Kaydet (Commit) 1b9c7dae authored tarafından Olivier Hallot's avatar Olivier Hallot

More OUString cleanup in vbahelper

Change-Id: Ibf1661c612486a3d5259d0e78dd03294d5eeef76
Reviewed-on: https://gerrit.libreoffice.org/576Reviewed-by: 's avatarOlivier Hallot <olivier.hallot@alta.org.br>
Tested-by: 's avatarOlivier Hallot <olivier.hallot@alta.org.br>
üst 340f1c59
...@@ -63,8 +63,8 @@ public: ...@@ -63,8 +63,8 @@ public:
InheritedHelperInterfaceImpl() {} InheritedHelperInterfaceImpl() {}
InheritedHelperInterfaceImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxContext( xContext ) {} InheritedHelperInterfaceImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxContext( xContext ) {}
InheritedHelperInterfaceImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxParent( xParent ), mxContext( xContext ) {} InheritedHelperInterfaceImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxParent( xParent ), mxContext( xContext ) {}
virtual rtl::OUString getServiceImplName() = 0; virtual OUString getServiceImplName() = 0;
virtual css::uno::Sequence<rtl::OUString> getServiceNames() = 0; virtual css::uno::Sequence<OUString> getServiceNames() = 0;
// XHelperInterface Methods // XHelperInterface Methods
virtual ::sal_Int32 SAL_CALL getCreator() throw (css::script::BasicErrorException, css::uno::RuntimeException) virtual ::sal_Int32 SAL_CALL getCreator() throw (css::script::BasicErrorException, css::uno::RuntimeException)
...@@ -77,24 +77,24 @@ public: ...@@ -77,24 +77,24 @@ public:
// The application could certainly be passed around in the context - seems // The application could certainly be passed around in the context - seems
// to make sense // to make sense
css::uno::Reference< css::container::XNameAccess > xNameAccess( mxContext, css::uno::UNO_QUERY_THROW ); css::uno::Reference< css::container::XNameAccess > xNameAccess( mxContext, css::uno::UNO_QUERY_THROW );
return xNameAccess->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Application" ) ) ); return xNameAccess->getByName( "Application" );
} }
// XServiceInfo Methods // XServiceInfo Methods
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) { return getServiceImplName(); } virtual OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) { return getServiceImplName(); }
virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (css::uno::RuntimeException) virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException)
{ {
css::uno::Sequence< rtl::OUString > sServices = getSupportedServiceNames(); css::uno::Sequence< OUString > sServices = getSupportedServiceNames();
const rtl::OUString* pStart = sServices.getConstArray(); const OUString* pStart = sServices.getConstArray();
const rtl::OUString* pEnd = pStart + sServices.getLength(); const OUString* pEnd = pStart + sServices.getLength();
for ( ; pStart != pEnd ; ++pStart ) for ( ; pStart != pEnd ; ++pStart )
if ( (*pStart).equals( ServiceName ) ) if ( (*pStart).equals( ServiceName ) )
return sal_True; return sal_True;
return sal_False; return sal_False;
} }
virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException) virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException)
{ {
css::uno::Sequence< rtl::OUString > aNames = getServiceNames(); css::uno::Sequence< OUString > aNames = getServiceNames();
return aNames; return aNames;
} }
}; };
...@@ -136,9 +136,9 @@ public: ...@@ -136,9 +136,9 @@ public:
implementation name. implementation name.
*/ */
#define VBAHELPER_IMPL_GETSERVICEIMPLNAME( classname ) \ #define VBAHELPER_IMPL_GETSERVICEIMPLNAME( classname ) \
::rtl::OUString classname::getServiceImplName() \ OUString classname::getServiceImplName() \
{ \ { \
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( #classname ) ); \ return OUString( RTL_CONSTASCII_USTRINGPARAM( #classname ) ); \
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
...@@ -147,13 +147,13 @@ public: ...@@ -147,13 +147,13 @@ public:
service name. service name.
*/ */
#define VBAHELPER_IMPL_GETSERVICENAMES( classname, servicename ) \ #define VBAHELPER_IMPL_GETSERVICENAMES( classname, servicename ) \
css::uno::Sequence< ::rtl::OUString > classname::getServiceNames() \ css::uno::Sequence< OUString > classname::getServiceNames() \
{ \ { \
static css::uno::Sequence< ::rtl::OUString > saServiceNames; \ static css::uno::Sequence< OUString > saServiceNames; \
if( saServiceNames.getLength() == 0 ) \ if( saServiceNames.getLength() == 0 ) \
{ \ { \
saServiceNames.realloc( 1 ); \ saServiceNames.realloc( 1 ); \
saServiceNames[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( servicename ) ); \ saServiceNames[ 0 ] = servicename; \
} \ } \
return saServiceNames; \ return saServiceNames; \
} }
...@@ -165,8 +165,8 @@ css::uno::Sequence< ::rtl::OUString > classname::getServiceNames() \ ...@@ -165,8 +165,8 @@ css::uno::Sequence< ::rtl::OUString > classname::getServiceNames() \
declaration. declaration.
*/ */
#define VBAHELPER_DECL_XHELPERINTERFACE \ #define VBAHELPER_DECL_XHELPERINTERFACE \
virtual ::rtl::OUString getServiceImplName(); \ virtual OUString getServiceImplName(); \
virtual css::uno::Sequence< ::rtl::OUString > getServiceNames(); virtual css::uno::Sequence< OUString > getServiceNames();
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
......
...@@ -39,7 +39,7 @@ class CommandBarEnumeration : public CommandBarEnumeration_BASE ...@@ -39,7 +39,7 @@ class CommandBarEnumeration : public CommandBarEnumeration_BASE
uno::Reference< XHelperInterface > m_xParent; uno::Reference< XHelperInterface > m_xParent;
uno::Reference< uno::XComponentContext > m_xContext; uno::Reference< uno::XComponentContext > m_xContext;
VbaCommandBarHelperRef m_pCBarHelper; VbaCommandBarHelperRef m_pCBarHelper;
uno::Sequence< rtl::OUString > m_sNames; uno::Sequence< OUString > m_sNames;
sal_Int32 m_nCurrentPosition; sal_Int32 m_nCurrentPosition;
public: public:
CommandBarEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, VbaCommandBarHelperRef pHelper) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_pCBarHelper( pHelper ) , m_nCurrentPosition( 0 ) CommandBarEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, VbaCommandBarHelperRef pHelper) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_pCBarHelper( pHelper ) , m_nCurrentPosition( 0 )
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
// FIXME: should be add menubar // FIXME: should be add menubar
if( hasMoreElements() ) if( hasMoreElements() )
{ {
rtl::OUString sResourceUrl( m_sNames[ m_nCurrentPosition++ ] ); OUString sResourceUrl( m_sNames[ m_nCurrentPosition++ ] );
if( sResourceUrl.indexOf( "private:resource/toolbar/" ) != -1 ) if( sResourceUrl.indexOf( "private:resource/toolbar/" ) != -1 )
{ {
uno::Reference< container::XIndexAccess > xCBarSetting = m_pCBarHelper->getSettings( sResourceUrl ); uno::Reference< container::XIndexAccess > xCBarSetting = m_pCBarHelper->getSettings( sResourceUrl );
...@@ -100,9 +100,9 @@ uno::Any ...@@ -100,9 +100,9 @@ uno::Any
ScVbaCommandBars::createCollectionObject( const uno::Any& aSource ) ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
{ {
// aSource should be a name at this time, because of the class is API wrapper. // aSource should be a name at this time, because of the class is API wrapper.
rtl::OUString sResourceUrl; OUString sResourceUrl;
uno::Reference< container::XIndexAccess > xBarSettings; uno::Reference< container::XIndexAccess > xBarSettings;
rtl::OUString sBarName; OUString sBarName;
sal_Bool bMenu = sal_False; sal_Bool bMenu = sal_False;
uno::Any aRet; uno::Any aRet;
...@@ -114,7 +114,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource ) ...@@ -114,7 +114,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Worksheet Menu Bar") ) ) if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Worksheet Menu Bar") ) )
{ {
// spreadsheet menu bar // spreadsheet menu bar
sResourceUrl = rtl::OUString( ITEM_MENUBAR_URL ); sResourceUrl = ITEM_MENUBAR_URL;
bMenu = sal_True; bMenu = sal_True;
} }
else if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Cell") ) ) else if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Cell") ) )
...@@ -128,7 +128,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource ) ...@@ -128,7 +128,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Menu Bar") ) ) if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Menu Bar") ) )
{ {
// text processor menu bar // text processor menu bar
sResourceUrl = rtl::OUString( ITEM_MENUBAR_URL ); sResourceUrl = ITEM_MENUBAR_URL;
bMenu = sal_True; bMenu = sal_True;
} }
} }
...@@ -148,7 +148,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource ) ...@@ -148,7 +148,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
} }
if( !aRet.hasValue() ) if( !aRet.hasValue() )
throw uno::RuntimeException( rtl::OUString( "Toolbar do not exist" ), uno::Reference< uno::XInterface >() ); throw uno::RuntimeException( "Toolbar do not exist" , uno::Reference< uno::XInterface >() );
return aRet; return aRet;
} }
...@@ -160,20 +160,20 @@ ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Positio ...@@ -160,20 +160,20 @@ ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Positio
// FIXME: only support to add Toolbar // FIXME: only support to add Toolbar
// Position - MsoBar MenuBar - sal_Bool // Position - MsoBar MenuBar - sal_Bool
// Currently only the Name is supported. // Currently only the Name is supported.
rtl::OUString sName; OUString sName;
if( Name.hasValue() ) if( Name.hasValue() )
Name >>= sName; Name >>= sName;
rtl::OUString sResourceUrl; OUString sResourceUrl;
if( !sName.isEmpty() ) if( !sName.isEmpty() )
{ {
sResourceUrl = m_pCBarHelper->findToolbarByName( m_xNameAccess, sName ); sResourceUrl = m_pCBarHelper->findToolbarByName( m_xNameAccess, sName );
if( !sResourceUrl.isEmpty() ) if( !sResourceUrl.isEmpty() )
throw uno::RuntimeException( rtl::OUString( "Toolbar exists" ), uno::Reference< uno::XInterface >() ); throw uno::RuntimeException( "Toolbar exists" , uno::Reference< uno::XInterface >() );
} }
else else
{ {
sName = rtl::OUString( "Custom1" ); sName = "Custom1";
} }
sResourceUrl = VbaCommandBarHelper::generateCustomURL(); sResourceUrl = VbaCommandBarHelper::generateCustomURL();
...@@ -187,7 +187,7 @@ ScVbaCommandBars::getCount() throw(css::uno::RuntimeException) ...@@ -187,7 +187,7 @@ ScVbaCommandBars::getCount() throw(css::uno::RuntimeException)
{ {
// Filter out all toolbars from the window collection // Filter out all toolbars from the window collection
sal_Int32 nCount = 1; // there is a Menubar in OOo sal_Int32 nCount = 1; // there is a Menubar in OOo
uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames(); uno::Sequence< ::OUString > allNames = m_xNameAccess->getElementNames();
for( sal_Int32 i = 0; i < allNames.getLength(); i++ ) for( sal_Int32 i = 0; i < allNames.getLength(); i++ )
{ {
if(allNames[i].indexOf( "private:resource/toolbar/" ) != -1 ) if(allNames[i].indexOf( "private:resource/toolbar/" ) != -1 )
...@@ -214,9 +214,9 @@ ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) th ...@@ -214,9 +214,9 @@ ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) th
{ {
uno::Any aSource; uno::Any aSource;
if( m_pCBarHelper->getModuleId() == "com.sun.star.sheet.SpreadsheetDocument" ) if( m_pCBarHelper->getModuleId() == "com.sun.star.sheet.SpreadsheetDocument" )
aSource <<= rtl::OUString("Worksheet Menu Bar"); aSource <<= OUString("Worksheet Menu Bar");
else if( m_pCBarHelper->getModuleId() == "com.sun.star.text.TextDocument" ) else if( m_pCBarHelper->getModuleId() == "com.sun.star.text.TextDocument" )
aSource <<= rtl::OUString("Menu Bar"); aSource <<= OUString("Menu Bar");
if( aSource.hasValue() ) if( aSource.hasValue() )
return createCollectionObject( aSource ); return createCollectionObject( aSource );
} }
...@@ -224,20 +224,20 @@ ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) th ...@@ -224,20 +224,20 @@ ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) th
} }
// XHelperInterface // XHelperInterface
rtl::OUString OUString
ScVbaCommandBars::getServiceImplName() ScVbaCommandBars::getServiceImplName()
{ {
return rtl::OUString("ScVbaCommandBars"); return OUString("ScVbaCommandBars");
} }
uno::Sequence<rtl::OUString> uno::Sequence<OUString>
ScVbaCommandBars::getServiceNames() ScVbaCommandBars::getServiceNames()
{ {
static uno::Sequence< rtl::OUString > aServiceNames; static uno::Sequence< OUString > aServiceNames;
if ( aServiceNames.getLength() == 0 ) if ( aServiceNames.getLength() == 0 )
{ {
aServiceNames.realloc( 1 ); aServiceNames.realloc( 1 );
aServiceNames[ 0 ] = rtl::OUString( "ooo.vba.CommandBars" ); aServiceNames[ 0 ] = "ooo.vba.CommandBars";
} }
return aServiceNames; return aServiceNames;
} }
......
...@@ -24,13 +24,13 @@ using namespace ::com::sun::star; ...@@ -24,13 +24,13 @@ using namespace ::com::sun::star;
sal_Bool SAL_CALL VbaDialogBase::Show() throw ( uno::RuntimeException ) sal_Bool SAL_CALL VbaDialogBase::Show() throw ( uno::RuntimeException )
{ {
rtl::OUString aURL; OUString aURL;
if ( m_xModel.is() ) if ( m_xModel.is() )
{ {
aURL = mapIndexToName( mnIndex ); aURL = mapIndexToName( mnIndex );
if( aURL.isEmpty() ) if( aURL.isEmpty() )
throw uno::RuntimeException( throw uno::RuntimeException(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ), " Unable to open the specified dialog ",
uno::Reference< XInterface > () ); uno::Reference< XInterface > () );
uno::Sequence< beans::PropertyValue > dispatchProps(0); uno::Sequence< beans::PropertyValue > dispatchProps(0);
......
...@@ -55,10 +55,10 @@ VbaDocumentBase::VbaDocumentBase( uno::Sequence< uno::Any> const & args, ...@@ -55,10 +55,10 @@ VbaDocumentBase::VbaDocumentBase( uno::Sequence< uno::Any> const & args,
{ {
} }
::rtl::OUString OUString
VbaDocumentBase::getName() throw (uno::RuntimeException) VbaDocumentBase::getName() throw (uno::RuntimeException)
{ {
rtl::OUString sName = getModel()->getURL(); OUString sName = getModel()->getURL();
if ( !sName.isEmpty() ) if ( !sName.isEmpty() )
{ {
...@@ -73,12 +73,12 @@ VbaDocumentBase::getName() throw (uno::RuntimeException) ...@@ -73,12 +73,12 @@ VbaDocumentBase::getName() throw (uno::RuntimeException)
} }
return sName; return sName;
} }
::rtl::OUString OUString
VbaDocumentBase::getPath() throw (uno::RuntimeException) VbaDocumentBase::getPath() throw (uno::RuntimeException)
{ {
INetURLObject aURL( getModel()->getURL() ); INetURLObject aURL( getModel()->getURL() );
rtl::OUString sURL = aURL.GetMainURL( INetURLObject::DECODE_TO_IURI ); OUString sURL = aURL.GetMainURL( INetURLObject::DECODE_TO_IURI );
rtl::OUString sPath; OUString sPath;
if( !sURL.isEmpty() ) if( !sURL.isEmpty() )
{ {
sURL = sURL.copy( 0, sURL.getLength() - aURL.GetLastName().getLength() - 1 ); sURL = sURL.copy( 0, sURL.getLength() - aURL.GetLastName().getLength() - 1 );
...@@ -87,10 +87,10 @@ VbaDocumentBase::getPath() throw (uno::RuntimeException) ...@@ -87,10 +87,10 @@ VbaDocumentBase::getPath() throw (uno::RuntimeException)
return sPath; return sPath;
} }
::rtl::OUString OUString
VbaDocumentBase::getFullName() throw (uno::RuntimeException) VbaDocumentBase::getFullName() throw (uno::RuntimeException)
{ {
rtl::OUString sPath = getName(); OUString sPath = getName();
//::osl::File::getSystemPathFromFileURL( getModel()->getURL(), sPath ); //::osl::File::getSystemPathFromFileURL( getModel()->getURL(), sPath );
return sPath; return sPath;
} }
...@@ -100,7 +100,7 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, ...@@ -100,7 +100,7 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
const uno::Any &rRouteArg ) throw (uno::RuntimeException) const uno::Any &rRouteArg ) throw (uno::RuntimeException)
{ {
sal_Bool bSaveChanges = sal_False; sal_Bool bSaveChanges = sal_False;
rtl::OUString aFileName; OUString aFileName;
sal_Bool bRouteWorkbook = sal_True; sal_Bool bRouteWorkbook = sal_True;
rSaveArg >>= bSaveChanges; rSaveArg >>= bSaveChanges;
...@@ -113,9 +113,7 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, ...@@ -113,9 +113,7 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
{ {
if( xStorable->isReadonly() ) if( xStorable->isReadonly() )
{ {
throw uno::RuntimeException(::rtl::OUString( throw uno::RuntimeException("Unable to save to a read only file ", uno::Reference< XInterface >() );
RTL_CONSTASCII_USTRINGPARAM( "Unable to save to a read only file ") ),
uno::Reference< XInterface >() );
} }
if( bFileName ) if( bFileName )
xStorable->storeAsURL( aFileName, uno::Sequence< beans::PropertyValue >(0) ); xStorable->storeAsURL( aFileName, uno::Sequence< beans::PropertyValue >(0) );
...@@ -136,11 +134,11 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, ...@@ -136,11 +134,11 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
uno::Reference< util::XURLTransformer > xURLTransformer( util::URLTransformer::create(mxContext) ); uno::Reference< util::XURLTransformer > xURLTransformer( util::URLTransformer::create(mxContext) );
util::URL aURL; util::URL aURL;
aURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseDoc" ) ); aURL.Complete = ".uno:CloseDoc";
xURLTransformer->parseStrict( aURL ); xURLTransformer->parseStrict( aURL );
uno::Reference< css::frame::XDispatch > xDispatch( uno::Reference< css::frame::XDispatch > xDispatch(
xDispatchProvider->queryDispatch( aURL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_self" ) ), 0 ), xDispatchProvider->queryDispatch( aURL, "_self" , 0 ),
uno::UNO_SET_THROW ); uno::UNO_SET_THROW );
xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() ); xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() );
bUIClose = sal_True; bUIClose = sal_True;
...@@ -193,30 +191,28 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, ...@@ -193,30 +191,28 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
void void
VbaDocumentBase::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException) VbaDocumentBase::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException)
{ {
rtl::OUString rPassword; OUString rPassword;
uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW ); uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
OSL_TRACE("Workbook::Protect stub"); OSL_TRACE("Workbook::Protect stub");
if( aPassword >>= rPassword ) if( aPassword >>= rPassword )
xProt->protect( rPassword ); xProt->protect( rPassword );
else else
xProt->protect( rtl::OUString() ); xProt->protect( OUString() );
} }
void void
VbaDocumentBase::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeException) VbaDocumentBase::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeException)
{ {
rtl::OUString rPassword; OUString rPassword;
uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW ); uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
if( !xProt->isProtected() ) if( !xProt->isProtected() )
throw uno::RuntimeException(::rtl::OUString( throw uno::RuntimeException("File is already unprotected", uno::Reference< XInterface >() );
RTL_CONSTASCII_USTRINGPARAM( "File is already unprotected" ) ),
uno::Reference< XInterface >() );
else else
{ {
if( aPassword >>= rPassword ) if( aPassword >>= rPassword )
xProt->unprotect( rPassword ); xProt->unprotect( rPassword );
else else
xProt->unprotect( rtl::OUString() ); xProt->unprotect( OUString() );
} }
} }
...@@ -236,7 +232,7 @@ VbaDocumentBase::setSaved( sal_Bool bSave ) throw (uno::RuntimeException) ...@@ -236,7 +232,7 @@ VbaDocumentBase::setSaved( sal_Bool bSave ) throw (uno::RuntimeException)
{ {
uno::Any aCaught( ::cppu::getCaughtException() ); uno::Any aCaught( ::cppu::getCaughtException() );
throw lang::WrappedTargetRuntimeException( throw lang::WrappedTargetRuntimeException(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't change modified state of model!" ) ), "Can't change modified state of model!",
uno::Reference< uno::XInterface >(), uno::Reference< uno::XInterface >(),
aCaught ); aCaught );
} }
...@@ -252,7 +248,7 @@ VbaDocumentBase::getSaved() throw (uno::RuntimeException) ...@@ -252,7 +248,7 @@ VbaDocumentBase::getSaved() throw (uno::RuntimeException)
void void
VbaDocumentBase::Save() throw (uno::RuntimeException) VbaDocumentBase::Save() throw (uno::RuntimeException)
{ {
rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Save")); OUString url(".uno:Save");
uno::Reference< frame::XModel > xModel = getModel(); uno::Reference< frame::XModel > xModel = getModel();
dispatchRequests(xModel,url); dispatchRequests(xModel,url);
} }
...@@ -284,16 +280,16 @@ VbaDocumentBase::getVBProject() throw (uno::RuntimeException) ...@@ -284,16 +280,16 @@ VbaDocumentBase::getVBProject() throw (uno::RuntimeException)
return uno::Any( mxVBProject ); return uno::Any( mxVBProject );
} }
rtl::OUString OUString
VbaDocumentBase::getServiceImplName() VbaDocumentBase::getServiceImplName()
{ {
return rtl::OUString( "VbaDocumentBase" ); return OUString( "VbaDocumentBase" );
} }
uno::Sequence< rtl::OUString > uno::Sequence< OUString >
VbaDocumentBase::getServiceNames() VbaDocumentBase::getServiceNames()
{ {
static uno::Sequence< rtl::OUString > aServiceNames; static uno::Sequence< OUString > aServiceNames;
if ( aServiceNames.getLength() == 0 ) if ( aServiceNames.getLength() == 0 )
{ {
aServiceNames.realloc( 1 ); aServiceNames.realloc( 1 );
......
...@@ -28,9 +28,6 @@ ...@@ -28,9 +28,6 @@
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::ooo::vba; using namespace ::ooo::vba;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
// ============================================================================ // ============================================================================
VbaEventsHelperBase::VbaEventsHelperBase( const uno::Sequence< uno::Any >& rArgs, const uno::Reference< uno::XComponentContext >& /*xContext*/ ) : VbaEventsHelperBase::VbaEventsHelperBase( const uno::Sequence< uno::Any >& rArgs, const uno::Reference< uno::XComponentContext >& /*xContext*/ ) :
...@@ -96,7 +93,7 @@ sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, cons ...@@ -96,7 +93,7 @@ sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, cons
const EventHandlerInfo& rInfo = getEventHandlerInfo( aEventQueue.front().mnEventId ); const EventHandlerInfo& rInfo = getEventHandlerInfo( aEventQueue.front().mnEventId );
uno::Sequence< uno::Any > aEventArgs = aEventQueue.front().maArgs; uno::Sequence< uno::Any > aEventArgs = aEventQueue.front().maArgs;
aEventQueue.pop_front(); aEventQueue.pop_front();
OSL_TRACE( "VbaEventsHelperBase::processVbaEvent( \"%s\" )", ::rtl::OUStringToOString( rInfo.maMacroName, RTL_TEXTENCODING_UTF8 ).getStr() ); OSL_TRACE( "VbaEventsHelperBase::processVbaEvent( \"%s\" )", OUStringToOString( rInfo.maMacroName, RTL_TEXTENCODING_UTF8 ).getStr() );
/* Let derived classes prepare the event, they may add new events for /* Let derived classes prepare the event, they may add new events for
next iteration. If false is returned, the event handler must not be next iteration. If false is returned, the event handler must not be
...@@ -143,7 +140,7 @@ sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, cons ...@@ -143,7 +140,7 @@ sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, cons
void SAL_CALL VbaEventsHelperBase::notifyEvent( const document::EventObject& rEvent ) throw (uno::RuntimeException) void SAL_CALL VbaEventsHelperBase::notifyEvent( const document::EventObject& rEvent ) throw (uno::RuntimeException)
{ {
OSL_TRACE( "VbaEventsHelperBase::notifyEvent( \"%s\" )", ::rtl::OUStringToOString( rEvent.EventName, RTL_TEXTENCODING_UTF8 ).getStr() ); OSL_TRACE( "VbaEventsHelperBase::notifyEvent( \"%s\" )", OUStringToOString( rEvent.EventName, RTL_TEXTENCODING_UTF8 ).getStr() );
if( rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ) ) if( rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ) )
stopListening(); stopListening();
} }
...@@ -290,7 +287,7 @@ void VbaEventsHelperBase::ensureVBALibrary() throw (uno::RuntimeException) ...@@ -290,7 +287,7 @@ void VbaEventsHelperBase::ensureVBALibrary() throw (uno::RuntimeException)
throw uno::RuntimeException(); throw uno::RuntimeException();
uno::Reference< beans::XPropertySet > xModelProps( mxModel, uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xModelProps( mxModel, uno::UNO_QUERY_THROW );
uno::Reference< container::XNameAccess > xBasicLibs( xModelProps->getPropertyValue( uno::Reference< container::XNameAccess > xBasicLibs( xModelProps->getPropertyValue(
OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicLibraries" ) ) ), uno::UNO_QUERY_THROW ); "BasicLibraries" ), uno::UNO_QUERY_THROW );
mxModuleInfos.set( xBasicLibs->getByName( maLibraryName ), uno::UNO_QUERY_THROW ); mxModuleInfos.set( xBasicLibs->getByName( maLibraryName ), uno::UNO_QUERY_THROW );
// listen to changes in the VBA source code // listen to changes in the VBA source code
uno::Reference< util::XChangesNotifier > xChangesNotifier( mxModuleInfos, uno::UNO_QUERY_THROW ); uno::Reference< util::XChangesNotifier > xChangesNotifier( mxModuleInfos, uno::UNO_QUERY_THROW );
...@@ -324,7 +321,7 @@ sal_Int32 VbaEventsHelperBase::getModuleType( const OUString& rModuleName ) thro ...@@ -324,7 +321,7 @@ sal_Int32 VbaEventsHelperBase::getModuleType( const OUString& rModuleName ) thro
throw uno::RuntimeException(); throw uno::RuntimeException();
} }
VbaEventsHelperBase::ModulePathMap& VbaEventsHelperBase::updateModulePathMap( const ::rtl::OUString& rModuleName ) throw (uno::RuntimeException) VbaEventsHelperBase::ModulePathMap& VbaEventsHelperBase::updateModulePathMap( const OUString& rModuleName ) throw (uno::RuntimeException)
{ {
// get type of the specified module (throws on error) // get type of the specified module (throws on error)
sal_Int32 nModuleType = getModuleType( rModuleName ); sal_Int32 nModuleType = getModuleType( rModuleName );
......
...@@ -29,7 +29,7 @@ using namespace ::com::sun::star; ...@@ -29,7 +29,7 @@ using namespace ::com::sun::star;
// form controls use other property name as the remaining OOo API // form controls use other property name as the remaining OOo API
#define VBAFONTBASE_PROPNAME( ascii_normal, ascii_control ) \ #define VBAFONTBASE_PROPNAME( ascii_normal, ascii_control ) \
mbFormControl ? rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ascii_control ) ) : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ascii_normal ) ) mbFormControl ? OUString( ascii_control ) : OUString( ascii_normal )
VbaFontBase::VbaFontBase( VbaFontBase::VbaFontBase(
const uno::Reference< XHelperInterface >& xParent, const uno::Reference< XHelperInterface >& xParent,
...@@ -65,8 +65,8 @@ VbaFontBase::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeExcept ...@@ -65,8 +65,8 @@ VbaFontBase::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeExcept
nValue = SUPERSCRIPT; nValue = SUPERSCRIPT;
nValue2 = SUPERSCRIPTHEIGHT; nValue2 = SUPERSCRIPTHEIGHT;
} }
mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue ); mxFont->setPropertyValue( "CharEscapement" , ( uno::Any )nValue );
mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 ); mxFont->setPropertyValue( "CharEscapementHeight" , ( uno::Any )nValue2 );
} }
uno::Any SAL_CALL uno::Any SAL_CALL
...@@ -75,7 +75,7 @@ VbaFontBase::getSuperscript() throw ( uno::RuntimeException ) ...@@ -75,7 +75,7 @@ VbaFontBase::getSuperscript() throw ( uno::RuntimeException )
short nValue = NORMAL; short nValue = NORMAL;
// not supported in form controls // not supported in form controls
if( !mbFormControl ) if( !mbFormControl )
mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue; mxFont->getPropertyValue( "CharEscapement" ) >>= nValue;
return uno::makeAny( ( nValue == SUPERSCRIPT ) ); return uno::makeAny( ( nValue == SUPERSCRIPT ) );
} }
...@@ -97,8 +97,8 @@ VbaFontBase::setSubscript( const uno::Any& aValue ) throw ( uno::RuntimeExceptio ...@@ -97,8 +97,8 @@ VbaFontBase::setSubscript( const uno::Any& aValue ) throw ( uno::RuntimeExceptio
nValue2 = SUBSCRIPTHEIGHT; nValue2 = SUBSCRIPTHEIGHT;
} }
mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 ); mxFont->setPropertyValue( "CharEscapementHeight" , ( uno::Any )nValue2 );
mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue ); mxFont->setPropertyValue( "CharEscapement" , ( uno::Any )nValue );
} }
...@@ -108,7 +108,7 @@ VbaFontBase::getSubscript() throw ( uno::RuntimeException ) ...@@ -108,7 +108,7 @@ VbaFontBase::getSubscript() throw ( uno::RuntimeException )
short nValue = NORMAL; short nValue = NORMAL;
// not supported in form controls // not supported in form controls
if( !mbFormControl ) if( !mbFormControl )
mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue; mxFont->getPropertyValue( "CharEscapement" ) >>= nValue;
return uno::makeAny( ( nValue == SUBSCRIPT ) ); return uno::makeAny( ( nValue == SUBSCRIPT ) );
} }
...@@ -211,13 +211,13 @@ void SAL_CALL ...@@ -211,13 +211,13 @@ void SAL_CALL
VbaFontBase::setShadow( const uno::Any& aValue ) throw ( uno::RuntimeException ) VbaFontBase::setShadow( const uno::Any& aValue ) throw ( uno::RuntimeException )
{ {
if( !mbFormControl ) if( !mbFormControl )
mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), aValue ); mxFont->setPropertyValue( "CharShadowed" , aValue );
} }
uno::Any SAL_CALL uno::Any SAL_CALL
VbaFontBase::getShadow() throw (uno::RuntimeException) VbaFontBase::getShadow() throw (uno::RuntimeException)
{ {
return mbFormControl ? uno::Any( false ) : mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ) ); return mbFormControl ? uno::Any( false ) : mxFont->getPropertyValue( "CharShadowed" );
} }
void SAL_CALL void SAL_CALL
...@@ -242,7 +242,7 @@ VbaFontBase::getItalic() throw ( uno::RuntimeException ) ...@@ -242,7 +242,7 @@ VbaFontBase::getItalic() throw ( uno::RuntimeException )
void SAL_CALL void SAL_CALL
VbaFontBase::setName( const uno::Any& aValue ) throw ( uno::RuntimeException ) VbaFontBase::setName( const uno::Any& aValue ) throw ( uno::RuntimeException )
{ {
rtl::OUString sString; OUString sString;
aValue >>= sString; aValue >>= sString;
mxFont->setPropertyValue( VBAFONTBASE_PROPNAME( "CharFontName", "FontName" ), aValue ); mxFont->setPropertyValue( VBAFONTBASE_PROPNAME( "CharFontName", "FontName" ), aValue );
} }
......
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