[Libreoffice-commits] core.git: sw/source
Tor Lillqvist
tml at collabora.com
Mon Apr 28 21:09:22 PDT 2014
sw/source/core/doc/doc.cxx | 6 --
sw/source/core/doc/docfld.cxx | 76 +++++++---------------------------
sw/source/core/uibase/uno/unofreg.cxx | 4 -
sw/source/core/unocore/unofield.cxx | 5 --
4 files changed, 17 insertions(+), 74 deletions(-)
New commits:
commit aed63550d90a3ad71ac464d2d975539e89ff14cd
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Apr 29 07:06:31 2014 +0300
Revert "More --disable-database-connectivity work"
Nah, this was not a good idea. We do need to keep the db related
fields around in some way for document roundtripping. Need to do
database functionality disabling at a different level. If at all, I am
starting to lose trust that it can meaningfully and cleanly be done.
This reverts commit d2f9e1a165314ad9e8588b1d44b3ff0a455ef7f6.
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 6b338c1..623a546 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -17,8 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <config_features.h>
-
#include <doc.hxx>
#include <DocumentSettingManager.hxx>
#include <UndoManager.hxx>
@@ -320,9 +318,7 @@ void SwDoc::ChgDBData(const SwDBData& rNewData)
maDBData = rNewData;
SetModified();
}
-#if HAVE_FEATURE_DBCONNECTIVITY
GetSysFldType(RES_DBNAMEFLD)->UpdateFlds();
-#endif
}
bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
@@ -690,7 +686,7 @@ SwFlyFrmFmt* SwDoc::InsertOLE(const SwPaM &rRg, const OUString& rObjName,
SwFieldType *SwDoc::GetSysFldType( const sal_uInt16 eWhich ) const
{
for( sal_uInt16 i = 0; i < INIT_FLDTYPES; ++i )
- if( (*mpFldTypes)[i] && eWhich == (*mpFldTypes)[i]->Which() )
+ if( eWhich == (*mpFldTypes)[i]->Which() )
return (*mpFldTypes)[i];
return 0;
}
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 6468d26..fafb713 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -95,8 +95,7 @@ SwFieldType* SwDoc::InsertFldType(const SwFieldType &rFldTyp)
const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
OUString sFldNm( rFldTyp.GetName() );
for( ; i < nSize; ++i )
- if( (*mpFldTypes)[i] &&
- nFldWhich == (*mpFldTypes)[i]->Which() &&
+ if( nFldWhich == (*mpFldTypes)[i]->Which() &&
rSCmp.isEqual( sFldNm, (*mpFldTypes)[i]->GetName() ))
return (*mpFldTypes)[i];
}
@@ -104,15 +103,13 @@ SwFieldType* SwDoc::InsertFldType(const SwFieldType &rFldTyp)
case RES_AUTHORITY:
for( ; i < nSize; ++i )
- if( (*mpFldTypes)[i] &&
- nFldWhich == (*mpFldTypes)[i]->Which() )
+ if( nFldWhich == (*mpFldTypes)[i]->Which() )
return (*mpFldTypes)[i];
break;
default:
for( i = 0; i < nSize; ++i )
- if( (*mpFldTypes)[i] &&
- nFldWhich == (*mpFldTypes)[i]->Which() )
+ if( nFldWhich == (*mpFldTypes)[i]->Which() )
return (*mpFldTypes)[i];
}
@@ -167,8 +164,7 @@ void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp )
SwFieldType* pFnd;
for( ; i < nSize; ++i )
- if( (*mpFldTypes)[i] &&
- nFldWhich == (pFnd = (*mpFldTypes)[i])->Which() &&
+ if( nFldWhich == (pFnd = (*mpFldTypes)[i])->Which() &&
rSCmp.isEqual( rFldNm, pFnd->GetName() ) )
{
// find new name
@@ -176,8 +172,7 @@ void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp )
do {
OUString sSrch = rFldNm + OUString::number( nNum );
for( i = INIT_FLDTYPES; i < nSize; ++i )
- if( (*mpFldTypes)[i] &&
- nFldWhich == (pFnd = (*mpFldTypes)[i])->Which() &&
+ if( nFldWhich == (pFnd = (*mpFldTypes)[i])->Which() &&
rSCmp.isEqual( sSrch, pFnd->GetName() ) )
break;
@@ -215,7 +210,7 @@ void SwDoc::RemoveFldType(sal_uInt16 nFld)
* Dependent fields present -> ErrRaise
*/
sal_uInt16 nSize = mpFldTypes->size();
- if(nFld < nSize && (*mpFldTypes)[nFld])
+ if(nFld < nSize)
{
SwFieldType* pTmp = (*mpFldTypes)[nFld];
@@ -288,9 +283,6 @@ SwFieldType* SwDoc::GetFldType(
SwFieldType* pRet = 0;
for( ; i < nSize; ++i )
{
- if( !(*mpFldTypes)[i] )
- continue;
-
SwFieldType* pFldType = (*mpFldTypes)[i];
OUString aFldName( pFldType->GetName() );
@@ -315,9 +307,6 @@ void SwDoc::UpdateFlds( SfxPoolItem *pNewHt, bool bCloseDB )
for( sal_uInt16 i=0; i < mpFldTypes->size(); ++i)
{
- if( !(*mpFldTypes)[i] )
- continue;
-
switch( (*mpFldTypes)[i]->Which() )
{
// Update table fields second to last
@@ -375,15 +364,13 @@ void SwDoc::UpdateUsrFlds()
SwCalc* pCalc = 0;
const SwFieldType* pFldType;
for( sal_uInt16 i = INIT_FLDTYPES; i < mpFldTypes->size(); ++i )
- {
- if( (*mpFldTypes)[i] &&
- RES_USERFLD == ( pFldType = (*mpFldTypes)[i] )->Which() )
+ if( RES_USERFLD == ( pFldType = (*mpFldTypes)[i] )->Which() )
{
if( !pCalc )
pCalc = new SwCalc( *this );
((SwUserFieldType*)pFldType)->GetValue( *pCalc );
}
- }
+
if( pCalc )
{
delete pCalc;
@@ -396,11 +383,8 @@ void SwDoc::UpdateRefFlds( SfxPoolItem* pHt )
{
SwFieldType* pFldType;
for( sal_uInt16 i = 0; i < mpFldTypes->size(); ++i )
- {
- if( (*mpFldTypes)[i] &&
- RES_GETREFFLD == ( pFldType = (*mpFldTypes)[i] )->Which() )
+ if( RES_GETREFFLD == ( pFldType = (*mpFldTypes)[i] )->Which() )
pFldType->ModifyNotification( 0, pHt );
- }
}
/// @note For simplicity assume that all field types have updatable contents so
@@ -409,9 +393,6 @@ bool SwDoc::containsUpdatableFields()
{
for (sal_uInt16 i = 0; i < mpFldTypes->size(); ++i)
{
- if( !(*mpFldTypes)[i] )
- continue;
-
SwFieldType* pFldType = (*mpFldTypes)[i];
SwIterator<SwFmtFld,SwFieldType> aIter(*pFldType);
if (aIter.First())
@@ -429,8 +410,7 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt )
for (sal_uInt16 i = 0; i < mpFldTypes->size(); ++i)
{
- if( (*mpFldTypes)[i] &&
- RES_TABLEFLD == ( pFldType = (*mpFldTypes)[i] )->Which() )
+ if( RES_TABLEFLD == ( pFldType = (*mpFldTypes)[i] )->Which() )
{
SwTableFmlUpdate* pUpdtFld = 0;
if( pHt && RES_TABLEFML_UPDATE == pHt->Which() )
@@ -679,9 +659,6 @@ void SwDoc::UpdatePageFlds( SfxPoolItem* pMsgHnt )
{
SwFieldType* pFldType;
for( sal_uInt16 i = 0; i < INIT_FLDTYPES; ++i )
- {
- if( !(*mpFldTypes)[i] )
- continue;
switch( ( pFldType = (*mpFldTypes)[ i ] )->Which() )
{
case RES_PAGENUMBERFLD:
@@ -694,7 +671,6 @@ void SwDoc::UpdatePageFlds( SfxPoolItem* pMsgHnt )
pFldType->ModifyNotification( 0, 0 );
break;
}
- }
SetNewFldLst(true);
}
@@ -702,12 +678,8 @@ void SwDoc::UpdatePageFlds( SfxPoolItem* pMsgHnt )
void SwDoc::GCFieldTypes()
{
for( sal_uInt16 n = mpFldTypes->size(); n > INIT_FLDTYPES; )
- {
- if( !(*mpFldTypes)[--n] )
- continue;
- if( !(*mpFldTypes)[n]->GetDepends() )
+ if( !(*mpFldTypes)[ --n ]->GetDepends() )
RemoveFldType( n );
- }
}
void SwDoc::LockExpFlds()
@@ -1280,11 +1252,7 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds )
const SwFieldType* pFldType;
// process separately:
for( n = mpFldTypes->size(); n; )
- {
- if( !(*mpFldTypes)[--n] )
- continue;
-
- switch( ( pFldType = (*mpFldTypes)[n] )->Which() )
+ switch( ( pFldType = (*mpFldTypes)[ --n ] )->Which() )
{
case RES_USERFLD:
{
@@ -1306,7 +1274,6 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds )
((SwSetExpFieldType*)pFldType)->SetOutlineChgNd( 0 );
break;
}
- }
}
// The array is filled with all fields; start calculation.
@@ -1629,11 +1596,7 @@ void SwDoc::_InitFieldTypes() // is being called by the CTOR
mpFldTypes->push_back( new SwPageNumberFieldType );
mpFldTypes->push_back( new SwAuthorFieldType );
mpFldTypes->push_back( new SwFileNameFieldType(this) );
-#if HAVE_FEATURE_DBCONNECTIVITY
mpFldTypes->push_back( new SwDBNameFieldType(this) );
-#else
- mpFldTypes->push_back( NULL );
-#endif
mpFldTypes->push_back( new SwGetExpFieldType(this) );
mpFldTypes->push_back( new SwGetRefFieldType( this ) );
mpFldTypes->push_back( new SwHiddenTxtFieldType );
@@ -1648,10 +1611,6 @@ void SwDoc::_InitFieldTypes() // is being called by the CTOR
mpFldTypes->push_back( new SwDBNextSetFieldType );
mpFldTypes->push_back( new SwDBNumSetFieldType );
mpFldTypes->push_back( new SwDBSetNumberFieldType );
-#else
- mpFldTypes->push_back( NULL );
- mpFldTypes->push_back( NULL );
- mpFldTypes->push_back( NULL );
#endif
mpFldTypes->push_back( new SwTemplNameFieldType(this) );
mpFldTypes->push_back( new SwTemplNameFieldType(this) );
@@ -1698,9 +1657,6 @@ const SwDBData& SwDoc::GetDBDesc()
const sal_uInt16 nSize = mpFldTypes->size();
for(sal_uInt16 i = 0; i < nSize && maDBData.sDataSource.isEmpty(); ++i)
{
- if( !(*mpFldTypes)[i] )
- continue;
-
SwFieldType& rFldType = *((*mpFldTypes)[i]);
sal_uInt16 nWhich = rFldType.Which();
if(IsUsed(rFldType))
@@ -1967,8 +1923,8 @@ void SwDoc::ChangeDBFields( const std::vector<OUString>& rOldNames,
switch( pFld->GetTyp()->Which() )
{
-#if HAVE_FEATURE_DBCONNECTIVITY
case RES_DBFLD:
+#if HAVE_FEATURE_DBCONNECTIVITY
if( IsNameInArray( rOldNames, lcl_DBDataToString(((SwDBField*)pFld)->GetDBData())))
{
SwDBFieldType* pOldTyp = (SwDBFieldType*)pFld->GetTyp();
@@ -1984,6 +1940,7 @@ void SwDoc::ChangeDBFields( const std::vector<OUString>& rOldNames,
bExpand = true;
}
+#endif
break;
case RES_DBSETNUMBERFLD:
@@ -2004,7 +1961,6 @@ void SwDoc::ChangeDBFields( const std::vector<OUString>& rOldNames,
((SwDBNameInfField*)pFld)->SetDBData(aNewDBData);
bExpand = true;
}
-#endif
// no break;
case RES_HIDDENTXTFLD:
case RES_HIDDENPARAFLD:
@@ -2247,7 +2203,7 @@ void SwDoc::ChangeAuthorityData( const SwAuthEntry* pNewData )
for( sal_uInt16 i = INIT_FLDTYPES; i < nSize; ++i )
{
SwFieldType* pFldType = (*mpFldTypes)[i];
- if( pFldType && RES_AUTHORITY == pFldType->Which() )
+ if( RES_AUTHORITY == pFldType->Which() )
{
SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)pFldType;
pAuthType->ChangeEntryContent(pNewData);
@@ -2735,7 +2691,6 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld,
ModifyNotification( 0, pDstFmtFld );
break;
-#if HAVE_FEATURE_DBCONNECTIVITY
case RES_DBNAMEFLD:
case RES_DBNEXTSETFLD:
case RES_DBNUMSETFLD:
@@ -2746,6 +2701,7 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld,
break;
case RES_DBFLD:
+#if HAVE_FEATURE_DBCONNECTIVITY
{
// JP 10.02.96: call ChgValue, so that the style change sets the
// ContentString correctly
diff --git a/sw/source/core/uibase/uno/unofreg.cxx b/sw/source/core/uibase/uno/unofreg.cxx
index 985e3ee..77b6f90 100644
--- a/sw/source/core/uibase/uno/unofreg.cxx
+++ b/sw/source/core/uibase/uno/unofreg.cxx
@@ -17,8 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <config_features.h>
-
#include "SwXFilterOptions.hxx"
#include "unofreg.hxx"
#include <sal/types.h>
@@ -206,7 +204,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sw_component_getFactory(
SwXModule_createInstance,
SwXModule_getSupportedServiceNames() );
}
-#if HAVE_FEATURE_DBCONNECTIVITY
else if( SwXMailMerge_getImplementationName().equalsAsciiL(
pImplName, nImplNameLen ) )
{
@@ -215,7 +212,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sw_component_getFactory(
SwXMailMerge_createInstance,
SwXMailMerge_getSupportedServiceNames() );
}
-#endif
else if( SwXFilterOptions::getImplementationName_Static().equalsAsciiL(
pImplName, nImplNameLen ) )
{
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index a469f63..8b4a0dc 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2774,9 +2774,6 @@ uno::Sequence< OUString > SwXTextFieldMasters::getElementNames(void)
std::vector<OUString> aFldNames;
for( size_t i = 0; i < nCount; ++i )
{
- if (!(*pFldTypes)[i])
- continue;
-
SwFieldType& rFldType = *((*pFldTypes)[i]);
OUString sFldName;
@@ -2982,8 +2979,6 @@ SwXFieldEnumeration::SwXFieldEnumeration(SwDoc & rDoc)
sal_uInt16 nCount = pFldTypes->size();
for(sal_uInt16 nType = 0; nType < nCount; ++nType)
{
- if( !(*pFldTypes)[nType] )
- continue;
const SwFieldType *pCurType = (*pFldTypes)[nType];
SwIterator<SwFmtFld,SwFieldType> aIter( *pCurType );
const SwFmtFld* pCurFldFmt = aIter.First();
More information about the Libreoffice-commits
mailing list