diff options
Diffstat (limited to 'svx/source/xoutdev/xtable.cxx')
-rw-r--r-- | svx/source/xoutdev/xtable.cxx | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index 5e35be97a2c7..b3f1416d8ceb 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -25,6 +25,7 @@ #include <svx/xpool.hxx> #include <svx/svdobj.hxx> #include <svx/svdpool.hxx> +#include <stack> using namespace com::sun::star; @@ -224,23 +225,41 @@ bool XPropertyList::Load() if( mbListDirty ) { mbListDirty = false; + std::stack<OUString> aDirs; - INetURLObject aURL( maPath ); - - if( INetProtocol::NotValid == aURL.GetProtocol() ) + sal_Int32 nIndex = 0; + do { - DBG_ASSERT( maPath.isEmpty(), "invalid URL" ); - return false; + aDirs.push(maPath.getToken(0, ';', nIndex)); } + while (nIndex >= 0); + + //try all entries palette path list working back to front until one + //succeeds + while (!aDirs.empty()) + { + OUString aPath(aDirs.top()); + aDirs.pop(); + + INetURLObject aURL(aPath); + + if( INetProtocol::NotValid == aURL.GetProtocol() ) + { + DBG_ASSERT( aPath.isEmpty(), "invalid URL" ); + return false; + } - aURL.Append( maName ); + aURL.Append( maName ); - if( aURL.getExtension().isEmpty() ) - aURL.setExtension( GetDefaultExt() ); + if( aURL.getExtension().isEmpty() ) + aURL.setExtension( GetDefaultExt() ); - return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), maReferer, - uno::Reference < embed::XStorage >(), - createInstance(), NULL ); + bool bRet = SvxXMLXTableImport::load(aURL.GetMainURL(INetURLObject::NO_DECODE), + maReferer, uno::Reference < embed::XStorage >(), + createInstance(), NULL ); + if (bRet) + return bRet; + } } return false; } @@ -256,11 +275,20 @@ bool XPropertyList::LoadFrom( const uno::Reference < embed::XStorage > &xStorage bool XPropertyList::Save() { - INetURLObject aURL( maPath ); + //save to the last path in the palette path list + OUString aLastDir; + sal_Int32 nIndex = 0; + do + { + aLastDir = maPath.getToken(0, ';', nIndex); + } + while (nIndex >= 0); + + INetURLObject aURL(aLastDir); if( INetProtocol::NotValid == aURL.GetProtocol() ) { - DBG_ASSERT( maPath.isEmpty(), "invalid URL" ); + DBG_ASSERT( aLastDir.isEmpty(), "invalid URL" ); return false; } |