Kaydet (Commit) 746f8a08 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Make the member mutable to avoid ugly casting.

Change-Id: I28fd84b89a8d443e502d2c0e76f38cf006a57d4a
üst aa6e3a1d
...@@ -248,10 +248,10 @@ class SfxFilterMatcher_Impl ...@@ -248,10 +248,10 @@ class SfxFilterMatcher_Impl
{ {
public: public:
OUString aName; OUString aName;
SfxFilterList_Impl* pList; // is created on demand mutable SfxFilterList_Impl* pList; // is created on demand
void InitForIterating() const; void InitForIterating() const;
void Update(); void Update() const;
SfxFilterMatcher_Impl(const OUString &rName) SfxFilterMatcher_Impl(const OUString &rName)
: aName(rName) : aName(rName)
, pList(0) , pList(0)
...@@ -321,7 +321,7 @@ SfxFilterMatcher::~SfxFilterMatcher() ...@@ -321,7 +321,7 @@ SfxFilterMatcher::~SfxFilterMatcher()
aImplArr.clear(); aImplArr.clear();
} }
void SfxFilterMatcher_Impl::Update() void SfxFilterMatcher_Impl::Update() const
{ {
if ( pList ) if ( pList )
{ {
...@@ -348,13 +348,13 @@ void SfxFilterMatcher_Impl::InitForIterating() const ...@@ -348,13 +348,13 @@ void SfxFilterMatcher_Impl::InitForIterating() const
if ( !aName.isEmpty() ) if ( !aName.isEmpty() )
{ {
// matcher of factory: use only filters of that document type // matcher of factory: use only filters of that document type
((SfxFilterMatcher_Impl*)this)->pList = new SfxFilterList_Impl; pList = new SfxFilterList_Impl;
((SfxFilterMatcher_Impl*)this)->Update(); Update();
} }
else else
{ {
// global matcher: use global filter array // global matcher: use global filter array
((SfxFilterMatcher_Impl*)this)->pList = pFilterArr; pList = pFilterArr;
} }
} }
......
...@@ -2873,11 +2873,28 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) : ...@@ -2873,11 +2873,28 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) :
pImp->m_pSet = pParams; pImp->m_pSet = pParams;
TransformParameters( SID_OPENDOC, aArgs, *pParams ); TransformParameters( SID_OPENDOC, aArgs, *pParams );
String aFilterName; OUString aFilterProvider;
SFX_ITEMSET_ARG( pImp->m_pSet, pFilterNameItem, SfxStringItem, SID_FILTER_NAME, false ); {
if( pFilterNameItem ) const SfxPoolItem* pItem = NULL;
aFilterName = pFilterNameItem->GetValue(); if (pImp->m_pSet->HasItem(SID_FILTER_PROVIDER, &pItem))
pImp->m_pFilter = SFX_APP()->GetFilterMatcher().GetFilter4FilterName( aFilterName ); aFilterProvider = static_cast<const SfxStringItem*>(pItem)->GetValue();
}
fprintf(stdout, "SfxMedium::SfxMedium: filter provider = '%s'\n", rtl::OUStringToOString(aFilterProvider, RTL_TEXTENCODING_UTF8).getStr());
if (aFilterProvider.isEmpty())
{
// This is a conventional filter type.
OUString aFilterName;
SFX_ITEMSET_ARG( pImp->m_pSet, pFilterNameItem, SfxStringItem, SID_FILTER_NAME, false );
if( pFilterNameItem )
aFilterName = pFilterNameItem->GetValue();
pImp->m_pFilter = SFX_APP()->GetFilterMatcher().GetFilter4FilterName( aFilterName );
}
else
{
// This filter is from an external provider such as orcus.
}
SFX_ITEMSET_ARG( pImp->m_pSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, false ); SFX_ITEMSET_ARG( pImp->m_pSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, false );
if( pSalvageItem ) if( pSalvageItem )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment