Kaydet (Commit) 677d0f40 authored tarafından Caolán McNamara's avatar Caolán McNamara

allow db fields with disable-database-connectivity

just non-functional as opposed to non-existing, otherwise
docs with them cannot be loaded at all

Change-Id: Ib752a7fc7b4d0aae7d55f1a24d902259604f54a7
Reviewed-on: https://gerrit.libreoffice.org/42341Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst f66661c1
...@@ -779,9 +779,6 @@ void SAL_CALL SwXFieldMaster::setPropertyValue( ...@@ -779,9 +779,6 @@ void SAL_CALL SwXFieldMaster::setPropertyValue(
SwFieldType* SwXFieldMaster::GetFieldType(bool const bDontCreate) const SwFieldType* SwXFieldMaster::GetFieldType(bool const bDontCreate) const
{ {
#if !HAVE_FEATURE_DBCONNECTIVITY
(void) bDontCreate;
#else
if (!bDontCreate && SwFieldIds::Database == m_pImpl->m_nResTypeId if (!bDontCreate && SwFieldIds::Database == m_pImpl->m_nResTypeId
&& m_pImpl->m_bIsDescriptor && m_pImpl->m_pDoc) && m_pImpl->m_bIsDescriptor && m_pImpl->m_pDoc)
{ {
...@@ -797,12 +794,12 @@ SwFieldType* SwXFieldMaster::GetFieldType(bool const bDontCreate) const ...@@ -797,12 +794,12 @@ SwFieldType* SwXFieldMaster::GetFieldType(bool const bDontCreate) const
aData.sCommand = m_pImpl->m_sParam2; aData.sCommand = m_pImpl->m_sParam2;
aData.nCommandType = m_pImpl->m_nParam2; aData.nCommandType = m_pImpl->m_nParam2;
SwDBFieldType aType(m_pImpl->m_pDoc, m_pImpl->m_sParam3, aData); SwDBFieldType aType(m_pImpl->m_pDoc, m_pImpl->m_sParam3, aData);
SwFieldType *const pType = m_pImpl->m_pDoc->getIDocumentFieldsAccess().InsertFieldType(aType); SwFieldType *const pType = m_pImpl->m_pDoc->getIDocumentFieldsAccess().InsertFieldType(aType);
pType->Add(m_pImpl.get()); pType->Add(m_pImpl.get());
const_cast<SwXFieldMaster*>(this)->m_pImpl->m_bIsDescriptor = false; const_cast<SwXFieldMaster*>(this)->m_pImpl->m_bIsDescriptor = false;
} }
#endif
if (m_pImpl->m_bIsDescriptor) if (m_pImpl->m_bIsDescriptor)
return nullptr; return nullptr;
else else
...@@ -1614,7 +1611,6 @@ void SAL_CALL SwXTextField::attach( ...@@ -1614,7 +1611,6 @@ void SAL_CALL SwXTextField::attach(
} }
break; break;
case SwServiceType::FieldTypeDatabaseName: case SwServiceType::FieldTypeDatabaseName:
#if HAVE_FEATURE_DBCONNECTIVITY
{ {
SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DatabaseName); SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DatabaseName);
SwDBData aData; SwDBData aData;
...@@ -1629,10 +1625,8 @@ void SAL_CALL SwXTextField::attach( ...@@ -1629,10 +1625,8 @@ void SAL_CALL SwXTextField::attach(
nSubType |= nsSwExtendedSubType::SUB_INVISIBLE; nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
pField->SetSubType(nSubType); pField->SetSubType(nSubType);
} }
#endif
break; break;
case SwServiceType::FieldTypeDatabaseNextSet: case SwServiceType::FieldTypeDatabaseNextSet:
#if HAVE_FEATURE_DBCONNECTIVITY
{ {
SwDBData aData; SwDBData aData;
aData.sDataSource = m_pImpl->m_pProps->sPar1; aData.sDataSource = m_pImpl->m_pProps->sPar1;
...@@ -1642,10 +1636,8 @@ void SAL_CALL SwXTextField::attach( ...@@ -1642,10 +1636,8 @@ void SAL_CALL SwXTextField::attach(
pField = new SwDBNextSetField(static_cast<SwDBNextSetFieldType*>(pFieldType), pField = new SwDBNextSetField(static_cast<SwDBNextSetFieldType*>(pFieldType),
m_pImpl->m_pProps->sPar3, aData); m_pImpl->m_pProps->sPar3, aData);
} }
#endif
break; break;
case SwServiceType::FieldTypeDatabaseNumSet: case SwServiceType::FieldTypeDatabaseNumSet:
#if HAVE_FEATURE_DBCONNECTIVITY
{ {
SwDBData aData; SwDBData aData;
aData.sDataSource = m_pImpl->m_pProps->sPar1; aData.sDataSource = m_pImpl->m_pProps->sPar1;
...@@ -1657,10 +1649,8 @@ void SAL_CALL SwXTextField::attach( ...@@ -1657,10 +1649,8 @@ void SAL_CALL SwXTextField::attach(
OUString::number(m_pImpl->m_pProps->nFormat), OUString::number(m_pImpl->m_pProps->nFormat),
aData ); aData );
} }
#endif
break; break;
case SwServiceType::FieldTypeDatabaseSetNum: case SwServiceType::FieldTypeDatabaseSetNum:
#if HAVE_FEATURE_DBCONNECTIVITY
{ {
SwDBData aData; SwDBData aData;
aData.sDataSource = m_pImpl->m_pProps->sPar1; aData.sDataSource = m_pImpl->m_pProps->sPar1;
...@@ -1679,10 +1669,8 @@ void SAL_CALL SwXTextField::attach( ...@@ -1679,10 +1669,8 @@ void SAL_CALL SwXTextField::attach(
nSubType |= nsSwExtendedSubType::SUB_INVISIBLE; nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
pField->SetSubType(nSubType); pField->SetSubType(nSubType);
} }
#endif
break; break;
case SwServiceType::FieldTypeDatabase: case SwServiceType::FieldTypeDatabase:
#if HAVE_FEATURE_DBCONNECTIVITY
{ {
SwFieldType* pFieldType = SwFieldType* pFieldType =
pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Database, m_pImpl->m_sTypeName, false); pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Database, m_pImpl->m_sTypeName, false);
...@@ -1698,7 +1686,6 @@ void SAL_CALL SwXTextField::attach( ...@@ -1698,7 +1686,6 @@ void SAL_CALL SwXTextField::attach(
nSubType |= nsSwExtendedSubType::SUB_INVISIBLE; nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
pField->SetSubType(nSubType); pField->SetSubType(nSubType);
} }
#endif
break; break;
case SwServiceType::FieldTypeSetExp: case SwServiceType::FieldTypeSetExp:
{ {
......
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