diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-04-09 11:34:45 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-04-09 13:01:26 -0400 |
commit | 746f8a08f55fe9597cbab63342ee3c91254f148b (patch) | |
tree | 72d5f0809fbeb55d161d31270a553be7d979aa68 /sfx2 | |
parent | aa6e3a1d252ac7e86a6338f366b3127b1ea7dcf8 (diff) |
Make the member mutable to avoid ugly casting.
Change-Id: I28fd84b89a8d443e502d2c0e76f38cf006a57d4a
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/bastyp/fltfnc.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 27 |
2 files changed, 28 insertions, 11 deletions
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index ff9d51ca88ac..53e3c2601034 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -248,10 +248,10 @@ class SfxFilterMatcher_Impl { public: OUString aName; - SfxFilterList_Impl* pList; // is created on demand + mutable SfxFilterList_Impl* pList; // is created on demand void InitForIterating() const; - void Update(); + void Update() const; SfxFilterMatcher_Impl(const OUString &rName) : aName(rName) , pList(0) @@ -321,7 +321,7 @@ SfxFilterMatcher::~SfxFilterMatcher() aImplArr.clear(); } -void SfxFilterMatcher_Impl::Update() +void SfxFilterMatcher_Impl::Update() const { if ( pList ) { @@ -348,13 +348,13 @@ void SfxFilterMatcher_Impl::InitForIterating() const if ( !aName.isEmpty() ) { // matcher of factory: use only filters of that document type - ((SfxFilterMatcher_Impl*)this)->pList = new SfxFilterList_Impl; - ((SfxFilterMatcher_Impl*)this)->Update(); + pList = new SfxFilterList_Impl; + Update(); } else { // global matcher: use global filter array - ((SfxFilterMatcher_Impl*)this)->pList = pFilterArr; + pList = pFilterArr; } } diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 5c15239f53e2..edd5fed57813 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2873,11 +2873,28 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) : pImp->m_pSet = pParams; TransformParameters( SID_OPENDOC, aArgs, *pParams ); - String 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 ); + OUString aFilterProvider; + { + const SfxPoolItem* pItem = NULL; + if (pImp->m_pSet->HasItem(SID_FILTER_PROVIDER, &pItem)) + 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 ); if( pSalvageItem ) |