Kaydet (Commit) 6a7250d7 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

String to rtl::OUString & reduce indent levels.

üst 25e019f4
...@@ -58,76 +58,74 @@ void ScGlobal::InitAddIns() ...@@ -58,76 +58,74 @@ void ScGlobal::InitAddIns()
{ {
// multi paths separated by semicolons // multi paths separated by semicolons
SvtPathOptions aPathOpt; SvtPathOptions aPathOpt;
String aMultiPath = aPathOpt.GetAddinPath(); rtl::OUString aMultiPath = aPathOpt.GetAddinPath();
if ( aMultiPath.Len() > 0 ) if (aMultiPath.isEmpty())
return;
sal_Int32 nTokens = comphelper::string::getTokenCount(aMultiPath, ';');
for (sal_Int32 j = 0; j < nTokens; ++j)
{ {
xub_StrLen nTokens = comphelper::string::getTokenCount(aMultiPath, ';'); rtl::OUString aPath = comphelper::string::getToken(aMultiPath, j, ';');
xub_StrLen nIndex = 0; if (aPath.isEmpty())
for ( xub_StrLen j=0; j<nTokens; j++ ) continue;
// use LocalFileHelper to convert the path to a URL that always points
// to the file on the server
rtl::OUString aUrl;
if ( utl::LocalFileHelper::ConvertPhysicalNameToURL( aPath, aUrl ) )
aPath = aUrl;
INetURLObject aObj;
aObj.SetSmartURL( aPath );
aObj.setFinalSlash();
try
{ {
String aPath( aMultiPath.GetToken( 0, ';', nIndex ) ); ::ucbhelper::Content aCnt( aObj.GetMainURL(INetURLObject::NO_DECODE),
if ( aPath.Len() > 0 ) Reference< XCommandEnvironment > () );
Reference< sdbc::XResultSet > xResultSet;
Sequence< rtl::OUString > aProps;
try
{
xResultSet = aCnt.createCursor(
aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
}
catch ( Exception& )
{ {
// use LocalFileHelper to convert the path to a URL that always points // ucb may throw different exceptions on failure now
// to the file on the server // no assertion if AddIn directory doesn't exist
rtl::OUString aUrl; }
if ( utl::LocalFileHelper::ConvertPhysicalNameToURL( aPath, aUrl ) )
aPath = aUrl; if ( xResultSet.is() )
{
INetURLObject aObj; Reference< sdbc::XRow > xRow( xResultSet, UNO_QUERY );
aObj.SetSmartURL( aPath ); Reference< XContentAccess >
aObj.setFinalSlash(); xContentAccess( xResultSet, UNO_QUERY );
try try
{ {
::ucbhelper::Content aCnt( aObj.GetMainURL(INetURLObject::NO_DECODE), if ( xResultSet->first() )
Reference< XCommandEnvironment > () );
Reference< sdbc::XResultSet > xResultSet;
Sequence< rtl::OUString > aProps;
try
{
xResultSet = aCnt.createCursor(
aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
}
catch ( Exception& )
{
// ucb may throw different exceptions on failure now
// no assertion if AddIn directory doesn't exist
}
if ( xResultSet.is() )
{ {
Reference< sdbc::XRow > xRow( xResultSet, UNO_QUERY ); do
Reference< XContentAccess >
xContentAccess( xResultSet, UNO_QUERY );
try
{
if ( xResultSet->first() )
{
do
{
rtl::OUString aId( xContentAccess->queryContentIdentifierString() );
InitExternalFunc( aId );
}
while ( xResultSet->next() );
}
}
catch ( Exception& )
{ {
OSL_FAIL( "ResultSetException catched!" ); rtl::OUString aId = xContentAccess->queryContentIdentifierString();
InitExternalFunc( aId );
} }
while ( xResultSet->next() );
} }
} }
catch ( Exception& ) catch ( Exception& )
{ {
OSL_FAIL( "Exception catched!" ); OSL_FAIL( "ResultSetException caught!" );
}
catch ( ... )
{
OSL_FAIL( "unexpected exception caught!" );
} }
} }
} }
catch ( Exception& )
{
OSL_FAIL( "Exception caught!" );
}
catch ( ... )
{
OSL_FAIL( "unexpected exception caught!" );
}
} }
} }
......
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