diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-04-09 15:36:03 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-04-13 01:54:35 -0400 |
commit | 0552a09b95010d0f622688c2508a0684803a3fa5 (patch) | |
tree | 7bc34a9a805cddd9686a3ff5614ca92771cf05c2 /sfx2 | |
parent | 938d2f9502359f696b0680f249c8e644cd1caba0 (diff) |
Manage to use orcus to import ods, xlsx, and csv.
But this occasionally crashes.
Change-Id: I0a18d0e210639b43b89b966a54de541b9a43e329
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfx2/docfilt.hxx | 19 | ||||
-rw-r--r-- | sfx2/inc/sfx2/objsh.hxx | 4 | ||||
-rw-r--r-- | sfx2/source/bastyp/fltfnc.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 15 | ||||
-rw-r--r-- | sfx2/source/doc/docfilt.cxx | 15 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 5 |
7 files changed, 46 insertions, 20 deletions
diff --git a/sfx2/inc/sfx2/docfilt.hxx b/sfx2/inc/sfx2/docfilt.hxx index 8400e5a6b16e..cc6f6b8c1971 100644 --- a/sfx2/inc/sfx2/docfilt.hxx +++ b/sfx2/inc/sfx2/docfilt.hxx @@ -34,12 +34,12 @@ #include <sfx2/sfxdefs.hxx> -//======================================================================== class SfxFilterContainer; class SotStorage; + class SFX2_DLLPUBLIC SfxFilter { -friend class SfxFilterContainer; + friend class SfxFilterContainer; WildCard aWildCard; @@ -47,17 +47,25 @@ friend class SfxFilterContainer; OUString aUserData; OUString aServiceName; OUString aMimeType; - OUString aFilterName; + OUString maFilterName; OUString aPattern; OUString aUIName; OUString aDefaultTemplate; + /** + * Custom provider name in case the filter is provided via external + * libraries. Empty for conventional filter types. + */ + OUString maProvider; + SfxFilterFlags nFormatType; sal_uIntPtr nVersion; sal_uIntPtr lFormat; sal_uInt16 nDocIcon; public: + SfxFilter( const OUString& rProvider, const OUString& rFilterName ); + SfxFilter( const OUString &rName, const OUString &rWildCard, SfxFilterFlags nFormatType, @@ -77,9 +85,9 @@ public: bool CanExport() const { return nFormatType & SFX_FILTER_EXPORT; } bool IsInternal() const { return nFormatType & SFX_FILTER_INTERNAL; } SfxFilterFlags GetFilterFlags() const { return nFormatType; } - const OUString& GetFilterName() const { return aFilterName; } + const OUString& GetFilterName() const { return maFilterName; } const OUString& GetMimeType() const { return aMimeType; } - const OUString& GetName() const { return aFilterName; } + const OUString& GetName() const { return maFilterName; } const WildCard& GetWildcard() const { return aWildCard; } const OUString& GetRealTypeName() const { return aTypeName; } sal_uIntPtr GetFormat() const { return lFormat; } @@ -98,6 +106,7 @@ public: OUString GetSuffixes() const; OUString GetDefaultExtension() const; const OUString& GetServiceName() const { return aServiceName; } + const OUString& GetProviderName() const; static const SfxFilter* GetDefaultFilter( const String& rName ); static const SfxFilter* GetFilterByName( const String& rName ); diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 5f1018e6ad6e..4c366a56710f 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -308,7 +308,7 @@ public: bool DoInitUnitTest(); sal_Bool DoInitNew( SfxMedium* pMedium=0 ); sal_Bool DoLoad( SfxMedium* pMedium ); - bool DoLoadExternal(SfxMedium* pMed, const OUString& rProvider); + bool DoLoadExternal( SfxMedium* pMed ); sal_Bool DoSave(); sal_Bool DoSaveAs( SfxMedium &rNewStor ); sal_Bool DoSaveObjectAs( SfxMedium &rNewStor, sal_Bool bCommit ); @@ -329,7 +329,7 @@ public: virtual sal_Bool SwitchPersistance( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); virtual void UpdateLinks(); - virtual bool LoadExternal(SfxMedium& rMedium, const OUString& rProvider); + virtual bool LoadExternal( SfxMedium& rMedium ); /** * Called when the Options dialog is dismissed with the OK button, to * handle potentially conflicting option settings. diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 78b3607dadba..43e0f1009880 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -1087,7 +1087,7 @@ void SfxFilterContainer::ReadSingleFilter_Impl( } else { - pFilter->aFilterName = sFilterName; + pFilter->maFilterName = sFilterName; pFilter->aWildCard = WildCard(sExtension, ';'); pFilter->nFormatType = nFlags; pFilter->lFormat = nClipboardId; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 3d57ae8b1499..79e32c374e08 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -125,6 +125,7 @@ #include "officecfg/Office/Common.hxx" #include <boost/noncopyable.hpp> +#include <boost/scoped_ptr.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -278,6 +279,8 @@ public: mutable INetURLObject* m_pURLObj; const SfxFilter* m_pFilter; + boost::scoped_ptr<SfxFilter> m_pCustomFilter; + SfxMedium* pAntiImpl; SvStream* m_pInStream; SvStream* m_pOutStream; @@ -2869,26 +2872,26 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) : pImp->m_pSet = pParams; TransformParameters( SID_OPENDOC, aArgs, *pParams ); - OUString aFilterProvider; + OUString aFilterProvider, aFilterName; { const SfxPoolItem* pItem = NULL; if (pImp->m_pSet->HasItem(SID_FILTER_PROVIDER, &pItem)) aFilterProvider = static_cast<const SfxStringItem*>(pItem)->GetValue(); + + if (pImp->m_pSet->HasItem(SID_FILTER_NAME, &pItem)) + aFilterName = static_cast<const SfxStringItem*>(pItem)->GetValue(); } 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. - + pImp->m_pCustomFilter.reset(new SfxFilter(aFilterProvider, aFilterName)); + pImp->m_pFilter = pImp->m_pCustomFilter.get(); } SFX_ITEMSET_ARG( pImp->m_pSet, pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, false ); diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index ce95b9b46300..d642f02ace72 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -40,6 +40,12 @@ using namespace ::com::sun::star; DBG_NAME(SfxFilter) +SfxFilter::SfxFilter( const OUString& rProvider, const OUString &rFilterName ) : + maFilterName(rFilterName), + maProvider(rProvider) +{ +} + SfxFilter::SfxFilter( const OUString &rName, const OUString &rWildCard, SfxFilterFlags nType, @@ -54,8 +60,8 @@ SfxFilter::SfxFilter( const OUString &rName, aUserData(rUsrDat), aServiceName(rServiceName), aMimeType(rMimeType), - aFilterName(rName), - aUIName(aFilterName), + maFilterName(rName), + aUIName(maFilterName), nFormatType(nType), nVersion(SOFFICE_FILEFORMAT_50), lFormat(lFmt), @@ -101,6 +107,11 @@ OUString SfxFilter::GetDefaultExtension() const return comphelper::string::getToken(GetWildcard().getGlob(), 0, ';'); } +const OUString& SfxFilter::GetProviderName() const +{ + return maProvider; +} + void SfxFilter::SetURLPattern( const OUString& rStr ) { aPattern = rStr.toAsciiLowerCase(); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 0008014b87e8..a6fef7693f60 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -858,10 +858,10 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed ) return bOk; } -bool SfxObjectShell::DoLoadExternal(SfxMedium *pMed, const OUString& rProvider) +bool SfxObjectShell::DoLoadExternal( SfxMedium *pMed ) { pMedium = pMed; - return LoadExternal(*pMedium, rProvider); + return LoadExternal(*pMedium); } sal_uInt32 SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc ) @@ -3606,7 +3606,7 @@ void SfxObjectShell::UpdateLinks() { } -bool SfxObjectShell::LoadExternal(SfxMedium&, const OUString&) +bool SfxObjectShell::LoadExternal( SfxMedium& ) { // Not implemented. It's an error if the code path ever comes here. return false; diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 3cfec8c97554..a333a984af56 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1854,8 +1854,11 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA OUString aFilterProvider = getFilterProvider(seqArguments); if (!aFilterProvider.isEmpty()) { - if (!m_pData->m_pObjectShell->DoLoadExternal(pMedium, aFilterProvider)) + if (!m_pData->m_pObjectShell->DoLoadExternal(pMedium)) + { delete pMedium; + return; + } pMedium->SetUpdatePickList(false); return; |