Kaydet (Commit) e61770f9 authored tarafından Michael Stahl's avatar Michael Stahl

de-dent SwXFieldMaster a bit

Change-Id: Ibfd1b6ad2fab06543913e2b38fad25d98351f9e2
üst b2d08481
...@@ -456,7 +456,9 @@ throw (uno::RuntimeException) ...@@ -456,7 +456,9 @@ throw (uno::RuntimeException)
return OUString("SwXFieldMaster"); return OUString("SwXFieldMaster");
} }
sal_Bool SwXFieldMaster::supportsService(const OUString& rServiceName) throw( uno::RuntimeException ) sal_Bool SAL_CALL
SwXFieldMaster::supportsService(const OUString& rServiceName)
throw (uno::RuntimeException)
{ {
sal_Bool bRet = sal_False; sal_Bool bRet = sal_False;
if(rServiceName.equalsAsciiL( if(rServiceName.equalsAsciiL(
...@@ -485,7 +487,8 @@ sal_Bool SwXFieldMaster::supportsService(const OUString& rServiceName) throw( un ...@@ -485,7 +487,8 @@ sal_Bool SwXFieldMaster::supportsService(const OUString& rServiceName) throw( un
return bRet; return bRet;
} }
uno::Sequence< OUString > SwXFieldMaster::getSupportedServiceNames(void) throw( uno::RuntimeException ) uno::Sequence< OUString > SAL_CALL
SwXFieldMaster::getSupportedServiceNames() throw (uno::RuntimeException)
{ {
uno::Sequence< OUString > aRet(2); uno::Sequence< OUString > aRet(2);
OUString* pArray = aRet.getArray(); OUString* pArray = aRet.getArray();
...@@ -617,8 +620,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, ...@@ -617,8 +620,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
{ {
throw lang::IllegalArgumentException(); throw lang::IllegalArgumentException();
} }
else
{
switch (m_pImpl->m_nResTypeId) switch (m_pImpl->m_nResTypeId)
{ {
case RES_USERFLD : case RES_USERFLD :
...@@ -627,7 +629,8 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, ...@@ -627,7 +629,8 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
pType2 = m_pImpl->m_pDoc->InsertFldType(aType); pType2 = m_pImpl->m_pDoc->InsertFldType(aType);
static_cast<SwUserFieldType*>(pType2)->SetContent(m_pImpl->m_sParam1); static_cast<SwUserFieldType*>(pType2)->SetContent(m_pImpl->m_sParam1);
static_cast<SwUserFieldType*>(pType2)->SetValue(m_pImpl->m_fParam1); static_cast<SwUserFieldType*>(pType2)->SetValue(m_pImpl->m_fParam1);
static_cast<SwUserFieldType*>(pType2)->SetType(m_pImpl->m_bParam1 ? nsSwGetSetExpType::GSE_EXPR : nsSwGetSetExpType::GSE_STRING); static_cast<SwUserFieldType*>(pType2)->SetType(m_pImpl->m_bParam1
? nsSwGetSetExpType::GSE_EXPR : nsSwGetSetExpType::GSE_STRING);
} }
break; break;
case RES_DDEFLD : case RES_DDEFLD :
...@@ -655,17 +658,13 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, ...@@ -655,17 +658,13 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
} }
break; break;
} }
if(pType2) if (!pType2)
{ {
throw uno::RuntimeException("no field type found!", *this);
}
pType2->Add(m_pImpl.get()); pType2->Add(m_pImpl.get());
m_pImpl->m_bIsDescriptor = false; m_pImpl->m_bIsDescriptor = false;
} }
else
throw uno::RuntimeException();
}
OSL_ENSURE(pType2, "kein FieldType gefunden!" );
}
else else
{ {
switch (m_pImpl->m_nResTypeId) switch (m_pImpl->m_nResTypeId)
...@@ -819,12 +818,16 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, ...@@ -819,12 +818,16 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
{ {
//TODO: Properties fuer die uebrigen Feldtypen einbauen //TODO: Properties fuer die uebrigen Feldtypen einbauen
sal_uInt16 nMId = GetFieldTypeMId( rPropertyName, *pType ); sal_uInt16 nMId = GetFieldTypeMId( rPropertyName, *pType );
if( USHRT_MAX != nMId ) if (USHRT_MAX == nMId)
{ {
throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName,
static_cast<cppu::OWeakObject *>(this));
}
pType->QueryValue( aRet, nMId ); pType->QueryValue( aRet, nMId );
if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME)) || if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME)) ||
rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_URL))) rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_DATA_BASE_URL)))
{ {
OUString aDataSource; OUString aDataSource;
aRet >>= aDataSource; aRet >>= aDataSource;
...@@ -835,18 +838,15 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, ...@@ -835,18 +838,15 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
INetURLObject aObj; INetURLObject aObj;
aObj.SetURL( aDataSource ); aObj.SetURL( aDataSource );
bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID; bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
if (bIsURL && rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_URL))) if (bIsURL && rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_DATA_BASE_URL)))
pStr = &aDataSource; // DataBaseURL pStr = &aDataSource; // DataBaseURL
else if (!bIsURL && rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME))) else if (!bIsURL && rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME)))
pStr = &aDataSource; // DataBaseName pStr = &aDataSource; // DataBaseName
if (pStr) if (pStr)
aRet <<= *pStr; aRet <<= *pStr;
} }
} }
else
throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
}
else else
{ {
if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COMMAND_TYPE)) ) if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COMMAND_TYPE)) )
...@@ -949,8 +949,8 @@ throw (uno::RuntimeException) ...@@ -949,8 +949,8 @@ throw (uno::RuntimeException)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
SwFieldType *const pFldType = GetFldType(true); SwFieldType *const pFldType = GetFldType(true);
if(pFldType) if (!pFldType)
{ throw uno::RuntimeException();
sal_uInt16 nTypeIdx = USHRT_MAX; sal_uInt16 nTypeIdx = USHRT_MAX;
const SwFldTypes* pTypes = m_pImpl->m_pDoc->GetFldTypes(); const SwFldTypes* pTypes = m_pImpl->m_pDoc->GetFldTypes();
for( sal_uInt16 i = 0; i < pTypes->size(); i++ ) for( sal_uInt16 i = 0; i < pTypes->size(); i++ )
...@@ -978,9 +978,6 @@ throw (uno::RuntimeException) ...@@ -978,9 +978,6 @@ throw (uno::RuntimeException)
} }
// dann den FieldType loeschen // dann den FieldType loeschen
m_pImpl->m_pDoc->RemoveFldType(nTypeIdx); m_pImpl->m_pDoc->RemoveFldType(nTypeIdx);
}
else
throw uno::RuntimeException();
} }
void SAL_CALL SwXFieldMaster::addEventListener( void SAL_CALL SwXFieldMaster::addEventListener(
......
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