diff options
Diffstat (limited to 'sw/source/core/fields')
-rw-r--r-- | sw/source/core/fields/authfld.cxx | 79 | ||||
-rw-r--r-- | sw/source/core/fields/cellfml.cxx | 76 | ||||
-rw-r--r-- | sw/source/core/fields/chpfld.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/fields/dbfld.cxx | 129 | ||||
-rw-r--r-- | sw/source/core/fields/ddefld.cxx | 36 | ||||
-rw-r--r-- | sw/source/core/fields/ddetbl.cxx | 18 | ||||
-rw-r--r-- | sw/source/core/fields/docufld.cxx | 143 | ||||
-rw-r--r-- | sw/source/core/fields/expfld.cxx | 210 | ||||
-rw-r--r-- | sw/source/core/fields/fldbas.cxx | 109 | ||||
-rw-r--r-- | sw/source/core/fields/flddat.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/fields/flddropdown.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/fields/fldlst.cxx | 28 | ||||
-rw-r--r-- | sw/source/core/fields/macrofld.cxx | 37 | ||||
-rw-r--r-- | sw/source/core/fields/makefile.mk | 92 | ||||
-rw-r--r-- | sw/source/core/fields/reffld.cxx | 87 | ||||
-rw-r--r-- | sw/source/core/fields/scrptfld.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/fields/tblcalc.cxx | 60 | ||||
-rw-r--r-- | sw/source/core/fields/usrfld.cxx | 41 |
18 files changed, 535 insertions, 656 deletions
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index 5bc0766176..36a3e229bb 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -75,16 +75,16 @@ SV_IMPL_PTRARR( SortKeyArr, TOXSortKeyPtr ) SwAuthEntry::SwAuthEntry(const SwAuthEntry& rCopy) : nRefCount(0) { - for(USHORT i = 0; i < AUTH_FIELD_END; i++) + for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++) aAuthFields[i] = rCopy.aAuthFields[i]; } // -------------------------------------------------------- -BOOL SwAuthEntry::operator==(const SwAuthEntry& rComp) +sal_Bool SwAuthEntry::operator==(const SwAuthEntry& rComp) { - for(USHORT i = 0; i < AUTH_FIELD_END; i++) + for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++) if(aAuthFields[i] != rComp.aAuthFields[i]) - return FALSE; - return TRUE; + return sal_False; + return sal_True; } // -------------------------------------------------------- @@ -95,8 +95,8 @@ SwAuthorityFieldType::SwAuthorityFieldType(SwDoc* pDoc) m_pSortKeyArr(new SortKeyArr(3, 3)), m_cPrefix('['), m_cSuffix(']'), - m_bIsSequence(FALSE), - m_bSortByDocument(TRUE), + m_bIsSequence(sal_False), + m_bSortByDocument(sal_True), m_eLanguage((LanguageType)::GetAppLanguage()) { } @@ -112,7 +112,7 @@ SwAuthorityFieldType::SwAuthorityFieldType( const SwAuthorityFieldType& rFType) m_eLanguage(rFType.m_eLanguage), m_sSortAlgorithm(rFType.m_sSortAlgorithm) { - for(USHORT i = 0; i < rFType.m_pSortKeyArr->Count(); i++) + for(sal_uInt16 i = 0; i < rFType.m_pSortKeyArr->Count(); i++) m_pSortKeyArr->Insert((*rFType.m_pSortKeyArr)[i], i); } @@ -132,16 +132,16 @@ SwFieldType* SwAuthorityFieldType::Copy() const void SwAuthorityFieldType::RemoveField(long nHandle) { #if OSL_DEBUG_LEVEL > 1 - BOOL bRemoved = FALSE; + sal_Bool bRemoved = sal_False; #endif - for(USHORT j = 0; j < m_pDataArr->Count(); j++) + for(sal_uInt16 j = 0; j < m_pDataArr->Count(); j++) { SwAuthEntry* pTemp = m_pDataArr->GetObject(j); long nRet = (long)(void*)pTemp; if(nRet == nHandle) { #if OSL_DEBUG_LEVEL > 1 - bRemoved = TRUE; + bRemoved = sal_True; #endif pTemp->RemoveRef(); if(!pTemp->GetRefCount()) @@ -162,11 +162,11 @@ long SwAuthorityFieldType::AddField(const String& rFieldContents) { long nRet = 0; SwAuthEntry* pEntry = new SwAuthEntry; - for( USHORT i = 0; i < AUTH_FIELD_END; ++i ) + for( sal_uInt16 i = 0; i < AUTH_FIELD_END; ++i ) pEntry->SetAuthorField( (ToxAuthorityField)i, rFieldContents.GetToken( i, TOX_STYLE_DELIMITER )); - for(USHORT j = 0; j < m_pDataArr->Count() && pEntry; j++) + for(sal_uInt16 j = 0; j < m_pDataArr->Count() && pEntry; j++) { SwAuthEntry* pTemp = m_pDataArr->GetObject(j); if(*pTemp == *pEntry) @@ -188,16 +188,16 @@ long SwAuthorityFieldType::AddField(const String& rFieldContents) return nRet; } -BOOL SwAuthorityFieldType::AddField(long nHandle) +sal_Bool SwAuthorityFieldType::AddField(long nHandle) { - BOOL bRet = FALSE; - for( USHORT j = 0; j < m_pDataArr->Count(); j++ ) + sal_Bool bRet = sal_False; + for( sal_uInt16 j = 0; j < m_pDataArr->Count(); j++ ) { SwAuthEntry* pTemp = m_pDataArr->GetObject(j); long nTmp = (long)(void*)pTemp; if( nTmp == nHandle ) { - bRet = TRUE; + bRet = sal_True; pTemp->AddRef(); //re-generate positions of the fields DelSequenceArray(); @@ -211,7 +211,7 @@ BOOL SwAuthorityFieldType::AddField(long nHandle) const SwAuthEntry* SwAuthorityFieldType::GetEntryByHandle(long nHandle) const { const SwAuthEntry* pRet = 0; - for(USHORT j = 0; j < m_pDataArr->Count(); j++) + for(sal_uInt16 j = 0; j < m_pDataArr->Count(); j++) { const SwAuthEntry* pTemp = m_pDataArr->GetObject(j); long nTmp = (long)(void*)pTemp; @@ -228,7 +228,7 @@ const SwAuthEntry* SwAuthorityFieldType::GetEntryByHandle(long nHandle) const void SwAuthorityFieldType::GetAllEntryIdentifiers( SvStringsDtor& rToFill )const { - for(USHORT j = 0; j < m_pDataArr->Count(); j++) + for(sal_uInt16 j = 0; j < m_pDataArr->Count(); j++) { SwAuthEntry* pTemp = m_pDataArr->GetObject(j); rToFill.Insert( new String( pTemp->GetAuthorField( @@ -240,7 +240,7 @@ const SwAuthEntry* SwAuthorityFieldType::GetEntryByIdentifier( const String& rIdentifier)const { const SwAuthEntry* pRet = 0; - for( USHORT j = 0; j < m_pDataArr->Count(); ++j ) + for( sal_uInt16 j = 0; j < m_pDataArr->Count(); ++j ) { const SwAuthEntry* pTemp = m_pDataArr->GetObject(j); if( rIdentifier == pTemp->GetAuthorField( AUTH_FIELD_IDENTIFIER )) @@ -255,13 +255,13 @@ const SwAuthEntry* SwAuthorityFieldType::GetEntryByIdentifier( bool SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry) { bool bChanged = false; - for( USHORT j = 0; j < m_pDataArr->Count(); ++j ) + for( sal_uInt16 j = 0; j < m_pDataArr->Count(); ++j ) { SwAuthEntry* pTemp = m_pDataArr->GetObject(j); if(pTemp->GetAuthorField(AUTH_FIELD_IDENTIFIER) == pNewEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER)) { - for(USHORT i = 0; i < AUTH_FIELD_END; i++) + for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++) pTemp->SetAuthorField((ToxAuthorityField) i, pNewEntry->GetAuthorField((ToxAuthorityField)i)); bChanged = true; @@ -274,9 +274,9 @@ bool SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry) Description: appends a new entry (if new) and returns the array position -----------------------------------------------------------------------*/ -USHORT SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert ) +sal_uInt16 SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert ) { - USHORT nRet = 0; + sal_uInt16 nRet = 0; for( nRet = 0; nRet < m_pDataArr->Count(); ++nRet ) { SwAuthEntry* pTemp = m_pDataArr->GetObject( nRet ); @@ -294,7 +294,7 @@ USHORT SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert ) return nRet; } -long SwAuthorityFieldType::GetHandle(USHORT nPos) +long SwAuthorityFieldType::GetHandle(sal_uInt16 nPos) { long nRet = 0; if( nPos < m_pDataArr->Count() ) @@ -305,7 +305,7 @@ long SwAuthorityFieldType::GetHandle(USHORT nPos) return nRet; } -USHORT SwAuthorityFieldType::GetSequencePos(long nHandle) +sal_uInt16 SwAuthorityFieldType::GetSequencePos(long nHandle) { //find the field in a sorted array of handles, #if OSL_DEBUG_LEVEL > 1 @@ -379,7 +379,7 @@ USHORT SwAuthorityFieldType::GetSequencePos(long nHandle) } } - for(USHORT i = 0; i < aSortArr.Count(); i++) + for(sal_uInt16 i = 0; i < aSortArr.Count(); i++) { const SwTOXSortTabBase& rBase = *aSortArr[i]; SwFmtFld& rFmtFld = ((SwTOXAuthority&)rBase).GetFldFmt(); @@ -389,8 +389,8 @@ USHORT SwAuthorityFieldType::GetSequencePos(long nHandle) aSortArr.DeleteAndDestroy(0, aSortArr.Count()); } //find nHandle - USHORT nRet = 0; - for(USHORT i = 0; i < m_SequArr.size(); ++i) + sal_uInt16 nRet = 0; + for(sal_uInt16 i = 0; i < m_SequArr.size(); ++i) { if(m_SequArr[i] == nHandle) { @@ -404,7 +404,8 @@ USHORT SwAuthorityFieldType::GetSequencePos(long nHandle) return nRet; } -bool SwAuthorityFieldType::QueryValue( Any& rVal, USHORT nWhichId ) const + +bool SwAuthorityFieldType::QueryValue( Any& rVal, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -459,7 +460,7 @@ bool SwAuthorityFieldType::QueryValue( Any& rVal, USHORT nWhichId ) const return true; } -bool SwAuthorityFieldType::PutValue( const Any& rAny, USHORT nWhichId ) +bool SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId ) { bool bRet = true; String sTmp; @@ -539,12 +540,12 @@ void SwAuthorityFieldType::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) SwModify::Modify( pOld, pNew ); } -USHORT SwAuthorityFieldType::GetSortKeyCount() const +sal_uInt16 SwAuthorityFieldType::GetSortKeyCount() const { return m_pSortKeyArr->Count(); } -const SwTOXSortKey* SwAuthorityFieldType::GetSortKey(USHORT nIdx) const +const SwTOXSortKey* SwAuthorityFieldType::GetSortKey(sal_uInt16 nIdx) const { SwTOXSortKey* pRet = 0; if(m_pSortKeyArr->Count() > nIdx) @@ -553,11 +554,11 @@ const SwTOXSortKey* SwAuthorityFieldType::GetSortKey(USHORT nIdx) const return pRet; } -void SwAuthorityFieldType::SetSortKeys(USHORT nKeyCount, SwTOXSortKey aKeys[]) +void SwAuthorityFieldType::SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey aKeys[]) { m_pSortKeyArr->DeleteAndDestroy(0, m_pSortKeyArr->Count()); - USHORT nArrIdx = 0; - for(USHORT i = 0; i < nKeyCount; i++) + sal_uInt16 nArrIdx = 0; + for(sal_uInt16 i = 0; i < nKeyCount; i++) if(aKeys[i].eField < AUTH_FIELD_END) m_pSortKeyArr->Insert(new SwTOXSortKey(aKeys[i]), nArrIdx++); } @@ -670,7 +671,7 @@ const char* aFieldNames[] = "ISBN" }; -bool SwAuthorityField::QueryValue( Any& rAny, USHORT /*nWhichId*/ ) const +bool SwAuthorityField::QueryValue( Any& rAny, sal_uInt16 /*nWhichId*/ ) const { if(!GetTyp()) return false; @@ -701,7 +702,7 @@ sal_Int16 lcl_Find(const OUString& rFieldName) return -1; } //---------------------------------------------------------------------------- -bool SwAuthorityField::PutValue( const Any& rAny, USHORT /*nWhichId*/ ) +bool SwAuthorityField::PutValue( const Any& rAny, sal_uInt16 /*nWhichId*/ ) { if(!GetTyp() || !((SwAuthorityFieldType*)GetTyp())->GetEntryByHandle(m_nHandle)) return false; @@ -746,7 +747,7 @@ SwFieldType* SwAuthorityField::ChgTyp( SwFieldType* pFldTyp ) { const SwAuthEntry* pEntry = pSrcTyp->GetEntryByHandle( m_nHandle ); - USHORT nHdlPos = pDstTyp->AppendField( *pEntry ); + sal_uInt16 nHdlPos = pDstTyp->AppendField( *pEntry ); pSrcTyp->RemoveField( m_nHandle ); m_nHandle = pDstTyp->GetHandle( nHdlPos ); pDstTyp->AddField( m_nHandle ); diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index a9457f2bf9..642f360ffc 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -55,7 +55,7 @@ const sal_Unicode cRelTrenner = ','; const sal_Unicode cRelKennung = ''; // CTRL-R -const USHORT cMAXSTACKSIZE = 50; +const sal_uInt16 cMAXSTACKSIZE = 50; const SwFrm* lcl_GetBoxFrm( const SwTableBox& rBox ); long lcl_GetLongBoxNum( String& rStr ); @@ -108,7 +108,7 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const const SfxPoolItem* pItem; if( SFX_ITEM_SET == GetFrmFmt()->GetItemState( - RES_BOXATR_FORMULA, FALSE, &pItem ) ) + RES_BOXATR_FORMULA, sal_False, &pItem ) ) { rCalcPara.rCalc.SetCalcError( CALC_NOERR ); // wieder zuruecksetzen if( !((SwTblBoxFormula*)pItem)->IsValid() ) @@ -135,7 +135,7 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const break; } else if( SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState( - RES_BOXATR_VALUE, FALSE, &pItem ) ) + RES_BOXATR_VALUE, sal_False, &pItem ) ) { rCalcPara.rCalc.SetCalcError( CALC_NOERR ); // wieder zuruecksetzen nRet = ((SwTblBoxValue*)pItem)->GetValue(); @@ -201,7 +201,7 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const break; default: - String const value(pFld->ExpandField(pDoc->IsClipBoard())); + String const value(pFld->ExpandField(true)); nRet = rCalcPara.rCalc.Calculate(value).GetDouble(); } } @@ -233,7 +233,7 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const } // ?? sonst ist das ein Fehler - } while( FALSE ); + } while( sal_False ); if( !rCalcPara.IsStackOverFlow() ) { @@ -264,15 +264,15 @@ SwTblCalcPara::~SwTblCalcPara() delete pBoxStk; } -bool SwTblCalcPara::CalcWithStackOverflow() +sal_Bool SwTblCalcPara::CalcWithStackOverflow() { // falls ein StackUeberlauf erkannt wurde, sollte mit // der letzten Box noch mal aufgesetzt werden. Irgend // ein Weg sollte dann - USHORT nSaveMaxSize = nMaxSize; + sal_uInt16 nSaveMaxSize = nMaxSize; nMaxSize = cMAXSTACKSIZE - 5; - USHORT nCnt = 0; + sal_uInt16 nCnt = 0; SwTableBoxes aStackOverFlows; do { SwTableBox* pBox = (SwTableBox*)pLastTblBox; @@ -289,7 +289,7 @@ bool SwTblCalcPara::CalcWithStackOverflow() // falls Rekursionen erkannt wurden nStackCnt = 0; rCalc.SetCalcError( CALC_NOERR ); - pBoxStk->Remove( USHORT(0), pBoxStk->Count() ); + pBoxStk->Remove( sal_uInt16(0), pBoxStk->Count() ); while( !rCalc.IsCalcError() && nCnt ) { @@ -351,7 +351,7 @@ void SwTableFormula::_MakeFormel( const SwTable& rTbl, String& rNewStr, rNewStr += '('; bool bDelim = false; - for( USHORT n = 0; n < aBoxes.Count() && + for( sal_uInt16 n = 0; n < aBoxes.Count() && !pCalcPara->rCalc.IsCalcError(); ++n ) { const SwTableBox* pTblBox = aBoxes[n]; @@ -361,7 +361,7 @@ void SwTableFormula::_MakeFormel( const SwTable& rTbl, String& rNewStr, rNewStr += cListDelim; bDelim = true; rNewStr += pCalcPara->rCalc.GetStrResult( - pTblBox->GetValue( *pCalcPara ), FALSE ); + pTblBox->GetValue( *pCalcPara ), sal_False ); } } rNewStr += ')'; @@ -373,7 +373,7 @@ void SwTableFormula::_MakeFormel( const SwTable& rTbl, String& rNewStr, if ( pSttBox->getRowSpan() >= 1 ) { rNewStr += pCalcPara->rCalc.GetStrResult( - pSttBox->GetValue( *pCalcPara ), FALSE ); + pSttBox->GetValue( *pCalcPara ), sal_False ); } } else @@ -609,7 +609,7 @@ String SwTableFormula::ScanString( FnScanFormel fnFormel, const SwTable& rTbl, void* pPara ) const { String aStr; - USHORT nFml = 0, nStt = 0, nEnd = 0, nTrenner; + sal_uInt16 nFml = 0, nStt = 0, nEnd = 0, nTrenner; do { // falls der Formel ein Name vorangestellt ist, diese Tabelle @@ -689,7 +689,7 @@ String SwTableFormula::ScanString( FnScanFormel fnFormel, const SwTable& rTbl, } nFml = nEnd+1; - } while( TRUE ); + } while( sal_True ); return aStr; } @@ -697,7 +697,7 @@ const SwTable* SwTableFormula::FindTable( SwDoc& rDoc, const String& rNm ) const { const SwFrmFmts& rTblFmts = *rDoc.GetTblFrmFmts(); const SwTable* pTmpTbl, *pRet = 0; - for( USHORT nFmtCnt = rTblFmts.Count(); nFmtCnt; ) + for( sal_uInt16 nFmtCnt = rTblFmts.Count(); nFmtCnt; ) { SwFrmFmt* pFmt = rTblFmts[ --nFmtCnt ]; // falls wir von Sw3Writer gerufen werden, dann ist dem @@ -726,12 +726,12 @@ const SwFrm* lcl_GetBoxFrm( const SwTableBox& rBox ) SwCntntNode* pCNd = aIdx.GetNodes().GoNext( &aIdx ); OSL_ENSURE( pCNd, "Box hat keinen TextNode" ); Point aPt; // den im Layout 1. Frame returnen - Tab.Kopfzeile !! - return pCNd->GetFrm( &aPt, NULL, FALSE ); + return pCNd->GetFrm( &aPt, NULL, sal_False ); } long lcl_GetLongBoxNum( String& rStr ) { - USHORT nPos; + sal_uInt16 nPos; long nRet; if( STRING_NOTFOUND == ( nPos = rStr.Search( cRelTrenner ) )) { @@ -774,8 +774,8 @@ const SwTableBox* lcl_RelToBox( const SwTable& rTbl, pBox = pLine->GetUpper(); pLine = pBox->GetUpper(); } - USHORT nSttBox = pLine->GetTabBoxes().GetPos( pBox ); - USHORT nSttLine = rTbl.GetTabLines().GetPos( pLine ); + sal_uInt16 nSttBox = pLine->GetTabBoxes().GetPos( pBox ); + sal_uInt16 nSttLine = rTbl.GetTabLines().GetPos( pLine ); long nBoxOffset = lcl_GetLongBoxNum( sGetName ) + nSttBox; long nLineOffset = lcl_GetLongBoxNum( sGetName ) + nSttLine; @@ -787,13 +787,13 @@ const SwTableBox* lcl_RelToBox( const SwTable& rTbl, if( nLineOffset >= long(pLines->Count()) ) return 0; - pLine = (*pLines)[ USHORT(nLineOffset) ]; + pLine = (*pLines)[ sal_uInt16(nLineOffset) ]; // dann suche die Box pBoxes = &pLine->GetTabBoxes(); if( nBoxOffset >= long(pBoxes->Count()) ) return 0; - pBox = (*pBoxes)[ USHORT(nBoxOffset) ]; + pBox = (*pBoxes)[ sal_uInt16(nBoxOffset) ]; while( sGetName.Len() ) { @@ -851,8 +851,8 @@ String lcl_BoxNmToRel( const SwTable& rTbl, const SwTableNode& rTblNd, // die externe Darstellung bei: if( &rTbl == &rTblNd.GetTable() ) { - long nBox = SwTable::_GetBoxNum( sTmp, TRUE ); - nBox -= SwTable::_GetBoxNum( sCpy, TRUE ); + long nBox = SwTable::_GetBoxNum( sTmp, sal_True ); + nBox -= SwTable::_GetBoxNum( sCpy, sal_True ); long nLine = SwTable::_GetBoxNum( sTmp ); nLine -= SwTable::_GetBoxNum( sCpy ); @@ -876,11 +876,11 @@ String lcl_BoxNmToRel( const SwTable& rTbl, const SwTableNode& rTblNd, return sTmp; } -USHORT SwTableFormula::GetBoxesOfFormula( const SwTable& rTbl, +sal_uInt16 SwTableFormula::GetBoxesOfFormula( const SwTable& rTbl, SwSelBoxes& rBoxes ) { if( rBoxes.Count() ) - rBoxes.Remove( USHORT(0), rBoxes.Count() ); + rBoxes.Remove( sal_uInt16(0), rBoxes.Count() ); BoxNmToPtr( &rTbl ); ScanString( &SwTableFormula::_GetFmlBoxes, rTbl, &rBoxes ); @@ -964,7 +964,7 @@ void SwTableFormula::GetBoxes( const SwTableBox& rSttBox, break; // dann mal die Tabellenkoepfe raus: - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) { pLine = rBoxes[n]->GetUpper(); while( pLine->GetUpper() ) @@ -973,7 +973,7 @@ void SwTableFormula::GetBoxes( const SwTableBox& rSttBox, if( pTbl->IsHeadline( *pLine ) ) rBoxes.Remove( n--, 1 ); } - } while( FALSE ); + } while( sal_False ); } } @@ -1037,9 +1037,9 @@ bool SwTableFormula::HasValidBoxes() const } -USHORT SwTableFormula::GetLnPosInTbl( const SwTable& rTbl, const SwTableBox* pBox ) +sal_uInt16 SwTableFormula::GetLnPosInTbl( const SwTable& rTbl, const SwTableBox* pBox ) { - USHORT nRet = USHRT_MAX; + sal_uInt16 nRet = USHRT_MAX; if( pBox ) { const SwTableLine* pLn = pBox->GetUpper(); @@ -1063,8 +1063,8 @@ void SwTableFormula::_SplitMergeBoxNm( const SwTable& rTbl, String& rNewStr, String* pTblNmBox = pLastBox ? pLastBox : &rFirstBox; - USHORT nLastBoxLen = pTblNmBox->Len(); - USHORT nTrenner = pTblNmBox->Search( '.' ); + sal_uInt16 nLastBoxLen = pTblNmBox->Len(); + sal_uInt16 nTrenner = pTblNmBox->Search( '.' ); if( STRING_NOTFOUND != nTrenner && // falls im Namen schon die Punkte enthalten sind, // treten diese immer paarig auf!!! (A1.1.1 !!) @@ -1085,13 +1085,13 @@ void SwTableFormula::_SplitMergeBoxNm( const SwTable& rTbl, String& rNewStr, if( rTblUpd.pTbl != &rTbl ) // es ist nicht die akt. (rNewStr += rTblUpd.pTbl->GetFrmFmt()->GetName() ) += '.'; // den neuen Tabellen Namen setzen - rTblUpd.bModified = TRUE; + rTblUpd.bModified = sal_True; } else if( pFnd != rTblUpd.pTbl || ( rTblUpd.pTbl != &rTbl && &rTbl != rTblUpd.DATA.pDelTbl)) (rNewStr += sTblNm ) += '.'; // den Tabellen Namen behalten else - rTblUpd.bModified = TRUE; + rTblUpd.bModified = sal_True; } else (rNewStr += sTblNm ) += '.'; // den Tabellen Namen behalten @@ -1141,7 +1141,7 @@ void SwTableFormula::_SplitMergeBoxNm( const SwTable& rTbl, String& rNewStr, { // das ist die "erste" Box in der Selektion. Die bestimmt ob die // Formel in der alten oder neuen Tabelle steht. - USHORT nEndLnPos = SwTableFormula::GetLnPosInTbl( *pTbl, pEndBox ), + sal_uInt16 nEndLnPos = SwTableFormula::GetLnPosInTbl( *pTbl, pEndBox ), nSttLnPos = SwTableFormula::GetLnPosInTbl( *pTbl, pSttBox ); if( USHRT_MAX != nSttLnPos && USHRT_MAX != nEndLnPos && @@ -1156,7 +1156,7 @@ void SwTableFormula::_SplitMergeBoxNm( const SwTable& rTbl, String& rNewStr, { // das ist aufjedenfall eine ungueltige Formel, also fuers // Undo auf Modified setzen - rTblUpd.bModified = TRUE; + rTblUpd.bModified = sal_True; if( pEndBox ) bInNewTbl = USHRT_MAX != nEndLnPos && rTblUpd.nSplitLine <= nEndLnPos && @@ -1165,7 +1165,7 @@ void SwTableFormula::_SplitMergeBoxNm( const SwTable& rTbl, String& rNewStr, } else { - USHORT nSttLnPos = SwTableFormula::GetLnPosInTbl( *pTbl, pSttBox ); + sal_uInt16 nSttLnPos = SwTableFormula::GetLnPosInTbl( *pTbl, pSttBox ); // dann landet das Teil in der neuen Tabelle? bInNewTbl = USHRT_MAX != nSttLnPos && rTblUpd.nSplitLine <= nSttLnPos && @@ -1177,7 +1177,7 @@ void SwTableFormula::_SplitMergeBoxNm( const SwTable& rTbl, String& rNewStr, { if( !bInNewTbl ) { - rTblUpd.bModified = TRUE; + rTblUpd.bModified = sal_True; ( rNewStr += rTblUpd.pTbl->GetFrmFmt()->GetName() ) += '.'; } else if( sTblNm.Len() ) @@ -1185,7 +1185,7 @@ void SwTableFormula::_SplitMergeBoxNm( const SwTable& rTbl, String& rNewStr, } else if( bInNewTbl ) { - rTblUpd.bModified = TRUE; + rTblUpd.bModified = sal_True; ( rNewStr += *rTblUpd.DATA.pNewTblNm ) += '.'; } else if( sTblNm.Len() ) diff --git a/sw/source/core/fields/chpfld.cxx b/sw/source/core/fields/chpfld.cxx index 36a4d43756..8c47f111c8 100644 --- a/sw/source/core/fields/chpfld.cxx +++ b/sw/source/core/fields/chpfld.cxx @@ -135,11 +135,11 @@ void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, sal_Bool bSrchNum) do { if( pONd && pONd->GetTxtColl() ) { - BYTE nPrevLvl = nLevel; + sal_uInt8 nPrevLvl = nLevel; OSL_ENSURE( pONd->GetAttrOutlineLevel() >= 0 && pONd->GetAttrOutlineLevel() <= MAXLEVEL, "<SwChapterField::ChangeExpansion(..)> - outline node with inconsistent outline level. Serious defect -> please inform OD." ); - nLevel = static_cast<BYTE>(pONd->GetAttrOutlineLevel()); + nLevel = static_cast<sal_uInt8>(pONd->GetAttrOutlineLevel()); if( nPrevLvl < nLevel ) nLevel = nPrevLvl; @@ -171,7 +171,7 @@ void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, sal_Bool bSrchNum) SwNumRule* pRule( pTxtNd->GetNumRule() ); if ( pTxtNd->IsCountedInList() && pRule ) { - const SwNumFmt& rNFmt = pRule->Get( static_cast<USHORT>(pTxtNd->GetActualListLevel()) ); + const SwNumFmt& rNFmt = pRule->Get( static_cast<sal_uInt16>(pTxtNd->GetActualListLevel()) ); sPost = rNFmt.GetSuffix(); sPre = rNFmt.GetPrefix(); } @@ -200,7 +200,7 @@ void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, sal_Bool bSrchNum) } } -bool SwChapterField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwChapterField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -234,9 +234,9 @@ bool SwChapterField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwChapterField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwChapterField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; switch( nWhichId ) { case FIELD_PROP_BYTE1: @@ -272,7 +272,7 @@ bool SwChapterField::PutValue( const uno::Any& rAny, USHORT nWhichId ) default: OSL_FAIL("illegal property"); - bRet = false; + bRet = false; } return bRet; } diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx index 681d7f23c8..5e89777d7f 100644 --- a/sw/source/core/fields/dbfld.cxx +++ b/sw/source/core/fields/dbfld.cxx @@ -29,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <float.h> #include <sfx2/app.hxx> #include <svl/zforlist.hxx> @@ -64,7 +63,7 @@ String lcl_DBTrennConv(const String& aContent) { String sTmp(aContent); sal_Unicode* pStr = sTmp.GetBufferAccess(); - for( USHORT i = sTmp.Len(); i; --i, ++pStr ) + for( sal_uInt16 i = sTmp.Len(); i; --i, ++pStr ) if( DB_DELIM == *pStr ) *pStr = '.'; return sTmp; @@ -115,7 +114,7 @@ void SwDBFieldType::ReleaseRef() if (--nRefCnt <= 0) { - USHORT nPos = GetDoc()->GetFldTypes()->GetPos(this); + sal_uInt16 nPos = GetDoc()->GetFldTypes()->GetPos(this); if (nPos != USHRT_MAX) { @@ -125,7 +124,7 @@ void SwDBFieldType::ReleaseRef() } } -bool SwDBFieldType::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwDBFieldType::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -147,7 +146,7 @@ bool SwDBFieldType::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwDBFieldType::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwDBFieldType::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -193,12 +192,12 @@ bool SwDBFieldType::PutValue( const uno::Any& rAny, USHORT nWhichId ) Beschreibung: SwDBField --------------------------------------------------------------------*/ -SwDBField::SwDBField(SwDBFieldType* pTyp, ULONG nFmt) +SwDBField::SwDBField(SwDBFieldType* pTyp, sal_uLong nFmt) : SwValueField(pTyp, nFmt), nSubType(0), - bIsInBodyTxt(TRUE), - bValidValue(FALSE), - bInitialized(FALSE) + bIsInBodyTxt(sal_True), + bValidValue(sal_False), + bInitialized(sal_False) { if (GetTyp()) ((SwDBFieldType*)GetTyp())->AddRef(); @@ -273,29 +272,25 @@ SwField* SwDBField::Copy() const return pTmp; } -String SwDBField::GetCntnt(BOOL bName) const +String SwDBField::GetFieldName() const { - if(bName) - { - const String& rDBName = ((SwDBFieldType*)GetTyp())->GetName(); + const String& rDBName = static_cast<SwDBFieldType*>(GetTyp())->GetName(); - String sContent( rDBName.GetToken(0, DB_DELIM) ); + String sContent( rDBName.GetToken(0, DB_DELIM) ); - if (sContent.Len() > 1) - { - sContent += DB_DELIM; - sContent += rDBName.GetToken(1, DB_DELIM); - sContent += DB_DELIM; - sContent += rDBName.GetToken(2, DB_DELIM); - } - return lcl_DBTrennConv(sContent); + if (sContent.Len() > 1) + { + sContent += DB_DELIM; + sContent += rDBName.GetToken(1, DB_DELIM); + sContent += DB_DELIM; + sContent += rDBName.GetToken(2, DB_DELIM); } - return Expand(); + return lcl_DBTrennConv(sContent); } //------------------------------------------------------------------------------ -void SwDBField::ChgValue( double d, BOOL bVal ) +void SwDBField::ChgValue( double d, sal_Bool bVal ) { bValidValue = bVal; SetValue(d); @@ -323,7 +318,7 @@ void SwDBField::Evaluate() SwNewDBMgr* pMgr = GetDoc()->GetNewDBMgr(); // erstmal loeschen - bValidValue = FALSE; + bValidValue = sal_False; double nValue = DBL_MAX; const SwDBData& aTmpData = GetDBData(); @@ -352,7 +347,7 @@ void SwDBField::Evaluate() if (*pDocFormatter->GetNullDate() != aStandard) nValue += (aStandard - *pDocFormatter->GetNullDate()); } - bValidValue = TRUE; + bValidValue = sal_True; SetValue(nValue); aContent = ((SwValueFieldType*)GetTyp())->ExpandValue(nValue, GetFormat(), GetLanguage()); } @@ -367,15 +362,15 @@ void SwDBField::Evaluate() SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter(); if (nFmt && nFmt != SAL_MAX_UINT32 && !pFormatter->IsTextFormat(nFmt)) - bValidValue = TRUE; // Wegen Bug #60339 nicht mehr bei allen Strings + bValidValue = sal_True; // Wegen Bug #60339 nicht mehr bei allen Strings } else { - // Bei Strings TRUE wenn Laenge > 0 sonst FALSE + // Bei Strings sal_True wenn Laenge > 0 sonst sal_False SetValue(aContent.Len() ? 1 : 0); } } - bInitialized = TRUE; + bInitialized = sal_True; } /*-------------------------------------------------------------------- @@ -387,23 +382,23 @@ const String& SwDBField::GetPar1() const return ((SwDBFieldType*)GetTyp())->GetName(); } -USHORT SwDBField::GetSubType() const +sal_uInt16 SwDBField::GetSubType() const { return nSubType; } -void SwDBField::SetSubType(USHORT nType) +void SwDBField::SetSubType(sal_uInt16 nType) { nSubType = nType; } -bool SwDBField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwDBField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { case FIELD_PROP_BOOL1: { - BOOL bTemp = 0 == (GetSubType()&nsSwExtendedSubType::SUB_OWN_FMT); + sal_Bool bTemp = 0 == (GetSubType()&nsSwExtendedSubType::SUB_OWN_FMT); rAny.setValue(&bTemp, ::getBooleanCppuType()); } break; @@ -429,7 +424,7 @@ bool SwDBField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const } -bool SwDBField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwDBField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -441,10 +436,10 @@ bool SwDBField::PutValue( const uno::Any& rAny, USHORT nWhichId ) break; case FIELD_PROP_BOOL2: { - USHORT nSubTyp = GetSubType(); + sal_uInt16 nSubTyp = GetSubType(); sal_Bool bVisible = sal_False; if(!(rAny >>= bVisible)) - return FALSE; + return sal_False; if(bVisible) nSubTyp &= ~nsSwExtendedSubType::SUB_INVISIBLE; else @@ -492,7 +487,7 @@ bool SwDBField::PutValue( const uno::Any& rAny, USHORT nWhichId ) Beschreibung: Basisklasse fuer alle weiteren Datenbankfelder --------------------------------------------------------------------*/ -SwDBNameInfField::SwDBNameInfField(SwFieldType* pTyp, const SwDBData& rDBData, ULONG nFmt) : +SwDBNameInfField::SwDBNameInfField(SwFieldType* pTyp, const SwDBData& rDBData, sal_uLong nFmt) : SwField(pTyp, nFmt), aDBData(rDBData), nSubType(0) @@ -518,24 +513,20 @@ void SwDBNameInfField::SetDBData(const SwDBData & rDBData) //------------------------------------------------------------------------------ -String SwDBNameInfField::GetCntnt(BOOL bName) const +String SwDBNameInfField::GetFieldName() const { - String sStr(SwField::GetCntnt(bName)); - - if(bName) + String sStr( SwField::GetFieldName() ); + if (aDBData.sDataSource.getLength()) { - if (aDBData.sDataSource.getLength()) - { - sStr += ':'; - sStr += String(aDBData.sDataSource); - sStr += DB_DELIM; - sStr += String(aDBData.sCommand); - } + sStr += ':'; + sStr += String(aDBData.sDataSource); + sStr += DB_DELIM; + sStr += String(aDBData.sCommand); } return lcl_DBTrennConv(sStr); } -bool SwDBNameInfField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwDBNameInfField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -560,7 +551,7 @@ bool SwDBNameInfField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwDBNameInfField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwDBNameInfField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -575,7 +566,7 @@ bool SwDBNameInfField::PutValue( const uno::Any& rAny, USHORT nWhichId ) break; case FIELD_PROP_BOOL2: { - USHORT nSubTyp = GetSubType(); + sal_uInt16 nSubTyp = GetSubType(); sal_Bool bVisible = sal_False; if(!(rAny >>= bVisible)) return false; @@ -592,12 +583,12 @@ bool SwDBNameInfField::PutValue( const uno::Any& rAny, USHORT nWhichId ) return true; } -USHORT SwDBNameInfField::GetSubType() const +sal_uInt16 SwDBNameInfField::GetSubType() const { return nSubType; } -void SwDBNameInfField::SetSubType(USHORT nType) +void SwDBNameInfField::SetSubType(sal_uInt16 nType) { nSubType = nType; } @@ -626,7 +617,7 @@ SwDBNextSetField::SwDBNextSetField(SwDBNextSetFieldType* pTyp, const String& rCond, const String& , const SwDBData& rDBData) : - SwDBNameInfField(pTyp, rDBData), aCond(rCond), bCondValid(TRUE) + SwDBNameInfField(pTyp, rDBData), aCond(rCond), bCondValid(sal_True) {} //------------------------------------------------------------------------------ @@ -672,7 +663,7 @@ void SwDBNextSetField::SetPar1(const String& rStr) aCond = rStr; } -bool SwDBNextSetField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwDBNextSetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { bool bRet = true; switch( nWhichId ) @@ -686,7 +677,7 @@ bool SwDBNextSetField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return bRet; } -bool SwDBNextSetField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwDBNextSetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { bool bRet = true; switch( nWhichId ) @@ -728,7 +719,7 @@ SwDBNumSetField::SwDBNumSetField(SwDBNumSetFieldType* pTyp, SwDBNameInfField(pTyp, rDBData), aCond(rCond), aPar2(rDBNum), - bCondValid(TRUE) + bCondValid(sal_True) {} //------------------------------------------------------------------------------ @@ -757,7 +748,7 @@ void SwDBNumSetField::Evaluate(SwDoc* pDoc) if( bCondValid && pMgr && pMgr->IsInMerge() && pMgr->IsDataSourceOpen(aTmpData.sDataSource, aTmpData.sCommand, sal_True)) { // Bedingug OK -> aktuellen Set einstellen - pMgr->ToRecordId(Max((USHORT)aPar2.ToInt32(), USHORT(1))-1); + pMgr->ToRecordId(Max((sal_uInt16)aPar2.ToInt32(), sal_uInt16(1))-1); } } @@ -789,7 +780,7 @@ void SwDBNumSetField::SetPar2(const String& rStr) aPar2 = rStr; } -bool SwDBNumSetField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwDBNumSetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { bool bRet = true; switch( nWhichId ) @@ -806,7 +797,7 @@ bool SwDBNumSetField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return bRet; } -bool SwDBNumSetField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwDBNumSetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { bool bRet = true; switch( nWhichId ) @@ -838,7 +829,7 @@ SwDBNameFieldType::SwDBNameFieldType(SwDoc* pDocument) } //------------------------------------------------------------------------------ -String SwDBNameFieldType::Expand(ULONG ) const +String SwDBNameFieldType::Expand(sal_uLong ) const { const SwDBData aData = pDoc->GetDBData(); String sRet(aData.sDataSource); @@ -860,7 +851,7 @@ SwFieldType* SwDBNameFieldType::Copy() const Beschreibung: Name der angedockten DB --------------------------------------------------------------------*/ -SwDBNameField::SwDBNameField(SwDBNameFieldType* pTyp, const SwDBData& rDBData, ULONG nFmt) +SwDBNameField::SwDBNameField(SwDBNameFieldType* pTyp, const SwDBData& rDBData, sal_uLong nFmt) : SwDBNameInfField(pTyp, rDBData, nFmt) {} @@ -885,12 +876,12 @@ SwField* SwDBNameField::Copy() const return pTmp; } -bool SwDBNameField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwDBNameField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { return SwDBNameInfField::QueryValue(rAny, nWhichId ); } -bool SwDBNameField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwDBNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { return SwDBNameInfField::PutValue(rAny, nWhichId ); } @@ -919,7 +910,7 @@ SwFieldType* SwDBSetNumberFieldType::Copy() const SwDBSetNumberField::SwDBSetNumberField(SwDBSetNumberFieldType* pTyp, const SwDBData& rDBData, - ULONG nFmt) + sal_uLong nFmt) : SwDBNameInfField(pTyp, rDBData, nFmt), nNumber(0) {} @@ -930,7 +921,7 @@ String SwDBSetNumberField::Expand() const if(0 !=(GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE) || nNumber == 0) return aEmptyStr; else - return FormatNumber((USHORT)nNumber, GetFormat()); + return FormatNumber((sal_uInt16)nNumber, GetFormat()); //return(nNumber == 0 ? aEmptyStr : FormatNumber(nNumber, GetFormat())); } @@ -960,7 +951,7 @@ SwField* SwDBSetNumberField::Copy() const return pTmp; } -bool SwDBSetNumberField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwDBSetNumberField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { bool bRet = true; switch( nWhichId ) @@ -977,7 +968,7 @@ bool SwDBSetNumberField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return bRet; } -bool SwDBSetNumberField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwDBSetNumberField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { bool bRet = true; switch( nWhichId ) @@ -986,7 +977,7 @@ bool SwDBSetNumberField::PutValue( const uno::Any& rAny, USHORT nWhichId ) { sal_Int16 nSet = 0; rAny >>= nSet; - if(nSet < (INT16) SVX_NUMBER_NONE ) + if(nSet < (sal_Int16) SVX_NUMBER_NONE ) SetFormat(nSet); else { } diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index 3ab4550218..88e5a83f81 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -56,7 +56,7 @@ class SwIntrnlRefLink : public SwBaseLink { SwDDEFieldType& rFldType; public: - SwIntrnlRefLink( SwDDEFieldType& rType, USHORT nUpdateType, USHORT nFmt ) + SwIntrnlRefLink( SwDDEFieldType& rType, sal_uInt16 nUpdateType, sal_uInt16 nFmt ) : SwBaseLink( nUpdateType, nFmt ), rFldType( rType ) {} @@ -66,7 +66,7 @@ public: const uno::Any & rValue ); virtual const SwNode* GetAnchor() const; - virtual BOOL IsInRange( ULONG nSttNd, ULONG nEndNd, xub_StrLen nStt = 0, + virtual sal_Bool IsInRange( sal_uLong nSttNd, sal_uLong nEndNd, xub_StrLen nStt = 0, xub_StrLen nEnd = STRING_NOTFOUND ) const; }; @@ -93,7 +93,7 @@ void SwIntrnlRefLink::DataChanged( const String& rMimeType, if( n && 0x0d == sStr.GetChar( n-1 ) ) --n; - BOOL bDel = n != sStr.Len(); + sal_Bool bDel = n != sStr.Len(); if( bDel ) sStr.Erase( n ); @@ -119,7 +119,7 @@ void SwIntrnlRefLink::DataChanged( const String& rMimeType, // dann suchen wir uns mal alle Felder. Wird kein gueltiges // gefunden, dann Disconnecten wir uns! SwMsgPoolItem aUpdateDDE( RES_UPDATEDDETBL ); - int bCallModify = FALSE; + int bCallModify = sal_False; rFldType.LockModify(); SwClientIter aIter( rFldType ); @@ -138,7 +138,7 @@ void SwIntrnlRefLink::DataChanged( const String& rMimeType, pSh->StartAction(); } pLast->Modify( 0, &aUpdateDDE ); - bCallModify = TRUE; + bCallModify = sal_True; } } while( 0 != ( pLast = aIter++ )); @@ -206,7 +206,7 @@ const SwNode* SwIntrnlRefLink::GetAnchor() const return pNd; } -BOOL SwIntrnlRefLink::IsInRange( ULONG nSttNd, ULONG nEndNd, +sal_Bool SwIntrnlRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd, xub_StrLen nStt, xub_StrLen nEnd ) const { // hier sollte irgend ein Anchor aus dem normalen Nodes-Array reichen @@ -225,7 +225,7 @@ BOOL SwIntrnlRefLink::IsInRange( ULONG nSttNd, ULONG nEndNd, if( pTblNd->GetNodes().IsDocNodes() && nSttNd < pTblNd->EndOfSectionIndex() && nEndNd > pTblNd->GetIndex() ) - return TRUE; + return sal_True; } else if( ((SwFmtFld*)pLast)->GetTxtFld() ) { @@ -233,24 +233,24 @@ BOOL SwIntrnlRefLink::IsInRange( ULONG nSttNd, ULONG nEndNd, const SwTxtNode* pNd = pTFld->GetpTxtNode(); if( pNd && pNds == &pNd->GetNodes() ) { - ULONG nNdPos = pNd->GetIndex(); + sal_uLong nNdPos = pNd->GetIndex(); if( nSttNd <= nNdPos && nNdPos <= nEndNd && ( nNdPos != nSttNd || *pTFld->GetStart() >= nStt ) && ( nNdPos != nEndNd || *pTFld->GetStart() < nEnd )) - return TRUE; + return sal_True; } } } while( 0 != ( pLast = aIter++ )); - return FALSE; + return sal_False; } SwDDEFieldType::SwDDEFieldType(const String& rName, - const String& rCmd, USHORT nUpdateType ) + const String& rCmd, sal_uInt16 nUpdateType ) : SwFieldType( RES_DDEFLD ), aName( rName ), pDoc( 0 ), nRefCnt( 0 ) { - bCRLFFlag = bDeleted = FALSE; + bCRLFFlag = bDeleted = sal_False; refLink = new SwIntrnlRefLink( *this, nUpdateType, FORMAT_STRING ); SetCmd( rCmd ); } @@ -327,9 +327,9 @@ void SwDDEFieldType::_RefCntChgd() } } -bool SwDDEFieldType::QueryValue( uno::Any& rVal, USHORT nWhichId ) const +bool SwDDEFieldType::QueryValue( uno::Any& rVal, sal_uInt16 nWhichId ) const { - BYTE nPart = 0; + sal_uInt8 nPart = 0; switch( nWhichId ) { case FIELD_PROP_PAR2: nPart = 3; break; @@ -337,7 +337,7 @@ bool SwDDEFieldType::QueryValue( uno::Any& rVal, USHORT nWhichId ) const case FIELD_PROP_SUBTYPE: nPart = 1; break; case FIELD_PROP_BOOL1: { - sal_Bool bSet = GetType() == sfx2::LINKUPDATE_ALWAYS ? TRUE : FALSE; + sal_Bool bSet = GetType() == sfx2::LINKUPDATE_ALWAYS ? sal_True : sal_False; rVal.setValue(&bSet, ::getBooleanCppuType()); } break; @@ -352,16 +352,16 @@ bool SwDDEFieldType::QueryValue( uno::Any& rVal, USHORT nWhichId ) const return true; } -bool SwDDEFieldType::PutValue( const uno::Any& rVal, USHORT nWhichId ) +bool SwDDEFieldType::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId ) { - BYTE nPart = 0; + sal_uInt8 nPart = 0; switch( nWhichId ) { case FIELD_PROP_PAR2: nPart = 3; break; case FIELD_PROP_PAR4: nPart = 2; break; case FIELD_PROP_SUBTYPE: nPart = 1; break; case FIELD_PROP_BOOL1: - SetType( static_cast<USHORT>(*(sal_Bool*)rVal.getValue() ? + SetType( static_cast<sal_uInt16>(*(sal_Bool*)rVal.getValue() ? sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL ) ); break; diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index 047fe46702..00edaf68b4 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -47,13 +47,13 @@ TYPEINIT1( SwDDETable, SwTable ); // Constructor movet alle Lines/Boxen aus der SwTable zu sich. // Die SwTable ist danach Leer und muss geloescht werden. SwDDETable::SwDDETable( SwTable& rTable, SwDDEFieldType* pDDEType, - BOOL bUpdate ) + sal_Bool bUpdate ) : SwTable( rTable ), aDepend( this, pDDEType ) { // Kopiere/move die Daten der Tabelle aSortCntBoxes.Insert( &rTable.GetTabSortBoxes(), 0, rTable.GetTabSortBoxes().Count() ); // move die Inh. Boxen - rTable.GetTabSortBoxes().Remove( (USHORT)0, rTable.GetTabSortBoxes().Count() ); + rTable.GetTabSortBoxes().Remove( (sal_uInt16)0, rTable.GetTabSortBoxes().Count() ); aLines.Insert( &rTable.GetTabLines(),0 ); // move die Lines rTable.GetTabLines().Remove( 0, rTable.GetTabLines().Count() ); @@ -117,11 +117,11 @@ void SwDDETable::ChangeContent() String aExpand = pDDEType->GetExpansion(); aExpand.EraseAllChars( '\r' ); - for( USHORT n = 0; n < aLines.Count(); ++n ) + for( sal_uInt16 n = 0; n < aLines.Count(); ++n ) { String aLine = aExpand.GetToken( n, '\n' ); SwTableLine* pLine = aLines[ n ]; - for( USHORT i = 0; i < pLine->GetTabBoxes().Count(); ++i ) + for( sal_uInt16 i = 0; i < pLine->GetTabBoxes().Count(); ++i ) { SwTableBox* pBox = pLine->GetTabBoxes()[ i ]; OSL_ENSURE( pBox->GetSttIdx(), "keine InhaltsBox" ); @@ -150,7 +150,7 @@ SwDDEFieldType* SwDDETable::GetDDEFldType() return (SwDDEFieldType*)aDepend.GetRegisteredIn(); } -BOOL SwDDETable::NoDDETable() +sal_Bool SwDDETable::NoDDETable() { // suche den TabellenNode OSL_ENSURE( GetFrmFmt(), "Kein FrameFormat" ); @@ -158,11 +158,11 @@ BOOL SwDDETable::NoDDETable() // Stehen wir im richtigen NodesArray (Wegen UNDO) if( !aLines.Count() ) - return FALSE; + return sal_False; OSL_ENSURE( GetTabSortBoxes().Count(), "Tabelle ohne Inhalt?" ); SwNode* pNd = (SwNode*)GetTabSortBoxes()[0]->GetSttNd(); if( !pNd->GetNodes().IsDocNodes() ) - return FALSE; + return sal_False; SwTableNode* pTblNd = pNd->FindTableNode(); OSL_ENSURE( pTblNd, "wo steht denn die Tabelle ?"); @@ -172,7 +172,7 @@ BOOL SwDDETable::NoDDETable() // Kopiere/move die Daten der Tabelle pNewTbl->GetTabSortBoxes().Insert( &GetTabSortBoxes(), 0, GetTabSortBoxes().Count() ); // move die Inh. Boxen - GetTabSortBoxes().Remove( (USHORT)0, GetTabSortBoxes().Count() ); + GetTabSortBoxes().Remove( (sal_uInt16)0, GetTabSortBoxes().Count() ); pNewTbl->GetTabLines().Insert( &GetTabLines(),0 ); // move die Lines GetTabLines().Remove( 0, GetTabLines().Count() ); @@ -182,7 +182,7 @@ BOOL SwDDETable::NoDDETable() pTblNd->SetNewTable( pNewTbl ); // setze die Tabelle - return TRUE; + return sal_True; } diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 998b705394..63d64e9cbf 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -171,9 +171,9 @@ void SwPageNumberFieldType::ChangeExpansion( SwDoc* pDoc, sal_uInt16 nPage, // es NIE zurueck const SfxItemPool &rPool = pDoc->GetAttrPool(); const SwFmtPageDesc *pDesc; - sal_uInt16 nMaxItems = rPool.GetItemCount( RES_PAGEDESC ); - for( sal_uInt16 n = 0; n < nMaxItems; ++n ) - if( 0 != (pDesc = (SwFmtPageDesc*)rPool.GetItem( RES_PAGEDESC, n ) ) + sal_uInt32 nMaxItems = rPool.GetItemCount2( RES_PAGEDESC ); + for( sal_uInt32 n = 0; n < nMaxItems; ++n ) + if( 0 != (pDesc = (SwFmtPageDesc*)rPool.GetItem2( RES_PAGEDESC, n ) ) && pDesc->GetNumOffset() && pDesc->GetDefinedIn() ) { if( pDesc->GetDefinedIn()->ISA( SwCntntNode )) @@ -249,7 +249,7 @@ sal_uInt16 SwPageNumberField::GetSubType() const return nSubType; } -bool SwPageNumberField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwPageNumberField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -280,7 +280,7 @@ bool SwPageNumberField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwPageNumberField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwPageNumberField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { bool bRet = true; sal_Int16 nSet = 0; @@ -333,7 +333,7 @@ SwAuthorFieldType::SwAuthorFieldType() { } -String SwAuthorFieldType::Expand(ULONG nFmt) const +String SwAuthorFieldType::Expand(sal_uLong nFmt) const { String sRet; SvtUserOptions& rOpt = SW_MOD()->GetUserOptions(); @@ -376,7 +376,7 @@ SwField* SwAuthorField::Copy() const return pTmp; } -bool SwAuthorField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwAuthorField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { bool bVal; switch( nWhichId ) @@ -401,7 +401,7 @@ bool SwAuthorField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwAuthorField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwAuthorField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -436,7 +436,7 @@ SwFileNameFieldType::SwFileNameFieldType(SwDoc *pDocument) pDoc = pDocument; } -String SwFileNameFieldType::Expand(ULONG nFmt) const +String SwFileNameFieldType::Expand(sal_uLong nFmt) const { String aRet; const SwDocShell* pDShell = pDoc->GetDocShell(); @@ -517,7 +517,7 @@ SwField* SwFileNameField::Copy() const return pTmp; } -bool SwFileNameField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwFileNameField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -543,7 +543,7 @@ bool SwFileNameField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const case FIELD_PROP_BOOL2: { - BOOL bVal = IsFixed(); + sal_Bool bVal = IsFixed(); rAny.setValue(&bVal, ::getBooleanCppuType()); } break; @@ -557,7 +557,7 @@ bool SwFileNameField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwFileNameField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwFileNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -568,7 +568,7 @@ bool SwFileNameField::PutValue( const uno::Any& rAny, USHORT nWhichId ) // here only a int16 sal_Int32 nType = 0; rAny >>= nType; - BOOL bFixed = IsFixed(); + sal_Bool bFixed = IsFixed(); switch( nType ) { case text::FilenameDisplayFormat::PATH: @@ -614,7 +614,7 @@ SwTemplNameFieldType::SwTemplNameFieldType(SwDoc *pDocument) pDoc = pDocument; } -String SwTemplNameFieldType::Expand(ULONG nFmt) const +String SwTemplNameFieldType::Expand(sal_uLong nFmt) const { OSL_ENSURE( nFmt < FF_END, "Expand: kein guelt. Fmt!" ); @@ -688,7 +688,7 @@ SwField* SwTemplNameField::Copy() const return pTmp; } -bool SwTemplNameField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwTemplNameField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch ( nWhichId ) { @@ -714,7 +714,7 @@ bool SwTemplNameField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwTemplNameField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwTemplNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch ( nWhichId ) { @@ -838,7 +838,7 @@ void SwDocStatField::ChangeExpansion( const SwFrm* pFrm ) pFrm->FindPageFrm()->GetPageDesc()->GetNumType().GetNumberingType() ); } -bool SwDocStatField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwDocStatField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch ( nWhichId ) { @@ -851,7 +851,7 @@ bool SwDocStatField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwDocStatField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwDocStatField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { bool bRet = false; switch ( nWhichId ) @@ -892,7 +892,7 @@ SwFieldType* SwDocInfoFieldType::Copy() const return pTyp; } -void lcl_GetLocalDataWrapper( ULONG nLang, +void lcl_GetLocalDataWrapper( sal_uLong nLang, const LocaleDataWrapper **ppAppLocalData, const LocaleDataWrapper **ppLocalData ) { @@ -1161,30 +1161,30 @@ String SwDocInfoField::Expand() const return aContent; } -String SwDocInfoField::GetCntnt(sal_Bool bName) const +String SwDocInfoField::GetFieldName() const { - if ( bName ) - { - String aStr(SwFieldType::GetTypeStr(GetTypeId())); - aStr += ':'; + String aStr(SwFieldType::GetTypeStr(GetTypeId())); + aStr += ':'; - sal_uInt16 nSub = nSubType & 0xff; + sal_uInt16 const nSub = nSubType & 0xff; - switch(nSub) - { - case DI_CUSTOM: - aStr += aName; - break; + switch (nSub) + { + case DI_CUSTOM: + aStr += aName; + break; - default: - aStr += *ViewShell::GetShellRes()->aDocInfoLst[ nSub - DI_SUBTYPE_BEGIN ]; - break; - } - if( IsFixed() ) - ( aStr += ' ' ) += ViewShell::GetShellRes()->aFixedStr; - return aStr; + default: + aStr += *ViewShell::GetShellRes() + ->aDocInfoLst[ nSub - DI_SUBTYPE_BEGIN ]; + break; } - return Expand(); + if (IsFixed()) + { + aStr += ' '; + aStr += ViewShell::GetShellRes()->aFixedStr; + } + return aStr; } SwField* SwDocInfoField::Copy() const @@ -1214,7 +1214,7 @@ void SwDocInfoField::SetLanguage(sal_uInt16 nLng) SwValueField::SetLanguage(nLng); } -bool SwDocInfoField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwDocInfoField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -1262,7 +1262,7 @@ bool SwDocInfoField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwDocInfoField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwDocInfoField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { sal_Int32 nValue = 0; switch( nWhichId ) @@ -1458,25 +1458,20 @@ void SwHiddenTxtField::Evaluate(SwDoc* pDoc) } } -String SwHiddenTxtField::GetCntnt(sal_Bool bName) const +String SwHiddenTxtField::GetFieldName() const { - if ( bName ) - { - String aStr(SwFieldType::GetTypeStr(nSubType)); - aStr += ' '; - aStr += aCond; - aStr += ' '; - aStr += aTRUETxt; + String aStr(SwFieldType::GetTypeStr(nSubType)); + aStr += ' '; + aStr += aCond; + aStr += ' '; + aStr += aTRUETxt; - if(nSubType == TYP_CONDTXTFLD) - { -static char const cTmp[] = " : "; - aStr.AppendAscii(cTmp); - aStr += aFALSETxt; - } - return aStr; + if (nSubType == TYP_CONDTXTFLD) + { + aStr.AppendAscii(" : "); + aStr += aFALSETxt; } - return Expand(); + return aStr; } SwField* SwHiddenTxtField::Copy() const @@ -1542,7 +1537,7 @@ sal_uInt16 SwHiddenTxtField::GetSubType() const return nSubType; } -bool SwHiddenTxtField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwHiddenTxtField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { const String* pOut = 0; switch( nWhichId ) @@ -1573,7 +1568,7 @@ bool SwHiddenTxtField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwHiddenTxtField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwHiddenTxtField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -1594,7 +1589,7 @@ bool SwHiddenTxtField::PutValue( const uno::Any& rAny, USHORT nWhichId ) break; case FIELD_PROP_PAR4: ::GetString( rAny, aContent); - bValid = TRUE; + bValid = sal_True; break; default: OSL_FAIL("illegal property"); @@ -1674,7 +1669,7 @@ SwField* SwHiddenParaField::Copy() const return pFld; } -bool SwHiddenParaField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwHiddenParaField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch ( nWhichId ) { @@ -1694,7 +1689,7 @@ bool SwHiddenParaField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwHiddenParaField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwHiddenParaField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch ( nWhichId ) { @@ -1824,7 +1819,7 @@ sal_uInt32 SwPostItField::GetNumberOfParagraphs() const return (mpText) ? mpText->Count() : 1; } -bool SwPostItField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -1884,7 +1879,7 @@ bool SwPostItField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwPostItField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -1914,7 +1909,7 @@ bool SwPostItField::PutValue( const uno::Any& rAny, USHORT nWhichId ) { util::DateTime aDateTimeValue; if(!(rAny >>= aDateTimeValue)) - return FALSE; + return sal_False; aDateTime.Set100Sec(aDateTimeValue.HundredthSeconds); aDateTime.SetSec(aDateTimeValue.Seconds); aDateTime.SetMin(aDateTimeValue.Minutes); @@ -2010,7 +2005,7 @@ void SwExtUserField::SetSubType(sal_uInt16 nSub) nType = nSub; } -bool SwExtUserField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwExtUserField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -2036,7 +2031,7 @@ bool SwExtUserField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwExtUserField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwExtUserField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -2113,7 +2108,7 @@ void SwRefPageSetField::SetPar2(const String& rStr) SetOffset( (short) rStr.ToInt32() ); } -bool SwRefPageSetField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwRefPageSetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -2129,7 +2124,7 @@ bool SwRefPageSetField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwRefPageSetField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwRefPageSetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -2366,7 +2361,7 @@ void SwRefPageGetField::ChangeExpansion( const SwFrm* pFrm, } } -bool SwRefPageGetField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwRefPageGetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -2382,7 +2377,7 @@ bool SwRefPageGetField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwRefPageGetField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwRefPageGetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -2477,7 +2472,7 @@ void SwJumpEditField::SetPar2(const String& rStr) sHelp = rStr; } -bool SwJumpEditField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwJumpEditField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -2508,7 +2503,7 @@ bool SwJumpEditField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwJumpEditField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwJumpEditField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -2587,7 +2582,7 @@ void SwCombinedCharField::SetPar1(const String& rStr) } bool SwCombinedCharField::QueryValue( uno::Any& rAny, - USHORT nWhichId ) const + sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -2601,7 +2596,7 @@ bool SwCombinedCharField::QueryValue( uno::Any& rAny, } bool SwCombinedCharField::PutValue( const uno::Any& rAny, - USHORT nWhichId ) + sal_uInt16 nWhichId ) { switch( nWhichId ) { diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 4fee604a78..c69c049e6d 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -72,15 +72,23 @@ using ::rtl::OUString; SV_IMPL_PTRARR( _SwSeqFldList, _SeqFldLstElem* ) //----------------------------------------------------------------------------- -sal_Int16 lcl_SubTypeToAPI(USHORT nSubType) +sal_Int16 lcl_SubTypeToAPI(sal_uInt16 nSubType) { sal_Int16 nRet = 0; switch(nSubType) { - case nsSwGetSetExpType::GSE_EXPR : nRet = SetVariableType::VAR /*0*/; break; - case nsSwGetSetExpType::GSE_SEQ : nRet = SetVariableType::SEQUENCE /*1*/; break; - case nsSwGetSetExpType::GSE_FORMULA : nRet = SetVariableType::FORMULA /*2*/; break; - case nsSwGetSetExpType::GSE_STRING : nRet = SetVariableType::STRING /*3*/; break; + case nsSwGetSetExpType::GSE_EXPR: + nRet = SetVariableType::VAR; // 0 + break; + case nsSwGetSetExpType::GSE_SEQ: + nRet = SetVariableType::SEQUENCE; // 1 + break; + case nsSwGetSetExpType::GSE_FORMULA: + nRet = SetVariableType::FORMULA; // 2 + break; + case nsSwGetSetExpType::GSE_STRING: + nRet = SetVariableType::STRING; // 3 + break; } return nRet; } @@ -105,7 +113,7 @@ sal_Int32 lcl_APIToSubType(const uno::Any& rAny) //----------------------------------------------------------------------------- -void ReplacePoint( String& rTmpName, BOOL bWithCommandType ) +void ReplacePoint( String& rTmpName, sal_Bool bWithCommandType ) { // replace first and last (if bWithCommandType: last two) dot Ersten und letzten Punkt ersetzen, da in Tabellennamen Punkte erlaubt sind // since table names may contain dots @@ -249,7 +257,7 @@ const SwTxtNode* GetBodyTxtNode( const SwDoc& rDoc, SwPosition& rPos, { Point aPt( pLayout->Frm().Pos() ); aPt.Y()++; // aus dem Header raus - pCntFrm = pPgFrm->GetCntntPos( aPt, FALSE, TRUE, FALSE ); + pCntFrm = pPgFrm->GetCntntPos( aPt, sal_False, sal_True, sal_False ); pTxtNode = GetFirstTxtNode( rDoc, rPos, pCntFrm, aPt ); } } @@ -289,9 +297,9 @@ void SwGetExpFieldType::Modify( SfxPoolItem*, SfxPoolItem* pNew ) --------------------------------------------------------------------*/ SwGetExpField::SwGetExpField(SwGetExpFieldType* pTyp, const String& rFormel, - USHORT nSub, ULONG nFmt) + sal_uInt16 nSub, sal_uLong nFmt) : SwFormulaField( pTyp, nFmt, 0.0 ), - bIsInBodyTxt( TRUE ), + bIsInBodyTxt( sal_True ), nSubType(nSub), bLateInitialization( false ) { @@ -306,18 +314,15 @@ String SwGetExpField::Expand() const return sExpand; } -String SwGetExpField::GetCntnt(BOOL bName) const +String SwGetExpField::GetFieldName() const { - if ( bName ) - { - String aStr( SwFieldType::GetTypeStr( static_cast<USHORT>(nsSwGetSetExpType::GSE_FORMULA & nSubType - ? TYP_FORMELFLD - : TYP_GETFLD ) )); - aStr += ' '; - aStr += GetFormula(); - return aStr; - } - return Expand(); + String aStr( SwFieldType::GetTypeStr( + static_cast<sal_uInt16>(((nsSwGetSetExpType::GSE_FORMULA & nSubType) != 0) + ? TYP_FORMELFLD + : TYP_GETFLD ) )); + aStr += ' '; + aStr += GetFormula(); + return aStr; } SwField* SwGetExpField::Copy() const @@ -373,7 +378,7 @@ void SwGetExpField::ChangeExpansion( const SwFrm& rFrm, const SwTxtFld& rFld ) if(GetSubType() & nsSwGetSetExpType::GSE_STRING) { SwHash** ppHashTbl; - USHORT nSize; + sal_uInt16 nSize; rDoc.FldsToExpand( ppHashTbl, nSize, aEndFld ); LookString( ppHashTbl, nSize, GetFormula(), sExpand ); ::DeleteHashTable( ppHashTbl, nSize ); // HashTabelle loeschen @@ -403,17 +408,17 @@ void SwGetExpField::SetPar2(const String& rStr) SetFormula(rStr); } -USHORT SwGetExpField::GetSubType() const +sal_uInt16 SwGetExpField::GetSubType() const { return nSubType; } -void SwGetExpField::SetSubType(USHORT nType) +void SwGetExpField::SetSubType(sal_uInt16 nType) { nSubType = nType; } -void SwGetExpField::SetLanguage(USHORT nLng) +void SwGetExpField::SetLanguage(sal_uInt16 nLng) { if (nSubType & nsSwExtendedSubType::SUB_CMD) SwField::SetLanguage(nLng); @@ -421,7 +426,7 @@ void SwGetExpField::SetLanguage(USHORT nLng) SwValueField::SetLanguage(nLng); } -bool SwGetExpField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwGetExpField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -445,7 +450,7 @@ bool SwGetExpField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const break; case FIELD_PROP_BOOL2: { - BOOL bTmp = 0 != (nSubType & nsSwExtendedSubType::SUB_CMD); + sal_Bool bTmp = 0 != (nSubType & nsSwExtendedSubType::SUB_CMD); rAny.setValue(&bTmp, ::getBooleanCppuType()); } break; @@ -458,7 +463,7 @@ bool SwGetExpField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwGetExpField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwGetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { sal_Int32 nTmp = 0; String sTmp; @@ -473,7 +478,7 @@ bool SwGetExpField::PutValue( const uno::Any& rAny, USHORT nWhichId ) break; case FIELD_PROP_USHORT1: rAny >>= nTmp; - nSubType = static_cast<USHORT>(nTmp); + nSubType = static_cast<sal_uInt16>(nTmp); break; case FIELD_PROP_PAR1: SetFormula( ::GetString( rAny, sTmp )); @@ -481,7 +486,7 @@ bool SwGetExpField::PutValue( const uno::Any& rAny, USHORT nWhichId ) case FIELD_PROP_SUBTYPE: nTmp = lcl_APIToSubType(rAny); if( nTmp >=0 ) - SetSubType( static_cast<USHORT>((GetSubType() & 0xff00) | nTmp)); + SetSubType( static_cast<sal_uInt16>((GetSubType() & 0xff00) | nTmp)); break; case FIELD_PROP_BOOL2: if(*(sal_Bool*) rAny.getValue()) @@ -502,16 +507,16 @@ bool SwGetExpField::PutValue( const uno::Any& rAny, USHORT nWhichId ) Set-Expression-Type --------------------------------------------------*/ -SwSetExpFieldType::SwSetExpFieldType( SwDoc* pDc, const String& rName, USHORT nTyp ) +SwSetExpFieldType::SwSetExpFieldType( SwDoc* pDc, const String& rName, sal_uInt16 nTyp ) : SwValueFieldType( pDc, RES_SETEXPFLD ), sName( rName ), pOutlChgNd( 0 ), sDelim( String::CreateFromAscii( "." ) ), nType(nTyp), nLevel( UCHAR_MAX ), - bDeleted( FALSE ) + bDeleted( sal_False ) { if( ( nsSwGetSetExpType::GSE_SEQ | nsSwGetSetExpType::GSE_STRING ) & nType ) - EnableFormat(FALSE); // Numberformatter nicht einsetzen + EnableFormat(sal_False); // Numberformatter nicht einsetzen } SwFieldType* SwSetExpFieldType::Copy() const @@ -534,7 +539,7 @@ void SwSetExpFieldType::Modify( SfxPoolItem*, SfxPoolItem* ) return; // nicht weiter expandieren } -void SwSetExpFieldType::SetSeqFormat(ULONG nFmt) +void SwSetExpFieldType::SetSeqFormat(sal_uLong nFmt) { SwClientIter aIter(*this); for( SwFmtFld* pFld = (SwFmtFld*)aIter.First( TYPE(SwFmtFld) ); @@ -542,7 +547,7 @@ void SwSetExpFieldType::SetSeqFormat(ULONG nFmt) pFld->GetFld()->ChangeFormat( nFmt ); } -ULONG SwSetExpFieldType::GetSeqFormat() +sal_uLong SwSetExpFieldType::GetSeqFormat() { if( !GetDepends() ) return SVX_NUM_ARABIC; @@ -551,15 +556,15 @@ ULONG SwSetExpFieldType::GetSeqFormat() return pFld->GetFormat(); } -USHORT SwSetExpFieldType::SetSeqRefNo( SwSetExpField& rFld ) +sal_uInt16 SwSetExpFieldType::SetSeqRefNo( SwSetExpField& rFld ) { if( !GetDepends() || !(nsSwGetSetExpType::GSE_SEQ & nType) ) return USHRT_MAX; -extern void InsertSort( SvUShorts& rArr, USHORT nIdx, USHORT* pInsPos = 0 ); +extern void InsertSort( SvUShorts& rArr, sal_uInt16 nIdx, sal_uInt16* pInsPos = 0 ); SvUShorts aArr( 64 ); - USHORT n; + sal_uInt16 n; // dann testmal, ob die Nummer schon vergeben ist oder ob eine neue // bestimmt werden muss. @@ -574,7 +579,7 @@ extern void InsertSort( SvUShorts& rArr, USHORT nIdx, USHORT* pInsPos = 0 ); // teste erstmal ob die Nummer schon vorhanden ist: - USHORT nNum = rFld.GetSeqNumber(); + sal_uInt16 nNum = rFld.GetSeqNumber(); if( USHRT_MAX != nNum ) { for( n = 0; n < aArr.Count(); ++n ) @@ -596,7 +601,7 @@ extern void InsertSort( SvUShorts& rArr, USHORT nIdx, USHORT* pInsPos = 0 ); return n; } -USHORT SwSetExpFieldType::GetSeqFldList( SwSeqFldList& rList ) +sal_uInt16 SwSetExpFieldType::GetSeqFldList( SwSeqFldList& rList ) { if( rList.Count() ) rList.Remove( 0, rList.Count() ); @@ -634,7 +639,7 @@ void SwSetExpFieldType::SetChapter( SwSetExpField& rFld, const SwNode& rNd ) const SwNodeNum & aNum = *(pTxtNd->GetNum()); // nur die Nummer besorgen, ohne Pre-/Post-fixstrings - String sNumber( pRule->MakeNumString(aNum, FALSE )); + String sNumber( pRule->MakeNumString(aNum, sal_False )); if( sNumber.Len() ) rFld.ChgExpStr( ( sNumber += sDelim ) += rFld.GetExpStr() ); @@ -647,7 +652,7 @@ void SwSetExpFieldType::SetChapter( SwSetExpField& rFld, const SwNode& rNd ) } } -bool SwSetExpFieldType::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwSetExpFieldType::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -672,7 +677,7 @@ bool SwSetExpFieldType::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwSetExpFieldType::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwSetExpFieldType::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -680,7 +685,7 @@ bool SwSetExpFieldType::PutValue( const uno::Any& rAny, USHORT nWhichId ) { sal_Int32 nSet = lcl_APIToSubType(rAny); if(nSet >=0) - SetType(static_cast<USHORT>(nSet)); + SetType(static_cast<sal_uInt16>(nSet)); } break; case FIELD_PROP_PAR2: @@ -709,7 +714,7 @@ bool SwSetExpFieldType::PutValue( const uno::Any& rAny, USHORT nWhichId ) return true; } -BOOL SwSeqFldList::InsertSort( _SeqFldLstElem* pNew ) +sal_Bool SwSeqFldList::InsertSort( _SeqFldLstElem* pNew ) { sal_Unicode* p = pNew->sDlgEntry.GetBufferAccess(); while( *p ) @@ -719,16 +724,16 @@ BOOL SwSeqFldList::InsertSort( _SeqFldLstElem* pNew ) ++p; } - USHORT nPos; - BOOL bRet = SeekEntry( *pNew, &nPos ); + sal_uInt16 nPos; + sal_Bool bRet = SeekEntry( *pNew, &nPos ); if( !bRet ) C40_INSERT( _SeqFldLstElem, pNew, nPos ); return bRet; } -BOOL SwSeqFldList::SeekEntry( const _SeqFldLstElem& rNew, USHORT* pP ) +sal_Bool SwSeqFldList::SeekEntry( const _SeqFldLstElem& rNew, sal_uInt16* pP ) { - USHORT nO = Count(), nM, nU = 0; + sal_uInt16 nO = Count(), nM, nU = 0; if( nO > 0 ) { CollatorWrapper & rCaseColl = ::GetAppCaseCollator(), @@ -740,7 +745,7 @@ BOOL SwSeqFldList::SeekEntry( const _SeqFldLstElem& rNew, USHORT* pP ) const String& rTmp2 = rNew.sDlgEntry; xub_StrLen nFndPos2 = 0; String sNum2( rTmp2.GetToken( 0, ' ', nFndPos2 )); - BOOL bIsNum2IsNumeric = rCC.isAsciiNumeric( sNum2 ); + sal_Bool bIsNum2IsNumeric = rCC.isAsciiNumeric( sNum2 ); sal_Int32 nNum2 = bIsNum2IsNumeric ? sNum2.ToInt32() : 0; nO--; @@ -769,7 +774,7 @@ BOOL SwSeqFldList::SeekEntry( const _SeqFldLstElem& rNew, USHORT* pP ) if( 0 == nCmp ) { if( pP ) *pP = nM; - return TRUE; + return sal_True; } else if( 0 < nCmp ) nU = nM + 1; @@ -780,7 +785,7 @@ BOOL SwSeqFldList::SeekEntry( const _SeqFldLstElem& rNew, USHORT* pP ) } } if( pP ) *pP = nU; - return FALSE; + return sal_False; } /*-------------------------------------------------------------------- @@ -788,13 +793,13 @@ BOOL SwSeqFldList::SeekEntry( const _SeqFldLstElem& rNew, USHORT* pP ) --------------------------------------------------------------------*/ SwSetExpField::SwSetExpField(SwSetExpFieldType* pTyp, const String& rFormel, - ULONG nFmt) + sal_uLong nFmt) : SwFormulaField( pTyp, nFmt, 0.0 ), nSeqNo( USHRT_MAX ), nSubType(0) { SetFormula(rFormel); // SubType ignorieren !!! - bInput = FALSE; + bInput = sal_False; if( IsSequenceFld() ) { SwValueField::SetValue(1.0); @@ -826,35 +831,28 @@ String SwSetExpField::Expand() const } /*-------------------------------------------------------------------- - Beschreibung: liefert den Namen oder den Inhalt + @return the field name --------------------------------------------------------------------*/ -String SwSetExpField::GetCntnt(BOOL bName) const +String SwSetExpField::GetFieldName() const { - if( bName ) - { - USHORT nStrType; - - if( IsSequenceFld() ) - nStrType = TYP_SEQFLD; - else if( bInput ) - nStrType = TYP_SETINPFLD; - else - nStrType = TYP_SETFLD; + SwFldTypesEnum const nStrType( (IsSequenceFld()) + ? TYP_SEQFLD + : (bInput) + ? TYP_SETINPFLD + : TYP_SETFLD ); - String aStr( SwFieldType::GetTypeStr( nStrType ) ); - aStr += ' '; - aStr += GetTyp()->GetName(); + String aStr( SwFieldType::GetTypeStr( static_cast<sal_uInt16>(nStrType) ) ); + aStr += ' '; + aStr += GetTyp()->GetName(); - if( TYP_SEQFLD != nStrType ) - { - // Sequence nicht die Formel ausgeben - aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " = " )); - aStr += GetFormula(); - } - return aStr; + // Sequence: without formula + if (TYP_SEQFLD != nStrType) + { + aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " = " ) ); + aStr += GetFormula(); } - return Expand(); + return aStr; } SwField* SwSetExpField::Copy() const @@ -873,7 +871,7 @@ SwField* SwSetExpField::Copy() const return pTmp; } -void SwSetExpField::SetSubType(USHORT nSub) +void SwSetExpField::SetSubType(sal_uInt16 nSub) { ((SwSetExpFieldType*)GetTyp())->SetType(nSub & 0xff); nSubType = nSub & 0xff00; @@ -881,7 +879,7 @@ void SwSetExpField::SetSubType(USHORT nSub) DBG_ASSERT( (nSub & 0xff) != 3, "SubType ist illegal!" ); } -USHORT SwSetExpField::GetSubType() const +sal_uInt16 SwSetExpField::GetSubType() const { return ((SwSetExpFieldType*)GetTyp())->GetType() | nSubType; } @@ -891,7 +889,7 @@ void SwSetExpField::SetValue( const double& rAny ) SwValueField::SetValue(rAny); if( IsSequenceFld() ) - sExpand = FormatNumber( (USHORT)GetValue(), GetFormat() ); + sExpand = FormatNumber( (sal_uInt16)GetValue(), GetFormat() ); else sExpand = ((SwValueFieldType*)GetTyp())->ExpandValue( rAny, GetFormat(), GetLanguage()); @@ -919,9 +917,9 @@ xub_StrLen SwGetExpField::GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc if(sNodeText.Len()) { //now check if sNodeText starts with a non-alphanumeric character plus a blank - USHORT nSrcpt = pBreakIt->GetRealScriptOfText( sNodeText, 0 ); + sal_uInt16 nSrcpt = pBreakIt->GetRealScriptOfText( sNodeText, 0 ); - static USHORT nIds[] = + static sal_uInt16 nIds[] = { RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, RES_CHRATR_FONT, RES_CHRATR_FONT, @@ -941,7 +939,7 @@ xub_StrLen SwGetExpField::GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc GetWhichOfScript( RES_CHRATR_LANGUAGE, nSrcpt )) ).GetLanguage(); CharClass aCC( SvxCreateLocale( eLang )); sal_Unicode c0 = sNodeText.GetChar(0); - BOOL bIsAlphaNum = aCC.isAlphaNumeric( sNodeText, 0 ); + sal_Bool bIsAlphaNum = aCC.isAlphaNumeric( sNodeText, 0 ); if( !bIsAlphaNum || (c0 == ' ' || c0 == '\t')) { @@ -968,7 +966,7 @@ const String& SwSetExpField::GetPar1() const String SwSetExpField::GetPar2() const { - USHORT nType = ((SwSetExpFieldType*)GetTyp())->GetType(); + sal_uInt16 nType = ((SwSetExpFieldType*)GetTyp())->GetType(); if (nType & nsSwGetSetExpType::GSE_STRING) return GetFormula(); @@ -977,7 +975,7 @@ String SwSetExpField::GetPar2() const void SwSetExpField::SetPar2(const String& rStr) { - USHORT nType = ((SwSetExpFieldType*)GetTyp())->GetType(); + sal_uInt16 nType = ((SwSetExpFieldType*)GetTyp())->GetType(); if( !(nType & nsSwGetSetExpType::GSE_SEQ) || rStr.Len() ) { @@ -1008,25 +1006,21 @@ SwFieldType* SwInputFieldType::Copy() const --------------------------------------------------------------------*/ SwInputField::SwInputField(SwInputFieldType* pTyp, const String& rContent, - const String& rPrompt, USHORT nSub, ULONG nFmt) : + const String& rPrompt, sal_uInt16 nSub, sal_uLong nFmt) : SwField(pTyp, nFmt), aContent(rContent), aPText(rPrompt), nSubType(nSub) { } -String SwInputField::GetCntnt(BOOL bName) const +String SwInputField::GetFieldName() const { - if ( bName ) + String aStr(SwField::GetFieldName()); + if ((nSubType & 0x00ff) == INP_USR) { - String aStr(SwField::GetCntnt(bName)); - if ((nSubType & 0x00ff) == INP_USR) - { - aStr += GetTyp()->GetName(); - aStr += ' '; - aStr += aContent; - } - return aStr; + aStr += GetTyp()->GetName(); + aStr += ' '; + aStr += aContent; } - return Expand(); + return aStr; } SwField* SwInputField::Copy() const @@ -1058,7 +1052,7 @@ String SwInputField::Expand() const return sRet; } -bool SwInputField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwInputField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -1080,7 +1074,7 @@ bool SwInputField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwInputField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwInputField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -1149,22 +1143,22 @@ String SwInputField::GetToolTip() const return aToolTip; } -BOOL SwInputField::isFormField() const +sal_Bool SwInputField::isFormField() const { return aHelp.Len() > 0 || aToolTip.Len() > 0; } -USHORT SwInputField::GetSubType() const +sal_uInt16 SwInputField::GetSubType() const { return nSubType; } -void SwInputField::SetSubType(USHORT nSub) +void SwInputField::SetSubType(sal_uInt16 nSub) { nSubType = nSub; } -bool SwSetExpField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwSetExpField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -1191,7 +1185,7 @@ bool SwSetExpField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const //I18N - if the formula contains only "TypeName+1" //and it's one of the initially created sequence fields //then the localized names has to be replaced by a programmatic name - OUString sMyFormula = SwXFieldMaster::LocalizeFormula(*this, GetFormula(), TRUE); + OUString sMyFormula = SwXFieldMaster::LocalizeFormula(*this, GetFormula(), sal_True); rAny <<= OUString( sMyFormula ); } break; @@ -1210,13 +1204,13 @@ bool SwSetExpField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const break; case FIELD_PROP_BOOL3: { - BOOL bTmp = 0 != (nSubType & nsSwExtendedSubType::SUB_CMD); + sal_Bool bTmp = 0 != (nSubType & nsSwExtendedSubType::SUB_CMD); rAny.setValue(&bTmp, ::getBooleanCppuType()); } break; case FIELD_PROP_BOOL1: { - BOOL bTmp = GetInputFlag(); + sal_Bool bTmp = GetInputFlag(); rAny.setValue(&bTmp, ::getBooleanCppuType()); } break; @@ -1229,7 +1223,7 @@ bool SwSetExpField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwSetExpField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwSetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { sal_Int32 nTmp32 = 0; sal_Int16 nTmp16 = 0; @@ -1270,7 +1264,7 @@ bool SwSetExpField::PutValue( const uno::Any& rAny, USHORT nWhichId ) //I18N - if the formula contains only "TypeName+1" //and it's one of the initially created sequence fields //then the localized names has to be replaced by a programmatic name - OUString sMyFormula = SwXFieldMaster::LocalizeFormula(*this, uTmp, FALSE); + OUString sMyFormula = SwXFieldMaster::LocalizeFormula(*this, uTmp, sal_False); SetFormula( sMyFormula ); } break; @@ -1284,7 +1278,7 @@ bool SwSetExpField::PutValue( const uno::Any& rAny, USHORT nWhichId ) case FIELD_PROP_SUBTYPE: nTmp32 = lcl_APIToSubType(rAny); if(nTmp32 >= 0) - SetSubType(static_cast<USHORT>((GetSubType() & 0xff00) | nTmp32)); + SetSubType(static_cast<sal_uInt16>((GetSubType() & 0xff00) | nTmp32)); break; case FIELD_PROP_PAR3: ::GetString( rAny, aPText ); diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index f2af5d421f..db7170e276 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -53,14 +53,11 @@ #include <comcore.hrc> #include <math.h> -#ifdef MAC -#include <stdlib.h> -#endif using namespace ::com::sun::star; using namespace nsSwDocInfoSubType; -USHORT lcl_GetLanguageOfFormat( USHORT nLng, ULONG nFmt, +sal_uInt16 lcl_GetLanguageOfFormat( sal_uInt16 nLng, sal_uLong nFmt, const SvNumberFormatter& rFormatter ) { if( nLng == LANGUAGE_NONE ) // wegen Bug #60010 @@ -88,7 +85,7 @@ SvStringsDtor* SwFieldType::pFldNames = 0; DBG_NAME(SwFieldType) - USHORT aTypeTab[] = { + sal_uInt16 aTypeTab[] = { /* RES_DBFLD */ TYP_DBFLD, /* RES_USERFLD */ TYP_USERFLD, /* RES_FILENAMEFLD */ TYP_FILENAMEFLD, @@ -134,7 +131,7 @@ DBG_NAME(SwFieldType) -const String& SwFieldType::GetTypeStr(USHORT nTypeId) +const String& SwFieldType::GetTypeStr(sal_uInt16 nTypeId) { if( !pFldNames ) _GetFldName(); @@ -151,7 +148,7 @@ const String& SwFieldType::GetTypeStr(USHORT nTypeId) jedes Dokument einmalig ist. --------------------------------------------------*/ -SwFieldType::SwFieldType( USHORT nWhichId ) +SwFieldType::SwFieldType( sal_uInt16 nWhichId ) : SwModify(0), nWhich( nWhichId ) { @@ -172,11 +169,11 @@ const String& SwFieldType::GetName() const return aEmptyStr; } -bool SwFieldType::QueryValue( uno::Any&, USHORT ) const +bool SwFieldType::QueryValue( uno::Any&, sal_uInt16 ) const { return false; } -bool SwFieldType::PutValue( const uno::Any& , USHORT ) +bool SwFieldType::PutValue( const uno::Any& , sal_uInt16 ) { return false; } @@ -187,9 +184,9 @@ bool SwFieldType::PutValue( const uno::Any& , USHORT ) Felder sind n-mal vorhanden, Feldtypen nur einmal --------------------------------------------------------------------*/ -SwField::SwField(SwFieldType* pTyp, sal_uInt32 nFmt, USHORT nLng) : +SwField::SwField(SwFieldType* pTyp, sal_uInt32 nFmt, sal_uInt16 nLng) : nLang(nLng), - bIsAutomaticLanguage(TRUE), + bIsAutomaticLanguage(sal_True), nFormat(nFmt) { OSL_ENSURE( pTyp, "SwField: ungueltiger SwFieldType" ); @@ -205,27 +202,27 @@ SwField::~SwField() --------------------------------------------------------------------*/ #if OSL_DEBUG_LEVEL > 1 -USHORT SwField::Which() const +sal_uInt16 SwField::Which() const { OSL_ENSURE(pType, "Kein Typ vorhanden"); return pType->Which(); } #endif -USHORT SwField::GetTypeId() const +sal_uInt16 SwField::GetTypeId() const { - USHORT nRet; + sal_uInt16 nRet; switch( pType->Which() ) { case RES_DATETIMEFLD: if (GetSubType() & FIXEDFLD) - nRet = static_cast<USHORT>(GetSubType() & DATEFLD ? TYP_FIXDATEFLD : TYP_FIXTIMEFLD); + nRet = static_cast<sal_uInt16>(GetSubType() & DATEFLD ? TYP_FIXDATEFLD : TYP_FIXTIMEFLD); else - nRet = static_cast<USHORT>(GetSubType() & DATEFLD ? TYP_DATEFLD : TYP_TIMEFLD); + nRet = static_cast<sal_uInt16>(GetSubType() & DATEFLD ? TYP_DATEFLD : TYP_TIMEFLD); break; case RES_GETEXPFLD: - nRet = static_cast<USHORT>(nsSwGetSetExpType::GSE_FORMULA & GetSubType() ? TYP_FORMELFLD : TYP_GETFLD); + nRet = static_cast<sal_uInt16>(nsSwGetSetExpType::GSE_FORMULA & GetSubType() ? TYP_FORMELFLD : TYP_GETFLD); break; case RES_HIDDENTXTFLD: @@ -262,21 +259,20 @@ USHORT SwField::GetTypeId() const Beschreibung: liefert den Namen oder den Inhalt --------------------------------------------------------------------*/ -String SwField::GetCntnt( BOOL bName ) const +String SwField::GetFieldName() const { - String sRet; - if( bName ) + sal_uInt16 nTypeId = GetTypeId(); + if (RES_DATETIMEFLD == GetTyp()->Which()) { - USHORT nTypeId = GetTypeId(); - if( RES_DATETIMEFLD == GetTyp()->Which() ) - nTypeId = static_cast<USHORT>(GetSubType() & DATEFLD ? TYP_DATEFLD : TYP_TIMEFLD); - - sRet = SwFieldType::GetTypeStr( nTypeId ); - if( IsFixed() ) - ( sRet += ' ' ) += ViewShell::GetShellRes()->aFixedStr; + nTypeId = static_cast<sal_uInt16>( + ((GetSubType() & DATEFLD) != 0) ? TYP_DATEFLD : TYP_TIMEFLD); + } + String sRet = SwFieldType::GetTypeStr( nTypeId ); + if (IsFixed()) + { + sRet += ' '; + sRet += ViewShell::GetShellRes()->aFixedStr; } - else - sRet = Expand(); return sRet; } @@ -305,22 +301,22 @@ void SwField::SetPar1(const String& ) void SwField::SetPar2(const String& ) {} -USHORT SwField::GetSubType() const +sal_uInt16 SwField::GetSubType() const { return 0; } -void SwField::SetSubType(USHORT ) +void SwField::SetSubType(sal_uInt16 ) { } -bool SwField::QueryValue( uno::Any& rVal, USHORT nWhichId ) const +bool SwField::QueryValue( uno::Any& rVal, sal_uInt16 nWhichId ) const { switch( nWhichId ) { case FIELD_PROP_BOOL4: { - BOOL bFixed = !bIsAutomaticLanguage; + sal_Bool bFixed = !bIsAutomaticLanguage; rVal.setValue(&bFixed, ::getCppuBooleanType()); } break; @@ -329,13 +325,13 @@ bool SwField::QueryValue( uno::Any& rVal, USHORT nWhichId ) const } return true; } -bool SwField::PutValue( const uno::Any& rVal, USHORT nWhichId ) +bool SwField::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId ) { switch( nWhichId ) { case FIELD_PROP_BOOL4: { - BOOL bFixed = FALSE; + sal_Bool bFixed = sal_False; if(rVal >>= bFixed) bIsAutomaticLanguage = !bFixed; } @@ -364,9 +360,9 @@ SwFieldType* SwField::ChgTyp( SwFieldType* pNewType ) } // hat das Feld eine Action auf dem ClickHandler ? (z.B. INetFelder,..) -BOOL SwField::HasClickHdl() const +sal_Bool SwField::HasClickHdl() const { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; switch( pType->Which() ) { case RES_INTERNETFLD: @@ -375,7 +371,7 @@ BOOL SwField::HasClickHdl() const case RES_MACROFLD: case RES_INPUTFLD: case RES_DROPDOWN : - bRet = TRUE; + bRet = sal_True; break; case RES_SETEXPFLD: @@ -385,7 +381,7 @@ BOOL SwField::HasClickHdl() const return bRet; } -void SwField::SetLanguage(USHORT nLng) +void SwField::SetLanguage(sal_uInt16 nLng) { nLang = nLng; } @@ -395,14 +391,14 @@ void SwField::ChangeFormat(sal_uInt32 n) nFormat = n; } -BOOL SwField::IsFixed() const +sal_Bool SwField::IsFixed() const { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; switch( pType->Which() ) { case RES_FIXDATEFLD: case RES_FIXTIMEFLD: - bRet = TRUE; + bRet = sal_True; break; case RES_DATETIMEFLD: @@ -425,9 +421,9 @@ BOOL SwField::IsFixed() const return bRet; } -String SwField::ExpandField(bool const bInClipboard) const +String SwField::ExpandField(bool const bCached) const { - if (!bInClipboard) // #i85766# do not expand fields in clipboard documents + if (!bCached) // #i85766# do not expand fields in clipboard documents { m_Cache = Expand(); } @@ -438,7 +434,8 @@ SwField * SwField::CopyField() const { SwField *const pNew = Copy(); // #i85766# cache expansion of source (for clipboard) - pNew->m_Cache = Expand(); + // use this->cache, not this->Expand(): only text formatting calls Expand() + pNew->m_Cache = m_Cache; return pNew; } @@ -446,7 +443,7 @@ SwField * SwField::CopyField() const Beschreibung: Numerierung expandieren --------------------------------------------------------------------*/ -String FormatNumber(USHORT nNum, sal_uInt32 nFormat) +String FormatNumber(sal_uInt16 nNum, sal_uInt32 nFormat) { if(SVX_NUM_PAGEDESC == nFormat) return String::CreateFromInt32( nNum ); @@ -462,10 +459,10 @@ String FormatNumber(USHORT nNum, sal_uInt32 nFormat) Beschreibung: CTOR SwValueFieldType --------------------------------------------------------------------*/ -SwValueFieldType::SwValueFieldType( SwDoc* pDocPtr, USHORT nWhichId ) +SwValueFieldType::SwValueFieldType( SwDoc* pDocPtr, sal_uInt16 nWhichId ) : SwFieldType(nWhichId), pDoc(pDocPtr), - bUseFormat(TRUE) + bUseFormat(sal_True) { } @@ -481,7 +478,7 @@ SwValueFieldType::SwValueFieldType( const SwValueFieldType& rTyp ) --------------------------------------------------------------------*/ String SwValueFieldType::ExpandValue( const double& rVal, - sal_uInt32 nFmt, USHORT nLng) const + sal_uInt32 nFmt, sal_uInt16 nLng) const { if (rVal >= DBL_MAX) // FehlerString fuer Calculator return ViewShell::GetShellRes()->aCalc_Error; @@ -491,7 +488,7 @@ String SwValueFieldType::ExpandValue( const double& rVal, Color* pCol = 0; // wegen Bug #60010 - USHORT nFmtLng = ::lcl_GetLanguageOfFormat( nLng, nFmt, *pFormatter ); + sal_uInt16 nFmtLng = ::lcl_GetLanguageOfFormat( nLng, nFmt, *pFormatter ); if( nFmt < SV_COUNTRY_LANGUAGE_OFFSET && LANGUAGE_SYSTEM != nFmtLng ) { @@ -542,7 +539,7 @@ void SwValueFieldType::DoubleToString( String &rValue, const double &rVal, } void SwValueFieldType::DoubleToString( String &rValue, const double &rVal, - USHORT nLng ) const + sal_uInt16 nLng ) const { SvNumberFormatter* pFormatter = pDoc->GetNumberFormatter(); @@ -560,7 +557,7 @@ void SwValueFieldType::DoubleToString( String &rValue, const double &rVal, --------------------------------------------------------------------*/ SwValueField::SwValueField( SwValueFieldType* pFldType, sal_uInt32 nFmt, - USHORT nLng, const double fVal ) + sal_uInt16 nLng, const double fVal ) : SwField(pFldType, nFmt, nLng), fValue(fVal) { @@ -605,7 +602,7 @@ SwFieldType* SwValueField::ChgTyp( SwFieldType* pNewType ) sal_uInt32 SwValueField::GetSystemFormat(SvNumberFormatter* pFormatter, sal_uInt32 nFmt) { const SvNumberformat* pEntry = pFormatter->GetEntry(nFmt); - USHORT nLng = SvxLocaleToLanguage( SvtSysLocale().GetLocaleData().getLocale() ); + sal_uInt16 nLng = SvxLocaleToLanguage( SvtSysLocale().GetLocaleData().getLocale() ); if (pEntry && nLng != pEntry->GetLanguage()) { @@ -636,7 +633,7 @@ sal_uInt32 SwValueField::GetSystemFormat(SvNumberFormatter* pFormatter, sal_uInt Beschreibung: Sprache im Format anpassen --------------------------------------------------------------------*/ -void SwValueField::SetLanguage( USHORT nLng ) +void SwValueField::SetLanguage( sal_uInt16 nLng ) { if( IsAutomaticLanguage() && ((SwValueFieldType *)GetTyp())->UseFormat() && @@ -644,7 +641,7 @@ void SwValueField::SetLanguage( USHORT nLng ) { // wegen Bug #60010 SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter(); - USHORT nFmtLng = ::lcl_GetLanguageOfFormat( nLng, GetFormat(), + sal_uInt16 nFmtLng = ::lcl_GetLanguageOfFormat( nLng, GetFormat(), *pFormatter ); if( (GetFormat() >= SV_COUNTRY_LANGUAGE_OFFSET || @@ -712,7 +709,7 @@ void SwFormulaField::SetFormula(const String& rStr) { sFormula = rStr; - ULONG nFmt(GetFormat()); + sal_uLong nFmt(GetFormat()); if( nFmt && SAL_MAX_UINT32 != nFmt ) { diff --git a/sw/source/core/fields/flddat.cxx b/sw/source/core/fields/flddat.cxx index a7ce52d8d2..064827f0f4 100644 --- a/sw/source/core/fields/flddat.cxx +++ b/sw/source/core/fields/flddat.cxx @@ -56,7 +56,7 @@ SwFieldType* SwDateTimeFieldType::Copy() const Beschreibung: Datum/Zeit-Feld --------------------------------------------------------------------*/ -SwDateTimeField::SwDateTimeField(SwDateTimeFieldType* pInitType, USHORT nSub, ULONG nFmt, USHORT nLng) +SwDateTimeField::SwDateTimeField(SwDateTimeFieldType* pInitType, sal_uInt16 nSub, sal_uLong nFmt, sal_uInt16 nLng) : SwValueField(pInitType, nFmt, nLng, 0.0), nSubType(nSub), nOffset(0) @@ -107,12 +107,12 @@ SwField* SwDateTimeField::Copy() const return pTmp; } -USHORT SwDateTimeField::GetSubType() const +sal_uInt16 SwDateTimeField::GetSubType() const { return nSubType; } -void SwDateTimeField::SetSubType(USHORT nType) +void SwDateTimeField::SetSubType(sal_uInt16 nType) { nSubType = nType; } @@ -153,7 +153,7 @@ double SwDateTimeField::GetValue() const return GetDateTime(GetDoc(), DateTime()); } -Date SwDateTimeField::GetDate(BOOL bUseOffset) const +Date SwDateTimeField::GetDate(sal_Bool bUseOffset) const { SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter(); Date* pNullDate = pFormatter->GetNullDate(); @@ -168,7 +168,7 @@ Date SwDateTimeField::GetDate(BOOL bUseOffset) const return aDate; } -Time SwDateTimeField::GetTime(BOOL bUseOffset) const +Time SwDateTimeField::GetTime(sal_Bool bUseOffset) const { double fDummy; double fFract = modf(GetValue(), &fDummy); @@ -179,19 +179,19 @@ Time SwDateTimeField::GetTime(BOOL bUseOffset) const return (Time)aDT; } -bool SwDateTimeField::QueryValue( uno::Any& rVal, USHORT nWhichId ) const +bool SwDateTimeField::QueryValue( uno::Any& rVal, sal_uInt16 nWhichId ) const { switch( nWhichId ) { case FIELD_PROP_BOOL1: { - BOOL bTmp = IsFixed(); + sal_Bool bTmp = IsFixed(); rVal.setValue(&bTmp, ::getCppuBooleanType()); } break; case FIELD_PROP_BOOL2: { - BOOL bTmp = IsDate(); + sal_Bool bTmp = IsDate(); rVal.setValue(&bTmp, ::getCppuBooleanType()); } break; @@ -222,7 +222,7 @@ bool SwDateTimeField::QueryValue( uno::Any& rVal, USHORT nWhichId ) const return true; } -bool SwDateTimeField::PutValue( const uno::Any& rVal, USHORT nWhichId ) +bool SwDateTimeField::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId ) { sal_Int32 nTmp = 0; switch( nWhichId ) @@ -249,7 +249,7 @@ bool SwDateTimeField::PutValue( const uno::Any& rVal, USHORT nWhichId ) { util::DateTime aDateTimeValue; if(!(rVal >>= aDateTimeValue)) - return FALSE; + return sal_False; DateTime aDateTime; aDateTime.Set100Sec(aDateTimeValue.HundredthSeconds); aDateTime.SetSec(aDateTimeValue.Seconds); diff --git a/sw/source/core/fields/flddropdown.cxx b/sw/source/core/fields/flddropdown.cxx index eab65e4d1e..17c80d835c 100644 --- a/sw/source/core/fields/flddropdown.cxx +++ b/sw/source/core/fields/flddropdown.cxx @@ -171,7 +171,7 @@ const String & SwDropDownField::GetToolTip() const return aToolTip; } -BOOL SwDropDownField::SetSelectedItem(const String & rItem) +sal_Bool SwDropDownField::SetSelectedItem(const String & rItem) { vector<String>::const_iterator aIt = std::find(aValues.begin(), aValues.end(), rItem); @@ -199,7 +199,7 @@ void SwDropDownField::SetToolTip(const String & rToolTip) aToolTip = rToolTip; } -bool SwDropDownField::QueryValue(::uno::Any &rVal, USHORT nWhich) const +bool SwDropDownField::QueryValue(::uno::Any &rVal, sal_uInt16 nWhich) const { nWhich &= ~CONVERT_TWIPS; switch( nWhich ) @@ -228,7 +228,7 @@ bool SwDropDownField::QueryValue(::uno::Any &rVal, USHORT nWhich) const } bool SwDropDownField::PutValue(const uno::Any &rVal, - USHORT nWhich) + sal_uInt16 nWhich) { switch( nWhich ) { diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx index d6827dddd9..c7257d7fd3 100644 --- a/sw/source/core/fields/fldlst.cxx +++ b/sw/source/core/fields/fldlst.cxx @@ -46,21 +46,21 @@ Beschreibung: Sortieren der Input-Eintraege --------------------------------------------------------------------*/ -SwInputFieldList::SwInputFieldList( SwEditShell* pShell, BOOL bBuildTmpLst ) +SwInputFieldList::SwInputFieldList( SwEditShell* pShell, sal_Bool bBuildTmpLst ) : pSh(pShell) { // Hier die Liste aller Eingabefelder sortiert erstellen pSrtLst = new _SetGetExpFlds(); const SwFldTypes& rFldTypes = *pSh->GetDoc()->GetFldTypes(); - const USHORT nSize = rFldTypes.Count(); + const sal_uInt16 nSize = rFldTypes.Count(); // Alle Typen abklappern - for(USHORT i=0; i < nSize; ++i) + for(sal_uInt16 i=0; i < nSize; ++i) { SwFieldType* pFldType = (SwFieldType*)rFldTypes[ i ]; - USHORT nType = pFldType->Which(); + sal_uInt16 nType = pFldType->Which(); if( RES_SETEXPFLD == nType || RES_INPUTFLD == nType || RES_DROPDOWN == nType ) { @@ -106,13 +106,13 @@ SwInputFieldList::~SwInputFieldList() Beschreibung: Felder aus der Liste in sortierter Reihenfolge --------------------------------------------------------------------*/ -USHORT SwInputFieldList::Count() const +sal_uInt16 SwInputFieldList::Count() const { return pSrtLst->Count(); } -SwField* SwInputFieldList::GetField(USHORT nId) +SwField* SwInputFieldList::GetField(sal_uInt16 nId) { const SwTxtFld* pTxtFld = (*pSrtLst)[ nId ]->GetFld(); OSL_ENSURE( pTxtFld, "kein TextFld" ); @@ -131,14 +131,14 @@ void SwInputFieldList::PushCrsr() void SwInputFieldList::PopCrsr() { - pSh->Pop(FALSE); + pSh->Pop(sal_False); } /*-------------------------------------------------------------------- Beschreibung: Position eines Feldes ansteuern --------------------------------------------------------------------*/ -void SwInputFieldList::GotoFieldPos(USHORT nId) +void SwInputFieldList::GotoFieldPos(sal_uInt16 nId) { pSh->StartAllAction(); (*pSrtLst)[ nId ]->GetPosOfContent( *pSh->GetCrsr()->GetPoint() ); @@ -148,17 +148,17 @@ void SwInputFieldList::GotoFieldPos(USHORT nId) // vergleiche TmpLst mit akt Feldern. Alle neue kommen in die SortLst // damit sie geupdatet werden koennen. Returnt die Anzahl. // (Fuer Textbausteine: nur seine Input-Felder aktualisieren) -USHORT SwInputFieldList::BuildSortLst() +sal_uInt16 SwInputFieldList::BuildSortLst() { const SwFldTypes& rFldTypes = *pSh->GetDoc()->GetFldTypes(); - USHORT nSize = rFldTypes.Count(); + sal_uInt16 nSize = rFldTypes.Count(); // Alle Typen abklappern - for( USHORT i = 0; i < nSize; ++i ) + for( sal_uInt16 i = 0; i < nSize; ++i ) { SwFieldType* pFldType = (SwFieldType*)rFldTypes[ i ]; - USHORT nType = pFldType->Which(); + sal_uInt16 nType = pFldType->Which(); if( RES_SETEXPFLD == nType || RES_INPUTFLD == nType ) { @@ -179,7 +179,7 @@ USHORT SwInputFieldList::BuildSortLst() VoidPtr pTmp = (VoidPtr)pTxtFld; // nicht in der TempListe vorhanden, also in die SortListe // aufnehemen - USHORT nFndPos = aTmpLst.GetPos( pTmp ); + sal_uInt16 nFndPos = aTmpLst.GetPos( pTmp ); if( USHRT_MAX == nFndPos ) { SwNodeIndex aIdx( rTxtNode ); @@ -208,7 +208,7 @@ void SwInputFieldList::RemoveUnselectedFlds() FOREACHPAM_START(pSh) { - for (USHORT i = 0; i < Count();) + for (sal_uInt16 i = 0; i < Count();) { _SetGetExpFld* pFld = (*pSrtLst)[i]; SwPosition aPos(*PCURCRSR->GetPoint()); diff --git a/sw/source/core/fields/macrofld.cxx b/sw/source/core/fields/macrofld.cxx index 4922a0a50b..d41d345255 100644 --- a/sw/source/core/fields/macrofld.cxx +++ b/sw/source/core/fields/macrofld.cxx @@ -29,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <hintids.hxx> #include <doc.hxx> #include <docufld.hxx> @@ -39,8 +38,10 @@ #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> #include <comphelper/processfactory.hxx> + using namespace ::com::sun::star; using ::rtl::OUString; + /*-------------------------------------------------------------------- Beschreibung: MacroFeldtypen --------------------------------------------------------------------*/ @@ -63,7 +64,7 @@ SwFieldType* SwMacroFieldType::Copy() const SwMacroField::SwMacroField(SwMacroFieldType* pInitType, const String& rLibAndName, const String& rTxt) : - SwField(pInitType), aMacro(rLibAndName), aText(rTxt), bIsScriptURL(FALSE) + SwField(pInitType), aMacro(rLibAndName), aText(rTxt), bIsScriptURL(sal_False) { bIsScriptURL = isScriptURL(aMacro); } @@ -78,16 +79,12 @@ SwField* SwMacroField::Copy() const return new SwMacroField((SwMacroFieldType*)GetTyp(), aMacro, aText); } -String SwMacroField::GetCntnt(BOOL bName) const +String SwMacroField::GetFieldName() const { - if(bName) - { - String aStr(GetTyp()->GetName()); - aStr += ' '; - aStr += aMacro; - return aStr; - } - return Expand(); + String aStr(GetTyp()->GetName()); + aStr += ' '; + aStr += aMacro; + return aStr; } String SwMacroField::GetLibName() const @@ -100,9 +97,9 @@ String SwMacroField::GetLibName() const if (aMacro.Len()) { - USHORT nPos = aMacro.Len(); + sal_uInt16 nPos = aMacro.Len(); - for (USHORT i = 0; i < 3 && nPos > 0; i++) + for (sal_uInt16 i = 0; i < 3 && nPos > 0; i++) while (aMacro.GetChar(--nPos) != '.' && nPos > 0) ; return aMacro.Copy(0, nPos ); @@ -122,9 +119,9 @@ String SwMacroField::GetMacroName() const } else { - USHORT nPos = aMacro.Len(); + sal_uInt16 nPos = aMacro.Len(); - for (USHORT i = 0; i < 3 && nPos > 0; i++) + for (sal_uInt16 i = 0; i < 3 && nPos > 0; i++) while (aMacro.GetChar(--nPos) != '.' && nPos > 0) ; return aMacro.Copy( ++nPos ); @@ -176,7 +173,7 @@ String SwMacroField::GetPar2() const return aText; } -bool SwMacroField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwMacroField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -198,7 +195,7 @@ bool SwMacroField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwMacroField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwMacroField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { String sTmp; switch( nWhichId ) @@ -236,7 +233,7 @@ void SwMacroField::CreateMacroString( rMacro += rMacroName; } -BOOL SwMacroField::isScriptURL( const String& str ) +sal_Bool SwMacroField::isScriptURL( const String& str ) { uno::Reference< lang::XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory(); @@ -253,10 +250,10 @@ BOOL SwMacroField::isScriptURL( const String& str ) if ( xUrl.is() ) { - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/fields/makefile.mk b/sw/source/core/fields/makefile.mk deleted file mode 100644 index 358b3f7afc..0000000000 --- a/sw/source/core/fields/makefile.mk +++ /dev/null @@ -1,92 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=fields - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -CXXFILES = \ - authfld.cxx \ - cellfml.cxx \ - chpfld.cxx \ - dbfld.cxx \ - ddefld.cxx \ - ddetbl.cxx \ - docufld.cxx \ - expfld.cxx \ - fldbas.cxx \ - flddat.cxx \ - flddropdown.cxx \ - scrptfld.cxx \ - macrofld.cxx \ - fldlst.cxx \ - postithelper.cxx \ - reffld.cxx \ - tblcalc.cxx \ - usrfld.cxx - - - -SLOFILES = \ - $(EXCEPTIONSFILES) \ - $(SLO)$/scrptfld.obj - -EXCEPTIONSFILES = \ - $(SLO)$/authfld.obj \ - $(SLO)$/cellfml.obj \ - $(SLO)$/chpfld.obj \ - $(SLO)$/dbfld.obj \ - $(SLO)$/ddefld.obj \ - $(SLO)$/ddetbl.obj \ - $(SLO)$/docufld.obj \ - $(SLO)$/expfld.obj \ - $(SLO)$/fldbas.obj \ - $(SLO)$/flddat.obj \ - $(SLO)$/flddropdown.obj \ - $(SLO)$/fldlst.obj \ - $(SLO)$/macrofld.obj \ - $(SLO)$/postithelper.obj \ - $(SLO)$/reffld.obj \ - $(SLO)$/tblcalc.obj \ - $(SLO)$/textapi.obj \ - $(SLO)$/usrfld.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 6cc1f38959..8ef28d46ee 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -77,7 +77,7 @@ using namespace ::com::sun::star::text; using namespace ::com::sun::star::lang; using ::rtl::OUString; -extern void InsertSort( SvUShorts& rArr, USHORT nIdx, USHORT* pInsPos = 0 ); +extern void InsertSort( SvUShorts& rArr, sal_uInt16 nIdx, sal_uInt16* pInsPos = 0 ); void lcl_GetLayTree( const SwFrm* pFrm, SvPtrarr& rArr ) { @@ -103,11 +103,11 @@ void lcl_GetLayTree( const SwFrm* pFrm, SvPtrarr& rArr ) } -BOOL IsFrameBehind( const SwTxtNode& rMyNd, USHORT nMySttPos, - const SwTxtNode& rBehindNd, USHORT nSttPos ) +sal_Bool IsFrameBehind( const SwTxtNode& rMyNd, sal_uInt16 nMySttPos, + const SwTxtNode& rBehindNd, sal_uInt16 nSttPos ) { - const SwTxtFrm *pMyFrm = (SwTxtFrm*)rMyNd.GetFrm(0,0,FALSE), - *pFrm = (SwTxtFrm*)rBehindNd.GetFrm(0,0,FALSE); + const SwTxtFrm *pMyFrm = (SwTxtFrm*)rMyNd.GetFrm(0,0,sal_False), + *pFrm = (SwTxtFrm*)rBehindNd.GetFrm(0,0,sal_False); while( pFrm && !pFrm->IsInside( nSttPos ) ) pFrm = (SwTxtFrm*)pFrm->GetFollow(); @@ -115,15 +115,15 @@ BOOL IsFrameBehind( const SwTxtNode& rMyNd, USHORT nMySttPos, pMyFrm = (SwTxtFrm*)pMyFrm->GetFollow(); if( !pFrm || !pMyFrm || pFrm == pMyFrm ) - return FALSE; + return sal_False; SvPtrarr aRefArr( 10, 10 ), aArr( 10, 10 ); ::lcl_GetLayTree( pFrm, aRefArr ); ::lcl_GetLayTree( pMyFrm, aArr ); - USHORT nRefCnt = aRefArr.Count() - 1, nCnt = aArr.Count() - 1; - BOOL bVert = FALSE; - BOOL bR2L = FALSE; + sal_uInt16 nRefCnt = aRefArr.Count() - 1, nCnt = aArr.Count() - 1; + sal_Bool bVert = sal_False; + sal_Bool bR2L = sal_False; // solange bis ein Frame ungleich ist ? while( nRefCnt && nCnt && aRefArr[ nRefCnt ] == aArr[ nCnt ] ) @@ -147,7 +147,7 @@ BOOL IsFrameBehind( const SwTxtNode& rMyNd, USHORT nMySttPos, const SwFrm* pFldFrm = (const SwFrm*)aArr[ nCnt ]; // unterschiedliche Frames, dann ueberpruefe deren Y-/X-Position - BOOL bRefIsLower = FALSE; + sal_Bool bRefIsLower = sal_False; if( ( FRM_COLUMN | FRM_CELL ) & pFldFrm->GetType() || ( FRM_COLUMN | FRM_CELL ) & pRefFrm->GetType() ) { @@ -212,8 +212,8 @@ BOOL IsFrameBehind( const SwTxtNode& rMyNd, USHORT nMySttPos, SwGetRefField::SwGetRefField( SwGetRefFieldType* pFldType, - const String& rSetRef, USHORT nSubTyp, - USHORT nSeqenceNo, ULONG nFmt ) + const String& rSetRef, sal_uInt16 nSubTyp, + sal_uInt16 nSeqenceNo, sal_uLong nFmt ) : SwField( pFldType, nFmt ), sSetRefName( rSetRef ), nSubType( nSubTyp ), @@ -230,12 +230,12 @@ String SwGetRefField::GetDescription() const return SW_RES(STR_REFERENCE); } -USHORT SwGetRefField::GetSubType() const +sal_uInt16 SwGetRefField::GetSubType() const { return nSubType; } -void SwGetRefField::SetSubType( USHORT n ) +void SwGetRefField::SetSubType( sal_uInt16 n ) { nSubType = n; } @@ -256,7 +256,7 @@ bool SwGetRefField::IsRefToNumItemCrossRefBookmark() const const SwTxtNode* SwGetRefField::GetReferencedTxtNode() const { SwDoc* pDoc = dynamic_cast<SwGetRefFieldType*>(GetTyp())->GetDoc(); - USHORT nDummy = USHRT_MAX; + sal_uInt16 nDummy = USHRT_MAX; return SwGetRefFieldType::FindAnchor( pDoc, sSetRefName, nSubType, nSeqNo, &nDummy ); } // <-- @@ -275,11 +275,8 @@ String SwGetRefField::Expand() const } -String SwGetRefField::GetCntnt(BOOL bName) const +String SwGetRefField::GetFieldName() const { - if( !bName ) - return Expand(); - String aStr(GetTyp()->GetName()); aStr += ' '; aStr += sSetRefName; @@ -292,8 +289,8 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) sTxt.Erase(); SwDoc* pDoc = ((SwGetRefFieldType*)GetTyp())->GetDoc(); - USHORT nStt = USHRT_MAX; - USHORT nEnd = USHRT_MAX; + sal_uInt16 nStt = USHRT_MAX; + sal_uInt16 nEnd = USHRT_MAX; SwTxtNode* pTxtNd = SwGetRefFieldType::FindAnchor( pDoc, sSetRefName, nSubType, nSeqNo, &nStt, &nEnd ); if ( !pTxtNd ) @@ -360,7 +357,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) case REF_ENDNOTE: { // die Nummer oder den NumString besorgen - USHORT n, nFtnCnt = pDoc->GetFtnIdxs().Count(); + sal_uInt16 n, nFtnCnt = pDoc->GetFtnIdxs().Count(); SwTxtFtn* pFtnIdx; for( n = 0; n < nFtnCnt; ++n ) if( nSeqNo == (pFtnIdx = pDoc->GetFtnIdxs()[ n ])->GetSeqRefNo() ) @@ -396,14 +393,14 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) case REF_PAGE: case REF_PAGE_PGDESC: { - const SwTxtFrm* pFrm = (SwTxtFrm*)pTxtNd->GetFrm(0,0,FALSE), + const SwTxtFrm* pFrm = (SwTxtFrm*)pTxtNd->GetFrm(0,0,sal_False), *pSave = pFrm; while( pFrm && !pFrm->IsInside( nStt ) ) pFrm = (SwTxtFrm*)pFrm->GetFollow(); if( pFrm || 0 != ( pFrm = pSave )) { - USHORT nPageNo = pFrm->GetVirtPageNum(); + sal_uInt16 nPageNo = pFrm->GetVirtPageNum(); const SwPageFrm *pPage; if( REF_PAGE_PGDESC == GetFormat() && 0 != ( pPage = pFrm->FindPageFrm() ) && @@ -424,7 +421,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) SwChapterFieldType aFldTyp; SwChapterField aFld( &aFldTyp, 0 ); aFld.SetLevel( MAXLEVEL - 1 ); - aFld.ChangeExpansion( pFrm, pTxtNd, TRUE ); + aFld.ChangeExpansion( pFrm, pTxtNd, sal_True ); sTxt = aFld.GetNumber(); } } @@ -581,7 +578,7 @@ String SwGetRefField::GetPar2() const return Expand(); } -bool SwGetRefField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwGetRefField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -653,7 +650,7 @@ bool SwGetRefField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwGetRefField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwGetRefField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { String sTmp; switch( nWhichId ) @@ -738,7 +735,7 @@ void SwGetRefField::ConvertProgrammaticToUIName() if(!pDoc->GetFldType(RES_SETEXPFLD, rPar1, false)) { sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromProgName( rPar1, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ); - USHORT nResId = USHRT_MAX; + sal_uInt16 nResId = USHRT_MAX; switch( nPoolId ) { case RES_POOLCOLL_LABEL_ABB: @@ -806,8 +803,8 @@ void SwGetRefFieldType::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) } SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const String& rRefMark, - USHORT nSubType, USHORT nSeqNo, - USHORT* pStt, USHORT* pEnd ) + sal_uInt16 nSubType, sal_uInt16 nSeqNo, + sal_uInt16* pStt, sal_uInt16* pEnd ) { OSL_ENSURE( pStt, "warum wird keine StartPos abgefragt?" ); @@ -860,7 +857,7 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const String& rRefMark, const ::sw::mark::IMark* pBkmk = ppMark->get(); const SwPosition* pPos = &pBkmk->GetMarkStart(); - pTxtNd = pDoc->GetNodes()[ pPos->nNode ]->GetTxtNode(); + pTxtNd = pPos->nNode.GetNode().GetTxtNode(); *pStt = pPos->nContent.GetIndex(); if(pEnd) { @@ -891,7 +888,7 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const String& rRefMark, case REF_FOOTNOTE: case REF_ENDNOTE: { - USHORT n, nFtnCnt = pDoc->GetFtnIdxs().Count(); + sal_uInt16 n, nFtnCnt = pDoc->GetFtnIdxs().Count(); SwTxtFtn* pFtnIdx; for( n = 0; n < nFtnCnt; ++n ) if( nSeqNo == (pFtnIdx = pDoc->GetFtnIdxs()[ n ])->GetSeqRefNo() ) @@ -921,24 +918,24 @@ struct _RefIdsMap String aName; SvUShortsSort aIds, aDstIds, aIdsMap; SvUShorts aMap; - BOOL bInit; + sal_Bool bInit; _RefIdsMap( const String& rName ) : aName( rName ), aIds( 16, 16 ), aIdsMap( 16, 16 ), aMap( 16, 16 ), - bInit( FALSE ) + bInit( sal_False ) {} void Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rFld, - BOOL bField = TRUE ); + sal_Bool bField = sal_True ); - BOOL IsInit() const { return bInit; } + sal_Bool IsInit() const { return bInit; } }; SV_DECL_PTRARR_DEL( _RefIdsMaps, _RefIdsMap*, 5, 5 ) SV_IMPL_PTRARR( _RefIdsMaps, _RefIdsMap* ) void _RefIdsMap::Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rFld, - BOOL bField ) + sal_Bool bField ) { if( !bInit ) @@ -970,19 +967,19 @@ void _RefIdsMap::Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rFld, } else { - USHORT n; + sal_uInt16 n; for( n = rDestDoc.GetFtnIdxs().Count(); n; ) aIds.Insert( rDestDoc.GetFtnIdxs()[ --n ]->GetSeqRefNo() ); for( n = rDoc.GetFtnIdxs().Count(); n; ) aDstIds.Insert( rDoc.GetFtnIdxs()[ --n ]->GetSeqRefNo() ); } - bInit = TRUE; + bInit = sal_True; } // dann teste mal, ob die Nummer schon vergeben ist // oder ob eine neue bestimmt werden muss. - USHORT nPos, nSeqNo = rFld.GetSeqNo(); + sal_uInt16 nPos, nSeqNo = rFld.GetSeqNo(); if( aIds.Seek_Entry( nSeqNo ) && aDstIds.Seek_Entry( nSeqNo )) { // ist schon vergeben, also muss eine neue @@ -991,7 +988,7 @@ void _RefIdsMap::Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rFld, rFld.SetSeqNo( aMap[ nPos ] ); else { - USHORT n; + sal_uInt16 n; for( n = 0; n < aIds.Count(); ++n ) if( n != aIds[ n ] ) @@ -1021,7 +1018,7 @@ void _RefIdsMap::Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rFld, else { SwTxtFtn* pFtnIdx; - for( USHORT i = 0, nCnt = rDoc.GetFtnIdxs().Count(); i < nCnt; ++i ) + for( sal_uInt16 i = 0, nCnt = rDoc.GetFtnIdxs().Count(); i < nCnt; ++i ) if( nSeqNo == (pFtnIdx = rDoc.GetFtnIdxs()[ i ])->GetSeqRefNo() ) { pFtnIdx->SetSeqNo( n ); @@ -1060,7 +1057,7 @@ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc ) case REF_SEQUENCEFLD: { _RefIdsMap* pMap = 0; - for( USHORT n = aFldMap.Count(); n; ) + for( sal_uInt16 n = aFldMap.Count(); n; ) if( aFldMap[ --n ]->aName == rRefFld.GetSetRefName() ) { pMap = aFldMap[ n ]; @@ -1072,13 +1069,13 @@ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc ) aFldMap.C40_INSERT( _RefIdsMap, pMap, aFldMap.Count() ); } - pMap->Check( *pDoc, rDestDoc, rRefFld, TRUE ); + pMap->Check( *pDoc, rDestDoc, rRefFld, sal_True ); } break; case REF_FOOTNOTE: case REF_ENDNOTE: - aFntMap.Check( *pDoc, rDestDoc, rRefFld, FALSE ); + aFntMap.Check( *pDoc, rDestDoc, rRefFld, sal_False ); break; } } diff --git a/sw/source/core/fields/scrptfld.cxx b/sw/source/core/fields/scrptfld.cxx index 8d23b7e42c..7a2297d2ad 100644 --- a/sw/source/core/fields/scrptfld.cxx +++ b/sw/source/core/fields/scrptfld.cxx @@ -57,7 +57,7 @@ SwFieldType* SwScriptFieldType::Copy() const SwScriptField::SwScriptField( SwScriptFieldType* pInitType, const String& rType, const String& rCode, - BOOL bURL ) + sal_Bool bURL ) : SwField( pInitType ), sType( rType ), sCode( rCode ), bCodeURL( bURL ) { } @@ -106,7 +106,7 @@ String SwScriptField::GetPar2() const return sCode; } -bool SwScriptField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwScriptField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -125,7 +125,7 @@ bool SwScriptField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwScriptField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwScriptField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx index 84f2f316d4..6da87bb105 100644 --- a/sw/source/core/fields/tblcalc.cxx +++ b/sw/source/core/fields/tblcalc.cxx @@ -40,6 +40,7 @@ #include <docfld.hxx> // fuer _SetGetExpFld #include <unofldmid.h> + using namespace ::com::sun::star; using ::rtl::OUString; @@ -71,7 +72,7 @@ void SwTblField::CalcField( SwTblCalcPara& rCalcPara ) SwTblField::SwTblField( SwTblFieldType* pInitType, const String& rFormel, - USHORT nType, ULONG nFmt ) + sal_uInt16 nType, sal_uLong nFmt ) : SwValueField( pInitType, nFmt ), SwTableFormula( rFormel ), sExpand( '0' ), nSubType(nType) { @@ -90,22 +91,12 @@ SwField* SwTblField::Copy() const } -String SwTblField::GetCntnt(BOOL bName) const +String SwTblField::GetFieldName() const { - if( bName ) - { - String aStr(GetTyp()->GetName()); - aStr += ' '; - - USHORT nOldSubType = nSubType; - SwTblField* pThis = (SwTblField*)this; - pThis->nSubType |= nsSwExtendedSubType::SUB_CMD; - aStr += Expand(); - pThis->nSubType = nOldSubType; - - return aStr; - } - return Expand(); + String aStr(GetTyp()->GetName()); + aStr += ' '; + aStr += const_cast<SwTblField *>(this)->GetCommand(); + return aStr; } // suche den TextNode, in dem das Feld steht @@ -126,21 +117,28 @@ const SwNode* SwTblField::GetNodeOfFormula() const return 0; } +String SwTblField::GetCommand() +{ + if (EXTRNL_NAME != GetNameType()) + { + SwNode const*const pNd = GetNodeOfFormula(); + SwTableNode const*const pTblNd = (pNd) ? pNd->FindTableNode() : 0; + if (pTblNd) + { + PtrToBoxNm( &pTblNd->GetTable() ); + } + } + return (EXTRNL_NAME == GetNameType()) + ? SwTableFormula::GetFormula() + : String(); +} String SwTblField::Expand() const { String aStr; if (nSubType & nsSwExtendedSubType::SUB_CMD) { - if( EXTRNL_NAME != GetNameType() ) - { - const SwNode* pNd = GetNodeOfFormula(); - const SwTableNode* pTblNd = pNd ? pNd->FindTableNode() : 0; - if( pTblNd ) - ((SwTblField*)this)->PtrToBoxNm( &pTblNd->GetTable() ); - } - if( EXTRNL_NAME == GetNameType() ) - aStr = SwTableFormula::GetFormula(); + aStr = const_cast<SwTblField *>(this)->GetCommand(); } else { @@ -156,12 +154,12 @@ String SwTblField::Expand() const return aStr; } -USHORT SwTblField::GetSubType() const +sal_uInt16 SwTblField::GetSubType() const { return nSubType; } -void SwTblField::SetSubType(USHORT nType) +void SwTblField::SetSubType(sal_uInt16 nType) { nSubType = nType; } @@ -189,14 +187,14 @@ void SwTblField::SetPar2(const String& rStr) SetFormula( rStr ); } -bool SwTblField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwTblField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { bool bRet = true; switch ( nWhichId ) { case FIELD_PROP_PAR2: { - USHORT nOldSubType = nSubType; + sal_uInt16 nOldSubType = nSubType; SwTblField* pThis = (SwTblField*)this; pThis->nSubType |= nsSwExtendedSubType::SUB_CMD; rAny <<= rtl::OUString( Expand() ); @@ -205,7 +203,7 @@ bool SwTblField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const break; case FIELD_PROP_BOOL1: { - BOOL bFormula = 0 != (nsSwExtendedSubType::SUB_CMD & nSubType); + sal_Bool bFormula = 0 != (nsSwExtendedSubType::SUB_CMD & nSubType); rAny.setValue(&bFormula, ::getBooleanCppuType()); } break; @@ -221,7 +219,7 @@ bool SwTblField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return bRet; } -bool SwTblField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwTblField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { bool bRet = true; String sTmp; diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx index 7fca454e34..e2ee584302 100644 --- a/sw/source/core/fields/usrfld.cxx +++ b/sw/source/core/fields/usrfld.cxx @@ -29,22 +29,24 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <svl/zforlist.hxx> #include <svl/zformat.hxx> -#include <svx/svdmodel.hxx> +#include <svx/svdmodel.hxx> #include <calbck.hxx> #include <calc.hxx> #include <usrfld.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <editsh.hxx> #include <dpage.hxx> #include <unofldmid.h> + using namespace ::com::sun::star; using ::rtl::OUString; + /*-------------------------------------------------------------------- Beschreibung: Benutzerfelder --------------------------------------------------------------------*/ @@ -71,17 +73,14 @@ SwField* SwUserField::Copy() const return pTmp; } -String SwUserField::GetCntnt(sal_Bool bName) const +String SwUserField::GetFieldName() const { - if ( bName ) - { String aStr(SwFieldType::GetTypeStr(TYP_USERFLD)); - aStr += ' '; - aStr += GetTyp()->GetName(); - aStr.AppendAscii(" = "); - aStr += ((SwUserFieldType*)GetTyp())->GetContent(); - return aStr; - } - return Expand(); + String aStr(SwFieldType::GetTypeStr(TYP_USERFLD)); + aStr += ' '; + aStr += GetTyp()->GetName(); + aStr.AppendAscii(" = "); + aStr += static_cast<SwUserFieldType*>(GetTyp())->GetContent(); + return aStr; } double SwUserField::GetValue() const @@ -128,19 +127,19 @@ void SwUserField::SetSubType(sal_uInt16 nSub) nSubType = nSub & 0xff00; } -bool SwUserField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwUserField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { case FIELD_PROP_BOOL2: { - BOOL bTmp = 0 != (nSubType & nsSwExtendedSubType::SUB_CMD); + sal_Bool bTmp = 0 != (nSubType & nsSwExtendedSubType::SUB_CMD); rAny.setValue(&bTmp, ::getBooleanCppuType()); } break; case FIELD_PROP_BOOL1: { - BOOL bTmp = 0 == (nSubType & nsSwExtendedSubType::SUB_INVISIBLE); + sal_Bool bTmp = 0 == (nSubType & nsSwExtendedSubType::SUB_INVISIBLE); rAny.setValue(&bTmp, ::getBooleanCppuType()); } break; @@ -153,7 +152,7 @@ bool SwUserField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwUserField::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwUserField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { @@ -299,11 +298,13 @@ void SwUserFieldType::SetContent( const String& rStr, sal_uInt32 nFmt ) sal_Bool bModified = GetDoc()->IsModified(); GetDoc()->SetModified(); if( !bModified ) // Bug 57028 - GetDoc()->SetUndoNoResetModified(); + { + GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified(); + } } } -bool SwUserFieldType::QueryValue( uno::Any& rAny, USHORT nWhichId ) const +bool SwUserFieldType::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) { @@ -315,7 +316,7 @@ bool SwUserFieldType::QueryValue( uno::Any& rAny, USHORT nWhichId ) const break; case FIELD_PROP_BOOL1: { - BOOL bExpression = 0 != (nsSwGetSetExpType::GSE_EXPR&nType); + sal_Bool bExpression = 0 != (nsSwGetSetExpType::GSE_EXPR&nType); rAny.setValue(&bExpression, ::getBooleanCppuType()); } break; @@ -325,7 +326,7 @@ bool SwUserFieldType::QueryValue( uno::Any& rAny, USHORT nWhichId ) const return true; } -bool SwUserFieldType::PutValue( const uno::Any& rAny, USHORT nWhichId ) +bool SwUserFieldType::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) { switch( nWhichId ) { |