work on sane lifecylce for SfxFilter
all SfxFilter instances should now be hold inside of a std::shared_ptr. This fixes a number of huge memory leaks in the test framework and removes one huge source of memory issue in sfx2. SfxMedium contains a pointer to the SfxFilter but does not own. Therefore it is required that any SfxFilter belonging to a SfxMedium lives longer. However this seems to work mostly by hoping that all SfxFilter instances are stored in a global array. As we have seen with the tests this is not true (there are also some cases inside of sd that seem to not follow that pattern as well). Change-Id: I12fd04a504cc4efc0a94967abd91c6fe2c6a8ce8 Reviewed-on: https://gerrit.libreoffice.org/23140 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
parent
fb827f2a34
commit
e94d5233dd
@ -197,7 +197,7 @@ void SvxHyperlinkNewDocTp::FillDocumentList ()
|
||||
aDocumentUrl = "private:factory/simpress"; // the AutoPilot for impress
|
||||
|
||||
// insert private-url and default-extension as user-data
|
||||
const SfxFilter* pFilter = SfxFilter::GetDefaultFilterFromFactory( aDocumentUrl );
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetDefaultFilterFromFactory( aDocumentUrl );
|
||||
if ( pFilter )
|
||||
{
|
||||
// insert doc-name and image
|
||||
|
@ -164,7 +164,7 @@ namespace svx
|
||||
{
|
||||
::sfx2::FileDialogHelper aFileDlg(
|
||||
ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, 0);
|
||||
const SfxFilter* pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
|
||||
if ( pFilter )
|
||||
{
|
||||
aFileDlg.AddFilter(pFilter->GetUIName(),pFilter->GetDefaultExtension());
|
||||
|
@ -380,7 +380,7 @@ void SAL_CALL OApplicationController::disposing()
|
||||
{
|
||||
OUString aFilter;
|
||||
INetURLObject aURL( m_xModel->getURL() );
|
||||
const SfxFilter* pFilter = getStandardDatabaseFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter();
|
||||
if ( pFilter )
|
||||
aFilter = pFilter->GetFilterName();
|
||||
|
||||
@ -1126,7 +1126,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
|
||||
0, getView());
|
||||
aFileDlg.SetDisplayDirectory( sUrl );
|
||||
|
||||
const SfxFilter* pFilter = getStandardDatabaseFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter();
|
||||
if ( pFilter )
|
||||
{
|
||||
aFileDlg.AddFilter(pFilter->GetUIName(),pFilter->GetDefaultExtension());
|
||||
|
@ -796,7 +796,7 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
|
||||
::sfx2::FileDialogHelper aFileDlg(
|
||||
ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
|
||||
0, this);
|
||||
const SfxFilter* pFilter = getStandardDatabaseFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter();
|
||||
if ( pFilter )
|
||||
{
|
||||
INetURLObject aWorkURL( m_sWorkPath );
|
||||
|
@ -719,7 +719,7 @@ namespace dbaui
|
||||
::sfx2::FileDialogHelper aFileDlg(
|
||||
ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
|
||||
0, OUString("sdatabase") );
|
||||
const SfxFilter* pFilter = getStandardDatabaseFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter();
|
||||
if ( pFilter )
|
||||
{
|
||||
aFileDlg.SetCurrentFilter(pFilter->GetUIName());
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include <vcl/taskpanelist.hxx>
|
||||
#include <connectivity/dbtools.hxx>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#define RET_ALL 10
|
||||
|
||||
// we only need forward decl here
|
||||
@ -366,7 +368,7 @@ namespace dbaui
|
||||
@retrun
|
||||
the filter
|
||||
*/
|
||||
const SfxFilter* getStandardDatabaseFilter();
|
||||
std::shared_ptr<const SfxFilter> getStandardDatabaseFilter();
|
||||
|
||||
/** opens a save dialog to store a form or report folder in the current hierarchy.
|
||||
@param _pParent
|
||||
|
@ -899,9 +899,9 @@ bool callColumnFormatDialog(vcl::Window* _pParent,
|
||||
return bRet;
|
||||
}
|
||||
|
||||
const SfxFilter* getStandardDatabaseFilter()
|
||||
std::shared_ptr<const SfxFilter> getStandardDatabaseFilter()
|
||||
{
|
||||
const SfxFilter* pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
|
||||
OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!");
|
||||
return pFilter;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ struct DispatchHolder
|
||||
namespace
|
||||
{
|
||||
|
||||
const SfxFilter* impl_lookupExportFilterForUrl( const rtl::OUString& rUrl, const rtl::OUString& rFactory )
|
||||
std::shared_ptr<const SfxFilter> impl_lookupExportFilterForUrl( const rtl::OUString& rUrl, const rtl::OUString& rFactory )
|
||||
{
|
||||
// create the list of filters
|
||||
OUStringBuffer sQuery(256);
|
||||
@ -105,7 +105,7 @@ const SfxFilter* impl_lookupExportFilterForUrl( const rtl::OUString& rUrl, const
|
||||
xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.document.FilterFactory", xContext ),
|
||||
UNO_QUERY_THROW );
|
||||
|
||||
const SfxFilter* pBestMatch = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pBestMatch;
|
||||
|
||||
const Reference< XEnumeration > xFilterEnum(
|
||||
xFilterFactory->createSubSetEnumerationByQuery( sQuery.makeStringAndClear() ), UNO_QUERY_THROW );
|
||||
@ -115,7 +115,7 @@ const SfxFilter* impl_lookupExportFilterForUrl( const rtl::OUString& rUrl, const
|
||||
const rtl::OUString aName( aFilterProps.getUnpackedValueOrDefault( "Name", rtl::OUString() ) );
|
||||
if ( !aName.isEmpty() )
|
||||
{
|
||||
const SfxFilter* const pFilter( SfxFilter::GetFilterByName( aName ) );
|
||||
std::shared_ptr<const SfxFilter> pFilter( SfxFilter::GetFilterByName( aName ) );
|
||||
if ( pFilter && pFilter->CanExport() && pFilter->GetWildcard().Matches( rUrl ) )
|
||||
{
|
||||
if ( !pBestMatch || ( SfxFilterFlags::PREFERED & pFilter->GetFilterFlags() ) )
|
||||
@ -127,7 +127,7 @@ const SfxFilter* impl_lookupExportFilterForUrl( const rtl::OUString& rUrl, const
|
||||
return pBestMatch;
|
||||
}
|
||||
|
||||
static const SfxFilter* impl_getExportFilterFromUrl(
|
||||
static std::shared_ptr<const SfxFilter> impl_getExportFilterFromUrl(
|
||||
const rtl::OUString& rUrl, const rtl::OUString& rFactory)
|
||||
{
|
||||
try
|
||||
@ -138,7 +138,7 @@ try
|
||||
UNO_QUERY_THROW );
|
||||
const rtl::OUString aTypeName( xTypeDetector->queryTypeByURL( rUrl ) );
|
||||
|
||||
const SfxFilter* pFilter( SfxFilterMatcher( rFactory ).GetFilter4EA( aTypeName, SfxFilterFlags::EXPORT ) );
|
||||
std::shared_ptr<const SfxFilter> pFilter( SfxFilterMatcher( rFactory ).GetFilter4EA( aTypeName, SfxFilterFlags::EXPORT ) );
|
||||
if ( !pFilter )
|
||||
pFilter = impl_lookupExportFilterForUrl( rUrl, rFactory );
|
||||
if ( !pFilter )
|
||||
@ -161,7 +161,7 @@ catch ( const Exception& )
|
||||
OUString impl_GuessFilter( const OUString& rUrlOut, const OUString& rDocService )
|
||||
{
|
||||
OUString aOutFilter;
|
||||
const SfxFilter* pOutFilter = impl_getExportFilterFromUrl( rUrlOut, rDocService );
|
||||
std::shared_ptr<const SfxFilter> pOutFilter = impl_getExportFilterFromUrl( rUrlOut, rDocService );
|
||||
if (pOutFilter)
|
||||
aOutFilter = pOutFilter->GetFilterName();
|
||||
|
||||
|
@ -35,9 +35,9 @@ namespace abp
|
||||
using namespace ::svt;
|
||||
using namespace ::utl;
|
||||
|
||||
const SfxFilter* lcl_getBaseFilter()
|
||||
std::shared_ptr<const SfxFilter> lcl_getBaseFilter()
|
||||
{
|
||||
const SfxFilter* pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
|
||||
OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!");
|
||||
return pFilter;
|
||||
}
|
||||
@ -111,7 +111,7 @@ namespace abp
|
||||
sPath += "/";
|
||||
sPath += rSettings.sDataSourceName;
|
||||
|
||||
const SfxFilter* pFilter = lcl_getBaseFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = lcl_getBaseFilter();
|
||||
if ( pFilter )
|
||||
{
|
||||
OUString sExt = pFilter->GetDefaultExtension();
|
||||
|
@ -199,7 +199,7 @@ namespace dbp
|
||||
ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, 0);
|
||||
aFileDlg.SetDisplayDirectory( SvtPathOptions().GetWorkPath() );
|
||||
|
||||
const SfxFilter* pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
|
||||
OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!");
|
||||
if ( pFilter )
|
||||
{
|
||||
|
@ -2900,7 +2900,7 @@ namespace pcr
|
||||
// is considered to be potentially expensive
|
||||
aFileDlg.SetDisplayDirectory( sDataSource );
|
||||
|
||||
const SfxFilter* pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
|
||||
OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!");
|
||||
if ( pFilter )
|
||||
{
|
||||
|
@ -6916,7 +6916,7 @@ css::uno::Reference < css::embed::XEmbeddedObject > SvxMSDffManager::CheckForCo
|
||||
if ( sStarName.getLength() )
|
||||
{
|
||||
//TODO/MBA: check if (and when) storage and stream will be destroyed!
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
std::unique_ptr<SvMemoryStream> xMemStream (new SvMemoryStream);
|
||||
if ( pName )
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef& rObj, SotSt
|
||||
{
|
||||
SvGlobalName aOwnGlobalName;
|
||||
SvGlobalName aObjName( rObj->getClassID() );
|
||||
const SfxFilter* pExpFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pExpFilter;
|
||||
{
|
||||
static struct _ObjExpType {
|
||||
sal_uInt32 nFlag;
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
SfxViewFactory* GetViewFactoryByViewName( const OUString& i_rViewName ) const;
|
||||
|
||||
// Filter
|
||||
const SfxFilter* GetTemplateFilter() const;
|
||||
std::shared_ptr<const SfxFilter> GetTemplateFilter() const;
|
||||
static OUString GetStandardTemplate( const OUString& rServiceName );
|
||||
static void SetStandardTemplate( const OUString& rServiceName, const OUString& rTemplateName );
|
||||
static void SetSystemTemplate( const OUString& rServiceName, const OUString& rTemplateName );
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
*/
|
||||
SfxMedium( const OUString &rName,
|
||||
StreamMode nOpenMode,
|
||||
const SfxFilter *pFilter = nullptr,
|
||||
std::shared_ptr<const SfxFilter> pFilter = nullptr,
|
||||
SfxItemSet *pSet = nullptr );
|
||||
/**
|
||||
* @param pSet Takes ownership
|
||||
@ -82,7 +82,7 @@ public:
|
||||
SfxMedium( const OUString &rName,
|
||||
const OUString &rReferer,
|
||||
StreamMode nOpenMode,
|
||||
const SfxFilter *pFilter = nullptr,
|
||||
std::shared_ptr<const SfxFilter> pFilter = nullptr,
|
||||
SfxItemSet *pSet = nullptr );
|
||||
|
||||
/**
|
||||
@ -113,9 +113,12 @@ public:
|
||||
void SetLoadTargetFrame(SfxFrame* pFrame );
|
||||
SfxFrame* GetLoadTargetFrame() const;
|
||||
|
||||
void SetFilter(const SfxFilter *pFlt);
|
||||
const SfxFilter* GetFilter() const;
|
||||
const SfxFilter* GetOrigFilter() const;
|
||||
/**
|
||||
* Does not take ownership of pFlt but pFlt needs to be around as long as the SfxMedium instance.
|
||||
*/
|
||||
void SetFilter(std::shared_ptr<const SfxFilter> pFilter);
|
||||
std::shared_ptr<const SfxFilter> GetFilter() const;
|
||||
std::shared_ptr<const SfxFilter> GetOrigFilter() const;
|
||||
const OUString& GetOrigURL() const;
|
||||
|
||||
SfxItemSet * GetItemSet() const;
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include <sfx2/dllapi.h>
|
||||
#include <tools/wldcrd.hxx>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class SfxFilterContainer;
|
||||
class SotStorage;
|
||||
|
||||
@ -104,9 +106,9 @@ public:
|
||||
const OUString& GetServiceName() const { return aServiceName; }
|
||||
const OUString& GetProviderName() const { return maProvider;}
|
||||
|
||||
static const SfxFilter* GetDefaultFilter( const OUString& rName );
|
||||
static const SfxFilter* GetFilterByName( const OUString& rName );
|
||||
static const SfxFilter* GetDefaultFilterFromFactory( const OUString& rServiceName );
|
||||
static std::shared_ptr<const SfxFilter> GetDefaultFilter( const OUString& rName );
|
||||
static std::shared_ptr<const SfxFilter> GetFilterByName( const OUString& rName );
|
||||
static std::shared_ptr<const SfxFilter> GetDefaultFilterFromFactory( const OUString& rServiceName );
|
||||
|
||||
static OUString GetTypeFromStorage( const SotStorage& rStg );
|
||||
static OUString GetTypeFromStorage(
|
||||
|
@ -66,17 +66,17 @@ public:
|
||||
|
||||
const OUString GetName() const;
|
||||
|
||||
const SfxFilter* GetAnyFilter( SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
const SfxFilter* GetFilter4EA( const OUString& rEA, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
const SfxFilter* GetFilter4Extension( const OUString& rExt, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
const SfxFilter* GetFilter4FilterName( const OUString& rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
std::shared_ptr<const SfxFilter> GetAnyFilter( SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
std::shared_ptr<const SfxFilter> GetFilter4EA( const OUString& rEA, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
std::shared_ptr<const SfxFilter> GetFilter4Extension( const OUString& rExt, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
std::shared_ptr<const SfxFilter> GetFilter4FilterName( const OUString& rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
|
||||
SAL_DLLPRIVATE static void ReadFilters_Impl( bool bUpdate=false );
|
||||
SAL_DLLPRIVATE static void ReadSingleFilter_Impl( const OUString& rName,
|
||||
const css::uno::Reference< css::container::XNameAccess >& xTypeCFG,
|
||||
const css::uno::Reference< css::container::XNameAccess >& xFilterCFG,
|
||||
bool bUpdate );
|
||||
SAL_DLLPRIVATE static const SfxFilter* GetDefaultFilter_Impl( const OUString& );
|
||||
SAL_DLLPRIVATE static std::shared_ptr<const SfxFilter> GetDefaultFilter_Impl( const OUString& );
|
||||
};
|
||||
|
||||
class SfxFilterMatcher_Impl;
|
||||
@ -92,22 +92,22 @@ public:
|
||||
SfxFilterMatcher(const SfxFilterMatcher&) = delete;
|
||||
SfxFilterMatcher& operator=( const SfxFilterMatcher& ) = delete;
|
||||
|
||||
SAL_DLLPRIVATE static bool IsFilterInstalled_Impl( const SfxFilter* pFilter );
|
||||
SAL_DLLPRIVATE static bool IsFilterInstalled_Impl( std::shared_ptr<const SfxFilter> pFilter );
|
||||
DECL_DLLPRIVATE_LINK_TYPED( MaybeFileHdl_Impl, OUString*, bool );
|
||||
|
||||
sal_uInt32 GuessFilterIgnoringContent( SfxMedium& rMedium, const SfxFilter ** ) const;
|
||||
sal_uInt32 GuessFilter( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
sal_uInt32 GuessFilterControlDefaultUI( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED, bool bDefUI = true ) const;
|
||||
sal_uInt32 DetectFilter( SfxMedium& rMedium, const SfxFilter ** ) const;
|
||||
sal_uInt32 GuessFilterIgnoringContent( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& ) const;
|
||||
sal_uInt32 GuessFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& , SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
sal_uInt32 GuessFilterControlDefaultUI( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>&, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED, bool bDefUI = true ) const;
|
||||
sal_uInt32 DetectFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& ) const;
|
||||
|
||||
const SfxFilter* GetFilter4Mime( const OUString& rMime, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED) const;
|
||||
const SfxFilter* GetFilter4ClipBoardId( SotClipboardFormatId nId, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
const SfxFilter* GetFilter4EA( const OUString& rEA, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
const SfxFilter* GetFilter4Extension( const OUString& rExt, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
const SfxFilter* GetFilter4FilterName( const OUString& rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
const SfxFilter* GetFilter4UIName( const OUString& rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
const SfxFilter* GetFilterForProps( const css::uno::Sequence < css::beans::NamedValue >& aSeq, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
const SfxFilter* GetAnyFilter( SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED ) const;
|
||||
std::shared_ptr<const SfxFilter> GetFilter4Mime( const OUString& rMime, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED) const;
|
||||
std::shared_ptr<const SfxFilter> GetFilter4ClipBoardId( SotClipboardFormatId nId, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
std::shared_ptr<const SfxFilter> GetFilter4EA( const OUString& rEA, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
std::shared_ptr<const SfxFilter> GetFilter4Extension( const OUString& rExt, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
std::shared_ptr<const SfxFilter> GetFilter4FilterName( const OUString& rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
std::shared_ptr<const SfxFilter> GetFilter4UIName( const OUString& rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
std::shared_ptr<const SfxFilter> GetFilterForProps( const css::uno::Sequence < css::beans::NamedValue >& aSeq, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
|
||||
std::shared_ptr<const SfxFilter> GetAnyFilter( SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED ) const;
|
||||
};
|
||||
|
||||
class SfxFilterContainer_Impl;
|
||||
@ -119,14 +119,14 @@ class SFX2_DLLPUBLIC SfxFilterMatcherIter
|
||||
sal_uInt16 nCurrent;
|
||||
const SfxFilterMatcher_Impl &m_rMatch;
|
||||
|
||||
SAL_DLLPRIVATE const SfxFilter* Find_Impl();
|
||||
SAL_DLLPRIVATE std::shared_ptr<const SfxFilter> Find_Impl();
|
||||
|
||||
public:
|
||||
SfxFilterMatcherIter( const SfxFilterMatcher& rMatcher, SfxFilterFlags nMask = SfxFilterFlags::NONE, SfxFilterFlags nNotMask = SFX_FILTER_NOTINSTALLED );
|
||||
SfxFilterMatcherIter(const SfxFilterMatcherIter&) = delete;
|
||||
SfxFilterMatcherIter& operator=( const SfxFilterMatcherIter& ) = delete;
|
||||
const SfxFilter* First();
|
||||
const SfxFilter* Next();
|
||||
std::shared_ptr<const SfxFilter> First();
|
||||
std::shared_ptr<const SfxFilter> Next();
|
||||
};
|
||||
|
||||
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include <sfx2/sfxuno.hxx>
|
||||
#include <sfx2/docfilt.hxx>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace com
|
||||
{
|
||||
namespace sun
|
||||
@ -248,7 +250,7 @@ ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType,
|
||||
const css::uno::Sequence< OUString >& rBlackList = css::uno::Sequence< OUString >());
|
||||
|
||||
|
||||
ErrCode RequestPassword(const SfxFilter* pCurrentFilter, OUString& aURL, SfxItemSet* pSet);
|
||||
ErrCode RequestPassword(std::shared_ptr<const SfxFilter> pCurrentFilter, OUString& aURL, SfxItemSet* pSet);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -55,7 +55,7 @@ namespace ooo
|
||||
{
|
||||
bool bRes( false );
|
||||
const SfxMedium *pMedium = rDocShell.GetMedium();
|
||||
const SfxFilter *pFilt = pMedium ? pMedium->GetFilter() : nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFilt = pMedium ? pMedium->GetFilter() : nullptr;
|
||||
if ( pFilt && pFilt->IsAlienFormat() )
|
||||
bRes = pFilt->GetMimeType().equalsAscii( pMimeType );
|
||||
return bRes;
|
||||
|
@ -167,7 +167,7 @@ OUString OReportEngineJFree::getNewOutputName()
|
||||
{
|
||||
MimeConfigurationHelper aConfighelper(m_xContext);
|
||||
const OUString sMimeType = m_xReport->getMimeType();
|
||||
const SfxFilter* pFilter = SfxFilter::GetDefaultFilter( aConfighelper.GetDocServiceNameFromMediaType(sMimeType) );
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetDefaultFilter( aConfighelper.GetDocServiceNameFromMediaType(sMimeType) );
|
||||
OUString sExt(".rpt");
|
||||
if ( pFilter )
|
||||
sExt = ::comphelper::string::stripStart(pFilter->GetDefaultExtension(), '*');
|
||||
|
@ -1666,7 +1666,7 @@ OUString GeometryHandler::impl_ConvertMimeTypeToUI_nothrow(const OUString& _sMim
|
||||
{
|
||||
::comphelper::MimeConfigurationHelper aMimeHelper(m_xContext);
|
||||
OUString sRet;
|
||||
const SfxFilter* pFilter = SfxFilter::GetDefaultFilter( aMimeHelper.GetDocServiceNameFromMediaType(_sMimetype) );
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetDefaultFilter( aMimeHelper.GetDocServiceNameFromMediaType(_sMimetype) );
|
||||
if ( pFilter )
|
||||
sRet = pFilter->GetUIName();
|
||||
if ( sRet.isEmpty() )
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
/** Create SfxMedium for stream read with SfxFilter and filter options set
|
||||
at the medium's SfxItemSet.
|
||||
*/
|
||||
static SfxMedium* CreateMedium( const OUString& rFileName, const SfxFilter* pFilter, const OUString& rOptions );
|
||||
static SfxMedium* CreateMedium( const OUString& rFileName, std::shared_ptr<const SfxFilter> pFilter, const OUString& rOptions );
|
||||
|
||||
static OUString GetOptions( SfxMedium& rMedium );
|
||||
|
||||
|
@ -539,12 +539,11 @@ ScDocShellRef ScBootstrapFixture::load( bool bReadWrite,
|
||||
const OUString& rTypeName, SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID,
|
||||
sal_uIntPtr nFilterVersion, const OUString* pPassword )
|
||||
{
|
||||
// TODO: will currently leak the pFilter instance
|
||||
SfxFilter* pFilter = new SfxFilter(
|
||||
std::shared_ptr<const SfxFilter> pFilter(new SfxFilter(
|
||||
rFilter,
|
||||
OUString(), nFilterFlags, nClipboardID, rTypeName, 0, OUString(),
|
||||
rUserData, OUString("private:factory/scalc*"));
|
||||
pFilter->SetVersion(nFilterVersion);
|
||||
rUserData, OUString("private:factory/scalc*")));
|
||||
const_cast<SfxFilter*>(pFilter.get())->SetVersion(nFilterVersion);
|
||||
|
||||
ScDocShellRef xDocShRef = new ScDocShell;
|
||||
xDocShRef->GetDocument().EnableUserInteraction(false);
|
||||
@ -632,12 +631,12 @@ ScDocShellRef ScBootstrapFixture::saveAndReload(
|
||||
SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE;
|
||||
if (nFormatType == ODS_FORMAT_TYPE)
|
||||
nExportFormat = SotClipboardFormatId::STARCHART_8;
|
||||
std::unique_ptr<SfxFilter> pExportFilter(new SfxFilter(
|
||||
std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter(
|
||||
rFilter,
|
||||
OUString(), nFormatType, nExportFormat, rTypeName, 0, OUString(),
|
||||
rUserData, OUString("private:factory/scalc*") ));
|
||||
pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
aStoreMedium.SetFilter(pExportFilter.get());
|
||||
const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
aStoreMedium.SetFilter(pExportFilter);
|
||||
pShell->DoSaveAs( aStoreMedium );
|
||||
pShell->DoClose();
|
||||
|
||||
@ -678,12 +677,12 @@ std::shared_ptr<utl::TempFile> ScBootstrapFixture::exportTo( ScDocShell* pShell,
|
||||
SfxFilterFlags nFormatType = aFileFormats[nFormat].nFormatType;
|
||||
if (nFormatType == ODS_FORMAT_TYPE)
|
||||
nExportFormat = SotClipboardFormatId::STARCHART_8;
|
||||
std::unique_ptr<SfxFilter> pExportFilter(new SfxFilter(
|
||||
std::shared_ptr<SfxFilter> pExportFilter(new SfxFilter(
|
||||
aFilterName,
|
||||
OUString(), nFormatType, nExportFormat, aFilterType, 0, OUString(),
|
||||
OUString(), OUString("private:factory/scalc*") ));
|
||||
pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
aStoreMedium.SetFilter(pExportFilter.get());
|
||||
const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
aStoreMedium.SetFilter(pExportFilter);
|
||||
pShell->DoSaveAs( aStoreMedium );
|
||||
pShell->DoClose();
|
||||
|
||||
|
@ -279,11 +279,11 @@ ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const OUSt
|
||||
SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE;
|
||||
if (nFormatType == ODS_FORMAT_TYPE)
|
||||
nExportFormat = SotClipboardFormatId::STARCHART_8;
|
||||
SfxFilter* pExportFilter = new SfxFilter(
|
||||
std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter(
|
||||
rFilter,
|
||||
OUString(), nFormatType, nExportFormat, rTypeName, 0, OUString(),
|
||||
rUserData, OUString("private:factory/scalc*") );
|
||||
pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
rUserData, OUString("private:factory/scalc*") ));
|
||||
const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
aStoreMedium.SetFilter(pExportFilter);
|
||||
SfxItemSet* pExportSet = aStoreMedium.GetItemSet();
|
||||
uno::Sequence< beans::NamedValue > aEncryptionData = comphelper::OStorageHelper::CreatePackageEncryptionData( "test" );
|
||||
|
@ -1517,17 +1517,17 @@ void ScFiltersTest::testPassword_Impl(const OUString& aFileNameBase)
|
||||
OUString aFilterType(getFileFormats()[0].pTypeName, strlen(getFileFormats()[0].pTypeName), RTL_TEXTENCODING_UTF8);
|
||||
|
||||
SotClipboardFormatId nFormat = SotClipboardFormatId::STARCALC_8;
|
||||
SfxFilter* aFilter = new SfxFilter(
|
||||
std::shared_ptr<const SfxFilter> pFilter(new SfxFilter(
|
||||
aFilterName,
|
||||
OUString(), getFileFormats()[0].nFormatType, nFormat, aFilterType, 0, OUString(),
|
||||
OUString(), OUString("private:factory/scalc*") );
|
||||
aFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
OUString(), OUString("private:factory/scalc*") ));
|
||||
const_cast<SfxFilter*>(pFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
|
||||
ScDocShellRef xDocSh = new ScDocShell;
|
||||
SfxMedium* pMedium = new SfxMedium(aFileName, STREAM_STD_READWRITE);
|
||||
SfxItemSet* pSet = pMedium->GetItemSet();
|
||||
pSet->Put(SfxStringItem(SID_PASSWORD, OUString("test")));
|
||||
pMedium->SetFilter(aFilter);
|
||||
pMedium->SetFilter(pFilter);
|
||||
if (!xDocSh->DoLoad(pMedium))
|
||||
{
|
||||
xDocSh->DoClose();
|
||||
|
@ -236,7 +236,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
|
||||
OUString aNewUrl( ScGlobal::GetAbsDocName( rNewFile, pImpl->m_pDocSh ) );
|
||||
bool bNewUrlName = (aNewUrl != aFileName);
|
||||
|
||||
const SfxFilter* pFilter = pImpl->m_pDocSh->GetFactory().GetFilterContainer()->GetFilter4FilterName(rNewFilter);
|
||||
std::shared_ptr<const SfxFilter> pFilter = pImpl->m_pDocSh->GetFactory().GetFilterContainer()->GetFilter4FilterName(rNewFilter);
|
||||
if (!pFilter)
|
||||
return false;
|
||||
|
||||
|
@ -1049,7 +1049,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
|
||||
const SfxUInt16Item* pUpdateDocItem = SfxItemSet::GetItem<SfxUInt16Item>(rMedium.GetItemSet(), SID_UPDATEDOCMODE, false);
|
||||
nCanUpdate = pUpdateDocItem ? pUpdateDocItem->GetValue() : css::document::UpdateDocMode::NO_UPDATE;
|
||||
|
||||
const SfxFilter* pFilter = rMedium.GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = rMedium.GetFilter();
|
||||
if (pFilter)
|
||||
{
|
||||
OUString aFltName = pFilter->GetFilterName();
|
||||
@ -1517,7 +1517,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
|
||||
|
||||
bool ScDocShell::LoadExternal( SfxMedium& rMed )
|
||||
{
|
||||
const SfxFilter* pFilter = rMed.GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = rMed.GetFilter();
|
||||
if (!pFilter)
|
||||
return false;
|
||||
|
||||
|
@ -718,7 +718,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
|
||||
// GetFilter needs name without the prefix.
|
||||
ScDocumentLoader::RemoveAppPrefix( aFilterName );
|
||||
|
||||
const SfxFilter* pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( aFilterName );
|
||||
std::shared_ptr<const SfxFilter> pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( aFilterName );
|
||||
SfxItemSet* pSet = new SfxAllItemSet( pApp->GetPool() );
|
||||
if (!aOptions.isEmpty())
|
||||
pSet->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, aOptions ) );
|
||||
|
@ -2431,7 +2431,7 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
|
||||
else
|
||||
ScDocumentLoader::GetFilterName(aFile, rFilter, aOptions, true, false);
|
||||
ScDocumentLoader::GetFilterName(aFile, rFilter, aOptions, true, false);
|
||||
const SfxFilter* pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName(rFilter);
|
||||
std::shared_ptr<const SfxFilter> pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName(rFilter);
|
||||
|
||||
if (pFileData->maRelativeName.isEmpty())
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
|
||||
OUString aNewUrl = ScGlobal::GetAbsDocName(rNewFile, pImpl->m_pDocSh);
|
||||
bool bNewUrlName = !aFileName.equals(aNewUrl);
|
||||
|
||||
const SfxFilter* pFilter = pImpl->m_pDocSh->GetFactory().GetFilterContainer()->GetFilter4FilterName(rNewFilter);
|
||||
std::shared_ptr<const SfxFilter> pFilter = pImpl->m_pDocSh->GetFactory().GetFilterContainer()->GetFilter4FilterName(rNewFilter);
|
||||
if (!pFilter)
|
||||
return false;
|
||||
|
||||
@ -462,7 +462,7 @@ bool ScDocumentLoader::GetFilterName( const OUString& rFileName,
|
||||
|
||||
// Filter-Detection
|
||||
|
||||
const SfxFilter* pSfxFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pSfxFilter;
|
||||
SfxMedium* pMedium = new SfxMedium( rFileName, STREAM_STD_READ );
|
||||
if ( pMedium->GetError() == ERRCODE_NONE )
|
||||
{
|
||||
@ -471,9 +471,9 @@ bool ScDocumentLoader::GetFilterName( const OUString& rFileName,
|
||||
|
||||
SfxFilterMatcher aMatcher("scalc");
|
||||
if( bWithContent )
|
||||
aMatcher.GuessFilter( *pMedium, &pSfxFilter );
|
||||
aMatcher.GuessFilter( *pMedium, pSfxFilter );
|
||||
else
|
||||
aMatcher.GuessFilterIgnoringContent( *pMedium, &pSfxFilter );
|
||||
aMatcher.GuessFilterIgnoringContent( *pMedium, pSfxFilter );
|
||||
}
|
||||
|
||||
bool bOK = false;
|
||||
@ -497,7 +497,7 @@ void ScDocumentLoader::RemoveAppPrefix( OUString& rFilterName )
|
||||
rFilterName = rFilterName.copy( aAppPrefix.getLength());
|
||||
}
|
||||
|
||||
SfxMedium* ScDocumentLoader::CreateMedium( const OUString& rFileName, const SfxFilter* pFilter,
|
||||
SfxMedium* ScDocumentLoader::CreateMedium( const OUString& rFileName, std::shared_ptr<const SfxFilter> pFilter,
|
||||
const OUString& rOptions )
|
||||
{
|
||||
// Always create SfxItemSet so ScDocShell can set options.
|
||||
@ -517,7 +517,7 @@ ScDocumentLoader::ScDocumentLoader( const OUString& rFileName,
|
||||
if ( rFilterName.isEmpty() )
|
||||
GetFilterName( rFileName, rFilterName, rOptions, true, bWithInteraction );
|
||||
|
||||
const SfxFilter* pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( rFilterName );
|
||||
std::shared_ptr<const SfxFilter> pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( rFilterName );
|
||||
|
||||
pMedium = CreateMedium( rFileName, pFilter, rOptions);
|
||||
if ( pMedium->GetError() != ERRCODE_NONE )
|
||||
|
@ -220,10 +220,10 @@ IMPL_LINK_TYPED( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFi
|
||||
const OUString aHTMLFilterName( FILTERNAME_HTML );
|
||||
const OUString aWebQFilterName( FILTERNAME_QUERY );
|
||||
|
||||
const SfxFilter* pFilter = pMed->GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = pMed->GetFilter();
|
||||
if (pFilter && aHTMLFilterName.equals(pFilter->GetFilterName()))
|
||||
{
|
||||
const SfxFilter* pNewFilter =
|
||||
std::shared_ptr<const SfxFilter> pNewFilter =
|
||||
ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( aWebQFilterName );
|
||||
if( pNewFilter )
|
||||
pMed->SetFilter( pNewFilter );
|
||||
|
@ -301,7 +301,7 @@ OUString SAL_CALL ScFilterDetect::detect( uno::Sequence<beans::PropertyValue>& l
|
||||
return OUString();
|
||||
|
||||
SfxFilterMatcher aMatcher("scalc");
|
||||
const SfxFilter* pFilter = aMatcher.GetFilter4FilterName(OUString::createFromAscii(pSearchFilterName));
|
||||
std::shared_ptr<const SfxFilter> pFilter = aMatcher.GetFilter4FilterName(OUString::createFromAscii(pSearchFilterName));
|
||||
|
||||
if (!pFilter)
|
||||
return OUString();
|
||||
|
@ -584,7 +584,7 @@ bool ScViewFunc::PasteFile( const Point& rPos, const OUString& rFile, bool bLink
|
||||
if (!bLink) // for bLink only graphics or URL
|
||||
{
|
||||
// 1. can I open the file?
|
||||
const SfxFilter* pFlt = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFlt;
|
||||
|
||||
// search only for its own filters, without selection box (as in ScDocumentLoader)
|
||||
SfxFilterMatcher aMatcher( ScDocShell::Factory().GetFilterContainer()->GetName() );
|
||||
@ -592,7 +592,7 @@ bool ScViewFunc::PasteFile( const Point& rPos, const OUString& rFile, bool bLink
|
||||
// #i73992# GuessFilter no longer calls UseInteractionHandler.
|
||||
// This is UI, so it can be called here.
|
||||
aSfxMedium.UseInteractionHandler(true);
|
||||
ErrCode nErr = aMatcher.GuessFilter( aSfxMedium, &pFlt );
|
||||
ErrCode nErr = aMatcher.GuessFilter( aSfxMedium, pFlt );
|
||||
|
||||
if ( pFlt && !nErr )
|
||||
{
|
||||
|
@ -63,15 +63,15 @@ bool SdFiltersTest::load(const OUString &rFilter, const OUString &rURL,
|
||||
const OUString &rUserData, SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID,
|
||||
unsigned int nFilterVersion)
|
||||
{
|
||||
SfxFilter aFilter(
|
||||
std::shared_ptr<const SfxFilter> pFilter(new SfxFilter(
|
||||
rFilter,
|
||||
OUString(), nFilterFlags, nClipboardID, OUString(), 0, OUString(),
|
||||
rUserData, OUString() );
|
||||
aFilter.SetVersion(nFilterVersion);
|
||||
rUserData, OUString() ));
|
||||
const_cast<SfxFilter*>(pFilter.get())->SetVersion(nFilterVersion);
|
||||
|
||||
::sd::DrawDocShellRef xDocShRef = new ::sd::DrawDocShell();
|
||||
SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ);
|
||||
pSrcMed->SetFilter(&aFilter);
|
||||
pSrcMed->SetFilter(pFilter);
|
||||
bool bLoaded = xDocShRef->DoLoad(pSrcMed);
|
||||
xDocShRef->DoClose();
|
||||
return bLoaded;
|
||||
|
@ -116,17 +116,18 @@ protected:
|
||||
SotClipboardFormatId nOptions = SotClipboardFormatId::NONE;
|
||||
if (pFmt->nFormatType != SfxFilterFlags::NONE)
|
||||
nOptions = SotClipboardFormatId::STARCALC_8;
|
||||
SfxFilter* aFilter = new SfxFilter(
|
||||
SfxFilter* pFilter = new SfxFilter(
|
||||
OUString::createFromAscii( pFmt->pFilterName ),
|
||||
OUString(), pFmt->nFormatType, nOptions,
|
||||
OUString::createFromAscii( pFmt->pTypeName ),
|
||||
0, OUString(),
|
||||
OUString::createFromAscii( pFmt->pUserData ),
|
||||
OUString("private:factory/simpress*") );
|
||||
aFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
std::shared_ptr<const SfxFilter> pFilt(pFilter);
|
||||
|
||||
::sd::DrawDocShellRef xDocShRef = new ::sd::DrawDocShell();
|
||||
SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ, aFilter, pParams);
|
||||
SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ, pFilt, pParams);
|
||||
if ( !xDocShRef->DoLoad(pSrcMed) || !xDocShRef.Is() )
|
||||
{
|
||||
if (xDocShRef.Is())
|
||||
@ -152,14 +153,14 @@ protected:
|
||||
SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE;
|
||||
if (pFormat->nFormatType == ODP_FORMAT_TYPE)
|
||||
nExportFormat = SotClipboardFormatId::STARCALC_8;
|
||||
SfxFilter* pExportFilter = new SfxFilter(
|
||||
std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter(
|
||||
OUString::createFromAscii(pFormat->pFilterName),
|
||||
OUString(), pFormat->nFormatType, nExportFormat,
|
||||
OUString::createFromAscii(pFormat->pTypeName),
|
||||
0, OUString(),
|
||||
OUString::createFromAscii(pFormat->pUserData),
|
||||
OUString("private:factory/simpress*") );
|
||||
pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
OUString("private:factory/simpress*") ));
|
||||
const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
aStoreMedium.SetFilter(pExportFilter);
|
||||
pShell->ConvertTo(aStoreMedium);
|
||||
pShell->DoClose();
|
||||
@ -171,14 +172,14 @@ protected:
|
||||
SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE;
|
||||
if (pFormat->nFormatType == ODP_FORMAT_TYPE)
|
||||
nExportFormat = SotClipboardFormatId::STARCHART_8;
|
||||
SfxFilter* pExportFilter = new SfxFilter(
|
||||
std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter(
|
||||
OUString::createFromAscii(pFormat->pFilterName),
|
||||
OUString(), pFormat->nFormatType, nExportFormat,
|
||||
OUString::createFromAscii(pFormat->pTypeName),
|
||||
0, OUString(),
|
||||
OUString::createFromAscii(pFormat->pUserData),
|
||||
OUString("private:factory/simpress*") );
|
||||
pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
OUString("private:factory/simpress*") ));
|
||||
const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
|
||||
aStoreMedium.SetFilter(pExportFilter);
|
||||
pShell->DoSaveAs(aStoreMedium);
|
||||
pShell->DoClose();
|
||||
|
@ -202,11 +202,11 @@ SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(SfxMedium& rMedium)
|
||||
bool bOK = true;
|
||||
SdDrawDocument* pBookmarkDoc = nullptr;
|
||||
OUString aBookmarkName = rMedium.GetName();
|
||||
const SfxFilter* pFilter = rMedium.GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = rMedium.GetFilter();
|
||||
if ( !pFilter )
|
||||
{
|
||||
rMedium.UseInteractionHandler( true );
|
||||
SfxGetpApp()->GetFilterMatcher().GuessFilter( rMedium, &pFilter );
|
||||
SfxGetpApp()->GetFilterMatcher().GuessFilter( rMedium, pFilter );
|
||||
}
|
||||
|
||||
if ( !pFilter )
|
||||
|
@ -783,7 +783,7 @@ bool SdXMLFilter::Import( ErrCode& nError )
|
||||
else
|
||||
{
|
||||
// check for binary formats
|
||||
const SfxFilter * pFilter = mrMedium.GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = mrMedium.GetFilter();
|
||||
if( pFilter )
|
||||
{
|
||||
OUString typeName(pFilter->GetRealTypeName());
|
||||
|
@ -579,7 +579,7 @@ bool SdNavigatorWin::InsertFile(const OUString& rFileName)
|
||||
else
|
||||
{
|
||||
// show dragged-in document
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
ErrCode nErr = 0;
|
||||
|
||||
if (aFileName != maDropFileName)
|
||||
@ -587,7 +587,7 @@ bool SdNavigatorWin::InsertFile(const OUString& rFileName)
|
||||
SfxMedium aMed(aFileName, (StreamMode::READ | StreamMode::SHARE_DENYNONE));
|
||||
SfxFilterMatcher aMatch( OUString("simpress") );
|
||||
aMed.UseInteractionHandler( true );
|
||||
nErr = aMatch.GuessFilter(aMed, &pFilter);
|
||||
nErr = aMatch.GuessFilter(aMed, pFilter);
|
||||
}
|
||||
|
||||
if ((pFilter && !nErr) || aFileName == maDropFileName)
|
||||
|
@ -572,7 +572,7 @@ bool DrawDocShell::ConvertTo( SfxMedium& rMedium )
|
||||
|
||||
if( mpDoc->GetPageCount() )
|
||||
{
|
||||
const SfxFilter* pMediumFilter = rMedium.GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pMediumFilter = rMedium.GetFilter();
|
||||
const OUString aTypeName( pMediumFilter->GetTypeName() );
|
||||
SdFilter* pFilter = nullptr;
|
||||
|
||||
@ -613,8 +613,6 @@ bool DrawDocShell::ConvertTo( SfxMedium& rMedium )
|
||||
bRet = pFilter->Export();
|
||||
if( !bRet )
|
||||
mpDoc->SetSwapGraphicsMode( nOldSwapMode );
|
||||
|
||||
delete pFilter;
|
||||
}
|
||||
}
|
||||
|
||||
@ -945,7 +943,7 @@ bool DrawDocShell::GetObjectIsmarked(const OUString& rBookmark, bool bRealizeMul
|
||||
bool DrawDocShell::SaveAsOwnFormat( SfxMedium& rMedium )
|
||||
{
|
||||
|
||||
const SfxFilter* pFilter = rMedium.GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = rMedium.GetFilter();
|
||||
|
||||
if (pFilter->IsOwnTemplateFormat())
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ OUString lcl_GetExtensionsList ( ::std::vector< FilterDesc > const& rFilterDescL
|
||||
}
|
||||
|
||||
void lcl_AddFilter ( ::std::vector< FilterDesc >& rFilterDescList,
|
||||
const SfxFilter *pFilter )
|
||||
std::shared_ptr<const SfxFilter> pFilter )
|
||||
{
|
||||
if (pFilter)
|
||||
rFilterDescList.push_back( ::std::make_pair( pFilter->GetUIName(), pFilter->GetDefaultExtension() ) );
|
||||
@ -165,7 +165,7 @@ void FuInsertFile::DoExecute( SfxRequest& rReq )
|
||||
try
|
||||
{
|
||||
// Get main filter
|
||||
const SfxFilter* pFilter = SfxFilter::GetDefaultFilterFromFactory( aOwnCont );
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetDefaultFilterFromFactory( aOwnCont );
|
||||
lcl_AddFilter( aFilterVector, pFilter );
|
||||
|
||||
// get template filter
|
||||
@ -259,9 +259,9 @@ void FuInsertFile::DoExecute( SfxRequest& rReq )
|
||||
mpDocSh->SetWaitCursor( true );
|
||||
|
||||
std::unique_ptr<SfxMedium> xMedium(new SfxMedium(aFile, StreamMode::READ | StreamMode::NOCREATE));
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
|
||||
SfxGetpApp()->GetFilterMatcher().GuessFilter(*xMedium, &pFilter);
|
||||
SfxGetpApp()->GetFilterMatcher().GuessFilter(*xMedium, pFilter);
|
||||
|
||||
bool bDrawMode = mpViewShell && dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr;
|
||||
bool bInserted = false;
|
||||
@ -726,7 +726,7 @@ bool FuInsertFile::InsSDDinOlMode(SfxMedium* pMedium)
|
||||
void FuInsertFile::GetSupportedFilterVector( ::std::vector< OUString >& rFilterVector )
|
||||
{
|
||||
SfxFilterMatcher& rMatcher = SfxGetpApp()->GetFilterMatcher();
|
||||
const SfxFilter* pSearchFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pSearchFilter;
|
||||
|
||||
rFilterVector.clear();
|
||||
|
||||
|
@ -123,7 +123,7 @@ OUString SAL_CALL SdFilterDetect::detect( Sequence< beans::PropertyValue >& lDes
|
||||
}
|
||||
|
||||
SfxFilterMatcher aMatch("sdraw");
|
||||
const SfxFilter* pFilter = aMatch.GetFilter4FilterName( aName );
|
||||
std::shared_ptr<const SfxFilter> pFilter = aMatch.GetFilter4FilterName( aName );
|
||||
if ( pFilter )
|
||||
return pFilter->GetRealTypeName();
|
||||
}
|
||||
|
@ -446,9 +446,9 @@ IMPL_LINK_NOARG_TYPED(View, DropInsertFileHdl, Idle *, void)
|
||||
}
|
||||
if( !bOK )
|
||||
{
|
||||
const SfxFilter* pFoundFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFoundFilter;
|
||||
SfxMedium aSfxMedium( aCurrentDropFile, StreamMode::READ | StreamMode::SHARE_DENYNONE );
|
||||
ErrCode nErr = SfxGetpApp()->GetFilterMatcher().GuessFilter( aSfxMedium, &pFoundFilter );
|
||||
ErrCode nErr = SfxGetpApp()->GetFilterMatcher().GuessFilter( aSfxMedium, pFoundFilter );
|
||||
|
||||
if( pFoundFilter && !nErr )
|
||||
{
|
||||
|
@ -20,9 +20,10 @@
|
||||
#define INCLUDED_SFX2_INC_ARRDECL_HXX
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
class SfxFilter;
|
||||
typedef ::std::vector< SfxFilter* > SfxFilterList_Impl;
|
||||
typedef ::std::vector< std::shared_ptr<const SfxFilter> > SfxFilterList_Impl;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -280,7 +280,7 @@ sal_uInt32 CheckPasswd_Impl
|
||||
|
||||
sal_uIntPtr SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUString &rFileName, bool bCopy, SfxItemSet* pSet )
|
||||
{
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
SfxMedium aMedium( rFileName, ( StreamMode::READ | StreamMode::SHARE_DENYNONE ) );
|
||||
|
||||
if ( !aMedium.GetStorage( false ).is() )
|
||||
@ -293,7 +293,7 @@ sal_uIntPtr SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUStri
|
||||
}
|
||||
|
||||
aMedium.UseInteractionHandler( true );
|
||||
sal_uIntPtr nErr = GetFilterMatcher().GuessFilter( aMedium,&pFilter,SfxFilterFlags::TEMPLATE, SfxFilterFlags::NONE );
|
||||
sal_uIntPtr nErr = GetFilterMatcher().GuessFilter( aMedium, pFilter, SfxFilterFlags::TEMPLATE, SfxFilterFlags::NONE );
|
||||
if ( 0 != nErr)
|
||||
{
|
||||
delete pSet;
|
||||
@ -830,7 +830,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
|
||||
|
||||
aTypeName = xTypeDetection->queryTypeByURL( aURL.Main );
|
||||
SfxFilterMatcher& rMatcher = SfxGetpApp()->GetFilterMatcher();
|
||||
const SfxFilter* pFilter = rMatcher.GetFilter4EA( aTypeName );
|
||||
std::shared_ptr<const SfxFilter> pFilter = rMatcher.GetFilter4EA( aTypeName );
|
||||
if (!pFilter || !lcl_isFilterNativelySupported(*pFilter))
|
||||
{
|
||||
// hyperlink does not link to own type => special handling (http, ftp) browser and (other external protocols) OS
|
||||
|
@ -191,7 +191,7 @@ void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh )
|
||||
|
||||
OUString aTitle = pDocSh->GetTitle(SFX_TITLE_PICKLIST);
|
||||
OUString aFilter;
|
||||
const SfxFilter* pFilter = pMed->GetOrigFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = pMed->GetOrigFilter();
|
||||
if ( pFilter )
|
||||
aFilter = pFilter->GetFilterName();
|
||||
|
||||
|
@ -446,7 +446,7 @@ IMPL_LINK_TYPED( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, /*unused
|
||||
|
||||
if ( !aFilterName.isEmpty() )
|
||||
{
|
||||
const SfxFilter* pFilter = SfxGetpApp()->GetFilterMatcher().GetFilter4UIName( aFilterName, SfxFilterFlags::NONE, SfxFilterFlags::NOTINFILEDLG );
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxGetpApp()->GetFilterMatcher().GetFilter4UIName( aFilterName, SfxFilterFlags::NONE, SfxFilterFlags::NOTINFILEDLG );
|
||||
|
||||
if ( pFilter )
|
||||
{
|
||||
|
@ -118,15 +118,7 @@ namespace
|
||||
{
|
||||
SfxFilterList_Impl aList;
|
||||
public:
|
||||
~SfxFilterArray()
|
||||
{
|
||||
SfxFilterList_Impl::iterator aEnd = aList.end();
|
||||
for (SfxFilterList_Impl::iterator aI = aList.begin(); aI != aEnd; ++aI)
|
||||
{
|
||||
SfxFilter *pFilter = *aI;
|
||||
delete pFilter;
|
||||
}
|
||||
}
|
||||
|
||||
SfxFilterList_Impl& getList()
|
||||
{
|
||||
return aList;
|
||||
@ -163,7 +155,7 @@ public:
|
||||
};
|
||||
|
||||
#define IMPL_FORWARD_LOOP( aMethod, ArgType, aArg ) \
|
||||
const SfxFilter* SfxFilterContainer::aMethod( ArgType aArg, SfxFilterFlags nMust, SfxFilterFlags nDont ) const \
|
||||
std::shared_ptr<const SfxFilter> SfxFilterContainer::aMethod( ArgType aArg, SfxFilterFlags nMust, SfxFilterFlags nDont ) const \
|
||||
{\
|
||||
SfxFilterMatcher aMatch( pImpl->aName ); \
|
||||
return aMatch.aMethod( aArg, nMust, nDont ); \
|
||||
@ -173,7 +165,7 @@ IMPL_FORWARD_LOOP( GetFilter4EA, const OUString&, rEA );
|
||||
IMPL_FORWARD_LOOP( GetFilter4Extension, const OUString&, rExt );
|
||||
IMPL_FORWARD_LOOP( GetFilter4FilterName, const OUString&, rName );
|
||||
|
||||
const SfxFilter* SfxFilterContainer::GetAnyFilter( SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
std::shared_ptr<const SfxFilter> SfxFilterContainer::GetAnyFilter( SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
{
|
||||
SfxFilterMatcher aMatch( pImpl->aName );
|
||||
return aMatch.GetAnyFilter( nMust, nDont );
|
||||
@ -196,7 +188,7 @@ const OUString SfxFilterContainer::GetName() const
|
||||
return pImpl->aName;
|
||||
}
|
||||
|
||||
const SfxFilter* SfxFilterContainer::GetDefaultFilter_Impl( const OUString& rName )
|
||||
std::shared_ptr<const SfxFilter> SfxFilterContainer::GetDefaultFilter_Impl( const OUString& rName )
|
||||
{
|
||||
// Try to find out the type of factory.
|
||||
// Interpret given name as Service- and ShortName!
|
||||
@ -218,7 +210,7 @@ const SfxFilter* SfxFilterContainer::GetDefaultFilter_Impl( const OUString& rNam
|
||||
// May the set default filter does not exists any longer or
|
||||
// does not fit the given factory.
|
||||
const SfxFilterMatcher aMatcher;
|
||||
const SfxFilter* pFilter = aMatcher.GetFilter4FilterName(sDefaultFilter);
|
||||
std::shared_ptr<const SfxFilter> pFilter = aMatcher.GetFilter4FilterName(sDefaultFilter);
|
||||
|
||||
if (
|
||||
pFilter &&
|
||||
@ -237,7 +229,7 @@ const SfxFilter* SfxFilterContainer::GetDefaultFilter_Impl( const OUString& rNam
|
||||
|
||||
for ( size_t i = 0, n = pFilterArr->size(); i < n; ++i )
|
||||
{
|
||||
const SfxFilter* pCheckFilter = (*pFilterArr)[i];
|
||||
std::shared_ptr<const SfxFilter> pCheckFilter = (*pFilterArr)[i];
|
||||
if ( pCheckFilter->GetServiceName().equalsIgnoreAsciiCase(sServiceName) )
|
||||
{
|
||||
pFilter = pCheckFilter;
|
||||
@ -328,7 +320,7 @@ void SfxFilterMatcher_Impl::Update() const
|
||||
pList->clear();
|
||||
for ( size_t i = 0, n = pFilterArr->size(); i < n; ++i )
|
||||
{
|
||||
SfxFilter* pFilter = (*pFilterArr)[i];
|
||||
std::shared_ptr<const SfxFilter> pFilter = (*pFilterArr)[i];
|
||||
if ( pFilter->GetServiceName() == aName )
|
||||
pList->push_back( pFilter );
|
||||
}
|
||||
@ -357,12 +349,12 @@ void SfxFilterMatcher_Impl::InitForIterating() const
|
||||
}
|
||||
}
|
||||
|
||||
const SfxFilter* SfxFilterMatcher::GetAnyFilter( SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetAnyFilter( SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
{
|
||||
m_rImpl.InitForIterating();
|
||||
for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i )
|
||||
{
|
||||
const SfxFilter* pFilter = (*m_rImpl.pList)[i];
|
||||
std::shared_ptr<const SfxFilter> pFilter = (*m_rImpl.pList)[i];
|
||||
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
|
||||
if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) )
|
||||
return pFilter;
|
||||
@ -374,7 +366,7 @@ const SfxFilter* SfxFilterMatcher::GetAnyFilter( SfxFilterFlags nMust, SfxFilter
|
||||
|
||||
sal_uInt32 SfxFilterMatcher::GuessFilterIgnoringContent(
|
||||
SfxMedium& rMedium,
|
||||
const SfxFilter**ppFilter ) const
|
||||
std::shared_ptr<const SfxFilter>& rpFilter ) const
|
||||
{
|
||||
uno::Reference<document::XTypeDetection> xDetection(
|
||||
comphelper::getProcessServiceFactory()->createInstance("com.sun.star.document.TypeDetection"), uno::UNO_QUERY);
|
||||
@ -388,27 +380,27 @@ sal_uInt32 SfxFilterMatcher::GuessFilterIgnoringContent(
|
||||
{
|
||||
}
|
||||
|
||||
*ppFilter = nullptr;
|
||||
rpFilter = nullptr;
|
||||
if ( !sTypeName.isEmpty() )
|
||||
{
|
||||
// make sure filter list is initialized
|
||||
m_rImpl.InitForIterating();
|
||||
*ppFilter = GetFilter4EA( sTypeName );
|
||||
rpFilter = GetFilter4EA( sTypeName );
|
||||
}
|
||||
|
||||
return *ppFilter ? ERRCODE_NONE : ERRCODE_ABORT;
|
||||
return rpFilter ? ERRCODE_NONE : ERRCODE_ABORT;
|
||||
}
|
||||
|
||||
|
||||
sal_uInt32 SfxFilterMatcher::GuessFilter( SfxMedium& rMedium, const SfxFilter**ppFilter, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
sal_uInt32 SfxFilterMatcher::GuessFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& rpFilter, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
{
|
||||
return GuessFilterControlDefaultUI( rMedium, ppFilter, nMust, nDont );
|
||||
return GuessFilterControlDefaultUI( rMedium, rpFilter, nMust, nDont );
|
||||
}
|
||||
|
||||
|
||||
sal_uInt32 SfxFilterMatcher::GuessFilterControlDefaultUI( SfxMedium& rMedium, const SfxFilter** ppFilter, SfxFilterFlags nMust, SfxFilterFlags nDont, bool /*bDefUI*/ ) const
|
||||
sal_uInt32 SfxFilterMatcher::GuessFilterControlDefaultUI( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& rpFilter, SfxFilterFlags nMust, SfxFilterFlags nDont, bool /*bDefUI*/ ) const
|
||||
{
|
||||
const SfxFilter* pOldFilter = *ppFilter;
|
||||
std::shared_ptr<const SfxFilter> pOldFilter = rpFilter;
|
||||
|
||||
// no detection service -> nothing to do !
|
||||
uno::Reference<document::XTypeDetection> xDetection(
|
||||
@ -467,14 +459,14 @@ sal_uInt32 SfxFilterMatcher::GuessFilterControlDefaultUI( SfxMedium& rMedium, c
|
||||
|
||||
if (!sTypeName.isEmpty())
|
||||
{
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pNewFilter;
|
||||
if (!aFilterName.isEmpty())
|
||||
// Type detection returned a suitable filter for this. Use it.
|
||||
pFilter = SfxFilter::GetFilterByName(aFilterName);
|
||||
pNewFilter = SfxFilter::GetFilterByName(aFilterName);
|
||||
|
||||
// fdo#78742 respect requested document service if set
|
||||
if (!pFilter || (!m_rImpl.aName.isEmpty()
|
||||
&& m_rImpl.aName != pFilter->GetServiceName()))
|
||||
if (!pNewFilter || (!m_rImpl.aName.isEmpty()
|
||||
&& m_rImpl.aName != pNewFilter->GetServiceName()))
|
||||
{
|
||||
// detect filter by given type
|
||||
// In case of this matcher is bound to a particular document type:
|
||||
@ -483,12 +475,12 @@ sal_uInt32 SfxFilterMatcher::GuessFilterControlDefaultUI( SfxMedium& rMedium, c
|
||||
// This "wrong" type will be sorted out now because we match only allowed filters to the detected type
|
||||
uno::Sequence< beans::NamedValue > lQuery { { "Name", css::uno::makeAny(sTypeName) } };
|
||||
|
||||
pFilter = GetFilterForProps(lQuery, nMust, nDont);
|
||||
pNewFilter = GetFilterForProps(lQuery, nMust, nDont);
|
||||
}
|
||||
|
||||
if (pFilter)
|
||||
if (pNewFilter)
|
||||
{
|
||||
*ppFilter = pFilter;
|
||||
rpFilter = pNewFilter;
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
}
|
||||
@ -500,7 +492,7 @@ sal_uInt32 SfxFilterMatcher::GuessFilterControlDefaultUI( SfxMedium& rMedium, c
|
||||
}
|
||||
|
||||
|
||||
bool SfxFilterMatcher::IsFilterInstalled_Impl( const SfxFilter* pFilter )
|
||||
bool SfxFilterMatcher::IsFilterInstalled_Impl( std::shared_ptr<const SfxFilter> pFilter )
|
||||
{
|
||||
if ( pFilter->GetFilterFlags() & SfxFilterFlags::MUSTINSTALL )
|
||||
{
|
||||
@ -533,14 +525,14 @@ bool SfxFilterMatcher::IsFilterInstalled_Impl( const SfxFilter* pFilter )
|
||||
}
|
||||
|
||||
|
||||
sal_uInt32 SfxFilterMatcher::DetectFilter( SfxMedium& rMedium, const SfxFilter**ppFilter ) const
|
||||
sal_uInt32 SfxFilterMatcher::DetectFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& rpFilter ) const
|
||||
/* [Description]
|
||||
|
||||
Here the Filter selection box is pulled up. Otherwise GuessFilter
|
||||
*/
|
||||
|
||||
{
|
||||
const SfxFilter* pOldFilter = rMedium.GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pOldFilter = rMedium.GetFilter();
|
||||
if ( pOldFilter )
|
||||
{
|
||||
if( !IsFilterInstalled_Impl( pOldFilter ) )
|
||||
@ -554,29 +546,29 @@ sal_uInt32 SfxFilterMatcher::DetectFilter( SfxMedium& rMedium, const SfxFilter**
|
||||
}
|
||||
}
|
||||
|
||||
const SfxFilter* pFilter = pOldFilter;
|
||||
std::shared_ptr<const SfxFilter> pFilter = pOldFilter;
|
||||
|
||||
bool bPreview = rMedium.IsPreview_Impl();
|
||||
const SfxStringItem* pReferer = SfxItemSet::GetItem<SfxStringItem>(rMedium.GetItemSet(), SID_REFERER, false);
|
||||
if ( bPreview && rMedium.IsRemote() && ( !pReferer || !pReferer->GetValue().match("private:searchfolder:") ) )
|
||||
return ERRCODE_ABORT;
|
||||
|
||||
ErrCode nErr = GuessFilter( rMedium, &pFilter );
|
||||
ErrCode nErr = GuessFilter( rMedium, pFilter );
|
||||
if ( nErr == ERRCODE_ABORT )
|
||||
return nErr;
|
||||
|
||||
if ( nErr == ERRCODE_IO_PENDING )
|
||||
{
|
||||
*ppFilter = pFilter;
|
||||
rpFilter = pFilter;
|
||||
return nErr;
|
||||
}
|
||||
|
||||
if ( !pFilter )
|
||||
{
|
||||
const SfxFilter* pInstallFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pInstallFilter;
|
||||
|
||||
// Now test the filter which are not installed (ErrCode is irrelevant)
|
||||
GuessFilter( rMedium, &pInstallFilter, SfxFilterFlags::IMPORT, SfxFilterFlags::CONSULTSERVICE );
|
||||
GuessFilter( rMedium, pInstallFilter, SfxFilterFlags::IMPORT, SfxFilterFlags::CONSULTSERVICE );
|
||||
if ( pInstallFilter )
|
||||
{
|
||||
if ( IsFilterInstalled_Impl( pInstallFilter ) )
|
||||
@ -587,7 +579,7 @@ sal_uInt32 SfxFilterMatcher::DetectFilter( SfxMedium& rMedium, const SfxFilter**
|
||||
{
|
||||
// Now test the filter, which first must be obtained by Star
|
||||
// (ErrCode is irrelevant)
|
||||
GuessFilter( rMedium, &pInstallFilter, SfxFilterFlags::IMPORT, SfxFilterFlags::NONE );
|
||||
GuessFilter( rMedium, pInstallFilter, SfxFilterFlags::IMPORT, SfxFilterFlags::NONE );
|
||||
if ( pInstallFilter )
|
||||
IsFilterInstalled_Impl( pInstallFilter );
|
||||
}
|
||||
@ -602,14 +594,14 @@ sal_uInt32 SfxFilterMatcher::DetectFilter( SfxMedium& rMedium, const SfxFilter**
|
||||
if( -1 != aFlags.indexOf( 'H' ) )
|
||||
bHidden = true;
|
||||
}
|
||||
*ppFilter = pFilter;
|
||||
rpFilter = pFilter;
|
||||
|
||||
if ( bHidden )
|
||||
nErr = pFilter ? ERRCODE_NONE : ERRCODE_ABORT;
|
||||
return nErr;
|
||||
}
|
||||
|
||||
const SfxFilter* SfxFilterMatcher::GetFilterForProps( const css::uno::Sequence < beans::NamedValue >& aSeq, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilterForProps( const css::uno::Sequence < beans::NamedValue >& aSeq, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
{
|
||||
uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
|
||||
uno::Reference< container::XContainerQuery > xTypeCFG;
|
||||
@ -627,7 +619,7 @@ const SfxFilter* SfxFilterMatcher::GetFilterForProps( const css::uno::Sequence <
|
||||
// try to get the preferred filter (works without loading all filters!)
|
||||
if ( (aProps[OUString("PreferredFilter")] >>= aValue) && !aValue.isEmpty() )
|
||||
{
|
||||
const SfxFilter* pFilter = SfxFilter::GetFilterByName( aValue );
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName( aValue );
|
||||
if ( !pFilter || (pFilter->GetFilterFlags() & nMust) != nMust || (pFilter->GetFilterFlags() & nDont ) )
|
||||
// check for filter flags
|
||||
// pFilter == 0: if preferred filter is a Writer filter, but Writer module is not installed
|
||||
@ -657,13 +649,13 @@ const SfxFilter* SfxFilterMatcher::GetFilterForProps( const css::uno::Sequence <
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const SfxFilter* SfxFilterMatcher::GetFilter4Mime( const OUString& rMediaType, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4Mime( const OUString& rMediaType, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
{
|
||||
if ( m_rImpl.pList )
|
||||
{
|
||||
for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i )
|
||||
{
|
||||
const SfxFilter* pFilter = (*m_rImpl.pList)[i];
|
||||
std::shared_ptr<const SfxFilter> pFilter = (*m_rImpl.pList)[i];
|
||||
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
|
||||
if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetMimeType() == rMediaType )
|
||||
return pFilter;
|
||||
@ -676,14 +668,14 @@ const SfxFilter* SfxFilterMatcher::GetFilter4Mime( const OUString& rMediaType, S
|
||||
return GetFilterForProps( aSeq, nMust, nDont );
|
||||
}
|
||||
|
||||
const SfxFilter* SfxFilterMatcher::GetFilter4EA( const OUString& rType, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4EA( const OUString& rType, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
{
|
||||
if ( m_rImpl.pList )
|
||||
{
|
||||
const SfxFilter* pFirst = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFirst;
|
||||
for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i )
|
||||
{
|
||||
const SfxFilter* pFilter = (*m_rImpl.pList)[i];
|
||||
std::shared_ptr<const SfxFilter> pFilter = (*m_rImpl.pList)[i];
|
||||
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
|
||||
if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetTypeName() == rType )
|
||||
{
|
||||
@ -703,13 +695,13 @@ const SfxFilter* SfxFilterMatcher::GetFilter4EA( const OUString& rType, SfxFilte
|
||||
return GetFilterForProps( aSeq, nMust, nDont );
|
||||
}
|
||||
|
||||
const SfxFilter* SfxFilterMatcher::GetFilter4Extension( const OUString& rExt, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4Extension( const OUString& rExt, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
{
|
||||
if ( m_rImpl.pList )
|
||||
{
|
||||
for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i )
|
||||
{
|
||||
const SfxFilter* pFilter = (*m_rImpl.pList)[i];
|
||||
std::shared_ptr<const SfxFilter> pFilter = (*m_rImpl.pList)[i];
|
||||
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
|
||||
if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) )
|
||||
{
|
||||
@ -741,7 +733,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4Extension( const OUString& rExt, Sf
|
||||
return GetFilterForProps( aSeq, nMust, nDont );
|
||||
}
|
||||
|
||||
const SfxFilter* SfxFilterMatcher::GetFilter4ClipBoardId( SotClipboardFormatId nId, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4ClipBoardId( SotClipboardFormatId nId, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
{
|
||||
if (nId == SotClipboardFormatId::NONE)
|
||||
return nullptr;
|
||||
@ -751,13 +743,13 @@ const SfxFilter* SfxFilterMatcher::GetFilter4ClipBoardId( SotClipboardFormatId n
|
||||
return GetFilterForProps( aSeq, nMust, nDont );
|
||||
}
|
||||
|
||||
const SfxFilter* SfxFilterMatcher::GetFilter4UIName( const OUString& rName, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4UIName( const OUString& rName, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
{
|
||||
m_rImpl.InitForIterating();
|
||||
const SfxFilter* pFirstFilter=nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFirstFilter;
|
||||
for ( size_t i = 0, n = m_rImpl.pList->size(); i < n; ++i )
|
||||
{
|
||||
const SfxFilter* pFilter = (*m_rImpl.pList)[i];
|
||||
std::shared_ptr<const SfxFilter> pFilter = (*m_rImpl.pList)[i];
|
||||
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
|
||||
if ( (nFlags & nMust) == nMust &&
|
||||
!(nFlags & nDont ) && pFilter->GetUIName() == rName )
|
||||
@ -771,7 +763,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4UIName( const OUString& rName, SfxF
|
||||
return pFirstFilter;
|
||||
}
|
||||
|
||||
const SfxFilter* SfxFilterMatcher::GetFilter4FilterName( const OUString& rName, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4FilterName( const OUString& rName, SfxFilterFlags nMust, SfxFilterFlags nDont ) const
|
||||
{
|
||||
OUString aName( rName );
|
||||
sal_Int32 nIndex = aName.indexOf(": ");
|
||||
@ -800,7 +792,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4FilterName( const OUString& rName,
|
||||
{
|
||||
for ( size_t i = 0, n = pFilterArr->size(); i < n; ++i )
|
||||
{
|
||||
const SfxFilter* pFilter = (*pFilterArr)[i];
|
||||
std::shared_ptr<const SfxFilter> pFilter = (*pFilterArr)[i];
|
||||
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
|
||||
if ((nFlags & nMust) == nMust && !(nFlags & nDont) && pFilter->GetFilterName().equalsIgnoreAsciiCase(aName))
|
||||
return pFilter;
|
||||
@ -817,7 +809,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4FilterName( const OUString& rName,
|
||||
|
||||
for ( size_t i = 0, n = pList->size(); i < n; ++i )
|
||||
{
|
||||
const SfxFilter* pFilter = (*pList)[i];
|
||||
std::shared_ptr<const SfxFilter> pFilter = (*pList)[i];
|
||||
SfxFilterFlags nFlags = pFilter->GetFilterFlags();
|
||||
if ( (nFlags & nMust) == nMust && !(nFlags & nDont ) && pFilter->GetFilterName().equalsIgnoreAsciiCase(aName))
|
||||
return pFilter;
|
||||
@ -828,7 +820,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4FilterName( const OUString& rName,
|
||||
|
||||
IMPL_LINK_TYPED( SfxFilterMatcher, MaybeFileHdl_Impl, OUString*, pString, bool )
|
||||
{
|
||||
const SfxFilter* pFilter = GetFilter4Extension( *pString );
|
||||
std::shared_ptr<const SfxFilter> pFilter = GetFilter4Extension( *pString );
|
||||
if (pFilter && !pFilter->GetWildcard().Matches( OUString() ) &&
|
||||
!pFilter->GetWildcard().Matches("*.*") &&
|
||||
!pFilter->GetWildcard().Matches(OUString('*'))
|
||||
@ -852,9 +844,9 @@ SfxFilterMatcherIter::SfxFilterMatcherIter(
|
||||
}
|
||||
|
||||
|
||||
const SfxFilter* SfxFilterMatcherIter::Find_Impl()
|
||||
std::shared_ptr<const SfxFilter> SfxFilterMatcherIter::Find_Impl()
|
||||
{
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
while( nCurrent < m_rMatch.pList->size() )
|
||||
{
|
||||
pFilter = (*m_rMatch.pList)[nCurrent++];
|
||||
@ -867,14 +859,14 @@ const SfxFilter* SfxFilterMatcherIter::Find_Impl()
|
||||
return pFilter;
|
||||
}
|
||||
|
||||
const SfxFilter* SfxFilterMatcherIter::First()
|
||||
std::shared_ptr<const SfxFilter> SfxFilterMatcherIter::First()
|
||||
{
|
||||
nCurrent = 0;
|
||||
return Find_Impl();
|
||||
}
|
||||
|
||||
|
||||
const SfxFilter* SfxFilterMatcherIter::Next()
|
||||
std::shared_ptr<const SfxFilter> SfxFilterMatcherIter::Next()
|
||||
{
|
||||
return Find_Impl();
|
||||
}
|
||||
@ -1063,12 +1055,10 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
|
||||
sFilterName = sFilterName.copy( nStartRealName+2 );
|
||||
}
|
||||
|
||||
SfxFilter* pFilter = bUpdate ? const_cast<SfxFilter*>(SfxFilter::GetFilterByName( sFilterName )) : nullptr;
|
||||
bool bNew = false;
|
||||
std::shared_ptr<const SfxFilter> pFilter = bUpdate ? SfxFilter::GetFilterByName( sFilterName ) : nullptr;
|
||||
if (!pFilter)
|
||||
{
|
||||
bNew = true;
|
||||
pFilter = new SfxFilter( sFilterName ,
|
||||
pFilter.reset(new SfxFilter( sFilterName ,
|
||||
sExtension ,
|
||||
nFlags ,
|
||||
nClipboardId ,
|
||||
@ -1076,33 +1066,34 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
|
||||
(sal_uInt16)nDocumentIconId ,
|
||||
sMimeType ,
|
||||
sUserData ,
|
||||
sServiceName );
|
||||
sServiceName ));
|
||||
rList.push_back( pFilter );
|
||||
}
|
||||
else
|
||||
{
|
||||
pFilter->maFilterName = sFilterName;
|
||||
pFilter->aWildCard = WildCard(sExtension, ';');
|
||||
pFilter->nFormatType = nFlags;
|
||||
pFilter->lFormat = nClipboardId;
|
||||
pFilter->aTypeName = sType;
|
||||
pFilter->nDocIcon = (sal_uInt16)nDocumentIconId;
|
||||
pFilter->aMimeType = sMimeType;
|
||||
pFilter->aUserData = sUserData;
|
||||
pFilter->aServiceName = sServiceName;
|
||||
SfxFilter* pFilt = const_cast<SfxFilter*>(pFilter.get());
|
||||
pFilt->maFilterName = sFilterName;
|
||||
pFilt->aWildCard = WildCard(sExtension, ';');
|
||||
pFilt->nFormatType = nFlags;
|
||||
pFilt->lFormat = nClipboardId;
|
||||
pFilt->aTypeName = sType;
|
||||
pFilt->nDocIcon = (sal_uInt16)nDocumentIconId;
|
||||
pFilt->aMimeType = sMimeType;
|
||||
pFilt->aUserData = sUserData;
|
||||
pFilt->aServiceName = sServiceName;
|
||||
}
|
||||
|
||||
SfxFilter* pFilt = const_cast<SfxFilter*>(pFilter.get());
|
||||
|
||||
// Don't forget to set right UIName!
|
||||
// Otherwise internal name is used as fallback ...
|
||||
pFilter->SetUIName( sUIName );
|
||||
pFilter->SetDefaultTemplate( sDefaultTemplate );
|
||||
pFilt->SetUIName( sUIName );
|
||||
pFilt->SetDefaultTemplate( sDefaultTemplate );
|
||||
if( nFormatVersion )
|
||||
{
|
||||
pFilter->SetVersion( nFormatVersion );
|
||||
pFilt->SetVersion( nFormatVersion );
|
||||
}
|
||||
pFilter->SetURLPattern(sPattern);
|
||||
|
||||
if (bNew)
|
||||
rList.push_back( pFilter );
|
||||
pFilt->SetURLPattern(sPattern);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1139,11 +1130,11 @@ void SfxFilterContainer::ReadFilters_Impl( bool bUpdate )
|
||||
if( !rList.empty() )
|
||||
{
|
||||
bUpdate = true;
|
||||
SfxFilter* pFilter;
|
||||
for ( size_t i = 0, n = rList.size(); i < n; ++i )
|
||||
{
|
||||
pFilter = rList[ i ];
|
||||
pFilter->nFormatType |= SFX_FILTER_NOTINSTALLED;
|
||||
std::shared_ptr<const SfxFilter> pFilter = rList[i];
|
||||
SfxFilter* pNonConstFilter = const_cast<SfxFilter*>(pFilter.get());
|
||||
pNonConstFilter->nFormatType |= SFX_FILTER_NOTINSTALLED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -867,7 +867,7 @@ IMPL_STATIC_LINK_NOARG_TYPED(SfxDocumentPage, ChangePassHdl, Button*, void)
|
||||
SfxItemSet* pMedSet = pShell->GetMedium()->GetItemSet();
|
||||
if (!pMedSet)
|
||||
break;
|
||||
const SfxFilter* pFilter = pShell->GetMedium()->GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = pShell->GetMedium()->GetFilter();
|
||||
if (!pFilter)
|
||||
break;
|
||||
|
||||
|
@ -362,15 +362,14 @@ void FileDialogHelper_Impl::SaveLastUsedFilter()
|
||||
SaveLastUsedFilter( *pConfigId );
|
||||
}
|
||||
|
||||
const SfxFilter* FileDialogHelper_Impl::getCurentSfxFilter()
|
||||
std::shared_ptr<const SfxFilter> FileDialogHelper_Impl::getCurentSfxFilter()
|
||||
{
|
||||
OUString aFilterName = getCurrentFilterUIName();
|
||||
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
if ( mpMatcher && !aFilterName.isEmpty() )
|
||||
pFilter = mpMatcher->GetFilter4UIName( aFilterName, m_nMustFlags, m_nDontFlags );
|
||||
return mpMatcher->GetFilter4UIName( aFilterName, m_nMustFlags, m_nDontFlags );
|
||||
|
||||
return pFilter;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool FileDialogHelper_Impl::updateExtendedControl( sal_Int16 _nExtendedControlId, bool _bEnable )
|
||||
@ -393,7 +392,7 @@ bool FileDialogHelper_Impl::updateExtendedControl( sal_Int16 _nExtendedControlId
|
||||
return bIsEnabled;
|
||||
}
|
||||
|
||||
bool FileDialogHelper_Impl::CheckFilterOptionsCapability( const SfxFilter* _pFilter )
|
||||
bool FileDialogHelper_Impl::CheckFilterOptionsCapability( std::shared_ptr<const SfxFilter> _pFilter )
|
||||
{
|
||||
bool bResult = false;
|
||||
|
||||
@ -512,7 +511,7 @@ void FileDialogHelper_Impl::updateSelectionBox()
|
||||
|
||||
if ( bSelectionBoxFound )
|
||||
{
|
||||
const SfxFilter* pFilter = getCurentSfxFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = getCurentSfxFilter();
|
||||
mbSelectionFltrEnabled = updateExtendedControl(
|
||||
ExtendedFilePickerElementIds::CHECKBOX_SELECTION,
|
||||
( mbSelectionEnabled && pFilter && ( pFilter->GetFilterFlags() & SfxFilterFlags::SUPPORTSSELECTION ) ) );
|
||||
@ -528,7 +527,7 @@ void FileDialogHelper_Impl::enablePasswordBox( bool bInit )
|
||||
|
||||
bool bWasEnabled = mbIsPwdEnabled;
|
||||
|
||||
const SfxFilter* pCurrentFilter = getCurentSfxFilter();
|
||||
std::shared_ptr<const SfxFilter> pCurrentFilter = getCurentSfxFilter();
|
||||
mbIsPwdEnabled = updateExtendedControl(
|
||||
ExtendedFilePickerElementIds::CHECKBOX_PASSWORD,
|
||||
pCurrentFilter && ( pCurrentFilter->GetFilterFlags() & SfxFilterFlags::ENCRYPTION )
|
||||
@ -1305,7 +1304,7 @@ void lcl_saveLastURLs(std::vector<OUString>& rpURLList,
|
||||
lLastURLs.push_back(*i);
|
||||
}
|
||||
|
||||
void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterface >& xPicker, std::vector<OUString>& rpURLList, const SfxFilter* pFilter)
|
||||
void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterface >& xPicker, std::vector<OUString>& rpURLList, std::shared_ptr<const SfxFilter> pFilter)
|
||||
{
|
||||
rpURLList.clear();
|
||||
|
||||
@ -1471,7 +1470,7 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList,
|
||||
// set the filter
|
||||
getRealFilter( rFilter );
|
||||
|
||||
const SfxFilter* pCurrentFilter = getCurentSfxFilter();
|
||||
std::shared_ptr<const SfxFilter> pCurrentFilter = getCurentSfxFilter();
|
||||
|
||||
// fill the rpURLList
|
||||
implGetAndCacheFiles( mxFileDlg, rpURLList, pCurrentFilter );
|
||||
@ -1553,7 +1552,7 @@ void FileDialogHelper_Impl::getRealFilter( OUString& _rFilter ) const
|
||||
|
||||
if ( !_rFilter.isEmpty() && mpMatcher )
|
||||
{
|
||||
const SfxFilter* pFilter =
|
||||
std::shared_ptr<const SfxFilter> pFilter =
|
||||
mpMatcher->GetFilter4UIName( _rFilter, m_nMustFlags, m_nDontFlags );
|
||||
_rFilter = pFilter ? pFilter->GetFilterName() : OUString("");
|
||||
}
|
||||
@ -1664,7 +1663,7 @@ void FileDialogHelper_Impl::setFilter( const OUString& rFilter )
|
||||
|
||||
if ( !rFilter.isEmpty() && mpMatcher )
|
||||
{
|
||||
const SfxFilter* pFilter = mpMatcher->GetFilter4FilterName(
|
||||
std::shared_ptr<const SfxFilter> pFilter = mpMatcher->GetFilter4FilterName(
|
||||
rFilter, m_nMustFlags, m_nDontFlags );
|
||||
if ( pFilter )
|
||||
maCurFilter = pFilter->GetUIName();
|
||||
@ -2600,7 +2599,7 @@ ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType,
|
||||
return nRet;
|
||||
}
|
||||
|
||||
ErrCode RequestPassword(const SfxFilter* pCurrentFilter, OUString& aURL, SfxItemSet* pSet)
|
||||
ErrCode RequestPassword(std::shared_ptr<const SfxFilter> pCurrentFilter, OUString& aURL, SfxItemSet* pSet)
|
||||
{
|
||||
uno::Reference < task::XInteractionHandler2 > xInteractionHandler = task::InteractionHandler::createWithParent( ::comphelper::getProcessComponentContext(), nullptr );
|
||||
// TODO: need a save way to distinguish MS filters from other filters
|
||||
|
@ -115,7 +115,7 @@ namespace sfx2
|
||||
void loadConfig();
|
||||
void saveConfig();
|
||||
|
||||
const SfxFilter* getCurentSfxFilter();
|
||||
std::shared_ptr<const SfxFilter> getCurentSfxFilter();
|
||||
bool updateExtendedControl( sal_Int16 _nExtendedControlId, bool _bEnable );
|
||||
|
||||
ErrCode getGraphic( const OUString& rURL, Graphic& rGraphic ) const;
|
||||
@ -128,7 +128,7 @@ namespace sfx2
|
||||
|
||||
void setControlHelpIds( const sal_Int16* _pControlId, const char** _pHelpId );
|
||||
|
||||
bool CheckFilterOptionsCapability( const SfxFilter* _pFilter );
|
||||
bool CheckFilterOptionsCapability( std::shared_ptr<const SfxFilter> _pFilter );
|
||||
|
||||
bool isInOpenMode() const;
|
||||
OUString getCurrentFilterUIName() const;
|
||||
@ -143,7 +143,7 @@ namespace sfx2
|
||||
|
||||
void implGetAndCacheFiles( const css::uno::Reference< XInterface >& xPicker ,
|
||||
std::vector<OUString>& rpURLList,
|
||||
const SfxFilter* pFilter );
|
||||
std::shared_ptr<const SfxFilter> pFilter );
|
||||
|
||||
DECL_LINK_TYPED( TimeOutHdl_Impl, Idle *, void);
|
||||
DECL_LINK_TYPED( InitControls, void*, void );
|
||||
|
@ -607,7 +607,7 @@ namespace sfx2
|
||||
OUString sFilterWildcard;
|
||||
OUString sFilterName;
|
||||
// loop through all the filters
|
||||
for ( const SfxFilter* pFilter = _rFilterMatcher.First(); pFilter; pFilter = _rFilterMatcher.Next() )
|
||||
for ( std::shared_ptr<const SfxFilter> pFilter = _rFilterMatcher.First(); pFilter; pFilter = _rFilterMatcher.Next() )
|
||||
{
|
||||
sFilterName = pFilter->GetFilterName();
|
||||
sFilterWildcard = pFilter->GetWildcard().getGlob();
|
||||
@ -762,7 +762,7 @@ namespace sfx2
|
||||
|
||||
|
||||
// check if there's already a filter <ALL>
|
||||
for ( const SfxFilter* pFilter = _rFilterMatcher.First(); pFilter && !bHasAll; pFilter = _rFilterMatcher.Next() )
|
||||
for ( std::shared_ptr<const SfxFilter> pFilter = _rFilterMatcher.First(); pFilter && !bHasAll; pFilter = _rFilterMatcher.Next() )
|
||||
{
|
||||
if ( pFilter->GetUIName() == _rAllFilterName )
|
||||
bHasAll = true;
|
||||
@ -869,21 +869,21 @@ namespace sfx2
|
||||
}
|
||||
|
||||
|
||||
const SfxFilter* TSortedFilterList::First()
|
||||
std::shared_ptr<const SfxFilter> TSortedFilterList::First()
|
||||
{
|
||||
m_nIterator = 0;
|
||||
return impl_getFilter(m_nIterator);
|
||||
}
|
||||
|
||||
|
||||
const SfxFilter* TSortedFilterList::Next()
|
||||
std::shared_ptr<const SfxFilter> TSortedFilterList::Next()
|
||||
{
|
||||
++m_nIterator;
|
||||
return impl_getFilter(m_nIterator);
|
||||
}
|
||||
|
||||
|
||||
const SfxFilter* TSortedFilterList::impl_getFilter(sal_Int32 nIndex)
|
||||
std::shared_ptr<const SfxFilter> TSortedFilterList::impl_getFilter(sal_Int32 nIndex)
|
||||
{
|
||||
if (nIndex<0 || nIndex>=(sal_Int32)m_lFilters.size())
|
||||
return nullptr;
|
||||
@ -908,7 +908,7 @@ namespace sfx2
|
||||
|
||||
// retrieve the default filter for this application module.
|
||||
// It must be set as first of the generated filter list.
|
||||
const SfxFilter* pDefaultFilter = SfxFilterContainer::GetDefaultFilter_Impl(_rFactory);
|
||||
std::shared_ptr<const SfxFilter> pDefaultFilter = SfxFilterContainer::GetDefaultFilter_Impl(_rFactory);
|
||||
// Only use one extension (#i32434#)
|
||||
// (and always the first if there are more than one)
|
||||
sExtension = pDefaultFilter->GetWildcard().getGlob().getToken(0, ';');
|
||||
@ -924,7 +924,7 @@ namespace sfx2
|
||||
SAL_WARN( "sfx.dialog", "Could not append DefaultFilter" << sUIName );
|
||||
}
|
||||
|
||||
for ( const SfxFilter* pFilter = _rFilterMatcher.First(); pFilter; pFilter = _rFilterMatcher.Next() )
|
||||
for ( std::shared_ptr<const SfxFilter> pFilter = _rFilterMatcher.First(); pFilter; pFilter = _rFilterMatcher.Next() )
|
||||
{
|
||||
if (pFilter->GetName() == pDefaultFilter->GetName())
|
||||
continue;
|
||||
@ -975,7 +975,7 @@ namespace sfx2
|
||||
Reference< XFilterGroupManager > xFilterGroupManager( _rxFilterManager, UNO_QUERY );
|
||||
OUString sTypeName;
|
||||
|
||||
for ( const SfxFilter* pFilter = _rFilterMatcher.First(); pFilter; pFilter = _rFilterMatcher.Next() )
|
||||
for ( std::shared_ptr<const SfxFilter> pFilter = _rFilterMatcher.First(); pFilter; pFilter = _rFilterMatcher.Next() )
|
||||
{
|
||||
sTypeName = pFilter->GetTypeName();
|
||||
sUIName = pFilter->GetUIName();
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <com/sun/star/container/XEnumeration.hpp>
|
||||
#include "filedlgimpl.hxx"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace sfx2
|
||||
{
|
||||
@ -37,11 +38,11 @@ namespace sfx2
|
||||
|
||||
public:
|
||||
explicit TSortedFilterList(const css::uno::Reference< css::container::XEnumeration >& xFilterList);
|
||||
const SfxFilter* First();
|
||||
const SfxFilter* Next();
|
||||
std::shared_ptr<const SfxFilter> First();
|
||||
std::shared_ptr<const SfxFilter> Next();
|
||||
|
||||
private:
|
||||
const SfxFilter* impl_getFilter(sal_Int32 nIndex);
|
||||
std::shared_ptr<const SfxFilter> impl_getFilter(sal_Int32 nIndex);
|
||||
};
|
||||
|
||||
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include <tools/globname.hxx>
|
||||
|
||||
#include <assert.h>
|
||||
#include <memory>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
@ -307,13 +308,13 @@ OUString SfxObjectFactory::GetStandardTemplate( const OUString& rServiceName )
|
||||
return sTemplate;
|
||||
}
|
||||
|
||||
const SfxFilter* SfxObjectFactory::GetTemplateFilter() const
|
||||
std::shared_ptr<const SfxFilter> SfxObjectFactory::GetTemplateFilter() const
|
||||
{
|
||||
sal_uInt16 nVersion=0;
|
||||
SfxFilterMatcher aMatcher ( OUString::createFromAscii( pShortName ) );
|
||||
SfxFilterMatcherIter aIter( aMatcher );
|
||||
const SfxFilter *pFilter = nullptr;
|
||||
const SfxFilter *pTemp = aIter.First();
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
std::shared_ptr<const SfxFilter> pTemp = aIter.First();
|
||||
while ( pTemp )
|
||||
{
|
||||
if( pTemp->IsOwnFormat() && pTemp->IsOwnTemplateFormat() && ( pTemp->GetVersion() > nVersion ) )
|
||||
|
@ -200,13 +200,13 @@ public:
|
||||
mutable SfxItemSet* m_pSet;
|
||||
mutable INetURLObject* m_pURLObj;
|
||||
|
||||
const SfxFilter* m_pFilter;
|
||||
std::unique_ptr<SfxFilter> m_pCustomFilter;
|
||||
std::shared_ptr<const SfxFilter> m_pFilter;
|
||||
std::shared_ptr<const SfxFilter> m_pCustomFilter;
|
||||
|
||||
SvStream* m_pInStream;
|
||||
SvStream* m_pOutStream;
|
||||
|
||||
const SfxFilter* pOrigFilter;
|
||||
std::shared_ptr<const SfxFilter> pOrigFilter;
|
||||
OUString aOrigURL;
|
||||
DateTime aExpireTime;
|
||||
SfxFrameWeakRef wLoadTargetFrame;
|
||||
@ -242,7 +242,7 @@ public:
|
||||
~SfxMedium_Impl();
|
||||
|
||||
OUString getFilterMimeType()
|
||||
{ return m_pFilter == nullptr ? OUString() : m_pFilter->GetMimeType(); }
|
||||
{ return !m_pFilter ? OUString() : m_pFilter->GetMimeType(); }
|
||||
};
|
||||
|
||||
|
||||
@ -2666,18 +2666,18 @@ SfxMedium::GetInteractionHandler( bool bGetAlways )
|
||||
}
|
||||
|
||||
|
||||
void SfxMedium::SetFilter( const SfxFilter* pFilterP )
|
||||
void SfxMedium::SetFilter( std::shared_ptr<const SfxFilter> pFilter )
|
||||
{
|
||||
pImp->m_pFilter = pFilterP;
|
||||
pImp->m_pFilter = pFilter;
|
||||
}
|
||||
|
||||
const SfxFilter* SfxMedium::GetFilter() const
|
||||
std::shared_ptr<const SfxFilter> SfxMedium::GetFilter() const
|
||||
{
|
||||
return pImp->m_pFilter;
|
||||
}
|
||||
|
||||
|
||||
const SfxFilter* SfxMedium::GetOrigFilter() const
|
||||
std::shared_ptr<const SfxFilter> SfxMedium::GetOrigFilter() const
|
||||
{
|
||||
return pImp->pOrigFilter ? pImp->pOrigFilter : pImp->m_pFilter;
|
||||
}
|
||||
@ -2951,17 +2951,17 @@ void SfxMedium::CompleteReOpen()
|
||||
pImp->bUseInteractionHandler = bUseInteractionHandler;
|
||||
}
|
||||
|
||||
SfxMedium::SfxMedium(const OUString &rName, StreamMode nOpenMode, const SfxFilter *pFlt, SfxItemSet *pInSet) :
|
||||
SfxMedium::SfxMedium(const OUString &rName, StreamMode nOpenMode, std::shared_ptr<const SfxFilter> pFilter, SfxItemSet *pInSet) :
|
||||
pImp(new SfxMedium_Impl)
|
||||
{
|
||||
pImp->m_pSet = pInSet;
|
||||
pImp->m_pFilter = pFlt;
|
||||
pImp->m_pFilter = pFilter;
|
||||
pImp->m_aLogicName = rName;
|
||||
pImp->m_nStorOpenMode = nOpenMode;
|
||||
Init_Impl();
|
||||
}
|
||||
|
||||
SfxMedium::SfxMedium(const OUString &rName, const OUString &rReferer, StreamMode nOpenMode, const SfxFilter *pFlt, SfxItemSet *pInSet) :
|
||||
SfxMedium::SfxMedium(const OUString &rName, const OUString &rReferer, StreamMode nOpenMode, std::shared_ptr<const SfxFilter> pFilter, SfxItemSet *pInSet) :
|
||||
pImp(new SfxMedium_Impl)
|
||||
{
|
||||
pImp->m_pSet = pInSet;
|
||||
@ -2969,7 +2969,7 @@ SfxMedium::SfxMedium(const OUString &rName, const OUString &rReferer, StreamMode
|
||||
if (s->GetItem(SID_REFERER) == nullptr) {
|
||||
s->Put(SfxStringItem(SID_REFERER, rReferer));
|
||||
}
|
||||
pImp->m_pFilter = pFlt;
|
||||
pImp->m_pFilter = pFilter;
|
||||
pImp->m_aLogicName = rName;
|
||||
pImp->m_nStorOpenMode = nOpenMode;
|
||||
Init_Impl();
|
||||
@ -3001,7 +3001,7 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) :
|
||||
{
|
||||
// This filter is from an external provider such as orcus.
|
||||
pImp->m_pCustomFilter.reset(new SfxFilter(aFilterProvider, aFilterName));
|
||||
pImp->m_pFilter = pImp->m_pCustomFilter.get();
|
||||
pImp->m_pFilter = pImp->m_pCustomFilter;
|
||||
}
|
||||
|
||||
const SfxStringItem* pSalvageItem = SfxItemSet::GetItem<SfxStringItem>(pImp->m_pSet, SID_DOC_SALVAGE, false);
|
||||
|
@ -122,17 +122,17 @@ OUString SfxFilter::GetSuffixes() const
|
||||
return aRet;
|
||||
}
|
||||
|
||||
const SfxFilter* SfxFilter::GetDefaultFilter( const OUString& rName )
|
||||
std::shared_ptr<const SfxFilter> SfxFilter::GetDefaultFilter( const OUString& rName )
|
||||
{
|
||||
return SfxFilterContainer::GetDefaultFilter_Impl( rName );
|
||||
}
|
||||
|
||||
const SfxFilter* SfxFilter::GetDefaultFilterFromFactory( const OUString& rFact )
|
||||
std::shared_ptr<const SfxFilter> SfxFilter::GetDefaultFilterFromFactory( const OUString& rFact )
|
||||
{
|
||||
return GetDefaultFilter( SfxObjectShell::GetServiceNameFromFactory( rFact ) );
|
||||
}
|
||||
|
||||
const SfxFilter* SfxFilter::GetFilterByName( const OUString& rName )
|
||||
std::shared_ptr<const SfxFilter> SfxFilter::GetFilterByName( const OUString& rName )
|
||||
{
|
||||
SfxFilterMatcher aMatch;
|
||||
return aMatch.GetFilter4FilterName( rName, SfxFilterFlags::NONE, SfxFilterFlags::NONE );
|
||||
@ -169,7 +169,7 @@ OUString SfxFilter::GetTypeFromStorage( const SotStorage& rStg )
|
||||
SotClipboardFormatId nClipId = ((SotStorage&)rStg).GetFormat();
|
||||
if ( nClipId != SotClipboardFormatId::NONE )
|
||||
{
|
||||
const SfxFilter* pFilter = SfxFilterMatcher().GetFilter4ClipBoardId( nClipId );
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxFilterMatcher().GetFilter4ClipBoardId( nClipId );
|
||||
if ( pFilter )
|
||||
return pFilter->GetTypeName();
|
||||
}
|
||||
@ -206,7 +206,7 @@ OUString SfxFilter::GetTypeFromStorage(
|
||||
nDont |= SfxFilterFlags::TEMPLATEPATH;
|
||||
|
||||
// get filter from storage MediaType
|
||||
const SfxFilter* pFilter = aMatcher.GetFilter4ClipBoardId( nClipId, nMust, nDont );
|
||||
std::shared_ptr<const SfxFilter> 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
|
||||
|
@ -95,8 +95,8 @@ SfxMedium* DocumentInserter::CreateMedium()
|
||||
else
|
||||
pMatcher = new SfxFilterMatcher();
|
||||
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
sal_uInt32 nError = pMatcher->DetectFilter( *pMedium, &pFilter );
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
sal_uInt32 nError = pMatcher->DetectFilter( *pMedium, pFilter );
|
||||
if ( nError == ERRCODE_NONE && pFilter )
|
||||
pMedium->SetFilter( pFilter );
|
||||
else
|
||||
@ -125,8 +125,8 @@ SfxMediumList* DocumentInserter::CreateMediumList()
|
||||
pMedium->UseInteractionHandler( true );
|
||||
|
||||
SfxFilterMatcher aMatcher( m_sDocFactory );
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
sal_uInt32 nError = aMatcher.DetectFilter( *pMedium, &pFilter );
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
sal_uInt32 nError = aMatcher.DetectFilter( *pMedium, pFilter );
|
||||
if ( nError == ERRCODE_NONE && pFilter )
|
||||
pMedium->SetFilter( pFilter );
|
||||
else
|
||||
|
@ -507,7 +507,7 @@ void SfxObjectShell::UpdateFromTemplate_Impl( )
|
||||
|
||||
bool SfxObjectShell::IsHelpDocument() const
|
||||
{
|
||||
const SfxFilter* pFilter = GetMedium()->GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = GetMedium()->GetFilter();
|
||||
return (pFilter && pFilter->GetFilterName() == "writer_web_HTML_help");
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ bool SfxObjectShell::APISaveAs_Impl(const OUString& aFileName, SfxItemSet& rItem
|
||||
const SfxStringItem* pContentTypeItem = rItemSet.GetItem<SfxStringItem>(SID_CONTENTTYPE, false);
|
||||
if ( pContentTypeItem )
|
||||
{
|
||||
const SfxFilter* pFilter = SfxFilterMatcher( OUString::createFromAscii(GetFactory().GetShortName()) ).GetFilter4Mime( pContentTypeItem->GetValue(), SfxFilterFlags::EXPORT );
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxFilterMatcher( OUString::createFromAscii(GetFactory().GetShortName()) ).GetFilter4Mime( pContentTypeItem->GetValue(), SfxFilterFlags::EXPORT );
|
||||
if ( pFilter )
|
||||
aFilterName = pFilter->GetName();
|
||||
}
|
||||
@ -287,7 +287,7 @@ bool SfxObjectShell::APISaveAs_Impl(const OUString& aFileName, SfxItemSet& rItem
|
||||
// in case no filter defined use default one
|
||||
if( aFilterName.isEmpty() )
|
||||
{
|
||||
const SfxFilter* pFilt = SfxFilter::GetDefaultFilterFromFactory(GetFactory().GetFactoryName());
|
||||
std::shared_ptr<const SfxFilter> pFilt = SfxFilter::GetDefaultFilterFromFactory(GetFactory().GetFactoryName());
|
||||
|
||||
DBG_ASSERT( pFilt, "No default filter!\n" );
|
||||
if( pFilt )
|
||||
|
@ -628,7 +628,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed )
|
||||
pMedium->CanDisposeStorage_Impl( true );
|
||||
|
||||
bool bOk = false;
|
||||
const SfxFilter* pFilter = pMed->GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = pMed->GetFilter();
|
||||
SfxItemSet* pSet = pMedium->GetItemSet();
|
||||
if( !pImp->nEventId )
|
||||
{
|
||||
@ -893,7 +893,7 @@ sal_uInt32 SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDo
|
||||
{
|
||||
try {
|
||||
bool bAbort = false;
|
||||
const SfxFilter* pFilter = pMedium->GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter();
|
||||
Sequence < PropertyValue > aProps;
|
||||
Any aAny = xFilterCFG->getByName( pFilter->GetName() );
|
||||
if ( aAny >>= aProps )
|
||||
@ -1107,7 +1107,7 @@ bool SfxObjectShell::SaveTo_Impl
|
||||
|
||||
ModifyBlocker_Impl aMod(this);
|
||||
|
||||
const SfxFilter *pFilter = rMedium.GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = rMedium.GetFilter();
|
||||
if ( !pFilter )
|
||||
{
|
||||
// if no filter was set, use the default filter
|
||||
@ -1334,7 +1334,7 @@ bool SfxObjectShell::SaveTo_Impl
|
||||
// document. It can be retrieved from the default filter for the desired target format
|
||||
SotClipboardFormatId nFormat = rMedium.GetFilter()->GetFormat();
|
||||
SfxFilterMatcher& rMatcher = SfxGetpApp()->GetFilterMatcher();
|
||||
const SfxFilter *pFilt = rMatcher.GetFilter4ClipBoardId( nFormat );
|
||||
std::shared_ptr<const SfxFilter> pFilt = rMatcher.GetFilter4ClipBoardId( nFormat );
|
||||
if ( pFilt )
|
||||
{
|
||||
if ( pFilt->GetServiceName() != rMedium.GetFilter()->GetServiceName() )
|
||||
@ -1957,7 +1957,7 @@ bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed )
|
||||
pMedium->CanDisposeStorage_Impl( true );
|
||||
}
|
||||
|
||||
const SfxFilter *pFilter = pMedium ? pMedium->GetFilter() : nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFilter = pMedium ? pMedium->GetFilter() : nullptr;
|
||||
if ( pNewMed )
|
||||
{
|
||||
if( bMedChanged )
|
||||
@ -2103,7 +2103,7 @@ void SfxObjectShell::AddToRecentlyUsedList()
|
||||
|
||||
if ( aUrl.GetProtocol() == INetProtocol::File )
|
||||
{
|
||||
const SfxFilter* pOrgFilter = pMedium->GetOrigFilter();
|
||||
std::shared_ptr<const SfxFilter> pOrgFilter = pMedium->GetOrigFilter();
|
||||
Application::AddToRecentDocumentList( aUrl.GetURLNoPass( INetURLObject::NO_DECODE ),
|
||||
(pOrgFilter) ? pOrgFilter->GetMimeType() : OUString(),
|
||||
(pOrgFilter) ? pOrgFilter->GetServiceName() : OUString() );
|
||||
@ -2485,7 +2485,7 @@ bool SfxObjectShell::ConvertTo
|
||||
bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
|
||||
{
|
||||
SfxMedium* pRetrMedium = GetMedium();
|
||||
const SfxFilter* pFilter = pRetrMedium->GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = pRetrMedium->GetFilter();
|
||||
|
||||
// copy the original itemset, but remove the "version" item, because pMediumTmp
|
||||
// is a new medium "from scratch", so no version should be stored into it
|
||||
@ -2585,7 +2585,7 @@ bool SfxObjectShell::Save_Impl( const SfxItemSet* pSet )
|
||||
{
|
||||
const SfxStringItem* pFilterItem = SfxItemSet::GetItem<SfxStringItem>(GetMedium()->GetItemSet(), SID_FILTER_NAME, false);
|
||||
OUString aFilterName;
|
||||
const SfxFilter *pFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
if ( pFilterItem )
|
||||
pFilter = SfxFilterMatcher( OUString::createFromAscii( GetFactory().GetShortName()) ).GetFilter4FilterName( aFilterName );
|
||||
|
||||
@ -2644,7 +2644,7 @@ bool SfxObjectShell::CommonSaveAs_Impl(const INetURLObject& aURL, const OUString
|
||||
const SfxBoolItem* pSaveToItem = rItemSet.GetItem<SfxBoolItem>(SID_SAVETO, false);
|
||||
bool bSaveTo = pSaveToItem && pSaveToItem->GetValue();
|
||||
|
||||
const SfxFilter* pFilter = GetFactory().GetFilterContainer()->GetFilter4FilterName( aFilterName );
|
||||
std::shared_ptr<const SfxFilter> pFilter = GetFactory().GetFilterContainer()->GetFilter4FilterName( aFilterName );
|
||||
if ( !pFilter
|
||||
|| !pFilter->CanExport()
|
||||
|| (!bSaveTo && !pFilter->CanImport()) )
|
||||
@ -2896,7 +2896,7 @@ bool SfxObjectShell::IsInformationLost()
|
||||
// for the latest store then the user should be asked to store in own format
|
||||
if ( !aFilterName.isEmpty() && aFilterName.equals( aPreusedFilterName ) )
|
||||
{
|
||||
const SfxFilter *pFilt = GetMedium()->GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilt = GetMedium()->GetFilter();
|
||||
DBG_ASSERT( pFilt && aFilterName.equals( pFilt->GetName() ), "MediaDescriptor contains wrong filter!\n" );
|
||||
return ( pFilt && pFilt->IsAlienFormat() );
|
||||
}
|
||||
@ -3061,7 +3061,7 @@ bool SfxObjectShell::SaveAsOwnFormat( SfxMedium& rMedium )
|
||||
const bool bTemplate = rMedium.GetFilter()->IsOwnTemplateFormat()
|
||||
&& nVersion > SOFFICE_FILEFORMAT_60;
|
||||
|
||||
const SfxFilter* pFilter = rMedium.GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = rMedium.GetFilter();
|
||||
bool bChart = false;
|
||||
if(pFilter->GetName() == "chart8")
|
||||
bChart = true;
|
||||
|
@ -1788,7 +1788,7 @@ namespace {
|
||||
|
||||
OUString getFilterProvider( SfxMedium& rMedium )
|
||||
{
|
||||
const SfxFilter* pFilter = rMedium.GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = rMedium.GetFilter();
|
||||
if (!pFilter)
|
||||
return OUString();
|
||||
|
||||
@ -1911,7 +1911,7 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA
|
||||
// file recovery: restore original filter
|
||||
const SfxStringItem* pFilterItem = SfxItemSet::GetItem<SfxStringItem>(pMedium->GetItemSet(), SID_FILTER_NAME, false);
|
||||
SfxFilterMatcher& rMatcher = SfxGetpApp()->GetFilterMatcher();
|
||||
const SfxFilter* pSetFilter = rMatcher.GetFilter4FilterName( pFilterItem->GetValue() );
|
||||
std::shared_ptr<const SfxFilter> pSetFilter = rMatcher.GetFilter4FilterName( pFilterItem->GetValue() );
|
||||
pMedium->SetFilter( pSetFilter );
|
||||
m_pData->m_pObjectShell->SetModified();
|
||||
}
|
||||
@ -2913,7 +2913,7 @@ bool SfxBaseModel::impl_isDisposed() const
|
||||
|
||||
OUString SfxBaseModel::GetMediumFilterName_Impl()
|
||||
{
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
|
||||
if ( pMedium )
|
||||
pFilter = pMedium->GetFilter();
|
||||
@ -2946,7 +2946,7 @@ void SfxBaseModel::impl_store( const OUString& sURL
|
||||
SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
|
||||
if ( pMedium )
|
||||
{
|
||||
const SfxFilter* pFilter = pMedium->GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter();
|
||||
if ( pFilter && aFilterName.equals( pFilter->GetFilterName() ) )
|
||||
{
|
||||
// #i119366# - If the former file saving with password, do not trying in StoreSelf anyway...
|
||||
@ -3772,7 +3772,7 @@ void SAL_CALL SfxBaseModel::storeToStorage( const Reference< embed::XStorage >&
|
||||
if( pItem )
|
||||
{
|
||||
OUString aFilterName = pItem->GetValue();
|
||||
const SfxFilter* pFilter = SfxGetpApp()->GetFilterMatcher().GetFilter4FilterName( aFilterName );
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxGetpApp()->GetFilterMatcher().GetFilter4FilterName( aFilterName );
|
||||
if ( pFilter && pFilter->UsesStorage() )
|
||||
nVersion = pFilter->GetVersion();
|
||||
}
|
||||
|
@ -1685,7 +1685,7 @@ static bool lcl_getServiceName ( const OUString &rFileURL, OUString &rName )
|
||||
|
||||
SotClipboardFormatId nFormat = SotStorage::GetFormatID( xStorage );
|
||||
|
||||
const SfxFilter* pFilter = SfxGetpApp()->GetFilterMatcher().GetFilter4ClipBoardId( nFormat );
|
||||
std::shared_ptr<const SfxFilter> pFilter = SfxGetpApp()->GetFilterMatcher().GetFilter4ClipBoardId( nFormat );
|
||||
|
||||
if ( pFilter )
|
||||
{
|
||||
|
@ -424,7 +424,7 @@ void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc )
|
||||
// Mark FileOpen parameter
|
||||
SfxItemSet* pItemSet = pMed->GetItemSet();
|
||||
|
||||
const SfxFilter* pFilter = pMed->GetOrigFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = pMed->GetOrigFilter();
|
||||
OUString aFilter;
|
||||
if ( pFilter )
|
||||
aFilter = pFilter->GetFilterName();
|
||||
|
@ -129,7 +129,7 @@ protected:
|
||||
virtual ~SfxFrameLoader_Impl();
|
||||
|
||||
private:
|
||||
const SfxFilter* impl_getFilterFromServiceName_nothrow(
|
||||
std::shared_ptr<const SfxFilter> impl_getFilterFromServiceName_nothrow(
|
||||
const OUString& i_rServiceName
|
||||
) const;
|
||||
|
||||
@ -138,7 +138,7 @@ private:
|
||||
const OUString& i_rDocumentURL
|
||||
);
|
||||
|
||||
const SfxFilter* impl_detectFilterForURL(
|
||||
std::shared_ptr<const SfxFilter> impl_detectFilterForURL(
|
||||
const OUString& _rURL,
|
||||
const ::comphelper::NamedValueCollection& i_rDescriptor,
|
||||
const SfxFilterMatcher& rMatcher
|
||||
@ -204,7 +204,7 @@ SfxFrameLoader_Impl::~SfxFrameLoader_Impl()
|
||||
}
|
||||
|
||||
|
||||
const SfxFilter* SfxFrameLoader_Impl::impl_detectFilterForURL( const OUString& sURL,
|
||||
std::shared_ptr<const SfxFilter> SfxFrameLoader_Impl::impl_detectFilterForURL( const OUString& sURL,
|
||||
const ::comphelper::NamedValueCollection& i_rDescriptor, const SfxFilterMatcher& rMatcher ) const
|
||||
{
|
||||
OUString sFilter;
|
||||
@ -229,7 +229,7 @@ const SfxFilter* SfxFrameLoader_Impl::impl_detectFilterForURL( const OUString& s
|
||||
OUString sType = xDetect->queryTypeByDescriptor( aQueryArgs, sal_True );
|
||||
if ( !sType.isEmpty() )
|
||||
{
|
||||
const SfxFilter* pFilter = rMatcher.GetFilter4EA( sType );
|
||||
std::shared_ptr<const SfxFilter> pFilter = rMatcher.GetFilter4EA( sType );
|
||||
if ( pFilter )
|
||||
sFilter = pFilter->GetName();
|
||||
}
|
||||
@ -244,14 +244,14 @@ const SfxFilter* SfxFrameLoader_Impl::impl_detectFilterForURL( const OUString& s
|
||||
sFilter.clear();
|
||||
}
|
||||
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
if (!sFilter.isEmpty())
|
||||
pFilter = rMatcher.GetFilter4FilterName(sFilter);
|
||||
return pFilter;
|
||||
}
|
||||
|
||||
|
||||
const SfxFilter* SfxFrameLoader_Impl::impl_getFilterFromServiceName_nothrow( const OUString& i_rServiceName ) const
|
||||
std::shared_ptr<const SfxFilter> SfxFrameLoader_Impl::impl_getFilterFromServiceName_nothrow( const OUString& i_rServiceName ) const
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -275,7 +275,7 @@ const SfxFilter* SfxFrameLoader_Impl::impl_getFilterFromServiceName_nothrow( con
|
||||
if ( sFilterName.isEmpty() )
|
||||
continue;
|
||||
|
||||
const SfxFilter* pFilter = rMatcher.GetFilter4FilterName( sFilterName );
|
||||
std::shared_ptr<const SfxFilter> pFilter = rMatcher.GetFilter4FilterName( sFilterName );
|
||||
if ( !pFilter )
|
||||
continue;
|
||||
|
||||
@ -361,7 +361,7 @@ void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollecti
|
||||
xInteraction = io_rDescriptor.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() );
|
||||
|
||||
const SfxFilterMatcher& rMatcher = SfxGetpApp()->GetFilterMatcher();
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
|
||||
// get filter by its name directly ...
|
||||
if ( !sFilterName.isEmpty() )
|
||||
@ -444,7 +444,7 @@ bool SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedVal
|
||||
{
|
||||
// detect the filter for the template. Might still be NULL (if the template is broken, or does not
|
||||
// exist, or some such), but this is handled by our caller the same way as if no template/URL was present.
|
||||
const SfxFilter* pTemplateFilter = impl_detectFilterForURL( sTemplateURL, io_rDescriptor, SfxGetpApp()->GetFilterMatcher() );
|
||||
std::shared_ptr<const SfxFilter> pTemplateFilter = impl_detectFilterForURL( sTemplateURL, io_rDescriptor, SfxGetpApp()->GetFilterMatcher() );
|
||||
if ( pTemplateFilter )
|
||||
{
|
||||
// load the template document, but, well, "as template"
|
||||
|
@ -154,7 +154,7 @@ void SfxViewFrame::InitInterface_Impl()
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const OUString& aPath, const SfxFilter* pFilter, sal_uInt32 nPasswordHash, const uno::Sequence< beans::PropertyValue >& aInfo )
|
||||
static bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const OUString& aPath, std::shared_ptr<const SfxFilter> pFilter, sal_uInt32 nPasswordHash, const uno::Sequence< beans::PropertyValue >& aInfo )
|
||||
{
|
||||
// TODO/LATER: In future the info should replace the direct hash completely
|
||||
bool bResult = ( !nPasswordHash && !aInfo.getLength() );
|
||||
@ -609,7 +609,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
|
||||
DELETEZ( xOldObj->Get_Impl()->pReloadTimer );
|
||||
|
||||
SfxItemSet* pNewSet = nullptr;
|
||||
const SfxFilter *pFilter = pMedium->GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter();
|
||||
if( pURLItem )
|
||||
{
|
||||
pNewSet = new SfxAllItemSet( pApp->GetPool() );
|
||||
@ -622,7 +622,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
|
||||
referer = refererItem->GetValue();
|
||||
}
|
||||
SfxMedium aMedium( pURLItem->GetValue(), referer, SFX_STREAM_READWRITE );
|
||||
SfxFilterMatcher().GuessFilter( aMedium, &pFilter );
|
||||
SfxFilterMatcher().GuessFilter( aMedium, pFilter );
|
||||
if ( pFilter )
|
||||
pNewSet->Put( SfxStringItem( SID_FILTER_NAME, pFilter->GetName() ) );
|
||||
pNewSet->Put( *aMedium.GetItemSet() );
|
||||
|
@ -656,7 +656,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
|
||||
// document that is going to be printed!)
|
||||
OUString aHelpFilterName( "writer_web_HTML_help" );
|
||||
SfxMedium* pMedium = GetViewFrame()->GetObjectShell()->GetMedium();
|
||||
const SfxFilter* pFilter = pMedium ? pMedium->GetFilter() : nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFilter = pMedium ? pMedium->GetFilter() : nullptr;
|
||||
bool bPrintOnHelp = ( pFilter && pFilter->GetFilterName() == aHelpFilterName );
|
||||
|
||||
const sal_uInt16 nId = rReq.GetSlot();
|
||||
|
@ -44,7 +44,7 @@ private:
|
||||
{
|
||||
// Cf.
|
||||
// filter/source/config/fragments/filters/MathML_XML__Math_.xcu
|
||||
SfxFilter* pFilter = new SfxFilter(MATHML_XML,
|
||||
std::shared_ptr<SfxFilter> pFilter(new SfxFilter(MATHML_XML,
|
||||
OUString(),
|
||||
SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::TEMPLATE,
|
||||
SotClipboardFormatId::STARCALC_8,
|
||||
@ -52,8 +52,8 @@ private:
|
||||
0,
|
||||
OUString(),
|
||||
OUString(),
|
||||
"private:factory/smath*");
|
||||
pFilter->SetVersion(SOFFICE_FILEFORMAT_60);
|
||||
"private:factory/smath*"));
|
||||
const_cast<SfxFilter*>(pFilter.get())->SetVersion(SOFFICE_FILEFORMAT_60);
|
||||
|
||||
mxDocShell = new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT |
|
||||
SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS |
|
||||
|
@ -863,7 +863,7 @@ bool SmDocShell::SaveAs( SfxMedium& rMedium )
|
||||
bool SmDocShell::ConvertTo( SfxMedium &rMedium )
|
||||
{
|
||||
bool bRet = false;
|
||||
const SfxFilter* pFlt = rMedium.GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFlt = rMedium.GetFilter();
|
||||
if( pFlt )
|
||||
{
|
||||
if( !pTree )
|
||||
|
@ -1644,7 +1644,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
|
||||
{
|
||||
std::unique_ptr<SfxMedium> pClipboardMedium(new SfxMedium());
|
||||
pClipboardMedium->GetItemSet(); //generate initial itemset, not sure if necessary
|
||||
const SfxFilter* pMathFilter =
|
||||
std::shared_ptr<const SfxFilter> pMathFilter =
|
||||
SfxFilter::GetFilterByName(MATHML_XML);
|
||||
pClipboardMedium->SetFilter(pMathFilter);
|
||||
pClipboardMedium->setStreamToLoadFrom(xStrm, true /*bIsReadOnly*/);
|
||||
@ -1662,7 +1662,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
|
||||
{
|
||||
std::unique_ptr<SfxMedium> pClipboardMedium(new SfxMedium());
|
||||
pClipboardMedium->GetItemSet(); //generates initial itemset, not sure if necessary
|
||||
const SfxFilter* pMathFilter =
|
||||
std::shared_ptr<const SfxFilter> pMathFilter =
|
||||
SfxFilter::GetFilterByName(MATHML_XML);
|
||||
pClipboardMedium->SetFilter(pMathFilter);
|
||||
|
||||
|
@ -1480,10 +1480,10 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
|
||||
{
|
||||
// normal link
|
||||
OUString aFilterName;
|
||||
const SfxFilter* pSfxFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pSfxFilter;
|
||||
SfxMedium aSfxMedium( aURL, referer_, StreamMode::READ | StreamMode::SHARE_DENYNONE );
|
||||
|
||||
SfxGetpApp()->GetFilterMatcher().GuessFilter( aSfxMedium, &pSfxFilter );
|
||||
SfxGetpApp()->GetFilterMatcher().GuessFilter( aSfxMedium, pSfxFilter );
|
||||
|
||||
if( !pSfxFilter )
|
||||
{
|
||||
|
@ -245,7 +245,7 @@ friend class SwConnectionDisposedListener_Impl;
|
||||
|
||||
SAL_DLLPRIVATE bool CreateNewTemp(OUString &sPath, const OUString &sAddress,
|
||||
std::unique_ptr< utl::TempFile > &aTempFile,
|
||||
const SwMergeDescriptor& rMergeDescriptor, const SfxFilter* pStoreToFilter);
|
||||
const SwMergeDescriptor& rMergeDescriptor, std::shared_ptr<const SfxFilter> pStoreToFilter);
|
||||
|
||||
|
||||
SAL_DLLPRIVATE bool CreateTargetDocShell(sal_Int32 nMaxDumpDocs, bool bMergeShell, vcl::Window *pSourceWindow,
|
||||
@ -261,7 +261,7 @@ friend class SwConnectionDisposedListener_Impl;
|
||||
|
||||
SAL_DLLPRIVATE void UpdateExpFields(SwWrtShell& rWorkShell, SfxObjectShellLock xWorkDocSh);
|
||||
|
||||
SAL_DLLPRIVATE void CreateStoreToFilter(const SfxFilter *&pStoreToFilter, const OUString *&pStoreToFilterOptions,
|
||||
SAL_DLLPRIVATE void CreateStoreToFilter(std::shared_ptr<const SfxFilter>& pStoreToFilter, const OUString *&pStoreToFilterOptions,
|
||||
SwDocShell *pSourceDocSh, bool bEMail, const SwMergeDescriptor &rMergeDescriptor);
|
||||
|
||||
SAL_DLLPRIVATE void MergeSingleFiles(SwDoc *pWorkDoc, SwWrtShell &rWorkShell, SwWrtShell *pTargetShell, SwDoc *pTargetDoc,
|
||||
@ -282,7 +282,7 @@ friend class SwConnectionDisposedListener_Impl;
|
||||
SAL_DLLPRIVATE bool SavePrintDoc(SfxObjectShellRef xTargetDocShell, SwView *pTargetView,
|
||||
const SwMergeDescriptor &rMergeDescriptor,
|
||||
std::unique_ptr< utl::TempFile > &aTempFile,
|
||||
const SfxFilter *&pStoreToFilter, const OUString *&pStoreToFilterOptions,
|
||||
std::shared_ptr<const SfxFilter>& pStoreToFilter, const OUString *&pStoreToFilterOptions,
|
||||
const bool bMergeShell, bool bCreateSingleFile, const bool bPrinter);
|
||||
|
||||
SAL_DLLPRIVATE void SetPrinterOptions(const SwMergeDescriptor &rMergeDescriptor,
|
||||
|
@ -83,14 +83,14 @@ class SwIoSystem
|
||||
{
|
||||
public:
|
||||
/// find for an internal format name the corresponding filter entry
|
||||
SW_DLLPUBLIC static const SfxFilter*
|
||||
SW_DLLPUBLIC static std::shared_ptr<const SfxFilter>
|
||||
GetFilterOfFormat( const OUString& rFormat,
|
||||
const SfxFilterContainer* pCnt = nullptr );
|
||||
|
||||
/** Detect for the given file which filter should be used. The filter name
|
||||
is returned. If no filter could be found, the name of the ASCII filter
|
||||
is returned! */
|
||||
static const SfxFilter* GetFileFilter(const OUString& rFileName);
|
||||
static std::shared_ptr<const SfxFilter> GetFileFilter(const OUString& rFileName);
|
||||
|
||||
static bool IsValidStgFilter( SotStorage& , const SfxFilter& );
|
||||
static bool IsValidStgFilter( const css::uno::Reference < css::embed::XStorage >& rStg, const SfxFilter& rFilter);
|
||||
|
@ -80,20 +80,20 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL,
|
||||
const OUString &rUserData, SfxFilterFlags nFilterFlags,
|
||||
SotClipboardFormatId nClipboardID, unsigned int nFilterVersion, bool bExport)
|
||||
{
|
||||
SfxFilter* pFilter = new SfxFilter(
|
||||
std::shared_ptr<const SfxFilter> pFilter(new SfxFilter(
|
||||
rFilter, OUString(), nFilterFlags,
|
||||
nClipboardID, OUString(), 0, OUString(),
|
||||
rUserData, OUString());
|
||||
pFilter->SetVersion(nFilterVersion);
|
||||
rUserData, OUString()));
|
||||
const_cast<SfxFilter*>(pFilter.get())->SetVersion(nFilterVersion);
|
||||
|
||||
SwDocShellRef xDocShRef = new SwDocShell;
|
||||
SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ);
|
||||
|
||||
const SfxFilter* pImportFilter = nullptr;
|
||||
SfxFilter* pExportFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pImportFilter;
|
||||
std::shared_ptr<const SfxFilter> pExportFilter;
|
||||
if (bExport)
|
||||
{
|
||||
SfxGetpApp()->GetFilterMatcher().GuessFilter(*pSrcMed, &pImportFilter, SfxFilterFlags::IMPORT, SfxFilterFlags::NONE);
|
||||
SfxGetpApp()->GetFilterMatcher().GuessFilter(*pSrcMed, pImportFilter, SfxFilterFlags::IMPORT, SfxFilterFlags::NONE);
|
||||
pExportFilter = pFilter;
|
||||
}
|
||||
else
|
||||
|
@ -185,11 +185,11 @@ void SwDocTest::testFileNameFields()
|
||||
OUString sFileURL = aTempFileURL.GetMainURL(INetURLObject::NO_DECODE);
|
||||
SfxMedium aDstMed(sFileURL, STREAM_STD_READWRITE);
|
||||
|
||||
SfxFilter aFilter(
|
||||
std::shared_ptr<SfxFilter> pFilter(new SfxFilter(
|
||||
OUString("Text"),
|
||||
OUString(), SfxFilterFlags::NONE, SotClipboardFormatId::NONE, OUString(), 0, OUString(),
|
||||
OUString("TEXT"), OUString() );
|
||||
aDstMed.SetFilter(&aFilter);
|
||||
OUString("TEXT"), OUString() ));
|
||||
aDstMed.SetFilter(pFilter);
|
||||
|
||||
m_xDocShRef->DoSaveAs(aDstMed);
|
||||
m_xDocShRef->DoSaveCompleted(&aDstMed);
|
||||
|
@ -1710,16 +1710,16 @@ void SwUiWriterTest::testTdf78742()
|
||||
OUString path = m_directories.getURLFromSrc(DATA_DIRECTORY) + "calc-data-source.ods";
|
||||
SfxMedium aMedium(path, StreamMode::READ | StreamMode::SHARE_DENYWRITE);
|
||||
SfxFilterMatcher aMatcher(OUString("com.sun.star.text.TextDocument"));
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
sal_uInt32 filter = aMatcher.DetectFilter(aMedium, &pFilter);
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
sal_uInt32 filter = aMatcher.DetectFilter(aMedium, pFilter);
|
||||
CPPUNIT_ASSERT_EQUAL(ERRCODE_IO_ABORT, filter);
|
||||
//it should not return any Filter
|
||||
CPPUNIT_ASSERT(!pFilter);
|
||||
//testing without service type and any .ods file
|
||||
SfxMedium aMedium2(path, StreamMode::READ | StreamMode::SHARE_DENYWRITE);
|
||||
SfxFilterMatcher aMatcher2;
|
||||
const SfxFilter* pFilter2 = nullptr;
|
||||
sal_uInt32 filter2 = aMatcher2.DetectFilter(aMedium2, &pFilter2);
|
||||
std::shared_ptr<const SfxFilter> pFilter2;
|
||||
sal_uInt32 filter2 = aMatcher2.DetectFilter(aMedium2, pFilter2);
|
||||
CPPUNIT_ASSERT_EQUAL(ERRCODE_CLASS_NONE, filter2);
|
||||
//Filter should be returned with proper Name
|
||||
CPPUNIT_ASSERT_EQUAL(OUString("calc8"), pFilter2->GetFilterName());
|
||||
@ -1727,8 +1727,8 @@ void SwUiWriterTest::testTdf78742()
|
||||
OUString path2 = m_directories.getURLFromSrc(DATA_DIRECTORY) + "fdo69893.odt";
|
||||
SfxMedium aMedium3(path2, StreamMode::READ | StreamMode::SHARE_DENYWRITE);
|
||||
SfxFilterMatcher aMatcher3(OUString("com.sun.star.text.TextDocument"));
|
||||
const SfxFilter* pFilter3 = nullptr;
|
||||
sal_uInt32 filter3 = aMatcher3.DetectFilter(aMedium3, &pFilter3);
|
||||
std::shared_ptr<const SfxFilter> pFilter3;
|
||||
sal_uInt32 filter3 = aMatcher3.DetectFilter(aMedium3, pFilter3);
|
||||
CPPUNIT_ASSERT_EQUAL(ERRCODE_CLASS_NONE, filter3);
|
||||
//Filter should be returned with proper Name
|
||||
CPPUNIT_ASSERT_EQUAL(OUString("writer8"), pFilter3->GetFilterName());
|
||||
|
@ -198,7 +198,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline,
|
||||
}
|
||||
}
|
||||
|
||||
const SfxFilter* pFilter;
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
switch( eDocType )
|
||||
{
|
||||
case SPLITDOC_TO_HTML:
|
||||
|
@ -983,7 +983,7 @@ void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL,
|
||||
return;
|
||||
|
||||
SfxObjectFactory& rFact = pDocSh->GetFactory();
|
||||
const SfxFilter* pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( sFilterName );
|
||||
std::shared_ptr<const SfxFilter> pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( sFilterName );
|
||||
uno::Reference < embed::XStorage > xReadStorage;
|
||||
if( xInputStream.is() )
|
||||
{
|
||||
@ -1015,7 +1015,7 @@ void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL,
|
||||
pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) );
|
||||
|
||||
SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() );
|
||||
ErrCode nErr = aMatcher.GuessFilter(*pMed, &pFilter, SfxFilterFlags::NONE);
|
||||
ErrCode nErr = aMatcher.GuessFilter(*pMed, pFilter, SfxFilterFlags::NONE);
|
||||
if ( nErr || !pFilter)
|
||||
return;
|
||||
pMed->SetFilter( pFilter );
|
||||
|
@ -60,7 +60,7 @@ const OUString SwIoSystem::GetSubStorageName( const SfxFilter& rFltr )
|
||||
return OUString();
|
||||
}
|
||||
|
||||
const SfxFilter* SwIoSystem::GetFilterOfFormat(const OUString& rFormatNm,
|
||||
std::shared_ptr<const SfxFilter> SwIoSystem::GetFilterOfFormat(const OUString& rFormatNm,
|
||||
const SfxFilterContainer* pCnt)
|
||||
{
|
||||
SfxFilterContainer aCntSw( OUString(sSWRITER) );
|
||||
@ -72,7 +72,7 @@ const SfxFilter* SwIoSystem::GetFilterOfFormat(const OUString& rFormatNm,
|
||||
{
|
||||
SfxFilterMatcher aMatcher( pFltCnt->GetName() );
|
||||
SfxFilterMatcherIter aIter( aMatcher );
|
||||
const SfxFilter* pFilter = aIter.First();
|
||||
std::shared_ptr<const SfxFilter> pFilter = aIter.First();
|
||||
while ( pFilter )
|
||||
{
|
||||
if( pFilter->GetUserData().equals(rFormatNm) )
|
||||
@ -141,7 +141,7 @@ bool SwIoSystem::IsValidStgFilter(SotStorage& rStg, const SfxFilter& rFilter)
|
||||
// Check the type of the stream (file) by searching for corresponding set of bytes.
|
||||
// If no known type is found, return ASCII for now!
|
||||
// Returns the internal FilterName.
|
||||
const SfxFilter* SwIoSystem::GetFileFilter(const OUString& rFileName)
|
||||
std::shared_ptr<const SfxFilter> SwIoSystem::GetFileFilter(const OUString& rFileName)
|
||||
{
|
||||
SfxFilterContainer aCntSw( OUString(sSWRITER) );
|
||||
SfxFilterContainer aCntSwWeb( OUString(sSWRITERWEB) );
|
||||
@ -149,7 +149,7 @@ const SfxFilter* SwIoSystem::GetFileFilter(const OUString& rFileName)
|
||||
|
||||
SfxFilterMatcher aMatcher( pFCntnr->GetName() );
|
||||
SfxFilterMatcherIter aIter( aMatcher );
|
||||
const SfxFilter* pFilter = aIter.First();
|
||||
std::shared_ptr<const SfxFilter> pFilter = aIter.First();
|
||||
if ( !pFilter )
|
||||
return nullptr;
|
||||
|
||||
@ -163,7 +163,7 @@ const SfxFilter* SwIoSystem::GetFileFilter(const OUString& rFileName)
|
||||
SfxMedium aMedium(aObj.GetMainURL(INetURLObject::NO_DECODE), STREAM_STD_READ);
|
||||
|
||||
// templates should not get precedence over "normal" filters (#i35508, #i33168)
|
||||
const SfxFilter* pTemplateFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pTemplateFilter;
|
||||
if (aMedium.IsStorage())
|
||||
{
|
||||
uno::Reference<embed::XStorage> const xStor = aMedium.GetStorage();
|
||||
|
@ -285,7 +285,7 @@ void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet )
|
||||
else if ( pObjShell && !sName.isEmpty() )
|
||||
{
|
||||
SfxFilterContainer* pFacCont = pObjShell->GetFactory().GetFilterContainer();
|
||||
const SfxFilter* pFilter = pFacCont->GetFilter4FilterName( sName );
|
||||
std::shared_ptr<const SfxFilter> pFilter = pFacCont->GetFilter4FilterName( sName );
|
||||
if ( pFilter )
|
||||
sNewEntry = pFilter->GetUIName();
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ IMPL_LINK_TYPED(SwMailMergeDocSelectPage, FileSelectHdl, Button*, pButton, void)
|
||||
SfxFilterMatcher aMatcher( OUString::createFromAscii(rFact.GetShortName()) );
|
||||
SfxFilterMatcherIter aIter( aMatcher );
|
||||
Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
|
||||
const SfxFilter* pFlt = aIter.First();
|
||||
std::shared_ptr<const SfxFilter> pFlt = aIter.First();
|
||||
while( pFlt )
|
||||
{
|
||||
if( pFlt && pFlt->IsAllowedAsTemplate() )
|
||||
|
@ -96,7 +96,7 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) :
|
||||
m_pExampleContainerWIN->set_height_request(aSize.Height());
|
||||
get(m_pZoomLB, "zoom");
|
||||
|
||||
const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat(
|
||||
std::shared_ptr<const SfxFilter> pSfxFlt = SwIoSystem::GetFilterOfFormat(
|
||||
FILTER_XML,
|
||||
SwDocShell::Factory().GetFilterContainer() );
|
||||
//save the current document into a temporary file
|
||||
|
@ -695,7 +695,7 @@ IMPL_LINK_TYPED(SwMailMergeOutputPage, SaveOutputHdl_Impl, Button*, pButton, voi
|
||||
OUString sTargetTempURL = URIHelper::SmartRel2Abs(
|
||||
INetURLObject(), utl::TempFile::CreateTempName(),
|
||||
URIHelper::GetMaybeFileHdl());
|
||||
const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat(
|
||||
std::shared_ptr<const SfxFilter> pSfxFlt = SwIoSystem::GetFilterOfFormat(
|
||||
FILTER_XML,
|
||||
SwDocShell::Factory().GetFilterContainer() );
|
||||
|
||||
@ -998,7 +998,7 @@ IMPL_LINK_TYPED(SwMailMergeOutputPage, SendDocumentsHdl_Impl, Button*, pButton,
|
||||
bool bAsBody = false;
|
||||
rtl_TextEncoding eEncoding = ::osl_getThreadTextEncoding();
|
||||
SfxFilterContainer* pFilterContainer = SwDocShell::Factory().GetFilterContainer();
|
||||
const SfxFilter *pSfxFlt = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pSfxFlt;
|
||||
sal_uLong nDocType = reinterpret_cast<sal_uLong>(m_pSendAsLB->GetSelectEntryData());
|
||||
OUString sExtension = lcl_GetExtensionForDocType(nDocType);
|
||||
switch( nDocType )
|
||||
@ -1025,7 +1025,7 @@ IMPL_LINK_TYPED(SwMailMergeOutputPage, SendDocumentsHdl_Impl, Button*, pButton,
|
||||
//because it uses the same user data :-(
|
||||
SfxFilterMatcher aMatcher( pFilterContainer->GetName() );
|
||||
SfxFilterMatcherIter aIter( aMatcher );
|
||||
const SfxFilter* pFilter = aIter.First();
|
||||
std::shared_ptr<const SfxFilter> pFilter = aIter.First();
|
||||
while ( pFilter )
|
||||
{
|
||||
if( pFilter->GetUserData() == FILTER_WW8 && pFilter->CanExport() )
|
||||
@ -1117,7 +1117,7 @@ IMPL_LINK_TYPED(SwMailMergeOutputPage, SendDocumentsHdl_Impl, Button*, pButton,
|
||||
OUString sTargetTempURL = URIHelper::SmartRel2Abs(
|
||||
INetURLObject(), utl::TempFile::CreateTempName(),
|
||||
URIHelper::GetMaybeFileHdl());
|
||||
const SfxFilter *pTargetSfxFlt = SwIoSystem::GetFilterOfFormat(
|
||||
std::shared_ptr<const SfxFilter> pTargetSfxFlt = SwIoSystem::GetFilterOfFormat(
|
||||
FILTER_XML,
|
||||
SwDocShell::Factory().GetFilterContainer() );
|
||||
|
||||
|
@ -580,7 +580,7 @@ IMPL_LINK_TYPED( SwGlossaryDlg, MenuHdl, Menu *, pMn, bool )
|
||||
uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
|
||||
SfxFilterMatcher aMatcher( OUString::createFromAscii(SwDocShell::Factory().GetShortName()) );
|
||||
SfxFilterMatcherIter aIter( aMatcher );
|
||||
const SfxFilter* pFilter = aIter.First();
|
||||
std::shared_ptr<const SfxFilter> pFilter = aIter.First();
|
||||
while ( pFilter )
|
||||
{
|
||||
if( pFilter->GetUserData() == FILTER_WW8 )
|
||||
|
@ -170,7 +170,7 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr,
|
||||
pMedSet->GetItemState( FN_API_CALL, true, &pApiItem ) )
|
||||
bAPICall = static_cast<const SfxBoolItem*>(pApiItem)->GetValue();
|
||||
|
||||
const SfxFilter* pFlt = rMedium.GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFlt = rMedium.GetFilter();
|
||||
if( !pFlt )
|
||||
{
|
||||
if(!bAPICall)
|
||||
@ -399,7 +399,7 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium )
|
||||
|
||||
{
|
||||
// Task 75666 - is the Document imported by our Microsoft-Filters?
|
||||
const SfxFilter* pOldFilter = GetMedium()->GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pOldFilter = GetMedium()->GetFilter();
|
||||
if( pOldFilter &&
|
||||
( pOldFilter->GetUserData() == FILTER_WW8 ||
|
||||
pOldFilter->GetUserData() == "CWW6" ||
|
||||
@ -534,7 +534,7 @@ static SwSrcView* lcl_GetSourceView( SwDocShell* pSh )
|
||||
|
||||
bool SwDocShell::ConvertTo( SfxMedium& rMedium )
|
||||
{
|
||||
const SfxFilter* pFlt = rMedium.GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFlt = rMedium.GetFilter();
|
||||
if( !pFlt )
|
||||
return false;
|
||||
|
||||
|
@ -510,7 +510,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
|
||||
SfxFilterMatcher aMatcher( OUString::createFromAscii(rFact.GetShortName()) );
|
||||
SfxFilterMatcherIter aIter( aMatcher );
|
||||
uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
|
||||
const SfxFilter* pFlt = aIter.First();
|
||||
std::shared_ptr<const SfxFilter> pFlt = aIter.First();
|
||||
while( pFlt )
|
||||
{
|
||||
// --> OD #i117339#
|
||||
@ -524,7 +524,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
|
||||
pFlt = aIter.Next();
|
||||
}
|
||||
bool bWeb = dynamic_cast< SwWebDocShell *>( this ) != nullptr;
|
||||
const SfxFilter *pOwnFlt =
|
||||
std::shared_ptr<const SfxFilter> pOwnFlt =
|
||||
SwDocShell::Factory().GetFilterContainer()->
|
||||
GetFilter4FilterName("writer8");
|
||||
|
||||
@ -591,7 +591,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
|
||||
// 1 - file unsaved -> save as HTML
|
||||
// 2 - file modified and HTML filter active -> save
|
||||
// 3 - file saved in non-HTML -> QueryBox to save as HTML
|
||||
const SfxFilter* pHtmlFlt =
|
||||
std::shared_ptr<const SfxFilter> pHtmlFlt =
|
||||
SwIoSystem::GetFilterOfFormat(
|
||||
"HTML",
|
||||
SwWebDocShell::Factory().GetFilterContainer() );
|
||||
@ -599,7 +599,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
|
||||
if(bLocalHasName)
|
||||
{
|
||||
//check for filter type
|
||||
const SfxFilter* pFlt = GetMedium()->GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFlt = GetMedium()->GetFilter();
|
||||
if(!pFlt || pFlt->GetUserData() != pHtmlFlt->GetUserData())
|
||||
{
|
||||
ScopedVclPtrInstance<MessageDialog> aQuery(&pViewFrame->GetWindow(),
|
||||
@ -915,7 +915,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
|
||||
aDlgHelper.SetControlHelpIds( nControlIds, pHelpIds );
|
||||
uno::Reference < XFilePicker2 > xFP = aDlgHelper.GetFilePicker();
|
||||
|
||||
const SfxFilter* pFlt;
|
||||
std::shared_ptr<const SfxFilter> pFlt;
|
||||
sal_uInt16 nStrId;
|
||||
|
||||
if( bCreateHtml )
|
||||
@ -1393,13 +1393,13 @@ sal_uLong SwDocShell::LoadStylesFromFile( const OUString& rURL,
|
||||
|
||||
// search for filter in WebDocShell, too
|
||||
SfxMedium aMed( rURL, STREAM_STD_READ );
|
||||
const SfxFilter* pFlt = nullptr;
|
||||
aMatcher.DetectFilter( aMed, &pFlt );
|
||||
std::shared_ptr<const SfxFilter> pFlt;
|
||||
aMatcher.DetectFilter( aMed, pFlt );
|
||||
if(!pFlt)
|
||||
{
|
||||
OUString sWebFactory(OUString::createFromAscii(SwWebDocShell::Factory().GetShortName()));
|
||||
SfxFilterMatcher aWebMatcher( sWebFactory );
|
||||
aWebMatcher.DetectFilter( aMed, &pFlt );
|
||||
aWebMatcher.DetectFilter( aMed, pFlt );
|
||||
}
|
||||
// --> OD #i117339# - trigger import only for own formats
|
||||
bool bImport( false );
|
||||
@ -1550,7 +1550,7 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh,
|
||||
if( INetProtocol::File == aTmpObj.GetProtocol() )
|
||||
xMed->Download(); // Touch the medium (download it)
|
||||
|
||||
const SfxFilter* pSfxFlt = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pSfxFlt;
|
||||
if (!xMed->GetError())
|
||||
{
|
||||
SfxFilterMatcher aMatcher( OUString::createFromAscii(SwDocShell::Factory().GetShortName()) );
|
||||
@ -1568,7 +1568,7 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh,
|
||||
xMed->GetItemSet()->Put( SfxStringItem( SID_PASSWORD, rPasswd ));
|
||||
|
||||
if( !pSfxFlt )
|
||||
aMatcher.DetectFilter( *xMed, &pSfxFlt );
|
||||
aMatcher.DetectFilter( *xMed, pSfxFlt );
|
||||
|
||||
if( pSfxFlt )
|
||||
{
|
||||
|
@ -990,7 +990,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
|
||||
pSfxDispatcher->Execute( pSourceDocSh->HasName() ? SID_SAVEDOC : SID_SAVEASDOC, SfxCallMode::SYNCHRON|SfxCallMode::RECORD);
|
||||
if( bMergeShell || !pSourceDocSh->IsModified() )
|
||||
{
|
||||
const SfxFilter* pStoreToFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pStoreToFilter;
|
||||
const OUString* pStoreToFilterOptions = nullptr;
|
||||
|
||||
CreateStoreToFilter(pStoreToFilter, pStoreToFilterOptions, pSourceDocSh, bEMail, rMergeDescriptor);
|
||||
@ -1327,7 +1327,7 @@ void SwDBManager::GetPathAddress(OUString &sPath, OUString &sAddress, uno::Refer
|
||||
|
||||
bool SwDBManager::CreateNewTemp(OUString &sPath, const OUString &sAddress,
|
||||
std::unique_ptr< utl::TempFile > &aTempFile,
|
||||
const SwMergeDescriptor& rMergeDescriptor, const SfxFilter* pStoreToFilter)
|
||||
const SwMergeDescriptor& rMergeDescriptor, std::shared_ptr<const SfxFilter> pStoreToFilter)
|
||||
{
|
||||
INetURLObject aEntry(sPath);
|
||||
OUString sLeading;
|
||||
@ -1469,7 +1469,7 @@ void SwDBManager::UpdateExpFields(SwWrtShell& rWorkShell, SfxObjectShellLock xWo
|
||||
}
|
||||
}
|
||||
|
||||
void SwDBManager::CreateStoreToFilter(const SfxFilter *&pStoreToFilter, const OUString *&pStoreToFilterOptions,
|
||||
void SwDBManager::CreateStoreToFilter(std::shared_ptr<const SfxFilter>& pStoreToFilter, const OUString *&pStoreToFilterOptions,
|
||||
SwDocShell *pSourceDocSh, bool bEMail, const SwMergeDescriptor &rMergeDescriptor)
|
||||
{
|
||||
pStoreToFilter = SwIoSystem::GetFileFilter(
|
||||
@ -1484,7 +1484,7 @@ void SwDBManager::CreateStoreToFilter(const SfxFilter *&pStoreToFilter, const OU
|
||||
}
|
||||
else if( !rMergeDescriptor.sSaveToFilter.isEmpty())
|
||||
{
|
||||
const SfxFilter* pFilter =
|
||||
std::shared_ptr<const SfxFilter> pFilter =
|
||||
pFilterContainer->GetFilter4FilterName( rMergeDescriptor.sSaveToFilter );
|
||||
if(pFilter)
|
||||
{
|
||||
@ -1618,7 +1618,7 @@ void SwDBManager::FinishMailMergeFile(SfxObjectShellLock &xWorkDocSh, SwView *pW
|
||||
|
||||
bool SwDBManager::SavePrintDoc(SfxObjectShellRef xTargetDocShell, SwView *pTargetView, const SwMergeDescriptor &rMergeDescriptor,
|
||||
std::unique_ptr< utl::TempFile > &aTempFile,
|
||||
const SfxFilter *&pStoreToFilter, const OUString *&pStoreToFilterOptions,
|
||||
std::shared_ptr<const SfxFilter>& pStoreToFilter, const OUString *&pStoreToFilterOptions,
|
||||
const bool bMergeShell, bool bCreateSingleFile, const bool bPrinter)
|
||||
{
|
||||
bool bNoError = true;
|
||||
@ -2965,7 +2965,7 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh,
|
||||
{
|
||||
//copy rSh to aTempFile
|
||||
OUString sTempURL;
|
||||
const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat(
|
||||
std::shared_ptr<const SfxFilter> pSfxFlt = SwIoSystem::GetFilterOfFormat(
|
||||
FILTER_XML,
|
||||
SwDocShell::Factory().GetFilterContainer() );
|
||||
try
|
||||
|
@ -710,11 +710,11 @@ bool SwGlossaryHdl::ImportGlossaries( const OUString& rName )
|
||||
bool bRet = false;
|
||||
if( !rName.isEmpty() )
|
||||
{
|
||||
const SfxFilter* pFilter = nullptr;
|
||||
std::shared_ptr<const SfxFilter> pFilter;
|
||||
std::unique_ptr<SfxMedium> pMed(new SfxMedium( rName, StreamMode::READ, nullptr, nullptr ));
|
||||
SfxFilterMatcher aMatcher( OUString("swriter") );
|
||||
pMed->UseInteractionHandler( true );
|
||||
if (!aMatcher.GuessFilter(*pMed, &pFilter, SfxFilterFlags::NONE))
|
||||
if (!aMatcher.GuessFilter(*pMed, pFilter, SfxFilterFlags::NONE))
|
||||
{
|
||||
SwTextBlocks *pGlossary = nullptr;
|
||||
pMed->SetFilter( pFilter );
|
||||
|
@ -2568,7 +2568,7 @@ bool SwTransferable::_PasteFileName( TransferableDataHelper& rData,
|
||||
|
||||
//Own FileFormat? --> insert, not for StarWriter/Web
|
||||
OUString sFileURL = URIHelper::SmartRel2Abs(INetURLObject(), sFile, Link<OUString *, bool>(), false );
|
||||
const SfxFilter* pFlt = SwPasteSdr::SetAttr == nAction
|
||||
std::shared_ptr<const SfxFilter> pFlt = SwPasteSdr::SetAttr == nAction
|
||||
? nullptr : SwIoSystem::GetFileFilter(sFileURL);
|
||||
if( pFlt && dynamic_cast< const SwWebDocShell *>( rSh.GetView().GetDocShell() ) == nullptr )
|
||||
{
|
||||
|
@ -304,7 +304,7 @@ void SwSrcView::Execute(SfxRequest& rReq)
|
||||
|
||||
// search for an html filter for export
|
||||
SfxFilterContainer* pFilterCont = GetObjectShell()->GetFactory().GetFilterContainer();
|
||||
const SfxFilter* pFilter =
|
||||
std::shared_ptr<const SfxFilter> pFilter =
|
||||
pFilterCont->GetFilter4Extension( "html", SfxFilterFlags::EXPORT );
|
||||
if ( pFilter )
|
||||
{
|
||||
@ -796,7 +796,7 @@ void SwSrcView::Load(SwDocShell* pDocShell)
|
||||
aEditWin->SetTextEncoding(eDestEnc);
|
||||
SfxMedium* pMedium = pDocShell->GetMedium();
|
||||
|
||||
const SfxFilter* pFilter = pMedium->GetFilter();
|
||||
std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter();
|
||||
bool bHtml = pFilter && pFilter->GetUserData() == "HTML";
|
||||
bool bDocModified = pDocShell->IsModified();
|
||||
if(bHtml && !bDocModified && pDocShell->HasName())
|
||||
|
@ -2110,13 +2110,13 @@ long SwView::InsertDoc( sal_uInt16 nSlotId, const OUString& rFileName, const OUS
|
||||
if( !rFileName.isEmpty() )
|
||||
{
|
||||
SfxObjectFactory& rFact = pDocSh->GetFactory();
|
||||
const SfxFilter* pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( rFilterName );
|
||||
std::shared_ptr<const SfxFilter> pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( rFilterName );
|
||||
if ( !pFilter )
|
||||
{
|
||||
pMed = new SfxMedium(rFileName, StreamMode::READ, nullptr, nullptr );
|
||||
SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() );
|
||||
pMed->UseInteractionHandler( true );
|
||||
ErrCode nErr = aMatcher.GuessFilter(*pMed, &pFilter, SfxFilterFlags::NONE);
|
||||
ErrCode nErr = aMatcher.GuessFilter(*pMed, pFilter, SfxFilterFlags::NONE);
|
||||
if ( nErr )
|
||||
DELETEZ(pMed);
|
||||
else
|
||||
|
@ -774,7 +774,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
|
||||
}
|
||||
|
||||
// save document with temporary filename
|
||||
const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat(
|
||||
std::shared_ptr<const SfxFilter> pSfxFlt = SwIoSystem::GetFilterOfFormat(
|
||||
FILTER_XML,
|
||||
SwDocShell::Factory().GetFilterContainer() );
|
||||
OUString aExtension(comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(), '*'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user