summaryrefslogtreecommitdiff
path: root/sc/source/ui/vba/testvba/testvba.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/vba/testvba/testvba.cxx')
-rw-r--r--sc/source/ui/vba/testvba/testvba.cxx77
1 files changed, 38 insertions, 39 deletions
diff --git a/sc/source/ui/vba/testvba/testvba.cxx b/sc/source/ui/vba/testvba/testvba.cxx
index 8e8729a31ae9..05060b6f6f8a 100644
--- a/sc/source/ui/vba/testvba/testvba.cxx
+++ b/sc/source/ui/vba/testvba/testvba.cxx
@@ -60,7 +60,6 @@ using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::uno::XInterface;
using ::com::sun::star::ucb::XSimpleFileAccess3;
using ::com::sun::star::document::XTypeDetection;
-using ::rtl::OUString;
using ::std::auto_ptr;
@@ -68,7 +67,7 @@ const OUString EXTN(".xls");
OUString convertToURL( const OUString& rPath )
{
- rtl::OUString aURL;
+ OUString aURL;
INetURLObject aObj;
aObj.SetURL( rPath );
bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
@@ -78,7 +77,7 @@ OUString convertToURL( const OUString& rPath )
{
osl::FileBase::getFileURLFromSystemPath( rPath, aURL );
if ( aURL.equals( rPath ) )
- throw uno::RuntimeException( rtl::OUString( "could'nt convert " ).concat( rPath ).concat( rtl::OUString( " to a URL, is it a fully qualified path name? " ) ), Reference< uno::XInterface >() );
+ throw uno::RuntimeException( OUString( "could'nt convert " ).concat( rPath ).concat( OUString( " to a URL, is it a fully qualified path name? " ) ), Reference< uno::XInterface >() );
}
return aURL;
}
@@ -108,55 +107,55 @@ private:
Reference< XMultiComponentFactory > mxMCF;
Reference< XComponentLoader > mxCompLoader;
Reference< XSimpleFileAccess3 > mxSFA;
- rtl::OUString msOutDirPath;
+ OUString msOutDirPath;
protected:
public:
TestVBA( const Reference< XComponentContext >& _xContext,
const Reference< XMultiComponentFactory >& _xMCF,
const Reference< XComponentLoader >& _xCompLoader,
- const rtl::OUString& _outDirPath ) : mxContext( _xContext ), mxMCF( _xMCF ),
+ const OUString& _outDirPath ) : mxContext( _xContext ), mxMCF( _xMCF ),
mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) )
{
mxSFA.set( ucb::SimpleFileAccess::create(_xContext) );
}
- rtl::OUString getLogLocation() throw ( beans::UnknownPropertyException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::Exception )
+ OUString getLogLocation() throw ( beans::UnknownPropertyException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::Exception )
{
- rtl::OUString sLogLocation;
- Reference< XPropertySet > pathSettings( mxMCF->createInstanceWithContext( rtl::OUString( "com.sun.star.comp.framework.PathSettings" ), mxContext), uno::UNO_QUERY_THROW );
- pathSettings->getPropertyValue( rtl::OUString( "Work" ) ) >>= sLogLocation;
- sLogLocation = sLogLocation.concat( rtl::OUString( "/" ) ).concat( rtl::OUString( "HelperAPI-test.log" ) );
+ OUString sLogLocation;
+ Reference< XPropertySet > pathSettings( mxMCF->createInstanceWithContext( OUString( "com.sun.star.comp.framework.PathSettings" ), mxContext), uno::UNO_QUERY_THROW );
+ pathSettings->getPropertyValue( OUString( "Work" ) ) >>= sLogLocation;
+ sLogLocation = sLogLocation.concat( OUString( "/" ) ).concat( OUString( "HelperAPI-test.log" ) );
return sLogLocation;
}
- rtl::OUString getLogLocationWithName( OUString fileName ) throw ( beans::UnknownPropertyException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::Exception )
+ OUString getLogLocationWithName( OUString fileName ) throw ( beans::UnknownPropertyException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::Exception )
{
printf("%s\n", getenv("HOME") );
- printf("file name %s\n", rtl::OUStringToOString( fileName, RTL_TEXTENCODING_UTF8 ).getStr() );
- rtl::OUString sLogLocation;
- Reference< XPropertySet > pathSettings( mxMCF->createInstanceWithContext( rtl::OUString( "com.sun.star.comp.framework.PathSettings" ), mxContext), uno::UNO_QUERY_THROW );
- pathSettings->getPropertyValue( rtl::OUString( "Work" ) ) >>= sLogLocation;
- sLogLocation = sLogLocation.concat( rtl::OUString( "/" ) ).concat( fileName.copy ( 0, fileName.lastIndexOf( EXTN ) ) + rtl::OUString( ".log" ) );
+ printf("file name %s\n", OUStringToOString( fileName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ OUString sLogLocation;
+ Reference< XPropertySet > pathSettings( mxMCF->createInstanceWithContext( OUString( "com.sun.star.comp.framework.PathSettings" ), mxContext), uno::UNO_QUERY_THROW );
+ pathSettings->getPropertyValue( OUString( "Work" ) ) >>= sLogLocation;
+ sLogLocation = sLogLocation.concat( OUString( "/" ) ).concat( fileName.copy ( 0, fileName.lastIndexOf( EXTN ) ) + OUString( ".log" ) );
return sLogLocation;
}
- void proccessDocument( const rtl::OUString& sUrl )
+ void proccessDocument( const OUString& sUrl )
{
if ( !mxSFA->isFolder( sUrl ) && sUrl.endsWithIgnoreAsciiCaseAsciiL( ".xls", 4 ) )
{
try
{
- OSL_TRACE( "processing %s", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
- printf( "processing %s\n", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
+ OSL_TRACE( "processing %s", OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
+ printf( "processing %s\n", OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
// Loading the wanted document
Sequence< PropertyValue > propertyValues(1);
- propertyValues[0].Name = rtl::OUString( "Hidden" );
+ propertyValues[0].Name = OUString( "Hidden" );
propertyValues[0].Value <<= false;
- rtl::OUString sfileUrl = convertToURL( sUrl );
- printf( "try to get xDoc %s\n", rtl::OUStringToOString( sfileUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
+ OUString sfileUrl = convertToURL( sUrl );
+ printf( "try to get xDoc %s\n", OUStringToOString( sfileUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
Reference< uno::XInterface > xDoc =
- mxCompLoader->loadComponentFromURL( sfileUrl, rtl::OUString( "_blank" ), 0, propertyValues);
+ mxCompLoader->loadComponentFromURL( sfileUrl, OUString( "_blank" ), 0, propertyValues);
printf( "got xDoc\n" );
OUString logFileURL = convertToURL( getLogLocation() );
@@ -173,18 +172,18 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) )
Reference< script::provider::XScript > xScript;
try
{
- xScript = xProv->getScript( rtl::OUString( "vnd.sun.star.script:VBAProject.TestMacros.Main?language=Basic&location=document"));
+ xScript = xProv->getScript( OUString( "vnd.sun.star.script:VBAProject.TestMacros.Main?language=Basic&location=document"));
} catch ( uno::Exception& e )
{
try
{
- xScript = xProv->getScript( rtl::OUString( "vnd.sun.star.script:VBAProject.testMacro.Main?language=Basic&location=document" ));
+ xScript = xProv->getScript( OUString( "vnd.sun.star.script:VBAProject.testMacro.Main?language=Basic&location=document" ));
} catch ( uno::Exception& e2 )
{
- xScript = xProv->getScript( rtl::OUString( "vnd.sun.star.script:VBAProject.testMain.Main?language=Basic&location=document" ));
+ xScript = xProv->getScript( OUString( "vnd.sun.star.script:VBAProject.testMain.Main?language=Basic&location=document" ));
}
}
- OSL_TRACE("Got script for doc %s", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
+ OSL_TRACE("Got script for doc %s", OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
printf("get the Script\n");
Sequence< uno::Any > aArgs;
Sequence< sal_Int16 > aOutArgsIndex;
@@ -193,27 +192,27 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) )
xScript->invoke(aArgs, aOutArgsIndex, aOutArgs);
OUString fileName = sUrl.copy ( sUrl.lastIndexOf( '/' ) );
- OUString newLocation = msOutDirPath + fileName.copy ( 0, fileName.lastIndexOf( EXTN ) ) + rtl::OUString( ".log" );
+ OUString newLocation = msOutDirPath + fileName.copy ( 0, fileName.lastIndexOf( EXTN ) ) + OUString( ".log" );
try
{
printf("move log file\n");
mxSFA->move( logFileURL, newLocation );
- OSL_TRACE("new logfile location is %s ", rtl::OUStringToOString( newLocation, RTL_TEXTENCODING_UTF8 ).getStr() );
+ OSL_TRACE("new logfile location is %s ", OUStringToOString( newLocation, RTL_TEXTENCODING_UTF8 ).getStr() );
printf("moved to new location\n");
}
catch ( uno::Exception& e )
{
logFileURL = convertToURL( getLogLocationWithName( fileName ) );
- printf("move log file from %s\n", rtl::OUStringToOString( logFileURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+ printf("move log file from %s\n", OUStringToOString( logFileURL, RTL_TEXTENCODING_UTF8 ).getStr() );
mxSFA->move( logFileURL, newLocation );
- OSL_TRACE("new logfile location is %s ", rtl::OUStringToOString( newLocation, RTL_TEXTENCODING_UTF8 ).getStr() );
+ OSL_TRACE("new logfile location is %s ", OUStringToOString( newLocation, RTL_TEXTENCODING_UTF8 ).getStr() );
printf("moved to new location\n");
}
}
catch ( uno::Exception& e )
{
- std::cerr << "Caught exception " << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << std::endl;
+ std::cerr << "Caught exception " << OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << std::endl;
}
// interface is supported, otherwise use XComponent.dispose
@@ -241,19 +240,19 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) )
}
catch( uno::Exception& e )
{
- std::cerr << "Caught exception " << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << std::endl;
+ std::cerr << "Caught exception " << OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << std::endl;
}
}
- printf("complete processing %s\n", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
+ printf("complete processing %s\n", OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
}
- void traverse( const rtl::OUString& sFileDirectory )
+ void traverse( const OUString& sFileDirectory )
{
- rtl::OUString sFileDirectoryURL = convertToURL( sFileDirectory );
+ OUString sFileDirectoryURL = convertToURL( sFileDirectory );
if ( !mxSFA->isFolder( sFileDirectoryURL) )
{
- throw lang::IllegalArgumentException( rtl::OUString( "not a directory: ").concat( sFileDirectoryURL ), Reference<uno::XInterface>(), 1 );
+ throw lang::IllegalArgumentException( OUString( "not a directory: ").concat( sFileDirectoryURL ), Reference<uno::XInterface>(), 1 );
}
// Getting all files and directories in the current directory
Sequence<OUString> entries = mxSFA->getFolderContents( sFileDirectoryURL, false );
@@ -278,7 +277,7 @@ void tryDispose( Reference< uno::XInterface > xIF, const char* sComp )
}
catch( uno::Exception& e )
{
- std::cerr << "tryDispose caught exception " <<rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << " while disposing " << sComp << std::endl;
+ std::cerr << "tryDispose caught exception " <<OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << " while disposing " << sComp << std::endl;
}
}
}
@@ -314,7 +313,7 @@ int main( int argv, char** argc )
}
catch( uno::Exception& e )
{
- std::cerr << "Caught Exception " << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << std::endl;
+ std::cerr << "Caught Exception " << OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << std::endl;
}
}