diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-10-26 10:13:18 +0200 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-03 20:24:27 -0500 |
commit | a884fe58a18a1007044de7141dfa70d1ac5fab4e (patch) | |
tree | 22db548b87b426a6f8143f42948b8b1d7a65897b /basic | |
parent | basic migration to OUString (diff) | |
download | core-a884fe58a18a1007044de7141dfa70d1ac5fab4e.tar.gz core-a884fe58a18a1007044de7141dfa70d1ac5fab4e.zip |
basic: OUStringification of ddectrl
Change-Id: I2af40d7c8117aff8ce62a8ea0eec579664f8bdeb
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/runtime/basrdll.cxx | 4 | ||||
-rw-r--r-- | basic/source/runtime/comenumwrapper.cxx | 6 | ||||
-rw-r--r-- | basic/source/runtime/ddectrl.cxx | 55 | ||||
-rw-r--r-- | basic/source/runtime/ddectrl.hxx | 17 | ||||
-rw-r--r-- | basic/source/runtime/methods.cxx | 43 |
5 files changed, 81 insertions, 44 deletions
diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx index d5d00ea3bad4..882ffc0d666c 100644 --- a/basic/source/runtime/basrdll.cxx +++ b/basic/source/runtime/basrdll.cxx @@ -52,7 +52,9 @@ void BasicDLL::EnableBreak( bool bEnable ) BasicDLL* pThis = BASIC_DLL(); DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" ); if ( pThis ) + { pThis->bBreakEnabled = bEnable; + } } void BasicDLL::SetDebugMode( bool bDebugMode ) @@ -60,7 +62,9 @@ void BasicDLL::SetDebugMode( bool bDebugMode ) BasicDLL* pThis = BASIC_DLL(); DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" ); if ( pThis ) + { pThis->bDebugMode = bDebugMode; + } } diff --git a/basic/source/runtime/comenumwrapper.cxx b/basic/source/runtime/comenumwrapper.cxx index dbc2abb2bf03..a5372ffdfe1d 100644 --- a/basic/source/runtime/comenumwrapper.cxx +++ b/basic/source/runtime/comenumwrapper.cxx @@ -31,9 +31,7 @@ using namespace ::com::sun::star; if ( m_xInvocation.is() ) { sal_Int32 nLength = 0; - bResult = - ( ( m_xInvocation->getValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "length" ) ) ) >>= nLength ) - && nLength > m_nCurInd ); + bResult = ( ( m_xInvocation->getValue( OUString("length" ) ) >>= nLength ) && nLength > m_nCurInd ); } } catch(const uno::Exception& ) @@ -57,7 +55,7 @@ uno::Any SAL_CALL ComEnumerationWrapper::nextElement() aArgs[0] <<= m_nCurInd++; - return m_xInvocation->invoke( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "item" ) ), + return m_xInvocation->invoke( OUString("item"), aArgs, aNamedParamIndex, aNamedParam ); diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx index 1b3adcf52861..fd942b0d3815 100644 --- a/basic/source/runtime/ddectrl.cxx +++ b/basic/source/runtime/ddectrl.cxx @@ -52,13 +52,19 @@ static const SbError nDdeErrMap[] = SbError SbiDdeControl::GetLastErr( DdeConnection* pConv ) { if( !pConv ) + { return 0; + } long nErr = pConv->GetError(); if( !nErr ) + { return 0; + } if( nErr < DDE_FIRSTERR || nErr > DDE_LASTERR ) + { return SbERR_DDE_ERROR; - return nDdeErrMap[ 2*(nErr - DDE_FIRSTERR) + 1 ]; + } + return nDdeErrMap[ 2 * (nErr - DDE_FIRSTERR) + 1 ]; } IMPL_LINK_INLINE( SbiDdeControl,Data , DdeData*, pData, @@ -77,23 +83,25 @@ SbiDdeControl::~SbiDdeControl() TerminateAll(); } -sal_Int16 SbiDdeControl::GetFreeChannel() +size_t SbiDdeControl::GetFreeChannel() { - sal_Int16 nChannel = 0; - sal_Int16 nListSize = static_cast<sal_Int16>(aConvList.size()); + size_t nChannel = 0; + size_t nListSize = aConvList.size(); for (; nChannel < nListSize; ++nChannel) { if (aConvList[nChannel] == DDE_FREECHANNEL) + { return nChannel+1; + } } aConvList.push_back(DDE_FREECHANNEL); return nChannel+1; } -SbError SbiDdeControl::Initiate( const String& rService, const String& rTopic, - sal_Int16& rnHandle ) +SbError SbiDdeControl::Initiate( const OUString& rService, const OUString& rTopic, + size_t& rnHandle ) { SbError nErr; DdeConnection* pConv = new DdeConnection( rService, rTopic ); @@ -105,23 +113,25 @@ SbError SbiDdeControl::Initiate( const String& rService, const String& rTopic, } else { - sal_Int16 nChannel = GetFreeChannel(); + size_t nChannel = GetFreeChannel(); aConvList[nChannel-1] = pConv; rnHandle = nChannel; } return 0; } -SbError SbiDdeControl::Terminate( sal_uInt16 nChannel ) +SbError SbiDdeControl::Terminate( size_t nChannel ) { if (!nChannel || nChannel > aConvList.size()) + { return SbERR_DDE_NO_CHANNEL; - + } DdeConnection* pConv = aConvList[nChannel-1]; if( pConv == DDE_FREECHANNEL ) + { return SbERR_DDE_NO_CHANNEL; - + } delete pConv; pConv = DDE_FREECHANNEL; @@ -131,12 +141,14 @@ SbError SbiDdeControl::Terminate( sal_uInt16 nChannel ) SbError SbiDdeControl::TerminateAll() { DdeConnection *conv; - for (sal_uInt16 nChannel = 0; nChannel < aConvList.size(); ++nChannel) + for (size_t nChannel = 0; nChannel < aConvList.size(); ++nChannel) { conv = aConvList[nChannel]; if (conv != DDE_FREECHANNEL) + { delete conv; + } } aConvList.clear(); @@ -144,15 +156,19 @@ SbError SbiDdeControl::TerminateAll() return 0; } -SbError SbiDdeControl::Request( sal_uInt16 nChannel, const String& rItem, String& rResult ) +SbError SbiDdeControl::Request( size_t nChannel, const OUString& rItem, OUString& rResult ) { if (!nChannel || nChannel > aConvList.size()) + { return SbERR_DDE_NO_CHANNEL; + } DdeConnection* pConv = aConvList[nChannel-1]; if( pConv == DDE_FREECHANNEL ) + { return SbERR_DDE_NO_CHANNEL; + } DdeRequest aRequest( *pConv, rItem, 30000 ); aRequest.SetDataHdl( LINK( this, SbiDdeControl, Data ) ); @@ -161,31 +177,36 @@ SbError SbiDdeControl::Request( sal_uInt16 nChannel, const String& rItem, String return GetLastErr( pConv ); } -SbError SbiDdeControl::Execute( sal_uInt16 nChannel, const String& rCommand ) +SbError SbiDdeControl::Execute( size_t nChannel, const OUString& rCommand ) { if (!nChannel || nChannel > aConvList.size()) + { return SbERR_DDE_NO_CHANNEL; + } DdeConnection* pConv = aConvList[nChannel-1]; if( pConv == DDE_FREECHANNEL ) + { return SbERR_DDE_NO_CHANNEL; - + } DdeExecute aRequest( *pConv, rCommand, 30000 ); aRequest.Execute(); return GetLastErr( pConv ); } -SbError SbiDdeControl::Poke( sal_uInt16 nChannel, const String& rItem, const String& rData ) +SbError SbiDdeControl::Poke( size_t nChannel, const OUString& rItem, const OUString& rData ) { if (!nChannel || nChannel > aConvList.size()) + { return SbERR_DDE_NO_CHANNEL; - + } DdeConnection* pConv = aConvList[nChannel-1]; if( pConv == DDE_FREECHANNEL ) + { return SbERR_DDE_NO_CHANNEL; - + } DdePoke aRequest( *pConv, rItem, DdeData(rData), 30000 ); aRequest.Execute(); return GetLastErr( pConv ); diff --git a/basic/source/runtime/ddectrl.hxx b/basic/source/runtime/ddectrl.hxx index 14489dfe3ff2..27be76fe0c10 100644 --- a/basic/source/runtime/ddectrl.hxx +++ b/basic/source/runtime/ddectrl.hxx @@ -22,7 +22,6 @@ #include <tools/link.hxx> #include <basic/sberrors.hxx> -#include <tools/string.hxx> class DdeConnection; class DdeData; @@ -32,22 +31,22 @@ class SbiDdeControl private: DECL_LINK( Data, DdeData* ); SbError GetLastErr( DdeConnection* ); - sal_Int16 GetFreeChannel(); + size_t GetFreeChannel(); std::vector<DdeConnection*> aConvList; - String aData; + OUString aData; public: SbiDdeControl(); ~SbiDdeControl(); - SbError Initiate( const String& rService, const String& rTopic, - sal_Int16& rnHandle ); - SbError Terminate( sal_uInt16 nChannel ); + SbError Initiate( const OUString& rService, const OUString& rTopic, + size_t& rnHandle ); + SbError Terminate( size_t nChannel ); SbError TerminateAll(); - SbError Request( sal_uInt16 nChannel, const String& rItem, String& rResult ); - SbError Execute( sal_uInt16 nChannel, const String& rCommand ); - SbError Poke( sal_uInt16 nChannel, const String& rItem, const String& rData ); + SbError Request( size_t nChannel, const OUString& rItem, OUString& rResult ); + SbError Execute( size_t nChannel, const OUString& rCommand ); + SbError Poke( size_t nChannel, const OUString& rItem, const OUString& rData ); }; #endif diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 0776831da8cd..5dd64ff522a9 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -3427,16 +3427,20 @@ RTLFUNC(DDEInitiate) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - const String& rApp = rPar.Get(1)->GetString(); - const String& rTopic = rPar.Get(2)->GetString(); + const OUString& rApp = rPar.Get(1)->GetString(); + const OUString& rTopic = rPar.Get(2)->GetString(); SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl(); - sal_Int16 nChannel; + size_t nChannel; SbError nDdeErr = pDDE->Initiate( rApp, rTopic, nChannel ); if( nDdeErr ) + { StarBASIC::Error( nDdeErr ); + } else - rPar.Get(0)->PutInteger( nChannel ); + { + rPar.Get(0)->PutInteger( (int)nChannel ); + } } RTLFUNC(DDETerminate) @@ -3458,11 +3462,13 @@ RTLFUNC(DDETerminate) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - sal_Int16 nChannel = rPar.Get(1)->GetInteger(); + size_t nChannel = rPar.Get(1)->GetInteger(); SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl(); SbError nDdeErr = pDDE->Terminate( nChannel ); if( nDdeErr ) + { StarBASIC::Error( nDdeErr ); + } } RTLFUNC(DDETerminateAll) @@ -3488,8 +3494,9 @@ RTLFUNC(DDETerminateAll) SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl(); SbError nDdeErr = pDDE->TerminateAll(); if( nDdeErr ) + { StarBASIC::Error( nDdeErr ); - + } } RTLFUNC(DDERequest) @@ -3510,15 +3517,19 @@ RTLFUNC(DDERequest) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - sal_Int16 nChannel = rPar.Get(1)->GetInteger(); - const String& rItem = rPar.Get(2)->GetString(); + size_t nChannel = rPar.Get(1)->GetInteger(); + const OUString& rItem = rPar.Get(2)->GetString(); SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl(); - String aResult; + OUString aResult; SbError nDdeErr = pDDE->Request( nChannel, rItem, aResult ); if( nDdeErr ) + { StarBASIC::Error( nDdeErr ); + } else + { rPar.Get(0)->PutString( aResult ); + } } RTLFUNC(DDEExecute) @@ -3540,12 +3551,14 @@ RTLFUNC(DDEExecute) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - sal_Int16 nChannel = rPar.Get(1)->GetInteger(); - const String& rCommand = rPar.Get(2)->GetString(); + size_t nChannel = rPar.Get(1)->GetInteger(); + const OUString& rCommand = rPar.Get(2)->GetString(); SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl(); SbError nDdeErr = pDDE->Execute( nChannel, rCommand ); if( nDdeErr ) + { StarBASIC::Error( nDdeErr ); + } } RTLFUNC(DDEPoke) @@ -3567,13 +3580,15 @@ RTLFUNC(DDEPoke) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - sal_Int16 nChannel = rPar.Get(1)->GetInteger(); - const String& rItem = rPar.Get(2)->GetString(); - const String& rData = rPar.Get(3)->GetString(); + size_t nChannel = rPar.Get(1)->GetInteger(); + const OUString& rItem = rPar.Get(2)->GetString(); + const OUString& rData = rPar.Get(3)->GetString(); SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl(); SbError nDdeErr = pDDE->Poke( nChannel, rItem, rData ); if( nDdeErr ) + { StarBASIC::Error( nDdeErr ); + } } |