diff options
Diffstat (limited to 'sw/source/core/doc')
44 files changed, 4062 insertions, 4043 deletions
diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx b/sw/source/core/doc/SwStyleNameMapper.cxx index 84b390f16cb5..eb653789da52 100644 --- a/sw/source/core/doc/SwStyleNameMapper.cxx +++ b/sw/source/core/doc/SwStyleNameMapper.cxx @@ -1091,7 +1091,7 @@ const SvStringsDtor& SwStyleNameMapper::GetNumRuleProgNameArray() const String SwStyleNameMapper::GetSpecialExtraProgName( const String& rExtraUIName ) { String aRes = rExtraUIName; - BOOL bChgName = FALSE; + sal_Bool bChgName = sal_False; const SvStringsDtor& rExtraArr = GetExtraUINameArray(); static sal_uInt16 nIds[] = { @@ -1106,7 +1106,7 @@ const String SwStyleNameMapper::GetSpecialExtraProgName( const String& rExtraUIN { if (aRes == *rExtraArr[ *pIds ]) { - bChgName = TRUE; + bChgName = sal_True; break; } } @@ -1118,7 +1118,7 @@ const String SwStyleNameMapper::GetSpecialExtraProgName( const String& rExtraUIN const String SwStyleNameMapper::GetSpecialExtraUIName( const String& rExtraProgName ) { String aRes = rExtraProgName; - BOOL bChgName = FALSE; + sal_Bool bChgName = sal_False; const SvStringsDtor& rExtraArr = GetExtraProgNameArray(); static sal_uInt16 nIds[] = { @@ -1134,7 +1134,7 @@ const String SwStyleNameMapper::GetSpecialExtraUIName( const String& rExtraProgN { if (aRes == *rExtraArr[ *pIds ]) { - bChgName = TRUE; + bChgName = sal_True; break; } } diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx index 1feb032d2814..dd4219417214 100644 --- a/sw/source/core/doc/acmplwrd.cxx +++ b/sw/source/core/doc/acmplwrd.cxx @@ -56,7 +56,7 @@ class SwAutoCompleteClient : public SwClient SwAutoCompleteWord* pAutoCompleteWord; SwDoc* pDoc; #if OSL_DEBUG_LEVEL > 1 - static ULONG nSwAutoCompleteClientCount; + static sal_uLong nSwAutoCompleteClientCount; #endif public: SwAutoCompleteClient(SwAutoCompleteWord& rToTell, SwDoc& rSwDoc); @@ -68,7 +68,7 @@ public: virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew); const SwDoc& GetDoc(){return *pDoc;} #if OSL_DEBUG_LEVEL > 1 - static ULONG GetElementCount() {return nSwAutoCompleteClientCount;} + static sal_uLong GetElementCount() {return nSwAutoCompleteClientCount;} #endif }; @@ -90,7 +90,7 @@ typedef std::vector<SwDocPtr> SwDocPtrVector; class SwAutoCompleteString : public String { #if OSL_DEBUG_LEVEL > 1 - static ULONG nSwAutoCompleteStringCount; + static sal_uLong nSwAutoCompleteStringCount; #endif SwDocPtrVector aSourceDocs; public: @@ -101,12 +101,12 @@ class SwAutoCompleteString : public String //returns true if last document reference has been removed sal_Bool RemoveDocument(const SwDoc& rDoc); #if OSL_DEBUG_LEVEL > 1 - static ULONG GetElementCount() {return nSwAutoCompleteStringCount;} + static sal_uLong GetElementCount() {return nSwAutoCompleteStringCount;} #endif }; #if OSL_DEBUG_LEVEL > 1 - ULONG SwAutoCompleteClient::nSwAutoCompleteClientCount = 0; - ULONG SwAutoCompleteString::nSwAutoCompleteStringCount = 0; + sal_uLong SwAutoCompleteClient::nSwAutoCompleteClientCount = 0; + sal_uLong SwAutoCompleteString::nSwAutoCompleteStringCount = 0; #endif SwAutoCompleteClient::SwAutoCompleteClient(SwAutoCompleteWord& rToTell, SwDoc& rSwDoc) : @@ -227,18 +227,18 @@ sal_Bool SwAutoCompleteString::RemoveDocument(const SwDoc& rDoc) return sal_False; } -SwAutoCompleteWord::SwAutoCompleteWord( USHORT nWords, USHORT nMWrdLen ) +SwAutoCompleteWord::SwAutoCompleteWord( sal_uInt16 nWords, sal_uInt16 nMWrdLen ) : aWordLst( 0, 255 ), aLRULst( 0, 255 ), pImpl(new SwAutoCompleteWord_Impl(*this)), nMaxCount( nWords ), nMinWrdLen( nMWrdLen ), - bLockWordLst( FALSE ) + bLockWordLst( sal_False ) { } SwAutoCompleteWord::~SwAutoCompleteWord() { - for(USHORT nPos = aWordLst.Count(); nPos; nPos--) + for(sal_uInt16 nPos = aWordLst.Count(); nPos; nPos--) { SwAutoCompleteString* pCurrent = (SwAutoCompleteString*)aWordLst[ nPos - 1 ]; aWordLst.Remove( nPos - 1 ); @@ -246,13 +246,13 @@ SwAutoCompleteWord::~SwAutoCompleteWord() } delete pImpl; #if OSL_DEBUG_LEVEL > 1 - ULONG nStrings = SwAutoCompleteString::GetElementCount(); - ULONG nClients = SwAutoCompleteClient::GetElementCount(); + sal_uLong nStrings = SwAutoCompleteString::GetElementCount(); + sal_uLong nClients = SwAutoCompleteClient::GetElementCount(); DBG_ASSERT(!nStrings && !nClients, "AutoComplete: clients or string count mismatch"); #endif } -BOOL SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc ) +sal_Bool SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc ) { SwDocShell* pDocShell = rDoc.GetDocShell(); SfxMedium* pMedium = pDocShell ? pDocShell->GetMedium() : 0; @@ -269,7 +269,7 @@ BOOL SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc ) aNewWord.EraseAllChars( CH_TXTATR_BREAKWORD ); pImpl->AddDocument(rDoc); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; xub_StrLen nWrdLen = aNewWord.Len(); while( nWrdLen && '.' == aNewWord.GetChar( nWrdLen-1 )) --nWrdLen; @@ -279,10 +279,10 @@ BOOL SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc ) SwAutoCompleteString* pAutoString; StringPtr pNew = pAutoString = new SwAutoCompleteString( aNewWord, 0, nWrdLen ); pAutoString->AddDocument(rDoc); - USHORT nInsPos; + sal_uInt16 nInsPos; if( aWordLst.Insert( pNew, nInsPos ) ) { - bRet = TRUE; + bRet = sal_True; if( aLRULst.Count() < nMaxCount ) aLRULst.Insert( pNew, 0 ); else @@ -322,15 +322,15 @@ BOOL SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc ) return bRet; } -void SwAutoCompleteWord::SetMaxCount( USHORT nNewMax ) +void SwAutoCompleteWord::SetMaxCount( sal_uInt16 nNewMax ) { if( nNewMax < nMaxCount && aLRULst.Count() > nNewMax ) { // dann die unten ueberhaengenden entfernen - USHORT nLRUIndex = nNewMax-1; + sal_uInt16 nLRUIndex = nNewMax-1; while( nNewMax < aWordLst.Count() && nLRUIndex < aLRULst.Count()) { - USHORT nPos = aWordLst.GetPos( (String*)aLRULst[ nLRUIndex++ ] ); + sal_uInt16 nPos = aWordLst.GetPos( (String*)aLRULst[ nLRUIndex++ ] ); OSL_ENSURE( USHRT_MAX != nPos, "String nicht gefunden" ); void * pDel = aWordLst[nPos]; aWordLst.Remove(nPos); @@ -341,7 +341,7 @@ void SwAutoCompleteWord::SetMaxCount( USHORT nNewMax ) nMaxCount = nNewMax; } -void SwAutoCompleteWord::SetMinWordLen( USHORT n ) +void SwAutoCompleteWord::SetMinWordLen( sal_uInt16 n ) { // will man wirklich alle Worte, die kleiner als die neue Min Laenge // sind entfernen? @@ -350,13 +350,13 @@ void SwAutoCompleteWord::SetMinWordLen( USHORT n ) // JP 11.03.99 - mal testhalber eingebaut if( n < nMinWrdLen ) { - for( USHORT nPos = 0; nPos < aWordLst.Count(); ++nPos ) + for( sal_uInt16 nPos = 0; nPos < aWordLst.Count(); ++nPos ) if( aWordLst[ nPos ]->Len() < n ) { void* pDel = aWordLst[ nPos ]; aWordLst.Remove(nPos); - USHORT nDelPos = aLRULst.GetPos( pDel ); + sal_uInt16 nDelPos = aLRULst.GetPos( pDel ); OSL_ENSURE( USHRT_MAX != nDelPos, "String nicht gefunden" ); aLRULst.Remove( nDelPos ); --nPos; @@ -367,8 +367,8 @@ void SwAutoCompleteWord::SetMinWordLen( USHORT n ) nMinWrdLen = n; } -BOOL SwAutoCompleteWord::GetRange( const String& rWord, USHORT& rStt, - USHORT& rEnd ) const +sal_Bool SwAutoCompleteWord::GetRange( const String& rWord, sal_uInt16& rStt, + sal_uInt16& rEnd ) const { const StringPtr pStr = (StringPtr)&rWord; aWordLst.Seek_Entry( pStr, &rStt ); @@ -383,8 +383,8 @@ BOOL SwAutoCompleteWord::GetRange( const String& rWord, USHORT& rStt, void SwAutoCompleteWord::CheckChangedList( const SvStringsISortDtor& rNewLst ) { - USHORT nMyLen = aWordLst.Count(), nNewLen = rNewLst.Count(); - USHORT nMyPos = 0, nNewPos = 0; + sal_uInt16 nMyLen = aWordLst.Count(), nNewLen = rNewLst.Count(); + sal_uInt16 nMyPos = 0, nNewPos = 0; for( ; nMyPos < nMyLen && nNewPos < nNewLen; ++nMyPos, ++nNewPos ) { @@ -394,7 +394,7 @@ void SwAutoCompleteWord::CheckChangedList( const SvStringsISortDtor& rNewLst ) void* pDel = aWordLst[ nMyPos ]; aWordLst.Remove(nMyPos); - USHORT nPos = aLRULst.GetPos( pDel ); + sal_uInt16 nPos = aLRULst.GetPos( pDel ); OSL_ENSURE( USHRT_MAX != nPos, "String nicht gefunden" ); aLRULst.Remove( nPos ); delete (SwAutoCompleteString*)pDel; @@ -409,7 +409,7 @@ void SwAutoCompleteWord::CheckChangedList( const SvStringsISortDtor& rNewLst ) for( ; nNewPos < nMyLen; ++nNewPos ) { void* pDel = aWordLst[ nNewPos ]; - USHORT nPos = aLRULst.GetPos( pDel ); + sal_uInt16 nPos = aLRULst.GetPos( pDel ); OSL_ENSURE( USHRT_MAX != nPos, "String nicht gefunden" ); aLRULst.Remove( nPos ); delete (SwAutoCompleteString*)pDel; @@ -425,13 +425,13 @@ void SwAutoCompleteWord::DocumentDying(const SwDoc& rDoc) SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get()->GetAutoCorrect(); const sal_Bool bDelete = !pACorr->GetSwFlags().bAutoCmpltKeepList; - for(USHORT nPos = aWordLst.Count(); nPos; nPos--) + for(sal_uInt16 nPos = aWordLst.Count(); nPos; nPos--) { SwAutoCompleteString* pCurrent = (SwAutoCompleteString*)aWordLst[ nPos - 1 ]; if(pCurrent->RemoveDocument(rDoc) && bDelete) { aWordLst.Remove( nPos - 1 ); - USHORT nLRUPos = aLRULst.GetPos( (void*)pCurrent ); + sal_uInt16 nLRUPos = aLRULst.GetPos( (void*)pCurrent ); DBG_ASSERT(nLRUPos < USHRT_MAX, "word not found in LRU list" ); aLRULst.Remove( nLRUPos ); delete pCurrent; diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index ec4560da5492..2bf98e0576ba 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -43,6 +43,7 @@ #include <docary.hxx> #include <swundo.hxx> #include <undobj.hxx> +#include <numrule.hxx> #include <doc.hxx> #include <frmfmt.hxx> #include <fmtanchr.hxx> @@ -119,15 +120,15 @@ SW_DLLPUBLIC const char * dbg_out(const ::rtl::OUString & aStr) struct CompareUShort { - bool operator()(USHORT a, USHORT b) const + bool operator()(sal_uInt16 a, sal_uInt16 b) const { return a < b; } }; -map<USHORT,String,CompareUShort> & GetItemWhichMap() +map<sal_uInt16,String,CompareUShort> & GetItemWhichMap() { - static map<USHORT,String,CompareUShort> aItemWhichMap; + static map<sal_uInt16,String,CompareUShort> aItemWhichMap; static bool bInitialized = false; if (! bInitialized) @@ -343,7 +344,7 @@ const String lcl_dbg_out(const SwpHints & rHints) { String aStr("[ SwpHints\n", RTL_TEXTENCODING_ASCII_US); - for (USHORT i = 0; i < rHints.Count(); i++) + for (sal_uInt16 i = 0; i < rHints.Count(); i++) { aStr += String(" ", RTL_TEXTENCODING_ASCII_US); aStr += lcl_dbg_out(*rHints[i]); @@ -474,7 +475,7 @@ const String lcl_AnchoredFrames(const SwNode & rNode) if (pFrmFmts) { bool bFirst = true; - for (USHORT nI = 0; nI < pFrmFmts->Count(); nI++) + for (sal_uInt16 nI = 0; nI < pFrmFmts->Count(); nI++) { const SwFmtAnchor & rAnchor = (*pFrmFmts)[nI]->GetAnchor(); const SwPosition * pPos = rAnchor.GetCntntAnchor(); @@ -603,7 +604,7 @@ String lcl_dbg_out(const SwNode & rNode) const SfxPoolItem * pItem = NULL; if (pAttrSet && SFX_ITEM_SET == - pAttrSet->GetItemState(RES_PARATR_NUMRULE, FALSE, &pItem)) + pAttrSet->GetItemState(RES_PARATR_NUMRULE, sal_False, &pItem)) { aTmpStr += String("(", RTL_TEXTENCODING_ASCII_US); aTmpStr += @@ -616,7 +617,7 @@ String lcl_dbg_out(const SwNode & rNode) aTmpStr += String("</rule>", RTL_TEXTENCODING_ASCII_US); if (pTxtNode->GetActualListLevel() > 0) - pNumFmt = pNumRule->GetNumFmt( static_cast< USHORT >(pTxtNode->GetActualListLevel()) ); + pNumFmt = pNumRule->GetNumFmt( static_cast< sal_uInt16 >(pTxtNode->GetActualListLevel()) ); if (pNumFmt) { @@ -722,7 +723,7 @@ SW_DLLPUBLIC const char * dbg_out(const SwTxtNode * pNode) return NULL; } -BOOL lcl_dbg_add_node(const SwNodePtr & pNode, void * pArgs) +sal_Bool lcl_dbg_add_node(const SwNodePtr & pNode, void * pArgs) { if (pNode) { @@ -731,10 +732,10 @@ BOOL lcl_dbg_add_node(const SwNodePtr & pNode, void * pArgs) } //MBA: this code didn't compile, needed to add a return value - return TRUE; + return sal_True; } -void lcl_dbg_nodes_inner(String & aStr, SwNodes & rNodes, ULONG & nIndex) +void lcl_dbg_nodes_inner(String & aStr, SwNodes & rNodes, sal_uLong & nIndex) { SwNode * pNode = rNodes[nIndex]; SwStartNode * pStartNode = dynamic_cast<SwStartNode *> (pNode); @@ -743,8 +744,8 @@ void lcl_dbg_nodes_inner(String & aStr, SwNodes & rNodes, ULONG & nIndex) if (pStartNode != NULL) pEndNode = pStartNode->EndOfSectionNode(); - ULONG nCount = rNodes.Count(); - ULONG nStartIndex = nIndex; + sal_uLong nCount = rNodes.Count(); + sal_uLong nStartIndex = nIndex; bool bDone = false; @@ -787,8 +788,8 @@ String lcl_dbg_out(SwNodes & rNodes) { String aStr("<nodes-array>", RTL_TEXTENCODING_ASCII_US); - ULONG nIndex = 0; - ULONG nCount = rNodes.Count(); + sal_uLong nIndex = 0; + sal_uLong nCount = rNodes.Count(); while (nIndex < nCount) { @@ -809,43 +810,10 @@ String lcl_dbg_out(const SwUndo & rUndo) { String aStr("[ ", RTL_TEXTENCODING_ASCII_US); - aStr += String::CreateFromInt32(rUndo.GetId()); + aStr += String::CreateFromInt32( + static_cast<SfxUndoAction const&>(rUndo).GetId()); aStr += String(": ", RTL_TEXTENCODING_ASCII_US); - switch(rUndo.GetId()) - { - case UNDO_START: - aStr += String(", ", RTL_TEXTENCODING_ASCII_US); - aStr += - String::CreateFromInt32(dynamic_cast - <const SwUndoStart &>(rUndo). - GetUserId()); - aStr += String(", ", RTL_TEXTENCODING_ASCII_US); - aStr += String::CreateFromInt32(dynamic_cast - <const SwUndoStart &>(rUndo). - GetEndOffset()); - aStr += String(" ", RTL_TEXTENCODING_ASCII_US); - - break; - - case UNDO_END: - aStr += String(", ", RTL_TEXTENCODING_ASCII_US); - aStr += - String::CreateFromInt32(dynamic_cast - <const SwUndoEnd &>(rUndo). - GetId()); - aStr += String(", ", RTL_TEXTENCODING_ASCII_US); - aStr += String::CreateFromInt32(dynamic_cast - <const SwUndoEnd &>(rUndo). - GetSttOffset()); - aStr += String(" ", RTL_TEXTENCODING_ASCII_US); - - break; - - default: - break; - } - aStr += rUndo.GetComment(); aStr += String(" ]", RTL_TEXTENCODING_ASCII_US); @@ -861,7 +829,7 @@ String lcl_dbg_out(SwOutlineNodes & rNodes) { String aStr("[\n", RTL_TEXTENCODING_ASCII_US); - for (USHORT i = 0; i < rNodes.Count(); i++) + for (sal_uInt16 i = 0; i < rNodes.Count(); i++) { aStr += lcl_dbg_out(*rNodes[i]); aStr += String("\n", RTL_TEXTENCODING_ASCII_US); @@ -877,39 +845,6 @@ SW_DLLPUBLIC const char * dbg_out(SwOutlineNodes & rNodes) return dbg_out(lcl_dbg_out(rNodes)); } -String lcl_dbg_out(const SwUndos & rUndos) -{ - USHORT nIndent = 0; - - String aStr("[\n", RTL_TEXTENCODING_ASCII_US); - - for (USHORT n = 0; n < rUndos.Count(); n++) - { - SwUndo * pUndo = rUndos[n]; - - if (pUndo->GetId() == UNDO_END) - nIndent--; - - for (USHORT nI = 0; n < nIndent; nI++) - aStr += String(" ", RTL_TEXTENCODING_ASCII_US); - - aStr += lcl_dbg_out(*pUndo); - aStr += String("\n", RTL_TEXTENCODING_ASCII_US); - - if (pUndo->GetId() == UNDO_START) - nIndent++; - } - - aStr += String("]\n", RTL_TEXTENCODING_ASCII_US); - - return aStr; -} - -SW_DLLPUBLIC const char * dbg_out(const SwUndos & rUndos) -{ - return dbg_out(lcl_dbg_out(rUndos)); -} - String lcl_dbg_out(const SwRewriter & rRewriter) { (void) rRewriter; @@ -941,7 +876,7 @@ String lcl_dbg_out(const SwNumRule & rRule) aResult += rRule.GetName(); aResult += String(" [", RTL_TEXTENCODING_ASCII_US); - for (BYTE n = 0; n < MAXLEVEL; n++) + for (sal_uInt8 n = 0; n < MAXLEVEL; n++) { if (n > 0) aResult += String(", ", RTL_TEXTENCODING_ASCII_US); @@ -991,7 +926,7 @@ String lcl_dbg_out(const SwNumRuleTbl & rTbl) { String aResult("[", RTL_TEXTENCODING_ASCII_US); - for (USHORT n = 0; n < rTbl.Count(); n++) + for (sal_uInt16 n = 0; n < rTbl.Count(); n++) { if (n > 0) aResult += String(", ", RTL_TEXTENCODING_ASCII_US); diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 0c0a92a84620..43cbc83ec773 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -28,7 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <doc.hxx> +#include <UndoManager.hxx> #include <hintids.hxx> #include <tools/shl.hxx> @@ -80,7 +82,10 @@ #include <pam.hxx> #include <ndtxt.hxx> #include <swundo.hxx> // fuer die UndoIds -#include <undobj.hxx> +#include <UndoCore.hxx> +#include <UndoInsert.hxx> +#include <UndoSplitMove.hxx> +#include <UndoTable.hxx> #include <pagedesc.hxx> //DTor #include <breakit.hxx> #include <ndole.hxx> @@ -100,7 +105,6 @@ #include <fldupde.hxx> #include <swbaslnk.hxx> #include <printdata.hxx> -#include <swprtopt.hxx> #include <cmdid.h> // fuer den dflt - Printer in SetJob #include <statstr.hrc> // StatLine-String #include <comcore.hrc> @@ -113,6 +117,8 @@ #include <viewsh.hxx> #include <shellres.hxx> #include <txtfrm.hxx> +#include <wdocsh.hxx> // SwWebDocShell +#include <prtopt.hxx> // SwPrintOptions #include <vector> #include <map> @@ -199,6 +205,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const case PURGE_OLE: return mbPurgeOLE; case KERN_ASIAN_PUNCTUATION: return mbKernAsianPunctuation; case DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: return mbDoNotResetParaAttrsForNumFont; + case MATH_BASELINE_ALIGNMENT: return mbMathBaselineAlignment; default: OSL_ENSURE(false, "Invalid setting id"); } @@ -237,8 +244,8 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) mbOldNumbering = value; const SwNumRuleTbl& rNmTbl = GetNumRuleTbl(); - for( USHORT n = 0; n < rNmTbl.Count(); ++n ) - rNmTbl[n]->SetInvalidRule(TRUE); + for( sal_uInt16 n = 0; n < rNmTbl.Count(); ++n ) + rNmTbl[n]->SetInvalidRule(sal_True); UpdateNumRule(); @@ -352,24 +359,26 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) case DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: mbDoNotResetParaAttrsForNumFont = value; break; - + case MATH_BASELINE_ALIGNMENT: + mbMathBaselineAlignment = value; + break; default: OSL_ENSURE(false, "Invalid setting id"); } } const i18n::ForbiddenCharacters* - SwDoc::getForbiddenCharacters(/*[in]*/ USHORT nLang, /*[in]*/ bool bLocaleData ) const + SwDoc::getForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ bool bLocaleData ) const { const i18n::ForbiddenCharacters* pRet = 0; if( xForbiddenCharsTable.is() ) - pRet = xForbiddenCharsTable->GetForbiddenCharacters( nLang, FALSE ); + pRet = xForbiddenCharsTable->GetForbiddenCharacters( nLang, sal_False ); if( bLocaleData && !pRet && pBreakIt ) pRet = &pBreakIt->GetForbidden( (LanguageType)nLang ); return pRet; } -void SwDoc::setForbiddenCharacters(/*[in]*/ USHORT nLang, +void SwDoc::setForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ const i18n::ForbiddenCharacters& rFChars ) { if( !xForbiddenCharsTable.is() ) @@ -451,7 +460,7 @@ void SwDoc::setCharacterCompressionType( /*[in]*/SwCharCompressType n ) eChrCmprType = n; if( pDrawModel ) { - pDrawModel->SetCharCompressType( static_cast<UINT16>(n) ); + pDrawModel->SetCharCompressType( static_cast<sal_uInt16>(n) ); if( !mbInReading ) pDrawModel->ReformatAllTextObjects(); } @@ -594,8 +603,8 @@ const JobSetup* SwDoc::getJobsetup() const void SwDoc::setJobsetup(/*[in]*/ const JobSetup &rJobSetup ) { - BOOL bCheckPageDescs = 0 == pPrt; - BOOL bDataChanged = FALSE; + sal_Bool bCheckPageDescs = 0 == pPrt; + sal_Bool bDataChanged = sal_False; if ( pPrt ) { @@ -604,7 +613,7 @@ void SwDoc::setJobsetup(/*[in]*/ const JobSetup &rJobSetup ) if ( pPrt->GetJobSetup() != rJobSetup ) { pPrt->SetJobSetup( rJobSetup ); - bDataChanged = TRUE; + bDataChanged = sal_True; } } else @@ -626,18 +635,30 @@ void SwDoc::setJobsetup(/*[in]*/ const JobSetup &rJobSetup ) else { pPrt = p; - bDataChanged = TRUE; + bDataChanged = sal_True; } } if ( bDataChanged && !get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) ) PrtDataChanged(); } -SwPrintData* SwDoc::getPrintData() const +const SwPrintData & SwDoc::getPrintData() const { if(!pPrtData) - ((SwDoc*)this)->pPrtData = new SwPrintData; - return pPrtData; + { + SwDoc * pThis = const_cast< SwDoc * >(this); + pThis->pPrtData = new SwPrintData; + + // SwPrintData should be initialized from the configuration, + // the respective config item is implememted by SwPrintOptions which + // is also derived from SwPrintData + const SwDocShell *pDocSh = GetDocShell(); + DBG_ASSERT( pDocSh, "pDocSh is 0, can't determine if this is a WebDoc or not" ); + bool bWeb = 0 != dynamic_cast< const SwWebDocShell * >(pDocSh); + SwPrintOptions aPrintOptions( bWeb ); + *pThis->pPrtData = aPrintOptions; + } + return *pPrtData; } void SwDoc::setPrintData(/*[in]*/ const SwPrintData& rPrtData ) @@ -677,14 +698,14 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart ) } SwUndoSplitNode* pUndo = 0; - if ( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); // einfuegen vom Undo-Object, z.Z. nur beim TextNode if( pNode->IsTxtNode() ) { pUndo = new SwUndoSplitNode( this, rPos, bChkTableStart ); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } } @@ -694,7 +715,7 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart ) // einen Absatz ein if( bChkTableStart && !rPos.nContent.GetIndex() && pNode->IsTxtNode() ) { - ULONG nPrevPos = rPos.nNode.GetIndex() - 1; + sal_uLong nPrevPos = rPos.nNode.GetIndex() - 1; const SwTableNode* pTblNd; const SwNode* pNd = GetNodes()[ nPrevPos ]; if( pNd->IsStartNode() && @@ -717,8 +738,8 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart ) { // Dann nur, wenn die Tabelle Umbrueche traegt! const SwFrmFmt* pFrmFmt = pTblNd->GetTable().GetFrmFmt(); - if( SFX_ITEM_SET != pFrmFmt->GetItemState(RES_PAGEDESC, FALSE) && - SFX_ITEM_SET != pFrmFmt->GetItemState( RES_BREAK, FALSE ) ) + if( SFX_ITEM_SET != pFrmFmt->GetItemState(RES_PAGEDESC, sal_False) && + SFX_ITEM_SET != pFrmFmt->GetItemState( RES_BREAK, sal_False ) ) pNd = 0; } } @@ -739,13 +760,13 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart ) SwFrmFmt* pFrmFmt = pTblNd->GetTable().GetFrmFmt(); const SfxPoolItem *pItem; if( SFX_ITEM_SET == pFrmFmt->GetItemState( RES_PAGEDESC, - FALSE, &pItem ) ) + sal_False, &pItem ) ) { pTxtNd->SetAttr( *pItem ); pFrmFmt->ResetFmtAttr( RES_PAGEDESC ); } if( SFX_ITEM_SET == pFrmFmt->GetItemState( RES_BREAK, - FALSE, &pItem ) ) + sal_False, &pItem ) ) { pTxtNd->SetAttr( *pItem ); pFrmFmt->ResetFmtAttr( RES_BREAK ); @@ -771,7 +792,7 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart ) { // verschiebe noch alle Bookmarks/TOXMarks/FlyAtCnt if( aBkmkArr.Count() ) - _RestoreCntntIdx( this, aBkmkArr, rPos.nNode.GetIndex()-1, 0, TRUE ); + _RestoreCntntIdx( this, aBkmkArr, rPos.nNode.GetIndex()-1, 0, sal_True ); if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() )) { @@ -791,10 +812,8 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart ) bool SwDoc::AppendTxtNode( SwPosition& rPos ) { - /* - * Neuen Node vor EndOfContent erzeugen. - */ - SwTxtNode *pCurNode = GetNodes()[ rPos.nNode ]->GetTxtNode(); + // create new node before EndOfContent + SwTxtNode * pCurNode = rPos.nNode.GetNode().GetTxtNode(); if( !pCurNode ) { // dann kann ja einer angelegt werden! @@ -808,10 +827,9 @@ bool SwDoc::AppendTxtNode( SwPosition& rPos ) rPos.nNode++; rPos.nContent.Assign( pCurNode, 0 ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoInsert( rPos.nNode )); + GetIDocumentUndoRedo().AppendUndo( new SwUndoInsert( rPos.nNode ) ); } if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() )) @@ -826,15 +844,15 @@ bool SwDoc::AppendTxtNode( SwPosition& rPos ) } SetModified(); - return TRUE; + return sal_True; } bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr, const enum InsertFlags nInsertMode ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); // AppendUndo not always called! } const SwPosition& rPos = *rRg.GetPoint(); @@ -856,15 +874,16 @@ bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr, SwDataChanged aTmp( rRg, 0 ); - if( !DoesUndo() || !DoesGroupUndo() ) + if (!GetIDocumentUndoRedo().DoesUndo() || + !GetIDocumentUndoRedo().DoesGroupUndo()) { pNode->InsertText( rStr, rPos.nContent, nInsertMode ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndoInsert * const pUndo( new SwUndoInsert( rPos.nNode, rPos.nContent.GetIndex(), rStr.Len(), nInsertMode)); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } } else @@ -874,25 +893,12 @@ bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr, // don't group the start if hints at the start should be expanded if (!(nInsertMode & IDocumentContentOperations::INS_FORCEHINTEXPAND)) { - USHORT const nUndoSize = pUndos->Count(); - if (0 != nUndoSize) + SwUndo *const pLastUndo = GetUndoManager().GetLastUndo(); + SwUndoInsert *const pUndoInsert( + dynamic_cast<SwUndoInsert *>(pLastUndo) ); + if (pUndoInsert && pUndoInsert->CanGrouping(rPos)) { - SwUndo * const pLastUndo = (*pUndos)[ nUndoSize - 1 ]; - - switch (pLastUndo->GetId()) - { - case UNDO_INSERT: - case UNDO_TYPING: - if (static_cast<SwUndoInsert*>(pLastUndo) - ->CanGrouping( rPos )) - { - pUndo = static_cast<SwUndoInsert*>(pLastUndo); - } - break; - - default: - break; - } + pUndo = pUndoInsert; } } @@ -903,7 +909,7 @@ bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr, { pUndo = new SwUndoInsert( rPos.nNode, nInsPos, 0, nInsertMode, !rCC.isLetterNumeric( rStr, 0 ) ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } pNode->InsertText( rStr, rPos.nContent, nInsertMode ); @@ -911,12 +917,12 @@ bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr, for( xub_StrLen i = 0; i < rStr.Len(); ++i ) { nInsPos++; - // wenn CanGrouping() TRUE returnt, ist schon alles erledigt + // wenn CanGrouping() sal_True returnt, ist schon alles erledigt if( !pUndo->CanGrouping( rStr.GetChar( i ) )) { pUndo = new SwUndoInsert( rPos.nNode, nInsPos, 1, nInsertMode, !rCC.isLetterNumeric( rStr, i ) ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } } } @@ -993,7 +999,7 @@ SwFlyFrmFmt* SwDoc::Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, { if( !pFrmFmt ) { - USHORT nId = RES_POOLFRM_OLE; + sal_uInt16 nId = RES_POOLFRM_OLE; SvGlobalName aClassName( xObj->getClassID() ); if (SotExchange::IsMath(aClassName)) nId = RES_POOLFRM_FORMEL; @@ -1032,9 +1038,9 @@ SwFlyFrmFmt* SwDoc::InsertOLE(const SwPaM &rRg, const String& rObjName, |* SwDoc::GetFldType() |* Beschreibung: liefert den am Doc eingerichteten Feldtypen zurueck *************************************************************************/ -SwFieldType *SwDoc::GetSysFldType( const USHORT eWhich ) const +SwFieldType *SwDoc::GetSysFldType( const sal_uInt16 eWhich ) const { - for( USHORT i = 0; i < INIT_FLDTYPES; ++i ) + for( sal_uInt16 i = 0; i < INIT_FLDTYPES; ++i ) if( eWhich == (*pFldTypes)[i]->Which() ) return (*pFldTypes)[i]; return 0; @@ -1058,9 +1064,9 @@ struct _PostItFld : public _SetGetExpFld _PostItFld( const SwNodeIndex& rNdIdx, const SwTxtFld* pFld, const SwIndex* pIdx = 0 ) : _SetGetExpFld( rNdIdx, pFld, pIdx ) {} - USHORT GetPageNo( const StringRangeEnumerator &rRangeEnum, + sal_uInt16 GetPageNo( const StringRangeEnumerator &rRangeEnum, const std::set< sal_Int32 > &rPossiblePages, - USHORT& rVirtPgNo, USHORT& rLineNo ); + sal_uInt16& rVirtPgNo, sal_uInt16& rLineNo ); SwPostItField* GetPostIt() const { @@ -1068,10 +1074,10 @@ struct _PostItFld : public _SetGetExpFld } }; -USHORT _PostItFld::GetPageNo( +sal_uInt16 _PostItFld::GetPageNo( const StringRangeEnumerator &rRangeEnum, const std::set< sal_Int32 > &rPossiblePages, - /* out */ USHORT& rVirtPgNo, /* out */ USHORT& rLineNo ) + /* out */ sal_uInt16& rVirtPgNo, /* out */ sal_uInt16& rLineNo ) { //Problem: Wenn ein PostItFld in einem Node steht, der von mehr als //einer Layout-Instanz repraesentiert wird, steht die Frage im Raum, @@ -1080,7 +1086,7 @@ USHORT _PostItFld::GetPageNo( //sondern die des ersten Auftretens des PostIts innerhalb des selektierten //Bereichs ermittelt werden. rVirtPgNo = 0; - USHORT nPos = GetCntnt(); + sal_uInt16 nPos = GetCntnt(); SwClientIter aIter( (SwModify &)GetFld()->GetTxtNode() ); for( SwTxtFrm* pFrm = (SwTxtFrm*)aIter.First( TYPE( SwFrm )); pFrm; pFrm = (SwTxtFrm*)aIter.Next() ) @@ -1088,10 +1094,10 @@ USHORT _PostItFld::GetPageNo( if( pFrm->GetOfst() > nPos || (pFrm->HasFollow() && pFrm->GetFollow()->GetOfst() <= nPos) ) continue; - USHORT nPgNo = pFrm->GetPhyPageNum(); + sal_uInt16 nPgNo = pFrm->GetPhyPageNum(); if( rRangeEnum.hasValue( nPgNo, &rPossiblePages )) { - rLineNo = (USHORT)(pFrm->GetLineCount( nPos ) + + rLineNo = (sal_uInt16)(pFrm->GetLineCount( nPos ) + pFrm->GetAllLines() - pFrm->GetThisLines()); rVirtPgNo = pFrm->GetVirtPageNum(); return nPgNo; @@ -1142,7 +1148,7 @@ static void lcl_FormatPostIt( SwPaM& aPam, SwPostItField* pField, bool bNewPage, bool bIsFirstPostIt, - USHORT nPageNo, USHORT nLineNo ) + sal_uInt16 nPageNo, sal_uInt16 nLineNo ) { static char const sTmp[] = " : "; @@ -1182,7 +1188,7 @@ static void lcl_FormatPostIt( pIDCO->SplitNode( *aPam.GetPoint(), false ); aStr = pField->GetPar2(); -#if defined( WIN ) || defined( WNT ) || defined( PM2 ) +#if defined( WNT ) || defined( PM2 ) // Bei Windows und Co alle CR rausschmeissen aStr.EraseAllChars( '\r' ); #endif @@ -1197,7 +1203,7 @@ static sal_Int32 lcl_GetPaperBin( const SwPageFrm *pStartFrm ) const SwFrmFmt &rFmt = pStartFrm->GetPageDesc()->GetMaster(); const SfxPoolItem *pItem = NULL; - SfxItemState eState = rFmt.GetItemState( RES_PAPER_BIN, FALSE, &pItem ); + SfxItemState eState = rFmt.GetItemState( RES_PAPER_BIN, sal_False, &pItem ); const SvxPaperBinItem *pPaperBinItem = dynamic_cast< const SvxPaperBinItem * >(pItem); if (eState > SFX_ITEM_DEFAULT && pPaperBinItem) nRes = pPaperBinItem->GetValue(); @@ -1234,30 +1240,30 @@ void SwDoc::CalculatePagesForPrinting( const SwPageFrm *pStPage = (SwPageFrm*)pLayout->Lower(); const SwFrm *pEndPage = pStPage; - USHORT nFirstPageNo = 0; - USHORT nLastPageNo = 0; + sal_uInt16 nFirstPageNo = 0; + sal_uInt16 nLastPageNo = 0; - for( USHORT i = 1; i <= (USHORT)aPages.Max(); ++i ) + for( sal_uInt16 i = 1; i <= (sal_uInt16)aPages.Max(); ++i ) { - if( i < (USHORT)aPages.Min() ) + if( i < (sal_uInt16)aPages.Min() ) { if( !pStPage->GetNext() ) break; pStPage = (SwPageFrm*)pStPage->GetNext(); pEndPage= pStPage; } - else if( i == (USHORT)aPages.Min() ) + else if( i == (sal_uInt16)aPages.Min() ) { nFirstPageNo = i; nLastPageNo = nFirstPageNo; - if( !pStPage->GetNext() || (i == (USHORT)aPages.Max()) ) + if( !pStPage->GetNext() || (i == (sal_uInt16)aPages.Max()) ) break; pEndPage = pStPage->GetNext(); } - else if( i > (USHORT)aPages.Min() ) + else if( i > (sal_uInt16)aPages.Min() ) { nLastPageNo = i; - if( !pEndPage->GetNext() || (i == (USHORT)aPages.Max()) ) + if( !pEndPage->GetNext() || (i == (sal_uInt16)aPages.Max()) ) break; pEndPage = pEndPage->GetNext(); } @@ -1270,7 +1276,7 @@ void SwDoc::CalculatePagesForPrinting( // geschaffen werden, alle Seiten von Seite x an zu deselektieren. // Z.B. durch SetTotalRange .... -// aMulti.Select( Range( nLastPageNo+1, SELECTION_MAX ), FALSE ); +// aMulti.Select( Range( nLastPageNo+1, SELECTION_MAX ), sal_False ); MultiSelection aTmpMulti( Range( 1, nLastPageNo ) ); long nTmpIdx = aMulti.FirstSelected(); static long nEndOfSelection = SFX_ENDOFSELECTION; @@ -1282,7 +1288,7 @@ void SwDoc::CalculatePagesForPrinting( aMulti = aTmpMulti; // Ende des HACKs - USHORT nPageNo = nFirstPageNo; + sal_uInt16 nPageNo = nFirstPageNo; std::map< sal_Int32, sal_Int32 > &rPrinterPaperTrays = rData.GetPrinterPaperTrays(); std::set< sal_Int32 > &rValidPages = rData.GetValidPagesSet(); @@ -1291,7 +1297,7 @@ void SwDoc::CalculatePagesForPrinting( rValidStartFrms.clear(); while ( pStPage ) { - const BOOL bRightPg = pStPage->OnRightPage(); + const sal_Bool bRightPg = pStPage->OnRightPage(); if ( aMulti.IsSelected( nPageNo ) && ( (bRightPg && bPrintRightPages) || (!bRightPg && bPrintLeftPages) ) ) @@ -1373,7 +1379,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( sal_Int16 nPostItMode = (sal_Int16) rOptions.getIntValue( "PrintAnnotationMode", 0 ); DBG_ASSERT(nPostItMode == POSTITS_NONE || rData.HasPostItData(), "print post-its without post-it data?" ); - const USHORT nPostItCount = rData.HasPostItData() ? rData.m_pPostItFields->Count() : 0; + const sal_uInt16 nPostItCount = rData.HasPostItData() ? rData.m_pPostItFields->Count() : 0; if (nPostItMode != POSTITS_NONE && nPostItCount > 0) { SET_CURR_SHELL( rData.m_pPostItShell ); @@ -1397,9 +1403,9 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( // temporary post-it document. // Since the array of post-it fileds is sorted by page and line number we will // already get them in the correct order - USHORT nVirtPg = 0, nLineNo = 0, nLastPageNum = 0, nPhyPageNum = 0; + sal_uInt16 nVirtPg = 0, nLineNo = 0, nLastPageNum = 0, nPhyPageNum = 0; bool bIsFirstPostIt = true; - for (USHORT i = 0; i < nPostItCount; ++i) + for (sal_uInt16 i = 0; i < nPostItCount; ++i) { _PostItFld& rPostIt = (_PostItFld&)*(*rData.m_pPostItFields)[ i ]; nLastPageNum = nPhyPageNum; @@ -1639,7 +1645,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // dann sorge mal dafuer, das alle Seiten in der richtigen // Reihenfolge stehen: - USHORT nSPg = 0, nEPg = aVec.size(), nStep = 1; + sal_uInt16 nSPg = 0, nEPg = aVec.size(), nStep = 1; if ( 0 == (nEPg & 1 )) // ungerade gibt es nicht! --nEPg; @@ -1654,7 +1660,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // the number of 'virtual' pages to be printed sal_Int32 nCntPage = (( nEPg - nSPg ) / ( 2 * nStep )) + 1; - for ( USHORT nPrintCount = 0; nSPg < nEPg && + for ( sal_uInt16 nPrintCount = 0; nSPg < nEPg && nPrintCount < nCntPage; ++nPrintCount ) { pStPage = aVec[ nSPg ]; @@ -1733,7 +1739,7 @@ void SwDoc::UpdateDocStat( SwDocStat& rStat ) rStat.nPara = 0; // Default ist auf 1 !! SwNode* pNd; - for( ULONG i = GetNodes().Count(); i; ) + for( sal_uLong i = GetNodes().Count(); i; ) { switch( ( pNd = GetNodes()[ --i ])->GetNodeType() ) { @@ -1766,7 +1772,7 @@ void SwDoc::UpdateDocStat( SwDocStat& rStat ) } rStat.nPage = GetRootFrm() ? GetRootFrm()->GetPageNum() : 0; - rStat.bModified = FALSE; + rStat.bModified = sal_False; SetDocStat( rStat ); com::sun::star::uno::Sequence < com::sun::star::beans::NamedValue > aStat( rStat.nPage ? 7 : 6); @@ -1825,10 +1831,10 @@ void SwDoc::DocInfoChgd( ) const SwFmtRefMark* SwDoc::GetRefMark( const String& rName ) const { const SfxPoolItem* pItem; - USHORT nMaxItems = GetAttrPool().GetItemCount( RES_TXTATR_REFMARK ); - for( USHORT n = 0; n < nMaxItems; ++n ) + sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_REFMARK ); + for( sal_uInt32 n = 0; n < nMaxItems; ++n ) { - if( 0 == (pItem = GetAttrPool().GetItem( RES_TXTATR_REFMARK, n ) )) + if( 0 == (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n ) )) continue; const SwFmtRefMark* pFmtRef = (SwFmtRefMark*)pItem; @@ -1841,16 +1847,16 @@ const SwFmtRefMark* SwDoc::GetRefMark( const String& rName ) const } // returne die RefMark per Index - fuer Uno -const SwFmtRefMark* SwDoc::GetRefMark( USHORT nIndex ) const +const SwFmtRefMark* SwDoc::GetRefMark( sal_uInt16 nIndex ) const { const SfxPoolItem* pItem; const SwTxtRefMark* pTxtRef; const SwFmtRefMark* pRet = 0; - USHORT nMaxItems = GetAttrPool().GetItemCount( RES_TXTATR_REFMARK ); - USHORT nCount = 0; - for( USHORT n = 0; n < nMaxItems; ++n ) - if( 0 != (pItem = GetAttrPool().GetItem( RES_TXTATR_REFMARK, n )) && + sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_REFMARK ); + sal_uInt32 nCount = 0; + for( sal_uInt32 n = 0; n < nMaxItems; ++n ) + if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n )) && 0 != (pTxtRef = ((SwFmtRefMark*)pItem)->GetTxtRefMark()) && &pTxtRef->GetTxtNode().GetNodes() == &GetNodes() ) { @@ -1868,15 +1874,15 @@ const SwFmtRefMark* SwDoc::GetRefMark( USHORT nIndex ) const //JP 24.06.96: Ist der ArrayPointer 0 dann returne nur, ob im Doc. eine // RefMark gesetzt ist // OS 25.06.96: ab jetzt wird immer die Anzahl der Referenzen returnt -USHORT SwDoc::GetRefMarks( SvStringsDtor* pNames ) const +sal_uInt16 SwDoc::GetRefMarks( SvStringsDtor* pNames ) const { const SfxPoolItem* pItem; const SwTxtRefMark* pTxtRef; - USHORT nMaxItems = GetAttrPool().GetItemCount( RES_TXTATR_REFMARK ); - USHORT nCount = 0; - for( USHORT n = 0; n < nMaxItems; ++n ) - if( 0 != (pItem = GetAttrPool().GetItem( RES_TXTATR_REFMARK, n )) && + sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_REFMARK ); + sal_uInt32 nCount = 0; + for( sal_uInt32 n = 0; n < nMaxItems; ++n ) + if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n )) && 0 != (pTxtRef = ((SwFmtRefMark*)pItem)->GetTxtRefMark()) && &pTxtRef->GetTxtNode().GetNodes() == &GetNodes() ) { @@ -1947,13 +1953,13 @@ void SwDoc::SetModified() // Bit 0: -> alter Zustand // Bit 1: -> neuer Zustand long nCall = mbModified ? 3 : 2; - mbModified = TRUE; - pDocStat->bModified = TRUE; + mbModified = sal_True; + pDocStat->bModified = sal_True; if( aOle2Link.IsSet() ) { - mbInCallModified = TRUE; + mbInCallModified = sal_True; aOle2Link.Call( (void*)nCall ); - mbInCallModified = FALSE; + mbInCallModified = sal_False; } if( pACEWord && !pACEWord->IsDeleted() ) @@ -1966,17 +1972,17 @@ void SwDoc::ResetModified() // Bit 0: -> alter Zustand // Bit 1: -> neuer Zustand long nCall = mbModified ? 1 : 0; - mbModified = FALSE; + mbModified = sal_False; // If there is already a document statistic, we assume that // it is correct. In this case we reset the modified flag. if ( 0 != pDocStat->nChar ) - pDocStat->bModified = FALSE; - nUndoSavePos = nUndoPos; + pDocStat->bModified = sal_False; + GetIDocumentUndoRedo().SetUndoNoModifiedPosition(); if( nCall && aOle2Link.IsSet() ) { - mbInCallModified = TRUE; + mbInCallModified = sal_True; aOle2Link.Call( (void*)nCall ); - mbInCallModified = FALSE; + mbInCallModified = sal_False; } } @@ -1989,10 +1995,9 @@ void SwDoc::ReRead( SwPaM& rPam, const String& rGrfName, || rPam.GetPoint()->nNode.GetIndex() == rPam.GetMark()->nNode.GetIndex() ) && 0 != ( pGrfNd = rPam.GetPoint()->nNode.GetNode().GetGrfNode() ) ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoReRead( rPam, *pGrfNd ) ); + GetIDocumentUndoRedo().AppendUndo(new SwUndoReRead(rPam, *pGrfNd)); } // Weil nicht bekannt ist, ob sich die Grafik spiegeln laesst, @@ -2001,15 +2006,15 @@ void SwDoc::ReRead( SwPaM& rPam, const String& rGrfName, GetMirrorGrf().GetValue() ) pGrfNd->SetAttr( SwMirrorGrf() ); - pGrfNd->ReRead( rGrfName, rFltName, pGraphic, pGrafObj, TRUE ); + pGrfNd->ReRead( rGrfName, rFltName, pGraphic, pGrafObj, sal_True ); SetModified(); } } -BOOL lcl_SpellAndGrammarAgain( const SwNodePtr& rpNd, void* pArgs ) +sal_Bool lcl_SpellAndGrammarAgain( const SwNodePtr& rpNd, void* pArgs ) { SwTxtNode *pTxtNode = (SwTxtNode*)rpNd->GetTxtNode(); - BOOL bOnlyWrong = *(BOOL*)pArgs; + sal_Bool bOnlyWrong = *(sal_Bool*)pArgs; if( pTxtNode ) { if( bOnlyWrong ) @@ -2031,13 +2036,13 @@ BOOL lcl_SpellAndGrammarAgain( const SwNodePtr& rpNd, void* pArgs ) pTxtNode->GetGrammarCheck()->SetInvalid( 0, STRING_LEN ); } } - return TRUE; + return sal_True; } -BOOL lcl_CheckSmartTagsAgain( const SwNodePtr& rpNd, void* ) +sal_Bool lcl_CheckSmartTagsAgain( const SwNodePtr& rpNd, void* ) { SwTxtNode *pTxtNode = (SwTxtNode*)rpNd->GetTxtNode(); -// BOOL bOnlyWrong = *(BOOL*)pArgs; +// sal_Bool bOnlyWrong = *(sal_Bool*)pArgs; if( pTxtNode ) { pTxtNode->SetSmartTagDirty( true ); @@ -2049,20 +2054,20 @@ BOOL lcl_CheckSmartTagsAgain( const SwNodePtr& rpNd, void* ) pTxtNode->SetSmartTags( NULL ); } } - return TRUE; + return sal_True; } /************************************************************************* - * SwDoc::SpellItAgainSam( BOOL bInvalid, BOOL bOnlyWrong ) + * SwDoc::SpellItAgainSam( sal_Bool bInvalid, sal_Bool bOnlyWrong ) * * stoesst das Spelling im Idle-Handler wieder an. - * Wird bInvalid als TRUE uebergeben, so werden zusaetzlich die WrongListen + * Wird bInvalid als sal_True uebergeben, so werden zusaetzlich die WrongListen * an allen Nodes invalidiert und auf allen Seiten das SpellInvalid-Flag * gesetzt. * Mit bOnlyWrong kann man dann steuern, ob nur die Bereiche mit falschen * Woertern oder die kompletten Bereiche neu ueberprueft werden muessen. ************************************************************************/ -void SwDoc::SpellItAgainSam( BOOL bInvalid, BOOL bOnlyWrong, BOOL bSmartTags ) +void SwDoc::SpellItAgainSam( sal_Bool bInvalid, sal_Bool bOnlyWrong, sal_Bool bSmartTags ) { OSL_ENSURE( GetRootFrm(), "SpellAgain: Where's my RootFrm?" ); if( bInvalid ) @@ -2097,7 +2102,7 @@ void SwDoc::InvalidateAutoCompleteFlag() pPage->InvalidateAutoCompleteWords(); pPage = (SwPageFrm*)pPage->GetNext(); } - for( ULONG nNd = 1, nCnt = GetNodes().Count(); nNd < nCnt; ++nNd ) + for( sal_uLong nNd = 1, nCnt = GetNodes().Count(); nNd < nCnt; ++nNd ) { SwTxtNode* pTxtNode = GetNodes()[ nNd ]->GetTxtNode(); if ( pTxtNode ) pTxtNode->SetAutoCompleteWordDirty( true ); @@ -2111,9 +2116,9 @@ const SwFmtINetFmt* SwDoc::FindINetAttr( const String& rName ) const const SwFmtINetFmt* pItem; const SwTxtINetFmt* pTxtAttr; const SwTxtNode* pTxtNd; - USHORT n, nMaxItems = GetAttrPool().GetItemCount( RES_TXTATR_INETFMT ); + sal_uInt32 n, nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT ); for( n = 0; n < nMaxItems; ++n ) - if( 0 != (pItem = (SwFmtINetFmt*)GetAttrPool().GetItem( + if( 0 != (pItem = (SwFmtINetFmt*)GetAttrPool().GetItem2( RES_TXTATR_INETFMT, n ) ) && pItem->GetName().Equals( rName ) && 0 != ( pTxtAttr = pItem->GetTxtINetFmt()) && @@ -2126,27 +2131,27 @@ const SwFmtINetFmt* SwDoc::FindINetAttr( const String& rName ) const return 0; } -void SwDoc::Summary( SwDoc* pExtDoc, BYTE nLevel, BYTE nPara, BOOL bImpress ) +void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, sal_Bool bImpress ) { const SwOutlineNodes& rOutNds = GetNodes().GetOutLineNds(); if( pExtDoc && rOutNds.Count() ) { - USHORT i; + sal_uInt16 i; ::StartProgress( STR_STATSTR_SUMMARY, 0, rOutNds.Count(), GetDocShell() ); SwNodeIndex aEndOfDoc( pExtDoc->GetNodes().GetEndOfContent(), -1 ); for( i = 0; i < rOutNds.Count(); ++i ) { ::SetProgressState( i, GetDocShell() ); - const ULONG nIndex = rOutNds[ i ]->GetIndex(); + const sal_uLong nIndex = rOutNds[ i ]->GetIndex(); const int nLvl = ((SwTxtNode*)GetNodes()[ nIndex ])->GetAttrOutlineLevel()-1;//<-end,zhaojianwei if( nLvl > nLevel ) continue; - USHORT nEndOfs = 1; - BYTE nWish = nPara; - ULONG nNextOutNd = i + 1 < rOutNds.Count() ? + sal_uInt16 nEndOfs = 1; + sal_uInt8 nWish = nPara; + sal_uLong nNextOutNd = i + 1 < rOutNds.Count() ? rOutNds[ i + 1 ]->GetIndex() : GetNodes().Count(); - BOOL bKeep = FALSE; + sal_Bool bKeep = sal_False; while( ( nWish || bKeep ) && nIndex + nEndOfs < nNextOutNd && GetNodes()[ nIndex + nEndOfs ]->IsTxtNode() ) { @@ -2168,7 +2173,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, BYTE nLevel, BYTE nPara, BOOL bImpress ) while( aIndx < aEndOfDoc ) { SwNode *pNode; - BOOL bDelete = FALSE; + sal_Bool bDelete = sal_False; if( (pNode = &aIndx.GetNode())->IsTxtNode() ) { SwTxtNode *pNd = (SwTxtNode*)pNode; @@ -2178,7 +2183,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, BYTE nLevel, BYTE nPara, BOOL bImpress ) { SwTxtFmtColl* pMyColl = pNd->GetTxtColl(); - const USHORT nHeadLine = static_cast<USHORT>( + const sal_uInt16 nHeadLine = static_cast<sal_uInt16>( !pMyColl->IsAssignedToListLevelOfOutlineStyle() //<-end,zhaojianwei ? RES_POOLCOLL_HEADLINE2 : RES_POOLCOLL_HEADLINE1 ); @@ -2188,7 +2193,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, BYTE nLevel, BYTE nPara, BOOL bImpress ) if( !pNd->Len() && pNd->StartOfSectionIndex()+2 < pNd->EndOfSectionIndex() ) { - bDelete = TRUE; + bDelete = sal_True; pExtDoc->GetNodes().Delete( aIndx ); } } @@ -2201,10 +2206,10 @@ void SwDoc::Summary( SwDoc* pExtDoc, BYTE nLevel, BYTE nPara, BOOL bImpress ) // loesche den nicht sichtbaren Content aus dem Document, wie z.B.: // versteckte Bereiche, versteckte Absaetze -BOOL SwDoc::RemoveInvisibleContent() +bool SwDoc::RemoveInvisibleContent() { - BOOL bRet = FALSE; - StartUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL ); + sal_Bool bRet = sal_False; + GetIDocumentUndoRedo().StartUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL ); { SwTxtNode* pTxtNd; @@ -2217,7 +2222,7 @@ BOOL SwDoc::RemoveInvisibleContent() pTxtNd->GetpSwpHints() && pTxtNd->HasHiddenParaField() && &pTxtNd->GetNodes() == &GetNodes() ) { - bRet = TRUE; + bRet = sal_True; SwPaM aPam( *pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().Len() ); // Remove hidden paragraph or delete contents: @@ -2243,7 +2248,7 @@ BOOL SwDoc::RemoveInvisibleContent() // // Remove any hidden paragraph (hidden text attribute) // - for( ULONG n = GetNodes().Count(); n; ) + for( sal_uLong n = GetNodes().Count(); n; ) { SwTxtNode* pTxtNd = GetNodes()[ --n ]->GetTxtNode(); if ( pTxtNd ) @@ -2252,8 +2257,8 @@ BOOL SwDoc::RemoveInvisibleContent() SwPaM aPam( *pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().Len() ); if ( pTxtNd->HasHiddenCharAttribute( true ) ) { - bRemoved = TRUE; - bRet = TRUE; + bRemoved = sal_True; + bRet = sal_True; // Remove hidden paragraph or delete contents: // Delete contents if @@ -2275,8 +2280,8 @@ BOOL SwDoc::RemoveInvisibleContent() } else if ( pTxtNd->HasHiddenCharAttribute( false ) ) { - bRemoved = TRUE; - bRet = TRUE; + bRemoved = sal_True; + bRet = sal_True; SwScriptInfo::DeleteHiddenRanges( *pTxtNd ); } @@ -2291,7 +2296,7 @@ BOOL SwDoc::RemoveInvisibleContent() // dann noch alle versteckten Bereiche loeschen/leeren SwSectionFmts aSectFmts; SwSectionFmts& rSectFmts = GetSections(); - USHORT n; + sal_uInt16 n; for( n = rSectFmts.Count(); n; ) { @@ -2330,7 +2335,7 @@ BOOL SwDoc::RemoveInvisibleContent() SwSectionNode* pSectNd = pSectFmt->GetSectionNode(); if( pSectNd ) { - bRet = TRUE; + bRet = sal_True; SwPaM aPam( *pSectNd ); if( pSectNd->StartOfSectionNode()->StartOfSectionIndex() == @@ -2366,15 +2371,78 @@ BOOL SwDoc::RemoveInvisibleContent() if( bRet ) SetModified(); - EndUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL ); + return bRet; +} +/*-- 25.08.2010 14:18:12--------------------------------------------------- + + -----------------------------------------------------------------------*/ +bool SwDoc::HasInvisibleContent() const +{ + sal_Bool bRet = sal_False; + + SwClientIter aIter( *GetSysFldType( RES_HIDDENPARAFLD ) ); + if( aIter.First( TYPE( SwFmtFld ) ) ) + bRet = sal_True; + + // + // Search for any hidden paragraph (hidden text attribute) + // + if( ! bRet ) + { + for( sal_uLong n = GetNodes().Count(); !bRet && (n > 0); ) + { + SwTxtNode* pTxtNd = GetNodes()[ --n ]->GetTxtNode(); + if ( pTxtNd ) + { + SwPaM aPam( *pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().Len() ); + if( pTxtNd->HasHiddenCharAttribute( true ) || ( pTxtNd->HasHiddenCharAttribute( false ) ) ) + { + bRet = sal_True; + } + } + } + } + + if( ! bRet ) + { + const SwSectionFmts& rSectFmts = GetSections(); + sal_uInt16 n; + + for( n = rSectFmts.Count(); !bRet && (n > 0); ) + { + SwSectionFmt* pSectFmt = rSectFmts[ --n ]; + // don't add sections in Undo/Redo + if( !pSectFmt->IsInNodesArr()) + continue; + SwSection* pSect = pSectFmt->GetSection(); + if( pSect->IsHidden() ) + bRet = sal_True; + } + } return bRet; } -BOOL SwDoc::ConvertFieldsToText() +bool SwDoc::RestoreInvisibleContent() { - BOOL bRet = FALSE; + bool bRet = false; + SwUndoId nLastUndoId(UNDO_EMPTY); + if (GetIDocumentUndoRedo().GetLastUndoInfo(0, & nLastUndoId) + && (UNDO_UI_DELETE_INVISIBLECNTNT == nLastUndoId)) + { + GetIDocumentUndoRedo().Undo(); + GetIDocumentUndoRedo().ClearRedo(); + bRet = true; + } + return bRet; +} + + +sal_Bool SwDoc::ConvertFieldsToText() +{ + sal_Bool bRet = sal_False; LockExpFlds(); - StartUndo( UNDO_UI_REPLACE, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_UI_REPLACE, NULL ); const SwFldTypes* pMyFldTypes = GetFldTypes(); sal_uInt16 nCount = pMyFldTypes->Count(); @@ -2402,17 +2470,17 @@ BOOL SwDoc::ConvertFieldsToText() // skip fields that are currently not in the document // e.g. fields in undo or redo array - BOOL bSkip = !pTxtFld || + sal_Bool bSkip = !pTxtFld || !pTxtFld->GetpTxtNode()->GetNodes().IsDocNodes(); if (!bSkip) { - BOOL bInHeaderFooter = IsInHeaderFooter(SwNodeIndex(*pTxtFld->GetpTxtNode())); + sal_Bool bInHeaderFooter = IsInHeaderFooter(SwNodeIndex(*pTxtFld->GetpTxtNode())); const SwFmtFld& rFmtFld = pTxtFld->GetFld(); const SwField* pField = rFmtFld.GetFld(); //#i55595# some fields have to be excluded in headers/footers - USHORT nWhich = pField->GetTyp()->Which(); + sal_uInt16 nWhich = pField->GetTyp()->Which(); if(!bInHeaderFooter || (nWhich != RES_PAGENUMBERFLD && nWhich != RES_CHAPTERFLD && @@ -2422,7 +2490,7 @@ BOOL SwDoc::ConvertFieldsToText() nWhich != RES_REFPAGEGETFLD&& nWhich != RES_REFPAGESETFLD)) { - String sText = pField->GetCntnt(); + String sText = pField->ExpandField(true); //database fields should not convert their command into text if( RES_DBFLD == pCurType->Which() && !static_cast<const SwDBField*>(pField)->IsInitialized()) sText.Erase(); @@ -2444,7 +2512,7 @@ BOOL SwDoc::ConvertFieldsToText() if( bRet ) SetModified(); - EndUndo( UNDO_UI_REPLACE, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_UI_REPLACE, NULL ); UnlockExpFlds(); return bRet; @@ -2481,26 +2549,17 @@ bool SwDoc::LinksUpdated() const } // embedded alle lokalen Links (Bereiche/Grafiken) -bool SwDoc::EmbedAllLinks() +::sfx2::SvBaseLink* lcl_FindNextRemovableLink( const ::sfx2::SvBaseLinks& rLinks, sfx2::LinkManager& rLnkMgr ) { - BOOL bRet = FALSE; - sfx2::LinkManager& rLnkMgr = GetLinkManager(); - const ::sfx2::SvBaseLinks& rLnks = rLnkMgr.GetLinks(); - if( rLnks.Count() ) + for( sal_uInt16 n = 0; n < rLinks.Count(); ++n ) { - BOOL bDoesUndo = DoesUndo(); - DoUndo( FALSE ); - - for( USHORT n = 0; n < rLnks.Count(); ++n ) + ::sfx2::SvBaseLink* pLnk = &(*rLinks[ n ]); + if( pLnk && + ( OBJECT_CLIENT_GRF == pLnk->GetObjType() || + OBJECT_CLIENT_FILE == pLnk->GetObjType() ) && + pLnk->ISA( SwBaseLink ) ) { - ::sfx2::SvBaseLink* pLnk = &(*rLnks[ n ]); - if( pLnk && - ( OBJECT_CLIENT_GRF == pLnk->GetObjType() || - OBJECT_CLIENT_FILE == pLnk->GetObjType() ) && - pLnk->ISA( SwBaseLink ) ) - { ::sfx2::SvBaseLinkRef xLink = pLnk; - USHORT nCount = rLnks.Count(); String sFName; rLnkMgr.GetDisplayNames( xLink, 0, &sFName, 0, 0 ); @@ -2508,46 +2567,57 @@ bool SwDoc::EmbedAllLinks() INetURLObject aURL( sFName ); if( INET_PROT_FILE == aURL.GetProtocol() || INET_PROT_CID == aURL.GetProtocol() ) - { - // dem Link sagen, das er aufgeloest wird! - xLink->Closed(); + return pLnk; + } + } + return 0; +} +bool SwDoc::EmbedAllLinks() +{ + sal_Bool bRet = sal_False; + sfx2::LinkManager& rLnkMgr = GetLinkManager(); + const ::sfx2::SvBaseLinks& rLinks = rLnkMgr.GetLinks(); + if( rLinks.Count() ) + { + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); - // falls einer vergessen hat sich auszutragen - if( xLink.Is() ) - rLnkMgr.Remove( xLink ); + ::sfx2::SvBaseLink* pLnk = 0; + while( 0 != (pLnk = lcl_FindNextRemovableLink( rLinks, rLnkMgr ) ) ) + { + ::sfx2::SvBaseLinkRef xLink = pLnk; + // dem Link sagen, das er aufgeloest wird! + xLink->Closed(); - if( nCount != rLnks.Count() + 1 ) - n = 0; // wieder von vorne anfangen, es wurden - // mehrere Links entfernt - bRet = TRUE; - } - } + // falls einer vergessen hat sich auszutragen + if( xLink.Is() ) + rLnkMgr.Remove( xLink ); + + bRet = sal_True; } - DelAllUndoObj(); - DoUndo( bDoesUndo ); + GetIDocumentUndoRedo().DelAllUndoObj(); SetModified(); } return bRet; } -BOOL SwDoc::IsInsTblFormatNum() const +sal_Bool SwDoc::IsInsTblFormatNum() const { return SW_MOD()->IsInsTblFormatNum(get(IDocumentSettingAccess::HTML_MODE)); } -BOOL SwDoc::IsInsTblChangeNumFormat() const +sal_Bool SwDoc::IsInsTblChangeNumFormat() const { return SW_MOD()->IsInsTblChangeNumFormat(get(IDocumentSettingAccess::HTML_MODE)); } -BOOL SwDoc::IsInsTblAlignNum() const +sal_Bool SwDoc::IsInsTblAlignNum() const { return SW_MOD()->IsInsTblAlignNum(get(IDocumentSettingAccess::HTML_MODE)); } // setze das InsertDB als Tabelle Undo auf: -void SwDoc::AppendUndoForInsertFromDB( const SwPaM& rPam, BOOL bIsTable ) +void SwDoc::AppendUndoForInsertFromDB( const SwPaM& rPam, sal_Bool bIsTable ) { if( bIsTable ) { @@ -2556,26 +2626,26 @@ void SwDoc::AppendUndoForInsertFromDB( const SwPaM& rPam, BOOL bIsTable ) { SwUndoCpyTbl* pUndo = new SwUndoCpyTbl; pUndo->SetTableSttIdx( pTblNd->GetIndex() ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } } else if( rPam.HasMark() ) { SwUndoCpyDoc* pUndo = new SwUndoCpyDoc( rPam ); - pUndo->SetInsertRange( rPam, FALSE ); - AppendUndo( pUndo ); + pUndo->SetInsertRange( rPam, sal_False ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } } void SwDoc::ChgTOX(SwTOXBase & rTOX, const SwTOXBase & rNew) { - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { - DelAllUndoObj(); + GetIDocumentUndoRedo().DelAllUndoObj(); SwUndo * pUndo = new SwUndoTOXChange(&rTOX, rNew); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } rTOX = rNew; @@ -2592,9 +2662,9 @@ String SwDoc::GetPaMDescr(const SwPaM & rPam) const String aResult; bool bOK = false; - if (rPam.GetNode(TRUE) == rPam.GetNode(FALSE)) + if (rPam.GetNode(sal_True) == rPam.GetNode(sal_False)) { - SwTxtNode * pTxtNode = rPam.GetNode(TRUE)->GetTxtNode(); + SwTxtNode * pTxtNode = rPam.GetNode(sal_True)->GetTxtNode(); if (0 != pTxtNode) { @@ -2611,9 +2681,9 @@ String SwDoc::GetPaMDescr(const SwPaM & rPam) const bOK = true; } } - else if (0 != rPam.GetNode(TRUE)) + else if (0 != rPam.GetNode(sal_True)) { - if (0 != rPam.GetNode(FALSE)) + if (0 != rPam.GetNode(sal_False)) aResult += String(SW_RES(STR_PARAGRAPHS)); bOK = true; @@ -2644,7 +2714,7 @@ SwTxtFld * SwDoc::GetTxtFld(const SwPosition & rPos) bool SwDoc::ContainsHiddenChars() const { - for( ULONG n = GetNodes().Count(); n; ) + for( sal_uLong n = GetNodes().Count(); n; ) { SwNode* pNd = GetNodes()[ --n ]; if ( ND_TEXTNODE == pNd->GetNodeType() && @@ -2655,7 +2725,7 @@ bool SwDoc::ContainsHiddenChars() const return false; } -SwUnoCrsr* SwDoc::CreateUnoCrsr( const SwPosition& rPos, BOOL bTblCrsr ) +SwUnoCrsr* SwDoc::CreateUnoCrsr( const SwPosition& rPos, sal_Bool bTblCrsr ) { SwUnoCrsr* pNew; if( bTblCrsr ) @@ -2669,7 +2739,7 @@ SwUnoCrsr* SwDoc::CreateUnoCrsr( const SwPosition& rPos, BOOL bTblCrsr ) void SwDoc::ChkCondColls() { - for (USHORT n = 0; n < pTxtFmtCollTbl->Count(); n++) + for (sal_uInt16 n = 0; n < pTxtFmtCollTbl->Count(); n++) { SwTxtFmtColl *pColl = (*pTxtFmtCollTbl)[n]; diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx index 598e8e5c7c83..00c6d40b5d91 100644 --- a/sw/source/core/doc/docbasic.cxx +++ b/sw/source/core/doc/docbasic.cxx @@ -52,13 +52,13 @@ static Sequence<Any> *lcl_docbasic_convertArgs( SbxArray& rArgs ) { Sequence<Any> *pRet = 0; - USHORT nCount = rArgs.Count(); + sal_uInt16 nCount = rArgs.Count(); if( nCount > 1 ) { nCount--; pRet = new Sequence<Any>( nCount ); Any *pUnoArgs = pRet->getArray(); - for( USHORT i=0; i<nCount; i++ ) + for( sal_uInt16 i=0; i<nCount; i++ ) { SbxVariable *pVar = rArgs.Get( i+1 ); switch( pVar->GetType() ) @@ -85,7 +85,7 @@ static Sequence<Any> *lcl_docbasic_convertArgs( SbxArray& rArgs ) return pRet; } -BOOL SwDoc::ExecMacro( const SvxMacro& rMacro, String* pRet, SbxArray* pArgs ) +sal_Bool SwDoc::ExecMacro( const SvxMacro& rMacro, String* pRet, SbxArray* pArgs ) { ErrCode eErr = 0; switch( rMacro.GetScriptType() ) @@ -97,7 +97,7 @@ BOOL SwDoc::ExecMacro( const SvxMacro& rMacro, String* pRet, SbxArray* pArgs ) aRef = pRetValue; eErr = pDocShell->CallBasic( rMacro.GetMacName(), rMacro.GetLibName(), - 0, pArgs, pRet ? pRetValue : 0 ); + pArgs, pRet ? pRetValue : 0 ); if( pRet && SbxNULL < pRetValue->GetType() && SbxVOID != pRetValue->GetType() ) @@ -144,13 +144,13 @@ BOOL SwDoc::ExecMacro( const SvxMacro& rMacro, String* pRet, SbxArray* pArgs ) -USHORT SwDoc::CallEvent( USHORT nEvent, const SwCallMouseEvent& rCallEvent, - BOOL bCheckPtr, SbxArray* pArgs, const Link* ) +sal_uInt16 SwDoc::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent, + sal_Bool bCheckPtr, SbxArray* pArgs, const Link* ) { if( !pDocShell ) // ohne DocShell geht das nicht! return 0; - USHORT nRet = 0; + sal_uInt16 nRet = 0; const SvxMacroTableDtor* pTbl = 0; switch( rCallEvent.eType ) { @@ -158,12 +158,12 @@ USHORT SwDoc::CallEvent( USHORT nEvent, const SwCallMouseEvent& rCallEvent, if( bCheckPtr ) { const SfxPoolItem* pItem; - USHORT n, nMaxItems = GetAttrPool().GetItemCount( RES_TXTATR_INETFMT ); + sal_uInt32 n, nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT ); for( n = 0; n < nMaxItems; ++n ) - if( 0 != (pItem = GetAttrPool().GetItem( RES_TXTATR_INETFMT, n ) ) + if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_INETFMT, n ) ) && rCallEvent.PTR.pINetAttr == pItem ) { - bCheckPtr = FALSE; // als Flag missbrauchen + bCheckPtr = sal_False; // als Flag missbrauchen break; } } @@ -177,9 +177,9 @@ USHORT SwDoc::CallEvent( USHORT nEvent, const SwCallMouseEvent& rCallEvent, const SwFrmFmtPtr pFmt = (SwFrmFmtPtr)rCallEvent.PTR.pFmt; if( bCheckPtr ) { - USHORT nPos = GetSpzFrmFmts()->GetPos( pFmt ); + sal_uInt16 nPos = GetSpzFrmFmts()->GetPos( pFmt ); if( USHRT_MAX != nPos ) - bCheckPtr = FALSE; // als Flag missbrauchen + bCheckPtr = sal_False; // als Flag missbrauchen } if( !bCheckPtr ) pTbl = &pFmt->GetMacro().GetMacroTable(); @@ -192,7 +192,7 @@ USHORT SwDoc::CallEvent( USHORT nEvent, const SwCallMouseEvent& rCallEvent, if( bCheckPtr ) { const SwFrmFmtPtr pFmt = (SwFrmFmtPtr)rCallEvent.PTR.IMAP.pFmt; - USHORT nPos = GetSpzFrmFmts()->GetPos( pFmt ); + sal_uInt16 nPos = GetSpzFrmFmts()->GetPos( pFmt ); const ImageMap* pIMap; if( USHRT_MAX != nPos && 0 != (pIMap = pFmt->GetURL().GetMap()) ) @@ -200,7 +200,7 @@ USHORT SwDoc::CallEvent( USHORT nEvent, const SwCallMouseEvent& rCallEvent, for( nPos = pIMap->GetIMapObjectCount(); nPos; ) if( pIMapObj == pIMap->GetIMapObject( --nPos )) { - bCheckPtr = FALSE; // als Flag missbrauchen + bCheckPtr = sal_False; // als Flag missbrauchen break; } } @@ -222,7 +222,7 @@ USHORT SwDoc::CallEvent( USHORT nEvent, const SwCallMouseEvent& rCallEvent, if( STARBASIC == rMacro.GetScriptType() ) { nRet += 0 == pDocShell->CallBasic( rMacro.GetMacName(), - rMacro.GetLibName(), 0, pArgs ) ? 1 : 0; + rMacro.GetLibName(), pArgs ) ? 1 : 0; } else if( EXTENDED_STYPE == rMacro.GetScriptType() ) { diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 6587f7e0e66e..30f65bd3b311 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -58,7 +58,6 @@ #include <swserv.hxx> #include <swundo.hxx> #include <tools/pstm.hxx> -#include <undobj.hxx> #include <unocrsr.hxx> #include <viscrs.hxx> #include <stdio.h> @@ -247,7 +246,7 @@ namespace bind(&::rtl::OUString::equals, bind(&IMark::GetName, _1), rName)); } -#if FALSE +#if 0 static void lcl_DebugMarks(IDocumentMarkAccess::container_t vMarks) { OSL_TRACE("%d Marks", vMarks.size()); @@ -321,7 +320,7 @@ namespace sw { namespace mark const ::rtl::OUString& rName, const IDocumentMarkAccess::MarkType eType) { -#if FALSE +#if 0 { ::rtl::OString sName = ::rtl::OUStringToOString(rName, RTL_TEXTENCODING_UTF8); const SwPosition* const pPos1 = rPaM.GetPoint(); @@ -408,7 +407,7 @@ namespace sw { namespace mark break; } pMarkBase->InitDoc(m_pDoc); -#if FALSE +#if 0 OSL_TRACE("--- makeType ---"); OSL_TRACE("Marks"); lcl_DebugMarks(m_vMarks); @@ -519,7 +518,7 @@ namespace sw { namespace mark // restore sorting if needed if(isSortingNeeded) sortMarks(); -#if FALSE +#if 0 OSL_TRACE("correctMarksAbsolute"); lcl_DebugMarks(m_vMarks); #endif @@ -559,7 +558,7 @@ namespace sw { namespace mark // restore sorting if needed if(isSortingNeeded) sortMarks(); -#if FALSE +#if 0 OSL_TRACE("correctMarksRelative"); lcl_DebugMarks(m_vMarks); #endif @@ -675,7 +674,7 @@ namespace sw { namespace mark } if(isSortingNeeded) sortMarks(); -#if FALSE +#if 0 OSL_TRACE("deleteMarks"); lcl_DebugMarks(m_vMarks); #endif @@ -878,19 +877,19 @@ namespace class _SwSaveTypeCountContent { union { - struct { USHORT nType, nCount; } TC; - ULONG nTypeCount; + struct { sal_uInt16 nType, nCount; } TC; + sal_uLong nTypeCount; } TYPECOUNT; xub_StrLen nContent; public: _SwSaveTypeCountContent() { TYPECOUNT.nTypeCount = 0; nContent = 0; } - _SwSaveTypeCountContent( USHORT nType ) + _SwSaveTypeCountContent( sal_uInt16 nType ) { SetTypeAndCount( nType, 0 ); nContent = 0; } - _SwSaveTypeCountContent( const SvULongs& rArr, USHORT& rPos ) + _SwSaveTypeCountContent( const SvULongs& rArr, sal_uInt16& rPos ) { TYPECOUNT.nTypeCount = rArr[ rPos++ ]; nContent = static_cast<xub_StrLen>(rArr[ rPos++ ]); @@ -901,17 +900,17 @@ namespace rArr.Insert( nContent, rArr.Count() ); } - void SetType( USHORT n ) { TYPECOUNT.TC.nType = n; } - USHORT GetType() const { return TYPECOUNT.TC.nType; } + void SetType( sal_uInt16 n ) { TYPECOUNT.TC.nType = n; } + sal_uInt16 GetType() const { return TYPECOUNT.TC.nType; } void IncType() { ++TYPECOUNT.TC.nType; } void DecType() { --TYPECOUNT.TC.nType; } - void SetCount( USHORT n ) { TYPECOUNT.TC.nCount = n; } - USHORT GetCount() const { return TYPECOUNT.TC.nCount; } - USHORT IncCount() { return ++TYPECOUNT.TC.nCount; } - USHORT DecCount() { return --TYPECOUNT.TC.nCount; } + void SetCount( sal_uInt16 n ) { TYPECOUNT.TC.nCount = n; } + sal_uInt16 GetCount() const { return TYPECOUNT.TC.nCount; } + sal_uInt16 IncCount() { return ++TYPECOUNT.TC.nCount; } + sal_uInt16 DecCount() { return --TYPECOUNT.TC.nCount; } - void SetTypeAndCount( USHORT nT, USHORT nC ) + void SetTypeAndCount( sal_uInt16 nT, sal_uInt16 nC ) { TYPECOUNT.TC.nCount = nC; TYPECOUNT.TC.nType = nT; } void SetContent( xub_StrLen n ) { nContent = n; } @@ -927,9 +926,9 @@ namespace static const int BEHIND_SAME_NODE = 3; // Same node index but content index behind given content index static const int BEHIND_NODE = 4; // Position behind the given node index - static int lcl_RelativePosition( const SwPosition& rPos, ULONG nNode, xub_StrLen nCntnt ) + static int lcl_RelativePosition( const SwPosition& rPos, sal_uLong nNode, xub_StrLen nCntnt ) { - ULONG nIndex = rPos.nNode.GetIndex(); + sal_uLong nIndex = rPos.nNode.GetIndex(); int nReturn = BEFORE_NODE; if( nIndex == nNode ) { @@ -952,17 +951,17 @@ namespace return rPos.nNode > rNdIdx || ( pIdx && rPos.nNode == rNdIdx && rPos.nContent > pIdx->GetIndex() ); } - static void lcl_ChkPaM( SvULongs& rSaveArr, ULONG nNode, xub_StrLen nCntnt, + static void lcl_ChkPaM( SvULongs& rSaveArr, sal_uLong nNode, xub_StrLen nCntnt, const SwPaM& rPam, _SwSaveTypeCountContent& rSave, - BOOL bChkSelDirection ) + sal_Bool bChkSelDirection ) { // SelektionsRichtung beachten - bool bBound1IsStart = !bChkSelDirection ? TRUE : + bool bBound1IsStart = !bChkSelDirection ? sal_True : ( *rPam.GetPoint() < *rPam.GetMark() ? rPam.GetPoint() == &rPam.GetBound() : rPam.GetMark() == &rPam.GetBound()); - const SwPosition* pPos = &rPam.GetBound( TRUE ); + const SwPosition* pPos = &rPam.GetBound( sal_True ); if( pPos->nNode.GetIndex() == nNode && ( bBound1IsStart ? pPos->nContent.GetIndex() < nCntnt : pPos->nContent.GetIndex() <= nCntnt )) @@ -971,7 +970,7 @@ namespace rSave.Add( rSaveArr ); } - pPos = &rPam.GetBound( FALSE ); + pPos = &rPam.GetBound( sal_False ); if( pPos->nNode.GetIndex() == nNode && ( (bBound1IsStart && bChkSelDirection) ? pPos->nContent.GetIndex() <= nCntnt @@ -1068,12 +1067,12 @@ void SaveBookmark::SetInDoc( if(pIdx && !m_nNode2) aPam.GetMark()->nContent += m_nCntnt2; else - aPam.GetMark()->nContent.Assign(aPam.GetCntntNode(FALSE), m_nCntnt2); + aPam.GetMark()->nContent.Assign(aPam.GetCntntNode(sal_False), m_nCntnt2); } else { aPam.GetMark()->nNode = m_nNode2; - aPam.GetMark()->nContent.Assign(aPam.GetCntntNode(FALSE), m_nCntnt2); + aPam.GetMark()->nContent.Assign(aPam.GetCntntNode(sal_False), m_nCntnt2); } } @@ -1093,7 +1092,7 @@ void SaveBookmark::SetInDoc( } if(!aPam.HasMark() - || CheckNodesRange(aPam.GetPoint()->nNode, aPam.GetMark()->nNode, TRUE)) + || CheckNodesRange(aPam.GetPoint()->nNode, aPam.GetMark()->nNode, sal_True)) { ::sw::mark::IBookmark* const pBookmark = dynamic_cast< ::sw::mark::IBookmark* >(pDoc->getIDocumentMarkAccess()->makeMark(aPam, m_aName, m_eOrigBkmType)); if(pBookmark) @@ -1135,13 +1134,13 @@ void _DelBookmarks( // Array, das alle Angaben auf die Position als Offset speichert. // Die neue Zuordung erfolgt nach dem Moven. SwRedlineTbl& rTbl = (SwRedlineTbl&)pDoc->GetRedlineTbl(); - for(USHORT nCnt = 0; nCnt < rTbl.Count(); ++nCnt ) + for(sal_uInt16 nCnt = 0; nCnt < rTbl.Count(); ++nCnt ) { // liegt auf der Position ?? SwRedline* pRedl = rTbl[ nCnt ]; - SwPosition *pRStt = &pRedl->GetBound(TRUE), - *pREnd = &pRedl->GetBound(FALSE); + SwPosition *pRStt = &pRedl->GetBound(sal_True), + *pREnd = &pRedl->GetBound(sal_False); if( *pRStt > *pREnd ) { SwPosition *pTmp = pRStt; pRStt = pREnd, pREnd = pTmp; @@ -1154,11 +1153,11 @@ void _DelBookmarks( pRStt->nContent = *pEndIdx; else { - BOOL bStt = TRUE; + sal_Bool bStt = sal_True; SwCntntNode* pCNd = pRStt->nNode.GetNode().GetCntntNode(); if( !pCNd && 0 == ( pCNd = pDoc->GetNodes().GoNext( &pRStt->nNode )) ) { - bStt = FALSE; + bStt = sal_False; pRStt->nNode = rStt; if( 0 == ( pCNd = pDoc->GetNodes().GoPrevious( &pRStt->nNode )) ) { @@ -1177,11 +1176,11 @@ void _DelBookmarks( pREnd->nContent = *pSttIdx; else { - BOOL bStt = FALSE; + sal_Bool bStt = sal_False; SwCntntNode* pCNd = pREnd->nNode.GetNode().GetCntntNode(); if( !pCNd && 0 == ( pCNd = pDoc->GetNodes().GoPrevious( &pREnd->nNode )) ) { - bStt = TRUE; + bStt = sal_True; pREnd->nNode = rEnd; if( 0 == ( pCNd = pDoc->GetNodes().GoNext( &pREnd->nNode )) ) { @@ -1197,10 +1196,10 @@ void _DelBookmarks( } void _SaveCntntIdx(SwDoc* pDoc, - ULONG nNode, + sal_uLong nNode, xub_StrLen nCntnt, SvULongs& rSaveArr, - BYTE nSaveFly) + sal_uInt8 nSaveFly) { // 1. Bookmarks _SwSaveTypeCountContent aSave; @@ -1281,7 +1280,7 @@ void _SaveCntntIdx(SwDoc* pDoc, SwFrm* pFrm = pNode->GetFrm(); #if OSL_DEBUG_LEVEL > 1 - static BOOL bViaDoc = FALSE; + static sal_Bool bViaDoc = sal_False; if( bViaDoc ) pFrm = NULL; #endif @@ -1375,14 +1374,14 @@ void _SaveCntntIdx(SwDoc* pDoc, if( _pStkCrsr ) do { lcl_ChkPaM( rSaveArr, nNode, nCntnt, *_pStkCrsr, - aSave, FALSE ); + aSave, sal_False ); aSave.IncCount(); } while ( (_pStkCrsr != 0 ) && ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) ); FOREACHPAM_START( PCURSH->_GetCrsr() ) lcl_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, - aSave, FALSE ); + aSave, sal_False ); aSave.IncCount(); FOREACHPAM_END() @@ -1393,10 +1392,10 @@ void _SaveCntntIdx(SwDoc* pDoc, { aSave.SetTypeAndCount( 0x400, 0 ); const SwUnoCrsrTbl& rTbl = pDoc->GetUnoCrsrTbl(); - for( USHORT n = 0; n < rTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rTbl.Count(); ++n ) { FOREACHPAM_START( rTbl[ n ] ) - lcl_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, FALSE ); + lcl_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, sal_False ); aSave.IncCount(); FOREACHPAM_END() @@ -1405,7 +1404,7 @@ void _SaveCntntIdx(SwDoc* pDoc, if( pUnoTblCrsr ) { FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() ) - lcl_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, FALSE ); + lcl_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, sal_False ); aSave.IncCount(); FOREACHPAM_END() } @@ -1416,15 +1415,15 @@ void _SaveCntntIdx(SwDoc* pDoc, void _RestoreCntntIdx(SwDoc* pDoc, SvULongs& rSaveArr, - ULONG nNode, + sal_uLong nNode, xub_StrLen nOffset, - BOOL bAuto) + sal_Bool bAuto) { SwCntntNode* pCNd = pDoc->GetNodes()[ nNode ]->GetCntntNode(); const SwRedlineTbl& rRedlTbl = pDoc->GetRedlineTbl(); SwSpzFrmFmts* pSpz = pDoc->GetSpzFrmFmts(); IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); - USHORT n = 0; + sal_uInt16 n = 0; while( n < rSaveArr.Count() ) { _SwSaveTypeCountContent aSave( rSaveArr, n ); @@ -1493,7 +1492,7 @@ void _RestoreCntntIdx(SwDoc* pDoc, SwCrsrShell* pShell = pDoc->GetEditShell(); if( pShell ) { - USHORT nCnt = 0; + sal_uInt16 nCnt = 0; FOREACHSHELL_START( pShell ) SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); if( _pStkCrsr ) @@ -1531,9 +1530,9 @@ void _RestoreCntntIdx(SwDoc* pDoc, case 0x0400: case 0x0401: { - USHORT nCnt = 0; + sal_uInt16 nCnt = 0; const SwUnoCrsrTbl& rTbl = pDoc->GetUnoCrsrTbl(); - for( USHORT i = 0; i < rTbl.Count(); ++i ) + for( sal_uInt16 i = 0; i < rTbl.Count(); ++i ) { FOREACHPAM_START( rTbl[ i ] ) if( aSave.GetCount() == nCnt ) @@ -1587,7 +1586,7 @@ void _RestoreCntntIdx(SvULongs& rSaveArr, const IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); SwCntntNode* pCNd = (SwCntntNode*)rNd.GetCntntNode(); - USHORT n = 0; + sal_uInt16 n = 0; while( n < rSaveArr.Count() ) { _SwSaveTypeCountContent aSave( rSaveArr, n ); @@ -1653,7 +1652,7 @@ void _RestoreCntntIdx(SvULongs& rSaveArr, SwCrsrShell* pShell = pDoc->GetEditShell(); if( pShell ) { - USHORT nCnt = 0; + sal_uInt16 nCnt = 0; FOREACHSHELL_START( pShell ) SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); if( _pStkCrsr ) @@ -1691,9 +1690,9 @@ void _RestoreCntntIdx(SvULongs& rSaveArr, case 0x0400: case 0x0401: { - USHORT nCnt = 0; + sal_uInt16 nCnt = 0; const SwUnoCrsrTbl& rTbl = pDoc->GetUnoCrsrTbl(); - for( USHORT i = 0; i < rTbl.Count(); ++i ) + for( sal_uInt16 i = 0; i < rTbl.Count(); ++i ) { FOREACHPAM_START( rTbl[ i ] ) if( aSave.GetCount() == nCnt ) diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx index ee40b03ef4e7..78fafdf4d15d 100644 --- a/sw/source/core/doc/docchart.cxx +++ b/sw/source/core/doc/docchart.cxx @@ -66,7 +66,7 @@ void SwTable::UpdateCharts() const GetFrmFmt()->GetDoc()->UpdateCharts( GetFrmFmt()->GetName() ); } -BOOL SwTable::IsTblComplexForChart( const String& rSelection, +sal_Bool SwTable::IsTblComplexForChart( const String& rSelection, SwChartLines* pGetCLines ) const { const SwTableBox* pSttBox, *pEndBox; @@ -115,7 +115,7 @@ IMPL_LINK( SwDoc, DoUpdateAllCharts, Timer *, EMPTYARG ) if( pVSh ) { const SwFrmFmts& rTblFmts = *GetTblFrmFmts(); - for( USHORT n = 0; n < rTblFmts.Count(); ++n ) + for( sal_uInt16 n = 0; n < rTblFmts.Count(); ++n ) { SwTable* pTmpTbl; const SwTableNode* pTblNd; @@ -171,20 +171,20 @@ void SwDoc::UpdateCharts( const String &rName ) const void SwDoc::SetTableName( SwFrmFmt& rTblFmt, const String &rNewName ) { -// BOOL bStop = 1; +// sal_Bool bStop = 1; const String aOldName( rTblFmt.GetName() ); - BOOL bNameFound = 0 == rNewName.Len(); + sal_Bool bNameFound = 0 == rNewName.Len(); if( !bNameFound ) { SwFrmFmt* pFmt; const SwFrmFmts& rTbl = *GetTblFrmFmts(); - for( USHORT i = rTbl.Count(); i; ) + for( sal_uInt16 i = rTbl.Count(); i; ) if( !( pFmt = rTbl[ --i ] )->IsDefault() && pFmt->GetName() == rNewName && IsUsed( *pFmt ) ) { - bNameFound = TRUE; + bNameFound = sal_True; break; } } diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index acd0b5a94c7f..69c070ab3d20 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -36,11 +36,12 @@ #include <editeng/boxitem.hxx> #include <editeng/udlnitem.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <redline.hxx> -#include <undobj.hxx> +#include <UndoRedline.hxx> #include <section.hxx> #include <tox.hxx> #include <docsh.hxx> @@ -60,8 +61,8 @@ public: CompareLine() {} virtual ~CompareLine(); - virtual ULONG GetHashValue() const = 0; - virtual BOOL Compare( const CompareLine& rLine ) const = 0; + virtual sal_uLong GetHashValue() const = 0; + virtual sal_Bool Compare( const CompareLine& rLine ) const = 0; }; class CompareData @@ -71,7 +72,7 @@ class CompareData protected: vector< CompareLine* > aLines; - ULONG nSttLineNum; + sal_uLong nSttLineNum; // Anfang und Ende beschneiden und alle anderen in das // LinesArray setzen @@ -82,7 +83,7 @@ public: virtual ~CompareData(); // gibt es unterschiede? - BOOL HasDiffs( const CompareData& rData ) const; + sal_Bool HasDiffs( const CompareData& rData ) const; // startet das Vergleichen und Erzeugen der Unterschiede zweier // Dokumente @@ -91,14 +92,14 @@ public: // ShowInsert / ShowDelete. Diese bekommen die Start und EndLine-Nummer // uebergeben. Die Abbildung auf den tatsaechline Inhalt muss die // Ableitung uebernehmen! - ULONG ShowDiffs( const CompareData& rData ); + sal_uLong ShowDiffs( const CompareData& rData ); - virtual void ShowInsert( ULONG nStt, ULONG nEnd ); - virtual void ShowDelete( const CompareData& rData, ULONG nStt, - ULONG nEnd, ULONG nInsPos ); + virtual void ShowInsert( sal_uLong nStt, sal_uLong nEnd ); + virtual void ShowDelete( const CompareData& rData, sal_uLong nStt, + sal_uLong nEnd, sal_uLong nInsPos ); virtual void CheckForChangesInLine( const CompareData& rData, - ULONG& nStt, ULONG& nEnd, - ULONG& nThisStt, ULONG& nThisEnd ); + sal_uLong& nStt, sal_uLong& nEnd, + sal_uLong& nThisStt, sal_uLong& nThisEnd ); // Eindeutigen Index fuer eine Line setzen. Gleiche Lines haben den // selben Index; auch in den anderen CompareData! @@ -116,7 +117,7 @@ public: } size_t GetLineCount() const { return aLines.size(); } - ULONG GetLineOffset() const { return nSttLineNum; } + sal_uLong GetLineOffset() const { return nSttLineNum; } const CompareLine* GetLine( size_t nLine ) const { return aLines[ nLine ]; } void InsertLine( CompareLine* pLine ) @@ -127,24 +128,24 @@ class Hash { struct _HashData { - ULONG nNext, nHash; + sal_uLong nNext, nHash; const CompareLine* pLine; _HashData() : nNext( 0 ), nHash( 0 ), pLine(0) {} }; - ULONG* pHashArr; + sal_uLong* pHashArr; _HashData* pDataArr; - ULONG nCount, nPrime; + sal_uLong nCount, nPrime; public: - Hash( ULONG nSize ); + Hash( sal_uLong nSize ); ~Hash(); void CalcHashValue( CompareData& rData ); - ULONG GetCount() const { return nCount; } + sal_uLong GetCount() const { return nCount; } }; class Compare @@ -152,17 +153,17 @@ class Compare public: class MovedData { - ULONG* pIndex; - ULONG* pLineNum; - ULONG nCount; + sal_uLong* pIndex; + sal_uLong* pLineNum; + sal_uLong nCount; public: MovedData( CompareData& rData, sal_Char* pDiscard ); ~MovedData(); - ULONG GetIndex( ULONG n ) const { return pIndex[ n ]; } - ULONG GetLineNum( ULONG n ) const { return pLineNum[ n ]; } - ULONG GetCount() const { return nCount; } + sal_uLong GetIndex( sal_uLong n ) const { return pIndex[ n ]; } + sal_uLong GetLineNum( sal_uLong n ) const { return pLineNum[ n ]; } + sal_uLong GetCount() const { return nCount; } }; private: @@ -173,9 +174,9 @@ private: const MovedData &rMoved1, &rMoved2; long *pMemory, *pFDiag, *pBDiag; - void Compare( ULONG nStt1, ULONG nEnd1, ULONG nStt2, ULONG nEnd2 ); - ULONG CheckDiag( ULONG nStt1, ULONG nEnd1, - ULONG nStt2, ULONG nEnd2, ULONG* pCost ); + void Compare( sal_uLong nStt1, sal_uLong nEnd1, sal_uLong nStt2, sal_uLong nEnd2 ); + sal_uLong CheckDiag( sal_uLong nStt1, sal_uLong nEnd1, + sal_uLong nStt2, sal_uLong nEnd2, sal_uLong* pCost ); public: CompareSequence( CompareData& rData1, CompareData& rData2, const MovedData& rD1, const MovedData& rD2 ); @@ -183,15 +184,15 @@ private: }; - static void CountDifference( const CompareData& rData, ULONG* pCounts ); + static void CountDifference( const CompareData& rData, sal_uLong* pCounts ); static void SetDiscard( const CompareData& rData, - sal_Char* pDiscard, ULONG* pCounts ); - static void CheckDiscard( ULONG nLen, sal_Char* pDiscard ); - static ULONG SetChangedFlag( CompareData& rData, sal_Char* pDiscard, int bFirst ); + sal_Char* pDiscard, sal_uLong* pCounts ); + static void CheckDiscard( sal_uLong nLen, sal_Char* pDiscard ); + static sal_uLong SetChangedFlag( CompareData& rData, sal_Char* pDiscard, int bFirst ); static void ShiftBoundaries( CompareData& rData1, CompareData& rData2 ); public: - Compare( ULONG nDiff, CompareData& rData1, CompareData& rData2 ); + Compare( sal_uLong nDiff, CompareData& rData1, CompareData& rData2 ); }; CompareLine::~CompareLine() {} @@ -233,7 +234,7 @@ void CompareData::CompareLines( CompareData& rData ) { CheckRanges( rData ); - ULONG nDifferent; + sal_uLong nDifferent; { Hash aH( GetLineCount() + rData.GetLineCount() + 1 ); aH.CalcHashValue( *this ); @@ -245,17 +246,17 @@ void CompareData::CompareLines( CompareData& rData ) } } -ULONG CompareData::ShowDiffs( const CompareData& rData ) +sal_uLong CompareData::ShowDiffs( const CompareData& rData ) { - ULONG nLen1 = rData.GetLineCount(), nLen2 = GetLineCount(); - ULONG nStt1 = 0, nStt2 = 0; - ULONG nCnt = 0; + sal_uLong nLen1 = rData.GetLineCount(), nLen2 = GetLineCount(); + sal_uLong nStt1 = 0, nStt2 = 0; + sal_uLong nCnt = 0; while( nStt1 < nLen1 || nStt2 < nLen2 ) { if( rData.GetChanged( nStt1 ) || GetChanged( nStt2 ) ) { - ULONG nSav1 = nStt1, nSav2 = nStt2; + sal_uLong nSav1 = nStt1, nSav2 = nStt2; while( nStt1 < nLen1 && rData.GetChanged( nStt1 )) ++nStt1; while( nStt2 < nLen2 && GetChanged( nStt2 )) ++nStt2; @@ -276,17 +277,17 @@ ULONG CompareData::ShowDiffs( const CompareData& rData ) return nCnt; } -BOOL CompareData::HasDiffs( const CompareData& rData ) const +sal_Bool CompareData::HasDiffs( const CompareData& rData ) const { - BOOL bRet = FALSE; - ULONG nLen1 = rData.GetLineCount(), nLen2 = GetLineCount(); - ULONG nStt1 = 0, nStt2 = 0; + sal_Bool bRet = sal_False; + sal_uLong nLen1 = rData.GetLineCount(), nLen2 = GetLineCount(); + sal_uLong nStt1 = 0, nStt2 = 0; while( nStt1 < nLen1 || nStt2 < nLen2 ) { if( rData.GetChanged( nStt1 ) || GetChanged( nStt2 ) ) { - bRet = TRUE; + bRet = sal_True; break; } ++nStt1, ++nStt2; @@ -294,24 +295,24 @@ BOOL CompareData::HasDiffs( const CompareData& rData ) const return bRet; } -void CompareData::ShowInsert( ULONG, ULONG ) +void CompareData::ShowInsert( sal_uLong, sal_uLong ) { } -void CompareData::ShowDelete( const CompareData&, ULONG, ULONG, ULONG ) +void CompareData::ShowDelete( const CompareData&, sal_uLong, sal_uLong, sal_uLong ) { } void CompareData::CheckForChangesInLine( const CompareData& , - ULONG&, ULONG&, ULONG&, ULONG& ) + sal_uLong&, sal_uLong&, sal_uLong&, sal_uLong& ) { } -Hash::Hash( ULONG nSize ) +Hash::Hash( sal_uLong nSize ) : nCount( 1 ) { -static const ULONG primes[] = +static const sal_uLong primes[] = { 509, 1021, @@ -352,8 +353,8 @@ static const ULONG primes[] = return; } nPrime = primes[ i ]; - pHashArr = new ULONG[ nPrime ]; - memset( pHashArr, 0, nPrime * sizeof( ULONG ) ); + pHashArr = new sal_uLong[ nPrime ]; + memset( pHashArr, 0, nPrime * sizeof( sal_uLong ) ); } Hash::~Hash() @@ -370,9 +371,9 @@ void Hash::CalcHashValue( CompareData& rData ) { const CompareLine* pLine = rData.GetLine( n ); OSL_ENSURE( pLine, "wo ist die Line?" ); - ULONG nH = pLine->GetHashValue(); + sal_uLong nH = pLine->GetHashValue(); - ULONG* pFound = &pHashArr[ nH % nPrime ]; + sal_uLong* pFound = &pHashArr[ nH % nPrime ]; size_t i; for( i = *pFound; ; i = pDataArr[i].nNext ) if( !i ) @@ -393,7 +394,7 @@ void Hash::CalcHashValue( CompareData& rData ) } } -Compare::Compare( ULONG nDiff, CompareData& rData1, CompareData& rData2 ) +Compare::Compare( sal_uLong nDiff, CompareData& rData1, CompareData& rData2 ) { MovedData *pMD1, *pMD2; // Suche die unterschiedlichen Lines @@ -401,10 +402,10 @@ Compare::Compare( ULONG nDiff, CompareData& rData1, CompareData& rData2 ) sal_Char* pDiscard1 = new sal_Char[ rData1.GetLineCount() ]; sal_Char* pDiscard2 = new sal_Char[ rData2.GetLineCount() ]; - ULONG* pCount1 = new ULONG[ nDiff ]; - ULONG* pCount2 = new ULONG[ nDiff ]; - memset( pCount1, 0, nDiff * sizeof( ULONG )); - memset( pCount2, 0, nDiff * sizeof( ULONG )); + sal_uLong* pCount1 = new sal_uLong[ nDiff ]; + sal_uLong* pCount2 = new sal_uLong[ nDiff ]; + memset( pCount1, 0, nDiff * sizeof( sal_uLong )); + memset( pCount2, 0, nDiff * sizeof( sal_uLong )); // stelle fest, welche Indizies in den CompareData mehrfach vergeben wurden CountDifference( rData1, pCount1 ); @@ -439,31 +440,31 @@ Compare::Compare( ULONG nDiff, CompareData& rData1, CompareData& rData2 ) delete pMD2; } -void Compare::CountDifference( const CompareData& rData, ULONG* pCounts ) +void Compare::CountDifference( const CompareData& rData, sal_uLong* pCounts ) { - ULONG nLen = rData.GetLineCount(); - for( ULONG n = 0; n < nLen; ++n ) + sal_uLong nLen = rData.GetLineCount(); + for( sal_uLong n = 0; n < nLen; ++n ) { - ULONG nIdx = rData.GetIndex( n ); + sal_uLong nIdx = rData.GetIndex( n ); ++pCounts[ nIdx ]; } } void Compare::SetDiscard( const CompareData& rData, - sal_Char* pDiscard, ULONG* pCounts ) + sal_Char* pDiscard, sal_uLong* pCounts ) { - ULONG nLen = rData.GetLineCount(); + sal_uLong nLen = rData.GetLineCount(); // berechne Max in Abhanegigkeit zur LineAnzahl - USHORT nMax = 5; - ULONG n; + sal_uInt16 nMax = 5; + sal_uLong n; for( n = nLen / 64; ( n = n >> 2 ) > 0; ) nMax <<= 1; for( n = 0; n < nLen; ++n ) { - ULONG nIdx = rData.GetIndex( n ); + sal_uLong nIdx = rData.GetIndex( n ); if( nIdx ) { nIdx = pCounts[ nIdx ]; @@ -474,17 +475,17 @@ void Compare::SetDiscard( const CompareData& rData, } } -void Compare::CheckDiscard( ULONG nLen, sal_Char* pDiscard ) +void Compare::CheckDiscard( sal_uLong nLen, sal_Char* pDiscard ) { - for( ULONG n = 0; n < nLen; ++n ) + for( sal_uLong n = 0; n < nLen; ++n ) { if( 2 == pDiscard[ n ] ) pDiscard[n] = 0; else if( pDiscard[ n ] ) { - ULONG j; - ULONG length; - ULONG provisional = 0; + sal_uLong j; + sal_uLong length; + sal_uLong provisional = 0; /* Find end of this run of discardable lines. Count how many are provisionally discardable. */ @@ -514,9 +515,9 @@ void Compare::CheckDiscard( ULONG nLen, sal_Char* pDiscard ) } else { - ULONG consec; - ULONG minimum = 1; - ULONG tem = length / 4; + sal_uLong consec; + sal_uLong minimum = 1; + sal_uLong tem = length / 4; /* MINIMUM is approximate square root of LENGTH/4. A subrun of two or more provisionals can stand @@ -580,8 +581,8 @@ void Compare::CheckDiscard( ULONG nLen, sal_Char* pDiscard ) Compare::MovedData::MovedData( CompareData& rData, sal_Char* pDiscard ) : pIndex( 0 ), pLineNum( 0 ), nCount( 0 ) { - ULONG nLen = rData.GetLineCount(); - ULONG n; + sal_uLong nLen = rData.GetLineCount(); + sal_uLong n; for( n = 0; n < nLen; ++n ) if( pDiscard[ n ] ) @@ -591,8 +592,8 @@ Compare::MovedData::MovedData( CompareData& rData, sal_Char* pDiscard ) if( nCount ) { - pIndex = new ULONG[ nCount ]; - pLineNum = new ULONG[ nCount ]; + pIndex = new sal_uLong[ nCount ]; + pLineNum = new sal_uLong[ nCount ]; for( n = 0, nCount = 0; n < nLen; ++n ) if( !pDiscard[ n ] ) @@ -615,7 +616,7 @@ Compare::CompareSequence::CompareSequence( const MovedData& rMD1, const MovedData& rMD2 ) : rData1( rD1 ), rData2( rD2 ), rMoved1( rMD1 ), rMoved2( rMD2 ) { - ULONG nSize = rMD1.GetCount() + rMD2.GetCount() + 3; + sal_uLong nSize = rMD1.GetCount() + rMD2.GetCount() + 3; pMemory = new long[ nSize * 2 ]; pFDiag = pMemory + ( rMD2.GetCount() + 1 ); pBDiag = pMemory + ( nSize + rMD2.GetCount() + 1 ); @@ -628,8 +629,8 @@ Compare::CompareSequence::~CompareSequence() delete pMemory; } -void Compare::CompareSequence::Compare( ULONG nStt1, ULONG nEnd1, - ULONG nStt2, ULONG nEnd2 ) +void Compare::CompareSequence::Compare( sal_uLong nStt1, sal_uLong nEnd1, + sal_uLong nStt2, sal_uLong nEnd2 ) { /* Slide down the bottom initial diagonal. */ while( nStt1 < nEnd1 && nStt2 < nEnd2 && @@ -652,7 +653,7 @@ void Compare::CompareSequence::Compare( ULONG nStt1, ULONG nEnd1, else { - ULONG c, d, b; + sal_uLong c, d, b; /* Find a point of correspondence in the middle of the files. */ @@ -672,8 +673,8 @@ void Compare::CompareSequence::Compare( ULONG nStt1, ULONG nEnd1, } } -ULONG Compare::CompareSequence::CheckDiag( ULONG nStt1, ULONG nEnd1, - ULONG nStt2, ULONG nEnd2, ULONG* pCost ) +sal_uLong Compare::CompareSequence::CheckDiag( sal_uLong nStt1, sal_uLong nEnd1, + sal_uLong nStt2, sal_uLong nEnd2, sal_uLong* pCost ) { const long dmin = nStt1 - nEnd2; /* Minimum valid diagonal. */ const long dmax = nEnd1 - nStt2; /* Maximum valid diagonal. */ @@ -706,7 +707,7 @@ ULONG Compare::CompareSequence::CheckDiag( ULONG nStt1, ULONG nEnd1, else x = thi; y = x - d; - while( ULONG(x) < nEnd1 && ULONG(y) < nEnd2 && + while( sal_uLong(x) < nEnd1 && sal_uLong(y) < nEnd2 && rMoved1.GetIndex( x ) == rMoved2.GetIndex( y )) ++x, ++y; pFDiag[d] = x; @@ -729,7 +730,7 @@ ULONG Compare::CompareSequence::CheckDiag( ULONG nStt1, ULONG nEnd1, else x = thi - 1; y = x - d; - while( ULONG(x) > nStt1 && ULONG(y) > nStt2 && + while( sal_uLong(x) > nStt1 && sal_uLong(y) > nStt2 && rMoved1.GetIndex( x - 1 ) == rMoved2.GetIndex( y - 1 )) --x, --y; pBDiag[d] = x; @@ -749,15 +750,15 @@ void Compare::ShiftBoundaries( CompareData& rData1, CompareData& rData2 ) CompareData* pData = &rData1; CompareData* pOtherData = &rData2; - ULONG i = 0; - ULONG j = 0; - ULONG i_end = pData->GetLineCount(); - ULONG preceding = ULONG_MAX; - ULONG other_preceding = ULONG_MAX; + sal_uLong i = 0; + sal_uLong j = 0; + sal_uLong i_end = pData->GetLineCount(); + sal_uLong preceding = ULONG_MAX; + sal_uLong other_preceding = ULONG_MAX; while (1) { - ULONG start, other_start; + sal_uLong start, other_start; /* Scan forwards to find beginning of another run of changes. Also keep track of the corresponding point in the other file. */ @@ -825,15 +826,15 @@ public: SwCompareLine( const SwNode& rNd ); virtual ~SwCompareLine(); - virtual ULONG GetHashValue() const; - virtual BOOL Compare( const CompareLine& rLine ) const; + virtual sal_uLong GetHashValue() const; + virtual sal_Bool Compare( const CompareLine& rLine ) const; - static ULONG GetTxtNodeHashValue( const SwTxtNode& rNd, ULONG nVal ); - static BOOL CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd ); - static BOOL CompareTxtNd( const SwTxtNode& rDstNd, + static sal_uLong GetTxtNodeHashValue( const SwTxtNode& rNd, sal_uLong nVal ); + static sal_Bool CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd ); + static sal_Bool CompareTxtNd( const SwTxtNode& rDstNd, const SwTxtNode& rSrcNd ); - BOOL ChangesInLine( const SwCompareLine& rLine, + sal_Bool ChangesInLine( const SwCompareLine& rLine, SwPaM *& rpInsRing, SwPaM*& rpDelRing ) const; const SwNode& GetNode() const { return rNode; } @@ -849,23 +850,23 @@ class SwCompareData : public CompareData SwDoc& rDoc; SwPaM *pInsRing, *pDelRing; - ULONG PrevIdx( const SwNode* pNd ); - ULONG NextIdx( const SwNode* pNd ); + sal_uLong PrevIdx( const SwNode* pNd ); + sal_uLong NextIdx( const SwNode* pNd ); virtual void CheckRanges( CompareData& ); - virtual void ShowInsert( ULONG nStt, ULONG nEnd ); - virtual void ShowDelete( const CompareData& rData, ULONG nStt, - ULONG nEnd, ULONG nInsPos ); + virtual void ShowInsert( sal_uLong nStt, sal_uLong nEnd ); + virtual void ShowDelete( const CompareData& rData, sal_uLong nStt, + sal_uLong nEnd, sal_uLong nInsPos ); virtual void CheckForChangesInLine( const CompareData& rData, - ULONG& nStt, ULONG& nEnd, - ULONG& nThisStt, ULONG& nThisEnd ); + sal_uLong& nStt, sal_uLong& nEnd, + sal_uLong& nThisStt, sal_uLong& nThisEnd ); public: SwCompareData( SwDoc& rD ) : rDoc( rD ), pInsRing(0), pDelRing(0) {} virtual ~SwCompareData(); - void SetRedlinesToDoc( BOOL bUseDocInfo ); + void SetRedlinesToDoc( sal_Bool bUseDocInfo ); }; SwCompareLine::SwCompareLine( const SwNode& rNd ) @@ -877,9 +878,9 @@ SwCompareLine::~SwCompareLine() { } -ULONG SwCompareLine::GetHashValue() const +sal_uLong SwCompareLine::GetHashValue() const { - ULONG nRet = 0; + sal_uLong nRet = 0; switch( rNode.GetNodeType() ) { case ND_TEXTNODE: @@ -936,7 +937,7 @@ const SwNode& SwCompareLine::GetEndNode() const return *pNd; } -BOOL SwCompareLine::Compare( const CompareLine& rLine ) const +sal_Bool SwCompareLine::Compare( const CompareLine& rLine ) const { return CompareNode( rNode, ((SwCompareLine&)rLine).rNode ); } @@ -964,12 +965,12 @@ namespace } } -BOOL SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd ) +sal_Bool SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd ) { if( rSrcNd.GetNodeType() != rDstNd.GetNodeType() ) - return FALSE; + return sal_False; - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; switch( rDstNd.GetNodeType() ) { @@ -1119,7 +1120,7 @@ String SwCompareLine::GetText() const return sRet; } -ULONG SwCompareLine::GetTxtNodeHashValue( const SwTxtNode& rNd, ULONG nVal ) +sal_uLong SwCompareLine::GetTxtNodeHashValue( const SwTxtNode& rNd, sal_uLong nVal ) { String sStr( rNd.GetExpandTxt() ); for( xub_StrLen n = 0; n < sStr.Len(); ++n ) @@ -1127,24 +1128,24 @@ ULONG SwCompareLine::GetTxtNodeHashValue( const SwTxtNode& rNd, ULONG nVal ) return nVal; } -BOOL SwCompareLine::CompareTxtNd( const SwTxtNode& rDstNd, +sal_Bool SwCompareLine::CompareTxtNd( const SwTxtNode& rDstNd, const SwTxtNode& rSrcNd ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; // erstmal ganz einfach! if( rDstNd.GetTxt() == rSrcNd.GetTxt() ) { // der Text ist gleich, aber sind die "Sonderattribute" (0xFF) auch // dieselben?? - bRet = TRUE; + bRet = sal_True; } return bRet; } -BOOL SwCompareLine::ChangesInLine( const SwCompareLine& rLine, +sal_Bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine, SwPaM *& rpInsRing, SwPaM*& rpDelRing ) const { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( ND_TEXTNODE == rNode.GetNodeType() && ND_TEXTNODE == rLine.GetNode().GetNodeType() ) { @@ -1191,14 +1192,12 @@ BOOL SwCompareLine::ChangesInLine( const SwCompareLine& rLine, if( nStt != nSEnd ) { { - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo()); SwPaM aCpyPam( rSrcNd, nStt ); aCpyPam.SetMark(); aCpyPam.GetPoint()->nContent = nSEnd; aCpyPam.GetDoc()->CopyRange( aCpyPam, *aPam.GetPoint(), false ); - pDoc->DoUndo( bUndo ); } SwPaM* pTmp = new SwPaM( *aPam.GetPoint(), rpDelRing ); @@ -1215,7 +1214,7 @@ BOOL SwCompareLine::ChangesInLine( const SwCompareLine& rLine, *pCorr->GetPoint() = *pTmp->GetMark(); } } - bRet = TRUE; + bRet = sal_True; } } return bRet; @@ -1237,7 +1236,7 @@ SwCompareData::~SwCompareData() } } -ULONG SwCompareData::NextIdx( const SwNode* pNd ) +sal_uLong SwCompareData::NextIdx( const SwNode* pNd ) { if( pNd->IsStartNode() ) { @@ -1251,7 +1250,7 @@ ULONG SwCompareData::NextIdx( const SwNode* pNd ) return pNd->GetIndex() + 1; } -ULONG SwCompareData::PrevIdx( const SwNode* pNd ) +sal_uLong SwCompareData::PrevIdx( const SwNode* pNd ) { if( pNd->IsEndNode() ) { @@ -1273,11 +1272,11 @@ void SwCompareData::CheckRanges( CompareData& rData ) const SwNode& rSrcEndNd = rSrcNds.GetEndOfContent(); const SwNode& rDstEndNd = rDstNds.GetEndOfContent(); - ULONG nSrcSttIdx = NextIdx( rSrcEndNd.StartOfSectionNode() ); - ULONG nSrcEndIdx = rSrcEndNd.GetIndex(); + sal_uLong nSrcSttIdx = NextIdx( rSrcEndNd.StartOfSectionNode() ); + sal_uLong nSrcEndIdx = rSrcEndNd.GetIndex(); - ULONG nDstSttIdx = NextIdx( rDstEndNd.StartOfSectionNode() ); - ULONG nDstEndIdx = rDstEndNd.GetIndex(); + sal_uLong nDstSttIdx = NextIdx( rDstEndNd.StartOfSectionNode() ); + sal_uLong nDstEndIdx = rDstEndNd.GetIndex(); while( nSrcSttIdx < nSrcEndIdx && nDstSttIdx < nDstEndIdx ) { @@ -1318,7 +1317,7 @@ void SwCompareData::CheckRanges( CompareData& rData ) } } -void SwCompareData::ShowInsert( ULONG nStt, ULONG nEnd ) +void SwCompareData::ShowInsert( sal_uLong nStt, sal_uLong nEnd ) { SwPaM* pTmp = new SwPaM( ((SwCompareLine*)GetLine( nStt ))->GetNode(), 0, ((SwCompareLine*)GetLine( nEnd-1 ))->GetEndNode(), 0, @@ -1330,14 +1329,14 @@ void SwCompareData::ShowInsert( ULONG nStt, ULONG nEnd ) } -void SwCompareData::ShowDelete( const CompareData& rData, ULONG nStt, - ULONG nEnd, ULONG nInsPos ) +void SwCompareData::ShowDelete( const CompareData& rData, sal_uLong nStt, + sal_uLong nEnd, sal_uLong nInsPos ) { SwNodeRange aRg( ((SwCompareLine*)rData.GetLine( nStt ))->GetNode(), 0, ((SwCompareLine*)rData.GetLine( nEnd-1 ))->GetEndNode(), 1 ); - USHORT nOffset = 0; + sal_uInt16 nOffset = 0; const CompareLine* pLine; if( GetLineCount() == nInsPos ) { @@ -1389,8 +1388,8 @@ void SwCompareData::ShowDelete( const CompareData& rData, ULONG nStt, } void SwCompareData::CheckForChangesInLine( const CompareData& rData, - ULONG& rStt, ULONG& rEnd, - ULONG& rThisStt, ULONG& rThisEnd ) + sal_uLong& rStt, sal_uLong& rEnd, + sal_uLong& rThisStt, sal_uLong& rThisEnd ) { while( rStt < rEnd && rThisStt < rThisEnd ) { @@ -1404,12 +1403,12 @@ void SwCompareData::CheckForChangesInLine( const CompareData& rData, } } -void SwCompareData::SetRedlinesToDoc( BOOL bUseDocInfo ) +void SwCompareData::SetRedlinesToDoc( sal_Bool bUseDocInfo ) { SwPaM* pTmp = pDelRing; // get the Author / TimeStamp from the "other" document info - USHORT nAuthor = rDoc.GetRedlineAuthor(); + sal_uInt16 nAuthor = rDoc.GetRedlineAuthor(); DateTime aTimeStamp; SwDocShell *pDocShell(rDoc.GetDocShell()); DBG_ASSERT(pDocShell, "no SwDocShell"); @@ -1464,8 +1463,11 @@ void SwCompareData::SetRedlinesToDoc( BOOL bUseDocInfo ) rDoc.DeleteRedline( *pTmp, false, USHRT_MAX ); - if( rDoc.DoesUndo() ) - rDoc.AppendUndo( new SwUndoCompDoc( *pTmp, FALSE )); + if (rDoc.GetIDocumentUndoRedo().DoesUndo()) + { + SwUndo *const pUndo(new SwUndoCompDoc( *pTmp, sal_False )) ; + rDoc.GetIDocumentUndoRedo().AppendUndo(pUndo); + } rDoc.AppendRedline( new SwRedline( aRedlnData, *pTmp ), true ); } while( pDelRing != ( pTmp = (SwPaM*)pTmp->GetNext() )); @@ -1530,8 +1532,11 @@ void SwCompareData::SetRedlinesToDoc( BOOL bUseDocInfo ) do { if( rDoc.AppendRedline( new SwRedline( aRedlnData, *pTmp ), true) && - rDoc.DoesUndo() ) - rDoc.AppendUndo( new SwUndoCompDoc( *pTmp, TRUE )); + rDoc.GetIDocumentUndoRedo().DoesUndo()) + { + SwUndo *const pUndo(new SwUndoCompDoc( *pTmp, sal_True )); + rDoc.GetIDocumentUndoRedo().AppendUndo(pUndo); + } } while( pInsRing != ( pTmp = (SwPaM*)pTmp->GetNext() )); } } @@ -1544,10 +1549,10 @@ long SwDoc::CompareDoc( const SwDoc& rDoc ) long nRet = 0; - StartUndo(UNDO_EMPTY, NULL); - BOOL bDocWasModified = IsModified(); + GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); + sal_Bool bDocWasModified = IsModified(); SwDoc& rSrcDoc = (SwDoc&)rDoc; - BOOL bSrcModified = rSrcDoc.IsModified(); + sal_Bool bSrcModified = rSrcDoc.IsModified(); RedlineMode_t eSrcRedlMode = rSrcDoc.GetRedlineMode(); rSrcDoc.SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_INSERT ); @@ -1575,13 +1580,11 @@ long SwDoc::CompareDoc( const SwDoc& rDoc ) if( !bSrcModified ) rSrcDoc.ResetModified(); - EndUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); return nRet; } -typedef void (SwDoc::*FNInsUndo)( SwUndo* ); - class _SaveMergeRedlines : public Ring { const SwRedline* pSrcRedl; @@ -1589,7 +1592,7 @@ class _SaveMergeRedlines : public Ring public: _SaveMergeRedlines( const SwNode& rDstNd, const SwRedline& rSrcRedl, Ring* pRing ); - USHORT InsertRedline( FNInsUndo pFn ); + sal_uInt16 InsertRedline(); SwRedline* GetDestRedline() { return pDestRedl; } }; @@ -1620,16 +1623,15 @@ _SaveMergeRedlines::_SaveMergeRedlines( const SwNode& rDstNd, } } -USHORT _SaveMergeRedlines::InsertRedline( FNInsUndo pFn ) +sal_uInt16 _SaveMergeRedlines::InsertRedline() { - USHORT nIns = 0; + sal_uInt16 nIns = 0; SwDoc* pDoc = pDestRedl->GetDoc(); if( nsRedlineType_t::REDLINE_INSERT == pDestRedl->GetType() ) { // der Teil wurde eingefuegt, also kopiere ihn aus dem SourceDoc - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); SwNodeIndex aSaveNd( pDestRedl->GetPoint()->nNode, -1 ); xub_StrLen nSaveCnt = pDestRedl->GetPoint()->nContent.GetIndex(); @@ -1642,7 +1644,6 @@ USHORT _SaveMergeRedlines::InsertRedline( FNInsUndo pFn ) *pDestRedl->GetPoint(), false ); pDoc->SetRedlineMode_intern( eOld ); - pDoc->DoUndo( bUndo ); pDestRedl->SetMark(); aSaveNd++; @@ -1664,7 +1665,7 @@ USHORT _SaveMergeRedlines::InsertRedline( FNInsUndo pFn ) // eingefuegter ist, dann muss dieser gesplittet werden! SwPosition* pDStt = pDestRedl->GetMark(), * pDEnd = pDestRedl->GetPoint(); - USHORT n = 0; + sal_uInt16 n = 0; // zur StartPos das erste Redline suchen if( !pDoc->GetRedline( *pDStt, &n ) && n ) @@ -1704,13 +1705,16 @@ USHORT _SaveMergeRedlines::InsertRedline( FNInsUndo pFn ) pCpyRedl->SetMark(); *pCpyRedl->GetPoint() = *pRStt; - SwUndoCompDoc* pUndo = pDoc->DoesUndo() + SwUndoCompDoc *const pUndo = + (pDoc->GetIDocumentUndoRedo().DoesUndo()) ? new SwUndoCompDoc( *pCpyRedl ) : 0; // now modify doc: append redline, undo (and count) pDoc->AppendRedline( pCpyRedl, true ); if( pUndo ) - (pDoc->*pFn)( pUndo ); + { + pDoc->GetIDocumentUndoRedo().AppendUndo(pUndo); + } ++nIns; *pDStt = *pREnd; @@ -1737,12 +1741,15 @@ USHORT _SaveMergeRedlines::InsertRedline( FNInsUndo pFn ) if( pDestRedl ) { - SwUndoCompDoc* pUndo = pDoc->DoesUndo() ? new SwUndoCompDoc( *pDestRedl ) : 0; + SwUndoCompDoc *const pUndo = (pDoc->GetIDocumentUndoRedo().DoesUndo()) + ? new SwUndoCompDoc( *pDestRedl ) : 0; // now modify doc: append redline, undo (and count) bool bRedlineAccepted = pDoc->AppendRedline( pDestRedl, true ); if( pUndo ) - (pDoc->*pFn)( pUndo ); + { + pDoc->GetIDocumentUndoRedo().AppendUndo( pUndo ); + } ++nIns; // if AppendRedline has deleted our redline, we may not keep a @@ -1761,10 +1768,10 @@ long SwDoc::MergeDoc( const SwDoc& rDoc ) long nRet = 0; - StartUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); SwDoc& rSrcDoc = (SwDoc&)rDoc; - BOOL bSrcModified = rSrcDoc.IsModified(); + sal_Bool bSrcModified = rSrcDoc.IsModified(); RedlineMode_t eSrcRedlMode = rSrcDoc.GetRedlineMode(); rSrcDoc.SetRedlineMode( nsRedlineMode_t::REDLINE_SHOW_DELETE ); @@ -1783,12 +1790,12 @@ long SwDoc::MergeDoc( const SwDoc& rDoc ) // deren Position im DestDoc _SaveMergeRedlines* pRing = 0; const SwRedlineTbl& rSrcRedlTbl = rSrcDoc.GetRedlineTbl(); - ULONG nEndOfExtra = rSrcDoc.GetNodes().GetEndOfExtras().GetIndex(); - ULONG nMyEndOfExtra = GetNodes().GetEndOfExtras().GetIndex(); - for( USHORT n = 0; n < rSrcRedlTbl.Count(); ++n ) + sal_uLong nEndOfExtra = rSrcDoc.GetNodes().GetEndOfExtras().GetIndex(); + sal_uLong nMyEndOfExtra = GetNodes().GetEndOfExtras().GetIndex(); + for( sal_uInt16 n = 0; n < rSrcRedlTbl.Count(); ++n ) { const SwRedline* pRedl = rSrcRedlTbl[ n ]; - ULONG nNd = pRedl->GetPoint()->nNode.GetIndex(); + sal_uLong nNd = pRedl->GetPoint()->nNode.GetIndex(); RedlineType_t eType = pRedl->GetType(); if( nEndOfExtra < nNd && ( nsRedlineType_t::REDLINE_INSERT == eType || nsRedlineType_t::REDLINE_DELETE == eType )) @@ -1818,7 +1825,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc ) _SaveMergeRedlines* pTmp = pRing; do { - nRet += pTmp->InsertRedline( &SwDoc::AppendUndo ); + nRet += pTmp->InsertRedline(); } while( pRing != ( pTmp = (_SaveMergeRedlines*)pTmp->GetNext() )); while( pRing != pRing->GetNext() ) @@ -1833,7 +1840,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc ) SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)); - EndUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); return nRet; } diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx index b68d512d1aa0..d13affa1c536 100644 --- a/sw/source/core/doc/doccorr.cxx +++ b/sw/source/core/doc/doccorr.cxx @@ -74,9 +74,9 @@ namespace { - // find the relevant section in which the SwUnoCrsr may wander. returns NULL if - // no restrictions apply - const SwStartNode* lcl_FindUnoCrsrSection( const SwNode& rNode ) + // find the relevant section in which the SwUnoCrsr may wander. + // returns NULL if no restrictions apply + static const SwStartNode* lcl_FindUnoCrsrSection( const SwNode& rNode ) { const SwStartNode* pStartNode = rNode.StartOfSectionNode(); while( ( pStartNode != NULL ) && @@ -87,45 +87,28 @@ namespace return pStartNode; } - static inline void lcl_PaMCorrAbs1(SwPaM * pPam, - SwNode const * const pOldNode, - const SwPosition& rNewPos, - const xub_StrLen nOffset) - { - for(int nb = 0; nb < 2; ++nb) - if(&((pPam)->GetBound(BOOL(nb)).nNode.GetNode()) == pOldNode) - { - (pPam)->GetBound(BOOL(nb)) = rNewPos; - (pPam)->GetBound(BOOL(nb)).nContent += nOffset; - } - }; - - static inline bool lcl_PaMCorrAbs2(SwPaM* pPam, - const SwPosition& rNewPos, - ULONG nSttNode, - ULONG nEndNode) + static inline bool lcl_PosCorrAbs(SwPosition & rPos, + const SwPosition& rStart, + const SwPosition& rEnd, + const SwPosition& rNewPos) { - bool bRet = false; - - for(int nb = 0; nb < 2; ++nb) - if((pPam)->GetBound(BOOL(nb)).nNode >= nSttNode && - (pPam)->GetBound(BOOL(nb)).nNode <= nEndNode) - { - (pPam)->GetBound(BOOL(nb)) = rNewPos; - bRet = true; - } - return bRet; + if ((rStart <= rPos) && (rPos <= rEnd)) + { + rPos = rNewPos; + return true; + } + return false; }; - static inline void lcl_PaMCorrAbs3(SwPaM * pPam, + static inline bool lcl_PaMCorrAbs(SwPaM & rPam, const SwPosition& rStart, const SwPosition& rEnd, const SwPosition& rNewPos) { - for(int nb = 0; nb < 2; ++nb) - if(rStart <= (pPam)->GetBound(BOOL(nb)) && - (pPam)->GetBound(BOOL(nb)) <= rEnd ) - (pPam)->GetBound(BOOL(nb)) = rNewPos; + bool bRet = false; + bRet |= lcl_PosCorrAbs(rPam.GetBound(true ), rStart, rEnd, rNewPos); + bRet |= lcl_PosCorrAbs(rPam.GetBound(false), rStart, rEnd, rNewPos); + return bRet; }; static inline void lcl_PaMCorrRel1(SwPaM * pPam, @@ -134,129 +117,79 @@ namespace const xub_StrLen nCntIdx) { for(int nb = 0; nb < 2; ++nb) - if(&((pPam)->GetBound(BOOL(nb)).nNode.GetNode()) == pOldNode) + if(&((pPam)->GetBound(sal_Bool(nb)).nNode.GetNode()) == pOldNode) { - (pPam)->GetBound(BOOL(nb)).nNode = rNewPos.nNode; - (pPam)->GetBound(BOOL(nb)).nContent.Assign( + (pPam)->GetBound(sal_Bool(nb)).nNode = rNewPos.nNode; + (pPam)->GetBound(sal_Bool(nb)).nContent.Assign( const_cast<SwIndexReg*>(rNewPos.nContent.GetIdxReg()), - nCntIdx + (pPam)->GetBound(BOOL(nb)).nContent.GetIndex()); + nCntIdx + (pPam)->GetBound(sal_Bool(nb)).nContent.GetIndex()); } } } -void PaMCorrAbs( const SwNodeIndex &rOldNode, - const SwPosition &rNewPos, - const xub_StrLen nOffset) -{ - const SwNode* pOldNode = &rOldNode.GetNode(); - const SwPosition aNewPos( rNewPos ); - const SwDoc* pDoc = pOldNode->GetDoc(); - SwCrsrShell* pShell = pDoc->GetEditShell(); - - if( pShell ) - { - FOREACHSHELL_START( pShell ) - SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); - if( _pStkCrsr ) - do { - lcl_PaMCorrAbs1( _pStkCrsr, pOldNode, aNewPos, nOffset ); - } while ( (_pStkCrsr != 0 ) && - ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) ); - - FOREACHPAM_START( PCURSH->_GetCrsr() ) - lcl_PaMCorrAbs1( PCURCRSR, pOldNode, aNewPos, nOffset ); - FOREACHPAM_END() - - if( PCURSH->IsTableMode() ) - lcl_PaMCorrAbs1( PCURSH->GetTblCrs(), pOldNode, aNewPos, nOffset ); - - FOREACHSHELL_END( pShell ) - } - - { - SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl(); - for( USHORT n = 0; n < rTbl.Count(); ++n ) - { - FOREACHPAM_START( rTbl[ n ] ) - lcl_PaMCorrAbs1( PCURCRSR, pOldNode, aNewPos, nOffset ); - FOREACHPAM_END() - SwUnoTableCrsr* pUnoTblCrsr = - dynamic_cast<SwUnoTableCrsr*>(rTbl[ n ]); - if( pUnoTblCrsr ) - { - FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() ) - lcl_PaMCorrAbs1( PCURCRSR, pOldNode, aNewPos, nOffset ); - FOREACHPAM_END() - } - } - } -} - - -void PaMCorrAbs( const SwNodeIndex &rStartNode, - const SwNodeIndex &rEndNode, - const SwPosition &rNewPos ) +void PaMCorrAbs( const SwPaM& rRange, + const SwPosition& rNewPos ) { - const ULONG nSttNode = rStartNode.GetIndex(); - const ULONG nEndNode = rEndNode.GetIndex(); - const SwPosition aNewPos( rNewPos ); - SwDoc* pDoc = rStartNode.GetNode().GetDoc(); + SwPosition const aStart( *rRange.Start() ); + SwPosition const aEnd( *rRange.End() ); + SwPosition const aNewPos( rNewPos ); + SwDoc *const pDoc = aStart.nNode.GetNode().GetDoc(); + SwCrsrShell *const pShell = pDoc->GetEditShell(); - SwCrsrShell* pShell = pDoc->GetEditShell(); if( pShell ) { FOREACHSHELL_START( pShell ) SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); if( _pStkCrsr ) do { - lcl_PaMCorrAbs2( _pStkCrsr, aNewPos, nSttNode, nEndNode ); + lcl_PaMCorrAbs( *_pStkCrsr, aStart, aEnd, aNewPos ); } while ( (_pStkCrsr != 0 ) && ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) ); FOREACHPAM_START( PCURSH->_GetCrsr() ) - lcl_PaMCorrAbs2( PCURCRSR, aNewPos, nSttNode, nEndNode ); + lcl_PaMCorrAbs( *PCURCRSR, aStart, aEnd, aNewPos ); FOREACHPAM_END() if( PCURSH->IsTableMode() ) - lcl_PaMCorrAbs2( PCURSH->GetTblCrs(), aNewPos, nSttNode, nEndNode ); + lcl_PaMCorrAbs( *PCURSH->GetTblCrs(), aStart, aEnd, aNewPos ); FOREACHSHELL_END( pShell ) } - { - SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl(); - for( USHORT n = 0; n < rTbl.Count(); ++n ) + SwUnoCrsrTbl& rTbl = const_cast<SwUnoCrsrTbl&>(pDoc->GetUnoCrsrTbl()); + + for( sal_uInt16 n = 0; n < rTbl.Count(); ++n ) { - bool bChange = false; + SwUnoCrsr *const pUnoCursor = rTbl[ n ]; - SwUnoCrsr* pUnoCursor = rTbl[ n ]; + bool bChange = false; // has the UNO cursor been corrected? // determine whether the UNO cursor will leave it's designated // section - bool bLeaveSection = + bool const bLeaveSection = pUnoCursor->IsRemainInSection() && ( lcl_FindUnoCrsrSection( aNewPos.nNode.GetNode() ) != lcl_FindUnoCrsrSection( pUnoCursor->GetPoint()->nNode.GetNode() ) ); FOREACHPAM_START( pUnoCursor ) - bChange |= lcl_PaMCorrAbs2(PCURCRSR, aNewPos, nSttNode, nEndNode); + bChange |= lcl_PaMCorrAbs( *PCURCRSR, aStart, aEnd, aNewPos ); FOREACHPAM_END() - SwUnoTableCrsr* pUnoTblCrsr = - dynamic_cast<SwUnoTableCrsr*>(pUnoCursor); + SwUnoTableCrsr *const pUnoTblCrsr = + dynamic_cast<SwUnoTableCrsr *>(rTbl[ n ]); if( pUnoTblCrsr ) { FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() ) bChange |= - lcl_PaMCorrAbs2( PCURCRSR, aNewPos, nSttNode, nEndNode ); + lcl_PaMCorrAbs( *PCURCRSR, aStart, aEnd, aNewPos ); FOREACHPAM_END() } // if a UNO cursor leaves its designated section, we must inform // (and invalidate) said cursor - if( bChange && bLeaveSection ) + if (bChange && bLeaveSection) { // the UNO cursor has left its section. We need to notify it! SwMsgPoolItem aHint( RES_UNOCURSOR_LEAVES_SECTION ); @@ -266,77 +199,36 @@ void PaMCorrAbs( const SwNodeIndex &rStartNode, } } - -void PaMCorrAbs( const SwPaM& rRange, - const SwPosition& rNewPos ) -{ - SwPosition aStart( *rRange.Start() ); - SwPosition aEnd( *rRange.End() ); - SwPosition aNewPos( rNewPos ); - SwDoc* pDoc = aStart.nNode.GetNode().GetDoc(); - SwCrsrShell* pShell = pDoc->GetEditShell(); - - if( pShell ) - { - FOREACHSHELL_START( pShell ) - SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); - if( _pStkCrsr ) - do { - lcl_PaMCorrAbs3( _pStkCrsr, aStart, aEnd, aNewPos ); - } while ( (_pStkCrsr != 0 ) && - ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) ); - - FOREACHPAM_START( PCURSH->_GetCrsr() ) - lcl_PaMCorrAbs3( PCURCRSR, aStart, aEnd, aNewPos ); - FOREACHPAM_END() - - if( PCURSH->IsTableMode() ) - lcl_PaMCorrAbs3( PCURSH->GetTblCrs(), aStart, aEnd, aNewPos ); - - FOREACHSHELL_END( pShell ) - } - { - SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl(); - for( USHORT n = 0; n < rTbl.Count(); ++n ) - { - FOREACHPAM_START( rTbl[ n ] ) - lcl_PaMCorrAbs3( PCURCRSR, aStart, aEnd, aNewPos ); - FOREACHPAM_END() - - SwUnoTableCrsr* pUnoTblCrsr = - dynamic_cast<SwUnoTableCrsr*>(rTbl[ n ]); - if( pUnoTblCrsr ) - { - FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() ) - lcl_PaMCorrAbs3( PCURCRSR, aStart, aEnd, aNewPos ); - FOREACHPAM_END() - } - } - } -} - void SwDoc::CorrAbs(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset, - BOOL bMoveCrsr) + sal_Bool bMoveCrsr) { + SwCntntNode *const pCntntNode( rOldNode.GetNode().GetCntntNode() ); + SwPaM const aPam(rOldNode, 0, + rOldNode, (pCntntNode) ? pCntntNode->Len() : 0); + SwPosition aNewPos(rNewPos); + aNewPos.nContent += nOffset; + getIDocumentMarkAccess()->correctMarksAbsolute(rOldNode, rNewPos, nOffset); - { // fix readlines + { // fix redlines SwRedlineTbl& rTbl = *pRedlineTbl; - for( USHORT n = 0; n < rTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rTbl.Count(); ++n ) { // is on position ?? - lcl_PaMCorrAbs1( rTbl[ n ], &rOldNode.GetNode(), SwPosition(rNewPos), nOffset ); + lcl_PaMCorrAbs(*rTbl[ n ], *aPam.Start(), *aPam.End(), aNewPos); } } if(bMoveCrsr) - ::PaMCorrAbs(rOldNode, rNewPos, nOffset); + { + ::PaMCorrAbs(aPam, aNewPos); + } } void SwDoc::CorrAbs(const SwPaM& rRange, const SwPosition& rNewPos, - BOOL bMoveCrsr) + sal_Bool bMoveCrsr) { SwPosition aStart(*rRange.Start()); SwPosition aEnd(*rRange.End()); @@ -351,14 +243,17 @@ void SwDoc::CorrAbs(const SwPaM& rRange, void SwDoc::CorrAbs(const SwNodeIndex& rStartNode, const SwNodeIndex& rEndNode, const SwPosition& rNewPos, - BOOL bMoveCrsr) + sal_Bool bMoveCrsr) { - SwPosition aNewPos(rNewPos); - _DelBookmarks(rStartNode, rEndNode); if(bMoveCrsr) - ::PaMCorrAbs(rStartNode, rEndNode, rNewPos); + { + SwCntntNode *const pCntntNode( rEndNode.GetNode().GetCntntNode() ); + SwPaM const aPam(rStartNode, 0, + rEndNode, (pCntntNode) ? pCntntNode->Len() : 0); + ::PaMCorrAbs(aPam, rNewPos); + } } @@ -397,7 +292,7 @@ void PaMCorrRel( const SwNodeIndex &rOldNode, } { SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl(); - for( USHORT n = 0; n < rTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rTbl.Count(); ++n ) { FOREACHPAM_START( rTbl[ n ] ) lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx ); @@ -418,14 +313,14 @@ void PaMCorrRel( const SwNodeIndex &rOldNode, void SwDoc::CorrRel(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset, - BOOL bMoveCrsr) + sal_Bool bMoveCrsr) { getIDocumentMarkAccess()->correctMarksRelative(rOldNode, rNewPos, nOffset); { // dann die Redlines korrigieren SwRedlineTbl& rTbl = *pRedlineTbl; SwPosition aNewPos(rNewPos); - for( USHORT n = 0; n < rTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rTbl.Count(); ++n ) { // liegt auf der Position ?? lcl_PaMCorrRel1( rTbl[ n ], &rOldNode.GetNode(), aNewPos, aNewPos.nContent.GetIndex() + nOffset ); @@ -459,5 +354,9 @@ SwEditShell* SwDoc::GetEditShell( ViewShell** ppSh ) const return 0; } +::sw::IShellCursorSupplier * SwDoc::GetIShellCursorSupplier() +{ + return GetEditShell(0); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/docdde.cxx b/sw/source/core/doc/docdde.cxx index 6959e2880877..10892ca2a611 100644 --- a/sw/source/core/doc/docdde.cxx +++ b/sw/source/core/doc/docdde.cxx @@ -92,7 +92,7 @@ struct _FindItem {} }; -BOOL lcl_FindSection( const SwSectionFmtPtr& rpSectFmt, void* pArgs, bool bCaseSensitive ) +sal_Bool lcl_FindSection( const SwSectionFmtPtr& rpSectFmt, void* pArgs, bool bCaseSensitive ) { _FindItem * const pItem( static_cast<_FindItem*>(pArgs) ); SwSection* pSect = rpSectFmt->GetSection(); @@ -113,26 +113,26 @@ BOOL lcl_FindSection( const SwSectionFmtPtr& rpSectFmt, void* pArgs, bool bCaseS { // eine Tabelle im normalen NodesArr pItem->pSectNd = pIdx->GetNode().GetSectionNode(); - return FALSE; + return sal_False; } //nein!! // sollte der Namen schon passen, der Rest aber nicht, dann haben wir // sie nicht. Die Namen sind immer eindeutig. } } - return TRUE; // dann weiter + return sal_True; // dann weiter } -BOOL lcl_FindSectionCaseSensitive( const SwSectionFmtPtr& rpSectFmt, void* pArgs ) +sal_Bool lcl_FindSectionCaseSensitive( const SwSectionFmtPtr& rpSectFmt, void* pArgs ) { return lcl_FindSection( rpSectFmt, pArgs, true ); } -BOOL lcl_FindSectionCaseInsensitive( const SwSectionFmtPtr& rpSectFmt, void* pArgs ) +sal_Bool lcl_FindSectionCaseInsensitive( const SwSectionFmtPtr& rpSectFmt, void* pArgs ) { return lcl_FindSection( rpSectFmt, pArgs, false ); } -BOOL lcl_FindTable( const SwFrmFmtPtr& rpTableFmt, void* pArgs ) +sal_Bool lcl_FindTable( const SwFrmFmtPtr& rpTableFmt, void* pArgs ) { _FindItem * const pItem( static_cast<_FindItem*>(pArgs) ); String sNm( GetAppCharClass().lower( rpTableFmt->GetName() )); @@ -148,12 +148,12 @@ BOOL lcl_FindTable( const SwFrmFmtPtr& rpTableFmt, void* pArgs ) // eine Tabelle im normalen NodesArr pItem->pTblNd = (SwTableNode*) pFBox->GetSttNd()->FindTableNode(); - return FALSE; + return sal_False; } //nein! // sollte der Namen schon passen, der Rest aber nicht, dann haben wir // sie nicht. Die Namen sind immer eindeutig. } - return TRUE; // dann weiter + return sal_True; // dann weiter } @@ -192,7 +192,7 @@ bool SwDoc::GetData( const String& rItem, const String& rMimeType, return SwServerObject( *aPara.pTblNd ).GetData( rValue, rMimeType ); } - return FALSE; + return sal_False; } @@ -230,7 +230,7 @@ bool SwDoc::SetData( const String& rItem, const String& rMimeType, return SwServerObject( *aPara.pTblNd ).SetData( rMimeType, rValue ); } - return FALSE; + return sal_False; } @@ -288,7 +288,7 @@ bool SwDoc::SetData( const String& rItem, const String& rMimeType, return pObj; } -BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam, +sal_Bool SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam, SwNodeRange*& rpRange ) const { // haben wir ueberhaupt das Item vorraetig? @@ -307,7 +307,7 @@ BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam, // sondern auch Rahmen(Text!), Tabellen, Gliederungen: if( STRING_NOTFOUND != nPos ) { - BOOL bWeiter = FALSE; + sal_Bool bWeiter = sal_False; String sName( sItem.Copy( 0, nPos ) ); String sCmp( sItem.Copy( nPos + 1 )); rCC.toLower( sItem ); @@ -323,7 +323,7 @@ BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam, { rpRange = new SwNodeRange( *aPara.pTblNd, 0, *aPara.pTblNd->EndOfSectionNode(), 1 ); - return TRUE; + return sal_True; } } else if( sCmp.EqualsAscii( pMarkToFrame ) ) @@ -336,13 +336,13 @@ BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam, !( pNd = &pIdx->GetNode())->IsNoTxtNode() ) { rpRange = new SwNodeRange( *pNd, 1, *pNd->EndOfSectionNode() ); - return TRUE; + return sal_True; } } else if( sCmp.EqualsAscii( pMarkToRegion ) ) { sItem = sName; // wird unten behandelt ! - bWeiter = TRUE; + bWeiter = sal_True; } else if( sCmp.EqualsAscii( pMarkToOutline ) ) { @@ -350,11 +350,11 @@ BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam, if( GotoOutline( aPos, sName )) { SwNode* pNd = &aPos.nNode.GetNode(); - //BYTE nLvl = pNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei + //sal_uInt8 nLvl = pNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei const int nLvl = pNd->GetTxtNode()->GetAttrOutlineLevel()-1;//<-end,zhaojianwei const SwOutlineNodes& rOutlNds = GetNodes().GetOutLineNds(); - USHORT nTmpPos; + sal_uInt16 nTmpPos; rOutlNds.Seek_Entry( pNd, &nTmpPos ); rpRange = new SwNodeRange( aPos.nNode, 0, aPos.nNode ); @@ -371,12 +371,12 @@ BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam, rpRange->aEnd = *rOutlNds[ nTmpPos ]; else rpRange->aEnd = GetNodes().GetEndOfContent(); - return TRUE; + return sal_True; } } if( !bWeiter ) - return FALSE; + return sal_False; } //search for bookmarks and sections case senstive at first. If nothing is found then try again case insensitive @@ -404,7 +404,7 @@ BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam, { rpRange = new SwNodeRange( *aPara.pSectNd, 1, *aPara.pSectNd->EndOfSectionNode() ); - return TRUE; + return sal_True; } } @@ -412,7 +412,7 @@ BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam, break; bCaseSensitive = false; } - return FALSE; + return sal_False; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index cf2de5b310c7..30adf7eb721a 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <vcl/virdev.hxx> #include <svx/svdmodel.hxx> @@ -49,6 +50,7 @@ #include <ndole.hxx> #include <mdiexp.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <pagefrm.hxx> //Fuer DelPageDesc #include <rootfrm.hxx> //Fuer DelPageDesc @@ -69,6 +71,7 @@ #include <GetMetricVal.hxx> #include <unotools/syslocale.hxx> #include <statstr.hrc> +#include <hints.hxx> #include <SwUndoPageDesc.hxx> @@ -120,8 +123,8 @@ static void lcl_DefaultPageFmt( sal_uInt16 nPoolFmtId, SvxLRSpaceItem aLR( RES_LR_SPACE ); SvxULSpaceItem aUL( RES_UL_SPACE ); - aUL.SetUpper( (USHORT)nMinTop ); - aUL.SetLower( (USHORT)nMinBottom ); + aUL.SetUpper( (sal_uInt16)nMinTop ); + aUL.SetLower( (sal_uInt16)nMinBottom ); aLR.SetRight( nMinRight ); aLR.SetLeft( nMinLeft ); @@ -141,7 +144,7 @@ static void lcl_DefaultPageFmt( sal_uInt16 nPoolFmtId, |*************************************************************************/ void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest, - const BOOL bPage = TRUE ) + const sal_Bool bPage = sal_True ) { /////////////// !!!!!!!!!!!!!!!! //JP 03.03.99: @@ -149,7 +152,7 @@ void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest, // funktioniert nicht richtig, wenn man unterschiedliche WhichRanges hat. /////////////// !!!!!!!!!!!!!!!! //Die interressanten Attribute uebernehmen. - USHORT const aIdArr[] = { RES_FRM_SIZE, RES_UL_SPACE, + sal_uInt16 const aIdArr[] = { RES_FRM_SIZE, RES_UL_SPACE, RES_BACKGROUND, RES_SHADOW, RES_COL, RES_COL, RES_FRAMEDIR, RES_FRAMEDIR, @@ -163,9 +166,9 @@ void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest, 0 }; const SfxPoolItem* pItem; - for( USHORT n = 0; aIdArr[ n ]; n += 2 ) + for( sal_uInt16 n = 0; aIdArr[ n ]; n += 2 ) { - for( USHORT nId = aIdArr[ n ]; nId <= aIdArr[ n+1]; ++nId ) + for( sal_uInt16 nId = aIdArr[ n ]; nId <= aIdArr[ n+1]; ++nId ) { // --> FME 2005-04-18 #i45539# // bPage == true: @@ -176,7 +179,7 @@ void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest, if( ( bPage && RES_HEADER_FOOTER_EAT_SPACING != nId ) || ( !bPage && RES_COL != nId && RES_PAPER_BIN != nId )) { - if( SFX_ITEM_SET == rSource.GetItemState( nId, FALSE, &pItem )) + if( SFX_ITEM_SET == rSource.GetItemState( nId, sal_False, &pItem )) rDest.SetFmtAttr( *pItem ); else rDest.ResetFmtAttr( nId ); @@ -191,18 +194,18 @@ void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest, } -void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) +void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged ) { OSL_ENSURE( i < aPageDescs.Count(), "PageDescs ueberindiziert." ); SwPageDesc *pDesc = aPageDescs[i]; - BOOL bDoesUndo = DoesUndo(); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { - AppendUndo(new SwUndoPageDesc(*pDesc, rChged, this)); - DoUndo(FALSE); + SwUndo *const pUndo(new SwUndoPageDesc(*pDesc, rChged, this)); + GetIDocumentUndoRedo().AppendUndo(pUndo); } + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); //Als erstes wird ggf. gespiegelt. if ( rChged.GetUseOn() == nsUseOnPage::PD_MIRROR ) @@ -225,7 +228,7 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) // ErgoSum-Texte geben, die sich auf eine geaenderte Seite beziehen, // deshalb werden die Fussnoten invalidiert SwFtnIdxs& rFtnIdxs = GetFtnIdxs(); - for( USHORT nPos = 0; nPos < rFtnIdxs.Count(); ++nPos ) + for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos ) { SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ]; const SwFmtFtn &rFtn = pTxtFtn->GetFtn(); @@ -241,7 +244,7 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) //Header abgleichen. const SwFmtHeader &rHead = rChged.GetMaster().GetHeader(); - if( bDoesUndo ) + if (undoGuard.UndoWasEnabled()) { // #i46909# no undo if header or footer changed // hat sich an den Nodes etwas veraendert ? @@ -268,7 +271,7 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) SwFmtHeader aHead( MakeLayoutFmt( RND_STD_HEADERL, 0 ) ); pDesc->GetLeft().SetFmtAttr( aHead ); //Weitere Attribute (Raender, Umrandung...) uebernehmen. - ::lcl_DescSetAttr( *rHead.GetHeaderFmt(), *aHead.GetHeaderFmt(), FALSE); + ::lcl_DescSetAttr( *rHead.GetHeaderFmt(), *aHead.GetHeaderFmt(), sal_False); } else { @@ -281,7 +284,7 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) { SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), "Header", GetDfltFrmFmt() ); - ::lcl_DescSetAttr( *pRight, *pFmt, FALSE ); + ::lcl_DescSetAttr( *pRight, *pFmt, sal_False ); //Der Bereich auf den das rechte Kopfattribut zeigt wird //kopiert und der Index auf den StartNode in das linke //Kopfattribut gehaengt. @@ -290,14 +293,14 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) SwNodeRange aRange( aRCnt.GetCntntIdx()->GetNode(), 0, *aRCnt.GetCntntIdx()->GetNode().EndOfSectionNode() ); aTmp = *pSttNd->EndOfSectionNode(); - GetNodes()._Copy( aRange, aTmp, FALSE ); + GetNodes()._Copy( aRange, aTmp, sal_False ); pFmt->SetFmtAttr( SwFmtCntnt( pSttNd ) ); pDesc->GetLeft().SetFmtAttr( SwFmtHeader( pFmt ) ); } else ::lcl_DescSetAttr( *pRight, - *(SwFrmFmt*)rLeftHead.GetHeaderFmt(), FALSE ); + *(SwFrmFmt*)rLeftHead.GetHeaderFmt(), sal_False ); } } @@ -305,7 +308,7 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) //Footer abgleichen. const SwFmtFooter &rFoot = rChged.GetMaster().GetFooter(); - if( bDoesUndo ) + if (undoGuard.UndoWasEnabled()) { // #i46909# no undo if header or footer changed // hat sich an den Nodes etwas veraendert ? @@ -330,7 +333,7 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) SwFmtFooter aFoot( MakeLayoutFmt( RND_STD_FOOTER, 0 ) ); pDesc->GetLeft().SetFmtAttr( aFoot ); //Weitere Attribute (Raender, Umrandung...) uebernehmen. - ::lcl_DescSetAttr( *rFoot.GetFooterFmt(), *aFoot.GetFooterFmt(), FALSE); + ::lcl_DescSetAttr( *rFoot.GetFooterFmt(), *aFoot.GetFooterFmt(), sal_False); } else { @@ -343,7 +346,7 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) { SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), "Footer", GetDfltFrmFmt() ); - ::lcl_DescSetAttr( *pRight, *pFmt, FALSE ); + ::lcl_DescSetAttr( *pRight, *pFmt, sal_False ); //Der Bereich auf den das rechte Kopfattribut zeigt wird //kopiert und der Index auf den StartNode in das linke //Kopfattribut gehaengt. @@ -352,14 +355,14 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) SwNodeRange aRange( aRCnt.GetCntntIdx()->GetNode(), 0, *aRCnt.GetCntntIdx()->GetNode().EndOfSectionNode() ); aTmp = *pSttNd->EndOfSectionNode(); - GetNodes()._Copy( aRange, aTmp, FALSE ); + GetNodes()._Copy( aRange, aTmp, sal_False ); pFmt->SetFmtAttr( SwFmtCntnt( pSttNd ) ); pDesc->GetLeft().SetFmtAttr( SwFmtFooter( pFmt ) ); } else ::lcl_DescSetAttr( *pRight, - *(SwFrmFmt*)rLeftFoot.GetFooterFmt(), FALSE ); + *(SwFrmFmt*)rLeftFoot.GetFooterFmt(), sal_False ); } } pDesc->ChgFooterShare( rChged.IsFooterShared() ); @@ -372,22 +375,22 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) //Wenn sich das UseOn oder der Follow aendern muessen die //Absaetze das erfahren. - BOOL bUseOn = FALSE; - BOOL bFollow = FALSE; + sal_Bool bUseOn = sal_False; + sal_Bool bFollow = sal_False; if ( pDesc->GetUseOn() != rChged.GetUseOn() ) { pDesc->SetUseOn( rChged.GetUseOn() ); - bUseOn = TRUE; + bUseOn = sal_True; } if ( pDesc->GetFollow() != rChged.GetFollow() ) { if ( rChged.GetFollow() == &rChged ) { if ( pDesc->GetFollow() != pDesc ) { pDesc->SetFollow( pDesc ); - bFollow = TRUE; + bFollow = sal_True; } } else { pDesc->SetFollow( rChged.pFollow ); - bFollow = TRUE; + bFollow = sal_True; } } @@ -420,13 +423,10 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) } SetModified(); - DoUndo(bDoesUndo); - // #i46909# no undo if header or footer changed if( bHeaderFooterChanged ) { - ClearRedo(); - DelAllUndoObj(); + GetIDocumentUndoRedo().DelAllUndoObj(); } } @@ -439,7 +439,7 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) |* |*************************************************************************/ -void lcl_RemoveFrms( SwFrmFmt& rFmt, BOOL& rbFtnsRemoved ) +void lcl_RemoveFrms( SwFrmFmt& rFmt, sal_Bool& rbFtnsRemoved ) { SwClientIter aIter( rFmt ); SwFrm *pFrm; @@ -448,8 +448,8 @@ void lcl_RemoveFrms( SwFrmFmt& rFmt, BOOL& rbFtnsRemoved ) if ( !rbFtnsRemoved && pFrm->IsPageFrm() && ((SwPageFrm*)pFrm)->IsFtnPage() ) { - rFmt.getIDocumentLayoutAccess()->GetRootFrm()->RemoveFtns( 0, FALSE, TRUE ); - rbFtnsRemoved = TRUE; + rFmt.getIDocumentLayoutAccess()->GetRootFrm()->RemoveFtns( 0, sal_False, sal_True ); + rbFtnsRemoved = sal_True; } else { @@ -488,8 +488,8 @@ void SwDoc::PreDelPageDesc(SwPageDesc * pDel) aPageDescs[0]->Add( pLast ); } - BOOL bFtnInf = FALSE; - if ( TRUE == (bFtnInf = pLast == pFtnInfo->GetPageDescDep()) || + sal_Bool bFtnInf = sal_False; + if ( sal_True == (bFtnInf = pLast == pFtnInfo->GetPageDescDep()) || pLast == pEndNoteInfo->GetPageDescDep() ) { aPageDescs[0]->Add( pLast ); @@ -498,7 +498,7 @@ void SwDoc::PreDelPageDesc(SwPageDesc * pDel) } } - for ( USHORT j = 0; j < aPageDescs.Count(); ++j ) + for ( sal_uInt16 j = 0; j < aPageDescs.Count(); ++j ) { if ( aPageDescs[j]->GetFollow() == pDel ) { @@ -521,7 +521,7 @@ void SwDoc::PreDelPageDesc(SwPageDesc * pDel) // Wenn wir auf Endnotenseiten stossen, schmeissen wir alle Fussnoten weg, // anders kann die Reihenfolge der Seiten (FollowsPageDescs usw.) // nicht garantiert werden. - BOOL bFtnsRemoved = FALSE; + sal_Bool bFtnsRemoved = sal_False; ::lcl_RemoveFrms( pDel->GetMaster(), bFtnsRemoved ); ::lcl_RemoveFrms( pDel->GetLeft(), bFtnsRemoved ); @@ -529,7 +529,7 @@ void SwDoc::PreDelPageDesc(SwPageDesc * pDel) } void SwDoc::BroadcastStyleOperation(String rName, SfxStyleFamily eFamily, - USHORT nOp) + sal_uInt16 nOp) { if (pDocShell) { @@ -546,7 +546,7 @@ void SwDoc::BroadcastStyleOperation(String rName, SfxStyleFamily eFamily, } } -void SwDoc::DelPageDesc( USHORT i, BOOL bBroadcast ) +void SwDoc::DelPageDesc( sal_uInt16 i, sal_Bool bBroadcast ) { OSL_ENSURE( i < aPageDescs.Count(), "PageDescs ueberindiziert." ); OSL_ENSURE( i != 0, "Default Pagedesc loeschen is nicht." ); @@ -559,9 +559,10 @@ void SwDoc::DelPageDesc( USHORT i, BOOL bBroadcast ) BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_PAGE, SFX_STYLESHEET_ERASED); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { - AppendUndo(new SwUndoPageDescDelete(*pDel, this)); + SwUndo *const pUndo(new SwUndoPageDescDelete(*pDel, this)); + GetIDocumentUndoRedo().AppendUndo(pUndo); } PreDelPageDesc(pDel); // #i7983# @@ -579,8 +580,8 @@ void SwDoc::DelPageDesc( USHORT i, BOOL bBroadcast ) |* |*************************************************************************/ -USHORT SwDoc::MakePageDesc( const String &rName, const SwPageDesc *pCpy, - BOOL bRegardLanguage, BOOL bBroadcast) +sal_uInt16 SwDoc::MakePageDesc( const String &rName, const SwPageDesc *pCpy, + sal_Bool bRegardLanguage, sal_Bool bBroadcast) // #116530# { SwPageDesc *pNew; if( pCpy ) @@ -613,19 +614,22 @@ USHORT SwDoc::MakePageDesc( const String &rName, const SwPageDesc *pCpy, BroadcastStyleOperation(rName, SFX_STYLE_FAMILY_PAGE, SFX_STYLESHEET_CREATED); - if (DoesUndo()) - AppendUndo(new SwUndoPageDescCreate(pNew, this)); + if (GetIDocumentUndoRedo().DoesUndo()) + { + // #116530# + GetIDocumentUndoRedo().AppendUndo(new SwUndoPageDescCreate(pNew, this)); + } SetModified(); return (aPageDescs.Count()-1); } -SwPageDesc* SwDoc::FindPageDescByName( const String& rName, USHORT* pPos ) const +SwPageDesc* SwDoc::FindPageDescByName( const String& rName, sal_uInt16* pPos ) const { SwPageDesc* pRet = 0; if( pPos ) *pPos = USHRT_MAX; - for( USHORT n = 0, nEnd = aPageDescs.Count(); n < nEnd; ++n ) + for( sal_uInt16 n = 0, nEnd = aPageDescs.Count(); n < nEnd; ++n ) if( aPageDescs[ n ]->GetName() == rName ) { pRet = aPageDescs[ n ]; @@ -651,12 +655,12 @@ void SwDoc::PrtDataChanged() // <-- SwWait *pWait = 0; - BOOL bEndAction = FALSE; + sal_Bool bEndAction = sal_False; if( GetDocShell() ) GetDocShell()->UpdateFontList(); - BOOL bDraw = TRUE; + sal_Bool bDraw = sal_True; if ( GetRootFrm() ) { ViewShell *pSh = GetRootFrm()->GetCurrShell(); @@ -664,12 +668,12 @@ void SwDoc::PrtDataChanged() ( pSh && pSh->GetViewOptions()->IsPrtFormat() ) ) { if ( GetDocShell() ) - pWait = new SwWait( *GetDocShell(), TRUE ); + pWait = new SwWait( *GetDocShell(), sal_True ); GetRootFrm()->StartAllAction(); - bEndAction = TRUE; + bEndAction = sal_True; - bDraw = FALSE; + bDraw = sal_False; if( pDrawModel ) { pDrawModel->SetAddExtLeading( get(IDocumentSettingAccess::ADD_EXT_LEADING) ); @@ -702,7 +706,7 @@ void SwDoc::PrtDataChanged() pDrawModel->SetRefDevice( pOutDev ); } - PrtOLENotify( TRUE ); + PrtOLENotify( sal_True ); if ( bEndAction ) GetRootFrm()->EndAllAction(); @@ -716,7 +720,7 @@ void SwDoc::PrtDataChanged() //ist in init.cxx zu finden. extern SvPtrarr *pGlobalOLEExcludeList; -void SwDoc::PrtOLENotify( BOOL bAll ) +void SwDoc::PrtOLENotify( sal_Bool bAll ) { SwFEShell *pShell = 0; if ( GetRootFrm() && GetRootFrm()->GetCurrShell() ) @@ -738,16 +742,16 @@ void SwDoc::PrtOLENotify( BOOL bAll ) //Da wir keine Shell haben, merken wir uns diesen unguenstigen //Zustand am Dokument, dies wird dann beim Erzeugen der ersten Shell //nachgeholt. - mbOLEPrtNotifyPending = TRUE; + mbOLEPrtNotifyPending = sal_True; if ( bAll ) - mbAllOLENotify = TRUE; + mbAllOLENotify = sal_True; } else { if ( mbAllOLENotify ) - bAll = TRUE; + bAll = sal_True; - mbOLEPrtNotifyPending = mbAllOLENotify = FALSE; + mbOLEPrtNotifyPending = mbAllOLENotify = sal_False; SwOLENodes *pNodes = 0; @@ -772,12 +776,12 @@ void SwDoc::PrtOLENotify( BOOL bAll ) 0, pNodes->Count(), GetDocShell()); GetRootFrm()->StartAllAction(); - for( USHORT i = 0; i < pNodes->Count(); ++i ) + for( sal_uInt16 i = 0; i < pNodes->Count(); ++i ) { ::SetProgressState( i, GetDocShell() ); SwOLENode* pOLENd = (*pNodes)[i]; - pOLENd->SetOLESizeInvalid( FALSE ); + pOLENd->SetOLESizeInvalid( sal_False ); //Ersteinmal die Infos laden und festellen ob das Teil nicht //schon in der Exclude-Liste steht @@ -792,8 +796,8 @@ void SwDoc::PrtOLENotify( BOOL bAll ) // aName = ???? } - BOOL bFound = FALSE; - for ( USHORT j = 0; + sal_Bool bFound = sal_False; + for ( sal_uInt16 j = 0; j < pGlobalOLEExcludeList->Count() && !bFound; ++j ) { @@ -824,7 +828,7 @@ IMPL_LINK( SwDoc, DoUpdateModifiedOLE, Timer *, ) SwFEShell* pSh = (SwFEShell*)GetEditShell(); if( pSh ) { - mbOLEPrtNotifyPending = mbAllOLENotify = FALSE; + mbOLEPrtNotifyPending = mbAllOLENotify = sal_False; SwOLENodes aOLENodes; SwClientIter aIter( *(SwModify*)GetDfltGrfFmtColl() ); @@ -846,12 +850,12 @@ IMPL_LINK( SwDoc, DoUpdateModifiedOLE, Timer *, ) GetRootFrm()->StartAllAction(); SwMsgPoolItem aMsgHint( RES_UPDATE_ATTR ); - for( USHORT i = 0; i < aOLENodes.Count(); ++i ) + for( sal_uInt16 i = 0; i < aOLENodes.Count(); ++i ) { ::SetProgressState( i, GetDocShell() ); SwOLENode* pOLENd = aOLENodes[i]; - pOLENd->SetOLESizeInvalid( FALSE ); + pOLENd->SetOLESizeInvalid( sal_False ); //Kennen wir nicht, also muss das Objekt geladen werden. //Wenn es keine Benachrichtigung wuenscht @@ -867,16 +871,16 @@ IMPL_LINK( SwDoc, DoUpdateModifiedOLE, Timer *, ) return 0; } -BOOL SwDoc::FindPageDesc( const String & rName, sal_uInt16 * pFound) +sal_Bool SwDoc::FindPageDesc( const String & rName, sal_uInt16 * pFound) { - BOOL bResult = FALSE; + sal_Bool bResult = sal_False; sal_uInt16 nI; for (nI = 0; nI < aPageDescs.Count(); nI++) { if (aPageDescs[nI]->GetName() == rName) { *pFound = nI; - bResult = TRUE; + bResult = sal_True; break; } } @@ -896,7 +900,7 @@ SwPageDesc * SwDoc::GetPageDesc( const String & rName ) return aResult; } -void SwDoc::DelPageDesc( const String & rName, BOOL bBroadcast ) +void SwDoc::DelPageDesc( const String & rName, sal_Bool bBroadcast ) { sal_uInt16 nI; @@ -919,7 +923,7 @@ void SwDoc::ChgPageDesc( const String & rName, const SwPageDesc & rDesc) */ void SwDoc::CheckDefaultPageFmt() { - for ( USHORT i = 0; i < GetPageDescCnt(); ++i ) + for ( sal_uInt16 i = 0; i < GetPageDescCnt(); ++i ) { SwPageDesc& rDesc = _GetPageDesc( i ); @@ -951,7 +955,7 @@ void SwDoc::SetDefaultPageMode(bool bSquaredPageMode) aNewGrid.Init(); SetDefault(aNewGrid); - for ( USHORT i = 0; i < GetPageDescCnt(); ++i ) + for ( sal_uInt16 i = 0; i < GetPageDescCnt(); ++i ) { SwPageDesc& rDesc = _GetPageDesc( i ); diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index 9840f06219ef..6c4fb754e305 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <rtl/logfile.hxx> #include <vcl/outdev.hxx> @@ -50,12 +51,13 @@ #include <viewimp.hxx> #include <swhints.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docsh.hxx> #include <rootfrm.hxx> //Damit der RootDtor gerufen wird. #include <poolfmt.hxx> #include <viewsh.hxx> // fuer MakeDrawView #include <drawdoc.hxx> -#include <undobj.hxx> +#include <UndoDraw.hxx> #include <swundo.hxx> // fuer die UndoIds #include <dcontact.hxx> #include <dview.hxx> @@ -128,7 +130,7 @@ void lcl_AdjustPositioningAttr( SwDrawFrmFmt* _pFrmFmt, { case FRMDIR_VERT_TOP_LEFT: { - // vertical from left-to-right - not supported yet + // vertical from left-to-right - Badaa: supported now! bVert = true; bR2L = true; OSL_ENSURE( false, @@ -161,10 +163,18 @@ void lcl_AdjustPositioningAttr( SwDrawFrmFmt* _pFrmFmt, } // use geometry of drawing object const SwRect aObjRect = _rSdrObj.GetSnapRect(); + if ( bVert ) { - nHoriRelPos = aObjRect.Top() - aAnchorPos.Y(); - nVertRelPos = aAnchorPos.X() - aObjRect.Right(); + if ( bR2L ) { + //FRMDIR_VERT_TOP_LEFT + nHoriRelPos = aObjRect.Left() - aAnchorPos.X(); + nVertRelPos = aObjRect.Top() - aAnchorPos.Y(); + } else { + //FRMDIR_VERT_TOP_RIGHT + nHoriRelPos = aObjRect.Top() - aAnchorPos.Y(); + nVertRelPos = aAnchorPos.X() - aObjRect.Right(); + } } else if ( bR2L ) { @@ -176,6 +186,7 @@ void lcl_AdjustPositioningAttr( SwDrawFrmFmt* _pFrmFmt, nHoriRelPos = aObjRect.Left() - aAnchorPos.X(); nVertRelPos = aObjRect.Top() - aAnchorPos.Y(); } + //End of SCMS } _pFrmFmt->SetFmtAttr( SwFmtHoriOrient( nHoriRelPos, text::HoriOrientation::NONE, text::RelOrientation::FRAME ) ); @@ -207,7 +218,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList(); SwDrawFrmFmt *pFmt = 0L; SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj(); - BOOL bNoGroup = ( 0 == pObj->GetUpGroup() ); + sal_Bool bNoGroup = ( 0 == pObj->GetUpGroup() ); SwDrawContact* pNewContact = 0; if( bNoGroup ) { @@ -215,9 +226,9 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) SwDrawContact *pMyContact = (SwDrawContact*)GetUserCall(pObj); const SwFmtAnchor aAnch( pMyContact->GetFmt()->GetAnchor() ); - SwUndoDrawGroup* pUndo = !DoesUndo() + SwUndoDrawGroup *const pUndo = (!GetIDocumentUndoRedo().DoesUndo()) ? 0 - : new SwUndoDrawGroup( (USHORT)rMrkList.GetMarkCount() ); + : new SwUndoDrawGroup( (sal_uInt16)rMrkList.GetMarkCount() ); // #i53320# bool bGroupMembersNotPositioned( false ); @@ -227,7 +238,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) bGroupMembersNotPositioned = pAnchoredDrawObj->NotYetPositioned(); } //ContactObjekte und Formate vernichten. - for( USHORT i = 0; i < rMrkList.GetMarkCount(); ++i ) + for( sal_uInt16 i = 0; i < rMrkList.GetMarkCount(); ++i ) { pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj); @@ -285,14 +296,15 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) if( pUndo ) { pUndo->SetGroupFmt( pFmt ); - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } } else { - if ( DoesUndo() ) - ClearRedo(); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().ClearRedo(); + } rDrawView.GroupMarked(); OSL_ENSURE( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." ); @@ -304,9 +316,11 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) void SwDoc::UnGroupSelection( SdrView& rDrawView ) { - const int bUndo = DoesUndo(); + bool const bUndo = GetIDocumentUndoRedo().DoesUndo(); if( bUndo ) - ClearRedo(); + { + GetIDocumentUndoRedo().ClearRedo(); + } // replace marked 'virtual' drawing objects by the corresponding 'master' // drawing objects. @@ -323,7 +337,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) { String sDrwFmtNm( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("DrawObject" ))); - for ( USHORT i = 0; i < nMarkCount; ++i ) + for ( sal_uInt16 i = 0; i < nMarkCount; ++i ) { SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); if ( pObj->IsA( TYPE(SdrObjGroup) ) ) @@ -336,10 +350,10 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) if( bUndo ) { pUndo = new SwUndoDrawUnGroup( (SdrObjGroup*)pObj ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } - for ( USHORT i2 = 0; i2 < pLst->GetObjCount(); ++i2 ) + for ( sal_uInt16 i2 = 0; i2 < pLst->GetObjCount(); ++i2 ) { SdrObject* pSubObj = pLst->GetObj( i2 ); SwDrawFrmFmt *pFmt = MakeDrawFrmFmt( sDrwFmtNm, @@ -366,7 +380,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) if( bUndo ) { pUndo = new SwUndoDrawUnGroupConnectToLayout(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } while ( pFmtsAndObjs[i].size() > 0 ) @@ -395,15 +409,15 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) |* |*************************************************************************/ -BOOL SwDoc::DeleteSelection( SwDrawView& rDrawView ) +sal_Bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) { - BOOL bCallBase = FALSE; + sal_Bool bCallBase = sal_False; const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList(); if( rMrkList.GetMarkCount() ) { - StartUndo(UNDO_EMPTY, NULL); - USHORT i; - BOOL bDelMarked = TRUE; + GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); + sal_uInt16 i; + sal_Bool bDelMarked = sal_True; if( 1 == rMrkList.GetMarkCount() ) { @@ -415,7 +429,7 @@ BOOL SwDoc::DeleteSelection( SwDrawView& rDrawView ) if( pFrmFmt ) { DelLayoutFmt( pFrmFmt ); - bDelMarked = FALSE; + bDelMarked = sal_False; } } } @@ -430,7 +444,7 @@ BOOL SwDoc::DeleteSelection( SwDrawView& rDrawView ) if( pFrmFmt && FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId() ) { - rDrawView.MarkObj( pObj, rDrawView.Imp().GetPageView(), TRUE ); + rDrawView.MarkObj( pObj, rDrawView.Imp().GetPageView(), sal_True ); --i; DelLayoutFmt( pFrmFmt ); } @@ -442,8 +456,10 @@ BOOL SwDoc::DeleteSelection( SwDrawView& rDrawView ) SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj(); if( !pObj->GetUpGroup() ) { - SwUndoDrawDelete* pUndo = !DoesUndo() ? 0 - : new SwUndoDrawDelete( (USHORT)rMrkList.GetMarkCount() ); + SwUndoDrawDelete *const pUndo = + (!GetIDocumentUndoRedo().DoesUndo()) + ? 0 + : new SwUndoDrawDelete( (sal_uInt16)rMrkList.GetMarkCount() ); //ContactObjekte vernichten, Formate sicherstellen. for( i = 0; i < rMrkList.GetMarkCount(); ++i ) @@ -475,13 +491,15 @@ BOOL SwDoc::DeleteSelection( SwDrawView& rDrawView ) } if( pUndo ) - AppendUndo( pUndo ); + { + GetIDocumentUndoRedo().AppendUndo( pUndo ); + } } - bCallBase = TRUE; + bCallBase = sal_True; } SetModified(); - EndUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); } return bCallBase; @@ -494,7 +512,7 @@ BOOL SwDoc::DeleteSelection( SwDrawView& rDrawView ) |*************************************************************************/ _ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAn, - UINT32 nArrOrdNum ) + sal_uInt32 nArrOrdNum ) : pFmt( pFrmFmt ), pAnchor( pFlyAn ), nOrdNum( nArrOrdNum ) { // #i11176# @@ -563,7 +581,7 @@ void SwDoc::InitDrawModel() pSdrPool->SetPoolDefaultItem(SdrShadowXDistItem((300 * 72) / 127)); pSdrPool->SetPoolDefaultItem(SdrShadowYDistItem((300 * 72) / 127)); } - SfxItemPool *pEEgPool = EditEngine::CreatePool( FALSE ); + SfxItemPool *pEEgPool = EditEngine::CreatePool( sal_False ); pSdrPool->SetSecondaryPool( pEEgPool ); if ( !GetAttrPool().GetFrozenIdRanges () ) GetAttrPool().FreezeIdRanges(); @@ -578,7 +596,7 @@ void SwDoc::InitDrawModel() //Seite. pDrawModel = new SwDrawDocument( this ); - pDrawModel->EnableUndo( DoesUndo() ); + pDrawModel->EnableUndo( GetIDocumentUndoRedo().DoesUndo() ); String sLayerNm; sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Hell" )); @@ -602,7 +620,7 @@ void SwDoc::InitDrawModel() nInvisibleControls = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); } - pDrawModel->InsertPage( pDrawModel->AllocPage( FALSE ) ); + pDrawModel->InsertPage( pDrawModel->AllocPage( sal_False ) ); RTL_LOGFILE_CONTEXT_TRACE( aLog, "after create DrawDocument" ); RTL_LOGFILE_CONTEXT_TRACE( aLog, "before create Spellchecker/Hyphenator" ); @@ -639,13 +657,13 @@ void SwDoc::NotifyInvisibleLayers( SdrPageView& _rSdrPageView ) { String sLayerNm; sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHell" )); - _rSdrPageView.SetLayerVisible( sLayerNm, FALSE ); + _rSdrPageView.SetLayerVisible( sLayerNm, sal_False ); sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHeaven" )); - _rSdrPageView.SetLayerVisible( sLayerNm, FALSE ); + _rSdrPageView.SetLayerVisible( sLayerNm, sal_False ); sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleControls" )); - _rSdrPageView.SetLayerVisible( sLayerNm, FALSE ); + _rSdrPageView.SetLayerVisible( sLayerNm, sal_False ); } /** method to determine, if a layer ID belongs to the visible ones. @@ -839,7 +857,7 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo) ******************************************************************/ pInfo->SetRepresentation( ((const SvxDateField*) pField)->GetFormatted( - *GetNumberFormatter( TRUE ), LANGUAGE_SYSTEM) ); + *GetNumberFormatter( sal_True ), LANGUAGE_SYSTEM) ); } else if (pField && pField->ISA(SvxURLField)) { @@ -865,7 +883,7 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo) break; } - USHORT nChrFmt; + sal_uInt16 nChrFmt; if (IsVisitedURL(((const SvxURLField*)pField)->GetURL())) nChrFmt = RES_POOLCHR_INET_VISIT; @@ -894,7 +912,7 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo) ******************************************************************/ pInfo->SetRepresentation( ((const SvxExtTimeField*) pField)->GetFormatted( - *GetNumberFormatter( TRUE ), LANGUAGE_SYSTEM) ); + *GetNumberFormatter( sal_True ), LANGUAGE_SYSTEM) ); } else { diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index d966cb78ba8c..ba43772dcaa0 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -49,6 +49,7 @@ #include <cntfrm.hxx> // fuers Spell #include <crsrsh.hxx> #include <doc.hxx> +#include <UndoManager.hxx> #include <docsh.hxx> #include <docary.hxx> #include <doctxm.hxx> // beim Move: Verzeichnisse korrigieren @@ -64,7 +65,12 @@ #include <swtable.hxx> #include <swundo.hxx> // fuer die UndoIds #include <txtfrm.hxx> -#include <undobj.hxx> +#include <hints.hxx> +#include <UndoSplitMove.hxx> +#include <UndoRedline.hxx> +#include <UndoOverwrite.hxx> +#include <UndoInsert.hxx> +#include <UndoDelete.hxx> #include <breakit.hxx> #include <hhcwrp.hxx> #include <vcl/msgbox.hxx> @@ -453,8 +459,8 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd, if( pHints && pHints->HasFtn() ) //...with footnotes { bUpdateFtn = sal_True; // Heureka - USHORT nCount = pHints->Count(); - for( USHORT i = 0; i < nCount; ++i ) + sal_uInt16 nCount = pHints->Count(); + for( sal_uInt16 i = 0; i < nCount; ++i ) { SwTxtAttr *pAttr = pHints->GetTextHint( i ); if ( pAttr->Which() == RES_TXTATR_FTN ) @@ -752,8 +758,10 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr ) if(!pNode) return sal_False; - if( DoesUndo() ) - ClearRedo(); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().ClearRedo(); // AppendUndo not always called + } sal_uInt16 nOldAttrCnt = pNode->GetpSwpHints() ? pNode->GetpSwpHints()->Count() : 0; @@ -761,13 +769,11 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr ) SwIndex& rIdx = rPt.nContent; xub_StrLen nStart = 0; - sal_uInt16 nUndoSize = pUndos->Count(); - SwUndo * pUndo; sal_Unicode c; String aStr; - BOOL bOldExpFlg = pNode->IsIgnoreDontExpand(); - pNode->SetIgnoreDontExpand( TRUE ); + sal_Bool bOldExpFlg = pNode->IsIgnoreDontExpand(); + pNode->SetIgnoreDontExpand( sal_True ); for( xub_StrLen nCnt = 0; nCnt < rStr.Len(); ++nCnt ) { @@ -778,16 +784,24 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr ) lcl_SkipAttr( pNode, rIdx, nStart ); } c = rStr.GetChar( nCnt ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - if( DoesGroupUndo() && nUndoSize && - UNDO_OVERWRITE == ( pUndo = (*pUndos)[ nUndoSize-1 ])->GetId() && - ((SwUndoOverwrite*)pUndo)->CanGrouping( this, rPt, c )) - ;// wenn CanGrouping() sal_True returnt, ist schon alles erledigt - else + bool bMerged(false); + if (GetIDocumentUndoRedo().DoesGroupUndo()) + { + SwUndo *const pUndo = GetUndoManager().GetLastUndo(); + SwUndoOverwrite *const pUndoOW( + dynamic_cast<SwUndoOverwrite *>(pUndo) ); + if (pUndoOW) + { + // if CanGrouping() returns true it's already merged + bMerged = pUndoOW->CanGrouping( this, rPt, c ); + } + } + if (!bMerged) { - AppendUndo( new SwUndoOverwrite( this, rPt, c )); - nUndoSize = pUndos->Count(); + SwUndo *const pUndoOW( new SwUndoOverwrite(this, rPt, c) ); + GetIDocumentUndoRedo().AppendUndo(pUndoOW); } } else @@ -820,7 +834,8 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr ) } } - if( !DoesUndo() && !IsIgnoreRedline() && GetRedlineTbl().Count() ) + if (!GetIDocumentUndoRedo().DoesUndo() && + !IsIgnoreRedline() && GetRedlineTbl().Count()) { SwPaM aPam( rPt.nNode, nStart, rPt.nNode, rPt.nContent.GetIndex() ); DeleteRedline( aPam, true, USHRT_MAX ); @@ -887,15 +902,13 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) // in a particular order, and presence of bookmarks // will change this order. Hence, we delete bookmarks // here without undo. - BOOL bDoesUndo = DoesUndo(); - DoUndo( FALSE ); + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); _DelBookmarks( pStt->nNode, pEnd->nNode, NULL, &pStt->nContent, &pEnd->nContent); - DoUndo( bDoesUndo ); } @@ -904,9 +917,9 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) // falls Undo eingeschaltet, erzeuge das UndoMove-Objekt SwUndoMove * pUndoMove = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndoMove = new SwUndoMove( rPaM, rPos ); pUndoMove->SetMoveRedlines( eMvFlags == DOC_MOVEREDLINES ); } @@ -1003,7 +1016,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) rPaM.SetMark(); // um den neuen Bereich eine Sel. aufspannen pTNd = aSavePam.GetNode()->GetTxtNode(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { // korrigiere erstmal den Content vom SavePam if( bNullCntnt ) @@ -1046,7 +1059,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) // zwischen SPoint und GetMark steht jetzt der neu eingefuegte Bereich pUndoMove->SetDestRange( aSavePam, *rPaM.GetPoint(), bJoin, bCorrSavePam ); - AppendUndo( pUndoMove ); + GetIDocumentUndoRedo().AppendUndo( pUndoMove ); } else { @@ -1127,11 +1140,15 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos, SwFtnIdxs aTmpFntIdx; SwUndoMove* pUndo = 0; - if( (DOC_CREATEUNDOOBJ & eMvFlags ) && DoesUndo() ) + if ((DOC_CREATEUNDOOBJ & eMvFlags ) && GetIDocumentUndoRedo().DoesUndo()) + { pUndo = new SwUndoMove( this, rRange, rPos ); + } else + { bUpdateFtn = lcl_SaveFtn( rRange.aStart, rRange.aEnd, rPos, GetFtnIdxs(), aTmpFntIdx ); + } _SaveRedlines aSaveRedl( 0, 4 ); SvPtrarr aSavRedlInsPosArr( 0, 4 ); @@ -1177,7 +1194,7 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos, pSaveInsPos = new SwNodeIndex( rRange.aStart, -1 ); // verschiebe die Nodes - BOOL bNoDelFrms = 0 != (DOC_NO_DELFRMS & eMvFlags); + sal_Bool bNoDelFrms = 0 != (DOC_NO_DELFRMS & eMvFlags); if( GetNodes()._MoveNodes( rRange, GetNodes(), rPos, !bNoDelFrms ) ) { aIdx++; // wieder auf alte Position @@ -1221,9 +1238,8 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos, if( pUndo ) { - ClearRedo(); pUndo->SetDestRange( aIdx, rPos, *pSaveInsPos ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if( pSaveInsPos ) @@ -1245,7 +1261,7 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos, } // Convert list of ranges of whichIds to a corresponding list of whichIds -SvUShorts * lcl_RangesToUShorts(USHORT * pRanges) +SvUShorts * lcl_RangesToUShorts(sal_uInt16 * pRanges) { SvUShorts * pResult = new SvUShorts(); @@ -1254,7 +1270,7 @@ SvUShorts * lcl_RangesToUShorts(USHORT * pRanges) { OSL_ENSURE(pRanges[i+1] != 0, "malformed ranges"); - for (USHORT j = pRanges[i]; j < pRanges[i+1]; j++) + for (sal_uInt16 j = pRanges[i]; j < pRanges[i+1]; j++) pResult->Insert(j, pResult->Count()); i += 2; @@ -1333,8 +1349,7 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev ) // falls PageBreaks geloescht / gesetzt werden, darf das // nicht in die Undo-History aufgenommen werden !! // (das loeschen vom Node geht auch am Undo vorbei !!!) - sal_Bool bDoUndo = pDoc->DoesUndo(); - pDoc->DoUndo( sal_False ); + ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); /* PageBreaks, PageDesc, ColumnBreaks */ // Sollte an der Logik zum Kopieren der PageBreak's ... @@ -1386,8 +1401,6 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev ) if( aBkmkArr.Count() ) ::_RestoreCntntIdx( pDoc, aBkmkArr, aIdx.GetIndex() ); - pDoc->DoUndo( bDoUndo ); - // falls der uebergebene PaM nicht im Crsr-Ring steht, // gesondert behandeln (z.B. Aufruf aus dem Auto-Format) if( pOldTxtNd == rPam.GetBound( sal_True ).nContent.GetIdxReg() ) @@ -1524,21 +1537,19 @@ bool SwDoc::DeleteAndJoinWithRedlineImpl( SwPaM & rPam, const bool ) OSL_ENSURE( IsRedlineOn(), "DeleteAndJoinWithRedline: redline off" ); { - sal_uInt16 nUndoSize = 0; SwUndoRedlineDelete* pUndo = 0; RedlineMode_t eOld = GetRedlineMode(); checkRedlining(eOld); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); //JP 06.01.98: MUSS noch optimiert werden!!! SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE )); - nUndoSize = pUndos->Count(); - StartUndo(UNDO_EMPTY, NULL); - AppendUndo( pUndo = new SwUndoRedlineDelete( rPam, UNDO_DELETE )); + GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); + pUndo = new SwUndoRedlineDelete( rPam, UNDO_DELETE ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if( *rPam.GetPoint() != *rPam.GetMark() ) AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_DELETE, rPam ), true); @@ -1546,18 +1557,29 @@ bool SwDoc::DeleteAndJoinWithRedlineImpl( SwPaM & rPam, const bool ) if( pUndo ) { - EndUndo(UNDO_EMPTY, NULL); - SwUndo* pPrevUndo; - if( nUndoSize && DoesGroupUndo() && - nUndoSize + 1 == pUndos->Count() && - UNDO_REDLINE == ( pPrevUndo = (*pUndos)[ nUndoSize-1 ])->GetId() && - UNDO_DELETE == ((SwUndoRedline*)pPrevUndo)->GetUserId() && - ((SwUndoRedlineDelete*)pPrevUndo)->CanGrouping( *pUndo )) + GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); + // ??? why the hell is the AppendUndo not below the + // CanGrouping, so this hideous cleanup wouldn't be necessary? + // bah, this is redlining, probably changing this would break it... + if (GetIDocumentUndoRedo().DoesGroupUndo()) { - DoUndo( sal_False ); - pUndos->DeleteAndDestroy( nUndoSize, 1 ); - --nUndoPos, --nUndoCnt; - DoUndo( sal_True ); + SwUndo *const pLastUndo( GetUndoManager().GetLastUndo() ); + SwUndoRedlineDelete *const pUndoRedlineDel( + dynamic_cast<SwUndoRedlineDelete*>(pLastUndo) ); + if (pUndoRedlineDel) + { + bool const bMerged = pUndoRedlineDel->CanGrouping(*pUndo); + if (bMerged) + { + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); + SwUndo const*const pDeleted = + GetUndoManager().RemoveLastUndo(); + OSL_ENSURE(pDeleted == pUndo, + "DeleteAndJoinWithRedlineImpl: " + "undo removed is not undo inserted?"); + delete pDeleted; + } + } } //JP 06.01.98: MUSS noch optimiert werden!!! SetRedlineMode( eOld ); @@ -1654,17 +1676,25 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam) } - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - sal_uInt16 nUndoSize = pUndos->Count(); - SwUndo * pUndo; - if( DoesGroupUndo() && nUndoSize-- && - UNDO_DELETE == ( pUndo = (*pUndos)[ nUndoSize ])->GetId() && - ((SwUndoDelete*)pUndo)->CanGrouping( this, rPam )) - ;// wenn CanGrouping() sal_True returnt, ist schon alles erledigt - else - AppendUndo( new SwUndoDelete( rPam ) ); + GetIDocumentUndoRedo().ClearRedo(); + bool bMerged(false); + if (GetIDocumentUndoRedo().DoesGroupUndo()) + { + SwUndo *const pLastUndo( GetUndoManager().GetLastUndo() ); + SwUndoDelete *const pUndoDelete( + dynamic_cast<SwUndoDelete *>(pLastUndo) ); + if (pUndoDelete) + { + bMerged = pUndoDelete->CanGrouping( this, rPam ); + // if CanGrouping() returns true it's already merged + } + } + if (!bMerged) + { + GetIDocumentUndoRedo().AppendUndo( new SwUndoDelete( rPam ) ); + } SetModified(); @@ -1808,7 +1838,7 @@ void lcl_syncGrammarError( SwTxtNode &rTxtNode, linguistic2::ProofreadingResult& return; SwGrammarMarkUp* pWrong = rTxtNode.GetGrammarCheck(); linguistic2::SingleProofreadingError* pArray = rResult.aErrors.getArray(); - USHORT i, j = 0; + sal_uInt16 i, j = 0; if( pWrong ) { for( i = 0; i < rResult.aErrors.getLength(); ++i ) @@ -1848,8 +1878,8 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, pEndPos->nNode.GetNode().GetTxtNode(), pEndPos->nContent, bGrammarCheck ); - ULONG nCurrNd = pSttPos->nNode.GetIndex(); - ULONG nEndNd = pEndPos->nNode.GetIndex(); + sal_uLong nCurrNd = pSttPos->nNode.GetIndex(); + sal_uLong nEndNd = pEndPos->nNode.GetIndex(); uno::Any aRet; if( nCurrNd <= nEndNd ) @@ -2180,7 +2210,7 @@ bool SwDoc::ReplaceRange( SwPaM& rPam, const String& rStr, ::std::vector<xub_StrLen> Breaks; SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() ); - aPam.Normalize(FALSE); + aPam.Normalize(sal_False); if (aPam.GetPoint()->nNode != aPam.GetMark()->nNode) { aPam.Move(fnMoveBackward); @@ -2283,9 +2313,9 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr, { RedlineMode_t eOld = GetRedlineMode(); checkRedlining(eOld); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - StartUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); // Bug 68584 - if any Redline will change (split!) the node const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK ); @@ -2365,15 +2395,19 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr, InsertItemSet( aTmpRange, aSet, 0 ); } - if( DoesUndo() ) - AppendUndo( new SwUndoRedlineDelete( aDelPam, UNDO_REPLACE )); + if (GetIDocumentUndoRedo().DoesUndo()) + { + SwUndo *const pUndoRD = + new SwUndoRedlineDelete( aDelPam, UNDO_REPLACE ); + GetIDocumentUndoRedo().AppendUndo(pUndoRD); + } AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_DELETE, aDelPam ), true); *rPam.GetMark() = *aDelPam.GetMark(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { *aDelPam.GetPoint() = *rPam.GetPoint(); - EndUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); // Bug 68584 - if any Redline will change (split!) the node const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK ); @@ -2400,21 +2434,13 @@ SetRedlineMode( eOld ); DeleteRedline( aDelPam, true, USHRT_MAX ); SwUndoReplace* pUndoRpl = 0; - if( DoesUndo() ) + bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo(); + if (bDoesUndo) { - ClearRedo(); - SwUndo* pU; - - if( !pUndos->Count() || - UNDO_REPLACE != ( pU = (*pUndos)[ pUndos->Count()-1 ])->GetId() || - ( pUndoRpl = (SwUndoReplace*)pU )->IsFull() ) - { - pUndoRpl = new SwUndoReplace(); - AppendUndo( pUndoRpl ); - } - pUndoRpl->AddEntry( aDelPam, sRepl, bRegExReplace ); - DoUndo( sal_False ); + pUndoRpl = new SwUndoReplace(aDelPam, sRepl, bRegExReplace); + GetIDocumentUndoRedo().AppendUndo(pUndoRpl); } + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); if( aDelPam.GetPoint() != pStt ) aDelPam.Exchange(); @@ -2467,8 +2493,7 @@ SetRedlineMode( eOld ); if( pUndoRpl ) { - pUndoRpl->SetEntryEnd( rPam ); - DoUndo( sal_True ); + pUndoRpl->SetEnd(rPam); } } } @@ -2499,16 +2524,18 @@ bool SwDoc::DelFullPara( SwPaM& rPam ) if ( nSectDiff-2 <= nNodeDiff || IsRedlineOn() || /* #i9185# Prevent getting the node after the end node (see below) */ - rEnd.nNode.GetIndex() + 1 == aNodes.Count() ) + rEnd.nNode.GetIndex() + 1 == GetNodes().Count() ) + { return sal_False; + } // harte SeitenUmbrueche am nachfolgenden Node verschieben sal_Bool bSavePageBreak = sal_False, bSavePageDesc = sal_False; /* #i9185# This whould lead to a segmentation fault if not catched above. */ - ULONG nNextNd = rEnd.nNode.GetIndex() + 1; - SwTableNode* pTblNd = aNodes[ nNextNd ]->GetTableNode(); + sal_uLong nNextNd = rEnd.nNode.GetIndex() + 1; + SwTableNode *const pTblNd = GetNodes()[ nNextNd ]->GetTableNode(); if( pTblNd && pNd->IsCntntNode() ) { @@ -2533,7 +2560,7 @@ bool SwDoc::DelFullPara( SwPaM& rPam ) } } - sal_Bool bDoesUndo = DoesUndo(); + bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo(); if( bDoesUndo ) { if( !rPam.HasMark() ) @@ -2548,7 +2575,7 @@ bool SwDoc::DelFullPara( SwPaM& rPam ) pTmpNode = rPam.GetMark()->nNode.GetNode().GetCntntNode(); rPam.GetMark()->nContent.Assign( pTmpNode, 0 ); - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() ); { @@ -2565,7 +2592,7 @@ bool SwDoc::DelFullPara( SwPaM& rPam ) *rPam.GetPoint() = *aDelPam.GetPoint(); pUndo->SetPgBrkFlags( bSavePageBreak, bSavePageDesc ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } else { @@ -2606,10 +2633,10 @@ bool SwDoc::DelFullPara( SwPaM& rPam ) } } - SwCntntNode *pTmpNode = rPam.GetBound( TRUE ).nNode.GetNode().GetCntntNode(); - rPam.GetBound( TRUE ).nContent.Assign( pTmpNode, 0 ); - pTmpNode = rPam.GetBound( FALSE ).nNode.GetNode().GetCntntNode(); - rPam.GetBound( FALSE ).nContent.Assign( pTmpNode, 0 ); + SwCntntNode *pTmpNode = rPam.GetBound( sal_True ).nNode.GetNode().GetCntntNode(); + rPam.GetBound( sal_True ).nContent.Assign( pTmpNode, 0 ); + pTmpNode = rPam.GetBound( sal_False ).nNode.GetNode().GetCntntNode(); + rPam.GetBound( sal_False ).nContent.Assign( pTmpNode, 0 ); GetNodes().Delete( aRg.aStart, nNodeDiff+1 ); } rPam.DeleteMark(); @@ -2622,15 +2649,13 @@ void SwDoc::TransliterateText( const SwPaM& rPaM, utl::TransliterationWrapper& rTrans ) { - SwUndoTransliterate* pUndo; - if( DoesUndo() ) - pUndo = new SwUndoTransliterate( rPaM, rTrans ); - else - pUndo = 0; + SwUndoTransliterate *const pUndo = (GetIDocumentUndoRedo().DoesUndo()) + ? new SwUndoTransliterate( rPaM, rTrans ) + : 0; const SwPosition* pStt = rPaM.Start(), * pEnd = rPaM.End(); - ULONG nSttNd = pStt->nNode.GetIndex(), + sal_uLong nSttNd = pStt->nNode.GetIndex(), nEndNd = pEnd->nNode.GetIndex(); xub_StrLen nSttCnt = pStt->nContent.GetIndex(), nEndCnt = pEnd->nContent.GetIndex(); @@ -2646,7 +2671,7 @@ void SwDoc::TransliterateText( pTNd->GetTxt(), nSttCnt, pBreakIt->GetLocale( pTNd->GetLang( nSttCnt ) ), WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/, - TRUE ); + sal_True ); if( aBndry.startPos < nSttCnt && nSttCnt < aBndry.endPos ) { @@ -2684,8 +2709,7 @@ void SwDoc::TransliterateText( { if( pUndo->HasData() ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } else delete pUndo; @@ -2704,7 +2728,7 @@ void SwDoc::checkRedlining(RedlineMode_t& _rReadlineMode) && !((_rReadlineMode & nsRedlineMode_t::REDLINE_SHOW_DELETE) == nsRedlineMode_t::REDLINE_SHOW_DELETE) ) { WarningBox aWarning( pParent,SW_RES(MSG_DISABLE_READLINE_QUESTION)); - USHORT nResult = aWarning.Execute(); + sal_uInt16 nResult = aWarning.Execute(); mbReadlineChecked = sal_True; if ( nResult == RET_YES ) { @@ -2722,8 +2746,8 @@ void SwDoc::CountWords( const SwPaM& rPaM, SwDocStat& rStat ) const const SwPosition* pEnd = pStt == rPaM.GetPoint() ? rPaM.GetMark() : rPaM.GetPoint(); - const ULONG nSttNd = pStt->nNode.GetIndex(); - const ULONG nEndNd = pEnd->nNode.GetIndex(); + const sal_uLong nSttNd = pStt->nNode.GetIndex(); + const sal_uLong nEndNd = pEnd->nNode.GetIndex(); const xub_StrLen nSttCnt = pStt->nContent.GetIndex(); const xub_StrLen nEndCnt = pEnd->nContent.GetIndex(); diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 6447aa4645ba..8b246e37b254 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -43,6 +43,7 @@ #include <unotools/charclass.hxx> #include <unotools/transliterationwrapper.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -75,8 +76,8 @@ using namespace ::com::sun::star::uno; -extern BOOL IsFrameBehind( const SwTxtNode& rMyNd, USHORT nMySttPos, - const SwTxtNode& rBehindNd, USHORT nSttPos ); +extern sal_Bool IsFrameBehind( const SwTxtNode& rMyNd, sal_uInt16 nMySttPos, + const SwTxtNode& rBehindNd, sal_uInt16 nSttPos ); SV_IMPL_OP_PTRARR_SORT( _SetGetExpFlds, _SetGetExpFldPtr ) @@ -90,10 +91,10 @@ SV_IMPL_OP_PTRARR_SORT( _SetGetExpFlds, _SetGetExpFldPtr ) */ SwFieldType* SwDoc::InsertFldType(const SwFieldType &rFldTyp) { - USHORT nSize = pFldTypes->Count(), + sal_uInt16 nSize = pFldTypes->Count(), nFldWhich = rFldTyp.Which(); - USHORT i = INIT_FLDTYPES; + sal_uInt16 i = INIT_FLDTYPES; switch( nFldWhich ) { @@ -170,8 +171,8 @@ void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp ) // - Wird genau der gleiche Typ gefunden, dann muss der geloeschte // einen anderen Namen erhalten. - USHORT nSize = pFldTypes->Count(), nFldWhich = rFldTyp.Which(); - USHORT i = INIT_FLDTYPES; + sal_uInt16 nSize = pFldTypes->Count(), nFldWhich = rFldTyp.Which(); + sal_uInt16 i = INIT_FLDTYPES; OSL_ENSURE( RES_SETEXPFLD == nFldWhich || RES_USERFLD == nFldWhich || @@ -186,7 +187,7 @@ void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp ) rSCmp.isEqual( rFldNm, pFnd->GetName() ) ) { // neuen Namen suchen - USHORT nNum = 1; + sal_uInt16 nNum = 1; do { String sSrch( rFldNm ); sSrch.Append( String::CreateFromInt32( nNum )); @@ -201,7 +202,7 @@ void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp ) break; // raus aus der While-Schleife } ++nNum; - } while( TRUE ); + } while( sal_True ); break; } @@ -210,13 +211,13 @@ void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp ) switch( nFldWhich ) { case RES_SETEXPFLD: - ((SwSetExpFieldType&)rFldTyp).SetDeleted( FALSE ); + ((SwSetExpFieldType&)rFldTyp).SetDeleted( sal_False ); break; case RES_USERFLD: - ((SwUserFieldType&)rFldTyp).SetDeleted( FALSE ); + ((SwUserFieldType&)rFldTyp).SetDeleted( sal_False ); break; case RES_DDEFLD: - ((SwDDEFieldType&)rFldTyp).SetDeleted( FALSE ); + ((SwDDEFieldType&)rFldTyp).SetDeleted( sal_False ); break; } } @@ -224,19 +225,19 @@ void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp ) /*-------------------------------------------------------------------- Beschreibung: Feldtypen loeschen --------------------------------------------------------------------*/ -void SwDoc::RemoveFldType(USHORT nFld) +void SwDoc::RemoveFldType(sal_uInt16 nFld) { OSL_ENSURE( INIT_FLDTYPES <= nFld, "keine InitFields loeschen" ); /* * Abheangige Felder vorhanden -> ErrRaise */ - USHORT nSize = pFldTypes->Count(); + sal_uInt16 nSize = pFldTypes->Count(); if(nFld < nSize) { SwFieldType* pTmp = (*pFldTypes)[nFld]; // JP 29.07.96: opt. FeldListe fuer den Calculator vorbereiten: - USHORT nWhich = pTmp->Which(); + sal_uInt16 nWhich = pTmp->Which(); switch( nWhich ) { case RES_SETEXPFLD: @@ -247,11 +248,11 @@ void SwDoc::RemoveFldType(USHORT nFld) if( pTmp->GetDepends() && !IsUsed( *pTmp ) ) { if( RES_SETEXPFLD == nWhich ) - ((SwSetExpFieldType*)pTmp)->SetDeleted( TRUE ); + ((SwSetExpFieldType*)pTmp)->SetDeleted( sal_True ); else if( RES_USERFLD == nWhich ) - ((SwUserFieldType*)pTmp)->SetDeleted( TRUE ); + ((SwUserFieldType*)pTmp)->SetDeleted( sal_True ); else - ((SwDDEFieldType*)pTmp)->SetDeleted( TRUE ); + ((SwDDEFieldType*)pTmp)->SetDeleted( sal_True ); nWhich = 0; } break; @@ -276,13 +277,13 @@ const SwFldTypes* SwDoc::GetFldTypes() const /*-------------------------------------------------------------------- Beschreibung: Den ersten Typen mit ResId und Namen finden --------------------------------------------------------------------*/ -SwFieldType* SwDoc::GetFldType( USHORT nResId, const String& rName, +SwFieldType* SwDoc::GetFldType( sal_uInt16 nResId, const String& rName, bool bDbFieldMatching // used in some UNO calls for RES_DBFLD // to use different string matching code // #i51815# ) const { - USHORT nSize = pFldTypes->Count(), i = 0; + sal_uInt16 nSize = pFldTypes->Count(), i = 0; const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore(); switch( nResId ) @@ -335,7 +336,7 @@ void SwDoc::UpdateFlds( SfxPoolItem *pNewHt, bool bCloseDB ) // Modify() fuer jeden Feldtypen rufen, // abhaengige SwTxtFld werden benachrichtigt ... - for( USHORT i=0; i < pFldTypes->Count(); ++i) + for( sal_uInt16 i=0; i < pFldTypes->Count(); ++i) { switch( (*pFldTypes)[i]->Which() ) { @@ -372,7 +373,7 @@ void SwDoc::UpdateFlds( SfxPoolItem *pNewHt, bool bCloseDB ) } if( !IsExpFldsLocked() ) - UpdateExpFlds( 0, FALSE ); // Expression-Felder Updaten + UpdateExpFlds( 0, sal_False ); // Expression-Felder Updaten // Tabellen UpdateTblFlds(pNewHt); @@ -394,7 +395,7 @@ void SwDoc::UpdateUsrFlds() { SwCalc* pCalc = 0; const SwFieldType* pFldType; - for( USHORT i = INIT_FLDTYPES; i < pFldTypes->Count(); ++i ) + for( sal_uInt16 i = INIT_FLDTYPES; i < pFldTypes->Count(); ++i ) if( RES_USERFLD == ( pFldType = (*pFldTypes)[i] )->Which() ) { if( !pCalc ) @@ -415,7 +416,7 @@ void SwDoc::UpdateUsrFlds() void SwDoc::UpdateRefFlds( SfxPoolItem* pHt ) { SwFieldType* pFldType; - for( USHORT i = 0; i < pFldTypes->Count(); ++i ) + for( sal_uInt16 i = 0; i < pFldTypes->Count(); ++i ) if( RES_GETREFFLD == ( pFldType = (*pFldTypes)[i] )->Which() ) pFldType->Modify( 0, pHt ); } @@ -426,9 +427,8 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) "Was ist das fuer ein MessageItem?" ); SwFieldType* pFldType(0); - USHORT i; - for( i = 0; i < pFldTypes->Count(); ++i ) + for (sal_uInt16 i = 0; i < pFldTypes->Count(); ++i) { if( RES_TABLEFLD == ( pFldType = (*pFldTypes)[i] )->Which() ) { @@ -461,7 +461,7 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) if( nsSwExtendedSubType::SUB_CMD & pFld->GetSubType() ) pFld->PtrToBoxNm( pUpdtFld->pTbl ); else - pFld->ChgValid( FALSE ); + pFld->ChgValid( sal_False ); break; case TBL_BOXNAME: // ist es die gesuchte Tabelle ?? @@ -487,7 +487,7 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) } else // setze bei allen das Value-Flag zurueck - pFld->ChgValid( FALSE ); + pFld->ChgValid( sal_False ); } break; @@ -497,13 +497,15 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) // und dann noch alle Tabellen Box Formeln abklappern const SfxPoolItem* pItem; - USHORT nMaxItems = GetAttrPool().GetItemCount( RES_BOXATR_FORMULA ); - for( i = 0; i < nMaxItems; ++i ) - if( 0 != (pItem = GetAttrPool().GetItem( RES_BOXATR_FORMULA, i ) ) && + sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_BOXATR_FORMULA ); + for (sal_uInt32 i = 0; i < nMaxItems; ++i) + { + if( 0 != (pItem = GetAttrPool().GetItem2( RES_BOXATR_FORMULA, i ) ) && ((SwTblBoxFormula*)pItem)->GetDefinedIn() ) { ((SwTblBoxFormula*)pItem)->ChangeState( pHt ); } + } // alle Felder/Boxen sind jetzt invalide, also kann das Rechnen anfangen @@ -598,8 +600,9 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) } // dann berechene noch die Formeln an den Boxen - for( i = 0; i < nMaxItems; ++i ) - if( 0 != (pItem = GetAttrPool().GetItem( RES_BOXATR_FORMULA, i ) ) && + for (sal_uInt32 i = 0; i < nMaxItems; ++i ) + { + if( 0 != (pItem = GetAttrPool().GetItem2( RES_BOXATR_FORMULA, i ) ) && ((SwTblBoxFormula*)pItem)->GetDefinedIn() && !((SwTblBoxFormula*)pItem)->IsValid() ) { @@ -675,6 +678,7 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) } } } + } if( pCalc ) delete pCalc; @@ -683,7 +687,7 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) void SwDoc::UpdatePageFlds( SfxPoolItem* pMsgHnt ) { SwFieldType* pFldType; - for( USHORT i = 0; i < INIT_FLDTYPES; ++i ) + for( sal_uInt16 i = 0; i < INIT_FLDTYPES; ++i ) switch( ( pFldType = (*pFldTypes)[ i ] )->Which() ) { case RES_PAGENUMBERFLD: @@ -702,7 +706,7 @@ void SwDoc::UpdatePageFlds( SfxPoolItem* pMsgHnt ) // ---- Loesche alle nicht referenzierten FeldTypen eines Dokumentes -- void SwDoc::GCFieldTypes() { - for( USHORT n = pFldTypes->Count(); n > INIT_FLDTYPES; ) + for( sal_uInt16 n = pFldTypes->Count(); n > INIT_FLDTYPES; ) if( !(*pFldTypes)[ --n ]->GetDepends() ) RemoveFldType( n ); } @@ -891,19 +895,19 @@ void _SetGetExpFld::SetBodyPos( const SwCntntFrm& rFrm ) } } -BOOL _SetGetExpFld::operator<( const _SetGetExpFld& rFld ) const +sal_Bool _SetGetExpFld::operator<( const _SetGetExpFld& rFld ) const { if( nNode < rFld.nNode || ( nNode == rFld.nNode && nCntnt < rFld.nCntnt )) - return TRUE; + return sal_True; else if( nNode != rFld.nNode || nCntnt != rFld.nCntnt ) - return FALSE; + return sal_False; const SwNode *pFirst = GetNodeFromCntnt(), *pNext = rFld.GetNodeFromCntnt(); // Position gleich: nur weiter wenn beide FeldPointer besetzt sind !! if( !pFirst || !pNext ) - return FALSE; + return sal_False; // gleiche Section ?? if( pFirst->StartOfSectionNode() != pNext->StartOfSectionNode() ) @@ -987,7 +991,7 @@ const SwNode* _SetGetExpFld::GetNodeFromCntnt() const xub_StrLen _SetGetExpFld::GetCntPosFromCntnt() const { - USHORT nRet = 0; + sal_uInt16 nRet = 0; if( CNTNT.pTxtFld ) switch( eSetGetExpFldType ) { @@ -1014,8 +1018,8 @@ _HashStr::_HashStr( const String& rName, const String& rText, // suche nach dem Namen, ist er vorhanden, returne seinen String, sonst // einen LeerString -void LookString( SwHash** ppTbl, USHORT nSize, const String& rName, - String& rRet, USHORT* pPos ) +void LookString( SwHash** ppTbl, sal_uInt16 nSize, const String& rName, + String& rRet, sal_uInt16* pPos ) { rRet = rName; rRet.EraseLeadingChars().EraseTrailingChars(); @@ -1052,7 +1056,7 @@ void lcl_CalcFld( SwDoc& rDoc, SwCalc& rCalc, const _SetGetExpFld& rSGEFld, return ; const SwField* pFld = pTxtFld->GetFld().GetFld(); - const USHORT nFldWhich = pFld->GetTyp()->Which(); + const sal_uInt16 nFldWhich = pFld->GetTyp()->Which(); if( RES_SETEXPFLD == nFldWhich ) { @@ -1105,38 +1109,38 @@ void SwDoc::FldsToCalc( SwCalc& rCalc, const _SetGetExpFld& rToThisFld ) { // erzeuge die Sortierteliste aller SetFelder pUpdtFlds->MakeFldList( *this, mbNewFldLst, GETFLD_CALC ); - mbNewFldLst = FALSE; + mbNewFldLst = sal_False; SwNewDBMgr* pMgr = GetNewDBMgr(); - pMgr->CloseAll(FALSE); + pMgr->CloseAll(sal_False); if( pUpdtFlds->GetSortLst()->Count() ) { - USHORT nLast; + sal_uInt16 nLast; _SetGetExpFld* pFld = (_SetGetExpFld*)&rToThisFld; if( pUpdtFlds->GetSortLst()->Seek_Entry( pFld, &nLast ) ) ++nLast; const _SetGetExpFldPtr* ppSortLst = pUpdtFlds->GetSortLst()->GetData(); - for( USHORT n = 0; n < nLast; ++n, ++ppSortLst ) + for( sal_uInt16 n = 0; n < nLast; ++n, ++ppSortLst ) lcl_CalcFld( *this, rCalc, **ppSortLst, pMgr ); } - pMgr->CloseAll(FALSE); + pMgr->CloseAll(sal_False); } -void SwDoc::FldsToCalc( SwCalc& rCalc, ULONG nLastNd, sal_uInt16 nLastCnt ) +void SwDoc::FldsToCalc( SwCalc& rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt ) { // erzeuge die Sortierteliste aller SetFelder pUpdtFlds->MakeFldList( *this, mbNewFldLst, GETFLD_CALC ); - mbNewFldLst = FALSE; + mbNewFldLst = sal_False; SwNewDBMgr* pMgr = GetNewDBMgr(); - pMgr->CloseAll(FALSE); + pMgr->CloseAll(sal_False); const _SetGetExpFldPtr* ppSortLst = pUpdtFlds->GetSortLst()->GetData(); - for( USHORT n = pUpdtFlds->GetSortLst()->Count(); + for( sal_uInt16 n = pUpdtFlds->GetSortLst()->Count(); n && ( (*ppSortLst)->GetNode() < nLastNd || ( (*ppSortLst)->GetNode() == nLastNd && (*ppSortLst)->GetCntnt() <= nLastCnt ) @@ -1144,15 +1148,15 @@ void SwDoc::FldsToCalc( SwCalc& rCalc, ULONG nLastNd, sal_uInt16 nLastCnt ) --n, ++ppSortLst ) lcl_CalcFld( *this, rCalc, **ppSortLst, pMgr ); - pMgr->CloseAll(FALSE); + pMgr->CloseAll(sal_False); } -void SwDoc::FldsToExpand( SwHash**& ppHashTbl, USHORT& rTblSize, +void SwDoc::FldsToExpand( SwHash**& ppHashTbl, sal_uInt16& rTblSize, const _SetGetExpFld& rToThisFld ) { // erzeuge die Sortierteliste aller SetFelder pUpdtFlds->MakeFldList( *this, mbNewFldLst, GETFLD_EXPAND ); - mbNewFldLst = FALSE; + mbNewFldLst = sal_False; // HashTabelle fuer alle String Ersetzungen, wird "one the fly" gefuellt // (versuche eine "ungerade"-Zahl zu erzeugen) @@ -1160,14 +1164,14 @@ void SwDoc::FldsToExpand( SwHash**& ppHashTbl, USHORT& rTblSize, ppHashTbl = new SwHash*[ rTblSize ]; memset( ppHashTbl, 0, sizeof( _HashStr* ) * rTblSize ); - USHORT nLast; + sal_uInt16 nLast; { _SetGetExpFld* pTmp = (_SetGetExpFld*)&rToThisFld; if( pUpdtFlds->GetSortLst()->Seek_Entry( pTmp, &nLast ) ) ++nLast; } - USHORT nPos; + sal_uInt16 nPos; SwHash* pFnd; String aNew; const _SetGetExpFldPtr* ppSortLst = pUpdtFlds->GetSortLst()->GetData(); @@ -1238,11 +1242,11 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) if( IsExpFldsLocked() || IsInReading() ) return; - BOOL bOldInUpdateFlds = pUpdtFlds->IsInUpdateFlds(); - pUpdtFlds->SetInUpdateFlds( TRUE ); + sal_Bool bOldInUpdateFlds = pUpdtFlds->IsInUpdateFlds(); + pUpdtFlds->SetInUpdateFlds( sal_True ); - pUpdtFlds->MakeFldList( *this, TRUE, GETFLD_ALL ); - mbNewFldLst = FALSE; + pUpdtFlds->MakeFldList( *this, sal_True, GETFLD_ALL ); + mbNewFldLst = sal_False; if( !pUpdtFlds->GetSortLst()->Count() ) { @@ -1250,15 +1254,15 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) UpdateRefFlds(NULL); pUpdtFlds->SetInUpdateFlds( bOldInUpdateFlds ); - pUpdtFlds->SetFieldsDirty( FALSE ); + pUpdtFlds->SetFieldsDirty( sal_False ); return ; } - USHORT nWhich, n; + sal_uInt16 nWhich, n; // HashTabelle fuer alle String Ersetzungen, wird "one the fly" gefuellt // (versuche eine "ungerade"-Zahl zu erzeugen) - USHORT nStrFmtCnt = (( pFldTypes->Count() / 7 ) + 1 ) * 7; + sal_uInt16 nStrFmtCnt = (( pFldTypes->Count() / 7 ) + 1 ) * 7; SwHash** pHashStrTbl = new SwHash*[ nStrFmtCnt ]; memset( pHashStrTbl, 0, sizeof( _HashStr* ) * nStrFmtCnt ); @@ -1271,7 +1275,7 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) case RES_USERFLD: { // Eintrag vorhanden ? - USHORT nPos; + sal_uInt16 nPos; const String& rNm = pFldType->GetName(); String sExpand(((SwUserFieldType*)pFldType)->Expand(nsSwGetSetExpType::GSE_STRING, 0, 0)); SwHash* pFnd = Find( rNm, pHashStrTbl, nStrFmtCnt, &nPos ); @@ -1297,7 +1301,7 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) // aktuelle Datensatznummer schon vorher einstellen SwNewDBMgr* pMgr = GetNewDBMgr(); - pMgr->CloseAll(FALSE); + pMgr->CloseAll(sal_False); String aNew; const _SetGetExpFldPtr* ppSortLst = pUpdtFlds->GetSortLst()->GetData(); @@ -1378,7 +1382,7 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) // Eintrag in den HashTable eintragen // Eintrag vorhanden ? - USHORT nPos; + sal_uInt16 nPos; SwHash* pFnd = Find( rName, pHashStrTbl, nStrFmtCnt, &nPos ); String const value(pFld->ExpandField(IsClipBoard())); if( pFnd ) @@ -1428,7 +1432,7 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) // suche den Namen vom Feld aNew = ((SwSetExpFieldType*)pSFld->GetTyp())->GetSetRefName(); // Eintrag vorhanden ? - USHORT nPos; + sal_uInt16 nPos; SwHash* pFnd = Find( aNew, pHashStrTbl, nStrFmtCnt, &nPos ); if( pFnd ) // Eintrag in der HashTabelle aendern @@ -1470,7 +1474,7 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) if( pSFld->IsSequenceFld() ) { - const BYTE nLvl = pSFldTyp->GetOutlineLvl(); + const sal_uInt8 nLvl = pSFldTyp->GetOutlineLvl(); if( MAXLEVEL > nLvl ) { // dann teste, ob die Nummer neu aufsetzen muss @@ -1516,7 +1520,7 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) } } - pMgr->CloseAll(FALSE); + pMgr->CloseAll(sal_False); // HashTabelle wieder loeschen ::DeleteHashTable( pHashStrTbl, nStrFmtCnt ); @@ -1525,16 +1529,16 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) UpdateRefFlds(NULL); pUpdtFlds->SetInUpdateFlds( bOldInUpdateFlds ); - pUpdtFlds->SetFieldsDirty( FALSE ); + pUpdtFlds->SetFieldsDirty( sal_False ); } void SwDoc::UpdateDBNumFlds( SwDBNameInfField& rDBFld, SwCalc& rCalc ) { SwNewDBMgr* pMgr = GetNewDBMgr(); - USHORT nFldType = rDBFld.Which(); + sal_uInt16 nFldType = rDBFld.Which(); - BOOL bPar1 = rCalc.Calculate( rDBFld.GetPar1() ).GetBool(); + sal_Bool bPar1 = rCalc.Calculate( rDBFld.GetPar1() ).GetBool(); if( RES_DBNEXTSETFLD == nFldType ) ((SwDBNextSetField&)rDBFld).SetCondValid( bPar1 ); @@ -1564,7 +1568,7 @@ void SwDoc::UpdateDBNumFlds( SwDBNameInfField& rDBFld, SwCalc& rCalc ) void SwDoc::_InitFieldTypes() // wird vom CTOR gerufen!! { // Feldtypen - USHORT nFldType = 0; + sal_uInt16 nFldType = 0; pFldTypes->Insert( new SwDateTimeFieldType(this), nFldType++ ); pFldTypes->Insert( new SwChapterFieldType, nFldType++ ); pFldTypes->Insert( new SwPageNumberFieldType, nFldType++ ); @@ -1625,11 +1629,11 @@ const SwDBData& SwDoc::GetDBDesc() { if(!aDBData.sDataSource.getLength()) { - const USHORT nSize = pFldTypes->Count(); - for(USHORT i = 0; i < nSize && !aDBData.sDataSource.getLength(); ++i) + const sal_uInt16 nSize = pFldTypes->Count(); + for(sal_uInt16 i = 0; i < nSize && !aDBData.sDataSource.getLength(); ++i) { SwFieldType& rFldType = *((*pFldTypes)[i]); - USHORT nWhich = rFldType.Which(); + sal_uInt16 nWhich = rFldType.Which(); if(IsUsed(rFldType)) { switch(nWhich) @@ -1666,7 +1670,7 @@ const SwDBData& SwDoc::GetDBDesc() return aDBData; } -void SwDoc::SetInitDBFields( BOOL b ) +void SwDoc::SetInitDBFields( sal_Bool b ) { GetNewDBMgr()->SetInitDBFields( b ); } @@ -1687,7 +1691,6 @@ String lcl_DBDataToString(const SwDBData& rData) void SwDoc::GetAllUsedDB( SvStringsDtor& rDBNameList, const SvStringsDtor* pAllDBNames ) { - USHORT n; SvStringsDtor aUsedDBNames; SvStringsDtor aAllDBNames; @@ -1698,7 +1701,7 @@ void SwDoc::GetAllUsedDB( SvStringsDtor& rDBNameList, } SwSectionFmts& rArr = GetSections(); - for( n = rArr.Count(); n; ) + for (sal_uInt16 n = rArr.Count(); n; ) { SwSection* pSect = rArr[ --n ]->GetSection(); @@ -1712,10 +1715,10 @@ void SwDoc::GetAllUsedDB( SvStringsDtor& rDBNameList, } const SfxPoolItem* pItem; - USHORT nMaxItems = GetAttrPool().GetItemCount( RES_TXTATR_FIELD ); - for( n = 0; n < nMaxItems; ++n ) + sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_FIELD ); + for (sal_uInt32 n = 0; n < nMaxItems; ++n) { - if( 0 == (pItem = GetAttrPool().GetItem( RES_TXTATR_FIELD, n ) )) + if( 0 == (pItem = GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) )) continue; const SwFmtFld* pFmtFld = (SwFmtFld*)pItem; @@ -1766,7 +1769,7 @@ void SwDoc::GetAllDBNames( SvStringsDtor& rAllDBNames ) SwNewDBMgr* pMgr = GetNewDBMgr(); const SwDSParamArr& rArr = pMgr->GetDSParamArray(); - for(USHORT i = 0; i < rArr.Count(); i++) + for(sal_uInt16 i = 0; i < rArr.Count(); i++) { SwDSParam* pParam = rArr[i]; String* pStr = new String( pParam->sDataSource ); @@ -1787,7 +1790,7 @@ SvStringsDtor& SwDoc::FindUsedDBs( const SvStringsDtor& rAllDBNames, #endif xub_StrLen nPos; - for (USHORT i = 0; i < rAllDBNames.Count(); ++i ) + for (sal_uInt16 i = 0; i < rAllDBNames.Count(); ++i ) { const String* pStr = rAllDBNames.GetObject(i); @@ -1813,7 +1816,7 @@ SvStringsDtor& SwDoc::FindUsedDBs( const SvStringsDtor& rAllDBNames, void SwDoc::AddUsedDBToList( SvStringsDtor& rDBNameList, const SvStringsDtor& rUsedDBNames ) { - for (USHORT i = 0; i < rUsedDBNames.Count(); i++) + for (sal_uInt16 i = 0; i < rUsedDBNames.Count(); i++) AddUsedDBToList( rDBNameList, *rUsedDBNames.GetObject(i) ); } @@ -1823,12 +1826,12 @@ void SwDoc::AddUsedDBToList( SvStringsDtor& rDBNameList, const String& rDBName) return; #ifdef UNX - for( USHORT i = 0; i < rDBNameList.Count(); ++i ) + for( sal_uInt16 i = 0; i < rDBNameList.Count(); ++i ) if( rDBName == rDBNameList.GetObject(i)->GetToken(0) ) return; #else const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore(); - for( USHORT i = 0; i < rDBNameList.Count(); ++i ) + for( sal_uInt16 i = 0; i < rDBNameList.Count(); ++i ) if( rSCmp.isEqual( rDBName, rDBNameList.GetObject(i)->GetToken(0) ) ) return; #endif @@ -1851,10 +1854,9 @@ void SwDoc::ChangeDBFields( const SvStringsDtor& rOldNames, aNewDBData.nCommandType = (short)rNewName.GetToken(2, DB_DELIM).ToInt32(); String sFormel; - USHORT n; SwSectionFmts& rArr = GetSections(); - for( n = rArr.Count(); n; ) + for (sal_uInt16 n = rArr.Count(); n; ) { SwSection* pSect = rArr[ --n ]->GetSection(); @@ -1867,11 +1869,11 @@ void SwDoc::ChangeDBFields( const SvStringsDtor& rOldNames, } const SfxPoolItem* pItem; - USHORT nMaxItems = GetAttrPool().GetItemCount( RES_TXTATR_FIELD ); + sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_FIELD ); - for( n = 0; n < nMaxItems; ++n ) + for (sal_uInt32 n = 0; n < nMaxItems; ++n ) { - if( 0 == (pItem = GetAttrPool().GetItem( RES_TXTATR_FIELD, n ) )) + if( 0 == (pItem = GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) )) continue; SwFmtFld* pFmtFld = (SwFmtFld*)pItem; @@ -1880,7 +1882,7 @@ void SwDoc::ChangeDBFields( const SvStringsDtor& rOldNames, continue; SwField* pFld = pFmtFld->GetFld(); - BOOL bExpand = FALSE; + sal_Bool bExpand = sal_False; switch( pFld->GetTyp()->Which() ) { @@ -1898,7 +1900,7 @@ void SwDoc::ChangeDBFields( const SvStringsDtor& rOldNames, ((SwDBField*)pFld)->ClearInitialized(); ((SwDBField*)pFld)->InitContent(); - bExpand = TRUE; + bExpand = sal_True; } break; @@ -1908,7 +1910,7 @@ void SwDoc::ChangeDBFields( const SvStringsDtor& rOldNames, lcl_DBDataToString(((SwDBNameInfField*)pFld)->GetRealDBData()))) { ((SwDBNameInfField*)pFld)->SetDBData(aNewDBData); - bExpand = TRUE; + bExpand = sal_True; } break; @@ -1918,7 +1920,7 @@ void SwDoc::ChangeDBFields( const SvStringsDtor& rOldNames, lcl_DBDataToString(((SwDBNameInfField*)pFld)->GetRealDBData()))) { ((SwDBNameInfField*)pFld)->SetDBData(aNewDBData); - bExpand = TRUE; + bExpand = sal_True; } // kein break; case RES_HIDDENTXTFLD: @@ -1926,7 +1928,7 @@ void SwDoc::ChangeDBFields( const SvStringsDtor& rOldNames, sFormel = pFld->GetPar1(); ReplaceUsedDBs( rOldNames, rNewName, sFormel); pFld->SetPar1( sFormel ); - bExpand = TRUE; + bExpand = sal_True; break; case RES_SETEXPFLD: @@ -1935,7 +1937,7 @@ void SwDoc::ChangeDBFields( const SvStringsDtor& rOldNames, sFormel = pFld->GetFormula(); ReplaceUsedDBs( rOldNames, rNewName, sFormel); pFld->SetPar2( sFormel ); - bExpand = TRUE; + bExpand = sal_True; break; } @@ -1957,7 +1959,7 @@ void SwDoc::ReplaceUsedDBs( const SvStringsDtor& rUsedDBNames, String sUpperNewNm( sNewName ); - for( USHORT i = 0; i < rUsedDBNames.Count(); ++i ) + for( sal_uInt16 i = 0; i < rUsedDBNames.Count(); ++i ) { String sDBName( *rUsedDBNames.GetObject( i ) ); @@ -1986,26 +1988,26 @@ void SwDoc::ReplaceUsedDBs( const SvStringsDtor& rUsedDBNames, } } -BOOL SwDoc::IsNameInArray( const SvStringsDtor& rArr, const String& rName ) +sal_Bool SwDoc::IsNameInArray( const SvStringsDtor& rArr, const String& rName ) { #ifdef UNX - for( USHORT i = 0; i < rArr.Count(); ++i ) + for( sal_uInt16 i = 0; i < rArr.Count(); ++i ) if( rName == *rArr[ i ] ) - return TRUE; + return sal_True; #else const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore(); - for( USHORT i = 0; i < rArr.Count(); ++i ) + for( sal_uInt16 i = 0; i < rArr.Count(); ++i ) if( rSCmp.isEqual( rName, *rArr[ i] )) - return TRUE; + return sal_True; #endif - return FALSE; + return sal_False; } void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) { - BOOL bIsModified = IsModified(); + sal_Bool bIsModified = IsModified(); - ULONG nDate, nTime; + sal_uLong nDate, nTime; if( pNewDateTime ) { nDate = pNewDateTime->GetDate(); @@ -2017,14 +2019,14 @@ void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) nTime = Time().GetTime(); } - USHORT aTypes[5] = { + sal_uInt16 aTypes[5] = { /*0*/ RES_DOCINFOFLD, /*1*/ RES_AUTHORFLD, /*2*/ RES_EXTUSERFLD, /*3*/ RES_FILENAMEFLD, /*4*/ RES_DATETIMEFLD }; // MUSS am Ende stehen!! - USHORT nStt = bOnlyTimeDate ? 4 : 0; + sal_uInt16 nStt = bOnlyTimeDate ? 4 : 0; for( ; nStt < 5; ++nStt ) { @@ -2036,13 +2038,13 @@ void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) { if( pFld && pFld->GetTxtFld() ) { - BOOL bChgd = FALSE; + sal_Bool bChgd = sal_False; switch( aTypes[ nStt ] ) { case RES_DOCINFOFLD: if( ((SwDocInfoField*)pFld->GetFld())->IsFixed() ) { - bChgd = TRUE; + bChgd = sal_True; SwDocInfoField* pDocInfFld = (SwDocInfoField*)pFld->GetFld(); pDocInfFld->SetExpansion( ((SwDocInfoFieldType*) pDocInfFld->GetTyp())->Expand( @@ -2056,7 +2058,7 @@ void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) case RES_AUTHORFLD: if( ((SwAuthorField*)pFld->GetFld())->IsFixed() ) { - bChgd = TRUE; + bChgd = sal_True; SwAuthorField* pAuthorFld = (SwAuthorField*)pFld->GetFld(); pAuthorFld->SetExpansion( ((SwAuthorFieldType*) pAuthorFld->GetTyp())->Expand( @@ -2067,7 +2069,7 @@ void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) case RES_EXTUSERFLD: if( ((SwExtUserField*)pFld->GetFld())->IsFixed() ) { - bChgd = TRUE; + bChgd = sal_True; SwExtUserField* pExtUserFld = (SwExtUserField*)pFld->GetFld(); pExtUserFld->SetExpansion( ((SwExtUserFieldType*) pExtUserFld->GetTyp())->Expand( @@ -2079,7 +2081,7 @@ void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) case RES_DATETIMEFLD: if( ((SwDateTimeField*)pFld->GetFld())->IsFixed() ) { - bChgd = TRUE; + bChgd = sal_True; ((SwDateTimeField*)pFld->GetFld())->SetDateTime( DateTime(Date(nDate), Time(nTime)) ); } @@ -2088,7 +2090,7 @@ void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) case RES_FILENAMEFLD: if( ((SwFileNameField*)pFld->GetFld())->IsFixed() ) { - bChgd = TRUE; + bChgd = sal_True; SwFileNameField* pFileNameFld = (SwFileNameField*)pFld->GetFld(); pFileNameFld->SetExpansion( ((SwFileNameFieldType*) @@ -2109,19 +2111,19 @@ void SwDoc::SetFixFields( bool bOnlyTimeDate, const DateTime* pNewDateTime ) ResetModified(); } -bool SwDoc::SetFieldsDirty( bool b, const SwNode* pChk, ULONG nLen ) +bool SwDoc::SetFieldsDirty( bool b, const SwNode* pChk, sal_uLong nLen ) { // teste ggfs. mal, ob die angegbenen Nodes ueberhaupt Felder beinhalten. // wenn nicht, braucht das Flag nicht veraendert werden. - BOOL bFldsFnd = FALSE; + sal_Bool bFldsFnd = sal_False; if( b && pChk && !GetUpdtFlds().IsFieldsDirty() && !IsInDtor() // ?? was ist mit Undo, da will man es doch auch haben !! /*&& &pChk->GetNodes() == &GetNodes()*/ ) { - b = FALSE; + b = sal_False; if( !nLen ) ++nLen; - ULONG nStt = pChk->GetIndex(); + sal_uLong nStt = pChk->GetIndex(); const SwNodes& rNds = pChk->GetNodes(); while( nLen-- ) { @@ -2130,15 +2132,15 @@ bool SwDoc::SetFieldsDirty( bool b, const SwNode* pChk, ULONG nLen ) { if( pTNd->GetAttrOutlineLevel() != 0 ) // Kapitelfelder aktualisieren - b = TRUE; + b = sal_True; else if( pTNd->GetpSwpHints() && pTNd->GetSwpHints().Count() ) - for( USHORT n = 0, nEnd = pTNd->GetSwpHints().Count(); + for( sal_uInt16 n = 0, nEnd = pTNd->GetSwpHints().Count(); n < nEnd; ++n ) { const SwTxtAttr* pAttr = pTNd->GetSwpHints()[ n ]; if( RES_TXTATR_FIELD == pAttr->Which() ) { - b = TRUE; + b = sal_True; break; } } @@ -2155,9 +2157,9 @@ bool SwDoc::SetFieldsDirty( bool b, const SwNode* pChk, ULONG nLen ) void SwDoc::ChangeAuthorityData( const SwAuthEntry* pNewData ) { - const USHORT nSize = pFldTypes->Count(); + const sal_uInt16 nSize = pFldTypes->Count(); - for( USHORT i = INIT_FLDTYPES; i < nSize; ++i ) + for( sal_uInt16 i = INIT_FLDTYPES; i < nSize; ++i ) { SwFieldType* pFldType = (*pFldTypes)[i]; if( RES_AUTHORITY == pFldType->Which() ) @@ -2170,9 +2172,9 @@ void SwDoc::ChangeAuthorityData( const SwAuthEntry* pNewData ) } -void SwDocUpdtFld::InsDelFldInFldLst( BOOL bIns, const SwTxtFld& rFld ) +void SwDocUpdtFld::InsDelFldInFldLst( sal_Bool bIns, const SwTxtFld& rFld ) { - USHORT nWhich = rFld.GetFld().GetFld()->GetTyp()->Which(); + sal_uInt16 nWhich = rFld.GetFld().GetFld()->GetTyp()->Which(); switch( nWhich ) { case RES_DBFLD: @@ -2189,7 +2191,7 @@ void SwDocUpdtFld::InsDelFldInFldLst( BOOL bIns, const SwTxtFld& rFld ) return; } - SetFieldsDirty( TRUE ); + SetFieldsDirty( sal_True ); if( !pFldSortLst ) { if( !bIns ) // keine Liste vorhanden und loeschen @@ -2204,7 +2206,7 @@ void SwDocUpdtFld::InsDelFldInFldLst( BOOL bIns, const SwTxtFld& rFld ) // ueber den pTxtFld Pointer suchen. Ist zwar eine Sortierte // Liste, aber nach Node-Positionen sortiert. Bis dieser // bestimmt ist, ist das Suchen nach dem Pointer schon fertig - for( USHORT n = 0; n < pFldSortLst->Count(); ++n ) + for( sal_uInt16 n = 0; n < pFldSortLst->Count(); ++n ) if( &rFld == (*pFldSortLst)[ n ]->GetPointer() ) pFldSortLst->DeleteAndDestroy( n--, 1 ); // ein Feld kann mehrfach vorhanden sein! @@ -2247,18 +2249,17 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) SvULongs aTmpArr; SwSectionFmts& rArr = rDoc.GetSections(); SwSectionNode* pSectNd; - USHORT nArrStt = 0; - ULONG nSttCntnt = rDoc.GetNodes().GetEndOfExtras().GetIndex(); - USHORT n; + sal_uInt16 nArrStt = 0; + sal_uLong nSttCntnt = rDoc.GetNodes().GetEndOfExtras().GetIndex(); - for( n = rArr.Count(); n; ) + for (sal_uInt16 n = rArr.Count(); n; ) { SwSection* pSect = rArr[ --n ]->GetSection(); if( pSect && pSect->IsHidden() && pSect->GetCondition().Len() && 0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() )) { - ULONG nIdx = pSectNd->GetIndex(); - USHORT i; + sal_uLong nIdx = pSectNd->GetIndex(); + sal_uInt16 i; for( i = 0; i < aTmpArr.Count() && aTmpArr[ i ] < nIdx; ++i ) ; @@ -2271,37 +2272,39 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) // erst alle anzeigen, damit die Frames vorhanden sind. Mit deren // Position wird das BodyAnchor ermittelt. // Dafuer erst den ContentBereich, dann die Sonderbereiche!!! - for( n = nArrStt; n < aTmpArr.Count(); ++n ) + for (sal_uInt16 n = nArrStt; n < aTmpArr.Count(); ++n) { pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode(); OSL_ENSURE( pSectNd, "Wo ist mein SectionNode" ); - pSectNd->GetSection().SetCondHidden( FALSE ); + pSectNd->GetSection().SetCondHidden( sal_False ); } - for( n = 0; n < nArrStt; ++n ) + for (sal_uInt16 n = 0; n < nArrStt; ++n) { pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode(); OSL_ENSURE( pSectNd, "Wo ist mein SectionNode" ); - pSectNd->GetSection().SetCondHidden( FALSE ); + pSectNd->GetSection().SetCondHidden( sal_False ); } // so, erst jetzt alle sortiert in die Liste eintragen - for( n = 0; n < aTmpArr.Count(); ++n ) + for (sal_uInt16 n = 0; n < aTmpArr.Count(); ++n) + { GetBodyNode( *rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode() ); + } } String sTrue( String::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "TRUE" ))), + RTL_CONSTASCII_STRINGPARAM( "sal_True" ))), sFalse( String::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "FALSE" ))); + RTL_CONSTASCII_STRINGPARAM( "sal_False" ))); - BOOL bIsDBMgr = 0 != rDoc.GetNewDBMgr(); - USHORT nWhich, n; + sal_Bool bIsDBMgr = 0 != rDoc.GetNewDBMgr(); + sal_uInt16 nWhich, n; const String* pFormel = 0; const SfxPoolItem* pItem; - USHORT nMaxItems = rDoc.GetAttrPool().GetItemCount( RES_TXTATR_FIELD ); + sal_uInt32 nMaxItems = rDoc.GetAttrPool().GetItemCount2( RES_TXTATR_FIELD ); for( n = 0; n < nMaxItems; ++n ) { - if( 0 == (pItem = rDoc.GetAttrPool().GetItem( RES_TXTATR_FIELD, n )) ) + if( 0 == (pItem = rDoc.GetAttrPool().GetItem2( RES_TXTATR_FIELD, n )) ) continue; const SwFmtFld* pFmtFld = (SwFmtFld*)pItem; @@ -2336,9 +2339,9 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) { pFormel = &pFld->GetPar1(); if( !pFormel->Len() || pFormel->Equals( sFalse )) - ((SwHiddenParaField*)pFld)->SetHidden( FALSE ); + ((SwHiddenParaField*)pFld)->SetHidden( sal_False ); else if( pFormel->Equals( sTrue )) - ((SwHiddenParaField*)pFld)->SetHidden( TRUE ); + ((SwHiddenParaField*)pFld)->SetHidden( sal_True ); else break; @@ -2353,9 +2356,9 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) { pFormel = &pFld->GetPar1(); if( !pFormel->Len() || pFormel->Equals( sFalse )) - ((SwHiddenTxtField*)pFld)->SetValue( TRUE ); + ((SwHiddenTxtField*)pFld)->SetValue( sal_True ); else if( pFormel->Equals( sTrue )) - ((SwHiddenTxtField*)pFld)->SetValue( FALSE ); + ((SwHiddenTxtField*)pFld)->SetValue( sal_False ); else break; @@ -2402,21 +2405,21 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) pFormel = 0; } } - nFldLstGetMode = static_cast<BYTE>( eGetMode ); + nFldLstGetMode = static_cast<sal_uInt8>( eGetMode ); nNodes = rDoc.GetNodes().Count(); } -void SwDocUpdtFld::GetBodyNode( const SwTxtFld& rTFld, USHORT nFldWhich ) +void SwDocUpdtFld::GetBodyNode( const SwTxtFld& rTFld, sal_uInt16 nFldWhich ) { const SwTxtNode& rTxtNd = rTFld.GetTxtNode(); const SwDoc& rDoc = *rTxtNd.GetDoc(); // immer den ersten !! (in Tab-Headline, Kopf-/Fuss ) Point aPt; - const SwCntntFrm* pFrm = rTxtNd.GetFrm( &aPt, 0, FALSE ); + const SwCntntFrm* pFrm = rTxtNd.GetFrm( &aPt, 0, sal_False ); _SetGetExpFld* pNew = NULL; - BOOL bIsInBody = FALSE; + sal_Bool bIsInBody = sal_False; if( !pFrm || pFrm->IsInDocBody() ) { @@ -2479,7 +2482,7 @@ void SwDocUpdtFld::GetBodyNode( const SwSectionNode& rSectNd ) // immer den ersten !! (in Tab-Headline, Kopf-/Fuss ) Point aPt; - const SwCntntFrm* pFrm = pCNd->GetFrm( &aPt, 0, FALSE ); + const SwCntntFrm* pFrm = pCNd->GetFrm( &aPt, 0, sal_False ); if( !pFrm ) break; @@ -2490,7 +2493,7 @@ void SwDocUpdtFld::GetBodyNode( const SwSectionNode& rSectNd ) #endif pNew = new _SetGetExpFld( rSectNd, &aPos ); - } while( FALSE ); + } while( sal_False ); } if( !pNew ) @@ -2517,10 +2520,10 @@ void SwDocUpdtFld::InsertFldType( const SwFieldType& rType ) if( sFldName.Len() ) { - SetFieldsDirty( TRUE ); + SetFieldsDirty( sal_True ); // suchen und aus der HashTabelle entfernen GetAppCharClass().toLower( sFldName ); - USHORT n; + sal_uInt16 n; SwHash* pFnd = Find( sFldName, GetFldTypeTable(), TBLSZ, &n ); @@ -2548,10 +2551,10 @@ void SwDocUpdtFld::RemoveFldType( const SwFieldType& rType ) if( sFldName.Len() ) { - SetFieldsDirty( TRUE ); + SetFieldsDirty( sal_True ); // suchen und aus der HashTabelle entfernen GetAppCharClass().toLower( sFldName ); - USHORT n; + sal_uInt16 n; SwHash* pFnd = Find( sFldName, GetFldTypeTable(), TBLSZ, &n ); if( pFnd ) @@ -2574,7 +2577,7 @@ void SwDocUpdtFld::RemoveFldType( const SwFieldType& rType ) SwDocUpdtFld::SwDocUpdtFld() : pFldSortLst(0), nFldUpdtPos(LONG_MAX), nFldLstGetMode(0) { - bInUpdateFlds = bFldsDirty = FALSE; + bInUpdateFlds = bFldsDirty = sal_False; memset( aFldTypeTable, 0, sizeof( aFldTypeTable ) ); } @@ -2582,7 +2585,7 @@ SwDocUpdtFld::~SwDocUpdtFld() { delete pFldSortLst; - for( USHORT n = 0; n < TBLSZ; ++n ) + for( sal_uInt16 n = 0; n < TBLSZ; ++n ) delete aFldTypeTable[n]; } @@ -2592,23 +2595,24 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld, { OSL_ENSURE(pDstTxtFld, "no field to update!"); - BOOL bTblSelBreak = FALSE; + sal_Bool bTblSelBreak = sal_False; SwFmtFld * pDstFmtFld = (SwFmtFld*)&pDstTxtFld->GetFld(); SwField * pDstFld = pDstFmtFld->GetFld(); - USHORT nFldWhich = rSrcFld.GetTyp()->Which(); + sal_uInt16 nFldWhich = rSrcFld.GetTyp()->Which(); SwNodeIndex aTblNdIdx(pDstTxtFld->GetTxtNode()); if (pDstFld->GetTyp()->Which() == rSrcFld.GetTyp()->Which()) { - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwPosition aPosition( pDstTxtFld->GetTxtNode() ); aPosition.nContent = *pDstTxtFld->GetStart(); - AppendUndo(new SwUndoFieldFromDoc(aPosition, *pDstFld, rSrcFld, - pMsgHnt, bUpdateFlds)); + SwUndo *const pUndo( new SwUndoFieldFromDoc( + aPosition, *pDstFld, rSrcFld, pMsgHnt, bUpdateFlds) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } SwField * pNewFld = rSrcFld.CopyField(); @@ -2637,7 +2641,7 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld, pNewFld->GetTyp()->Modify(0, &aTblUpdate); if (! bUpdateFlds) - bTblSelBreak = TRUE; + bTblSelBreak = sal_True; } } break; @@ -2664,7 +2668,7 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld, //richtig setzt SwDBField* pDBFld = (SwDBField*)pNewFld; if (pDBFld->IsInitialized()) - pDBFld->ChgValue( pDBFld->GetValue(), TRUE ); + pDBFld->ChgValue( pDBFld->GetValue(), sal_True ); pDBFld->ClearInitialized(); pDBFld->InitContent(); @@ -2685,14 +2689,18 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld, } bool SwDoc::PutValueToField(const SwPosition & rPos, - const Any& rVal, USHORT nWhich) + const Any& rVal, sal_uInt16 nWhich) { Any aOldVal; SwField * pField = GetField(rPos); - if (DoesUndo() && pField->QueryValue(aOldVal, nWhich)) - AppendUndo(new SwUndoFieldFromAPI(rPos, aOldVal, rVal, nWhich)); + if (GetIDocumentUndoRedo().DoesUndo() && + pField->QueryValue(aOldVal, nWhich)) + { + SwUndo *const pUndo(new SwUndoFieldFromAPI(rPos, aOldVal, rVal, nWhich)); + GetIDocumentUndoRedo().AppendUndo(pUndo); + } return pField->PutValue(rVal, nWhich); } diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 67b0576e8c07..68e93ed41542 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -29,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <hintids.hxx> #include <svl/itemiter.hxx> #include <svx/svdobj.hxx> @@ -44,6 +43,7 @@ #include <ndgrf.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <ndindex.hxx> #include <docary.hxx> #include <fmtcntnt.hxx> @@ -62,23 +62,24 @@ #include <swundo.hxx> #include <swtable.hxx> #include <crstate.hxx> -#include <undobj.hxx> +#include <UndoCore.hxx> +#include <UndoAttribute.hxx> #include <fmtcnct.hxx> #include <dflyobj.hxx> #include <undoflystrattr.hxx> -extern USHORT GetHtmlMode( const SwDocShell* ); +extern sal_uInt16 GetHtmlMode( const SwDocShell* ); using namespace ::com::sun::star; -USHORT SwDoc::GetFlyCount( FlyCntType eType ) const +sal_uInt16 SwDoc::GetFlyCount( FlyCntType eType ) const { const SwSpzFrmFmts& rFmts = *GetSpzFrmFmts(); - USHORT nSize = rFmts.Count(); - USHORT nCount = 0; + sal_uInt16 nSize = rFmts.Count(); + sal_uInt16 nCount = 0; const SwNodeIndex* pIdx; - for ( USHORT i = 0; i < nSize; i++) + for ( sal_uInt16 i = 0; i < nSize; i++) { const SwFrmFmt* pFlyFmt = rFmts[ i ]; if( RES_FLYFRMFMT == pFlyFmt->Which() @@ -114,14 +115,14 @@ USHORT SwDoc::GetFlyCount( FlyCntType eType ) const } // If you change this, also update SwXFrameEnumeration in unocoll. -SwFrmFmt* SwDoc::GetFlyNum( USHORT nIdx, FlyCntType eType ) +SwFrmFmt* SwDoc::GetFlyNum( sal_uInt16 nIdx, FlyCntType eType ) { SwSpzFrmFmts& rFmts = *GetSpzFrmFmts(); SwFrmFmt* pRetFmt = 0; - USHORT nSize = rFmts.Count(); + sal_uInt16 nSize = rFmts.Count(); const SwNodeIndex* pIdx; - USHORT nCount = 0; - for( USHORT i = 0; !pRetFmt && i < nSize; ++i ) + sal_uInt16 nCount = 0; + for( sal_uInt16 i = 0; !pRetFmt && i < nSize; ++i ) { SwFrmFmt* pFlyFmt = rFmts[ i ]; if( RES_FLYFRMFMT == pFlyFmt->Which() @@ -168,7 +169,7 @@ Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch, case FLY_AS_CHAR: if( pFlyFmt && rAnch.GetCntntAnchor() ) { - const SwFrm* pOld = ((SwFlyFrmFmt*)pFlyFmt)->GetFrm( &aRet, FALSE ); + const SwFrm* pOld = ((SwFlyFrmFmt*)pFlyFmt)->GetFrm( &aRet, sal_False ); if( pOld ) aRet = pOld->Frm().Pos(); } @@ -180,7 +181,7 @@ Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch, { const SwPosition *pPos = rAnch.GetCntntAnchor(); const SwCntntNode* pNd = pPos->nNode.GetNode().GetCntntNode(); - const SwFrm* pOld = pNd ? pNd->GetFrm( &aRet, 0, FALSE ) : 0; + const SwFrm* pOld = pNd ? pNd->GetFrm( &aRet, 0, sal_False ) : 0; if( pOld ) aRet = pOld->Frm().Pos(); } @@ -191,7 +192,7 @@ Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch, { const SwFlyFrmFmt* pFmt = (SwFlyFrmFmt*)rAnch.GetCntntAnchor()-> nNode.GetNode().GetFlyFmt(); - const SwFrm* pOld = pFmt ? pFmt->GetFrm( &aRet, FALSE ) : 0; + const SwFrm* pOld = pFmt ? pFmt->GetFrm( &aRet, sal_False ) : 0; if( pOld ) aRet = pOld->Frm().Pos(); } @@ -199,9 +200,9 @@ Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch, case FLY_AT_PAGE: { - USHORT nPgNum = rAnch.GetPageNum(); + sal_uInt16 nPgNum = rAnch.GetPageNum(); const SwPageFrm *pPage = (SwPageFrm*)rDoc.GetRootFrm()->Lower(); - for( USHORT i = 1; (i <= nPgNum) && pPage; ++i, + for( sal_uInt16 i = 1; (i <= nPgNum) && pPage; ++i, pPage = (const SwPageFrm*)pPage->GetNext() ) if( i == nPgNum ) { @@ -220,7 +221,7 @@ Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch, #define IGNOREANCHOR 1 #define DONTMAKEFRMS 2 -sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, BOOL bNewFrms ) +sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, sal_Bool bNewFrms ) { //Ankerwechsel sind fast immer in alle 'Richtungen' erlaubt. //Ausnahme: Absatz- bzw. Zeichengebundene Rahmen duerfen wenn sie in @@ -294,10 +295,10 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, BOOL bNewFrms pNd->InsertItem( aFmt, pPos->nContent.GetIndex(), 0 ); } - if( SFX_ITEM_SET != rSet.GetItemState( RES_VERT_ORIENT, FALSE, &pItem )) + if( SFX_ITEM_SET != rSet.GetItemState( RES_VERT_ORIENT, sal_False, &pItem )) { SwFmtVertOrient aOldV( rFmt.GetVertOrient() ); - BOOL bSet = TRUE; + sal_Bool bSet = sal_True; switch( aOldV.GetVertOrient() ) { case text::VertOrientation::LINE_TOP: aOldV.SetVertOrient( text::VertOrientation::TOP ); break; @@ -305,7 +306,7 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, BOOL bNewFrms case text::VertOrientation::LINE_BOTTOM: aOldV.SetVertOrient( text::VertOrientation::BOTTOM); break; case text::VertOrientation::NONE: aOldV.SetVertOrient( text::VertOrientation::CENTER); break; default: - bSet = FALSE; + bSet = sal_False; } if( bSet ) rSet.Put( aOldV ); @@ -323,7 +324,7 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, BOOL bNewFrms //Chg: Wenn sich in den Positionsattributen lediglich die //Ausrichtung veraendert (text::RelOrientation::FRAME vs. text::RelOrientation::PRTAREA), dann wird die //Position ebenfalls korrigiert. - if( SFX_ITEM_SET != rSet.GetItemState( RES_HORI_ORIENT, FALSE, &pItem )) + if( SFX_ITEM_SET != rSet.GetItemState( RES_HORI_ORIENT, sal_False, &pItem )) pItem = 0; SwFmtHoriOrient aOldH( rFmt.GetHoriOrient() ); @@ -344,7 +345,7 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, BOOL bNewFrms rSet.Put( aOldH ); } - if( SFX_ITEM_SET != rSet.GetItemState( RES_VERT_ORIENT, FALSE, &pItem )) + if( SFX_ITEM_SET != rSet.GetItemState( RES_VERT_ORIENT, sal_False, &pItem )) pItem = 0; SwFmtVertOrient aOldV( rFmt.GetVertOrient() ); @@ -376,35 +377,27 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, BOOL bNewFrms return MAKEFRMS; } -BOOL SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet ) +static bool +lcl_SetFlyFrmAttr(SwDoc & rDoc, + sal_Int8 (SwDoc::*pSetFlyFrmAnchor)(SwFrmFmt &, SfxItemSet &, sal_Bool), + SwFrmFmt & rFlyFmt, SfxItemSet & rSet) { - if( !rSet.Count() ) - return FALSE; - - ::std::auto_ptr<SwUndoFmtAttrHelper> pSaveUndo; - const bool bDoesUndo = DoesUndo(); - - if( DoesUndo() ) - { - ClearRedo(); - pSaveUndo.reset( new SwUndoFmtAttrHelper( rFlyFmt ) ); - // --> FME 2004-10-13 #i32968# - // Inserting columns in the frame causes MakeFrmFmt to put two - // objects of type SwUndoFrmFmt on the undo stack. We don't want them. - DoUndo( FALSE ); - // <-- - } + // #i32968# Inserting columns in the frame causes MakeFrmFmt to put two + // objects of type SwUndoFrmFmt on the undo stack. We don't want them. + ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); //Ist das Ankerattribut dabei? Falls ja ueberlassen wir die Verarbeitung - //desselben einer Spezialmethode. Sie Returnt TRUE wenn der Fly neu + //desselben einer Spezialmethode. Sie Returnt sal_True wenn der Fly neu //erzeugt werden muss (z.B. weil ein Wechsel des FlyTyps vorliegt). - sal_Int8 nMakeFrms = SFX_ITEM_SET == rSet.GetItemState( RES_ANCHOR, FALSE )? - SetFlyFrmAnchor( rFlyFmt, rSet, FALSE ) : DONTMAKEFRMS; + sal_Int8 const nMakeFrms = + (SFX_ITEM_SET == rSet.GetItemState( RES_ANCHOR, sal_False )) + ? (rDoc.*pSetFlyFrmAnchor)( rFlyFmt, rSet, sal_False ) + : DONTMAKEFRMS; const SfxPoolItem* pItem; SfxItemIter aIter( rSet ); - SfxItemSet aTmpSet( GetAttrPool(), aFrmFmtSetRange ); - USHORT nWhich = aIter.GetCurItem()->Which(); + SfxItemSet aTmpSet( rDoc.GetAttrPool(), aFrmFmtSetRange ); + sal_uInt16 nWhich = aIter.GetCurItem()->Which(); do { switch( nWhich ) { @@ -424,7 +417,7 @@ BOOL SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet ) default: if( !IsInvalidItem( aIter.GetCurItem() ) && ( SFX_ITEM_SET != - rFlyFmt.GetAttrSet().GetItemState( nWhich, TRUE, &pItem ) || + rFlyFmt.GetAttrSet().GetItemState( nWhich, sal_True, &pItem ) || *pItem != *aIter.GetCurItem() )) aTmpSet.Put( *aIter.GetCurItem() ); break; @@ -441,21 +434,36 @@ BOOL SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet ) if( MAKEFRMS == nMakeFrms ) rFlyFmt.MakeFrms(); - if ( pSaveUndo.get() ) + return aTmpSet.Count() || MAKEFRMS == nMakeFrms; +} + +sal_Bool SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet ) +{ + if( !rSet.Count() ) + return sal_False; + + ::std::auto_ptr<SwUndoFmtAttrHelper> pSaveUndo; + + if (GetIDocumentUndoRedo().DoesUndo()) { - // --> FME 2004-10-13 #i32968# - DoUndo( bDoesUndo ); - // <-- + GetIDocumentUndoRedo().ClearRedo(); // AppendUndo far below, so leave it + pSaveUndo.reset( new SwUndoFmtAttrHelper( rFlyFmt ) ); + } + + bool const bRet = + lcl_SetFlyFrmAttr(*this, &SwDoc::SetFlyFrmAnchor, rFlyFmt, rSet); + if ( pSaveUndo.get() ) + { if ( pSaveUndo->GetUndo() ) { - AppendUndo( pSaveUndo->ReleaseUndo() ); + GetIDocumentUndoRedo().AppendUndo( pSaveUndo->ReleaseUndo() ); } } SetModified(); - return aTmpSet.Count() || MAKEFRMS == nMakeFrms; + return bRet; } // #i73249# @@ -467,13 +475,11 @@ void SwDoc::SetFlyFrmTitle( SwFlyFrmFmt& rFlyFrmFmt, return; } - const bool bFormerIsNoDrawUndoObj( IsNoDrawUndoObj() ); - SetNoDrawUndoObj( true ); + ::sw::DrawUndoGuard const drawUndoGuard(GetIDocumentUndoRedo()); - if ( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt, + GetIDocumentUndoRedo().AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt, UNDO_FLYFRMFMT_TITLE, rFlyFrmFmt.GetObjTitle(), sNewTitle ) ); @@ -481,8 +487,6 @@ void SwDoc::SetFlyFrmTitle( SwFlyFrmFmt& rFlyFrmFmt, rFlyFrmFmt.SetObjTitle( sNewTitle, true ); - SetNoDrawUndoObj( bFormerIsNoDrawUndoObj ); - SetModified(); } @@ -494,13 +498,11 @@ void SwDoc::SetFlyFrmDescription( SwFlyFrmFmt& rFlyFrmFmt, return; } - const bool bFormerIsNoDrawUndoObj( IsNoDrawUndoObj() ); - SetNoDrawUndoObj( true ); + ::sw::DrawUndoGuard const drawUndoGuard(GetIDocumentUndoRedo()); - if ( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt, + GetIDocumentUndoRedo().AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt, UNDO_FLYFRMFMT_DESCRIPTION, rFlyFrmFmt.GetObjDescription(), sNewDescription ) ); @@ -508,36 +510,34 @@ void SwDoc::SetFlyFrmDescription( SwFlyFrmFmt& rFlyFrmFmt, rFlyFrmFmt.SetObjDescription( sNewDescription, true ); - SetNoDrawUndoObj( bFormerIsNoDrawUndoObj ); - SetModified(); } /*************************************************************************** - * Methode : BOOL SwDoc::SetFrmFmtToFly( SwFlyFrm&, SwFrmFmt& ) + * Methode : sal_Bool SwDoc::SetFrmFmtToFly( SwFlyFrm&, SwFrmFmt& ) * Beschreibung: ***************************************************************************/ -BOOL SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, - SfxItemSet* pSet, BOOL bKeepOrient ) +sal_Bool SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, + SfxItemSet* pSet, sal_Bool bKeepOrient ) { - BOOL bChgAnchor = FALSE, bFrmSz = FALSE; + sal_Bool bChgAnchor = sal_False, bFrmSz = sal_False; const SwFmtFrmSize aFrmSz( rFmt.GetFrmSize() ); const SwFmtVertOrient aVert( rFmt.GetVertOrient() ); const SwFmtHoriOrient aHori( rFmt.GetHoriOrient() ); SwUndoSetFlyFmt* pUndo = 0; - if( DoesUndo() ) + bool const bUndo = GetIDocumentUndoRedo().DoesUndo(); + if (bUndo) { - ClearRedo(); - AppendUndo( pUndo = new SwUndoSetFlyFmt( rFmt, rNewFmt ) ); - // --> FME 2004-10-13 #i32968# - // Inserting columns in the section causes MakeFrmFmt to put two - // objects of type SwUndoFrmFmt on the undo stack. We don't want them. - DoUndo( FALSE ); - // <-- + pUndo = new SwUndoSetFlyFmt( rFmt, rNewFmt ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } + // #i32968# Inserting columns in the section causes MakeFrmFmt to put + // 2 objects of type SwUndoFrmFmt on the undo stack. We don't want them. + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); + //Erstmal die Spalten setzen, sonst gibts nix als Aerger mit dem //Set/Reset/Abgleich usw. const SfxPoolItem* pItem; @@ -550,20 +550,20 @@ BOOL SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, // 1. wenn nicht automatisch -> ignorieren, sonst -> wech // 2. wech damit, MB! - if( SFX_ITEM_SET == rNewFmt.GetAttrSet().GetItemState( RES_FRM_SIZE, FALSE )) + if( SFX_ITEM_SET == rNewFmt.GetAttrSet().GetItemState( RES_FRM_SIZE, sal_False )) { rFmt.ResetFmtAttr( RES_FRM_SIZE ); - bFrmSz = TRUE; + bFrmSz = sal_True; } const SfxItemSet* pAsk = pSet; if( !pAsk ) pAsk = &rNewFmt.GetAttrSet(); - if( SFX_ITEM_SET == pAsk->GetItemState( RES_ANCHOR, FALSE, &pItem ) + if( SFX_ITEM_SET == pAsk->GetItemState( RES_ANCHOR, sal_False, &pItem ) && ((SwFmtAnchor*)pItem)->GetAnchorId() != rFmt.GetAnchor().GetAnchorId() ) { if( pSet ) - bChgAnchor = MAKEFRMS == SetFlyFrmAnchor( rFmt, *pSet, FALSE ); + bChgAnchor = MAKEFRMS == SetFlyFrmAnchor( rFmt, *pSet, sal_False ); else { //JP 23.04.98: muss den FlyFmt-Range haben, denn im SetFlyFrmAnchor @@ -571,7 +571,7 @@ BOOL SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, SfxItemSet aFlySet( *rNewFmt.GetAttrSet().GetPool(), rNewFmt.GetAttrSet().GetRanges() ); aFlySet.Put( *pItem ); - bChgAnchor = MAKEFRMS == SetFlyFrmAnchor( rFmt, aFlySet, FALSE); + bChgAnchor = MAKEFRMS == SetFlyFrmAnchor( rFmt, aFlySet, sal_False); } } } @@ -604,11 +604,6 @@ BOOL SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, SetModified(); - // --> FME 2004-10-13 #i32968# - if ( pUndo ) - DoUndo( TRUE ); - // <-- - return bChgAnchor; } @@ -639,10 +634,10 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, return false; } - StartUndo( UNDO_INSATTR, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_INSATTR, NULL ); - BOOL bUnmark = FALSE; - for ( USHORT i = 0; i < _rMrkList.GetMarkCount(); ++i ) + sal_Bool bUnmark = sal_False; + for ( sal_uInt16 i = 0; i < _rMrkList.GetMarkCount(); ++i ) { SdrObject* pObj = _rMrkList.GetMark( i )->GetMarkedSdrObj(); if ( !pObj->ISA(SwVirtFlyDrawObj) ) @@ -731,7 +726,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, // consider that drawing objects can be in // header/footer. Thus, <GetFrm()> by left-top-corner pTxtFrm = aPos.nNode.GetNode(). - GetCntntNode()->GetFrm( &aPt, 0, FALSE ); + GetCntntNode()->GetFrm( &aPt, 0, sal_False ); } const SwFrm *pTmp = ::FindAnchor( pTxtFrm, aPt ); pNewAnchorFrm = pTmp->FindFlyFrm(); @@ -867,7 +862,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, } } - EndUndo( UNDO_END, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); SetModified(); return bUnmark; @@ -909,16 +904,16 @@ int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest ) if( !pTxtNd ) return SW_CHAIN_NOT_FOUND; - const ULONG nFlySttNd = pCntIdx->GetIndex(); + const sal_uLong nFlySttNd = pCntIdx->GetIndex(); if( 2 != ( pCntIdx->GetNode().EndOfSectionIndex() - nFlySttNd ) || pTxtNd->GetTxt().Len() ) return SW_CHAIN_NOT_EMPTY; - USHORT nArrLen = GetSpzFrmFmts()->Count(); - for( USHORT n = 0; n < nArrLen; ++n ) + sal_uInt16 nArrLen = GetSpzFrmFmts()->Count(); + for( sal_uInt16 n = 0; n < nArrLen; ++n ) { const SwFmtAnchor& rAnchor = (*GetSpzFrmFmts())[ n ]->GetAnchor(); - ULONG nTstSttNd; + sal_uLong nTstSttNd; // #i20622# - to-frame anchored objects are allowed. if ( ((rAnchor.GetAnchorId() == FLY_AT_PARA) || (rAnchor.GetAnchorId() == FLY_AT_CHAR)) && @@ -940,14 +935,14 @@ int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest ) // both in the same fly, header, footer or on the page? const SwFmtAnchor &rSrcAnchor = rSource.GetAnchor(), &rDstAnchor = rDest.GetAnchor(); - ULONG nEndOfExtras = GetNodes().GetEndOfExtras().GetIndex(); - BOOL bAllowed = FALSE; + sal_uLong nEndOfExtras = GetNodes().GetEndOfExtras().GetIndex(); + sal_Bool bAllowed = sal_False; if ( FLY_AT_PAGE == rSrcAnchor.GetAnchorId() ) { if ( (FLY_AT_PAGE == rDstAnchor.GetAnchorId()) || ( rDstAnchor.GetCntntAnchor() && rDstAnchor.GetCntntAnchor()->nNode.GetIndex() > nEndOfExtras )) - bAllowed = TRUE; + bAllowed = sal_True; } else if( rSrcAnchor.GetCntntAnchor() && rDstAnchor.GetCntntAnchor() ) { @@ -966,7 +961,7 @@ int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest ) pSttNd == rDstIdx.GetNode().FindHeaderStartNode() ) || ( !pSttNd && rDstIdx.GetIndex() > nEndOfExtras && rSrcIdx.GetIndex() > nEndOfExtras )) - bAllowed = TRUE; + bAllowed = sal_True; } return bAllowed ? SW_CHAIN_OK : SW_CHAIN_WRONG_AREA; @@ -977,7 +972,7 @@ int SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ) int nErr = Chainable( rSource, rDest ); if ( !nErr ) { - StartUndo( UNDO_CHAINE, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_CHAINE, NULL ); SwFlyFrmFmt& rDestFmt = (SwFlyFrmFmt&)rDest; @@ -1011,7 +1006,7 @@ int SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ) } SetAttr( aSet, rSource ); - EndUndo( UNDO_CHAINE, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_CHAINE, NULL ); } return nErr; } @@ -1021,14 +1016,14 @@ void SwDoc::Unchain( SwFrmFmt &rFmt ) SwFmtChain aChain( rFmt.GetChain() ); if ( aChain.GetNext() ) { - StartUndo( UNDO_UNCHAIN, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_UNCHAIN, NULL ); SwFrmFmt *pFollow = aChain.GetNext(); aChain.SetNext( 0 ); SetAttr( aChain, rFmt ); aChain = pFollow->GetChain(); aChain.SetPrev( 0 ); SetAttr( aChain, *pFollow ); - EndUndo( UNDO_UNCHAIN, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_UNCHAIN, NULL ); } } diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 8bb37e8dbee0..b1aed2bfa726 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -54,12 +54,14 @@ #include <fmtcntnt.hxx> #include <frmatr.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <hints.hxx> // fuer SwHyphenBug (in SetDefault) #include <ndtxt.hxx> #include <pam.hxx> -#include <undobj.hxx> +#include <UndoCore.hxx> +#include <UndoAttribute.hxx> #include <ndgrf.hxx> #include <pagedesc.hxx> // Fuer Sonderbehandlung in InsFrmFmt #include <rolbck.hxx> // Undo-Attr @@ -95,14 +97,14 @@ SV_IMPL_PTRARR(SwSpzFrmFmts,SwFrmFmtPtr) * interne Funktionen */ -BOOL SetTxtFmtCollNext( const SwTxtFmtCollPtr& rpTxtColl, void* pArgs ) +sal_Bool SetTxtFmtCollNext( const SwTxtFmtCollPtr& rpTxtColl, void* pArgs ) { SwTxtFmtColl *pDel = (SwTxtFmtColl*) pArgs; if ( &rpTxtColl->GetNextTxtFmtColl() == pDel ) { rpTxtColl->SetNextTxtFmtColl( *rpTxtColl ); } - return TRUE; + return sal_True; } /* @@ -116,7 +118,7 @@ struct ParaRstFmt SwHistory* pHistory; const SwPosition *pSttNd, *pEndNd; const SfxItemSet* pDelSet; - USHORT nWhich; + sal_uInt16 nWhich; bool bReset; bool bResetListAttrs; // #i62575# bool bResetAll; @@ -125,7 +127,7 @@ struct ParaRstFmt bool bKeepOutlineLevelAttr; ParaRstFmt( const SwPosition* pStt, const SwPosition* pEnd, - SwHistory* pHst, USHORT nWhch = 0, const SfxItemSet* pSet = 0 ) + SwHistory* pHst, sal_uInt16 nWhch = 0, const SfxItemSet* pSet = 0 ) : pFmtColl(0), pHistory(pHst), pSttNd(pStt), @@ -158,14 +160,14 @@ struct ParaRstFmt * (wird bei Selectionen am Start/Ende und bei keiner SSelection benoetigt) */ -BOOL lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs ) +sal_Bool lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs ) { ParaRstFmt* pPara = (ParaRstFmt*)pArgs; SwTxtNode * pTxtNode = (SwTxtNode*)rpNd->GetTxtNode(); if( pTxtNode && pTxtNode->GetpSwpHints() ) { SwIndex aSt( pTxtNode, 0 ); - USHORT nEnd = pTxtNode->Len(); + sal_uInt16 nEnd = pTxtNode->Len(); if( &pPara->pSttNd->nNode.GetNode() == pTxtNode && pPara->pSttNd->nContent.GetIndex() ) @@ -188,16 +190,16 @@ BOOL lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs ) pTxtNode->RstAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich, pPara->pDelSet, pPara->bInclRefToxMark ); } - return TRUE; + return sal_True; } -BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) +sal_Bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) { ParaRstFmt* pPara = (ParaRstFmt*)pArgs; SwCntntNode* pNode = (SwCntntNode*)rpNd->GetCntntNode(); if( pNode && pNode->HasSwAttrSet() ) { - const BOOL bLocked = pNode->IsModifyLocked(); + const sal_Bool bLocked = pNode->IsModifyLocked(); pNode->LockModify(); SwDoc* pDoc = pNode->GetDoc(); @@ -234,12 +236,12 @@ BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) const SfxPoolItem* pItem; - USHORT const aSavIds[ 4 ] = { RES_PAGEDESC, RES_BREAK, //->add by zhaojianwei + sal_uInt16 const aSavIds[ 4 ] = { RES_PAGEDESC, RES_BREAK, //->add by zhaojianwei RES_PARATR_NUMRULE, RES_PARATR_OUTLINELEVEL }; - for( USHORT n = 0; n < 4; ++n ) //<-end,zhaojianwei + for( sal_uInt16 n = 0; n < 4; ++n ) //<-end,zhaojianwei { - if( SFX_ITEM_SET == pSet->GetItemState( aSavIds[ n ], FALSE, &pItem )) + if( SFX_ITEM_SET == pSet->GetItemState( aSavIds[ n ], sal_False, &pItem )) { bool bSave = false; switch( aSavIds[ n ] ) @@ -291,12 +293,12 @@ BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) "<lcl_RstAttr(..)> - certain attributes are kept, but not needed. -> please inform OD" ); SfxItemIter aIter( *pPara->pDelSet ); pItem = aIter.FirstItem(); - while( TRUE ) + while( sal_True ) { if ( ( pItem->Which() != RES_PAGEDESC && pItem->Which() != RES_BREAK && pItem->Which() != RES_PARATR_NUMRULE ) || - ( aSet.GetItemState( pItem->Which(), FALSE ) != SFX_ITEM_SET ) ) + ( aSet.GetItemState( pItem->Which(), sal_False ) != SFX_ITEM_SET ) ) { pNode->ResetAttr( pItem->Which() ); } @@ -324,37 +326,36 @@ BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) pNode->UnlockModify(); } } - return TRUE; + return sal_True; } -void SwDoc::RstTxtAttrs(const SwPaM &rRg, BOOL bInclRefToxMark ) +void SwDoc::RstTxtAttrs(const SwPaM &rRg, sal_Bool bInclRefToxMark ) { SwHistory* pHst = 0; SwDataChanged aTmp( rRg, 0 ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg, RES_CHRFMT ); pHst = &pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End(); ParaRstFmt aPara( pStt, pEnd, pHst ); - aPara.bInclRefToxMark = ( bInclRefToxMark == TRUE ); + aPara.bInclRefToxMark = ( bInclRefToxMark == sal_True ); GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1, lcl_RstTxtAttr, &aPara ); SetModified(); } void SwDoc::ResetAttrs( const SwPaM &rRg, - BOOL bTxtAttr, + sal_Bool bTxtAttr, const SvUShortsSort* pAttrs, const bool bSendDataChangedEvents ) { SwPaM* pPam = (SwPaM*)&rRg; if( !bTxtAttr && pAttrs && pAttrs->Count() && RES_TXTATR_END > (*pAttrs)[ 0 ] ) - bTxtAttr = TRUE; + bTxtAttr = sal_True; if( !rRg.HasMark() ) { @@ -365,7 +366,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, pPam = new SwPaM( *rRg.GetPoint() ); SwIndex& rSt = pPam->GetPoint()->nContent; - USHORT nMkPos, nPtPos = rSt.GetIndex(); + sal_uInt16 nMkPos, nPtPos = rSt.GetIndex(); // JP 22.08.96: Sonderfall: steht der Crsr in einem URL-Attribut // dann wird dessen Bereich genommen @@ -384,7 +385,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, pTxtNd->GetTxt(), nPtPos, pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ), WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/, - TRUE ); + sal_True ); if( aBndry.startPos < nPtPos && nPtPos < aBndry.endPos ) { @@ -395,7 +396,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, { nPtPos = nMkPos = rSt.GetIndex(); if( bTxtAttr ) - pTxtNd->DontExpandFmt( rSt, TRUE ); + pTxtNd->DontExpandFmt( rSt, sal_True ); } } @@ -412,24 +413,23 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, pDataChanged.reset( new SwDataChanged( *pPam, 0 ) ); } SwHistory* pHst = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg, - static_cast<USHORT>(bTxtAttr ? RES_CONDTXTFMTCOLL : RES_TXTFMTCOLL )); + static_cast<sal_uInt16>(bTxtAttr ? RES_CONDTXTFMTCOLL : RES_TXTFMTCOLL )); if( pAttrs && pAttrs->Count() ) { pUndo->SetAttrs( *pAttrs ); } pHst = &pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } const SwPosition *pStt = pPam->Start(), *pEnd = pPam->End(); ParaRstFmt aPara( pStt, pEnd, pHst ); // mst: not including META here; it seems attrs with CH_TXTATR are omitted - USHORT aResetableSetRange[] = { + sal_uInt16 aResetableSetRange[] = { RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_PARATR_BEGIN, RES_PARATR_END-1, @@ -445,7 +445,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, SfxItemSet aDelSet( GetAttrPool(), aResetableSetRange ); if( pAttrs && pAttrs->Count() ) { - for( USHORT n = pAttrs->Count(); n; ) + for( sal_uInt16 n = pAttrs->Count(); n; ) if( POOLATTR_END > (*pAttrs)[ --n ] ) aDelSet.Put( *GetDfltAttr( (*pAttrs)[ n ] )); @@ -453,7 +453,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, aPara.pDelSet = &aDelSet; } - BOOL bAdd = TRUE; + sal_Bool bAdd = sal_True; SwNodeIndex aTmpStt( pStt->nNode ); SwNodeIndex aTmpEnd( pEnd->nNode ); if( pStt->nContent.GetIndex() ) // nur ein Teil @@ -466,7 +466,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, const SfxPoolItem* pItem = aIter.GetCurItem(); SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END ); - while( TRUE ) + while( sal_True ) { if( IsInRange( aCharFmtSetRange, pItem->Which() )) { @@ -508,7 +508,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, } if( pEnd->nContent.GetIndex() == pEnd->nNode.GetNode().GetCntntNode()->Len() ) // dann spaeter aufsetzen und alle CharFmtAttr -> TxtFmtAttr - aTmpEnd++, bAdd = FALSE; + aTmpEnd++, bAdd = sal_False; else if( pStt->nNode != pEnd->nNode || !pStt->nContent.GetIndex() ) { SwTxtNode* pTNd = aTmpEnd.GetNode().GetTxtNode(); @@ -516,7 +516,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, { SfxItemIter aIter( *pTNd->GetpSwAttrSet() ); const SfxPoolItem* pItem = aIter.GetCurItem(); - while( TRUE ) + while( sal_True ) { if( IsInRange( aCharFmtSetRange, pItem->Which() )) { @@ -584,7 +584,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, { SfxItemIter aIter( rChgSet ); const SfxPoolItem* pItem = aIter.FirstItem(); - const USHORT nWhich = pItem->Which(); + const sal_uInt16 nWhich = pItem->Which(); if ( isCHRATR(nWhich) || (RES_TXTATR_CHARFMT == nWhich) || @@ -659,7 +659,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, return false; } - SwNumFmt aNumFmt = pNumRule->Get(static_cast<USHORT>(pTxtNd->GetActualListLevel())); + SwNumFmt aNumFmt = pNumRule->Get(static_cast<sal_uInt16>(pTxtNd->GetActualListLevel())); SwCharFmt * pCharFmt = pDoc->FindCharFmtByName(aNumFmt.GetCharFmtName()); @@ -697,7 +697,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, pStt->nNode, pStt->nContent.GetIndex() ); if( pUndo ) - pUndo->SaveRedlineData( aPam, TRUE ); + pUndo->SaveRedlineData( aPam, sal_True ); if( pDoc->IsRedlineOn() ) pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true); @@ -722,8 +722,8 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, aTxtSet.Put( rChgSet ); if( aTxtSet.Count() ) { - USHORT nInsCnt = rSt.GetIndex(); - USHORT nEnd = pStt->nNode == pEnd->nNode + sal_uInt16 nInsCnt = rSt.GetIndex(); + sal_uInt16 nEnd = pStt->nNode == pEnd->nNode ? pEnd->nContent.GetIndex() : pNode->Len(); SwRegHistory history( pNode, *pNode, pHistory ); @@ -734,7 +734,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, && pDoc->GetRedlineTbl().Count()))) { // wurde Text-Inhalt eingefuegt? (RefMark/TOXMarks ohne Ende) - BOOL bTxtIns = nInsCnt != rSt.GetIndex(); + sal_Bool bTxtIns = nInsCnt != rSt.GetIndex(); // wurde Inhalt eingefuegt oder ueber die Selektion gesetzt? SwPaM aPam( pStt->nNode, bTxtIns ? nInsCnt + 1 : nEnd, pStt->nNode, nInsCnt ); @@ -758,7 +758,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, SwTableNode* pTblNd; const SwFmtPageDesc* pDesc; if( SFX_ITEM_SET == pOtherSet->GetItemState( RES_PAGEDESC, - FALSE, (const SfxPoolItem**)&pDesc )) + sal_False, (const SfxPoolItem**)&pDesc )) { if( pNode ) { @@ -807,7 +807,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, if( pNode && 0 == (nFlags & nsSetAttrMode::SETATTR_APICALL) && 0 != (pTblNd = pNode->FindTableNode() ) && SFX_ITEM_SET == pOtherSet->GetItemState( RES_BREAK, - FALSE, (const SfxPoolItem**)&pBreak ) ) + sal_False, (const SfxPoolItem**)&pBreak ) ) { SwTableNode* pCurTblNd = pTblNd; while ( 0 != ( pCurTblNd = pCurTblNd->StartOfSectionNode()->FindTableNode() ) ) @@ -836,9 +836,9 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, { // wenns eine PoolNumRule ist, diese ggfs. anlegen const SwNumRuleItem* pRule; - USHORT nPoolId; + sal_uInt16 nPoolId; if( SFX_ITEM_SET == pOtherSet->GetItemState( RES_PARATR_NUMRULE, - FALSE, (const SfxPoolItem**)&pRule ) && + sal_False, (const SfxPoolItem**)&pRule ) && !pDoc->FindNumRulePtr( pRule->GetValue() ) && USHRT_MAX != (nPoolId = SwStyleNameMapper::GetPoolIdFromUIName ( pRule->GetValue(), nsSwGetPoolIdFromName::GET_POOLID_NUMRULE )) ) @@ -859,7 +859,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, { SwTxtNode* pTxtNd = static_cast<SwTxtNode*>(pNode); const SwIndex& rSt = pStt->nContent; - USHORT nMkPos, nPtPos = rSt.GetIndex(); + sal_uInt16 nMkPos, nPtPos = rSt.GetIndex(); const String& rStr = pTxtNd->GetTxt(); // JP 22.08.96: Sonderfall: steht der Crsr in einem URL-Attribut @@ -879,7 +879,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, pTxtNd->GetTxt(), nPtPos, pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ), WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/, - TRUE ); + sal_True ); if( aBndry.startPos < nPtPos && nPtPos < aBndry.endPos ) { @@ -921,7 +921,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, SwPaM aPam( *pNode, nMkPos, *pNode, nPtPos ); if( pUndo ) - pUndo->SaveRedlineData( aPam, FALSE ); + pUndo->SaveRedlineData( aPam, sal_False ); pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_FORMAT, aPam ), true); } } @@ -938,12 +938,12 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, if( pDoc->IsRedlineOn() && pCharSet && pCharSet->Count() ) { if( pUndo ) - pUndo->SaveRedlineData( rRg, FALSE ); + pUndo->SaveRedlineData( rRg, sal_False ); pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_FORMAT, rRg ), true); } /* jetzt wenn Bereich */ - ULONG nNodes = 0; + sal_uLong nNodes = 0; SwNodeIndex aSt( pDoc->GetNodes() ); SwNodeIndex aEnd( pDoc->GetNodes() ); @@ -951,7 +951,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, if( pNode ) { - USHORT nLen = pNode->Len(); + sal_uInt16 nLen = pNode->Len(); if( pStt->nNode != pEnd->nNode ) aCntEnd.Assign( pNode, nLen ); @@ -998,7 +998,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, pNode = pEnd->nNode.GetNode().GetCntntNode(); if(pNode) { - USHORT nLen = pNode->Len(); + sal_uInt16 nLen = pNode->Len(); if( aCntEnd.GetIndex() != nLen ) { // the SwRegHistory inserts the attribute into the TxtNode! @@ -1038,9 +1038,9 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, pDoc->GetNodes().ForEach( aSt, aEnd, lcl_RstTxtAttr, &aPara ); } - BOOL bCreateSwpHints = pCharSet && ( - SFX_ITEM_SET == pCharSet->GetItemState( RES_TXTATR_CHARFMT, FALSE ) || - SFX_ITEM_SET == pCharSet->GetItemState( RES_TXTATR_INETFMT, FALSE ) ); + sal_Bool bCreateSwpHints = pCharSet && ( + SFX_ITEM_SET == pCharSet->GetItemState( RES_TXTATR_CHARFMT, sal_False ) || + SFX_ITEM_SET == pCharSet->GetItemState( RES_TXTATR_INETFMT, sal_False ) ); for(; aSt < aEnd; aSt++ ) { @@ -1088,9 +1088,9 @@ bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt, { SwDataChanged aTmp( rRg, 0 ); SwUndoAttr* pUndoAttr = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndoAttr = new SwUndoAttr( rRg, rHt, nFlags ); } @@ -1098,8 +1098,10 @@ bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt, aSet.Put( rHt ); bool bRet = lcl_InsAttr( this, rRg, aSet, nFlags, pUndoAttr ); - if( DoesUndo() ) - AppendUndo( pUndoAttr ); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().AppendUndo( pUndoAttr ); + } if( bRet ) SetModified(); @@ -1111,16 +1113,18 @@ bool SwDoc::InsertItemSet ( const SwPaM &rRg, const SfxItemSet &rSet, { SwDataChanged aTmp( rRg, 0 ); SwUndoAttr* pUndoAttr = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndoAttr = new SwUndoAttr( rRg, rSet, nFlags ); } bool bRet = lcl_InsAttr( this, rRg, rSet, nFlags, pUndoAttr ); - if( DoesUndo() ) - AppendUndo( pUndoAttr ); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().AppendUndo( pUndoAttr ); + } if( bRet ) SetModified(); @@ -1142,14 +1146,17 @@ void SwDoc::SetAttr( const SfxPoolItem& rAttr, SwFmt& rFmt ) // das alte in die Undo-History aufgenommen void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); SwUndoFmtAttrHelper aTmp( rFmt ); rFmt.SetFmtAttr( rSet ); if ( aTmp.GetUndo() ) { - AppendUndo( aTmp.ReleaseUndo() ); + GetIDocumentUndoRedo().AppendUndo( aTmp.ReleaseUndo() ); + } + else + { + GetIDocumentUndoRedo().ClearRedo(); } } else @@ -1159,19 +1166,21 @@ void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt ) SetModified(); } -void SwDoc::ResetAttrAtFormat( const USHORT nWhichId, +void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId, SwFmt& rChangedFormat ) { - SwUndo* pUndo = 0; - if ( DoesUndo() ) - pUndo = new SwUndoFmtResetAttr( rChangedFormat, nWhichId ); + SwUndo *const pUndo = (GetIDocumentUndoRedo().DoesUndo()) + ? new SwUndoFmtResetAttr( rChangedFormat, nWhichId ) + : 0; - const BOOL bAttrReset = rChangedFormat.ResetFmtAttr( nWhichId ); + const sal_Bool bAttrReset = rChangedFormat.ResetFmtAttr( nWhichId ); if ( bAttrReset ) { if ( pUndo ) - AppendUndo( pUndo ); + { + GetIDocumentUndoRedo().AppendUndo( pUndo ); + } SetModified(); } @@ -1188,14 +1197,14 @@ int lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth, // auf dem gleichen TabStop (gepoolt!) vorgenommen // wird. Als Modify wird ein FmtChg verschickt. - USHORT nOldCnt = rChgTabStop.Count(); + sal_uInt16 nOldCnt = rChgTabStop.Count(); if( !nOldCnt || nOldWidth == nNewWidth ) - return FALSE; + return sal_False; // suche den Anfang der Defaults SvxTabStop* pTabs = ((SvxTabStop*)rChgTabStop.GetStart()) + (nOldCnt-1); - USHORT n; + sal_uInt16 n; for( n = nOldCnt; n ; --n, --pTabs ) if( SVX_TAB_ADJUST_DEFAULT != pTabs->GetAdjustment() ) @@ -1203,7 +1212,7 @@ int lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth, ++n; if( n < nOldCnt ) // die DefTabStops loeschen rChgTabStop.Remove( n, nOldCnt - n ); - return TRUE; + return sal_True; } // Setze das Attribut als neues default Attribut in diesem Dokument. @@ -1224,12 +1233,12 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) SwAttrSet aOld( GetAttrPool(), rSet.GetRanges() ), aNew( GetAttrPool(), rSet.GetRanges() ); SfxItemIter aIter( rSet ); - USHORT nWhich; + sal_uInt16 nWhich; const SfxPoolItem* pItem = aIter.GetCurItem(); SfxItemPool* pSdrPool = GetAttrPool().GetSecondaryPool(); - while( TRUE ) + while( sal_True ) { - BOOL bCheckSdrDflt = FALSE; + sal_Bool bCheckSdrDflt = sal_False; nWhich = pItem->Which(); aOld.Put( GetAttrPool().GetDefaultItem( nWhich ) ); GetAttrPool().SetPoolDefaultItem( *pItem ); @@ -1265,7 +1274,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) // copy also the defaults if( bCheckSdrDflt ) { - USHORT nEdtWhich, nSlotId; + sal_uInt16 nEdtWhich, nSlotId; if( 0 != (nSlotId = GetAttrPool().GetSlotId( nWhich ) ) && nSlotId != nWhich && 0 != (nEdtWhich = pSdrPool->GetWhich( nSlotId )) && @@ -1285,15 +1294,14 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) if( aNew.Count() && aCallMod.GetDepends() ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoDefaultAttr( aOld ) ); + GetIDocumentUndoRedo().AppendUndo( new SwUndoDefaultAttr( aOld ) ); } const SfxPoolItem* pTmpItem; if( ( SFX_ITEM_SET == - aNew.GetItemState( RES_PARATR_TABSTOP, FALSE, &pTmpItem ) ) && + aNew.GetItemState( RES_PARATR_TABSTOP, sal_False, &pTmpItem ) ) && ((SvxTabStopItem*)pTmpItem)->Count() ) { // TabStop-Aenderungen behandeln wir erstmal anders: @@ -1305,10 +1313,10 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) SwTwips nNewWidth = (*(SvxTabStopItem*)pTmpItem)[ 0 ].GetTabPos(), nOldWidth = ((SvxTabStopItem&)aOld.Get(RES_PARATR_TABSTOP))[ 0 ].GetTabPos(); - int bChg = FALSE; - USHORT nMaxItems = GetAttrPool().GetItemCount( RES_PARATR_TABSTOP ); - for( USHORT n = 0; n < nMaxItems; ++n ) - if( 0 != (pTmpItem = GetAttrPool().GetItem( RES_PARATR_TABSTOP, n ) )) + int bChg = sal_False; + sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_PARATR_TABSTOP ); + for( sal_uInt32 n = 0; n < nMaxItems; ++n ) + if( 0 != (pTmpItem = GetAttrPool().GetItem2( RES_PARATR_TABSTOP, n ) )) bChg |= lcl_SetNewDefTabStops( nOldWidth, nNewWidth, *(SvxTabStopItem*)pTmpItem ); @@ -1339,7 +1347,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) } // Erfrage das Default Attribut in diesem Dokument. -const SfxPoolItem& SwDoc::GetDefault( USHORT nFmtHint ) const +const SfxPoolItem& SwDoc::GetDefault( sal_uInt16 nFmtHint ) const { return GetAttrPool().GetDefaultItem( nFmtHint ); } @@ -1347,7 +1355,7 @@ const SfxPoolItem& SwDoc::GetDefault( USHORT nFmtHint ) const /* * Loeschen der Formate */ -void SwDoc::DelCharFmt(USHORT nFmt, BOOL bBroadcast) +void SwDoc::DelCharFmt(sal_uInt16 nFmt, sal_Bool bBroadcast) { SwCharFmt * pDel = (*pCharFmtTbl)[nFmt]; @@ -1355,12 +1363,12 @@ void SwDoc::DelCharFmt(USHORT nFmt, BOOL bBroadcast) BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_CHAR, SFX_STYLESHEET_ERASED); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoCharFmtDelete(pDel, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } pCharFmtTbl->DeleteAndDestroy(nFmt); @@ -1368,15 +1376,15 @@ void SwDoc::DelCharFmt(USHORT nFmt, BOOL bBroadcast) SetModified(); } -void SwDoc::DelCharFmt( SwCharFmt *pFmt, BOOL bBroadcast ) +void SwDoc::DelCharFmt( SwCharFmt *pFmt, sal_Bool bBroadcast ) { - USHORT nFmt = pCharFmtTbl->GetPos( pFmt ); + sal_uInt16 nFmt = pCharFmtTbl->GetPos( pFmt ); OSL_ENSURE( USHRT_MAX != nFmt, "Fmt not found," ); DelCharFmt( nFmt, bBroadcast ); } -void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, BOOL bBroadcast ) +void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, sal_Bool bBroadcast ) { if( pFmt->ISA( SwTableBoxFmt ) || pFmt->ISA( SwTableLineFmt )) { @@ -1389,7 +1397,7 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, BOOL bBroadcast ) //Das Format muss in einem der beiden Arrays stehen, in welchem //werden wir schon merken. - USHORT nPos; + sal_uInt16 nPos; if ( USHRT_MAX != ( nPos = pFrmFmtTbl->GetPos( pFmt )) ) { if (bBroadcast) @@ -1397,11 +1405,11 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, BOOL bBroadcast ) SFX_STYLE_FAMILY_FRAME, SFX_STYLESHEET_ERASED); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoFrmFmtDelete(pFmt, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } pFrmFmtTbl->DeleteAndDestroy( nPos ); @@ -1418,7 +1426,7 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, BOOL bBroadcast ) void SwDoc::DelTblFrmFmt( SwTableFmt *pFmt ) { - USHORT nPos = pTblFrmFmtTbl->GetPos( pFmt ); + sal_uInt16 nPos = pTblFrmFmtTbl->GetPos( pFmt ); OSL_ENSURE( USHRT_MAX != nPos, "Fmt not found," ); pTblFrmFmtTbl->DeleteAndDestroy( nPos ); } @@ -1445,13 +1453,13 @@ SwDrawFrmFmt *SwDoc::MakeDrawFrmFmt( const String &rFmtName, } -USHORT SwDoc::GetTblFrmFmtCount(BOOL bUsed) const +sal_uInt16 SwDoc::GetTblFrmFmtCount(sal_Bool bUsed) const { - USHORT nCount = pTblFrmFmtTbl->Count(); + sal_uInt16 nCount = pTblFrmFmtTbl->Count(); if(bUsed) { - SwAutoFmtGetDocNode aGetHt( &aNodes ); - for ( USHORT i = nCount; i; ) + SwAutoFmtGetDocNode aGetHt( &GetNodes() ); + for ( sal_uInt16 i = nCount; i; ) { if((*pTblFrmFmtTbl)[--i]->GetInfo( aGetHt )) @@ -1463,14 +1471,13 @@ USHORT SwDoc::GetTblFrmFmtCount(BOOL bUsed) const } -SwFrmFmt& SwDoc::GetTblFrmFmt(USHORT nFmt, BOOL bUsed ) const +SwFrmFmt& SwDoc::GetTblFrmFmt(sal_uInt16 nFmt, sal_Bool bUsed ) const { - USHORT nRemoved = 0; + sal_uInt16 nRemoved = 0; if(bUsed) { - SwAutoFmtGetDocNode aGetHt( &aNodes ); - - for ( USHORT i = 0; i <= nFmt; i++ ) + SwAutoFmtGetDocNode aGetHt( &GetNodes() ); + for ( sal_uInt16 i = 0; i <= nFmt; i++ ) { while ( (*pTblFrmFmtTbl)[ i + nRemoved]->GetInfo( aGetHt )) { @@ -1493,7 +1500,7 @@ SwTableFmt* SwDoc::MakeTblFrmFmt( const String &rFmtName, SwFrmFmt *SwDoc::MakeFrmFmt(const String &rFmtName, SwFrmFmt *pDerivedFrom, - BOOL bBroadcast, BOOL bAuto) + sal_Bool bBroadcast, sal_Bool bAuto) { SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom ); @@ -1507,11 +1514,11 @@ SwFrmFmt *SwDoc::MakeFrmFmt(const String &rFmtName, BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA, SFX_STYLESHEET_CREATED); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoFrmFmtCreate(pFmt, pDerivedFrom, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } } @@ -1520,7 +1527,7 @@ SwFrmFmt *SwDoc::MakeFrmFmt(const String &rFmtName, SwFmt *SwDoc::_MakeFrmFmt(const String &rFmtName, SwFmt *pDerivedFrom, - BOOL bBroadcast, BOOL bAuto) + sal_Bool bBroadcast, sal_Bool bAuto) { SwFrmFmt *pFrmFmt = dynamic_cast<SwFrmFmt*>(pDerivedFrom); pFrmFmt = MakeFrmFmt( rFmtName, pFrmFmt, bBroadcast, bAuto ); @@ -1531,19 +1538,19 @@ SwFmt *SwDoc::_MakeFrmFmt(const String &rFmtName, // #i40550# - add parameter <bAuto> - not relevant SwCharFmt *SwDoc::MakeCharFmt( const String &rFmtName, SwCharFmt *pDerivedFrom, - BOOL bBroadcast, - BOOL ) + sal_Bool bBroadcast, + sal_Bool ) { SwCharFmt *pFmt = new SwCharFmt( GetAttrPool(), rFmtName, pDerivedFrom ); pCharFmtTbl->Insert( pFmt, pCharFmtTbl->Count() ); - pFmt->SetAuto( FALSE ); + pFmt->SetAuto( sal_False ); SetModified(); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoCharFmtCreate(pFmt, pDerivedFrom, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if (bBroadcast) @@ -1557,7 +1564,7 @@ SwCharFmt *SwDoc::MakeCharFmt( const String &rFmtName, SwFmt *SwDoc::_MakeCharFmt(const String &rFmtName, SwFmt *pDerivedFrom, - BOOL bBroadcast, BOOL bAuto) + sal_Bool bBroadcast, sal_Bool bAuto) { SwCharFmt *pCharFmt = dynamic_cast<SwCharFmt*>(pDerivedFrom); pCharFmt = MakeCharFmt( rFmtName, pCharFmt, bBroadcast, bAuto ); @@ -1572,20 +1579,20 @@ SwFmt *SwDoc::_MakeCharFmt(const String &rFmtName, // #i40550# - add parameter <bAuto> - not relevant SwTxtFmtColl* SwDoc::MakeTxtFmtColl( const String &rFmtName, SwTxtFmtColl *pDerivedFrom, - BOOL bBroadcast, - BOOL ) + sal_Bool bBroadcast, + sal_Bool ) { SwTxtFmtColl *pFmtColl = new SwTxtFmtColl( GetAttrPool(), rFmtName, pDerivedFrom ); pTxtFmtCollTbl->Insert(pFmtColl, pTxtFmtCollTbl->Count()); - pFmtColl->SetAuto( FALSE ); + pFmtColl->SetAuto( sal_False ); SetModified(); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoTxtFmtCollCreate(pFmtColl, pDerivedFrom, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if (bBroadcast) @@ -1597,7 +1604,7 @@ SwTxtFmtColl* SwDoc::MakeTxtFmtColl( const String &rFmtName, SwFmt *SwDoc::_MakeTxtFmtColl(const String &rFmtName, SwFmt *pDerivedFrom, - BOOL bBroadcast, BOOL bAuto) + sal_Bool bBroadcast, sal_Bool bAuto) { SwTxtFmtColl *pTxtFmtColl = dynamic_cast<SwTxtFmtColl*>(pDerivedFrom); pTxtFmtColl = MakeTxtFmtColl( rFmtName, pTxtFmtColl, bBroadcast, bAuto ); @@ -1608,12 +1615,12 @@ SwFmt *SwDoc::_MakeTxtFmtColl(const String &rFmtName, //FEATURE::CONDCOLL SwConditionTxtFmtColl* SwDoc::MakeCondTxtFmtColl( const String &rFmtName, SwTxtFmtColl *pDerivedFrom, - BOOL bBroadcast) + sal_Bool bBroadcast) { SwConditionTxtFmtColl*pFmtColl = new SwConditionTxtFmtColl( GetAttrPool(), rFmtName, pDerivedFrom ); pTxtFmtCollTbl->Insert(pFmtColl, pTxtFmtCollTbl->Count()); - pFmtColl->SetAuto( FALSE ); + pFmtColl->SetAuto( sal_False ); SetModified(); if (bBroadcast) @@ -1632,12 +1639,12 @@ SwGrfFmtColl* SwDoc::MakeGrfFmtColl( const String &rFmtName, SwGrfFmtColl *pFmtColl = new SwGrfFmtColl( GetAttrPool(), rFmtName, pDerivedFrom ); pGrfFmtCollTbl->Insert( pFmtColl, pGrfFmtCollTbl->Count() ); - pFmtColl->SetAuto( FALSE ); + pFmtColl->SetAuto( sal_False ); SetModified(); return pFmtColl; } -void SwDoc::DelTxtFmtColl(USHORT nFmtColl, BOOL bBroadcast) +void SwDoc::DelTxtFmtColl(sal_uInt16 nFmtColl, sal_Bool bBroadcast) { OSL_ENSURE( nFmtColl, "Remove fuer Coll 0." ); @@ -1650,12 +1657,12 @@ void SwDoc::DelTxtFmtColl(USHORT nFmtColl, BOOL bBroadcast) BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_PARA, SFX_STYLESHEET_ERASED); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndoTxtFmtCollDelete * pUndo = new SwUndoTxtFmtCollDelete(pDel, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } // Die FmtColl austragen @@ -1667,14 +1674,14 @@ void SwDoc::DelTxtFmtColl(USHORT nFmtColl, BOOL bBroadcast) SetModified(); } -void SwDoc::DelTxtFmtColl( SwTxtFmtColl *pColl, BOOL bBroadcast ) +void SwDoc::DelTxtFmtColl( SwTxtFmtColl *pColl, sal_Bool bBroadcast ) { - USHORT nFmt = pTxtFmtCollTbl->GetPos( pColl ); + sal_uInt16 nFmt = pTxtFmtCollTbl->GetPos( pColl ); OSL_ENSURE( USHRT_MAX != nFmt, "Collection not found," ); DelTxtFmtColl( nFmt, bBroadcast ); } -BOOL lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs ) +sal_Bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs ) { // ParaSetFmtColl * pPara = (ParaSetFmtColl*)pArgs; SwCntntNode* pCNd = (SwCntntNode*)rpNode->GetTxtNode(); @@ -1745,10 +1752,10 @@ BOOL lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs ) pPara->nWhich++; } - return TRUE; + return sal_True; } -BOOL SwDoc::SetTxtFmtColl( const SwPaM &rRg, +sal_Bool SwDoc::SetTxtFmtColl( const SwPaM &rRg, SwTxtFmtColl *pFmt, bool bReset, bool bResetListAttrs ) @@ -1756,16 +1763,15 @@ BOOL SwDoc::SetTxtFmtColl( const SwPaM &rRg, SwDataChanged aTmp( rRg, 0 ); const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End(); SwHistory* pHst = 0; - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); SwUndoFmtColl* pUndo = new SwUndoFmtColl( rRg, pFmt, bReset, bResetListAttrs ); pHst = pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } ParaRstFmt aPara( pStt, pEnd, pHst ); @@ -1777,7 +1783,7 @@ BOOL SwDoc::SetTxtFmtColl( const SwPaM &rRg, GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1, lcl_SetTxtFmtColl, &aPara ); if( !aPara.nWhich ) - bRet = FALSE; // keinen gueltigen Node gefunden + bRet = sal_False; // keinen gueltigen Node gefunden if( bRet ) SetModified(); @@ -1794,7 +1800,7 @@ SwFmt* SwDoc::CopyFmt( const SwFmt& rFmt, // kein-Autoformat || default Format || Collection-Format // dann suche danach. if( !rFmt.IsAuto() || !rFmt.GetRegisteredIn() ) - for( USHORT n = 0; n < rFmtArr.Count(); n++ ) + for( sal_uInt16 n = 0; n < rFmtArr.Count(); n++ ) { // ist die Vorlage schon im Doc vorhanden ?? if( ((SwFmt*)rFmtArr[n])->GetName().Equals( rFmt.GetName() )) @@ -1809,9 +1815,9 @@ SwFmt* SwDoc::CopyFmt( const SwFmt& rFmt, // erzeuge das Format und kopiere die Attribute // #i40550# - SwFmt* pNewFmt = (this->*fnCopyFmt)( rFmt.GetName(), pParent, FALSE, TRUE ); + SwFmt* pNewFmt = (this->*fnCopyFmt)( rFmt.GetName(), pParent, sal_False, sal_True ); pNewFmt->SetAuto( rFmt.IsAuto() ); - pNewFmt->CopyAttrs( rFmt, TRUE ); // kopiere Attribute + pNewFmt->CopyAttrs( rFmt, sal_True ); // kopiere Attribute pNewFmt->SetPoolFmtId( rFmt.GetPoolFmtId() ); pNewFmt->SetPoolHelpId( rFmt.GetPoolHelpId() ); @@ -1860,7 +1866,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) pNewColl = new SwConditionTxtFmtColl( GetAttrPool(), rColl.GetName(), pParent); pTxtFmtCollTbl->Insert( pNewColl, pTxtFmtCollTbl->Count() ); - pNewColl->SetAuto( FALSE ); + pNewColl->SetAuto( sal_False ); SetModified(); // Kopiere noch die Bedingungen @@ -1872,7 +1878,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) pNewColl = MakeTxtFmtColl( rColl.GetName(), pParent ); // kopiere jetzt noch die Auto-Formate oder kopiere die Attribute - pNewColl->CopyAttrs( rColl, TRUE ); + pNewColl->CopyAttrs( rColl, sal_True ); if(rColl.IsAssignedToListLevelOfOutlineStyle()) pNewColl->AssignToListLevelOfOutlineStyle(rColl.GetAssignedOutlineStyleLevel());//<-end,zhaojianwei @@ -1891,7 +1897,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) { const SfxPoolItem* pItem; if( SFX_ITEM_SET == pNewColl->GetItemState( RES_PARATR_NUMRULE, - FALSE, &pItem )) + sal_False, &pItem )) { const SwNumRule* pRule; const String& rName = ((SwNumRuleItem*)pItem)->GetValue(); @@ -1901,7 +1907,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) { SwNumRule* pDestRule = FindNumRulePtr( rName ); if( pDestRule ) - pDestRule->SetInvalidRule( TRUE ); + pDestRule->SetInvalidRule( sal_True ); else MakeNumRule( rName, pRule ); } @@ -1940,7 +1946,7 @@ SwGrfFmtColl* SwDoc::CopyGrfColl( const SwGrfFmtColl& rColl ) SwPageDesc* lcl_FindPageDesc( const SwPageDescs& rArr, const String& rName ) { - for( USHORT n = rArr.Count(); n; ) + for( sal_uInt16 n = rArr.Count(); n; ) { SwPageDesc* pDesc = rArr[ --n ]; if( pDesc->GetName() == rName ) @@ -1954,7 +1960,7 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, FNCopyFmt fnCopyFmt, SwFmt& rDfltFmt ) { - USHORT nSrc; + sal_uInt16 nSrc; SwFmt* pSrc, *pDest; // 1. Schritt alle Formate anlegen (das 0. ueberspringen - Default!) @@ -1970,7 +1976,7 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, MakeCondTxtFmtColl( pSrc->GetName(), (SwTxtFmtColl*)&rDfltFmt ); else // #i40550# - (this->*fnCopyFmt)( pSrc->GetName(), &rDfltFmt, FALSE, TRUE ); + (this->*fnCopyFmt)( pSrc->GetName(), &rDfltFmt, sal_False, sal_True ); } } @@ -1982,7 +1988,7 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, continue; pDest = FindFmtByName( rDestArr, pSrc->GetName() ); - pDest->SetAuto( FALSE ); + pDest->SetAuto( sal_False ); //JP 19.02.96: ist so wohl optimaler - loest ggfs. kein Modify aus! pDest->DelDiffs( *pSrc ); @@ -1990,7 +1996,7 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, const SfxPoolItem* pItem; if( &GetAttrPool() != pSrc->GetAttrSet().GetPool() && SFX_ITEM_SET == pSrc->GetAttrSet().GetItemState( - RES_PAGEDESC, FALSE, &pItem ) && + RES_PAGEDESC, sal_False, &pItem ) && ((SwFmtPageDesc*)pItem)->GetPageDesc() ) { SwFmtPageDesc aPageDesc( *(SwFmtPageDesc*)pItem ); @@ -2049,9 +2055,9 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, { // jetzt noch Header-/Footer-Attribute richtig behandeln // Contenten Nodes Dokumentuebergreifend kopieren! - USHORT nAttr = static_cast<USHORT>( bCpyHeader ? RES_HEADER : RES_FOOTER ); + sal_uInt16 nAttr = static_cast<sal_uInt16>( bCpyHeader ? RES_HEADER : RES_FOOTER ); const SfxPoolItem* pItem; - if( SFX_ITEM_SET != rSrcFmt.GetAttrSet().GetItemState( nAttr, FALSE, &pItem )) + if( SFX_ITEM_SET != rSrcFmt.GetAttrSet().GetItemState( nAttr, sal_False, &pItem )) return ; // Im Header steht noch der Verweis auf das Format aus dem @@ -2068,10 +2074,10 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, { SwFrmFmt* pNewFmt = new SwFrmFmt( GetAttrPool(), "CpyDesc", GetDfltFrmFmt() ); - pNewFmt->CopyAttrs( *pOldFmt, TRUE ); + pNewFmt->CopyAttrs( *pOldFmt, sal_True ); if( SFX_ITEM_SET == pNewFmt->GetAttrSet().GetItemState( - RES_CNTNT, FALSE, &pItem )) + RES_CNTNT, sal_False, &pItem )) { SwFmtCntnt* pCntnt = (SwFmtCntnt*)pItem; if( pCntnt->GetCntntIdx() ) @@ -2103,16 +2109,16 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, } void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, - BOOL bCopyPoolIds ) + sal_Bool bCopyPoolIds ) { - BOOL bNotifyLayout = FALSE; + sal_Bool bNotifyLayout = sal_False; rDstDesc.SetLandscape( rSrcDesc.GetLandscape() ); rDstDesc.SetNumType( rSrcDesc.GetNumType() ); if( rDstDesc.ReadUseOn() != rSrcDesc.ReadUseOn() ) { rDstDesc.WriteUseOn( rSrcDesc.ReadUseOn() ); - bNotifyLayout = TRUE; + bNotifyLayout = sal_True; } if( bCopyPoolIds ) @@ -2130,12 +2136,12 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, if( !pFollow ) { // dann mal kopieren - USHORT nPos = MakePageDesc( rSrcDesc.GetFollow()->GetName() ); + sal_uInt16 nPos = MakePageDesc( rSrcDesc.GetFollow()->GetName() ); pFollow = aPageDescs[ nPos ]; CopyPageDesc( *rSrcDesc.GetFollow(), *pFollow ); } rDstDesc.SetFollow( pFollow ); - bNotifyLayout = TRUE; + bNotifyLayout = sal_True; } // die Header/Footer-Attribute werden gesondert kopiert, die Content- @@ -2196,8 +2202,7 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, void SwDoc::ReplaceStyles( SwDoc& rSource ) { - BOOL bIsUndo = DoesUndo(); - DoUndo( FALSE ); + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); CopyFmtArr( *rSource.pCharFmtTbl, *pCharFmtTbl, &SwDoc::_MakeCharFmt, *pDfltCharFmt ); @@ -2207,7 +2212,7 @@ void SwDoc::ReplaceStyles( SwDoc& rSource ) &SwDoc::_MakeTxtFmtColl, *pDfltTxtFmtColl ); // und jetzt noch die Seiten-Vorlagen - USHORT nCnt = rSource.aPageDescs.Count(); + sal_uInt16 nCnt = rSource.aPageDescs.Count(); if( nCnt ) { // ein anderes Doc -> Numberformatter muessen gemergt werden @@ -2234,7 +2239,7 @@ void SwDoc::ReplaceStyles( SwDoc& rSource ) if( nCnt ) { const SwNumRuleTbl& rArr = rSource.GetNumRuleTbl(); - for( USHORT n = 0; n < nCnt; ++n ) + for( sal_uInt16 n = 0; n < nCnt; ++n ) { const SwNumRule& rR = *rArr[ n ]; if( !rR.IsAutoRule() ) @@ -2248,22 +2253,20 @@ void SwDoc::ReplaceStyles( SwDoc& rSource ) } } - if( bIsUndo ) + if (undoGuard.UndoWasEnabled()) { - // es wurde am Nodes-Array gedreht! - ClearRedo(); - DelAllUndoObj(); + // nodes array was modified! + GetIDocumentUndoRedo().DelAllUndoObj(); } SetModified(); - DoUndo( bIsUndo ); } SwFmt* SwDoc::FindFmtByName( const SvPtrarr& rFmtArr, const String& rName ) const { SwFmt* pFnd = 0; - for( USHORT n = 0; n < rFmtArr.Count(); n++ ) + for( sal_uInt16 n = 0; n < rFmtArr.Count(); n++ ) { // ist die Vorlage schon im Doc vorhanden ?? if( ((SwFmt*)rFmtArr[n])->GetName() == rName ) @@ -2275,21 +2278,20 @@ SwFmt* SwDoc::FindFmtByName( const SvPtrarr& rFmtArr, return pFnd; } -void SwDoc::MoveLeftMargin( const SwPaM& rPam, BOOL bRight, BOOL bModulus ) +void SwDoc::MoveLeftMargin( const SwPaM& rPam, sal_Bool bRight, sal_Bool bModulus ) { SwHistory* pHistory = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); SwUndoMoveLeftMargin* pUndo = new SwUndoMoveLeftMargin( rPam, bRight, bModulus ); pHistory = &pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } const SvxTabStopItem& rTabItem = (SvxTabStopItem&)GetDefault( RES_PARATR_TABSTOP ); - USHORT nDefDist = rTabItem.Count() ? - static_cast<USHORT>(rTabItem[0].GetTabPos()) : 1134; + sal_uInt16 nDefDist = rTabItem.Count() ? + static_cast<sal_uInt16>(rTabItem[0].GetTabPos()) : 1134; const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End(); SwNodeIndex aIdx( rStt.nNode ); while( aIdx <= rEnd.nNode ) @@ -2308,7 +2310,7 @@ void SwDoc::MoveLeftMargin( const SwPaM& rPam, BOOL bRight, BOOL bModulus ) const int nListLevel = pTNd->GetActualListLevel(); if ( nListLevel >= 0 ) { - const SwNumFmt& rFmt = pRule->Get(static_cast<USHORT>(nListLevel)); + const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(nListLevel)); if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) { aLS.SetTxtLeft( rFmt.GetIndentAt() ); @@ -2337,17 +2339,16 @@ void SwDoc::MoveLeftMargin( const SwPaM& rPam, BOOL bRight, BOOL bModulus ) SetModified(); } -BOOL SwDoc::DontExpandFmt( const SwPosition& rPos, BOOL bFlag ) +sal_Bool SwDoc::DontExpandFmt( const SwPosition& rPos, sal_Bool bFlag ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode(); if( pTxtNd ) { bRet = pTxtNd->DontExpandFmt( rPos.nContent, bFlag ); - if( bRet && DoesUndo() ) + if( bRet && GetIDocumentUndoRedo().DoesUndo() ) { - ClearRedo(); - AppendUndo( new SwUndoDontExpandFmt( rPos )); + GetIDocumentUndoRedo().AppendUndo( new SwUndoDontExpandFmt(rPos) ); } } return bRet; @@ -2381,7 +2382,7 @@ void SwDoc::_CreateNumberFormatter() Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); pNumberFormatter = new SvNumberFormatter( xMSF, eLang ); pNumberFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL ); - pNumberFormatter->SetYear2000(static_cast<USHORT>(::utl::MiscCfg().GetYear2000())); + pNumberFormatter->SetYear2000(static_cast<sal_uInt16>(::utl::MiscCfg().GetYear2000())); } @@ -2390,8 +2391,8 @@ SwTblNumFmtMerge::SwTblNumFmtMerge( const SwDoc& rSrc, SwDoc& rDest ) { // ein anderes Doc -> Numberformatter muessen gemergt werden SvNumberFormatter* pN; - if( &rSrc != &rDest && 0 != ( pN = ((SwDoc&)rSrc).GetNumberFormatter( FALSE ) )) - ( pNFmt = rDest.GetNumberFormatter( TRUE ))->MergeFormatter( *pN ); + if( &rSrc != &rDest && 0 != ( pN = ((SwDoc&)rSrc).GetNumberFormatter( sal_False ) )) + ( pNFmt = rDest.GetNumberFormatter( sal_True ))->MergeFormatter( *pN ); if( &rSrc != &rDest ) ((SwGetRefFieldType*)rSrc.GetSysFldType( RES_GETREFFLD ))-> @@ -2405,7 +2406,7 @@ SwTblNumFmtMerge::~SwTblNumFmtMerge() } -void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, USHORT nPoolId, +void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, sal_uInt16 nPoolId, const SfxItemSet* pSet ) { SwPaM aPam( rPos ); @@ -2429,7 +2430,7 @@ void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, USHORT nPoolId, // das Adjust Item behalten wir extra const SfxPoolItem* pItem; if( SFX_ITEM_SET == pTNd->GetpSwAttrSet()->GetItemState( - RES_PARATR_ADJUST, FALSE, &pItem )) + RES_PARATR_ADJUST, sal_False, &pItem )) aTmp.Put( *pItem ); aExtraData.SetItemSet( aTmp ); } @@ -2480,7 +2481,7 @@ void SwDoc::SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& rSet ) void SwDoc::ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet) { - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { // copying <rSet> to <aSet> SfxItemSet aSet(rSet); @@ -2508,18 +2509,18 @@ void SwDoc::ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet) SwUndo * pUndo = new SwUndoFmtAttr(aOldSet, rFmt); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } rFmt.SetFmtAttr(rSet); } void SwDoc::RenameFmt(SwFmt & rFmt, const String & sNewName, - BOOL bBroadcast) + sal_Bool bBroadcast) { SfxStyleFamily eFamily = SFX_STYLE_FAMILY_ALL; - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = NULL; @@ -2543,7 +2544,9 @@ void SwDoc::RenameFmt(SwFmt & rFmt, const String & sNewName, } if (pUndo) - AppendUndo(pUndo); + { + GetIDocumentUndoRedo().AppendUndo(pUndo); + } } rFmt.SetName(sNewName); @@ -2567,8 +2570,8 @@ namespace docfunc const SwTxtFmtColls* pTxtFmtColls( rDoc.GetTxtFmtColls() ); if ( pTxtFmtColls ) { - const USHORT nCount = pTxtFmtColls->Count(); - for ( USHORT i = 0; i < nCount; ++i ) + const sal_uInt16 nCount = pTxtFmtColls->Count(); + for ( sal_uInt16 i = 0; i < nCount; ++i ) { SwTxtFmtColl* pTxtFmtColl = (*pTxtFmtColls)[i]; diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index 6ce4d432dd27..6f5d0f509f52 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -37,9 +37,11 @@ #include <pam.hxx> #include <pagedesc.hxx> #include <charfmt.hxx> -#include <undobj.hxx> +#include <UndoAttribute.hxx> +#include <hints.hxx> #include <rolbck.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <ndtxt.hxx> #include <poolfmt.hxx> #include <ftninfo.hxx> @@ -79,7 +81,7 @@ SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo) } -BOOL SwEndNoteInfo::operator==( const SwEndNoteInfo& rInfo ) const +sal_Bool SwEndNoteInfo::operator==( const SwEndNoteInfo& rInfo ) const { return aPageDescDep.GetRegisteredIn() == rInfo.aPageDescDep.GetRegisteredIn() && @@ -186,7 +188,7 @@ void SwEndNoteInfo::SetAnchorCharFmt( SwCharFmt* pChFmt ) void SwEndNoteInfo::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) { - USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ; + sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ; if( RES_ATTRSET_CHG == nWhich || RES_FMT_CHG == nWhich ) @@ -197,7 +199,7 @@ void SwEndNoteInfo::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) else pDoc = ((SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn())->GetDoc(); SwFtnIdxs& rFtnIdxs = pDoc->GetFtnIdxs(); - for( USHORT nPos = 0; nPos < rFtnIdxs.Count(); ++nPos ) + for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos ) { SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ]; const SwFmtFtn &rFtn = pTxtFtn->GetFtn(); @@ -222,7 +224,7 @@ SwFtnInfo& SwFtnInfo::operator=(const SwFtnInfo& rInfo) } -BOOL SwFtnInfo::operator==( const SwFtnInfo& rInfo ) const +sal_Bool SwFtnInfo::operator==( const SwFtnInfo& rInfo ) const { return ePos == rInfo.ePos && eNum == rInfo.eNum && @@ -260,23 +262,22 @@ void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo) { const SwFtnInfo &rOld = GetFtnInfo(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoFootNoteInfo( rOld ) ); + GetIDocumentUndoRedo().AppendUndo( new SwUndoFootNoteInfo(rOld) ); } - BOOL bFtnPos = rInfo.ePos != rOld.ePos; - BOOL bFtnDesc = rOld.ePos == FTNPOS_CHAPTER && + sal_Bool bFtnPos = rInfo.ePos != rOld.ePos; + sal_Bool bFtnDesc = rOld.ePos == FTNPOS_CHAPTER && rInfo.GetPageDesc( *this ) != rOld.GetPageDesc( *this ); - BOOL bExtra = rInfo.aQuoVadis != rOld.aQuoVadis || + sal_Bool bExtra = rInfo.aQuoVadis != rOld.aQuoVadis || rInfo.aErgoSum != rOld.aErgoSum || rInfo.aFmt.GetNumberingType() != rOld.aFmt.GetNumberingType() || rInfo.GetPrefix() != rOld.GetPrefix() || rInfo.GetSuffix() != rOld.GetSuffix(); SwCharFmt *pOldChrFmt = rOld.GetCharFmt( *this ), *pNewChrFmt = rInfo.GetCharFmt( *this ); - BOOL bFtnChrFmts = pOldChrFmt != pNewChrFmt; + sal_Bool bFtnChrFmts = pOldChrFmt != pNewChrFmt; *pFtnInfo = rInfo; @@ -288,13 +289,13 @@ void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo) { GetRootFrm()->UpdateFtnNums(); if ( bFtnDesc ) - GetRootFrm()->CheckFtnPageDescs( FALSE ); + GetRootFrm()->CheckFtnPageDescs( sal_False ); if ( bExtra ) { //Fuer die Benachrichtung bezueglich ErgoSum usw. sparen wir uns //extra-Code und nutzen die vorhandenen Wege. SwFtnIdxs& rFtnIdxs = GetFtnIdxs(); - for( USHORT nPos = 0; nPos < rFtnIdxs.Count(); ++nPos ) + for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos ) { SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ]; const SwFmtFtn &rFtn = pTxtFtn->GetFtn(); @@ -326,13 +327,13 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo) { if( !(GetEndNoteInfo() == rInfo) ) { - if( DoesUndo() ) + if(GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoEndNoteInfo( GetEndNoteInfo() ) ); + SwUndo *const pUndo( new SwUndoEndNoteInfo( GetEndNoteInfo() ) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } - BOOL bNumChg = rInfo.nFtnOffset != GetEndNoteInfo().nFtnOffset; + sal_Bool bNumChg = rInfo.nFtnOffset != GetEndNoteInfo().nFtnOffset; // this seems to be an optimization: UpdateAllFtn() is only called // if the offset changes; if the offset is the same, // but type/prefix/suffix changes, just set new numbers. @@ -342,24 +343,24 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo) || (rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix()) || (rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix()) ); - BOOL bFtnDesc = rInfo.GetPageDesc( *this ) != + sal_Bool bFtnDesc = rInfo.GetPageDesc( *this ) != GetEndNoteInfo().GetPageDesc( *this ); SwCharFmt *pOldChrFmt = GetEndNoteInfo().GetCharFmt( *this ), *pNewChrFmt = rInfo.GetCharFmt( *this ); - BOOL bFtnChrFmts = pOldChrFmt != pNewChrFmt; + sal_Bool bFtnChrFmts = pOldChrFmt != pNewChrFmt; *pEndNoteInfo = rInfo; if ( GetRootFrm() ) { if ( bFtnDesc ) - GetRootFrm()->CheckFtnPageDescs( TRUE ); + GetRootFrm()->CheckFtnPageDescs( sal_True ); if ( bExtra ) { //Fuer die Benachrichtung bezueglich ErgoSum usw. sparen wir uns //extra-Code und nutzen die vorhandenen Wege. SwFtnIdxs& rFtnIdxs = GetFtnIdxs(); - for( USHORT nPos = 0; nPos < rFtnIdxs.Count(); ++nPos ) + for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos ) { SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ]; const SwFmtFtn &rFtn = pTxtFtn->GetFtn(); @@ -393,26 +394,26 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr, SwFtnIdxs& rFtnArr = GetFtnIdxs(); const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End(); - const ULONG nSttNd = pStt->nNode.GetIndex(); + const sal_uLong nSttNd = pStt->nNode.GetIndex(); const xub_StrLen nSttCnt = pStt->nContent.GetIndex(); - const ULONG nEndNd = pEnd->nNode.GetIndex(); + const sal_uLong nEndNd = pEnd->nNode.GetIndex(); const xub_StrLen nEndCnt = pEnd->nContent.GetIndex(); - USHORT nPos; + sal_uInt16 nPos; rFtnArr.SeekEntry( pStt->nNode, &nPos ); SwUndoChangeFootNote* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); // AppendUndo far below, so leave it pUndo = new SwUndoChangeFootNote( rPam, rNumStr, nNumber, bIsEndNote ); } SwTxtFtn* pTxtFtn; - ULONG nIdx; - BOOL bChg = FALSE; - BOOL bTypeChgd = FALSE; - USHORT n = nPos; // sichern + sal_uLong nIdx; + sal_Bool bChg = sal_False; + sal_Bool bTypeChgd = sal_False; + sal_uInt16 n = nPos; // sichern while( nPos < rFtnArr.Count() && (( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ nPos++ ] ))) < nEndNd || ( nIdx == nEndNd && @@ -424,7 +425,7 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr, if( rFtn.GetNumStr() != rNumStr || rFtn.IsEndNote() != bIsEndNote ) { - bChg = TRUE; + bChg = sal_True; if ( pUndo ) { pUndo->GetHistory().Add( *pTxtFtn ); @@ -434,7 +435,7 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr, if( rFtn.IsEndNote() != bIsEndNote ) { ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote ); - bTypeChgd = TRUE; + bTypeChgd = sal_True; pTxtFtn->CheckCondColl(); //#i11339# dispose UNO wrapper when a footnote is changed to an endnote or vice versa SwPtrMsgPoolItem aMsgHint( RES_FOOTNOTE_DELETED, (void*)&pTxtFtn->GetAttr() ); @@ -455,7 +456,7 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr, if( rFtn.GetNumStr() != rNumStr || rFtn.IsEndNote() != bIsEndNote ) { - bChg = TRUE; + bChg = sal_True; if ( pUndo ) { pUndo->GetHistory().Add( *pTxtFtn ); @@ -465,7 +466,7 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr, if( rFtn.IsEndNote() != bIsEndNote ) { ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote ); - bTypeChgd = TRUE; + bTypeChgd = sal_True; pTxtFtn->CheckCondColl(); } } @@ -476,8 +477,7 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr, { if( pUndo ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if ( bTypeChgd ) diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 6decd1908fbb..cc881ca8cd45 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -44,6 +44,7 @@ #include <fmtinfmt.hxx> #include <fmtanchr.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -67,30 +68,30 @@ enum SwSplitDocType SPLITDOC_TO_HTML }; -BOOL SwDoc::GenerateGlobalDoc( const String& rPath, +sal_Bool SwDoc::GenerateGlobalDoc( const String& rPath, const SwTxtFmtColl* pSplitColl ) { return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, pSplitColl ); } //#outline level,add by zhaojianwei -BOOL SwDoc::GenerateGlobalDoc( const String& rPath, int nOutlineLevel ) +sal_Bool SwDoc::GenerateGlobalDoc( const String& rPath, int nOutlineLevel ) { return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, nOutlineLevel ); } -BOOL SwDoc::GenerateHTMLDoc( const String& rPath, int nOutlineLevel ) +sal_Bool SwDoc::GenerateHTMLDoc( const String& rPath, int nOutlineLevel ) { return SplitDoc( SPLITDOC_TO_HTML, rPath, nOutlineLevel ); } //<-end,zhaojianwei -BOOL SwDoc::GenerateHTMLDoc( const String& rPath, +sal_Bool SwDoc::GenerateHTMLDoc( const String& rPath, const SwTxtFmtColl* pSplitColl ) { return SplitDoc( SPLITDOC_TO_HTML, rPath, pSplitColl ); } -BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, +sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, const SwTxtFmtColl* pSplitColl ) { // ueber alle Node der Vorlage Iterieren und dafuer einzelne @@ -101,9 +102,9 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, // Am Ende wird dieses Doc als GlobalDoc/HTML-Doc gespreichert. if( !pDocShell || !pDocShell->GetMedium() || ( SPLITDOC_TO_GLOBALDOC == eDocType && get(IDocumentSettingAccess::GLOBAL_DOCUMENT) ) ) - return FALSE; + return sal_False; - USHORT nOutl = 0; + sal_uInt16 nOutl = 0; SwOutlineNodes* pOutlNds = (SwOutlineNodes*)&GetNodes().GetOutLineNds(); SwNodePtr pSttNd; @@ -123,7 +124,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, if( !pOutlNds->Count() ) { delete pOutlNds; - return FALSE; + return sal_False; } } } @@ -131,7 +132,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, { // dann suche die Gliederungs - Vorlage, der 1. Ebene const SwTxtFmtColls& rFmtColls =*GetTxtFmtColls(); - for( USHORT n = rFmtColls.Count(); n; ) + for( sal_uInt16 n = rFmtColls.Count(); n; ) if ( rFmtColls[ --n ]->GetAttrOutlineLevel() == 1 )//<-end,zhaojianwei { pSplitColl = rFmtColls[ n ]; @@ -139,7 +140,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, } if( !pSplitColl ) - return FALSE; + return sal_False; } const SfxFilter* pFilter; @@ -158,10 +159,10 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, } if( !pFilter ) - return FALSE; + return sal_False; // Undo/Redline aufjedenfall abschalten - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); SetRedlineMode_intern( (RedlineMode_t)(GetRedlineMode() & ~nsRedlineMode_t::REDLINE_ON)); String sExt( pFilter->GetSuffixes().GetToken(0, ',') ); @@ -229,7 +230,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, String sFileName; if( pSttNd->GetIndex() + 1 < aEndIdx.GetIndex() ) { - SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); + SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); if( xDocSh->DoInitNew( 0 ) ) { SwDoc* pDoc = ((SwDocShell*)(&xDocSh))->GetDoc(); @@ -266,7 +267,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, SwNodeRange aRg( *pSttNd, 0, aEndIdx.GetNode() ); SwNodeIndex aTmpIdx( pDoc->GetNodes().GetEndOfContent() ); - GetNodes()._Copy( aRg, aTmpIdx, FALSE ); + GetNodes()._Copy( aRg, aTmpIdx, sal_False ); // den initialen TextNode loeschen SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 2 ); @@ -284,7 +285,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, utl::TempFile aTempFile2(sLeading,&sExt,&sPath ); sFileName = aTempFile2.GetURL(); SfxMedium* pTmpMed = new SfxMedium( sFileName, - STREAM_STD_READWRITE, TRUE ); + STREAM_STD_READWRITE, sal_True ); pTmpMed->SetFilter( pFilter ); // fuer den HTML-Filter mussen wir aber ein Layout @@ -315,7 +316,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, { // loesche alle Nodes im Bereich und setze im "Start- // Node" den Link auf das gespeicherte Doc - ULONG nNodeDiff = aEndIdx.GetIndex() - + sal_uLong nNodeDiff = aEndIdx.GetIndex() - pSttNd->GetIndex() - 1; if( nNodeDiff ) { @@ -332,14 +333,14 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, aTmp.Exchange(); if( !aTmp.Move( fnMoveBackward, fnGoNode )) { - OSL_ENSURE( FALSE, "kein Node mehr vorhanden" ); + OSL_ENSURE( sal_False, "kein Node mehr vorhanden" ); } } // Bookmarks usw. verschieben - CorrAbs( aSIdx, aEIdx, *aTmp.GetPoint(), TRUE); + CorrAbs( aSIdx, aEIdx, *aTmp.GetPoint(), sal_True); // stehen noch FlyFrames rum, loesche auch diese - for( USHORT n = 0; n < GetSpzFrmFmts()->Count(); ++n ) + for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n ) { SwFrmFmt* pFly = (*GetSpzFrmFmts())[n]; const SwFmtAnchor* pAnchor = &pFly->GetAnchor(); @@ -396,7 +397,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, if( pSectNd->GetIndex() + 1 == pSttNd->GetIndex() ) { - BOOL bMvIdx = aEndIdx == *pSectEnd; + sal_Bool bMvIdx = aEndIdx == *pSectEnd; DelSectionFmt( pSectNd->GetSection().GetFmt() ); if( bMvIdx ) aEndIdx--; @@ -485,13 +486,13 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, } //#outline level,add by zhaojianwei -BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) +sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, int nOutlineLevel ) { if( !pDocShell || !pDocShell->GetMedium() || ( SPLITDOC_TO_GLOBALDOC == eDocType && get(IDocumentSettingAccess::GLOBAL_DOCUMENT) ) ) - return FALSE; + return sal_False; - USHORT nOutl = 0; + sal_uInt16 nOutl = 0; SwOutlineNodes* pOutlNds = (SwOutlineNodes*)&GetNodes().GetOutLineNds(); SwNodePtr pSttNd; @@ -511,10 +512,10 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) } if( !pFilter ) - return FALSE; + return sal_False; // Undo/Redline aufjedenfall abschalten - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); SetRedlineMode_intern( (RedlineMode_t)(GetRedlineMode() & ~nsRedlineMode_t::REDLINE_ON)); String sExt( pFilter->GetSuffixes().GetToken(0, ',') ); @@ -577,7 +578,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) String sFileName; if( pSttNd->GetIndex() + 1 < aEndIdx.GetIndex() ) { - SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); + SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); if( xDocSh->DoInitNew( 0 ) ) { SwDoc* pDoc = ((SwDocShell*)(&xDocSh))->GetDoc(); @@ -614,7 +615,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) SwNodeRange aRg( *pSttNd, 0, aEndIdx.GetNode() ); SwNodeIndex aTmpIdx( pDoc->GetNodes().GetEndOfContent() ); - GetNodes()._Copy( aRg, aTmpIdx, FALSE ); + GetNodes()._Copy( aRg, aTmpIdx, sal_False ); // den initialen TextNode loeschen SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 2 ); @@ -632,7 +633,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) utl::TempFile aTempFile2(sLeading,&sExt,&sPath ); sFileName = aTempFile2.GetURL(); SfxMedium* pTmpMed = new SfxMedium( sFileName, - STREAM_STD_READWRITE, TRUE ); + STREAM_STD_READWRITE, sal_True ); pTmpMed->SetFilter( pFilter ); // fuer den HTML-Filter mussen wir aber ein Layout @@ -662,7 +663,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) { // loesche alle Nodes im Bereich und setze im "Start- // Node" den Link auf das gespeicherte Doc - ULONG nNodeDiff = aEndIdx.GetIndex() - + sal_uLong nNodeDiff = aEndIdx.GetIndex() - pSttNd->GetIndex() - 1; if( nNodeDiff ) { @@ -679,14 +680,14 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) aTmp.Exchange(); if( !aTmp.Move( fnMoveBackward, fnGoNode )) { - OSL_ENSURE( FALSE, "kein Node mehr vorhanden" ); + OSL_ENSURE( sal_False, "kein Node mehr vorhanden" ); } } // Bookmarks usw. verschieben - CorrAbs( aSIdx, aEIdx, *aTmp.GetPoint(), TRUE); + CorrAbs( aSIdx, aEIdx, *aTmp.GetPoint(), sal_True); // stehen noch FlyFrames rum, loesche auch diese - for( USHORT n = 0; n < GetSpzFrmFmts()->Count(); ++n ) + for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n ) { SwFrmFmt* pFly = (*GetSpzFrmFmts())[n]; const SwFmtAnchor* pAnchor = &pFly->GetAnchor(); @@ -743,7 +744,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) if( pSectNd->GetIndex() + 1 == pSttNd->GetIndex() ) { - BOOL bMvIdx = aEndIdx == *pSectEnd; + sal_Bool bMvIdx = aEndIdx == *pSectEnd; DelSectionFmt( pSectNd->GetSection().GetFmt() ); if( bMvIdx ) aEndIdx--; diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx index 3b4df9098392..350bde67062c 100644 --- a/sw/source/core/doc/docglos.cxx +++ b/sw/source/core/doc/docglos.cxx @@ -29,8 +29,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <shellio.hxx> #include <pam.hxx> #include <swundo.hxx> @@ -39,11 +44,6 @@ #include <crsrsh.hxx> #include <docsh.hxx> -#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> -#include <com/sun/star/document/XDocumentProperties.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/beans/XPropertySetInfo.hpp> - using namespace ::com::sun::star; @@ -109,14 +109,14 @@ static void lcl_copyDocumentProperties( /* -------------------------------------------------- Description: inserts an AutoText block --------------------------------------------------*/ -BOOL SwDoc::InsertGlossary( SwTextBlocks& rBlock, const String& rEntry, +sal_Bool SwDoc::InsertGlossary( SwTextBlocks& rBlock, const String& rEntry, SwPaM& rPaM, SwCrsrShell* pShell ) { - BOOL bRet = FALSE; - USHORT nIdx = rBlock.GetIndex( rEntry ); - if( (USHORT) -1 != nIdx ) + sal_Bool bRet = sal_False; + sal_uInt16 nIdx = rBlock.GetIndex( rEntry ); + if( (sal_uInt16) -1 != nIdx ) { - BOOL bSav_IsInsGlossary = mbInsOnlyTxtGlssry; + sal_Bool bSav_IsInsGlossary = mbInsOnlyTxtGlssry; mbInsOnlyTxtGlssry = rBlock.IsOnlyTextBlock( nIdx ); if( rBlock.BeginGetDoc( nIdx ) ) @@ -159,7 +159,7 @@ BOOL SwDoc::InsertGlossary( SwTextBlocks& rBlock, const String& rEntry, pCntntNd = aCpyPam.GetCntntNode(); aCpyPam.GetPoint()->nContent.Assign( pCntntNd, pCntntNd->Len() ); - StartUndo( UNDO_INSGLOSSARY, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_INSGLOSSARY, NULL ); SwPaM *_pStartCrsr = &rPaM, *__pStartCrsr = _pStartCrsr; do { @@ -186,12 +186,12 @@ BOOL SwDoc::InsertGlossary( SwTextBlocks& rBlock, const String& rEntry, pShell->SaveTblBoxCntnt( &rInsPos ); } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr ); - EndUndo( UNDO_INSGLOSSARY, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL ); UnlockExpFlds(); if( !IsExpFldsLocked() ) UpdateExpFlds(NULL, true); - bRet = TRUE; + bRet = sal_True; } mbInsOnlyTxtGlssry = bSav_IsInsGlossary; } diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 892683123412..fe7b0626300a 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -74,6 +74,7 @@ #include <ndnotxt.hxx> #include <ndole.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <cntfrm.hxx> @@ -84,7 +85,7 @@ #include <dcontact.hxx> #include <swundo.hxx> #include <flypos.hxx> -#include <undobj.hxx> +#include <UndoInsert.hxx> #include <expfld.hxx> // InsertLabel #include <poolfmt.hxx> // PoolVorlagen-Id's #include <docary.hxx> @@ -111,7 +112,7 @@ using ::rtl::OUString; #define DEF_FLY_WIDTH 2268 //Defaultbreite fuer FlyFrms (2268 == 4cm) -static bool lcl_IsItemSet(const SwCntntNode & rNode, USHORT which) +static bool lcl_IsItemSet(const SwCntntNode & rNode, sal_uInt16 which) { bool bResult = false; @@ -189,10 +190,10 @@ SwFrmFmt *SwDoc::MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet ) if( pSet ) // noch ein paar Attribute setzen ? pFmt->SetFmtAttr( *pSet ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoInsLayFmt( pFmt,0,0 )); + GetIDocumentUndoRedo().AppendUndo( + new SwUndoInsLayFmt(pFmt, 0, 0)); } } break; @@ -243,7 +244,7 @@ void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt ) } const SwNodeIndex* pCntIdx = pFmt->GetCntnt().GetCntntIdx(); - if( pCntIdx && !DoesUndo() ) + if (pCntIdx && !GetIDocumentUndoRedo().DoesUndo()) { //Verbindung abbauen, falls es sich um ein OLE-Objekt handelt. SwOLENode* pOLENd = GetNodes()[ pCntIdx->GetIndex()+1 ]->GetOLENode(); @@ -272,11 +273,10 @@ void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt ) // erstmal sind nur Fly's Undofaehig const sal_uInt16 nWh = pFmt->Which(); - if( DoesUndo() && (RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh) ) + if (GetIDocumentUndoRedo().DoesUndo() && + (RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh)) { - // erstmal werden alle Undo - Objecte geloescht. - ClearRedo(); - AppendUndo( new SwUndoDelLayFmt( pFmt )); + GetIDocumentUndoRedo().AppendUndo( new SwUndoDelLayFmt( pFmt )); } else { @@ -291,9 +291,9 @@ void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt ) if ( pTbl ) { std::vector<SwFrmFmt*> aToDeleteFrmFmts; - const ULONG nNodeIdxOfFlyFmt( pCntntIdx->GetIndex() ); + const sal_uLong nNodeIdxOfFlyFmt( pCntntIdx->GetIndex() ); - for ( USHORT i = 0; i < pTbl->Count(); ++i ) + for ( sal_uInt16 i = 0; i < pTbl->Count(); ++i ) { SwFrmFmt* pTmpFmt = (*pTbl)[i]; const SwFmtAnchor &rAnch = pTmpFmt->GetAnchor(); @@ -467,10 +467,9 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource, } } - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoInsLayFmt( pDest,0,0 )); + GetIDocumentUndoRedo().AppendUndo(new SwUndoInsLayFmt(pDest,0,0)); } // sorge dafuer das auch Fly's in Fly's kopiert werden @@ -508,10 +507,9 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource, else pDest->SetFmtAttr( rNewAnchor ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoInsLayFmt( pDest,0,0 )); + GetIDocumentUndoRedo().AppendUndo(new SwUndoInsLayFmt(pDest,0,0)); } } @@ -699,12 +697,12 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos, if( GetRootFrm() ) pFmt->MakeFrms(); // ??? - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - ULONG nNodeIdx = rAnchPos.nNode.GetIndex(); + sal_uLong nNodeIdx = rAnchPos.nNode.GetIndex(); xub_StrLen nCntIdx = rAnchPos.nContent.GetIndex(); - AppendUndo( new SwUndoInsLayFmt( pFmt, nNodeIdx, nCntIdx )); + GetIDocumentUndoRedo().AppendUndo( + new SwUndoInsLayFmt( pFmt, nNodeIdx, nCntIdx )); } SetModified(); @@ -714,7 +712,7 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos, SwFlyFrmFmt* SwDoc::MakeFlySection( RndStdIds eAnchorType, const SwPosition* pAnchorPos, const SfxItemSet* pFlySet, - SwFrmFmt* pFrmFmt, BOOL bCalledFromShell ) + SwFrmFmt* pFrmFmt, sal_Bool bCalledFromShell ) { SwFlyFrmFmt* pFmt = 0; sal_Bool bCallMake = sal_True; @@ -758,7 +756,7 @@ SwFlyFrmFmt* SwDoc::MakeFlySection( RndStdIds eAnchorType, if (bCalledFromShell && !lcl_IsItemSet(*pNewTxtNd, RES_PARATR_ADJUST) && SFX_ITEM_SET == pAnchorNode->GetSwAttrSet(). - GetItemState(RES_PARATR_ADJUST, TRUE, &pItem)) + GetItemState(RES_PARATR_ADJUST, sal_True, &pItem)) static_cast<SwCntntNode *>(pNewTxtNd)->SetAttr(*pItem); pFmt = _MakeFlySection( *pAnchorPos, *pNewTxtNd, @@ -773,7 +771,7 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, { SwFmtAnchor& rAnch = (SwFmtAnchor&)rSet.Get( RES_ANCHOR ); - StartUndo( UNDO_INSLAYFMT, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_INSLAYFMT, NULL ); SwFlyFrmFmt* pFmt = MakeFlySection( rAnch.GetAnchorId(), rPam.GetPoint(), &rSet, pParent ); @@ -830,7 +828,7 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, rTbl.MakeCopy( this, aPos, *pSelBoxes ); // Don't delete a part of a table with row span!! // You could delete the content instead -> ToDo - //rTbl.DeleteSel( this, *pSelBoxes, 0, 0, TRUE, TRUE ); + //rTbl.DeleteSel( this, *pSelBoxes, 0, 0, sal_True, sal_True ); } // wenn Tabelle im Rahmen, dann ohne nachfolgenden TextNode @@ -841,17 +839,21 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, GetNodes().Delete( aIndex, 1 ); //JP erstmal ein Hack, solange keine Flys/Headers/Footers Undofaehig sind -if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht. - DelAllUndoObj(); +// werden erstmal alle Undo - Objecte geloescht. +if( GetIDocumentUndoRedo().DoesUndo() ) +{ + GetIDocumentUndoRedo().DelAllUndoObj(); +} } else { // copy all Pams and then delete all SwPaM* pTmp = (SwPaM*)&rPam; - BOOL bOldFlag = mbCopyIsMove, bOldUndo = mbUndo; - mbCopyIsMove = TRUE; - mbUndo = FALSE; + sal_Bool bOldFlag = mbCopyIsMove; + bool const bOldUndo = GetIDocumentUndoRedo().DoesUndo(); + mbCopyIsMove = sal_True; + GetIDocumentUndoRedo().DoUndo(false); do { if( pTmp->HasMark() && *pTmp->GetPoint() != *pTmp->GetMark() ) @@ -861,7 +863,7 @@ if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht. pTmp = static_cast<SwPaM*>(pTmp->GetNext()); } while ( &rPam != pTmp ); mbCopyIsMove = bOldFlag; - mbUndo = bOldUndo; + GetIDocumentUndoRedo().DoUndo(bOldUndo); pTmp = (SwPaM*)&rPam; do { @@ -878,7 +880,7 @@ if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht. SetModified(); - EndUndo( UNDO_INSLAYFMT, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_INSLAYFMT, NULL ); return pFmt; } @@ -975,10 +977,9 @@ SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg, } } - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoInsLayFmt( pFmt,0,0 )); + GetIDocumentUndoRedo().AppendUndo( new SwUndoInsLayFmt(pFmt, 0, 0) ); } SetModified(); @@ -994,7 +995,7 @@ SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg, sal_Bool TstFlyRange( const SwPaM* pPam, const SwPosition* pFlyPos, RndStdIds nAnchorId ) { - sal_Bool bOk = FALSE; + sal_Bool bOk = sal_False; const SwPaM* pTmp = pPam; do { const sal_uInt32 nFlyIndex = pFlyPos->nNode.GetIndex(); @@ -1158,31 +1159,27 @@ void lcl_CpyAttr( SfxItemSet &rNewSet, const SfxItemSet &rOldSet, sal_uInt16 nWh } -SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, const String& rSeparator, +static SwFlyFrmFmt * +lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, + SwUndoInsertLabel *const pUndo, + SwLabelType const eType, String const& rTxt, String const& rSeparator, const String& rNumberingSeparator, - const sal_Bool bBefore, const sal_uInt16 nId, const ULONG nNdIdx, + const sal_Bool bBefore, const sal_uInt16 nId, const sal_uLong nNdIdx, const String& rCharacterStyle, const sal_Bool bCpyBrd ) { - sal_Bool bWasUndo = DoesUndo(); - SwUndoInsertLabel* pUndo = 0; - if( bWasUndo ) - { - ClearRedo(); - pUndo = new SwUndoInsertLabel( eType, rTxt, rSeparator, rNumberingSeparator, - bBefore, nId, rCharacterStyle, bCpyBrd ); - DoUndo( sal_False ); - } + ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); sal_Bool bTable = sal_False; //Um etwas Code zu sparen. //Erstmal das Feld bauen, weil ueber den Namen die TxtColl besorgt werden //muss - OSL_ENSURE( nId == USHRT_MAX || nId < GetFldTypes()->Count(), "FldType ueberindiziert." ); - SwFieldType *pType = nId != USHRT_MAX ? (*GetFldTypes())[nId] : NULL; - OSL_ENSURE( !pType || pType->Which() == RES_SETEXPFLD, "Falsche Id fuer Label" ); + OSL_ENSURE( nId == USHRT_MAX || nId < rDoc.GetFldTypes()->Count(), + "FldType index out of bounds." ); + SwFieldType *pType = (nId != USHRT_MAX) ? (*rDoc.GetFldTypes())[nId] : NULL; + OSL_ENSURE(!pType || pType->Which() == RES_SETEXPFLD, "wrong Id for Label"); - SwTxtFmtColl *pColl = NULL; + SwTxtFmtColl * pColl = NULL; if( pType ) { for( sal_uInt16 i = pTxtFmtCollTbl->Count(); i; ) @@ -1197,7 +1194,9 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co } if( !pColl ) - pColl = GetTxtCollFromPool( RES_POOLCOLL_LABEL ); + { + pColl = rDoc.GetTxtCollFromPool( RES_POOLCOLL_LABEL ); + } SwTxtNode *pNew = NULL; SwFlyFrmFmt* pNewFmt = NULL; @@ -1211,9 +1210,9 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co //Am Anfang/Ende der Fly-Section den entsprechenden Node mit Feld //einfuegen (Frame wird automatisch erzeugt). { - SwStartNode *pSttNd = GetNodes()[nNdIdx]->GetStartNode(); + SwStartNode *pSttNd = rDoc.GetNodes()[nNdIdx]->GetStartNode(); OSL_ENSURE( pSttNd, "Kein StartNode in InsertLabel." ); - ULONG nNode; + sal_uLong nNode; if( bBefore ) { nNode = pSttNd->GetIndex(); @@ -1231,8 +1230,8 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co pUndo->SetNodePos( nNode ); //Node fuer Beschriftungsabsatz erzeugen. - SwNodeIndex aIdx( GetNodes(), nNode ); - pNew = GetNodes().MakeTxtNode( aIdx, pColl ); + SwNodeIndex aIdx( rDoc.GetNodes(), nNode ); + pNew = rDoc.GetNodes().MakeTxtNode( aIdx, pColl ); } break; @@ -1244,12 +1243,12 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co // Frames erzeugen. //Erstmal das Format zum Fly besorgen und das Layout entkoppeln. - SwFrmFmt *pOldFmt = GetNodes()[nNdIdx]->GetFlyFmt(); + SwFrmFmt *pOldFmt = rDoc.GetNodes()[nNdIdx]->GetFlyFmt(); OSL_ENSURE( pOldFmt, "Format des Fly nicht gefunden." ); pOldFmt->DelFrms(); - pNewFmt = MakeFlyFrmFmt( GetUniqueFrameName(), - GetFrmFmtFromPool( RES_POOLFRM_FRAME )); + pNewFmt = rDoc.MakeFlyFrmFmt( rDoc.GetUniqueFrameName(), + rDoc.GetFrmFmtFromPool(RES_POOLFRM_FRAME) ); /* #i6447#: Only the selected items are copied from the old format. */ @@ -1307,8 +1306,8 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co aFrmSize.SetHeightSizeType( ATT_MIN_SIZE ); pNewSet->Put( aFrmSize ); - SwStartNode* pSttNd = GetNodes().MakeTextSection( - SwNodeIndex( GetNodes().GetEndOfAutotext() ), + SwStartNode* pSttNd = rDoc.GetNodes().MakeTextSection( + SwNodeIndex( rDoc.GetNodes().GetEndOfAutotext() ), SwFlyStartNode, pColl ); pNewSet->Put( SwFmtCntnt( pSttNd )); @@ -1387,7 +1386,7 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co break; default: - OSL_ENSURE( !this, "Neuer LabelType?." ); + OSL_ENSURE(false, "unknown LabelType?"); } OSL_ENSURE( pNew, "No Label inserted" ); if( pNew ) @@ -1407,7 +1406,7 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co aTxt += ' '; } xub_StrLen nIdx = aTxt.Len(); - if ( rTxt.Len() > 0 ) + if( rTxt.Len() > 0 ) { aTxt += rSeparator; } @@ -1429,11 +1428,11 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co pNew->InsertItem( aFmt, nIdx, nIdx ); if(rCharacterStyle.Len()) { - SwCharFmt* pCharFmt = FindCharFmtByName( rCharacterStyle ); + SwCharFmt* pCharFmt = rDoc.FindCharFmtByName(rCharacterStyle); if( !pCharFmt ) { - const USHORT nMyId = SwStyleNameMapper::GetPoolIdFromUIName(rCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT); - pCharFmt = GetCharFmtFromPool( nMyId ); + const sal_uInt16 nMyId = SwStyleNameMapper::GetPoolIdFromUIName(rCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT); + pCharFmt = rDoc.GetCharFmtFromPool( nMyId ); } if (pCharFmt) { @@ -1453,7 +1452,8 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co } else { - SwTableNode *pNd = GetNodes()[nNdIdx]->GetStartNode()->GetTableNode(); + SwTableNode *const pNd = + rDoc.GetNodes()[nNdIdx]->GetStartNode()->GetTableNode(); SwTable &rTbl = pNd->GetTable(); if ( !rTbl.GetFrmFmt()->GetKeep().GetValue() ) rTbl.GetFrmFmt()->SetFmtAttr( SvxFmtKeepItem( sal_True, RES_KEEP ) ); @@ -1461,57 +1461,70 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co pUndo->SetUndoKeep(); } } - SetModified(); + rDoc.SetModified(); } - if( pUndo ) - AppendUndo( pUndo ); + return pNewFmt; +} + +SwFlyFrmFmt * +SwDoc::InsertLabel( + SwLabelType const eType, String const& rTxt, String const& rSeparator, + String const& rNumberingSeparator, + sal_Bool const bBefore, sal_uInt16 const nId, sal_uLong const nNdIdx, + String const& rCharacterStyle, + sal_Bool const bCpyBrd ) +{ + SwUndoInsertLabel * pUndo(0); + if (GetIDocumentUndoRedo().DoesUndo()) + { + pUndo = new SwUndoInsertLabel( + eType, rTxt, rSeparator, rNumberingSeparator, + bBefore, nId, rCharacterStyle, bCpyBrd ); + } + + SwFlyFrmFmt *const pNewFmt = lcl_InsertLabel(*this, pTxtFmtCollTbl, pUndo, + eType, rTxt, rSeparator, rNumberingSeparator, bBefore, + nId, nNdIdx, rCharacterStyle, bCpyBrd); + + if (pUndo) + { + GetIDocumentUndoRedo().AppendUndo(pUndo); + } else - DelAllUndoObj(); - DoUndo( bWasUndo ); + { + GetIDocumentUndoRedo().DelAllUndoObj(); + } return pNewFmt; } + /************************************************************************* |* |* SwDoc::InsertDrawLabel() |* |*************************************************************************/ -SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, +static SwFlyFrmFmt * +lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, + SwUndoInsertLabel *const pUndo, SwDrawFrmFmt *const pOldFmt, + String const& rTxt, const String& rSeparator, const String& rNumberSeparator, const sal_uInt16 nId, const String& rCharacterStyle, SdrObject& rSdrObj ) { - - SwDrawContact* pContact = (SwDrawContact*)GetUserCall( &rSdrObj ); - if ( !pContact ) - return 0; + ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); + ::sw::DrawUndoGuard const drawUndoGuard(rDoc.GetIDocumentUndoRedo()); OSL_ENSURE( RES_DRAWFRMFMT == pContact->GetFmt()->Which(), "Kein DrawFrmFmt" ); - SwDrawFrmFmt* pOldFmt = (SwDrawFrmFmt *)pContact->GetFmt(); - if( !pOldFmt ) - return 0; - - sal_Bool bWasUndo = DoesUndo(); - sal_Bool bWasNoDrawUndo = IsNoDrawUndoObj(); - SwUndoInsertLabel* pUndo = 0; - if( bWasUndo ) - { - ClearRedo(); - pUndo = new SwUndoInsertLabel( - LTYPE_DRAW, rTxt, rSeparator, rNumberSeparator, sal_False, nId, rCharacterStyle, sal_False ); - DoUndo( sal_False ); - SetNoDrawUndoObj( sal_True ); - } - // Erstmal das Feld bauen, weil ueber den Namen die TxtColl besorgt // werden muss - OSL_ENSURE( nId == USHRT_MAX || nId < GetFldTypes()->Count(), "FldType overflow" ); - SwFieldType *pType = nId != USHRT_MAX ? (*GetFldTypes())[nId] : 0; + OSL_ENSURE( nId == USHRT_MAX || nId < rDoc.GetFldTypes()->Count(), + "FldType index out of bounds" ); + SwFieldType *pType = nId != USHRT_MAX ? (*rDoc.GetFldTypes())[nId] : 0; OSL_ENSURE( !pType || pType->Which() == RES_SETEXPFLD, "Wrong label id" ); SwTxtFmtColl *pColl = NULL; @@ -1529,7 +1542,9 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, } if( !pColl ) - pColl = GetTxtCollFromPool( RES_POOLCOLL_LABEL ); + { + pColl = rDoc.GetTxtCollFromPool( RES_POOLCOLL_LABEL ); + } SwTxtNode* pNew = NULL; SwFlyFrmFmt* pNewFmt = NULL; @@ -1568,8 +1583,8 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, // Den Rahmen ggf. in den Hintergrund schicken. // Consider 'invisible' hell layer. - if ( GetHellId() != nLayerId && - GetInvisibleHellId() != nLayerId ) + if ( rDoc.GetHellId() != nLayerId && + rDoc.GetInvisibleHellId() != nLayerId ) { SvxOpaqueItem aOpaque( RES_OPAQUE ); aOpaque.SetValue( sal_True ); @@ -1598,11 +1613,12 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, pNewSet->Put( pOldFmt->GetULSpace() ); SwStartNode* pSttNd = - GetNodes().MakeTextSection( SwNodeIndex( GetNodes().GetEndOfAutotext() ), + rDoc.GetNodes().MakeTextSection( + SwNodeIndex( rDoc.GetNodes().GetEndOfAutotext() ), SwFlyStartNode, pColl ); - pNewFmt = MakeFlyFrmFmt( GetUniqueFrameName(), - GetFrmFmtFromPool( RES_POOLFRM_FRAME ) ); + pNewFmt = rDoc.MakeFlyFrmFmt( rDoc.GetUniqueFrameName(), + rDoc.GetFrmFmtFromPool( RES_POOLFRM_FRAME ) ); // JP 28.10.99: Bug 69487 - set border and shadow to default if the // template contains any. @@ -1641,11 +1657,15 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, pNewSet->ClearItem(); pNewSet->Put( SwFmtSurround( SURROUND_NONE ) ); - if( nLayerId == GetHellId() ) - rSdrObj.SetLayer( GetHeavenId() ); + if (nLayerId == rDoc.GetHellId()) + { // Consider drawing objects in 'invisible' hell layer - else if( nLayerId == GetInvisibleHellId() ) - rSdrObj.SetLayer( GetInvisibleHeavenId() ); + rSdrObj.SetLayer( rDoc.GetHeavenId() ); + } + else if (nLayerId == rDoc.GetInvisibleHellId()) + { + rSdrObj.SetLayer( rDoc.GetInvisibleHeavenId() ); + } pNewSet->Put( SvxLRSpaceItem( RES_LR_SPACE ) ); pNewSet->Put( SvxULSpaceItem( RES_UL_SPACE ) ); @@ -1714,11 +1734,11 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, pNew->InsertItem( aFmt, nIdx, nIdx ); if ( rCharacterStyle.Len() ) { - SwCharFmt* pCharFmt = FindCharFmtByName( rCharacterStyle ); + SwCharFmt * pCharFmt = rDoc.FindCharFmtByName(rCharacterStyle); if ( !pCharFmt ) { - const USHORT nMyId = SwStyleNameMapper::GetPoolIdFromUIName( rCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ); - pCharFmt = GetCharFmtFromPool( nMyId ); + const sal_uInt16 nMyId = SwStyleNameMapper::GetPoolIdFromUIName( rCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ); + pCharFmt = rDoc.GetCharFmtFromPool( nMyId ); } if ( pCharFmt ) { @@ -1730,18 +1750,54 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, } } - if( pUndo ) + return pNewFmt; +} + +SwFlyFrmFmt* SwDoc::InsertDrawLabel( + String const& rTxt, + String const& rSeparator, + String const& rNumberSeparator, + sal_uInt16 const nId, + String const& rCharacterStyle, + SdrObject& rSdrObj ) +{ + SwDrawContact *const pContact = + static_cast<SwDrawContact*>(GetUserCall( &rSdrObj )); + OSL_ENSURE( RES_DRAWFRMFMT == pContact->GetFmt()->Which(), + "InsertDrawLabel(): not a DrawFrmFmt" ); + if (!pContact) + return 0; + + SwDrawFrmFmt* pOldFmt = (SwDrawFrmFmt *)pContact->GetFmt(); + if (!pOldFmt) + return 0; + + SwUndoInsertLabel * pUndo = 0; + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().ClearRedo(); + pUndo = new SwUndoInsertLabel( + LTYPE_DRAW, rTxt, rSeparator, rNumberSeparator, sal_False, + nId, rCharacterStyle, sal_False ); + } + + SwFlyFrmFmt *const pNewFmt = lcl_InsertDrawLabel( + *this, pTxtFmtCollTbl, pUndo, pOldFmt, + rTxt, rSeparator, rNumberSeparator, nId, rCharacterStyle, rSdrObj); + + if (pUndo) { - AppendUndo( pUndo ); - SetNoDrawUndoObj( bWasNoDrawUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else - DelAllUndoObj(); - DoUndo( bWasUndo ); + { + GetIDocumentUndoRedo().DelAllUndoObj(); + } return pNewFmt; } + /************************************************************************* |* |* IDocumentTimerAccess-methods @@ -1803,7 +1859,7 @@ IMPL_LINK( SwDoc, DoIdleJobs, Timer *, pTimer ) if (GetRootFrm()->IsNeedGrammarCheck()) { - BOOL bIsOnlineSpell = pSh->GetViewOptions()->IsOnlineSpell(); + sal_Bool bIsOnlineSpell = pSh->GetViewOptions()->IsOnlineSpell(); sal_Bool bIsAutoGrammar = sal_False; SvtLinguConfig().GetProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( @@ -2192,7 +2248,7 @@ short SwDoc::GetTextDirection( const SwPosition& rPos, if( !pItem ) { - const SwPageDesc* pPgDsc = pNd->FindPageDesc( FALSE ); + const SwPageDesc* pPgDsc = pNd->FindPageDesc( sal_False ); if( pPgDsc ) pItem = &pPgDsc->GetMaster().GetFrmDir(); } diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 45e3792f174b..a396ef295d27 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -97,6 +97,7 @@ #include <IGrammarContact.hxx> #include <tblsel.hxx> #include <MarkManager.hxx> +#include <UndoManager.hxx> #include <unochart.hxx> #include <cmdid.h> // fuer den dflt - Printer in SetJob @@ -191,7 +192,7 @@ void StartGrammarChecking( SwDoc &rDoc ) /* * interne Funktionen */ -BOOL lcl_DelFmtIndizes( const SwFrmFmtPtr& rpFmt, void* ) +sal_Bool lcl_DelFmtIndizes( const SwFrmFmtPtr& rpFmt, void* ) { SwFmtCntnt &rFmtCntnt = (SwFmtCntnt&)rpFmt->GetCntnt(); if ( rFmtCntnt.GetCntntIdx() ) @@ -199,18 +200,20 @@ BOOL lcl_DelFmtIndizes( const SwFrmFmtPtr& rpFmt, void* ) SwFmtAnchor &rFmtAnchor = (SwFmtAnchor&)rpFmt->GetAnchor(); if ( rFmtAnchor.GetCntntAnchor() ) rFmtAnchor.SetAnchor( 0 ); - return TRUE; + return sal_True; } /* * exportierte Methoden */ -SwDoc::SwDoc() : - aNodes( this ), - aUndoNodes( this ), +SwDoc::SwDoc() + : m_pNodes( new SwNodes(this) ) + , mpAttrPool(new SwAttrPool(this)), pMarkManager(new ::sw::mark::MarkManager(*this)), m_pMetaFieldManager(new ::sw::MetaFieldManager()), + m_pUndoManager(new ::sw::UndoManager( + ::std::auto_ptr<SwNodes>(new SwNodes(this)), *this, *this, *this)), pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ), pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, pDfltFrmFmt ) ), pColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, pDfltFrmFmt ) ), @@ -228,7 +231,6 @@ SwDoc::SwDoc() : pDefTOXBases( new SwDefTOXBase_Impl() ), pLayout( 0 ), // Rootframe des spezifischen Layouts. pDrawModel( 0 ), - pUndos( new SwUndos( 0, 20 ) ), pUpdtFlds( new SwDocUpdtFld() ), pFldTypes( new SwFldTypes() ), pVirDev( 0 ), @@ -242,7 +244,6 @@ SwDoc::SwDoc() : pFtnIdxs( new SwFtnIdxs ), pDocStat( new SwDocStat ), pDocShell( 0 ), - pDocShRef( 0 ), pLinkMgr( new sfx2::LinkManager( 0 ) ), pACEWord( 0 ), pURLStateChgd( 0 ), @@ -264,10 +265,6 @@ SwDoc::SwDoc() : pChartControllerHelper( 0 ), mpListItemsList( new tImplSortedNodeNumList() ), // #i83479# m_pXmlIdRegistry(), - nUndoPos( 0 ), - nUndoSavePos( 0 ), - nUndoCnt( 0 ), - nUndoSttEnd( 0 ), nAutoFmtRedlnCommentNo( 0 ), nLinkUpdMode( GLOBALSETTING ), eFldUpdMode( AUTOUPD_GLOBALSETTING ), @@ -290,13 +287,11 @@ SwDoc::SwDoc() : mbGlossDoc = mbModified = mbDtor = - mbUndo = mbPageNums = mbLoaded = mbUpdateExpFld = mbNewDoc = mbCopyIsMove = - mbNoDrawUndoObj = mbBrowseMode = mbInReading = mbInXMLImport = @@ -320,7 +315,6 @@ SwDoc::SwDoc() : mbApplyWorkaroundForB6375613 = false; - mbGroupUndo = mbNewFldLst = mbVisibleLinks = mbPurgeOLE = @@ -344,6 +338,7 @@ SwDoc::SwDoc() : mbUseFormerObjectPos = aOptions.IsUseObjectPositioning(); mbUseFormerTextWrapping = aOptions.IsUseOurTextWrapping(); mbConsiderWrapOnObjPos = aOptions.IsConsiderWrappingStyle(); + mbMathBaselineAlignment = false; // default for *old* documents is 'off' mbAddFlyOffsets = false; // hidden mbOldNumbering = false; // hidden mbUseHiResolutionVirtualDevice = true; // hidden @@ -406,8 +401,10 @@ SwDoc::SwDoc() : // Counting of phantoms depends on <IsOldNumbering()> pOutlineRule->SetCountPhantoms( !get(IDocumentSettingAccess::OLD_NUMBERING) ); - new SwTxtNode( SwNodeIndex( aUndoNodes.GetEndOfContent() ), pDfltTxtFmtColl ); - new SwTxtNode( SwNodeIndex( aNodes.GetEndOfContent() ), + new SwTxtNode( + SwNodeIndex(GetUndoManager().GetUndoNodes().GetEndOfContent()), + pDfltTxtFmtColl ); + new SwTxtNode( SwNodeIndex( GetNodes().GetEndOfContent() ), GetTxtCollFromPool( RES_POOLCOLL_STANDARD )); // den eigenen IdleTimer setzen @@ -443,7 +440,14 @@ SwDoc::SwDoc() : */ SwDoc::~SwDoc() { - SwPauseThreadStarting aPauseThreadStarting; // #i73788# + // nothing here should create Undo actions! + GetIDocumentUndoRedo().DoUndo(false); + + if (pDocShell) + { + pDocShell->SetUndoManager(0); + } + // #i83479# delete mpListItemsList; @@ -486,9 +490,7 @@ SwDoc::~SwDoc() delete pPgPViewPrtData; - mbUndo = FALSE; // immer das Undo abschalten !! - // damit die Fussnotenattribute die Fussnotennodes in Frieden lassen. - mbDtor = TRUE; + mbDtor = sal_True; DELETEZ( pLayout ); @@ -504,7 +506,7 @@ SwDoc::~SwDoc() // die BaseLinks freigeben. { - for( USHORT n = pLinkMgr->GetServers().Count(); n; ) + for( sal_uInt16 n = pLinkMgr->GetServers().Count(); n; ) pLinkMgr->GetServers()[ --n ]->Closed(); if( pLinkMgr->GetLinks().Count() ) @@ -513,13 +515,14 @@ SwDoc::~SwDoc() // die KapitelNummern / Nummern muessen vor den Vorlage geloescht werden // ansonsten wird noch staendig geupdatet !!! - aNodes.pOutlineNds->Remove( USHORT(0), aNodes.pOutlineNds->Count() ); - aUndoNodes.pOutlineNds->Remove( USHORT(0), aUndoNodes.pOutlineNds->Count() ); + m_pNodes->pOutlineNds->Remove(sal_uInt16(0), m_pNodes->pOutlineNds->Count()); + SwNodes & rUndoNodes( GetUndoManager().GetUndoNodes() ); + rUndoNodes.pOutlineNds->Remove(sal_uInt16(0), rUndoNodes.pOutlineNds->Count()); - pFtnIdxs->Remove( USHORT(0), pFtnIdxs->Count() ); + pFtnIdxs->Remove( sal_uInt16(0), pFtnIdxs->Count() ); - pUndos->DeleteAndDestroy( 0, pUndos->Count() ); //Es koennen in den Attributen noch - //noch indizes angemeldet sein. + // indices could be registered in attributes + m_pUndoManager->DelAllUndoObj(); // in den BookMarks sind Indizies auf den Content. Diese muessen vorm // loesche der Nodes geloescht werden. @@ -538,7 +541,7 @@ SwDoc::~SwDoc() //JP: alt - loeschen ohne Flag ist teuer; Modify wird verschickt! // aTOXTypes.DeleteAndDestroy( 0, aTOXTypes.Count() ); { - for( USHORT n = pTOXTypes->Count(); n; ) + for( sal_uInt16 n = pTOXTypes->Count(); n; ) { (*pTOXTypes)[ --n ]->SetInDocDTOR(); delete (*pTOXTypes)[ n ]; @@ -562,8 +565,8 @@ SwDoc::~SwDoc() // Inhaltssections loeschen // nicht erst durch den SwNodes-DTOR, damit Formate // keine Abhaengigen mehr haben. - aNodes.DelNodes( SwNodeIndex( aNodes ), aNodes.Count() ); - aUndoNodes.DelNodes( SwNodeIndex( aUndoNodes ), aUndoNodes.Count() ); + m_pNodes->DelNodes( SwNodeIndex(*m_pNodes), m_pNodes->Count() ); + rUndoNodes.DelNodes( SwNodeIndex( rUndoNodes ), rUndoNodes.Count() ); // Formate loeschen, spaeter mal permanent machen. @@ -653,7 +656,6 @@ SwDoc::~SwDoc() delete pFtnIdxs; delete pFldTypes; delete pTOXTypes; - delete pUndos; delete pDocStat; delete pEmptyPageFmt; delete pColumnContFmt; @@ -709,7 +711,15 @@ void SwDoc::SetDocShell( SwDocShell* pDSh ) { if( pDocShell != pDSh ) { + if (pDocShell) + { + pDocShell->SetUndoManager(0); + } pDocShell = pDSh; + if (pDocShell) + { + pDocShell->SetUndoManager(& GetUndoManager()); + } pLinkMgr->SetPersist( pDocShell ); //JP 27.08.98: Bug 55570 - DocShell Pointer auch am DrawModel setzen @@ -741,9 +751,8 @@ SfxObjectShell* SwDoc::GetPersist() const void SwDoc::ClearDoc() { - BOOL bOldUndo = mbUndo; - DelAllUndoObj(); - mbUndo = FALSE; // immer das Undo abschalten !! + GetIDocumentUndoRedo().DelAllUndoObj(); + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); // Undo-Benachrichtigung vom Draw abschalten if( pDrawModel ) @@ -753,7 +762,7 @@ void SwDoc::ClearDoc() } // stehen noch FlyFrames rum, loesche auch diese - USHORT n; + sal_uInt16 n; while ( 0 != (n = GetSpzFrmFmts()->Count()) ) DelLayoutFmt((*pSpzFrmFmtTbl)[n-1]); OSL_ENSURE( !pDrawModel || !pDrawModel->GetPage(0)->GetObjCount(), @@ -783,8 +792,8 @@ void SwDoc::ClearDoc() pFirstNd->SetAttr( SwFmtPageDesc( pDummyPgDsc )); SwPosition aPos( *pFirstNd, SwIndex( pFirstNd )); - ::PaMCorrAbs( aSttIdx, SwNodeIndex( GetNodes().GetEndOfContent() ), - aPos ); + SwPaM const tmpPaM(aSttIdx, SwNodeIndex(GetNodes().GetEndOfContent())); + ::PaMCorrAbs(tmpPaM, aPos); } GetNodes().Delete( aSttIdx, @@ -849,8 +858,6 @@ void SwDoc::ClearDoc() pFirstNd->ResetAllAttr(); // delete now the dummy pagedesc DelPageDesc( nDummyPgDsc ); - - mbUndo = bOldUndo; } void SwDoc::SetPreViewPrtData( const SwPagePreViewPrtData* pNew ) @@ -903,11 +910,11 @@ IGrammarContact* getGrammarContact( const SwTxtNode& rTxtNode ) // #i42634# Moved common code of SwReader::Read() and SwDocShell::UpdateLinks() // to new SwDoc::UpdateLinks(): -void SwDoc::UpdateLinks( BOOL bUI ) +void SwDoc::UpdateLinks( sal_Bool bUI ) { SfxObjectCreateMode eMode; - USHORT nLinkMode = getLinkUpdateMode( true ); - USHORT nUpdateDocMode = GetDocShell()->GetUpdateDocMode(); + sal_uInt16 nLinkMode = getLinkUpdateMode( true ); + sal_uInt16 nUpdateDocMode = GetDocShell()->GetUpdateDocMode(); if( GetDocShell() && (nLinkMode != NEVER || document::UpdateDocMode::FULL_UPDATE == nUpdateDocMode) && GetLinkManager().GetLinks().Count() && @@ -918,13 +925,13 @@ void SwDoc::UpdateLinks( BOOL bUI ) !GetDocShell()->IsPreview() ) { ViewShell* pVSh = 0; - BOOL bAskUpdate = nLinkMode == MANUAL; - BOOL bUpdate = TRUE; + sal_Bool bAskUpdate = nLinkMode == MANUAL; + sal_Bool bUpdate = sal_True; switch(nUpdateDocMode) { - case document::UpdateDocMode::NO_UPDATE: bUpdate = FALSE;break; - case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = FALSE; break; - case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = TRUE; break; + case document::UpdateDocMode::NO_UPDATE: bUpdate = sal_False;break; + case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = sal_False; break; + case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = sal_True; break; } if( bUpdate && (bUI || !bAskUpdate) ) { @@ -936,10 +943,10 @@ void SwDoc::UpdateLinks( BOOL bUI ) ViewShell aVSh( *this, 0, 0 ); SET_CURR_SHELL( &aVSh ); - GetLinkManager().UpdateAllLinks( bAskUpdate , TRUE, FALSE, pDlgParent ); + GetLinkManager().UpdateAllLinks( bAskUpdate , sal_True, sal_False, pDlgParent ); } else - GetLinkManager().UpdateAllLinks( bAskUpdate, TRUE, FALSE, pDlgParent ); + GetLinkManager().UpdateAllLinks( bAskUpdate, sal_True, sal_False, pDlgParent ); } } @@ -1000,6 +1007,30 @@ SwDoc::GetMetaFieldManager() return *m_pMetaFieldManager; } +::sw::UndoManager & +SwDoc::GetUndoManager() +{ + return *m_pUndoManager; +} + +::sw::UndoManager const& +SwDoc::GetUndoManager() const +{ + return *m_pUndoManager; +} + +IDocumentUndoRedo & +SwDoc::GetIDocumentUndoRedo() +{ + return *m_pUndoManager; +} + +IDocumentUndoRedo const& +SwDoc::GetIDocumentUndoRedo() const +{ + return *m_pUndoManager; +} + void SwDoc::InitTOXTypes() { ShellResource* pShellRes = ViewShell::GetShellRes(); @@ -1023,7 +1054,7 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const { SwDoc* pRet = new SwDoc; //copy settings - USHORT aRangeOfDefaults[] = { + sal_uInt16 aRangeOfDefaults[] = { RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_PARATR_BEGIN, RES_PARATR_END-1, @@ -1034,8 +1065,8 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const SfxItemSet aNewDefaults( pRet->GetAttrPool(), aRangeOfDefaults ); - USHORT nWhich; - USHORT nRange = 0; + sal_uInt16 nWhich; + sal_uInt16 nRange = 0; while( aRangeOfDefaults[nRange] != 0) { for( nWhich = aRangeOfDefaults[nRange]; nWhich < aRangeOfDefaults[nRange + 1]; ++nWhich ) @@ -1081,23 +1112,31 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const // COMPATIBILITY FLAGS END // pRet->ReplaceStyles( * const_cast< SwDoc*>( this )); - SfxObjectShellRef aDocShellRef = const_cast< SwDocShell* >( GetDocShell() ); - pRet->SetRefForDocShell( boost::addressof(aDocShellRef) ); - SfxObjectShellRef xRetShell = new SwDocShell( pRet, SFX_CREATE_MODE_STANDARD ); + + // we have to use pointer here, since the callee has to decide whether SfxObjectShellLock or SfxObjectShellRef should be used + // sometimes the object will be returned with refcount set to 0 ( if no DoInitNew is done ) + SfxObjectShell* pRetShell = new SwDocShell( pRet, SFX_CREATE_MODE_STANDARD ); if( bCallInitNew ) - xRetShell->DoInitNew(); + { + // it could happen that DoInitNew creates model, that increases the refcount of the object + pRetShell->DoInitNew(); + } + //copy content pRet->Paste( *this ); - pRet->SetRefForDocShell( 0 ); - return xRetShell; + + // remove the temporary shell if it is there as it was done before + pRet->SetTmpDocShell( (SfxObjectShell*)NULL ); + + return pRetShell; } /*-- 08.05.2009 10:52:40--------------------------------------------------- - copy document content - code from SwFEShell::Paste( SwDoc* , BOOL ) + copy document content - code from SwFEShell::Paste( SwDoc* , sal_Bool ) -----------------------------------------------------------------------*/ void SwDoc::Paste( const SwDoc& rSource ) { -// this has to be empty const USHORT nStartPageNumber = GetPhyPageNum(); +// this has to be empty const sal_uInt16 nStartPageNumber = GetPhyPageNum(); // until the end of the NodesArray SwNodeIndex aSourceIdx( rSource.GetNodes().GetEndOfExtras(), 2 ); SwPaM aCpyPam( aSourceIdx ); //DocStart @@ -1108,7 +1147,7 @@ void SwDoc::Paste( const SwDoc& rSource ) aCpyPam.SetMark(); aCpyPam.Move( fnMoveForward, fnGoDoc ); - this->StartUndo( UNDO_INSGLOSSARY, NULL ); + this->GetIDocumentUndoRedo().StartUndo( UNDO_INSGLOSSARY, NULL ); this->LockExpFlds(); { @@ -1143,9 +1182,9 @@ void SwDoc::Paste( const SwDoc& rSource ) //additionally copy page bound frames if( /*bIncludingPageFrames && */rSource.GetSpzFrmFmts()->Count() ) { - for ( USHORT i = 0; i < rSource.GetSpzFrmFmts()->Count(); ++i ) + for ( sal_uInt16 i = 0; i < rSource.GetSpzFrmFmts()->Count(); ++i ) { - BOOL bInsWithFmt = TRUE; + sal_Bool bInsWithFmt = sal_True; const SwFrmFmt& rCpyFmt = *(*rSource.GetSpzFrmFmts())[i]; if( bInsWithFmt ) { @@ -1162,7 +1201,7 @@ void SwDoc::Paste( const SwDoc& rSource ) } } - this->EndUndo( UNDO_INSGLOSSARY, NULL ); + this->GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL ); UnlockExpFlds(); UpdateFlds(NULL, false); diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 0944e97a48c0..caf34812dd9e 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <tools/date.hxx> #include <tools/time.hxx> @@ -36,11 +37,14 @@ #include <ftninfo.hxx> #include <ftnidx.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <doctxm.hxx> // pTOXBaseRing #include <poolfmt.hxx> -#include <undobj.hxx> +#include <UndoCore.hxx> +#include <UndoRedline.hxx> +#include <UndoNumbering.hxx> #include <swundo.hxx> #include <SwUndoFmt.hxx> #include <rolbck.hxx> @@ -62,7 +66,7 @@ #include <map> -inline BYTE GetUpperLvlChg( BYTE nCurLvl, BYTE nLevel, USHORT nMask ) +inline sal_uInt8 GetUpperLvlChg( sal_uInt8 nCurLvl, sal_uInt8 nLevel, sal_uInt16 nMask ) { if( 1 < nLevel ) { @@ -71,7 +75,7 @@ inline BYTE GetUpperLvlChg( BYTE nCurLvl, BYTE nLevel, USHORT nMask ) else nCurLvl = 0; } - return static_cast<BYTE>((nMask - 1) & ~(( 1 << nCurLvl ) - 1)); + return static_cast<sal_uInt8>((nMask - 1) & ~(( 1 << nCurLvl ) - 1)); } void SwDoc::SetOutlineNumRule( const SwNumRule& rRule ) @@ -91,7 +95,7 @@ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule ) *this); // assure that the outline numbering rule is an automatic rule - pOutlineRule->SetAutoRule( TRUE ); + pOutlineRule->SetAutoRule( sal_True ); // teste ob die evt. gesetzen CharFormate in diesem Document // definiert sind @@ -116,7 +120,7 @@ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule ) } PropagateOutlineRule(); - pOutlineRule->SetInvalidRule(TRUE); + pOutlineRule->SetInvalidRule(sal_True); UpdateNumRule(); // gibt es Fussnoten && gilt Kapitelweises Nummerieren, dann updaten @@ -130,7 +134,7 @@ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule ) void SwDoc::PropagateOutlineRule() { - for (USHORT n = 0; n < pTxtFmtCollTbl->Count(); n++) + for (sal_uInt16 n = 0; n < pTxtFmtCollTbl->Count(); n++) { SwTxtFmtColl *pColl = (*pTxtFmtCollTbl)[n]; @@ -139,7 +143,7 @@ void SwDoc::PropagateOutlineRule() SwClientIter aIter(*pColl); // Check only the list style, which is set at the paragraph style - const SwNumRuleItem & rCollRuleItem = pColl->GetNumRule( FALSE ); + const SwNumRuleItem & rCollRuleItem = pColl->GetNumRule( sal_False ); // Check on document setting OUTLINE_LEVEL_YIELDS_OUTLINE_RULE no longer needed. if ( rCollRuleItem.GetValue().Len() == 0 ) @@ -158,21 +162,21 @@ void SwDoc::PropagateOutlineRule() } // Hoch-/Runterstufen -BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) +sal_Bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) { if( !GetNodes().GetOutLineNds().Count() || !nOffset ) - return FALSE; + return sal_False; // den Bereich feststellen const SwOutlineNodes& rOutlNds = GetNodes().GetOutLineNds(); const SwNodePtr pSttNd = (SwNodePtr)&rPam.Start()->nNode.GetNode(); const SwNodePtr pEndNd = (SwNodePtr)&rPam.End()->nNode.GetNode(); - USHORT nSttPos, nEndPos; + sal_uInt16 nSttPos, nEndPos; if( !rOutlNds.Seek_Entry( pSttNd, &nSttPos ) && !nSttPos-- ) // wir stehen in keiner "Outline-Section" - return FALSE; + return sal_False; if( rOutlNds.Seek_Entry( pEndNd, &nEndPos ) ) ++nEndPos; @@ -180,7 +184,7 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) // jetzt haben wir unseren Bereich im OutlineNodes-Array // dann prufe ersmal, ob nicht unterebenen aufgehoben werden // (Stufung ueber die Grenzen) - USHORT n; + sal_uInt16 n; // so, dann koennen wir: // 1. Vorlagen-Array anlegen @@ -296,12 +300,12 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) */ if (aCollArr[n] != NULL) { - USHORT m = n; + sal_uInt16 m = n; int nCount = nNum; while (nCount > 0 && m + nStep >= 0 && m + nStep < MAXLEVEL) { - m = static_cast<USHORT>(m + nStep); + m = static_cast<sal_uInt16>(m + nStep); if (aCollArr[m] != NULL) nCount--; @@ -346,13 +350,13 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) } if (! bMoveApplicable ) - return FALSE; + return sal_False; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - StartUndo(UNDO_OUTLINE_LR, NULL); - AppendUndo( new SwUndoOutlineLeftRight( rPam, nOffset ) ); + GetIDocumentUndoRedo().StartUndo(UNDO_OUTLINE_LR, NULL); + SwUndo *const pUndoOLR( new SwUndoOutlineLeftRight( rPam, nOffset ) ); + GetIDocumentUndoRedo().AppendUndo(pUndoOLR); } // 2. allen Nodes die neue Vorlage zuweisen @@ -391,48 +395,52 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) n++; // Undo ??? } - if (DoesUndo()) - EndUndo(UNDO_OUTLINE_LR, NULL); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().EndUndo(UNDO_OUTLINE_LR, NULL); + } ChkCondColls(); SetModified(); - return TRUE; + return sal_True; } // Hoch-/Runter - Verschieben ! -BOOL SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) +sal_Bool SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) { // kein Verschiebung in den Sonderbereichen const SwPosition& rStt = *rPam.Start(), & rEnd = &rStt == rPam.GetPoint() ? *rPam.GetMark() : *rPam.GetPoint(); if( !GetNodes().GetOutLineNds().Count() || !nOffset || - rStt.nNode.GetIndex() < aNodes.GetEndOfExtras().GetIndex() || - rEnd.nNode.GetIndex() < aNodes.GetEndOfExtras().GetIndex() ) - return FALSE; + (rStt.nNode.GetIndex() < GetNodes().GetEndOfExtras().GetIndex()) || + (rEnd.nNode.GetIndex() < GetNodes().GetEndOfExtras().GetIndex())) + { + return sal_False; + } - USHORT nAktPos = 0; + sal_uInt16 nAktPos = 0; SwNodeIndex aSttRg( rStt.nNode ), aEndRg( rEnd.nNode ); int nOutLineLevel = MAXLEVEL; //<-end,zhaojianwei SwNode* pSrch = &aSttRg.GetNode(); if( pSrch->IsTxtNode()) - nOutLineLevel = static_cast<BYTE>(((SwTxtNode*)pSrch)->GetAttrOutlineLevel()-1);//<-end,zhaojianwei + nOutLineLevel = static_cast<sal_uInt8>(((SwTxtNode*)pSrch)->GetAttrOutlineLevel()-1);//<-end,zhaojianwei SwNode* pEndSrch = &aEndRg.GetNode(); if( !GetNodes().GetOutLineNds().Seek_Entry( pSrch, &nAktPos ) ) { if( !nAktPos ) - return FALSE; // Promoting or demoting before the first outline => no. + return sal_False; // Promoting or demoting before the first outline => no. if( --nAktPos ) aSttRg = *GetNodes().GetOutLineNds()[ nAktPos ]; else if( 0 > nOffset ) - return FALSE; // Promoting at the top of document?! + return sal_False; // Promoting at the top of document?! else aSttRg = *GetNodes().GetEndOfContent().StartOfSectionNode(); } - USHORT nTmpPos = 0; + sal_uInt16 nTmpPos = 0; // If the given range ends at an outlined text node we have to decide if it has to be a part of // the moving range or not. Normally it will be a sub outline of our chapter // and has to be moved, too. But if the chapter ends with a table(or a section end), @@ -485,14 +493,14 @@ BOOL SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) aEndRg++; // calculation of the new position - if( nOffset < 0 && nAktPos < USHORT(-nOffset) ) + if( nOffset < 0 && nAktPos < sal_uInt16(-nOffset) ) pNd = GetNodes().GetEndOfContent().StartOfSectionNode(); else if( nAktPos + nOffset >= GetNodes().GetOutLineNds().Count() ) pNd = &GetNodes().GetEndOfContent(); else pNd = GetNodes().GetOutLineNds()[ nAktPos + nOffset ]; - ULONG nNewPos = pNd->GetIndex(); + sal_uLong nNewPos = pNd->GetIndex(); // And now a correction of the insert position if necessary... SwNodeIndex aInsertPos( *pNd, -1 ); @@ -532,7 +540,7 @@ BOOL SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) if( pNd->IsTableNode() ) pNd = pNd->StartOfSectionNode(); if( pNd->FindTableNode() ) - return FALSE; + return sal_False; OSL_ENSURE( aSttRg.GetIndex() > nNewPos || nNewPos >= aEndRg.GetIndex(), "Position liegt im MoveBereich" ); @@ -541,19 +549,19 @@ BOOL SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) // setze die Position auf den Dokumentanfang. // Sollten da Bereiche oder Tabellen stehen, so werden sie nach // hinten verschoben. - nNewPos = Max( nNewPos, aNodes.GetEndOfExtras().GetIndex() + 2 ); + nNewPos = Max( nNewPos, GetNodes().GetEndOfExtras().GetIndex() + 2 ); long nOffs = nNewPos - ( 0 < nOffset ? aEndRg.GetIndex() : aSttRg.GetIndex()); SwPaM aPam( aSttRg, aEndRg, 0, -1 ); - return MoveParagraph( aPam, nOffs, TRUE ); + return MoveParagraph( aPam, nOffs, sal_True ); } -USHORT lcl_FindOutlineName( const SwNodes& rNds, const String& rName, - BOOL bExact ) +sal_uInt16 lcl_FindOutlineName( const SwNodes& rNds, const String& rName, + sal_Bool bExact ) { - USHORT nSavePos = USHRT_MAX; + sal_uInt16 nSavePos = USHRT_MAX; const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds(); - for( USHORT n = 0; n < rOutlNds.Count(); ++n ) + for( sal_uInt16 n = 0; n < rOutlNds.Count(); ++n ) { SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode(); String sTxt( pTxtNd->GetExpandTxt() ); @@ -574,7 +582,7 @@ USHORT lcl_FindOutlineName( const SwNodes& rNds, const String& rName, return nSavePos; } -USHORT lcl_FindOutlineNum( const SwNodes& rNds, String& rName ) +sal_uInt16 lcl_FindOutlineNum( const SwNodes& rNds, String& rName ) { // Gueltig Nummern sind (immer nur Offsets!!!): // ([Nummer]+\.)+ (als regulaerer Ausdruck!) @@ -585,16 +593,16 @@ USHORT lcl_FindOutlineNum( const SwNodes& rNds, String& rName ) if( STRING_NOTFOUND == nPos ) return USHRT_MAX; // ungueltige Nummer!!! - USHORT nLevelVal[ MAXLEVEL ]; // Nummern aller Levels + sal_uInt16 nLevelVal[ MAXLEVEL ]; // Nummern aller Levels memset( nLevelVal, 0, MAXLEVEL * sizeof( nLevelVal[0] )); - BYTE nLevel = 0; + sal_uInt8 nLevel = 0; String sName( rName ); while( STRING_NOTFOUND != nPos ) { - USHORT nVal = 0; + sal_uInt16 nVal = 0; sal_Unicode c; - for( USHORT n = 0; n < sNum.Len(); ++n ) + for( sal_uInt16 n = 0; n < sNum.Len(); ++n ) if( '0' <= ( c = sNum.GetChar( n )) && c <= '9' ) { nVal *= 10; nVal += c - '0'; @@ -643,7 +651,7 @@ USHORT lcl_FindOutlineNum( const SwNodes& rNds, String& rName ) SwNumberTree::tNumberVector aLevelVal = rNdNum.GetNumberVector(); //now compare with the one searched for bool bEqual = true; - for( BYTE n = 0; (n < nLevel) && bEqual; ++n ) + for( sal_uInt8 n = 0; (n < nLevel) && bEqual; ++n ) { bEqual = aLevelVal[n] == nLevelVal[n]; } @@ -678,7 +686,7 @@ USHORT lcl_FindOutlineNum( const SwNodes& rNds, String& rName ) // Text gesucht. Wird dieser gefunden ist es der Eintrag. Ansonsten der, // der ueber die Nummer gefunden wurde. // Ist keine Nummer angegeben, dann nur den Text suchen. -BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const +sal_Bool SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const { if( rName.Len() ) { @@ -686,7 +694,7 @@ BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const // 1. Schritt: ueber die Nummer: String sName( rName ); - USHORT nFndPos = ::lcl_FindOutlineNum( GetNodes(), sName ); + sal_uInt16 nFndPos = ::lcl_FindOutlineNum( GetNodes(), sName ); if( USHRT_MAX != nFndPos ) { SwTxtNode* pNd = rOutlNds[ nFndPos ]->GetTxtNode(); @@ -694,7 +702,7 @@ BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const //#i4533# leading numbers followed by a dot have been remove while //searching for the outline position //to compensate this they must be removed from the paragraphs text content, too - USHORT nPos = 0; + sal_uInt16 nPos = 0; String sTempNum; while(sExpandedText.Len() && (sTempNum = sExpandedText.GetToken(0, '.', nPos)).Len() && STRING_NOTFOUND != nPos && @@ -706,7 +714,7 @@ BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const if( !sExpandedText.Equals( sName ) ) { - USHORT nTmp = ::lcl_FindOutlineName( GetNodes(), sName, TRUE ); + sal_uInt16 nTmp = ::lcl_FindOutlineName( GetNodes(), sName, sal_True ); if( USHRT_MAX != nTmp ) // ueber den Namen gefunden { nFndPos = nTmp; @@ -715,32 +723,32 @@ BOOL SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const } rPos.nNode = *pNd; rPos.nContent.Assign( pNd, 0 ); - return TRUE; + return sal_True; } - nFndPos = ::lcl_FindOutlineName( GetNodes(), rName, FALSE ); + nFndPos = ::lcl_FindOutlineName( GetNodes(), rName, sal_False ); if( USHRT_MAX != nFndPos ) { SwTxtNode* pNd = rOutlNds[ nFndPos ]->GetTxtNode(); rPos.nNode = *pNd; rPos.nContent.Assign( pNd, 0 ); - return TRUE; + return sal_True; } // #i68289# additional search on hyperlink URL without its outline numbering part if ( !sName.Equals( rName ) ) { - nFndPos = ::lcl_FindOutlineName( GetNodes(), sName, FALSE ); + nFndPos = ::lcl_FindOutlineName( GetNodes(), sName, sal_False ); if( USHRT_MAX != nFndPos ) { SwTxtNode* pNd = rOutlNds[ nFndPos ]->GetTxtNode(); rPos.nNode = *pNd; rPos.nContent.Assign( pNd, 0 ); - return TRUE; + return sal_True; } } } - return FALSE; + return sal_False; } void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule ) @@ -748,8 +756,8 @@ void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule ) SwNumRule* pOld = rDoc.FindNumRulePtr( rRule.GetName() ); OSL_ENSURE( pOld, "ohne die alte NumRule geht gar nichts" ); - USHORT nChgFmtLevel = 0, nMask = 1; - BYTE n; + sal_uInt16 nChgFmtLevel = 0, nMask = 1; + sal_uInt8 n; for( n = 0; n < MAXLEVEL; ++n, nMask <<= 1 ) { @@ -773,7 +781,7 @@ void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule ) if ( bInvalidateNumRule ) { - pOld->SetInvalidRule(TRUE); + pOld->SetInvalidRule(sal_True); } return ; @@ -781,12 +789,12 @@ void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule ) SwNumRule::tTxtNodeList aTxtNodeList; pOld->GetTxtNodeList( aTxtNodeList ); - BYTE nLvl( 0 ); + sal_uInt8 nLvl( 0 ); for ( SwNumRule::tTxtNodeList::iterator aIter = aTxtNodeList.begin(); aIter != aTxtNodeList.end(); ++aIter ) { SwTxtNode* pTxtNd = *aIter; - nLvl = static_cast<BYTE>(pTxtNd->GetActualListLevel()); + nLvl = static_cast<sal_uInt8>(pTxtNd->GetActualListLevel()); if( nLvl < MAXLEVEL ) { @@ -802,7 +810,7 @@ void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule ) pOld->Set( n, rRule.GetNumFmt( n )); pOld->CheckCharFmts( &rDoc ); - pOld->SetInvalidRule(TRUE); + pOld->SetInvalidRule(sal_True); pOld->SetContinusNum( rRule.IsContinusNum() ); rDoc.UpdateNumRule(); @@ -816,11 +824,12 @@ void SwDoc::SetNumRule( const SwPaM& rPam, const bool bResetIndentAttrs ) { SwUndoInsNum * pUndo = NULL; - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - StartUndo( UNDO_INSNUM, NULL ); // Klammerung fuer die Attribute! - AppendUndo( pUndo = new SwUndoInsNum( rPam, rRule ) ); + // Start/End for attributes! + GetIDocumentUndoRedo().StartUndo( UNDO_INSNUM, NULL ); + pUndo = new SwUndoInsNum( rPam, rRule ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } SwNumRule * pNew = FindNumRulePtr( rRule.GetName() ); @@ -923,32 +932,65 @@ void SwDoc::SetNumRule( const SwPaM& rPam, { SvUShortsSort aResetAttrsArray; aResetAttrsArray.Insert( RES_LR_SPACE ); - ResetAttrs( rPam, sal_True, &aResetAttrsArray ); + // --> OD 2010-10-05 #i114929# + // On a selection setup a corresponding Point-and-Mark in order to get + // the indentation attribute reset on all paragraphs touched by the selection + if ( rPam.HasMark() && + rPam.End()->nNode.GetNode().GetTxtNode() ) + { + SwPaM aPam( rPam.Start()->nNode, + rPam.End()->nNode ); + aPam.Start()->nContent = 0; + aPam.End()->nContent = rPam.End()->nNode.GetNode().GetTxtNode()->Len(); + ResetAttrs( aPam, sal_False, &aResetAttrsArray ); + } + else + { + ResetAttrs( rPam, sal_False, &aResetAttrsArray ); + } + // <-- } - if (DoesUndo()) - EndUndo( UNDO_INSNUM, NULL ); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().EndUndo( UNDO_INSNUM, NULL ); + } SetModified(); } void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted) { - if ( bCounted ) { SvUShortsSort aResetAttrsArray; aResetAttrsArray.Insert( RES_PARATR_LIST_ISCOUNTED ); - ResetAttrs( rPam, sal_True, &aResetAttrsArray ); + // --> OD 2010-10-05 #i114929# + // On a selection setup a corresponding Point-and-Mark in order to get + // the list-is-counted attribute reset on all paragraphs touched by the selection + if ( rPam.HasMark() && + rPam.End()->nNode.GetNode().GetTxtNode() ) + { + SwPaM aPam( rPam.Start()->nNode, + rPam.End()->nNode ); + aPam.Start()->nContent = 0; + aPam.End()->nContent = rPam.End()->nNode.GetNode().GetTxtNode()->Len(); + ResetAttrs( aPam, sal_False, &aResetAttrsArray ); + } + else + { + ResetAttrs( rPam, sal_False, &aResetAttrsArray ); + } + // <-- } else { InsertPoolItem( rPam, - SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, FALSE ), 0 ); + SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, sal_False ), 0 ); } } -void SwDoc::SetNumRuleStart( const SwPosition& rPos, BOOL bFlag ) +void SwDoc::SetNumRuleStart( const SwPosition& rPos, sal_Bool bFlag ) { SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode(); @@ -957,10 +999,10 @@ void SwDoc::SetNumRuleStart( const SwPosition& rPos, BOOL bFlag ) const SwNumRule* pRule = pTxtNd->GetNumRule(); if( pRule && !bFlag != !pTxtNd->IsListRestart()) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoNumRuleStart( rPos, bFlag )); + SwUndo *const pUndo( new SwUndoNumRuleStart(rPos, bFlag) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } pTxtNd->SetListRestart(bFlag ? true : false); @@ -970,7 +1012,7 @@ void SwDoc::SetNumRuleStart( const SwPosition& rPos, BOOL bFlag ) } } -void SwDoc::SetNodeNumStart( const SwPosition& rPos, USHORT nStt ) +void SwDoc::SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt ) { SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode(); @@ -979,10 +1021,10 @@ void SwDoc::SetNodeNumStart( const SwPosition& rPos, USHORT nStt ) if ( !pTxtNd->HasAttrListRestartValue() || pTxtNd->GetAttrListRestartValue() != nStt ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoNumRuleStart( rPos, nStt )); + SwUndo *const pUndo( new SwUndoNumRuleStart(rPos, nStt) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } pTxtNd->SetAttrListRestartValue( nStt ); @@ -992,25 +1034,24 @@ void SwDoc::SetNodeNumStart( const SwPosition& rPos, USHORT nStt ) } // loeschen geht nur, wenn die Rule niemand benutzt! -BOOL SwDoc::DelNumRule( const String& rName, BOOL bBroadcast ) +sal_Bool SwDoc::DelNumRule( const String& rName, sal_Bool bBroadcast ) { - USHORT nPos = FindNumRule( rName ); + sal_uInt16 nPos = FindNumRule( rName ); if ( (*pNumRuleTbl)[ nPos ] == GetOutlineNumRule() ) { OSL_ENSURE( false, "<SwDoc::DelNumRule(..)> - No deletion of outline list style. This is serious defect - please inform OD" ); - return FALSE; + return sal_False; } if( USHRT_MAX != nPos && !IsUsed( *(*pNumRuleTbl)[ nPos ] )) { - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoNumruleDelete(*(*pNumRuleTbl)[nPos], this); - - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if (bBroadcast) @@ -1047,9 +1088,9 @@ BOOL SwDoc::DelNumRule( const String& rName, BOOL bBroadcast ) maNumRuleMap.erase(aTmpName); SetModified(); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } void SwDoc::ChgNumRuleFmts( const SwNumRule& rRule, const String * pName ) @@ -1058,12 +1099,11 @@ void SwDoc::ChgNumRuleFmts( const SwNumRule& rRule, const String * pName ) if( pRule ) { SwUndoInsNum* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); pUndo = new SwUndoInsNum( *pRule, rRule ); pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } ::lcl_ChgNumRule( *this, rRule ); @@ -1075,18 +1115,17 @@ void SwDoc::ChgNumRuleFmts( const SwNumRule& rRule, const String * pName ) } sal_Bool SwDoc::RenameNumRule(const String & rOldName, const String & rNewName, - BOOL bBroadcast) + sal_Bool bBroadcast) { sal_Bool bResult = sal_False; SwNumRule * pNumRule = FindNumRulePtr(rOldName); if (pNumRule) { - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoNumruleRename(rOldName, rNewName, this); - - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } SwNumRule::tTxtNodeList aTxtNodeList; @@ -1115,7 +1154,7 @@ sal_Bool SwDoc::RenameNumRule(const String & rOldName, const String & rNewName, void SwDoc::StopNumRuleAnimations( OutputDevice* pOut ) { - for( USHORT n = GetNumRuleTbl().Count(); n; ) + for( sal_uInt16 n = GetNumRuleTbl().Count(); n; ) { SwNumRule::tTxtNodeList aTxtNodeList; GetNumRuleTbl()[ --n ]->GetTxtNodeList( aTxtNodeList ); @@ -1132,20 +1171,21 @@ void SwDoc::StopNumRuleAnimations( OutputDevice* pOut ) } } -BOOL SwDoc::ReplaceNumRule( const SwPosition& rPos, +sal_Bool SwDoc::ReplaceNumRule( const SwPosition& rPos, const String& rOldRule, const String& rNewRule ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; SwNumRule *pOldRule = FindNumRulePtr( rOldRule ), *pNewRule = FindNumRulePtr( rNewRule ); if( pOldRule && pNewRule && pOldRule != pNewRule ) { SwUndoInsNum* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - StartUndo( UNDO_START, NULL ); // Klammerung fuer die Attribute! - AppendUndo( pUndo = new SwUndoInsNum( rPos, *pNewRule, rOldRule ) ); + // Start/End for attributes! + GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); + pUndo = new SwUndoInsNum( rPos, *pNewRule, rOldRule ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } SwNumRule::tTxtNodeList aTxtNodeList; @@ -1154,8 +1194,8 @@ BOOL SwDoc::ReplaceNumRule( const SwPosition& rPos, { SwRegHistory aRegH( pUndo ? pUndo->GetHistory() : 0 ); - USHORT nChgFmtLevel = 0; - for( BYTE n = 0; n < MAXLEVEL; ++n ) + sal_uInt16 nChgFmtLevel = 0; + for( sal_uInt8 n = 0; n < MAXLEVEL; ++n ) { const SwNumFmt& rOldFmt = pOldRule->Get( n ), & rNewFmt = pNewRule->Get( n ); @@ -1182,10 +1222,10 @@ BOOL SwDoc::ReplaceNumRule( const SwPosition& rPos, pTxtNd->NumRuleChgd(); } } - EndUndo( UNDO_END, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); SetModified(); - bRet = TRUE; + bRet = sal_True; } } @@ -1214,12 +1254,12 @@ void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM) ::std::map<SwNumRule *, ListStyleData> aMyNumRuleMap; - ULONG nStt = rPaM.Start()->nNode.GetIndex(); - ULONG nEnd = rPaM.End()->nNode.GetIndex(); + sal_uLong nStt = rPaM.Start()->nNode.GetIndex(); + sal_uLong nEnd = rPaM.End()->nNode.GetIndex(); bool bFirst = true; - for (ULONG n = nStt; n <= nEnd; n++) + for (sal_uLong n = nStt; n <= nEnd; n++) { SwTxtNode * pCNd = GetNodes()[n]->GetTxtNode(); @@ -1275,10 +1315,10 @@ void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM) } } -BOOL SwDoc::NoNum( const SwPaM& rPam ) +sal_Bool SwDoc::NoNum( const SwPaM& rPam ) { - BOOL bRet = SplitNode( *rPam.GetPoint(), false ); + sal_Bool bRet = SplitNode( *rPam.GetPoint(), false ); // ist ueberhaupt Nummerierung im Spiel ? if( bRet ) { @@ -1293,25 +1333,25 @@ BOOL SwDoc::NoNum( const SwPaM& rPam ) SetModified(); } else - bRet = FALSE; // keine Nummerierung , ?? oder immer TRUE ?? + bRet = sal_False; // keine Nummerierung , ?? oder immer sal_True ?? } return bRet; } void SwDoc::DelNumRules( const SwPaM& rPam ) { - ULONG nStt = rPam.GetPoint()->nNode.GetIndex(), + sal_uLong nStt = rPam.GetPoint()->nNode.GetIndex(), nEnd = rPam.GetMark()->nNode.GetIndex(); if( nStt > nEnd ) { - ULONG nTmp = nStt; nStt = nEnd; nEnd = nTmp; + sal_uLong nTmp = nStt; nStt = nEnd; nEnd = nTmp; } SwUndoDelNum* pUndo; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( pUndo = new SwUndoDelNum( rPam ) ); + pUndo = new SwUndoDelNum( rPam ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } else pUndo = 0; @@ -1330,13 +1370,13 @@ void SwDoc::DelNumRules( const SwPaM& rPam ) aRegH.RegisterInModify( pTNd, *pTNd ); if( pUndo ) - pUndo->AddNode( *pTNd, FALSE ); + pUndo->AddNode( *pTNd, sal_False ); // directly set list style attribute is reset, otherwise empty // list style is applied const SfxItemSet* pAttrSet = pTNd->GetpSwAttrSet(); if ( pAttrSet && - pAttrSet->GetItemState( RES_PARATR_NUMRULE, FALSE ) == SFX_ITEM_SET ) + pAttrSet->GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_SET ) pTNd->ResetAttr( RES_PARATR_NUMRULE ); else pTNd->SetAttr( aEmptyRule ); @@ -1365,21 +1405,21 @@ void SwDoc::DelNumRules( const SwPaM& rPam ) void SwDoc::InvalidateNumRules() { - for (USHORT n = 0; n < pNumRuleTbl->Count(); ++n) - (*pNumRuleTbl)[n]->SetInvalidRule(TRUE); + for (sal_uInt16 n = 0; n < pNumRuleTbl->Count(); ++n) + (*pNumRuleTbl)[n]->SetInvalidRule(sal_True); } // zum naechsten/vorhergehenden Punkt auf gleicher Ebene -BOOL lcl_IsNumOk( BYTE nSrchNum, BYTE& rLower, BYTE& rUpper, - BOOL bOverUpper, BYTE nNumber ) +sal_Bool lcl_IsNumOk( sal_uInt8 nSrchNum, sal_uInt8& rLower, sal_uInt8& rUpper, + sal_Bool bOverUpper, sal_uInt8 nNumber ) { OSL_ENSURE( nNumber < MAXLEVEL, "<lcl_IsNumOk(..)> - misusage of method" ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; { if( bOverUpper ? nSrchNum == nNumber : nSrchNum >= nNumber ) - bRet = TRUE; + bRet = sal_True; else if( nNumber > rLower ) rLower = nNumber; else if( nNumber < rUpper ) @@ -1388,9 +1428,9 @@ BOOL lcl_IsNumOk( BYTE nSrchNum, BYTE& rLower, BYTE& rUpper, return bRet; } -BOOL lcl_IsValidPrevNextNumNode( const SwNodeIndex& rIdx ) +sal_Bool lcl_IsValidPrevNextNumNode( const SwNodeIndex& rIdx ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; const SwNode& rNd = rIdx.GetNode(); switch( rNd.GetNodeType() ) { @@ -1404,28 +1444,28 @@ BOOL lcl_IsValidPrevNextNumNode( const SwNodeIndex& rIdx ) break; case ND_SECTIONNODE: // der ist erlaubt, also weiter - bRet = TRUE; + bRet = sal_True; break; } return bRet; } -BOOL lcl_GotoNextPrevNum( SwPosition& rPos, BOOL bNext, - BOOL bOverUpper, BYTE* pUpper, BYTE* pLower ) +sal_Bool lcl_GotoNextPrevNum( SwPosition& rPos, sal_Bool bNext, + sal_Bool bOverUpper, sal_uInt8* pUpper, sal_uInt8* pLower ) { const SwTxtNode* pNd = rPos.nNode.GetNode().GetTxtNode(); const SwNumRule* pRule; if( !pNd || 0 == ( pRule = pNd->GetNumRule())) - return FALSE; + return sal_False; - BYTE nSrchNum = static_cast<BYTE>(pNd->GetActualListLevel()); + sal_uInt8 nSrchNum = static_cast<sal_uInt8>(pNd->GetActualListLevel()); SwNodeIndex aIdx( rPos.nNode ); if( ! pNd->IsCountedInList() ) { // falls gerade mal NO_NUMLEVEL an ist, so such den vorherigen Node // mit Nummerierung - BOOL bError = FALSE; + sal_Bool bError = sal_False; do { aIdx--; if( aIdx.GetNode().IsTxtNode() ) @@ -1433,28 +1473,28 @@ BOOL lcl_GotoNextPrevNum( SwPosition& rPos, BOOL bNext, pNd = aIdx.GetNode().GetTxtNode(); pRule = pNd->GetNumRule(); - BYTE nTmpNum; + sal_uInt8 nTmpNum; if( pRule ) { - nTmpNum = static_cast<BYTE>(pNd->GetActualListLevel()); + nTmpNum = static_cast<sal_uInt8>(pNd->GetActualListLevel()); if( !( ! pNd->IsCountedInList() && (nTmpNum >= nSrchNum )) ) break; // gefunden } else - bError = TRUE; + bError = sal_True; } else bError = !lcl_IsValidPrevNextNumNode( aIdx ); } while( !bError ); if( bError ) - return FALSE; + return sal_False; } - BYTE nLower = nSrchNum, nUpper = nSrchNum; - BOOL bRet = FALSE; + sal_uInt8 nLower = nSrchNum, nUpper = nSrchNum; + sal_Bool bRet = sal_False; const SwTxtNode* pLast; if( bNext ) @@ -1472,11 +1512,11 @@ BOOL lcl_GotoNextPrevNum( SwPosition& rPos, BOOL bNext, if( pRule ) { if( ::lcl_IsNumOk( nSrchNum, nLower, nUpper, bOverUpper, - static_cast<BYTE>(pNd->GetActualListLevel()) )) + static_cast<sal_uInt8>(pNd->GetActualListLevel()) )) { rPos.nNode = aIdx; rPos.nContent.Assign( (SwTxtNode*)pNd, 0 ); - bRet = TRUE; + bRet = sal_True; break; } else @@ -1507,7 +1547,7 @@ BOOL lcl_GotoNextPrevNum( SwPosition& rPos, BOOL bNext, rPos.nNode.Assign( *pLast ); rPos.nContent.Assign( (SwTxtNode*)pLast, 0 ); } - bRet = TRUE; + bRet = sal_True; } if( bRet ) @@ -1520,10 +1560,10 @@ BOOL lcl_GotoNextPrevNum( SwPosition& rPos, BOOL bNext, return bRet; } -BOOL SwDoc::GotoNextNum( SwPosition& rPos, BOOL bOverUpper, - BYTE* pUpper, BYTE* pLower ) +sal_Bool SwDoc::GotoNextNum( SwPosition& rPos, sal_Bool bOverUpper, + sal_uInt8* pUpper, sal_uInt8* pLower ) { - return ::lcl_GotoNextPrevNum( rPos, TRUE, bOverUpper, pUpper, pLower ); + return ::lcl_GotoNextPrevNum( rPos, sal_True, bOverUpper, pUpper, pLower ); } const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos, @@ -1561,7 +1601,7 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos, const SwNumRule * pNumRule = pTxtNd->GetNumRule(); if (pNumRule) { - if ( ( pNumRule->IsOutlineRule() == ( bOutline ? TRUE : FALSE ) ) && + if ( ( pNumRule->IsOutlineRule() == ( bOutline ? sal_True : sal_False ) ) && ( ( bNum && pNumRule->Get(0).IsEnumeration()) || ( !bNum && pNumRule->Get(0).IsItemize() ) ) ) // #i22362#, #i29560# { @@ -1594,33 +1634,33 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos, pNode = &aIdx.GetNode(); } - while (! (pNode == aNodes.DocumentSectionStartNode(pStartFromNode) || - pNode == aNodes.DocumentSectionEndNode(pStartFromNode))); + while (!(pNode == GetNodes().DocumentSectionStartNode(pStartFromNode) || + pNode == GetNodes().DocumentSectionEndNode(pStartFromNode))); } return pResult; } -BOOL SwDoc::GotoPrevNum( SwPosition& rPos, BOOL bOverUpper, - BYTE* pUpper, BYTE* pLower ) +sal_Bool SwDoc::GotoPrevNum( SwPosition& rPos, sal_Bool bOverUpper, + sal_uInt8* pUpper, sal_uInt8* pLower ) { - return ::lcl_GotoNextPrevNum( rPos, FALSE, bOverUpper, pUpper, pLower ); + return ::lcl_GotoNextPrevNum( rPos, sal_False, bOverUpper, pUpper, pLower ); } -BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) +sal_Bool SwDoc::NumUpDown( const SwPaM& rPam, sal_Bool bDown ) { - ULONG nStt = rPam.GetPoint()->nNode.GetIndex(), + sal_uLong nStt = rPam.GetPoint()->nNode.GetIndex(), nEnd = rPam.GetMark()->nNode.GetIndex(); if( nStt > nEnd ) { - ULONG nTmp = nStt; nStt = nEnd; nEnd = nTmp; + sal_uLong nTmp = nStt; nStt = nEnd; nEnd = nTmp; } // -> outline nodes are promoted or demoted differently bool bOnlyOutline = true; bool bOnlyNonOutline = true; - for (ULONG n = nStt; n <= nEnd; n++) + for (sal_uLong n = nStt; n <= nEnd; n++) { SwTxtNode * pTxtNd = GetNodes()[n]->GetTxtNode(); @@ -1638,7 +1678,7 @@ BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) } } - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; char nDiff = bDown ? 1 : -1; if (bOnlyOutline) @@ -1651,7 +1691,7 @@ BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) promotable resp. demotable. */ - for (ULONG nTmp = nStt; nTmp <= nEnd; ++nTmp) + for (sal_uLong nTmp = nStt; nTmp <= nEnd; ++nTmp) { SwTxtNode* pTNd = GetNodes()[ nTmp ]->GetTxtNode(); @@ -1663,25 +1703,25 @@ BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) if (pRule) { - BYTE nLevel = static_cast<BYTE>(pTNd->GetActualListLevel()); + sal_uInt8 nLevel = static_cast<sal_uInt8>(pTNd->GetActualListLevel()); if( (-1 == nDiff && 0 >= nLevel) || (1 == nDiff && MAXLEVEL - 1 <= nLevel)) - bRet = FALSE; + bRet = sal_False; } } } if( bRet ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoNumUpDown( rPam, nDiff ) ); + SwUndo *const pUndo( new SwUndoNumUpDown(rPam, nDiff) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } String sNumRule; - for(ULONG nTmp = nStt; nTmp <= nEnd; ++nTmp ) + for(sal_uLong nTmp = nStt; nTmp <= nEnd; ++nTmp ) { SwTxtNode* pTNd = GetNodes()[ nTmp ]->GetTxtNode(); @@ -1691,7 +1731,7 @@ BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) if (pRule) { - BYTE nLevel = static_cast<BYTE>(pTNd->GetActualListLevel()); + sal_uInt8 nLevel = static_cast<sal_uInt8>(pTNd->GetActualListLevel()); nLevel = nLevel + nDiff; pTNd->SetAttrListLevel(nLevel); @@ -1707,12 +1747,12 @@ BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) return bRet; } -BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) +sal_Bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, sal_Bool bIsOutlMv ) { const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End(); - ULONG nStIdx = pStt->nNode.GetIndex(); - ULONG nEndIdx = pEnd->nNode.GetIndex(); + sal_uLong nStIdx = pStt->nNode.GetIndex(); + sal_uLong nEndIdx = pEnd->nNode.GetIndex(); // Here are some sophisticated checks whether the wished PaM will be moved or not. // For moving outlines (bIsOutlMv) I've already done some checks, so here are two different @@ -1732,24 +1772,24 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) { // First is a start node pTmp2 = pTmp1->EndOfSectionNode(); if( pTmp2->GetIndex() > nEndIdx ) - return FALSE; // Its end node is behind the moved range + return sal_False; // Its end node is behind the moved range } pTmp1 = pTmp1->StartOfSectionNode()->EndOfSectionNode(); if( pTmp1->GetIndex() <= nEndIdx ) - return FALSE; // End node inside but start node before moved range => no. + return sal_False; // End node inside but start node before moved range => no. pTmp1 = GetNodes()[ nEndIdx ]; if( pTmp1->IsEndNode() ) { // The last one is an end node pTmp1 = pTmp1->StartOfSectionNode(); if( pTmp1->GetIndex() < nStIdx ) - return FALSE; // Its start node is before the moved range. + return sal_False; // Its start node is before the moved range. } pTmp1 = pTmp1->StartOfSectionNode(); if( pTmp1->GetIndex() >= nStIdx ) - return FALSE; // A start node which ends behind the moved area => no. + return sal_False; // A start node which ends behind the moved area => no. } - ULONG nInStIdx, nInEndIdx; + sal_uLong nInStIdx, nInEndIdx; long nOffs = nOffset; if( nOffset > 0 ) { @@ -1760,8 +1800,8 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) else { //Impossible to move to negative index - if( ULONG(abs( nOffset )) > nStIdx) - return FALSE; + if( sal_uLong(abs( nOffset )) > nStIdx) + return sal_False; nInEndIdx = nStIdx - 1; nStIdx += nOffset; @@ -1771,7 +1811,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) // [ nStIdx, nInEndIdx ] mit [ nInStIdx, nEndIdx ] if( nEndIdx >= GetNodes().GetEndOfContent().GetIndex() ) - return FALSE; + return sal_False; if( !bIsOutlMv ) { // And here the restrictions for moving paragraphs other than chapters (outlines) @@ -1782,7 +1822,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) pTmp1 = GetNodes()[ nStIdx ]->StartOfSectionNode(); pTmp2 = GetNodes()[ nInStIdx ]->StartOfSectionNode(); if( pTmp1 != pTmp2 ) - return FALSE; // "start" nodes in different sections + return sal_False; // "start" nodes in different sections pTmp1 = GetNodes()[ nEndIdx ]; bool bIsEndNode = pTmp1->IsEndNode(); if( !pTmp1->IsStartNode() ) @@ -1802,21 +1842,21 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) } pTmp2 = pTmp2->EndOfSectionNode(); if( pTmp1 != pTmp2 ) - return FALSE; // The "end" notes are in different sections + return sal_False; // The "end" notes are in different sections } // auf Redlining testen - darf die Selektion ueberhaupt verschoben // werden? if( !IsIgnoreRedline() ) { - USHORT nRedlPos = GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_DELETE ); + sal_uInt16 nRedlPos = GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_DELETE ); if( USHRT_MAX != nRedlPos ) { SwPosition aStPos( *pStt ), aEndPos( *pEnd ); aStPos.nContent = 0; SwCntntNode* pCNd = pEnd->nNode.GetNode().GetCntntNode(); aEndPos.nContent = pCNd ? pCNd->Len() : 1; - BOOL bCheckDel = TRUE; + sal_Bool bCheckDel = sal_True; // es existiert fuer den Bereich irgendein Redline-Delete-Object for( ; nRedlPos < GetRedlineTbl().Count(); ++nRedlPos ) @@ -1838,14 +1878,14 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) case POS_INSIDE: // Pos1 liegt vollstaendig in Pos2 // ist erlaubt, aber checke dann alle nachfolgenden // auf Ueberlappungen - bCheckDel = FALSE; + bCheckDel = sal_False; break; case POS_OUTSIDE: // Pos2 liegt vollstaendig in Pos1 case POS_EQUAL: // Pos1 ist genauso gross wie Pos2 case POS_OVERLAP_BEFORE: // Pos1 ueberlappt Pos2 am Anfang case POS_OVERLAP_BEHIND: // Pos1 ueberlappt Pos2 am Ende - return FALSE; + return sal_False; } } } @@ -1867,7 +1907,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) { // wenn der Bereich komplett im eigenen Redline liegt, kann es // verschoben werden! - USHORT nRedlPos = GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_INSERT ); + sal_uInt16 nRedlPos = GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_INSERT ); if( USHRT_MAX != nRedlPos ) { SwRedline* pTmp = GetRedlineTbl()[ nRedlPos ]; @@ -1903,7 +1943,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) if( !pOwnRedl ) { - StartUndo( UNDO_START, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); // zuerst das Insert, dann das Loeschen SwPosition aInsPos( aIdx ); @@ -1915,7 +1955,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) rOrigPam.DeleteMark(); rOrigPam.GetPoint()->nNode = aIdx.GetIndex() - 1; - BOOL bDelLastPara = !aInsPos.nNode.GetNode().IsCntntNode(); + sal_Bool bDelLastPara = !aInsPos.nNode.GetNode().IsCntntNode(); /* When copying to a non-content node Copy will insert a paragraph before that node and insert before @@ -1928,7 +1968,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) /* aInsPos points to the non-content node. Move it to the previous content node. */ SwPaM aInsPam(aInsPos); - BOOL bMoved = aInsPam.Move(fnMoveBackward); + sal_Bool bMoved = aInsPam.Move(fnMoveBackward); OSL_ENSURE(bMoved, "No content node found!"); if (bMoved) @@ -1954,21 +1994,21 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) // alle die im zu loeschenden Node stehen, mussen auf den // naechsten umgestezt werden SwPosition* pPos; - for( USHORT n = 0; n < GetRedlineTbl().Count(); ++n ) + for( sal_uInt16 n = 0; n < GetRedlineTbl().Count(); ++n ) { SwRedline* pTmp = GetRedlineTbl()[ n ]; - if( ( pPos = &pTmp->GetBound(TRUE))->nNode == aIdx ) + if( ( pPos = &pTmp->GetBound(sal_True))->nNode == aIdx ) { pPos->nNode++; pPos->nContent.Assign( pPos->nNode.GetNode().GetCntntNode(),0); } - if( ( pPos = &pTmp->GetBound(FALSE))->nNode == aIdx ) + if( ( pPos = &pTmp->GetBound(sal_False))->nNode == aIdx ) { pPos->nNode++; pPos->nContent.Assign( pPos->nNode.GetNode().GetCntntNode(),0); } } - CorrRel( aIdx, aInsPos, 0, FALSE ); + CorrRel( aIdx, aInsPos, 0, sal_False ); pCNd->JoinNext(); } @@ -1978,12 +2018,13 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) RedlineMode_t eOld = GetRedlineMode(); checkRedlining(eOld); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { //JP 06.01.98: MUSS noch optimiert werden!!! SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)); - AppendUndo( new SwUndoRedlineDelete( aPam, UNDO_DELETE )); + SwUndo *const pUndo(new SwUndoRedlineDelete(aPam, UNDO_DELETE)); + GetIDocumentUndoRedo().AppendUndo(pUndo); } SwRedline* pNewRedline = new SwRedline( nsRedlineType_t::REDLINE_DELETE, aPam ); @@ -1991,17 +2032,17 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) // prevent assertion from aPam's target being deleted // (Alternatively, one could just let aPam go out of scope, but // that requires touching a lot of code.) - aPam.GetBound(TRUE).nContent.Assign( NULL, 0 ); - aPam.GetBound(FALSE).nContent.Assign( NULL, 0 ); + aPam.GetBound(sal_True).nContent.Assign( NULL, 0 ); + aPam.GetBound(sal_False).nContent.Assign( NULL, 0 ); AppendRedline( pNewRedline, true ); //JP 06.01.98: MUSS noch optimiert werden!!! SetRedlineMode( eOld ); - EndUndo( UNDO_END, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); SetModified(); - return TRUE; + return sal_True; } } @@ -2011,7 +2052,7 @@ SetRedlineMode( eOld ); SplitRedline(aTemp); } - ULONG nRedlSttNd(0), nRedlEndNd(0); + sal_uLong nRedlSttNd(0), nRedlEndNd(0); if( pOwnRedl ) { const SwPosition *pRStt = pOwnRedl->Start(), *pREnd = pOwnRedl->End(); @@ -2020,8 +2061,8 @@ SetRedlineMode( eOld ); } SwUndoMoveNum* pUndo = 0; - ULONG nMoved = 0; - if( DoesUndo() ) + sal_uLong nMoved = 0; + if (GetIDocumentUndoRedo().DoesUndo()) { pUndo = new SwUndoMoveNum( rPam, nOffset, bIsOutlMv ); nMoved = rPam.End()->nNode.GetIndex() - rPam.Start()->nNode.GetIndex() + 1; @@ -2032,13 +2073,12 @@ SetRedlineMode( eOld ); if( pUndo ) { - ClearRedo(); // i57907: Under circumstances (sections at the end of a chapter) // the rPam.Start() is not moved to the new position. // But aIdx should be at the new end position and as long as the number of moved paragraphs // is nMoved, I know, where the new position is. pUndo->SetStartNode( aIdx.GetIndex() - nMoved ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if( pOwnRedl ) @@ -2059,12 +2099,12 @@ SetRedlineMode( eOld ); } SetModified(); - return TRUE; + return sal_True; } -BOOL SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, BOOL bDel ) +sal_Bool SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, sal_Bool bDel ) { - BOOL bResult = FALSE; + sal_Bool bResult = sal_False; SwTxtNode * pTxtNd = rIdx.GetNode().GetTxtNode(); if (pTxtNd && pTxtNd->GetNumRule() != NULL && @@ -2072,23 +2112,23 @@ BOOL SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, BOOL bDel ) { if ( !pTxtNd->IsCountedInList() == !bDel) { - BOOL bOldNum = bDel; // == pTxtNd->IsCounted(); - BOOL bNewNum = bDel ? FALSE : TRUE; + sal_Bool bOldNum = bDel; // == pTxtNd->IsCounted(); + sal_Bool bNewNum = bDel ? sal_False : sal_True; pTxtNd->SetCountedInList(bNewNum ? true : false); SetModified(); - bResult = TRUE; + bResult = sal_True; - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndoNumOrNoNum * pUndo = new SwUndoNumOrNoNum(rIdx, bOldNum, bNewNum); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } } - else if (bDel && pTxtNd->GetNumRule(FALSE) && + else if (bDel && pTxtNd->GetNumRule(sal_False) && pTxtNd->GetActualListLevel() >= 0 && pTxtNd->GetActualListLevel() < MAXLEVEL) { @@ -2096,7 +2136,7 @@ BOOL SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, BOOL bDel ) DelNumRules(aPam); - bResult = TRUE; + bResult = sal_True; } } @@ -2116,9 +2156,9 @@ SwNumRule* SwDoc::GetCurrNumRule( const SwPosition& rPos ) const return pRet; } -USHORT SwDoc::FindNumRule( const String& rName ) const +sal_uInt16 SwDoc::FindNumRule( const String& rName ) const { - for( USHORT n = pNumRuleTbl->Count(); n; ) + for( sal_uInt16 n = pNumRuleTbl->Count(); n; ) if( (*pNumRuleTbl)[ --n ]->GetName() == rName ) return n; @@ -2133,7 +2173,7 @@ SwNumRule* SwDoc::FindNumRulePtr( const String& rName ) const if ( !pResult ) { - for (USHORT n = 0; n < pNumRuleTbl->Count(); ++n) + for (sal_uInt16 n = 0; n < pNumRuleTbl->Count(); ++n) { if ((*pNumRuleTbl)[n]->GetName() == rName) { @@ -2156,9 +2196,9 @@ void SwDoc::AddNumRule(SwNumRule * pRule) createListForListStyle( pRule->GetName() ); } -USHORT SwDoc::MakeNumRule( const String &rName, +sal_uInt16 SwDoc::MakeNumRule( const String &rName, const SwNumRule* pCpy, - BOOL bBroadcast, + sal_Bool bBroadcast, const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode ) { SwNumRule* pNew; @@ -2183,15 +2223,14 @@ USHORT SwDoc::MakeNumRule( const String &rName, eDefaultNumberFormatPositionAndSpaceMode ); } - USHORT nRet = pNumRuleTbl->Count(); + sal_uInt16 nRet = pNumRuleTbl->Count(); AddNumRule(pNew); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoNumruleCreate(pNew, this); - - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if (bBroadcast) @@ -2201,7 +2240,7 @@ USHORT SwDoc::MakeNumRule( const String &rName, return nRet; } -String SwDoc::GetUniqueNumRuleName( const String* pChkStr, BOOL bAutoNum ) const +String SwDoc::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) const { String aName; if( bAutoNum ) @@ -2220,8 +2259,8 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, BOOL bAutoNum ) const aName = SW_RESSTR( STR_NUMRULE_DEFNAME ); } - USHORT nNum(0), nTmp, nFlagSize = ( pNumRuleTbl->Count() / 8 ) +2; - BYTE* pSetFlags = new BYTE[ nFlagSize ]; + sal_uInt16 nNum(0), nTmp, nFlagSize = ( pNumRuleTbl->Count() / 8 ) +2; + sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ]; memset( pSetFlags, 0, nFlagSize ); xub_StrLen nNmLen = aName.Len(); @@ -2239,7 +2278,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, BOOL bAutoNum ) const } const SwNumRule* pNumRule; - USHORT n; + sal_uInt16 n; for( n = 0; n < pNumRuleTbl->Count(); ++n ) if( 0 != ( pNumRule = (*pNumRuleTbl)[ n ] ) ) @@ -2248,7 +2287,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, BOOL bAutoNum ) const if( rNm.Match( aName ) == nNmLen ) { // Nummer bestimmen und das Flag setzen - nNum = (USHORT)rNm.Copy( nNmLen ).ToInt32(); + nNum = (sal_uInt16)rNm.Copy( nNmLen ).ToInt32(); if( nNum-- && nNum < pNumRuleTbl->Count() ) pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 )); } @@ -2280,14 +2319,14 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, BOOL bAutoNum ) const void SwDoc::UpdateNumRule() { const SwNumRuleTbl& rNmTbl = GetNumRuleTbl(); - for( USHORT n = 0; n < rNmTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rNmTbl.Count(); ++n ) if( rNmTbl[ n ]->IsInvalidRule() ) rNmTbl[ n ]->Validate(); } void SwDoc::MarkListLevel( const String& sListId, const int nListLevel, - const BOOL bValue ) + const sal_Bool bValue ) { SwList* pList = getListByName( sListId ); @@ -2299,15 +2338,15 @@ void SwDoc::MarkListLevel( const String& sListId, void SwDoc::MarkListLevel( SwList& rList, const int nListLevel, - const BOOL bValue ) + const sal_Bool bValue ) { // Set new marked list level and notify all affected nodes of the changed mark. rList.MarkListLevel( nListLevel, bValue ); } -BOOL SwDoc::IsFirstOfNumRule(SwPosition & rPos) +sal_Bool SwDoc::IsFirstOfNumRule(SwPosition & rPos) { - BOOL bResult = FALSE; + sal_Bool bResult = sal_False; SwTxtNode * pTxtNode = rPos.nNode.GetNode().GetTxtNode(); if (pTxtNode) @@ -2409,7 +2448,7 @@ sal_Int32 SwDoc::getOutlineNodesCount() const int SwDoc::getOutlineLevel( const sal_Int32 nIdx ) const { - return GetNodes().GetOutLineNds()[ static_cast<USHORT>(nIdx) ]-> + return GetNodes().GetOutLineNds()[ static_cast<sal_uInt16>(nIdx) ]-> // GetTxtNode()->GetOutlineLevel(); //#outline level,zhaojianwei GetTxtNode()->GetAttrOutlineLevel()-1; //<-end,zhaojianwei } @@ -2418,14 +2457,14 @@ String SwDoc::getOutlineText( const sal_Int32 nIdx, const bool bWithNumber, const bool bWithSpacesForLevel ) const { - return GetNodes().GetOutLineNds()[ static_cast<USHORT>(nIdx) ]-> + return GetNodes().GetOutLineNds()[ static_cast<sal_uInt16>(nIdx) ]-> GetTxtNode()->GetExpandTxt( 0, STRING_LEN, bWithNumber, bWithNumber, bWithSpacesForLevel ); } SwTxtNode* SwDoc::getOutlineNode( const sal_Int32 nIdx ) const { - return GetNodes().GetOutLineNds()[ static_cast<USHORT>(nIdx) ]->GetTxtNode(); + return GetNodes().GetOutLineNds()[ static_cast<sal_uInt16>(nIdx) ]->GetTxtNode(); } void SwDoc::getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOutlineNodeList ) const @@ -2433,8 +2472,8 @@ void SwDoc::getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOu orOutlineNodeList.clear(); orOutlineNodeList.reserve( getOutlineNodesCount() ); - const USHORT nOutlCount( static_cast<USHORT>(getOutlineNodesCount()) ); - for ( USHORT i = 0; i < nOutlCount; ++i ) + const sal_uInt16 nOutlCount( static_cast<sal_uInt16>(getOutlineNodesCount()) ); + for ( sal_uInt16 i = 0; i < nOutlCount; ++i ) { orOutlineNodeList.push_back( GetNodes().GetOutLineNds()[i]->GetTxtNode() ); diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index d807706d9710..e409ec3462d8 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -39,11 +39,14 @@ #include <editeng/crsditem.hxx> #include <swmodule.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <ndtxt.hxx> #include <redline.hxx> #include <swundo.hxx> -#include <undobj.hxx> +#include <UndoCore.hxx> +#include <UndoRedline.hxx> +#include <hints.hxx> #include <pamtyp.hxx> #include <poolfmt.hxx> #include <viewsh.hxx> @@ -100,10 +103,10 @@ TYPEINIT1(SwRedlineHint, SfxHint); const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl(); // verify valid redline positions - for( USHORT i = 0; i < rTbl.Count(); ++i ) + for( sal_uInt16 i = 0; i < rTbl.Count(); ++i ) lcl_CheckPam( rTbl[ i ] ); - for( USHORT j = 0; j < rTbl.Count(); ++j ) + for( sal_uInt16 j = 0; j < rTbl.Count(); ++j ) { // check for empty redlines DBG_ASSERT( ( *(rTbl[j]->GetPoint()) != *(rTbl[j]->GetMark()) ) || @@ -112,7 +115,7 @@ TYPEINIT1(SwRedlineHint, SfxHint); } // verify proper redline sorting - for( USHORT n = 1; n < rTbl.Count(); ++n ) + for( sal_uInt16 n = 1; n < rTbl.Count(); ++n ) { const SwRedline* pPrev = rTbl[ n-1 ]; const SwRedline* pCurrent = rTbl[ n ]; @@ -131,11 +134,11 @@ TYPEINIT1(SwRedlineHint, SfxHint); void lcl_DebugRedline( const SwDoc* pDoc ) { - static USHORT nWatch = 0; + static sal_uInt16 nWatch = 0; const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl(); - for( USHORT n = 0; n < rTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rTbl.Count(); ++n ) { - USHORT nDummy = 0; + sal_uInt16 nDummy = 0; const SwRedline* pCurrent = rTbl[ n ]; const SwRedline* pNext = n+1 < rTbl.Count() ? rTbl[ n+1 ] : 0; if( pCurrent == pNext ) @@ -172,7 +175,7 @@ void SwDoc::SetRedlineMode( RedlineMode_t eMode ) bool bSaveInXMLImportFlag = IsInXMLImport(); SetInXMLImport( false ); // und dann alles verstecken, anzeigen - void (SwRedline::*pFnc)( USHORT ) = 0; + void (SwRedline::*pFnc)( sal_uInt16 ) = 0; switch( nsRedlineMode_t::REDLINE_SHOW_MASK & eMode ) { @@ -195,8 +198,8 @@ void SwDoc::SetRedlineMode( RedlineMode_t eMode ) _CHECK_REDLINE( this ) if( pFnc ) - for( USHORT nLoop = 1; nLoop <= 2; ++nLoop ) - for( USHORT i = 0; i < pRedlineTbl->Count(); ++i ) + for( sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop ) + for( sal_uInt16 i = 0; i < pRedlineTbl->Count(); ++i ) ((*pRedlineTbl)[ i ]->*pFnc)( nLoop ); _CHECK_REDLINE( this ) SetInXMLImport( bSaveInXMLImportFlag ); @@ -367,10 +370,10 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) ( pNewRedl->GetContentIdx() == NULL ) ) { // Do not insert empty redlines delete pNewRedl; - return FALSE; + return sal_False; } - BOOL bCompress = FALSE; - USHORT n = 0; + sal_Bool bCompress = sal_False; + sal_uInt16 n = 0; // zur StartPos das erste Redline suchen if( !GetRedline( *pStt, &n ) && n ) --n; @@ -470,7 +473,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) if( bDelete ) { delete pNewRedl, pNewRedl = 0; - bCompress = TRUE; + bCompress = sal_True; } } else if( POS_INSIDE == eCmpPos ) @@ -670,7 +673,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) case POS_INSIDE: case POS_EQUAL: delete pNewRedl, pNewRedl = 0; - bCompress = TRUE; + bCompress = sal_True; break; case POS_OVERLAP_BEFORE: @@ -722,7 +725,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) // delete current (below), and restart process with // previous - USHORT nToBeDeleted = n; + sal_uInt16 nToBeDeleted = n; bDec = true; if( *(pNewRedl->Start()) <= *pREnd ) @@ -761,7 +764,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) switch( eCmpPos ) { case POS_EQUAL: - bCompress = TRUE; + bCompress = sal_True; pRedlineTbl->DeleteAndDestroy( n ); bDec = true; // kein break! @@ -788,7 +791,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) else DeleteAndJoin( *pNewRedl ); - bCompress = TRUE; + bCompress = sal_True; } delete pNewRedl, pNewRedl = 0; break; @@ -803,7 +806,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) { pRedlineTbl->SavePtrInArr( pNewRedl ); DeleteAndJoin( *pRedl ); - USHORT nFnd = pRedlineTbl->GetPos(pNewRedl ); + sal_uInt16 nFnd = pRedlineTbl->GetPos(pNewRedl ); if( USHRT_MAX != nFnd ) pRedlineTbl->Remove( nFnd ); else @@ -833,7 +836,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) // behandelt wird, erstmal temp. einfuegen pRedlineTbl->SavePtrInArr( pNewRedl ); DeleteAndJoin( aPam ); - USHORT nFnd = pRedlineTbl->GetPos(pNewRedl ); + sal_uInt16 nFnd = pRedlineTbl->GetPos(pNewRedl ); if( USHRT_MAX != nFnd ) pRedlineTbl->Remove( nFnd ); else @@ -862,7 +865,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) // behandelt wird, erstmal temp. einfuegen pRedlineTbl->SavePtrInArr( pNewRedl ); DeleteAndJoin( aPam ); - USHORT nFnd = pRedlineTbl->GetPos(pNewRedl ); + sal_uInt16 nFnd = pRedlineTbl->GetPos(pNewRedl ); if( USHRT_MAX != nFnd ) pRedlineTbl->Remove( nFnd ); else @@ -894,7 +897,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) delete pNewRedl, pNewRedl = 0; if( IsHideChanges( eRedlineMode )) pRedl->Hide(); - bCompress = TRUE; + bCompress = sal_True; } break; @@ -907,7 +910,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) if (*pStt != *pEnd) // <-- { - pNewRedl->PushData( *pRedl, FALSE ); + pNewRedl->PushData( *pRedl, sal_False ); pRedl->SetStart( *pEnd, pRStt ); // re-insert pRedlineTbl->Remove( n ); @@ -917,7 +920,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) } else { - pNewRedl->PushData( *pRedl, FALSE ); + pNewRedl->PushData( *pRedl, sal_False ); if( *pREnd != *pEnd ) { pNew = new SwRedline( *pRedl ); @@ -945,7 +948,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) pNew->SetEnd( *pRStt ); pNewRedl->SetStart( *pREnd, pStt ); } - bCompress = TRUE; + bCompress = sal_True; } break; @@ -1270,7 +1273,7 @@ void SwDoc::CompressRedlines() { _CHECK_REDLINE( this ) - void (SwRedline::*pFnc)(USHORT) = 0; + void (SwRedline::*pFnc)(sal_uInt16) = 0; switch( nsRedlineMode_t::REDLINE_SHOW_MASK & eRedlineMode ) { case nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE: @@ -1282,7 +1285,7 @@ void SwDoc::CompressRedlines() } // versuche gleiche zusammenzufassen - for( USHORT n = 1; n < pRedlineTbl->Count(); ++n ) + for( sal_uInt16 n = 1; n < pRedlineTbl->Count(); ++n ) { SwRedline* pPrev = (*pRedlineTbl)[ n-1 ], * pCur = (*pRedlineTbl)[ n ]; @@ -1313,8 +1316,8 @@ void SwDoc::CompressRedlines() bool SwDoc::SplitRedline( const SwPaM& rRange ) { - BOOL bChg = FALSE; - USHORT n = 0; + sal_Bool bChg = sal_False; + sal_uInt16 n = 0; const SwPosition* pStt = rRange.Start(), * pEnd = pStt == rRange.GetPoint() ? rRange.GetMark() : rRange.GetPoint(); @@ -1328,7 +1331,7 @@ bool SwDoc::SplitRedline( const SwPaM& rRange ) if( *pTStt <= *pStt && *pStt <= *pTEnd && *pTStt <= *pEnd && *pEnd <= *pTEnd ) { - bChg = TRUE; + bChg = sal_True; int nn = 0; if( *pStt == *pTStt ) nn += 1; @@ -1374,21 +1377,20 @@ bool SwDoc::SplitRedline( const SwPaM& rRange ) } bool SwDoc::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo, - USHORT nDelType ) + sal_uInt16 nDelType ) { if( nsRedlineMode_t::REDLINE_IGNOREDELETE_REDLINES & eRedlineMode || !rRange.HasMark() || *rRange.GetMark() == *rRange.GetPoint() ) - return FALSE; + return sal_False; - BOOL bChg = FALSE; + sal_Bool bChg = sal_False; - if( bSaveInUndo && DoesUndo() ) + if (bSaveInUndo && GetIDocumentUndoRedo().DoesUndo()) { SwUndoRedline* pUndo = new SwUndoRedline( UNDO_REDLINE, rRange ); if( pUndo->GetRedlSaveCount() ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } else delete pUndo; @@ -1397,7 +1399,7 @@ bool SwDoc::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo, const SwPosition* pStt = rRange.Start(), * pEnd = pStt == rRange.GetPoint() ? rRange.GetMark() : rRange.GetPoint(); - USHORT n = 0; + sal_uInt16 n = 0; GetRedline( *pStt, &n ); for( ; n < pRedlineTbl->Count() ; ++n ) { @@ -1408,17 +1410,17 @@ bool SwDoc::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo, SwPosition* pRStt = pRedl->Start(), * pREnd = pRStt == pRedl->GetPoint() ? pRedl->GetMark() : pRedl->GetPoint(); - BOOL bDel = FALSE; + sal_Bool bDel = sal_False; switch( ComparePosition( *pStt, *pEnd, *pRStt, *pREnd ) ) { case POS_EQUAL: case POS_OUTSIDE: - bDel = TRUE; + bDel = sal_True; break; case POS_OVERLAP_BEFORE: if( *pEnd == *pREnd ) - bDel = TRUE; + bDel = sal_True; else { pRedl->InvalidateRange(); @@ -1432,7 +1434,7 @@ bool SwDoc::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo, case POS_OVERLAP_BEHIND: if( *pStt == *pRStt ) - bDel = TRUE; + bDel = sal_True; else { pRedl->InvalidateRange(); @@ -1495,7 +1497,7 @@ bool SwDoc::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo, { pRedl->InvalidateRange(); pRedlineTbl->DeleteAndDestroy( n-- ); - bChg = TRUE; + bChg = sal_True; } } @@ -1506,19 +1508,19 @@ bool SwDoc::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo, } bool SwDoc::DeleteRedline( const SwStartNode& rNode, bool bSaveInUndo, - USHORT nDelType ) + sal_uInt16 nDelType ) { SwPaM aTemp(*rNode.EndOfSectionNode(), rNode); return DeleteRedline(aTemp, bSaveInUndo, nDelType); } -USHORT SwDoc::GetRedlinePos( const SwNode& rNd, USHORT nType ) const +sal_uInt16 SwDoc::GetRedlinePos( const SwNode& rNd, sal_uInt16 nType ) const { - const ULONG nNdIdx = rNd.GetIndex(); - for( USHORT n = 0; n < pRedlineTbl->Count() ; ++n ) + const sal_uLong nNdIdx = rNd.GetIndex(); + for( sal_uInt16 n = 0; n < pRedlineTbl->Count() ; ++n ) { const SwRedline* pTmp = (*pRedlineTbl)[ n ]; - ULONG nPt = pTmp->GetPoint()->nNode.GetIndex(), + sal_uLong nPt = pTmp->GetPoint()->nNode.GetIndex(), nMk = pTmp->GetMark()->nNode.GetIndex(); if( nPt < nMk ) { long nTmp = nMk; nMk = nPt; nPt = nTmp; } @@ -1533,9 +1535,9 @@ USHORT SwDoc::GetRedlinePos( const SwNode& rNd, USHORT nType ) const } const SwRedline* SwDoc::GetRedline( const SwPosition& rPos, - USHORT* pFndPos ) const + sal_uInt16* pFndPos ) const { - USHORT nO = pRedlineTbl->Count(), nM, nU = 0; + sal_uInt16 nO = pRedlineTbl->Count(), nM, nU = 0; if( nO > 0 ) { nO--; @@ -1600,17 +1602,17 @@ const SwRedline* SwDoc::GetRedline( const SwPosition& rPos, return 0; } -typedef BOOL (*Fn_AcceptReject)( SwRedlineTbl& rArr, USHORT& rPos, - BOOL bCallDelete, +typedef sal_Bool (*Fn_AcceptReject)( SwRedlineTbl& rArr, sal_uInt16& rPos, + sal_Bool bCallDelete, const SwPosition* pSttRng, const SwPosition* pEndRng); -BOOL lcl_AcceptRedline( SwRedlineTbl& rArr, USHORT& rPos, - BOOL bCallDelete, +sal_Bool lcl_AcceptRedline( SwRedlineTbl& rArr, sal_uInt16& rPos, + sal_Bool bCallDelete, const SwPosition* pSttRng = 0, const SwPosition* pEndRng = 0 ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; SwRedline* pRedl = rArr[ rPos ]; SwPosition *pRStt = 0, *pREnd = 0; SwComparePosition eCmp = POS_OUTSIDE; @@ -1628,7 +1630,7 @@ BOOL lcl_AcceptRedline( SwRedlineTbl& rArr, USHORT& rPos, case nsRedlineType_t::REDLINE_INSERT: case nsRedlineType_t::REDLINE_FORMAT: { - BOOL bCheck = FALSE, bReplace = FALSE; + sal_Bool bCheck = sal_False, bReplace = sal_False; switch( eCmp ) { case POS_INSIDE: @@ -1644,18 +1646,18 @@ BOOL lcl_AcceptRedline( SwRedlineTbl& rArr, USHORT& rPos, rArr.Insert( pNew ); ++rPos; } pRedl->SetEnd( *pSttRng, pREnd ); - bCheck = TRUE; + bCheck = sal_True; } break; case POS_OVERLAP_BEFORE: pRedl->SetStart( *pEndRng, pRStt ); - bReplace = TRUE; + bReplace = sal_True; break; case POS_OVERLAP_BEHIND: pRedl->SetEnd( *pSttRng, pREnd ); - bCheck = TRUE; + bCheck = sal_True; break; case POS_OUTSIDE: @@ -1664,7 +1666,7 @@ BOOL lcl_AcceptRedline( SwRedlineTbl& rArr, USHORT& rPos, break; default: - bRet = FALSE; + bRet = sal_False; } if( bReplace || ( bCheck && !pRedl->HasValidRange() )) @@ -1679,7 +1681,7 @@ BOOL lcl_AcceptRedline( SwRedlineTbl& rArr, USHORT& rPos, { SwDoc& rDoc = *pRedl->GetDoc(); const SwPosition *pDelStt = 0, *pDelEnd = 0; - BOOL bDelRedl = FALSE; + sal_Bool bDelRedl = sal_False; switch( eCmp ) { case POS_INSIDE: @@ -1709,7 +1711,7 @@ BOOL lcl_AcceptRedline( SwRedlineTbl& rArr, USHORT& rPos, case POS_EQUAL: { rArr.Remove( rPos-- ); - bDelRedl = TRUE; + bDelRedl = sal_True; if( bCallDelete ) { pDelStt = pRedl->Start(); @@ -1718,7 +1720,7 @@ BOOL lcl_AcceptRedline( SwRedlineTbl& rArr, USHORT& rPos, } break; default: - bRet = FALSE; + bRet = sal_False; } if( pDelStt && pDelEnd ) @@ -1741,8 +1743,8 @@ BOOL lcl_AcceptRedline( SwRedlineTbl& rArr, USHORT& rPos, if( pCSttNd && !pCEndNd ) { - aPam.GetBound( TRUE ).nContent.Assign( 0, 0 ); - aPam.GetBound( FALSE ).nContent.Assign( 0, 0 ); + aPam.GetBound( sal_True ).nContent.Assign( 0, 0 ); + aPam.GetBound( sal_False ).nContent.Assign( 0, 0 ); aPam.DeleteMark(); rDoc.DelFullPara( aPam ); } @@ -1759,17 +1761,17 @@ BOOL lcl_AcceptRedline( SwRedlineTbl& rArr, USHORT& rPos, break; default: - bRet = FALSE; + bRet = sal_False; } return bRet; } -BOOL lcl_RejectRedline( SwRedlineTbl& rArr, USHORT& rPos, - BOOL bCallDelete, +sal_Bool lcl_RejectRedline( SwRedlineTbl& rArr, sal_uInt16& rPos, + sal_Bool bCallDelete, const SwPosition* pSttRng = 0, const SwPosition* pEndRng = 0 ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; SwRedline* pRedl = rArr[ rPos ]; SwPosition *pRStt = 0, *pREnd = 0; SwComparePosition eCmp = POS_OUTSIDE; @@ -1788,7 +1790,7 @@ BOOL lcl_RejectRedline( SwRedlineTbl& rArr, USHORT& rPos, { SwDoc& rDoc = *pRedl->GetDoc(); const SwPosition *pDelStt = 0, *pDelEnd = 0; - BOOL bDelRedl = FALSE; + sal_Bool bDelRedl = sal_False; switch( eCmp ) { case POS_INSIDE: @@ -1818,7 +1820,7 @@ BOOL lcl_RejectRedline( SwRedlineTbl& rArr, USHORT& rPos, { // dann den Bereich wieder loeschen rArr.Remove( rPos-- ); - bDelRedl = TRUE; + bDelRedl = sal_True; if( bCallDelete ) { pDelStt = pRedl->Start(); @@ -1828,7 +1830,7 @@ BOOL lcl_RejectRedline( SwRedlineTbl& rArr, USHORT& rPos, break; default: - bRet = FALSE; + bRet = sal_False; } if( pDelStt && pDelEnd ) { @@ -1851,8 +1853,8 @@ BOOL lcl_RejectRedline( SwRedlineTbl& rArr, USHORT& rPos, if( pCSttNd && !pCEndNd ) { - aPam.GetBound( TRUE ).nContent.Assign( 0, 0 ); - aPam.GetBound( FALSE ).nContent.Assign( 0, 0 ); + aPam.GetBound( sal_True ).nContent.Assign( 0, 0 ); + aPam.GetBound( sal_False ).nContent.Assign( 0, 0 ); aPam.DeleteMark(); rDoc.DelFullPara( aPam ); } @@ -1866,7 +1868,7 @@ BOOL lcl_RejectRedline( SwRedlineTbl& rArr, USHORT& rPos, case nsRedlineType_t::REDLINE_DELETE: { SwRedline* pNew = 0; - BOOL bCheck = FALSE, bReplace = FALSE; + sal_Bool bCheck = sal_False, bReplace = sal_False; switch( eCmp ) { @@ -1880,7 +1882,7 @@ BOOL lcl_RejectRedline( SwRedlineTbl& rArr, USHORT& rPos, if( *pSttRng == *pRStt ) { pRedl->SetStart( *pEndRng, pRStt ); - bReplace = TRUE; + bReplace = sal_True; if( pNew ) pNew->SetEnd( *pEndRng ); } @@ -1897,7 +1899,7 @@ BOOL lcl_RejectRedline( SwRedlineTbl& rArr, USHORT& rPos, } pRedl->SetEnd( *pSttRng, pREnd ); - bCheck = TRUE; + bCheck = sal_True; if( pNew ) pNew->SetStart( *pSttRng ); } @@ -1911,7 +1913,7 @@ BOOL lcl_RejectRedline( SwRedlineTbl& rArr, USHORT& rPos, pNew->PopData(); } pRedl->SetStart( *pEndRng, pRStt ); - bReplace = TRUE; + bReplace = sal_True; if( pNew ) pNew->SetEnd( *pEndRng ); break; @@ -1923,7 +1925,7 @@ BOOL lcl_RejectRedline( SwRedlineTbl& rArr, USHORT& rPos, pNew->PopData(); } pRedl->SetEnd( *pSttRng, pREnd ); - bCheck = TRUE; + bCheck = sal_True; if( pNew ) pNew->SetStart( *pSttRng ); break; @@ -1936,7 +1938,7 @@ BOOL lcl_RejectRedline( SwRedlineTbl& rArr, USHORT& rPos, break; default: - bRet = FALSE; + bRet = sal_False; } if( pNew ) @@ -1963,15 +1965,15 @@ BOOL lcl_RejectRedline( SwRedlineTbl& rArr, USHORT& rPos, break; default: - bRet = FALSE; + bRet = sal_False; } return bRet; } const SwRedline* lcl_FindCurrRedline( const SwPosition& rSttPos, - USHORT& rPos, - BOOL bNext = TRUE ) + sal_uInt16& rPos, + sal_Bool bNext = sal_True ) { const SwRedline* pFnd = 0; const SwRedlineTbl& rArr = rSttPos.nNode.GetNode().GetDoc()->GetRedlineTbl(); @@ -1999,16 +2001,16 @@ const SwRedline* lcl_FindCurrRedline( const SwPosition& rSttPos, } int lcl_AcceptRejectRedl( Fn_AcceptReject fn_AcceptReject, - SwRedlineTbl& rArr, BOOL bCallDelete, + SwRedlineTbl& rArr, sal_Bool bCallDelete, const SwPaM& rPam) { - USHORT n = 0; + sal_uInt16 n = 0; int nCount = 0; const SwPosition* pStt = rPam.Start(), * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark() : rPam.GetPoint(); - const SwRedline* pFnd = lcl_FindCurrRedline( *pStt, n, TRUE ); + const SwRedline* pFnd = lcl_FindCurrRedline( *pStt, n, sal_True ); if( pFnd && // neu ein Teil davon? ( *pFnd->Start() != *pStt || *pFnd->End() > *pEnd )) { @@ -2080,9 +2082,9 @@ void lcl_AdjustRedlineRange( SwPaM& rPam ) } -bool SwDoc::AcceptRedline( USHORT nPos, bool bCallDelete ) +bool SwDoc::AcceptRedline( sal_uInt16 nPos, bool bCallDelete ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; // aufjedenfall auf sichtbar umschalten if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) != @@ -2092,21 +2094,24 @@ bool SwDoc::AcceptRedline( USHORT nPos, bool bCallDelete ) SwRedline* pTmp = (*pRedlineTbl)[ nPos ]; if( pTmp->HasMark() && pTmp->IsVisible() ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, pTmp->GetDescr()); - StartUndo( UNDO_ACCEPT_REDLINE, &aRewriter); + GetIDocumentUndoRedo().StartUndo(UNDO_ACCEPT_REDLINE, &aRewriter); } int nLoopCnt = 2; - USHORT nSeqNo = pTmp->GetSeqNo(); + sal_uInt16 nSeqNo = pTmp->GetSeqNo(); do { - if( DoesUndo() ) - AppendUndo( new SwUndoAcceptRedline( *pTmp )); + if (GetIDocumentUndoRedo().DoesUndo()) + { + SwUndo *const pUndo( new SwUndoAcceptRedline(*pTmp) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); + } bRet |= lcl_AcceptRedline( *pRedlineTbl, nPos, bCallDelete ); @@ -2114,7 +2119,7 @@ bool SwDoc::AcceptRedline( USHORT nPos, bool bCallDelete ) { if( USHRT_MAX == nPos ) nPos = 0; - USHORT nFndPos = 2 == nLoopCnt + sal_uInt16 nFndPos = 2 == nLoopCnt ? pRedlineTbl->FindNextSeqNo( nSeqNo, nPos ) : pRedlineTbl->FindPrevSeqNo( nSeqNo, nPos ); if( USHRT_MAX != nFndPos || ( 0 != ( --nLoopCnt ) && @@ -2135,8 +2140,10 @@ bool SwDoc::AcceptRedline( USHORT nPos, bool bCallDelete ) SetModified(); } - if( DoesUndo() ) - EndUndo( UNDO_ACCEPT_REDLINE, NULL ); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().EndUndo(UNDO_END, 0); + } } return bRet; } @@ -2154,10 +2161,10 @@ bool SwDoc::AcceptRedline( const SwPaM& rPam, bool bCallDelete ) SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() ); lcl_AdjustRedlineRange( aPam ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - StartUndo( UNDO_ACCEPT_REDLINE, NULL ); - AppendUndo( new SwUndoAcceptRedline( aPam )); + GetIDocumentUndoRedo().StartUndo( UNDO_ACCEPT_REDLINE, NULL ); + GetIDocumentUndoRedo().AppendUndo( new SwUndoAcceptRedline( aPam )); } int nRet = lcl_AcceptRejectRedl( lcl_AcceptRedline, *pRedlineTbl, @@ -2167,7 +2174,7 @@ bool SwDoc::AcceptRedline( const SwPaM& rPam, bool bCallDelete ) CompressRedlines(); SetModified(); } - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { String aTmpStr; @@ -2180,14 +2187,14 @@ bool SwDoc::AcceptRedline( const SwPaM& rPam, bool bCallDelete ) SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, aTmpStr); - EndUndo( UNDO_ACCEPT_REDLINE, &aRewriter ); + GetIDocumentUndoRedo().EndUndo( UNDO_ACCEPT_REDLINE, &aRewriter ); } return nRet != 0; } -bool SwDoc::RejectRedline( USHORT nPos, bool bCallDelete ) +bool SwDoc::RejectRedline( sal_uInt16 nPos, bool bCallDelete ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; // aufjedenfall auf sichtbar umschalten if( (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) != @@ -2197,21 +2204,24 @@ bool SwDoc::RejectRedline( USHORT nPos, bool bCallDelete ) SwRedline* pTmp = (*pRedlineTbl)[ nPos ]; if( pTmp->HasMark() && pTmp->IsVisible() ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, pTmp->GetDescr()); - StartUndo( UNDO_REJECT_REDLINE, NULL ); + GetIDocumentUndoRedo().StartUndo(UNDO_REJECT_REDLINE, &aRewriter); } int nLoopCnt = 2; - USHORT nSeqNo = pTmp->GetSeqNo(); + sal_uInt16 nSeqNo = pTmp->GetSeqNo(); do { - if( DoesUndo() ) - AppendUndo( new SwUndoRejectRedline( *pTmp )); + if (GetIDocumentUndoRedo().DoesUndo()) + { + SwUndo *const pUndo( new SwUndoRejectRedline( *pTmp ) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); + } bRet |= lcl_RejectRedline( *pRedlineTbl, nPos, bCallDelete ); @@ -2219,7 +2229,7 @@ bool SwDoc::RejectRedline( USHORT nPos, bool bCallDelete ) { if( USHRT_MAX == nPos ) nPos = 0; - USHORT nFndPos = 2 == nLoopCnt + sal_uInt16 nFndPos = 2 == nLoopCnt ? pRedlineTbl->FindNextSeqNo( nSeqNo, nPos ) : pRedlineTbl->FindPrevSeqNo( nSeqNo, nPos ); if( USHRT_MAX != nFndPos || ( 0 != ( --nLoopCnt ) && @@ -2240,8 +2250,10 @@ bool SwDoc::RejectRedline( USHORT nPos, bool bCallDelete ) SetModified(); } - if( DoesUndo() ) - EndUndo( UNDO_REJECT_REDLINE, NULL ); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().EndUndo(UNDO_END, 0); + } } return bRet; } @@ -2259,10 +2271,10 @@ bool SwDoc::RejectRedline( const SwPaM& rPam, bool bCallDelete ) SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() ); lcl_AdjustRedlineRange( aPam ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - StartUndo( UNDO_REJECT_REDLINE, NULL ); - AppendUndo( new SwUndoRejectRedline( aPam )); + GetIDocumentUndoRedo().StartUndo( UNDO_REJECT_REDLINE, NULL ); + GetIDocumentUndoRedo().AppendUndo( new SwUndoRejectRedline(aPam) ); } int nRet = lcl_AcceptRejectRedl( lcl_RejectRedline, *pRedlineTbl, @@ -2272,7 +2284,7 @@ bool SwDoc::RejectRedline( const SwPaM& rPam, bool bCallDelete ) CompressRedlines(); SetModified(); } - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { String aTmpStr; @@ -2285,7 +2297,7 @@ bool SwDoc::RejectRedline( const SwPaM& rPam, bool bCallDelete ) SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, aTmpStr); - EndUndo( UNDO_REJECT_REDLINE, &aRewriter ); + GetIDocumentUndoRedo().EndUndo( UNDO_REJECT_REDLINE, &aRewriter ); } return nRet != 0; @@ -2298,12 +2310,12 @@ const SwRedline* SwDoc::SelNextRedline( SwPaM& rPam ) const SwPosition& rSttPos = *rPam.GetPoint(); SwPosition aSavePos( rSttPos ); - BOOL bRestart; + sal_Bool bRestart; // sollte die StartPos auf dem letzen gueligen ContentNode stehen, // dann aufjedenfall das naechste Redline nehmen - USHORT n = 0; - const SwRedline* pFnd = lcl_FindCurrRedline( rSttPos, n, TRUE ); + sal_uInt16 n = 0; + const SwRedline* pFnd = lcl_FindCurrRedline( rSttPos, n, sal_True ); if( pFnd ) { const SwPosition* pEnd = pFnd->End(); @@ -2320,7 +2332,7 @@ const SwRedline* SwDoc::SelNextRedline( SwPaM& rPam ) const } do { - bRestart = FALSE; + bRestart = sal_False; for( ; !pFnd && n < pRedlineTbl->Count(); ++n ) { @@ -2392,7 +2404,7 @@ const SwRedline* SwDoc::SelNextRedline( SwPaM& rPam ) const { if( n < pRedlineTbl->Count() ) { - bRestart = TRUE; + bRestart = sal_True; *rPam.GetPoint() = *pSaveFnd->End(); } else @@ -2415,12 +2427,12 @@ const SwRedline* SwDoc::SelPrevRedline( SwPaM& rPam ) const SwPosition& rSttPos = *rPam.GetPoint(); SwPosition aSavePos( rSttPos ); - BOOL bRestart; + sal_Bool bRestart; // sollte die StartPos auf dem ersten gueligen ContentNode stehen, // dann aufjedenfall das vorherige Redline nehmen - USHORT n = 0; - const SwRedline* pFnd = lcl_FindCurrRedline( rSttPos, n, FALSE ); + sal_uInt16 n = 0; + const SwRedline* pFnd = lcl_FindCurrRedline( rSttPos, n, sal_False ); if( pFnd ) { const SwPosition* pStt = pFnd->Start(); @@ -2437,7 +2449,7 @@ const SwRedline* SwDoc::SelPrevRedline( SwPaM& rPam ) const } do { - bRestart = FALSE; + bRestart = sal_False; while( !pFnd && 0 < n ) { @@ -2511,7 +2523,7 @@ const SwRedline* SwDoc::SelPrevRedline( SwPaM& rPam ) const { if( n ) { - bRestart = TRUE; + bRestart = sal_True; *rPam.GetPoint() = *pSaveFnd->Start(); } else @@ -2530,16 +2542,16 @@ const SwRedline* SwDoc::SelPrevRedline( SwPaM& rPam ) const // Kommentar am Redline setzen bool SwDoc::SetRedlineComment( const SwPaM& rPaM, const String& rS ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; const SwPosition* pStt = rPaM.Start(), * pEnd = pStt == rPaM.GetPoint() ? rPaM.GetMark() : rPaM.GetPoint(); - USHORT n = 0; - if( lcl_FindCurrRedline( *pStt, n, TRUE ) ) + sal_uInt16 n = 0; + if( lcl_FindCurrRedline( *pStt, n, sal_True ) ) { for( ; n < pRedlineTbl->Count(); ++n ) { - bRet = TRUE; + bRet = sal_True; SwRedline* pTmp = (*pRedlineTbl)[ n ]; if( pStt != pEnd && *pTmp->Start() > *pEnd ) break; @@ -2556,13 +2568,13 @@ bool SwDoc::SetRedlineComment( const SwPaM& rPaM, const String& rS ) } // legt gebenenfalls einen neuen Author an -USHORT SwDoc::GetRedlineAuthor() +sal_uInt16 SwDoc::GetRedlineAuthor() { return SW_MOD()->GetRedlineAuthor(); } // fuer die Reader usw. - neuen Author in die Tabelle eintragen -USHORT SwDoc::InsertRedlineAuthor( const String& rNew ) +sal_uInt16 SwDoc::InsertRedlineAuthor( const String& rNew ) { return SW_MOD()->InsertRedlineAuthor(rNew); } @@ -2570,7 +2582,7 @@ USHORT SwDoc::InsertRedlineAuthor( const String& rNew ) void SwDoc::UpdateRedlineAttr() { const SwRedlineTbl& rTbl = GetRedlineTbl(); - for( USHORT n = 0; n < rTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rTbl.Count(); ++n ) { SwRedline* pRedl = rTbl[ n ]; if( pRedl->IsVisible() ) @@ -2581,7 +2593,7 @@ void SwDoc::UpdateRedlineAttr() // setze Kommentar-Text fuers Redline, das dann per AppendRedline // hereinkommt. Wird vom Autoformat benutzt. 0-Pointer setzt den Modus // wieder zurueck. Pointer wird nicht kopiert, muss also gueltig bleiben! -void SwDoc::SetAutoFmtRedlineComment( const String* pTxt, USHORT nSeqNo ) +void SwDoc::SetAutoFmtRedlineComment( const String* pTxt, sal_uInt16 nSeqNo ) { mbIsAutoFmtRedline = 0 != pTxt; if( pTxt ) @@ -2606,9 +2618,9 @@ void SwDoc::SetRedlinePassword( /* */ -BOOL SwRedlineTbl::Insert( SwRedlinePtr& p, BOOL bIns ) +sal_Bool SwRedlineTbl::Insert( SwRedlinePtr& p, sal_Bool bIns ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( p->HasValidRange() ) { bRet = _SwRedlineTbl::Insert( p ); @@ -2623,9 +2635,9 @@ BOOL SwRedlineTbl::Insert( SwRedlinePtr& p, BOOL bIns ) return bRet; } -BOOL SwRedlineTbl::Insert( SwRedlinePtr& p, USHORT& rP, BOOL bIns ) +sal_Bool SwRedlineTbl::Insert( SwRedlinePtr& p, sal_uInt16& rP, sal_Bool bIns ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( p->HasValidRange() ) { bRet = _SwRedlineTbl::Insert( p, rP ); @@ -2640,10 +2652,10 @@ BOOL SwRedlineTbl::Insert( SwRedlinePtr& p, USHORT& rP, BOOL bIns ) return bRet; } -BOOL SwRedlineTbl::InsertWithValidRanges( SwRedlinePtr& p, USHORT* pInsPos ) +sal_Bool SwRedlineTbl::InsertWithValidRanges( SwRedlinePtr& p, sal_uInt16* pInsPos ) { // erzeuge aus den Selektion gueltige "Teilbereiche". - BOOL bAnyIns = FALSE; + sal_Bool bAnyIns = sal_False; SwPosition* pStt = p->Start(), * pEnd = pStt == p->GetPoint() ? p->GetMark() : p->GetPoint(); SwPosition aNewStt( *pStt ); @@ -2660,7 +2672,7 @@ BOOL SwRedlineTbl::InsertWithValidRanges( SwRedlinePtr& p, USHORT* pInsPos ) } SwRedline* pNew = 0; - USHORT nInsPos; + sal_uInt16 nInsPos; if( aNewStt < *pEnd ) do { @@ -2685,7 +2697,7 @@ BOOL SwRedlineTbl::InsertWithValidRanges( SwRedlinePtr& p, USHORT* pInsPos ) { // We want to be before the table *pNew->GetPoint() = SwPosition(*pTab); - pC = GoPreviousNds( &pNew->GetPoint()->nNode, FALSE ); // here we are. + pC = GoPreviousNds( &pNew->GetPoint()->nNode, sal_False ); // here we are. if( pC ) pNew->GetPoint()->nContent.Assign( pC, 0 ); pTab = pNew->GetPoint()->nNode.GetNode().StartOfSectionNode()->FindTableNode(); @@ -2730,7 +2742,7 @@ BOOL SwRedlineTbl::InsertWithValidRanges( SwRedlinePtr& p, USHORT* pInsPos ) _SwRedlineTbl::Insert( pNew, nInsPos ) ) { pNew->CallDisplayFunc(); - bAnyIns = TRUE; + bAnyIns = sal_True; pNew = 0; if( pInsPos && *pInsPos < nInsPos ) *pInsPos = nInsPos; @@ -2749,7 +2761,7 @@ BOOL SwRedlineTbl::InsertWithValidRanges( SwRedlinePtr& p, USHORT* pInsPos ) return bAnyIns; } -void SwRedlineTbl::Remove( USHORT nP, USHORT nL ) +void SwRedlineTbl::Remove( sal_uInt16 nP, sal_uInt16 nL ) { SwDoc* pDoc = 0; if( !nP && nL && nL == _SwRedlineTbl::Count() ) @@ -2763,7 +2775,7 @@ void SwRedlineTbl::Remove( USHORT nP, USHORT nL ) pSh->InvalidateWindows( SwRect( 0, 0, LONG_MAX, LONG_MAX ) ); } -void SwRedlineTbl::DeleteAndDestroy( USHORT nP, USHORT nL ) +void SwRedlineTbl::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) { SwDoc* pDoc = 0; if( !nP && nL && nL == _SwRedlineTbl::Count() ) @@ -2780,7 +2792,7 @@ void SwRedlineTbl::DeleteAndDestroy( USHORT nP, USHORT nL ) // suche den naechsten oder vorherigen Redline mit dergleichen Seq.No // Mit dem Lookahead kann die Suche eingeschraenkt werden. 0 oder // USHRT_MAX suchen im gesamten Array. -USHORT SwRedlineTbl::FindNextOfSeqNo( USHORT nSttPos, USHORT nLookahead ) const +sal_uInt16 SwRedlineTbl::FindNextOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead ) const { return nSttPos + 1 < _SwRedlineTbl::Count() ? FindNextSeqNo( _SwRedlineTbl::GetObject( nSttPos ) @@ -2788,7 +2800,7 @@ USHORT SwRedlineTbl::FindNextOfSeqNo( USHORT nSttPos, USHORT nLookahead ) const : USHRT_MAX; } -USHORT SwRedlineTbl::FindPrevOfSeqNo( USHORT nSttPos, USHORT nLookahead ) const +sal_uInt16 SwRedlineTbl::FindPrevOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead ) const { return nSttPos ? FindPrevSeqNo( _SwRedlineTbl::GetObject( nSttPos )->GetSeqNo(), @@ -2796,10 +2808,10 @@ USHORT SwRedlineTbl::FindPrevOfSeqNo( USHORT nSttPos, USHORT nLookahead ) const : USHRT_MAX; } -USHORT SwRedlineTbl::FindNextSeqNo( USHORT nSeqNo, USHORT nSttPos, - USHORT nLookahead ) const +sal_uInt16 SwRedlineTbl::FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos, + sal_uInt16 nLookahead ) const { - USHORT nRet = USHRT_MAX, nEnd; + sal_uInt16 nRet = USHRT_MAX, nEnd; if( nSeqNo && nSttPos < _SwRedlineTbl::Count() ) { nEnd = _SwRedlineTbl::Count(); @@ -2817,10 +2829,10 @@ USHORT SwRedlineTbl::FindNextSeqNo( USHORT nSeqNo, USHORT nSttPos, return nRet; } -USHORT SwRedlineTbl::FindPrevSeqNo( USHORT nSeqNo, USHORT nSttPos, - USHORT nLookahead ) const +sal_uInt16 SwRedlineTbl::FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos, + sal_uInt16 nLookahead ) const { - USHORT nRet = USHRT_MAX, nEnd; + sal_uInt16 nRet = USHRT_MAX, nEnd; if( nSeqNo && nSttPos < _SwRedlineTbl::Count() ) { nEnd = 0; @@ -2854,12 +2866,12 @@ void SwRedlineExtraData::Reject( SwPaM& ) const int SwRedlineExtraData::operator == ( const SwRedlineExtraData& ) const { - return FALSE; + return sal_False; } SwRedlineExtraData_FmtColl::SwRedlineExtraData_FmtColl( const String& rColl, - USHORT nPoolFmtId, + sal_uInt16 nPoolFmtId, const SfxItemSet* pItemSet ) : sFmtNm(rColl), pSet(0), nPoolId(nPoolFmtId) { @@ -2937,7 +2949,7 @@ SwRedlineExtraData_Format::SwRedlineExtraData_Format( const SfxItemSet& rSet ) { SfxItemIter aIter( rSet ); const SfxPoolItem* pItem = aIter.FirstItem(); - while( TRUE ) + while( sal_True ) { aWhichIds.Insert( pItem->Which(), aWhichIds.Count() ); if( aIter.IsAtEnd() ) @@ -2948,7 +2960,7 @@ SwRedlineExtraData_Format::SwRedlineExtraData_Format( const SfxItemSet& rSet ) SwRedlineExtraData_Format::SwRedlineExtraData_Format( const SwRedlineExtraData_Format& rCpy ) - : SwRedlineExtraData(), aWhichIds( (BYTE)rCpy.aWhichIds.Count() ) + : SwRedlineExtraData(), aWhichIds( (sal_uInt8)rCpy.aWhichIds.Count() ) { aWhichIds.Insert( &rCpy.aWhichIds, 0 ); } @@ -2970,7 +2982,7 @@ void SwRedlineExtraData_Format::Reject( SwPaM& rPam ) const pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE))); // eigentlich muesste hier das Attribut zurueck gesetzt werden!!! - for( USHORT n = 0, nEnd = aWhichIds.Count(); n < nEnd; ++n ) + for( sal_uInt16 n = 0, nEnd = aWhichIds.Count(); n < nEnd; ++n ) { pDoc->InsertPoolItem( rPam, *GetDfltAttr( aWhichIds[ n ] ), nsSetAttrMode::SETATTR_DONTEXPAND ); @@ -2982,11 +2994,11 @@ void SwRedlineExtraData_Format::Reject( SwPaM& rPam ) const int SwRedlineExtraData_Format::operator == ( const SwRedlineExtraData& rCmp ) const { int nRet = 1; - USHORT nEnd = aWhichIds.Count(); + sal_uInt16 n = 0, nEnd = aWhichIds.Count(); if( nEnd != ((SwRedlineExtraData_Format&)rCmp).aWhichIds.Count() ) nRet = 0; else - for(USHORT n=0 ; n < nEnd; ++n ) + for( ; n < nEnd; ++n ) if( ((SwRedlineExtraData_Format&)rCmp).aWhichIds[n] != aWhichIds[n]) { nRet = 0; @@ -2995,14 +3007,14 @@ int SwRedlineExtraData_Format::operator == ( const SwRedlineExtraData& rCmp ) co return nRet; } -SwRedlineData::SwRedlineData( RedlineType_t eT, USHORT nAut ) +SwRedlineData::SwRedlineData( RedlineType_t eT, sal_uInt16 nAut ) : pNext( 0 ), pExtraData( 0 ), eType( eT ), nAuthor( nAut ), nSeqNo( 0 ) { aStamp.SetSec( 0 ); aStamp.Set100Sec( 0 ); } -SwRedlineData::SwRedlineData( const SwRedlineData& rCpy, BOOL bCpyNext ) +SwRedlineData::SwRedlineData( const SwRedlineData& rCpy, sal_Bool bCpyNext ) : pNext( (bCpyNext && rCpy.pNext) ? new SwRedlineData( *rCpy.pNext ) : 0 ), pExtraData( rCpy.pExtraData ? rCpy.pExtraData->CreateNew() : 0 ), @@ -3012,7 +3024,7 @@ SwRedlineData::SwRedlineData( const SwRedlineData& rCpy, BOOL bCpyNext ) } // fuer sw3io: pNext geht in eigenen Besitz ueber! -SwRedlineData::SwRedlineData(RedlineType_t eT, USHORT nAut, const DateTime& rDT, +SwRedlineData::SwRedlineData(RedlineType_t eT, sal_uInt16 nAut, const DateTime& rDT, const String& rCmnt, SwRedlineData *pNxt, SwRedlineExtraData* pData) : pNext(pNxt), pExtraData(pData), sComment(rCmnt), aStamp(rDT), eType(eT), nAuthor(nAut), nSeqNo(0) @@ -3051,8 +3063,8 @@ SwRedline::SwRedline(RedlineType_t eTyp, const SwPaM& rPam ) pRedlineData( new SwRedlineData( eTyp, GetDoc()->GetRedlineAuthor() ) ), pCntntSect( 0 ) { - bDelLastPara = bIsLastParaDelete = FALSE; - bIsVisible = TRUE; + bDelLastPara = bIsLastParaDelete = sal_False; + bIsVisible = sal_True; if( !rPam.HasMark() ) DeleteMark(); } @@ -3062,8 +3074,8 @@ SwRedline::SwRedline( const SwRedlineData& rData, const SwPaM& rPam ) pRedlineData( new SwRedlineData( rData )), pCntntSect( 0 ) { - bDelLastPara = bIsLastParaDelete = FALSE; - bIsVisible = TRUE; + bDelLastPara = bIsLastParaDelete = sal_False; + bIsVisible = sal_True; if( !rPam.HasMark() ) DeleteMark(); } @@ -3073,8 +3085,8 @@ SwRedline::SwRedline( const SwRedlineData& rData, const SwPosition& rPos ) pRedlineData( new SwRedlineData( rData )), pCntntSect( 0 ) { - bDelLastPara = bIsLastParaDelete = FALSE; - bIsVisible = TRUE; + bDelLastPara = bIsLastParaDelete = sal_False; + bIsVisible = sal_True; } SwRedline::SwRedline( const SwRedline& rCpy ) @@ -3082,8 +3094,8 @@ SwRedline::SwRedline( const SwRedline& rCpy ) pRedlineData( new SwRedlineData( *rCpy.pRedlineData )), pCntntSect( 0 ) { - bDelLastPara = bIsLastParaDelete = FALSE; - bIsVisible = TRUE; + bDelLastPara = bIsLastParaDelete = sal_False; + bIsVisible = sal_True; if( !rCpy.HasMark() ) DeleteMark(); } @@ -3101,7 +3113,7 @@ SwRedline::~SwRedline() } // liegt eine gueltige Selektion vor? -BOOL SwRedline::HasValidRange() const +sal_Bool SwRedline::HasValidRange() const { const SwNode* pPtNd = &GetPoint()->nNode.GetNode(), * pMkNd = &GetMark()->nNode.GetNode(); @@ -3112,11 +3124,11 @@ BOOL SwRedline::HasValidRange() const ( pPtNd != pMkNd || GetContentIdx() != NULL || pPtNd != &pPtNd->GetNodes().GetEndOfContent() ) ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } -void SwRedline::CallDisplayFunc( USHORT nLoop ) +void SwRedline::CallDisplayFunc( sal_uInt16 nLoop ) { switch( nsRedlineMode_t::REDLINE_SHOW_MASK & GetDoc()->GetRedlineMode() ) { @@ -3132,25 +3144,24 @@ void SwRedline::CallDisplayFunc( USHORT nLoop ) } } -void SwRedline::Show( USHORT nLoop ) +void SwRedline::Show( sal_uInt16 nLoop ) { if( 1 <= nLoop ) { SwDoc* pDoc = GetDoc(); RedlineMode_t eOld = pDoc->GetRedlineMode(); pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); switch( GetType() ) { case nsRedlineType_t::REDLINE_INSERT: // Inhalt wurde eingefuegt - bIsVisible = TRUE; + bIsVisible = sal_True; MoveFromSection(); break; case nsRedlineType_t::REDLINE_DELETE: // Inhalt wurde geloescht - bIsVisible = TRUE; + bIsVisible = sal_True; MoveFromSection(); break; @@ -3162,28 +3173,26 @@ void SwRedline::Show( USHORT nLoop ) break; } pDoc->SetRedlineMode_intern( eOld ); - pDoc->DoUndo( bUndo ); } } -void SwRedline::Hide( USHORT nLoop ) +void SwRedline::Hide( sal_uInt16 nLoop ) { SwDoc* pDoc = GetDoc(); RedlineMode_t eOld = pDoc->GetRedlineMode(); pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); switch( GetType() ) { case nsRedlineType_t::REDLINE_INSERT: // Inhalt wurde eingefuegt - bIsVisible = TRUE; + bIsVisible = sal_True; if( 1 <= nLoop ) MoveFromSection(); break; case nsRedlineType_t::REDLINE_DELETE: // Inhalt wurde geloescht - bIsVisible = FALSE; + bIsVisible = sal_False; switch( nLoop ) { case 0: MoveToSection(); break; @@ -3201,18 +3210,16 @@ void SwRedline::Hide( USHORT nLoop ) break; } pDoc->SetRedlineMode_intern( eOld ); - pDoc->DoUndo( bUndo ); } -void SwRedline::ShowOriginal( USHORT nLoop ) +void SwRedline::ShowOriginal( sal_uInt16 nLoop ) { SwDoc* pDoc = GetDoc(); RedlineMode_t eOld = pDoc->GetRedlineMode(); SwRedlineData* pCur; pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); // bestimme den Type, ist der erste auf Stack for( pCur = pRedlineData; pCur->pNext; ) @@ -3221,7 +3228,7 @@ void SwRedline::ShowOriginal( USHORT nLoop ) switch( pCur->eType ) { case nsRedlineType_t::REDLINE_INSERT: // Inhalt wurde eingefuegt - bIsVisible = FALSE; + bIsVisible = sal_False; switch( nLoop ) { case 0: MoveToSection(); break; @@ -3231,7 +3238,7 @@ void SwRedline::ShowOriginal( USHORT nLoop ) break; case nsRedlineType_t::REDLINE_DELETE: // Inhalt wurde geloescht - bIsVisible = TRUE; + bIsVisible = sal_True; if( 1 <= nLoop ) MoveFromSection(); break; @@ -3245,27 +3252,26 @@ void SwRedline::ShowOriginal( USHORT nLoop ) break; } pDoc->SetRedlineMode_intern( eOld ); - pDoc->DoUndo( bUndo ); } void SwRedline::InvalidateRange() // das Layout anstossen { - ULONG nSttNd = GetMark()->nNode.GetIndex(), + sal_uLong nSttNd = GetMark()->nNode.GetIndex(), nEndNd = GetPoint()->nNode.GetIndex(); - USHORT nSttCnt = GetMark()->nContent.GetIndex(), + sal_uInt16 nSttCnt = GetMark()->nContent.GetIndex(), nEndCnt = GetPoint()->nContent.GetIndex(); if( nSttNd > nEndNd || ( nSttNd == nEndNd && nSttCnt > nEndCnt )) { - ULONG nTmp = nSttNd; nSttNd = nEndNd; nEndNd = nTmp; - nTmp = nSttCnt; nSttCnt = nEndCnt; nEndCnt = (USHORT)nTmp; + sal_uLong nTmp = nSttNd; nSttNd = nEndNd; nEndNd = nTmp; + nTmp = nSttCnt; nSttCnt = nEndCnt; nEndCnt = (sal_uInt16)nTmp; } SwUpdateAttr aHt( 0, 0, RES_FMT_CHG ); SwNodes& rNds = GetDoc()->GetNodes(); SwNode* pNd; - for( ULONG n = nSttNd; n <= nEndNd; ++n ) + for( sal_uLong n = nSttNd; n <= nEndNd; ++n ) if( ND_TEXTNODE == ( pNd = rNds[ n ] )->GetNodeType() ) { aHt.nStart = n == nSttNd ? nSttCnt : 0; @@ -3280,7 +3286,7 @@ void SwRedline::InvalidateRange() // das Layout anstossen * text node nNdIdx *************************************************************************/ -void SwRedline::CalcStartEnd( ULONG nNdIdx, USHORT& nStart, USHORT& nEnd ) const +void SwRedline::CalcStartEnd( sal_uLong nNdIdx, sal_uInt16& nStart, sal_uInt16& nEnd ) const { const SwPosition *pRStt = Start(), *pREnd = End(); if( pRStt->nNode < nNdIdx ) @@ -3330,13 +3336,13 @@ void SwRedline::MoveToSection() // damit die Indizies der anderen Redlines nicht mitverschoben // werden, diese aufs Ende setzen (ist exclusive). const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl(); - for( USHORT n = 0; n < rTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rTbl.Count(); ++n ) { SwRedline* pRedl = rTbl[ n ]; - if( pRedl->GetBound(TRUE) == *pStt ) - pRedl->GetBound(TRUE) = *pEnd; - if( pRedl->GetBound(FALSE) == *pStt ) - pRedl->GetBound(FALSE) = *pEnd; + if( pRedl->GetBound(sal_True) == *pStt ) + pRedl->GetBound(sal_True) = *pEnd; + if( pRedl->GetBound(sal_False) == *pStt ) + pRedl->GetBound(sal_False) = *pEnd; } } @@ -3362,7 +3368,7 @@ void SwRedline::MoveToSection() else { if( pCSttNd && !pCEndNd ) - bDelLastPara = TRUE; + bDelLastPara = sal_True; pDoc->MoveRange( aPam, aPos, IDocumentContentOperations::DOC_MOVEDEFAULT ); } @@ -3401,9 +3407,9 @@ void SwRedline::CopyToSection() SwDoc* pDoc = GetDoc(); SwNodes& rNds = pDoc->GetNodes(); - BOOL bSaveCopyFlag = pDoc->IsCopyIsMove(), + sal_Bool bSaveCopyFlag = pDoc->IsCopyIsMove(), bSaveRdlMoveFlg = pDoc->IsRedlineMove(); - pDoc->SetCopyIsMove( TRUE ); + pDoc->SetCopyIsMove( sal_True ); // The IsRedlineMove() flag causes the behaviour of the // SwDoc::_CopyFlyInFly method to change, which will eventually be @@ -3483,13 +3489,13 @@ void SwRedline::DelCopyOfSection() // damit die Indizies der anderen Redlines nicht mitverschoben // werden, diese aufs Ende setzen (ist exclusive). const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl(); - for( USHORT n = 0; n < rTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rTbl.Count(); ++n ) { SwRedline* pRedl = rTbl[ n ]; - if( pRedl->GetBound(TRUE) == *pStt ) - pRedl->GetBound(TRUE) = *pEnd; - if( pRedl->GetBound(FALSE) == *pStt ) - pRedl->GetBound(FALSE) = *pEnd; + if( pRedl->GetBound(sal_True) == *pStt ) + pRedl->GetBound(sal_True) = *pEnd; + if( pRedl->GetBound(sal_False) == *pStt ) + pRedl->GetBound(sal_False) = *pEnd; } } @@ -3501,7 +3507,7 @@ void SwRedline::DelCopyOfSection() else if( pCSttNd || pCEndNd ) { if( pCSttNd && !pCEndNd ) - bDelLastPara = TRUE; + bDelLastPara = sal_True; pDoc->DeleteRange( aPam ); if( bDelLastPara ) @@ -3513,21 +3519,21 @@ void SwRedline::DelCopyOfSection() // bDelLastPara condition above), only redlines before the // current ones can be affected. const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl(); - USHORT n = rTbl.GetPos( this ); + sal_uInt16 n = rTbl.GetPos( this ); OSL_ENSURE( n != USHRT_MAX, "How strange. We don't exist!" ); - for( BOOL bBreak = FALSE; !bBreak && n > 0; ) + for( sal_Bool bBreak = sal_False; !bBreak && n > 0; ) { --n; - bBreak = TRUE; - if( rTbl[ n ]->GetBound(TRUE) == *aPam.GetPoint() ) + bBreak = sal_True; + if( rTbl[ n ]->GetBound(sal_True) == *aPam.GetPoint() ) { - rTbl[ n ]->GetBound(TRUE) = *pEnd; - bBreak = FALSE; + rTbl[ n ]->GetBound(sal_True) = *pEnd; + bBreak = sal_False; } - if( rTbl[ n ]->GetBound(FALSE) == *aPam.GetPoint() ) + if( rTbl[ n ]->GetBound(sal_False) == *aPam.GetPoint() ) { - rTbl[ n ]->GetBound(FALSE) = *pEnd; - bBreak = FALSE; + rTbl[ n ]->GetBound(sal_False) = *pEnd; + bBreak = sal_False; } } @@ -3536,8 +3542,8 @@ void SwRedline::DelCopyOfSection() *GetMark() = *pEnd; DeleteMark(); - aPam.GetBound( TRUE ).nContent.Assign( 0, 0 ); - aPam.GetBound( FALSE ).nContent.Assign( 0, 0 ); + aPam.GetBound( sal_True ).nContent.Assign( 0, 0 ); + aPam.GetBound( sal_False ).nContent.Assign( 0, 0 ); aPam.DeleteMark(); pDoc->DelFullPara( aPam ); } @@ -3561,42 +3567,42 @@ void SwRedline::MoveFromSection() SwDoc* pDoc = GetDoc(); const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl(); SvPtrarr aBeforeArr( 16, 16 ), aBehindArr( 16, 16 ); - USHORT nMyPos = rTbl.GetPos( this ); + sal_uInt16 nMyPos = rTbl.GetPos( this ); OSL_ENSURE( this, "this nicht im Array?" ); - BOOL bBreak = FALSE; - USHORT n; + sal_Bool bBreak = sal_False; + sal_uInt16 n; for( n = nMyPos+1; !bBreak && n < rTbl.Count(); ++n ) { - bBreak = TRUE; - if( rTbl[ n ]->GetBound(TRUE) == *GetPoint() ) + bBreak = sal_True; + if( rTbl[ n ]->GetBound(sal_True) == *GetPoint() ) { - void* pTmp = &rTbl[ n ]->GetBound(TRUE); + void* pTmp = &rTbl[ n ]->GetBound(sal_True); aBehindArr.Insert( pTmp, aBehindArr.Count()); - bBreak = FALSE; + bBreak = sal_False; } - if( rTbl[ n ]->GetBound(FALSE) == *GetPoint() ) + if( rTbl[ n ]->GetBound(sal_False) == *GetPoint() ) { - void* pTmp = &rTbl[ n ]->GetBound(FALSE); + void* pTmp = &rTbl[ n ]->GetBound(sal_False); aBehindArr.Insert( pTmp, aBehindArr.Count() ); - bBreak = FALSE; + bBreak = sal_False; } } - for( bBreak = FALSE, n = nMyPos; !bBreak && n ; ) + for( bBreak = sal_False, n = nMyPos; !bBreak && n ; ) { --n; - bBreak = TRUE; - if( rTbl[ n ]->GetBound(TRUE) == *GetPoint() ) + bBreak = sal_True; + if( rTbl[ n ]->GetBound(sal_True) == *GetPoint() ) { - void* pTmp = &rTbl[ n ]->GetBound(TRUE); + void* pTmp = &rTbl[ n ]->GetBound(sal_True); aBeforeArr.Insert( pTmp, aBeforeArr.Count() ); - bBreak = FALSE; + bBreak = sal_False; } - if( rTbl[ n ]->GetBound(FALSE) == *GetPoint() ) + if( rTbl[ n ]->GetBound(sal_False) == *GetPoint() ) { - void* pTmp = &rTbl[ n ]->GetBound(FALSE); + void* pTmp = &rTbl[ n ]->GetBound(sal_False); aBeforeArr.Insert( pTmp, aBeforeArr.Count() ); - bBreak = FALSE; + bBreak = sal_False; } } @@ -3616,7 +3622,7 @@ void SwRedline::MoveFromSection() ? pCNd->GetFmtColl() : 0; SwNodeIndex aNdIdx( GetPoint()->nNode, -1 ); - USHORT nPos = GetPoint()->nContent.GetIndex(); + sal_uInt16 nPos = GetPoint()->nContent.GetIndex(); SwPosition aPos( *GetPoint() ); if( bDelLastPara && *aPam.GetPoint() == *aPam.GetMark() ) @@ -3641,7 +3647,7 @@ void SwRedline::MoveFromSection() { GetPoint()->nNode++; GetPoint()->nContent.Assign( pCNd = GetCntntNode(), 0 ); - bDelLastPara = FALSE; + bDelLastPara = sal_False; } else if( pColl ) pCNd = GetCntntNode(); @@ -3681,12 +3687,12 @@ void SwRedline::SetContentIdx( const SwNodeIndex* pIdx ) if( pIdx && !pCntntSect ) { pCntntSect = new SwNodeIndex( *pIdx ); - bIsVisible = FALSE; + bIsVisible = sal_False; } else if( !pIdx && pCntntSect ) { delete pCntntSect, pCntntSect = 0; - bIsVisible = FALSE; + bIsVisible = sal_False; } #if OSL_DEBUG_LEVEL > 1 else @@ -3694,15 +3700,15 @@ void SwRedline::SetContentIdx( const SwNodeIndex* pIdx ) #endif } -BOOL SwRedline::CanCombine( const SwRedline& rRedl ) const +sal_Bool SwRedline::CanCombine( const SwRedline& rRedl ) const { return IsVisible() && rRedl.IsVisible() && pRedlineData->CanCombine( *rRedl.pRedlineData ); } -void SwRedline::PushData( const SwRedline& rRedl, BOOL bOwnAsNext ) +void SwRedline::PushData( const SwRedline& rRedl, sal_Bool bOwnAsNext ) { - SwRedlineData* pNew = new SwRedlineData( *rRedl.pRedlineData, FALSE ); + SwRedlineData* pNew = new SwRedlineData( *rRedl.pRedlineData, sal_False ); if( bOwnAsNext ) { pNew->pNext = pRedlineData; @@ -3715,46 +3721,46 @@ void SwRedline::PushData( const SwRedline& rRedl, BOOL bOwnAsNext ) } } -BOOL SwRedline::PopData() +sal_Bool SwRedline::PopData() { if( !pRedlineData->pNext ) - return FALSE; + return sal_False; SwRedlineData* pCur = pRedlineData; pRedlineData = pCur->pNext; pCur->pNext = 0; delete pCur; - return TRUE; + return sal_True; } -USHORT SwRedline::GetStackCount() const +sal_uInt16 SwRedline::GetStackCount() const { - USHORT nRet = 1; + sal_uInt16 nRet = 1; for( SwRedlineData* pCur = pRedlineData; pCur->pNext; ++nRet ) pCur = pCur->pNext; return nRet; } -USHORT SwRedline::GetAuthor( USHORT nPos ) const +sal_uInt16 SwRedline::GetAuthor( sal_uInt16 nPos ) const { return GetRedlineData(nPos).nAuthor; } -const String& SwRedline::GetAuthorString( USHORT nPos ) const +const String& SwRedline::GetAuthorString( sal_uInt16 nPos ) const { return SW_MOD()->GetRedlineAuthor(GetRedlineData(nPos).nAuthor); } -const DateTime& SwRedline::GetTimeStamp( USHORT nPos ) const +const DateTime& SwRedline::GetTimeStamp( sal_uInt16 nPos ) const { return GetRedlineData(nPos).aStamp; } -RedlineType_t SwRedline::GetRealType( USHORT nPos ) const +RedlineType_t SwRedline::GetRealType( sal_uInt16 nPos ) const { return GetRedlineData(nPos).eType; } -const String& SwRedline::GetComment( USHORT nPos ) const +const String& SwRedline::GetComment( sal_uInt16 nPos ) const { return GetRedlineData(nPos).sComment; } @@ -3766,18 +3772,18 @@ int SwRedline::operator==( const SwRedline& rCmp ) const int SwRedline::operator<( const SwRedline& rCmp ) const { - BOOL nResult = FALSE; + sal_Bool nResult = sal_False; if (*Start() < *rCmp.Start()) - nResult = TRUE; + nResult = sal_True; else if (*Start() == *rCmp.Start()) if (*End() < *rCmp.End()) - nResult = TRUE; + nResult = sal_True; return nResult; } -const SwRedlineData & SwRedline::GetRedlineData(USHORT nPos) const +const SwRedlineData & SwRedline::GetRedlineData(sal_uInt16 nPos) const { SwRedlineData * pCur = pRedlineData; @@ -3793,7 +3799,7 @@ const SwRedlineData & SwRedline::GetRedlineData(USHORT nPos) const return *pCur; } -String SwRedline::GetDescr(USHORT nPos) +String SwRedline::GetDescr(sal_uInt16 nPos) { String aResult; @@ -3837,11 +3843,11 @@ String SwRedline::GetDescr(USHORT nPos) bool SwDoc::IsInRedlines(const SwNode & rNode) const { SwPosition aPos(rNode); - SwNode & rEndOfRedlines = aNodes.GetEndOfRedlines(); + SwNode & rEndOfRedlines = GetNodes().GetEndOfRedlines(); SwPaM aPam(SwPosition(*rEndOfRedlines.StartOfSectionNode()), SwPosition(rEndOfRedlines)); - return aPam.ContainsPosition(aPos) ? sal_True : sal_False; + return aPam.ContainsPosition(aPos) ? true : false; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx index 759002c3ac4e..564e8d7e6989 100644 --- a/sw/source/core/doc/docruby.cxx +++ b/sw/source/core/doc/docruby.cxx @@ -29,14 +29,16 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <string.h> // fuer strchr() -#include <hintids.hxx> #include <com/sun/star/i18n/UnicodeType.hdl> #include <com/sun/star/i18n/WordType.hdl> + #include <unotools/charclass.hxx> + +#include <hintids.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <mvsave.hxx> // Strukturen zum Sichern beim Move/Delete #include <ndtxt.hxx> @@ -44,7 +46,6 @@ #include <rubylist.hxx> #include <pam.hxx> #include <swundo.hxx> // fuer die UndoIds -#include <undobj.hxx> #include <breakit.hxx> #include <crsskip.hxx> @@ -60,12 +61,12 @@ using namespace ::com::sun::star::i18n; * * */ -USHORT SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList, - USHORT nMode ) +sal_uInt16 SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList, + sal_uInt16 nMode ) { const SwPaM *_pStartCrsr = (SwPaM*)rPam.GetNext(), *__pStartCrsr = _pStartCrsr; - BOOL bCheckEmpty = &rPam != _pStartCrsr; + sal_Bool bCheckEmpty = &rPam != _pStartCrsr; do { const SwPosition* pStt = _pStartCrsr->Start(), * pEnd = pStt == _pStartCrsr->GetPoint() @@ -106,18 +107,18 @@ USHORT SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList, return rList.Count(); } -USHORT SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList, - USHORT nMode ) +sal_uInt16 SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList, + sal_uInt16 nMode ) { - StartUndo( UNDO_SETRUBYATTR, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_SETRUBYATTR, NULL ); SvUShortsSort aDelArr; aDelArr.Insert( RES_TXTATR_CJK_RUBY ); - USHORT nListEntry = 0; + sal_uInt16 nListEntry = 0; const SwPaM *_pStartCrsr = (SwPaM*)rPam.GetNext(), *__pStartCrsr = _pStartCrsr; - BOOL bCheckEmpty = &rPam != _pStartCrsr; + sal_Bool bCheckEmpty = &rPam != _pStartCrsr; do { const SwPosition* pStt = _pStartCrsr->Start(), * pEnd = pStt == _pStartCrsr->GetPoint() @@ -146,7 +147,7 @@ USHORT SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList, } else { - ResetAttrs( aPam, TRUE, &aDelArr ); + ResetAttrs( aPam, sal_True, &aDelArr ); } } @@ -190,12 +191,12 @@ USHORT SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList, } while( 30 > rList.Count() && (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr ); - EndUndo( UNDO_SETRUBYATTR, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_SETRUBYATTR, NULL ); return nListEntry; } -BOOL SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, USHORT ) +sal_Bool SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, sal_uInt16 ) { // Point must be the startposition, Mark is optional the end position SwPosition* pPos = rPam.GetPoint(); @@ -203,7 +204,7 @@ BOOL SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, USHORT ) const String* pTxt = &pTNd->GetTxt(); xub_StrLen nStart = pPos->nContent.GetIndex(), nEnd = pTxt->Len(); - BOOL bHasMark = rPam.HasMark(); + sal_Bool bHasMark = rPam.HasMark(); if( bHasMark ) { // in the same node? @@ -219,7 +220,7 @@ BOOL SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, USHORT ) // ----- search the start // --- look where a ruby attribut starts - USHORT nHtIdx = USHRT_MAX; + sal_uInt16 nHtIdx = USHRT_MAX; const SwpHints* pHts = pTNd->GetpSwpHints(); const SwTxtAttr* pAttr = 0; if( pHts ) @@ -249,7 +250,7 @@ BOOL SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, USHORT ) *pTxt, nStart, pBreakIt->GetLocale( pTNd->GetLang( nStart )), WordType::ANYWORD_IGNOREWHITESPACES, - TRUE ).startPos; + sal_True ).startPos; if( nWordStt < nStart && -1 != nWordStt ) { nStart = (xub_StrLen)nWordStt; @@ -257,7 +258,7 @@ BOOL SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, USHORT ) } } - BOOL bAlphaNum = FALSE; + sal_Bool bAlphaNum = sal_False; long nWordEnd = nEnd; CharClass& rCC = GetAppCharClass(); while( nStart < nEnd ) @@ -277,14 +278,14 @@ BOOL SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, USHORT ) } sal_Int32 nChType = rCC.getType( *pTxt, nStart ); - BOOL bIgnoreChar = FALSE, bIsAlphaNum = FALSE, bChkNxtWrd = FALSE; + sal_Bool bIgnoreChar = sal_False, bIsAlphaNum = sal_False, bChkNxtWrd = sal_False; switch( nChType ) { case UnicodeType::UPPERCASE_LETTER: case UnicodeType::LOWERCASE_LETTER: case UnicodeType::TITLECASE_LETTER: case UnicodeType::DECIMAL_DIGIT_NUMBER: - bChkNxtWrd = bIsAlphaNum = TRUE; + bChkNxtWrd = bIsAlphaNum = sal_True; break; case UnicodeType::SPACE_SEPARATOR: @@ -292,15 +293,15 @@ BOOL SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, USHORT ) /*??*/ case UnicodeType::PRIVATE_USE: case UnicodeType::START_PUNCTUATION: case UnicodeType::END_PUNCTUATION: - bIgnoreChar = TRUE; + bIgnoreChar = sal_True; break; case UnicodeType::OTHER_LETTER: - bChkNxtWrd = TRUE; + bChkNxtWrd = sal_True; default: - bIsAlphaNum = FALSE; + bIsAlphaNum = sal_False; break; } @@ -320,7 +321,7 @@ BOOL SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, USHORT ) *pTxt, nStart, pBreakIt->GetLocale( pTNd->GetLang( nStart )), WordType::ANYWORD_IGNOREWHITESPACES, - TRUE ).endPos; + sal_True ).endPos; if( 0 > nWordEnd || nWordEnd > nEnd || nWordEnd == nStart ) nWordEnd = nEnd; } diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 072f91113865..62b9560151c6 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <rtl/math.hxx> #include <unotools/collatorwrapper.hxx> @@ -40,6 +41,7 @@ #include <fmtanchr.hxx> #include <frmfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <node.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -47,7 +49,9 @@ #include <swundo.hxx> #include <sortopt.hxx> #include <docsort.hxx> -#include <undobj.hxx> +#include <UndoSort.hxx> +#include <UndoRedline.hxx> +#include <hints.hxx> #include <tblsel.hxx> #include <cellatr.hxx> #include <redline.hxx> @@ -127,20 +131,20 @@ double SwSortElement::StrToDouble( const String& rStr ) const /*-------------------------------------------------------------------- Beschreibung: Operatoren zum Vergleichen --------------------------------------------------------------------*/ -BOOL SwSortElement::operator==(const SwSortElement& ) +sal_Bool SwSortElement::operator==(const SwSortElement& ) { - return FALSE; + return sal_False; } /*-------------------------------------------------------------------- Beschreibung: Kleiner-Operator fuers sortieren --------------------------------------------------------------------*/ -BOOL SwSortElement::operator<(const SwSortElement& rCmp) +sal_Bool SwSortElement::operator<(const SwSortElement& rCmp) { // der eigentliche Vergleich // - for(USHORT nKey = 0; nKey < pOptions->aKeys.Count(); ++nKey) + for(sal_uInt16 nKey = 0; nKey < pOptions->aKeys.Count(); ++nKey) { const SwSortElement *pOrig, *pCmp; @@ -181,10 +185,10 @@ BOOL SwSortElement::operator<(const SwSortElement& rCmp) return -1 == nCmp; } } - return FALSE; + return sal_False; } -double SwSortElement::GetValue( USHORT nKey ) const +double SwSortElement::GetValue( sal_uInt16 nKey ) const { return StrToDouble( GetKey( nKey )); } @@ -204,7 +208,7 @@ SwSortTxtElement::~SwSortTxtElement() /*-------------------------------------------------------------------- Beschreibung: Key ermitteln --------------------------------------------------------------------*/ -String SwSortTxtElement::GetKey(USHORT nId) const +String SwSortTxtElement::GetKey(sal_uInt16 nId) const { SwTxtNode* pTxtNd = aPos.GetNode().GetTxtNode(); if( !pTxtNd ) @@ -214,7 +218,7 @@ String SwSortTxtElement::GetKey(USHORT nId) const const String& rStr = pTxtNd->GetTxt(); sal_Unicode nDeli = pOptions->cDeli; - USHORT nDCount = pOptions->aKeys[nId]->nColumnId, i = 1; + sal_uInt16 nDCount = pOptions->aKeys[nId]->nColumnId, i = 1; xub_StrLen nStart = 0; // Den Delimitter suchen @@ -233,7 +237,7 @@ String SwSortTxtElement::GetKey(USHORT nId) const /*-------------------------------------------------------------------- Beschreibung: Sortier-Elemente fuer Tabellen --------------------------------------------------------------------*/ -SwSortBoxElement::SwSortBoxElement( USHORT nRC ) +SwSortBoxElement::SwSortBoxElement( sal_uInt16 nRC ) : nRow( nRC ) { } @@ -245,10 +249,10 @@ SwSortBoxElement::~SwSortBoxElement() /*-------------------------------------------------------------------- Beschreibung: Schluessel zu einer Zelle ermitteln --------------------------------------------------------------------*/ -String SwSortBoxElement::GetKey(USHORT nKey) const +String SwSortBoxElement::GetKey(sal_uInt16 nKey) const { const _FndBox* pFndBox; - USHORT nCol = pOptions->aKeys[nKey]->nColumnId-1; + sal_uInt16 nCol = pOptions->aKeys[nKey]->nColumnId-1; if( SRT_ROWS == pOptions->eDirection ) pFndBox = pBox->GetBox(nCol, nRow); // Zeilen sortieren @@ -266,7 +270,7 @@ String SwSortBoxElement::GetKey(USHORT nKey) const { // ueber alle TextNodes der Box const SwNode *pNd = 0, *pEndNd = pMyBox->GetSttNd()->EndOfSectionNode(); - for( ULONG nIdx = pMyBox->GetSttIdx() + 1; pNd != pEndNd; ++nIdx ) + for( sal_uLong nIdx = pMyBox->GetSttIdx() + 1; pNd != pEndNd; ++nIdx ) if( ( pNd = pDoc->GetNodes()[ nIdx ])->IsTxtNode() ) aRetStr += ((SwTxtNode*)pNd)->GetTxt(); } @@ -274,10 +278,10 @@ String SwSortBoxElement::GetKey(USHORT nKey) const return aRetStr; } -double SwSortBoxElement::GetValue( USHORT nKey ) const +double SwSortBoxElement::GetValue( sal_uInt16 nKey ) const { const _FndBox* pFndBox; - USHORT nCol = pOptions->aKeys[nKey]->nColumnId-1; + sal_uInt16 nCol = pOptions->aKeys[nKey]->nColumnId-1; if( SRT_ROWS == pOptions->eDirection ) pFndBox = pBox->GetBox(nCol, nRow); // Zeilen sortieren @@ -302,13 +306,13 @@ double SwSortBoxElement::GetValue( USHORT nKey ) const /*-------------------------------------------------------------------- Beschreibung: Text sortieren im Document --------------------------------------------------------------------*/ -BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) +sal_Bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) { // pruefen ob Rahmen im Text const SwPosition *pStart = rPaM.Start(), *pEnd = rPaM.End(); // Index auf den Start der Selektion - for ( USHORT n = 0; n < GetSpzFrmFmts()->Count(); ++n ) + for ( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n ) { SwFrmFmt *const pFmt = static_cast<SwFrmFmt*>((*GetSpzFrmFmts())[n]); SwFmtAnchor const*const pAnchor = &pFmt->GetAnchor(); @@ -316,22 +320,24 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) if (pAPos && (FLY_AT_PARA == pAnchor->GetAnchorId()) && pStart->nNode <= pAPos->nNode && pAPos->nNode <= pEnd->nNode ) - return FALSE; + return sal_False; } // pruefe ob nur TextNodes in der Selection liegen { - ULONG nStart = pStart->nNode.GetIndex(), + sal_uLong nStart = pStart->nNode.GetIndex(), nEnd = pEnd->nNode.GetIndex(); while( nStart <= nEnd ) // Iterieren ueber einen selektierten Bereich if( !GetNodes()[ nStart++ ]->IsTxtNode() ) - return FALSE; + return sal_False; } - BOOL bUndo = DoesUndo(); + bool const bUndo = GetIDocumentUndoRedo().DoesUndo(); if( bUndo ) - StartUndo( UNDO_START, NULL ); + { + GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); + } SwPaM* pRedlPam = 0; SwUndoRedlineSort* pRedlUndo = 0; @@ -340,7 +346,7 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() )) { pRedlPam = new SwPaM( pStart->nNode, pEnd->nNode, -1, 1 ); - SwCntntNode* pCNd = pRedlPam->GetCntntNode( FALSE ); + SwCntntNode* pCNd = pRedlPam->GetCntntNode( sal_False ); if( pCNd ) pRedlPam->GetMark()->nContent = pCNd->Len(); @@ -349,7 +355,7 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) if( bUndo ) { pRedlUndo = new SwUndoRedlineSort( *pRedlPam,rOpt ); - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); } // erst den Bereich kopieren, dann SwNodeIndex aEndIdx( pEnd->nNode, 1 ); @@ -360,11 +366,11 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) DeleteRedline( *pRedlPam, true, USHRT_MAX ); pRedlPam->GetMark()->nNode.Assign( pEnd->nNode.GetNode(), 1 ); - pCNd = pRedlPam->GetCntntNode( FALSE ); + pCNd = pRedlPam->GetCntntNode( sal_False ); pRedlPam->GetMark()->nContent.Assign( pCNd, 0 ); pRedlPam->GetPoint()->nNode.Assign( aEndIdx.GetNode() ); - pCNd = pRedlPam->GetCntntNode( TRUE ); + pCNd = pRedlPam->GetCntntNode( sal_True ); xub_StrLen nCLen = 0; if( !pCNd && 0 != (pCNd = GetNodes()[ aEndIdx.GetIndex()-1 ]->GetCntntNode())) @@ -398,15 +404,18 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) // Und jetzt der Akt: Verschieben von Nodes und immer schoen auf UNDO // achten // - ULONG nBeg = pStart->nNode.GetIndex(); + sal_uLong nBeg = pStart->nNode.GetIndex(); SwNodeRange aRg( aStart, aStart ); if( bUndo && !pRedlUndo ) - AppendUndo( pUndoSort = new SwUndoSort( rPaM, rOpt ) ); + { + pUndoSort = new SwUndoSort(rPaM, rOpt); + GetIDocumentUndoRedo().AppendUndo(pUndoSort); + } - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); - for ( USHORT n = 0; n < aSortArr.Count(); ++n ) + for ( sal_uInt16 n = 0; n < aSortArr.Count(); ++n ) { SwSortTxtElement* pBox = (SwSortTxtElement*)aSortArr[n]; aStart = nBeg + n; @@ -430,7 +439,10 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) if( pRedlUndo ) { pRedlUndo->SetSaveRange( *pRedlPam ); - AppendUndo( pRedlUndo ); + // UGLY: temp. enable Undo + GetIDocumentUndoRedo().DoUndo(true); + GetIDocumentUndoRedo().AppendUndo( pRedlUndo ); + GetIDocumentUndoRedo().DoUndo(false); } // nBeg is start of sorted range @@ -467,23 +479,25 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) delete pRedlPam, pRedlPam = 0; } - DoUndo( bUndo ); + GetIDocumentUndoRedo().DoUndo( bUndo ); if( bUndo ) - EndUndo( UNDO_END, NULL ); + { + GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); + } - return TRUE; + return sal_True; } /*-------------------------------------------------------------------- Beschreibung: Tabelle sortieren im Document --------------------------------------------------------------------*/ -BOOL SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) +sal_Bool SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) { // uebers SwDoc fuer Undo !! OSL_ENSURE( rBoxes.Count(), "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; // Auf gehts sortieren // suche alle Boxen / Lines @@ -494,12 +508,12 @@ BOOL SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) } if(!aFndBox.GetLines().Count()) - return FALSE; + return sal_False; if( !IsIgnoreRedline() && GetRedlineTbl().Count() ) DeleteRedline( *pTblNd, true, USHRT_MAX ); - USHORT nStart = 0; + sal_uInt16 nStart = 0; if( pTblNd->GetTable().GetRowsToRepeat() > 0 && rOpt.eDirection == SRT_ROWS ) { // Oberste seleketierte Zeile @@ -532,7 +546,7 @@ BOOL SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) FlatFndBox aFlatBox(this, aFndBox); if(!aFlatBox.IsSymmetric()) - return FALSE; + return sal_False; // MIB 9.7.97: HTML-Layout loeschen pTblNd->GetTable().SetHTMLTableLayout( 0 ); @@ -546,21 +560,18 @@ BOOL SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) pTblNd->DelFrms(); // ? TL_CHART2: ? - // Redo loeschen bevor Undo - BOOL bUndo = DoesUndo(); SwUndoSort* pUndoSort = 0; - if(bUndo) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); pUndoSort = new SwUndoSort( rBoxes[0]->GetSttIdx(), rBoxes[rBoxes.Count()-1]->GetSttIdx(), *pTblNd, rOpt, aFlatBox.HasItemSets() ); - AppendUndo(pUndoSort); - DoUndo(FALSE); + GetIDocumentUndoRedo().AppendUndo(pUndoSort); } + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); // SchluesselElemente einsortieren - USHORT nCount = (rOpt.eDirection == SRT_ROWS) ? + sal_uInt16 nCount = (rOpt.eDirection == SRT_ROWS) ? aFlatBox.GetRows() : aFlatBox.GetCols(); // SortList nach Schluessel sortieren @@ -569,7 +580,7 @@ BOOL SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) // wenn die HeaderLine wiederholt wird und die // Zeilen sortiert werden 1.Zeile nicht mitsortieren - USHORT i; + sal_uInt16 i; for( i = nStart; i < nCount; ++i) { @@ -591,7 +602,7 @@ BOOL SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) // Restore table frames: // --> FME 2004-11-26 #i37739# A simple 'MakeFrms' after the node sorting // does not work if the table is inside a frame and has no prev/next. - const ULONG nIdx = pTblNd->GetIndex(); + const sal_uLong nIdx = pTblNd->GetIndex(); aNode2Layout.RestoreUpperFrms( GetNodes(), nIdx, nIdx + 1 ); // <-- @@ -602,20 +613,17 @@ BOOL SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) aSortList.DeleteAndDestroy( 0, aSortList.Count() ); SwSortElement::Finit(); - // Undo wieder aktivieren - DoUndo(bUndo); - SetModified(); - return TRUE; + return sal_True; } /*-------------------------------------------------------------------- Beschreibung: Zeilenweise verschieben --------------------------------------------------------------------*/ -void MoveRow(SwDoc* pDoc, const FlatFndBox& rBox, USHORT nS, USHORT nT, +void MoveRow(SwDoc* pDoc, const FlatFndBox& rBox, sal_uInt16 nS, sal_uInt16 nT, SwMovedBoxes& rMovedList, SwUndoSort* pUD) { - for( USHORT i=0; i < rBox.GetCols(); ++i ) + for( sal_uInt16 i=0; i < rBox.GetCols(); ++i ) { // Alte Zellen-Pos bestimmen und merken const _FndBox* pSource = rBox.GetBox(i, nS); @@ -625,7 +633,7 @@ void MoveRow(SwDoc* pDoc, const FlatFndBox& rBox, USHORT nS, USHORT nT, const SwTableBox* pT = pTarget->GetBox(); const SwTableBox* pS = pSource->GetBox(); - BOOL bMoved = rMovedList.GetPos(pT) != USHRT_MAX; + sal_Bool bMoved = rMovedList.GetPos(pT) != USHRT_MAX; // und verschieben MoveCell(pDoc, pS, pT, bMoved, pUD); @@ -658,10 +666,10 @@ void MoveRow(SwDoc* pDoc, const FlatFndBox& rBox, USHORT nS, USHORT nT, /*-------------------------------------------------------------------- Beschreibung: Spaltenweise verschieben --------------------------------------------------------------------*/ -void MoveCol(SwDoc* pDoc, const FlatFndBox& rBox, USHORT nS, USHORT nT, +void MoveCol(SwDoc* pDoc, const FlatFndBox& rBox, sal_uInt16 nS, sal_uInt16 nT, SwMovedBoxes& rMovedList, SwUndoSort* pUD) { - for(USHORT i=0; i < rBox.GetRows(); ++i) + for(sal_uInt16 i=0; i < rBox.GetRows(); ++i) { // Alte Zellen-Pos bestimmen und merken const _FndBox* pSource = rBox.GetBox(nS, i); @@ -673,7 +681,7 @@ void MoveCol(SwDoc* pDoc, const FlatFndBox& rBox, USHORT nS, USHORT nT, const SwTableBox* pS = pSource->GetBox(); // und verschieben - BOOL bMoved = rMovedList.GetPos(pT) != USHRT_MAX; + sal_Bool bMoved = rMovedList.GetPos(pT) != USHRT_MAX; MoveCell(pDoc, pS, pT, bMoved, pUD); rMovedList.Insert(pS, rMovedList.Count() ); @@ -705,7 +713,7 @@ void MoveCol(SwDoc* pDoc, const FlatFndBox& rBox, USHORT nS, USHORT nT, Beschreibung: Eine einzelne Zelle verschieben --------------------------------------------------------------------*/ void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, const SwTableBox* pTar, - BOOL bMovedBefore, SwUndoSort* pUD) + sal_Bool bMovedBefore, SwUndoSort* pUD) { OSL_ENSURE(pSource && pTar,"Fehlende Quelle oder Ziel"); @@ -732,9 +740,9 @@ void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, const SwTableBox* pTar, // Ziel SwNodeIndex aTar( *pTar->GetSttNd() ); pNd = pDoc->GetNodes().GoNext( &aTar ); // naechsten ContentNode - ULONG nCount = pNd->EndOfSectionIndex() - pNd->StartOfSectionIndex(); + sal_uLong nCount = pNd->EndOfSectionIndex() - pNd->StartOfSectionIndex(); - BOOL bDelFirst = FALSE; + sal_Bool bDelFirst = sal_False; if( nCount == 2 ) { OSL_ENSURE( pNd->GetCntntNode(), "Kein ContentNode"); @@ -796,71 +804,71 @@ FlatFndBox::~FlatFndBox() /*-------------------------------------------------------------------- Beschreibung: Alle Lines einer Box muessen gleichviel Boxen haben --------------------------------------------------------------------*/ -BOOL FlatFndBox::CheckLineSymmetry(const _FndBox& rBox) +sal_Bool FlatFndBox::CheckLineSymmetry(const _FndBox& rBox) { const _FndLines &rLines = rBox.GetLines(); - USHORT nBoxes(0); + sal_uInt16 nBoxes(0); // UeberLines iterieren - for(USHORT i=0; i < rLines.Count(); ++i) + for(sal_uInt16 i=0; i < rLines.Count(); ++i) { // Die Boxen einer Line _FndLine* pLn = rLines[i]; const _FndBoxes& rBoxes = pLn->GetBoxes(); // Anzahl der Boxen aller Lines ungleich -> keine Symmetrie if( i && nBoxes != rBoxes.Count()) - return FALSE; + return sal_False; nBoxes = rBoxes.Count(); if( !CheckBoxSymmetry( *pLn ) ) - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } /*-------------------------------------------------------------------- Beschreibung: Box auf Symmetrie pruefen Alle Boxen einer Line muessen gleichviele Lines haben --------------------------------------------------------------------*/ -BOOL FlatFndBox::CheckBoxSymmetry(const _FndLine& rLn) +sal_Bool FlatFndBox::CheckBoxSymmetry(const _FndLine& rLn) { const _FndBoxes &rBoxes = rLn.GetBoxes(); - USHORT nLines(0); + sal_uInt16 nLines(0); // Ueber Boxes iterieren - for(USHORT i=0; i < rBoxes.Count(); ++i) + for(sal_uInt16 i=0; i < rBoxes.Count(); ++i) { // Die Boxen einer Line _FndBox* pBox = rBoxes[i]; const _FndLines& rLines = pBox->GetLines(); // Anzahl der Boxen aller Lines ungleich -> keine Symmetrie if( i && nLines != rLines.Count() ) - return FALSE; + return sal_False; nLines = rLines.Count(); if( nLines && !CheckLineSymmetry( *pBox ) ) - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } /*-------------------------------------------------------------------- Beschreibung: max Anzahl der Spalten (Boxes) --------------------------------------------------------------------*/ -USHORT FlatFndBox::GetColCount(const _FndBox& rBox) +sal_uInt16 FlatFndBox::GetColCount(const _FndBox& rBox) { const _FndLines& rLines = rBox.GetLines(); // Ueber Lines iterieren if( !rLines.Count() ) return 1; - USHORT nSum = 0; - for( USHORT i=0; i < rLines.Count(); ++i ) + sal_uInt16 nSum = 0; + for( sal_uInt16 i=0; i < rLines.Count(); ++i ) { // Die Boxen einer Line - USHORT nCount = 0; + sal_uInt16 nCount = 0; const _FndBoxes& rBoxes = rLines[i]->GetBoxes(); - for( USHORT j=0; j < rBoxes.Count(); ++j ) + for( sal_uInt16 j=0; j < rBoxes.Count(); ++j ) // Rekursiv wirder ueber die Lines Iterieren nCount += rBoxes[j]->GetLines().Count() ? GetColCount(*rBoxes[j]) : 1; @@ -874,18 +882,18 @@ USHORT FlatFndBox::GetColCount(const _FndBox& rBox) /*-------------------------------------------------------------------- Beschreibung: max Anzahl der Zeilen (Lines) --------------------------------------------------------------------*/ -USHORT FlatFndBox::GetRowCount(const _FndBox& rBox) +sal_uInt16 FlatFndBox::GetRowCount(const _FndBox& rBox) { const _FndLines& rLines = rBox.GetLines(); if( !rLines.Count() ) return 1; - USHORT nLines = 0; - for(USHORT i=0; i < rLines.Count(); ++i) + sal_uInt16 nLines = 0; + for(sal_uInt16 i=0; i < rLines.Count(); ++i) { // Die Boxen einer Line const _FndBoxes& rBoxes = rLines[i]->GetBoxes(); - USHORT nLn = 1; - for(USHORT j=0; j < rBoxes.Count(); ++j) + sal_uInt16 nLn = 1; + for(sal_uInt16 j=0; j < rBoxes.Count(); ++j) if( rBoxes[j]->GetLines().Count() ) // Rekursiv ueber die Lines Iterieren nLn = Max(GetRowCount(*rBoxes[j]), nLn); @@ -898,19 +906,19 @@ USHORT FlatFndBox::GetRowCount(const _FndBox& rBox) /*-------------------------------------------------------------------- Beschreibung: lineares Array aus atomaren FndBoxes erzeugen --------------------------------------------------------------------*/ -void FlatFndBox::FillFlat(const _FndBox& rBox, BOOL bLastBox) +void FlatFndBox::FillFlat(const _FndBox& rBox, sal_Bool bLastBox) { - BOOL bModRow = FALSE; + sal_Bool bModRow = sal_False; const _FndLines& rLines = rBox.GetLines(); // Ueber Lines iterieren - USHORT nOldRow = nRow; - for( USHORT i=0; i < rLines.Count(); ++i ) + sal_uInt16 nOldRow = nRow; + for( sal_uInt16 i=0; i < rLines.Count(); ++i ) { // Die Boxen einer Line const _FndBoxes& rBoxes = rLines[i]->GetBoxes(); - USHORT nOldCol = nCol; - for( USHORT j = 0; j < rBoxes.Count(); ++j ) + sal_uInt16 nOldCol = nCol; + for( sal_uInt16 j = 0; j < rBoxes.Count(); ++j ) { // Die Box pruefen ob es eine atomare Box ist const _FndBox* pBox = rBoxes[ j ]; @@ -918,7 +926,7 @@ void FlatFndBox::FillFlat(const _FndBox& rBox, BOOL bLastBox) if( !pBox->GetLines().Count() ) { // peichern - USHORT nOff = nRow * nCols + nCol; + sal_uInt16 nOff = nRow * nCols + nCol; *(pArr + nOff) = pBox; // sicher die Formel/Format/Value Werte @@ -939,7 +947,7 @@ void FlatFndBox::FillFlat(const _FndBox& rBox, BOOL bLastBox) *(ppItemSets + nOff ) = pSet; } - bModRow = TRUE; + bModRow = sal_True; } else { @@ -959,16 +967,16 @@ void FlatFndBox::FillFlat(const _FndBox& rBox, BOOL bLastBox) /*-------------------------------------------------------------------- Beschreibung: Zugriff auf eine bestimmte Zelle --------------------------------------------------------------------*/ -const _FndBox* FlatFndBox::GetBox(USHORT n_Col, USHORT n_Row) const +const _FndBox* FlatFndBox::GetBox(sal_uInt16 n_Col, sal_uInt16 n_Row) const { - USHORT nOff = n_Row * nCols + n_Col; + sal_uInt16 nOff = n_Row * nCols + n_Col; const _FndBox* pTmp = *(pArr + nOff); OSL_ENSURE(n_Col < nCols && n_Row < nRows && pTmp, "unzulaessiger Array-Zugriff"); return pTmp; } -const SfxItemSet* FlatFndBox::GetItemSet(USHORT n_Col, USHORT n_Row) const +const SfxItemSet* FlatFndBox::GetItemSet(sal_uInt16 n_Col, sal_uInt16 n_Row) const { OSL_ENSURE( !ppItemSets || ( n_Col < nCols && n_Row < nRows), "unzulaessiger Array-Zugriff"); diff --git a/sw/source/core/doc/docstat.cxx b/sw/source/core/doc/docstat.cxx index 5225ffd6ad10..0b79d817a436 100644 --- a/sw/source/core/doc/docstat.cxx +++ b/sw/source/core/doc/docstat.cxx @@ -47,7 +47,7 @@ SwDocStat::SwDocStat() : nWord(0), nChar(0), nCharExcludingSpaces(0), - bModified(TRUE) + bModified(sal_True) {} /************************************************************************ @@ -65,7 +65,7 @@ void SwDocStat::Reset() nWord = 0; nChar = 0; nCharExcludingSpaces = 0; - bModified = TRUE; + bModified = sal_True; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index b11d9497e975..00d425324f25 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -50,6 +50,7 @@ #include <frmatr.hxx> #include <pagedesc.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pagefrm.hxx> #include <ndtxt.hxx> #include <swtable.hxx> @@ -59,7 +60,7 @@ #include <poolfmt.hxx> #include <txtfrm.hxx> #include <rootfrm.hxx> -#include <undobj.hxx> +#include <UndoAttribute.hxx> #include <swundo.hxx> #include <mdiexp.hxx> #include <docary.hxx> @@ -102,18 +103,18 @@ typedef LinkStruct* LinkStructPtr; SV_DECL_PTRARR(LinkStructArr, LinkStructPtr, 0, 5 ) SV_IMPL_PTRARR(LinkStructArr, LinkStructPtr) -USHORT SwDoc::GetTOIKeys( SwTOIKeyType eTyp, SvStringsSort& rArr ) const +sal_uInt16 SwDoc::GetTOIKeys( SwTOIKeyType eTyp, SvStringsSort& rArr ) const { if( rArr.Count() ) - rArr.Remove( USHORT(0), rArr.Count() ); + rArr.Remove( sal_uInt16(0), rArr.Count() ); // dann mal ueber den Pool und alle Primary oder Secondary heraussuchen const SwTxtTOXMark* pMark; const SfxPoolItem* pItem; const SwTOXType* pTOXType; - USHORT i, nMaxItems = GetAttrPool().GetItemCount( RES_TXTATR_TOXMARK ); + sal_uInt32 i, nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_TOXMARK ); for( i = 0; i < nMaxItems; ++i ) - if( 0 != (pItem = GetAttrPool().GetItem( RES_TXTATR_TOXMARK, i ) ) && + if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_TOXMARK, i ) ) && 0!= ( pTOXType = ((SwTOXMark*)pItem)->GetTOXType()) && TOX_INDEX == pTOXType->GetType() && 0 != ( pMark = ((SwTOXMark*)pItem)->GetTxtTOXMark() ) && @@ -136,12 +137,11 @@ USHORT SwDoc::GetTOIKeys( SwTOIKeyType eTyp, SvStringsSort& rArr ) const /*-------------------------------------------------------------------- Beschreibung: aktuelle Verzeichnismarkierungen ermitteln --------------------------------------------------------------------*/ -USHORT SwDoc::GetCurTOXMark( const SwPosition& rPos, +sal_uInt16 SwDoc::GetCurTOXMark( const SwPosition& rPos, SwTOXMarks& rArr ) const { - // suche an der Position rPos nach allen SwTOXMark's - SwTxtNode* pTxtNd = GetNodes()[ rPos.nNode ]->GetTxtNode(); - // kein TextNode oder kein HintsArray vorhanden ?? + // search on Position rPos for all SwTOXMarks + SwTxtNode *const pTxtNd = rPos.nNode.GetNode().GetTxtNode(); if( !pTxtNd || !pTxtNd->GetpSwpHints() ) return 0; @@ -152,7 +152,7 @@ USHORT SwDoc::GetCurTOXMark( const SwPosition& rPos, xub_StrLen nAktPos = rPos.nContent.GetIndex(); - for( USHORT n = 0; n < rHts.Count(); ++n ) + for( sal_uInt16 n = 0; n < rHts.Count(); ++n ) { if( RES_TXTATR_TOXMARK != (pHt = rHts[n])->Which() ) continue; @@ -186,14 +186,13 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark ) SwTxtNode& rTxtNd = const_cast<SwTxtNode&>(pTxtTOXMark->GetTxtNode()); OSL_ENSURE( rTxtNd.GetpSwpHints(), "kann nicht geloescht werden" ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - // fuers Undo die Attribute sichern - ClearRedo(); + // save attributes for Undo SwUndoResetAttr* pUndo = new SwUndoResetAttr( SwPosition( rTxtNd, SwIndex( &rTxtNd, *pTxtTOXMark->GetStart() ) ), RES_TXTATR_TOXMARK ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); SwRegHistory aRHst( rTxtNd, &pUndo->GetHistory() ); rTxtNd.GetpSwpHints()->Register( &aRHst ); @@ -201,7 +200,7 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark ) rTxtNd.DeleteAttribute( const_cast<SwTxtTOXMark*>(pTxtTOXMark) ); - if ( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { if( rTxtNd.GetpSwpHints() ) rTxtNd.GetpSwpHints()->DeRegister(); @@ -214,10 +213,10 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark ) --------------------------------------------------------------------*/ class CompareNodeCntnt { - ULONG nNode; + sal_uLong nNode; xub_StrLen nCntnt; public: - CompareNodeCntnt( ULONG nNd, xub_StrLen nCnt ) + CompareNodeCntnt( sal_uLong nNd, xub_StrLen nCnt ) : nNode( nNd ), nCntnt( nCnt ) {} int operator==( const CompareNodeCntnt& rCmp ) const @@ -239,7 +238,7 @@ public: }; const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark, - SwTOXSearch eDir, BOOL bInReadOnly ) + SwTOXSearch eDir, sal_Bool bInReadOnly ) { const SwTxtTOXMark* pMark = rCurTOXMark.GetTxtTOXMark(); OSL_ENSURE(pMark, "pMark==0 Ungueltige TxtTOXMark"); @@ -268,7 +267,7 @@ const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark, if( pTOXMark != &rCurTOXMark && 0 != ( pMark = pTOXMark->GetTxtTOXMark()) && 0 != ( pTOXSrc = pMark->GetpTxtNd() ) && - 0 != ( pCFrm = pTOXSrc->GetFrm( &aPt, 0, FALSE )) && + 0 != ( pCFrm = pTOXSrc->GetFrm( &aPt, 0, sal_False )) && ( bInReadOnly || !pCFrm->IsProtected() )) { CompareNodeCntnt aAbsNew( pTOXSrc->GetIndex(), *pMark->GetStart() ); @@ -287,12 +286,12 @@ const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark, if ( (aAbsNew < aAbsIdx && aAbsNew > aPrevPos && aPrevPos != aAbsIdx && aAbsNew != aAbsIdx ) || (aAbsIdx == aAbsNew && - (ULONG(&rCurTOXMark) > ULONG(pTOXMark) && + (sal_uLong(&rCurTOXMark) > sal_uLong(pTOXMark) && (!pNew || (pNew && (aPrevPos < aAbsIdx || - ULONG(pNew) < ULONG(pTOXMark)))))) || + sal_uLong(pNew) < sal_uLong(pTOXMark)))))) || (aPrevPos == aAbsNew && aAbsIdx != aAbsNew && - ULONG(pTOXMark) > ULONG(pNew)) ) + sal_uLong(pTOXMark) > sal_uLong(pNew)) ) { pNew = pTOXMark; aPrevPos = aAbsNew; @@ -312,12 +311,12 @@ const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark, if ( (aAbsNew > aAbsIdx && aAbsNew < aNextPos && aNextPos != aAbsIdx && aAbsNew != aAbsIdx ) || (aAbsIdx == aAbsNew && - (ULONG(&rCurTOXMark) < ULONG(pTOXMark) && + (sal_uLong(&rCurTOXMark) < sal_uLong(pTOXMark) && (!pNew || (pNew && (aNextPos > aAbsIdx || - ULONG(pNew) > ULONG(pTOXMark)))))) || + sal_uLong(pNew) > sal_uLong(pTOXMark)))))) || (aNextPos == aAbsNew && aAbsIdx != aAbsNew && - ULONG(pTOXMark) < ULONG(pNew)) ) + sal_uLong(pTOXMark) < sal_uLong(pNew)) ) { pNew = pTOXMark; aNextPos = aAbsNew; @@ -357,9 +356,9 @@ const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark, const SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos, const SwTOXBase& rTOX, const SfxItemSet* pSet, - BOOL bExpand ) + sal_Bool bExpand ) { - StartUndo( UNDO_INSTOX, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_INSTOX, NULL ); String sSectNm( rTOX.GetTOXName() ); sSectNm = GetUniqueTOXBaseName( *rTOX.GetTOXType(), &sSectNm ); @@ -401,12 +400,12 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" )); } } - EndUndo( UNDO_INSTOX, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_INSTOX, NULL ); return pNewSection; } -const SwTOXBaseSection* SwDoc::InsertTableOf( ULONG nSttNd, ULONG nEndNd, +const SwTOXBaseSection* SwDoc::InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd, const SwTOXBase& rTOX, const SfxItemSet* pSet ) { @@ -479,7 +478,7 @@ const SwAttrSet& SwDoc::GetTOXBaseAttrSet(const SwTOXBase& rTOXBase) const return pFmt->GetAttrSet(); } -const SwTOXBase* SwDoc::GetDefaultTOXBase( TOXTypes eTyp, BOOL bCreate ) +const SwTOXBase* SwDoc::GetDefaultTOXBase( TOXTypes eTyp, sal_Bool bCreate ) { SwTOXBase** prBase = 0; switch(eTyp) @@ -522,17 +521,17 @@ void SwDoc::SetDefaultTOXBase(const SwTOXBase& rBase) /*-------------------------------------------------------------------- Beschreibung: Verzeichnis loeschen --------------------------------------------------------------------*/ -BOOL SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, BOOL bDelNodes ) +sal_Bool SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, sal_Bool bDelNodes ) { // its only delete the TOX, not the nodes - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase; SwSectionFmt* pFmt = rTOXSect.GetFmt(); if( pFmt ) { - StartUndo( UNDO_CLEARTOXRANGE, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_CLEARTOXRANGE, NULL ); /* Save the start node of the TOX' section. */ SwSectionNode * pMyNode = pFmt->GetSectionNode(); @@ -591,8 +590,8 @@ BOOL SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, BOOL bDelNodes ) if( !bDelNodes ) { SwSections aArr( 0, 4 ); - USHORT nCnt = pFmt->GetChildSections( aArr, SORTSECT_NOT, FALSE ); - for( USHORT n = 0; n < nCnt; ++n ) + sal_uInt16 nCnt = pFmt->GetChildSections( aArr, SORTSECT_NOT, sal_False ); + for( sal_uInt16 n = 0; n < nCnt; ++n ) { SwSection* pSect = aArr[ n ]; if( TOX_HEADER_SECTION == pSect->GetType() ) @@ -604,8 +603,8 @@ BOOL SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, BOOL bDelNodes ) DelSectionFmt( pFmt, bDelNodes ); - EndUndo( UNDO_CLEARTOXRANGE, NULL ); - bRet = TRUE; + GetIDocumentUndoRedo().EndUndo( UNDO_CLEARTOXRANGE, NULL ); + bRet = sal_True; } return bRet; @@ -614,21 +613,21 @@ BOOL SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, BOOL bDelNodes ) /*-------------------------------------------------------------------- Beschreibung: Verzeichnistypen verwalten --------------------------------------------------------------------*/ -USHORT SwDoc::GetTOXTypeCount(TOXTypes eTyp) const +sal_uInt16 SwDoc::GetTOXTypeCount(TOXTypes eTyp) const { const SwTOXTypePtr * ppTTypes = pTOXTypes->GetData(); - USHORT nCnt = 0; - for( USHORT n = 0; n < pTOXTypes->Count(); ++n, ++ppTTypes ) + sal_uInt16 nCnt = 0; + for( sal_uInt16 n = 0; n < pTOXTypes->Count(); ++n, ++ppTTypes ) if( eTyp == (*ppTTypes)->GetType() ) ++nCnt; return nCnt; } -const SwTOXType* SwDoc::GetTOXType( TOXTypes eTyp, USHORT nId ) const +const SwTOXType* SwDoc::GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const { const SwTOXTypePtr * ppTTypes = pTOXTypes->GetData(); - USHORT nCnt = 0; - for( USHORT n = 0; n < pTOXTypes->Count(); ++n, ++ppTTypes ) + sal_uInt16 nCnt = 0; + for( sal_uInt16 n = 0; n < pTOXTypes->Count(); ++n, ++ppTTypes ) if( eTyp == (*ppTTypes)->GetType() && nCnt++ == nId ) return (*ppTTypes); return 0; @@ -644,7 +643,7 @@ const SwTOXType* SwDoc::InsertTOXType( const SwTOXType& rTyp ) String SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType, const String* pChkStr ) const { - USHORT n; + sal_uInt16 n; const SwSectionNode* pSectNd; const SwSection* pSect; @@ -653,21 +652,21 @@ String SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType, String aName( rType.GetTypeName() ); xub_StrLen nNmLen = aName.Len(); - USHORT nNum = 0; - USHORT nTmp = 0; - USHORT nFlagSize = ( pSectionFmtTbl->Count() / 8 ) +2; - BYTE* pSetFlags = new BYTE[ nFlagSize ]; + sal_uInt16 nNum = 0; + sal_uInt16 nTmp = 0; + sal_uInt16 nFlagSize = ( pSectionFmtTbl->Count() / 8 ) +2; + sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ]; memset( pSetFlags, 0, nFlagSize ); for( n = 0; n < pSectionFmtTbl->Count(); ++n ) - if( 0 != ( pSectNd = (*pSectionFmtTbl)[ n ]->GetSectionNode( FALSE ) )&& + if( 0 != ( pSectNd = (*pSectionFmtTbl)[ n ]->GetSectionNode( sal_False ) )&& TOX_CONTENT_SECTION == (pSect = &pSectNd->GetSection())->GetType()) { const String& rNm = pSect->GetSectionName(); if( rNm.Match( aName ) == nNmLen ) { // Nummer bestimmen und das Flag setzen - nNum = (USHORT)rNm.Copy( nNmLen ).ToInt32(); + nNum = (sal_uInt16)rNm.Copy( nNmLen ).ToInt32(); if( nNum-- && nNum < pSectionFmtTbl->Count() ) pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 )); } @@ -695,14 +694,14 @@ String SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType, return aName += String::CreateFromInt32( ++nNum ); } -BOOL SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const String& rName) +sal_Bool SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const String& rName) { OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "keine TOXBaseSection!" ); SwTOXBaseSection* pTOX = (SwTOXBaseSection*)&rTOXBase; String sTmp = GetUniqueTOXBaseName(*rTOXBase.GetTOXType(), &rName); - BOOL bRet = sTmp == rName; + sal_Bool bRet = sTmp == rName; if(bRet) { pTOX->SetTOXName(rName); @@ -712,7 +711,7 @@ BOOL SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const String& rName) return bRet; } -const SwTxtNode* lcl_FindChapterNode( const SwNode& rNd, BYTE nLvl = 0 ) +const SwTxtNode* lcl_FindChapterNode( const SwNode& rNd, sal_uInt8 nLvl = 0 ) { const SwNode* pNd = &rNd; if( pNd->GetNodes().GetEndOfExtras().GetIndex() > pNd->GetIndex() ) @@ -720,7 +719,7 @@ const SwTxtNode* lcl_FindChapterNode( const SwNode& rNd, BYTE nLvl = 0 ) // then find the "Anchor" (Body) position Point aPt; SwNode2Layout aNode2Layout( *pNd, pNd->GetIndex() ); - const SwFrm* pFrm = aNode2Layout.GetFrm( &aPt, 0, FALSE ); + const SwFrm* pFrm = aNode2Layout.GetFrm( &aPt, 0, sal_False ); if( pFrm ) { @@ -747,9 +746,9 @@ SwTOXBaseSection::~SwTOXBaseSection() { } -BOOL SwTOXBaseSection::SetPosAtStartEnd( SwPosition& rPos, BOOL bAtStart ) const +sal_Bool SwTOXBaseSection::SetPosAtStartEnd( SwPosition& rPos, sal_Bool bAtStart ) const { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; const SwSectionNode* pSectNd = GetFmt()->GetSectionNode(); if( pSectNd ) { @@ -767,7 +766,7 @@ BOOL SwTOXBaseSection::SetPosAtStartEnd( SwPosition& rPos, BOOL bAtStart ) const if( pCNd ) nC = pCNd->Len(); } rPos.nContent.Assign( pCNd, nC ); - bRet = TRUE; + bRet = sal_True; } return bRet; } @@ -803,7 +802,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, // determine page description of table-of-content sal_uInt32 nPgDescNdIdx = pSectNd->GetIndex() + 1; sal_uInt32* pPgDescNdIdx = &nPgDescNdIdx; - pDefaultPageDesc = pSectNd->FindPageDesc( FALSE, pPgDescNdIdx ); + pDefaultPageDesc = pSectNd->FindPageDesc( sal_False, pPgDescNdIdx ); if ( nPgDescNdIdx < pSectNd->GetIndex() ) { pDefaultPageDesc = 0; @@ -824,7 +823,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, eBreak == SVX_BREAK_PAGE_BOTH ) ) { - pDefaultPageDesc = pNdAfterTOX->FindPageDesc( FALSE ); + pDefaultPageDesc = pNdAfterTOX->FindPageDesc( sal_False ); } } // consider start node of content section in the node array. @@ -836,7 +835,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, // determine page description of content before table-of-content SwNodeIndex aIdx( *pSectNd ); pDefaultPageDesc = - pSectNd->GetNodes().GoPrevious( &aIdx )->FindPageDesc( FALSE ); + pSectNd->GetNodes().GoPrevious( &aIdx )->FindPageDesc( sal_False ); } if ( !pDefaultPageDesc ) @@ -892,7 +891,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, } aEndIdx--; SwPosition aPos( aEndIdx, SwIndex( pFirstEmptyNd, 0 )); - pDoc->CorrAbs( aSttIdx, aEndIdx, aPos, TRUE ); + pDoc->CorrAbs( aSttIdx, aEndIdx, aPos, sal_True ); // delete all before DelFlyInRange( aSttIdx, aEndIdx ); @@ -969,9 +968,9 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" )); // sortierte Liste aller Verzeichnismarken und Verzeichnisbereiche void* p = 0; String* pStr = 0; - USHORT nCnt = 0, nFormMax = GetTOXForm().GetFormMax(); - SvStringsDtor aStrArr( (BYTE)nFormMax ); - SvPtrarr aCollArr( (BYTE)nFormMax ); + sal_uInt16 nCnt = 0, nFormMax = GetTOXForm().GetFormMax(); + SvStringsDtor aStrArr( (sal_uInt8)nFormMax ); + SvPtrarr aCollArr( (sal_uInt8)nFormMax ); for( ; nCnt < nFormMax; ++nCnt ) { aCollArr.Insert( p, nCnt ); @@ -984,7 +983,7 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" )); ::SetProgressState( 0, pDoc->GetDocShell() ); // setze den Text in das Verzeichniss - USHORT nLvl = aSortArr[ nCnt ]->GetLevel(); + sal_uInt16 nLvl = aSortArr[ nCnt ]->GetLevel(); SwTxtFmtColl* pColl = (SwTxtFmtColl*)aCollArr[ nLvl ]; if( !pColl ) { @@ -1002,7 +1001,7 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" )); // fuer die Seitennummer eintragen //if it is a TOX_INDEX and the SwForm IsCommaSeparated() // then a range of entries must be generated into one paragraph - USHORT nRange = 1; + sal_uInt16 nRange = 1; if(TOX_INDEX == SwTOXBase::GetType() && GetTOXForm().IsCommaSeparated() && aSortArr[nCnt]->GetType() == TOX_SORT_INDEX) @@ -1032,7 +1031,7 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" )); if( !aCorPam.Move( fnMoveForward ) ) aCorPam.Move( fnMoveBackward ); SwNodeIndex aEndIdx( aInsPos, 1 ); - pDoc->CorrAbs( aInsPos, aEndIdx, *aCorPam.GetPoint(), TRUE ); + pDoc->CorrAbs( aInsPos, aEndIdx, *aCorPam.GetPoint(), sal_True ); // Task 70995 - save and restore PageDesc and Break Attributes if( pFirstEmptyNd->HasSwAttrSet() ) @@ -1048,7 +1047,7 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" )); } // now create the new Frames - ULONG nIdx = pSectNd->GetIndex(); + sal_uLong nIdx = pSectNd->GetIndex(); // don't delete if index is empty if(nIdx + 2 < pSectNd->EndOfSectionIndex()) pDoc->GetNodes().Delete( aInsPos, 1 ); @@ -1067,12 +1066,12 @@ void SwTOXBaseSection::InsertAlphaDelimitter( const SwTOXInternational& rIntl ) { SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc(); String sDeli, sLastDeli; - USHORT i = 0; + sal_uInt16 i = 0; while( i < aSortArr.Count() ) { ::SetProgressState( 0, pDoc->GetDocShell() ); - USHORT nLevel = aSortArr[i]->GetLevel(); + sal_uInt16 nLevel = aSortArr[i]->GetLevel(); // Alpha-Delimitter ueberlesen if( nLevel == FORM_ALPHA_DELIMITTER ) @@ -1107,14 +1106,14 @@ void SwTOXBaseSection::InsertAlphaDelimitter( const SwTOXInternational& rIntl ) /*-------------------------------------------------------------------- Beschreibung: Template auswerten --------------------------------------------------------------------*/ -SwTxtFmtColl* SwTOXBaseSection::GetTxtFmtColl( USHORT nLevel ) +SwTxtFmtColl* SwTOXBaseSection::GetTxtFmtColl( sal_uInt16 nLevel ) { SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc(); const String& rName = GetTOXForm().GetTemplate( nLevel ); SwTxtFmtColl* pColl = rName.Len() ? pDoc->FindTxtFmtCollByName(rName) :0; if( !pColl ) { - USHORT nPoolFmt = 0; + sal_uInt16 nPoolFmt = 0; const TOXTypes eMyType = SwTOXBase::GetType(); switch( eMyType ) { @@ -1239,12 +1238,12 @@ void SwTOXBaseSection::UpdateOutline( const SwTxtNode* pOwnChapterNode ) SwNodes& rNds = pDoc->GetNodes(); const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds(); - for( USHORT n = 0; n < rOutlNds.Count(); ++n ) + for( sal_uInt16 n = 0; n < rOutlNds.Count(); ++n ) { ::SetProgressState( 0, pDoc->GetDocShell() ); SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode(); if( pTxtNd && pTxtNd->Len() && pTxtNd->GetDepends() && - USHORT( pTxtNd->GetAttrOutlineLevel()) <= GetLevel() && + sal_uInt16( pTxtNd->GetAttrOutlineLevel()) <= GetLevel() && pTxtNd->GetFrm() && !pTxtNd->HasHiddenParaField() && !pTxtNd->HasHiddenCharAttribute( true ) && @@ -1263,11 +1262,11 @@ void SwTOXBaseSection::UpdateOutline( const SwTxtNode* pOwnChapterNode ) void SwTOXBaseSection::UpdateTemplate( const SwTxtNode* pOwnChapterNode ) { SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc(); - for(USHORT i = 0; i < MAXLEVEL; i++) + for(sal_uInt16 i = 0; i < MAXLEVEL; i++) { String sTmpStyleNames = GetStyleNames(i); - USHORT nTokenCount = sTmpStyleNames.GetTokenCount(TOX_STYLE_DELIMITER); - for( USHORT nStyle = 0; nStyle < nTokenCount; ++nStyle ) + sal_uInt16 nTokenCount = sTmpStyleNames.GetTokenCount(TOX_STYLE_DELIMITER); + for( sal_uInt16 nStyle = 0; nStyle < nTokenCount; ++nStyle ) { SwTxtFmtColl* pColl = pDoc->FindTxtFmtCollByName( sTmpStyleNames.GetToken( nStyle, @@ -1381,9 +1380,9 @@ long lcl_IsSOObject( const SvGlobalName& rFactoryNm ) long nFlag; // GlobalNameId struct _GlobalNameIds { - UINT32 n1; - USHORT n2, n3; - BYTE b8, b9, b10, b11, b12, b13, b14, b15; + sal_uInt32 n1; + sal_uInt16 n2, n3; + sal_uInt8 b8, b9, b10, b11, b12, b13, b14, b15; } aGlNmIds[4]; } aArr[] = { { nsSwTOOElements::TOO_MATH, @@ -1430,7 +1429,7 @@ void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType, SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc(); SwNodes& rNds = pDoc->GetNodes(); // auf den 1. Node der 1. Section - ULONG nIdx = rNds.GetEndOfAutotext().StartOfSectionIndex() + 2, + sal_uLong nIdx = rNds.GetEndOfAutotext().StartOfSectionIndex() + 2, nEndIdx = rNds.GetEndOfAutotext().GetIndex(); while( nIdx < nEndIdx ) @@ -1459,7 +1458,7 @@ void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType, case nsSwTOXElement::TOX_OLE: if( pNd->IsOLENode() ) { - BOOL bInclude = TRUE; + sal_Bool bInclude = sal_True; if(TOX_OBJECTS == SwTOXBase::GetType()) { SwOLENode* pOLENode = pNd->GetOLENode(); @@ -1476,7 +1475,7 @@ void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType, else { OSL_FAIL("OLE-object nicht geladen?"); - bInclude = FALSE; + bInclude = sal_False; } } @@ -1512,7 +1511,7 @@ void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType, { SwTOXPara * pNew = new SwTOXPara( *pCNd, eMyType, ( USHRT_MAX != nSetLevel ) - ? static_cast<USHORT>(nSetLevel) + ? static_cast<sal_uInt16>(nSetLevel) : FORM_ALPHA_DELIMITTER ); InsertSorted( pNew ); } @@ -1531,7 +1530,7 @@ void SwTOXBaseSection::UpdateTable( const SwTxtNode* pOwnChapterNode ) SwNodes& rNds = pDoc->GetNodes(); const SwFrmFmts& rArr = *pDoc->GetTblFrmFmts(); - for( USHORT n = 0; n < rArr.Count(); ++n ) + for( sal_uInt16 n = 0; n < rArr.Count(); ++n ) { ::SetProgressState( 0, pDoc->GetDocShell() ); @@ -1560,7 +1559,7 @@ void SwTOXBaseSection::UpdateTable( const SwTxtNode* pOwnChapterNode ) if( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle()) { const int nTmp = pOutlNd->GetTxtColl()->GetAttrOutlineLevel(); - pNew->SetLevel( static_cast<USHORT>(nTmp) );//<-end ,zhaojianwei + pNew->SetLevel( static_cast<sal_uInt16>(nTmp) );//<-end ,zhaojianwei } } } @@ -1576,7 +1575,7 @@ void SwTOXBaseSection::UpdateTable( const SwTxtNode* pOwnChapterNode ) Beschreibung: String generieren anhand der Form SonderZeichen 0-31 und 255 entfernen --------------------------------------------------------------------*/ -String lcl_GetNumString( const SwTOXSortTabBase& rBase, sal_Bool bUsePrefix, BYTE nLevel ) +String lcl_GetNumString( const SwTOXSortTabBase& rBase, sal_Bool bUsePrefix, sal_uInt8 nLevel ) { String sRet; @@ -1596,8 +1595,8 @@ String lcl_GetNumString( const SwTOXSortTabBase& rBase, sal_Bool bUsePrefix, BYT // add parameter <_TOXSectNdIdx> and <_pDefaultPageDesc> in order to control, // which page description is used, no appropriate one is found. -void SwTOXBaseSection::GenerateText( USHORT nArrayIdx, - USHORT nCount, +void SwTOXBaseSection::GenerateText( sal_uInt16 nArrayIdx, + sal_uInt16 nCount, SvStringsDtor& , const sal_uInt32 _nTOXSectNdIdx, const SwPageDesc* _pDefaultPageDesc ) @@ -1610,13 +1609,13 @@ void SwTOXBaseSection::GenerateText( USHORT nArrayIdx, SwTxtNode* pTOXNd = (SwTxtNode*)aSortArr[nArrayIdx]->pTOXNd; String& rTxt = (String&)pTOXNd->GetTxt(); rTxt.Erase(); - for(USHORT nIndex = nArrayIdx; nIndex < nArrayIdx + nCount; nIndex++) + for(sal_uInt16 nIndex = nArrayIdx; nIndex < nArrayIdx + nCount; nIndex++) { if(nIndex > nArrayIdx) rTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " )); // comma separation // String mit dem Pattern aus der Form initialisieren const SwTOXSortTabBase& rBase = *aSortArr[nIndex]; - USHORT nLvl = rBase.GetLevel(); + sal_uInt16 nLvl = rBase.GetLevel(); OSL_ENSURE( nLvl < GetTOXForm().GetFormMax(), "ungueltiges FORM_LEVEL"); SvxTabStopItem aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP ); @@ -1636,7 +1635,7 @@ void SwTOXBaseSection::GenerateText( USHORT nArrayIdx, { case TOKEN_ENTRY_NO: // fuer Inhaltsverzeichnis Numerierung - rTxt.Insert( lcl_GetNumString( rBase, aToken.nChapterFormat == CF_NUMBER, static_cast<BYTE>(aToken.nOutlineLevel - 1)) ); + rTxt.Insert( lcl_GetNumString( rBase, aToken.nChapterFormat == CF_NUMBER, static_cast<sal_uInt8>(aToken.nOutlineLevel - 1)) ); break; case TOKEN_ENTRY_TEXT: @@ -1665,7 +1664,7 @@ void SwTOXBaseSection::GenerateText( USHORT nArrayIdx, { const SvxLRSpaceItem& rLR = (SvxLRSpaceItem&)pTOXNd-> - SwCntntNode::GetAttr( RES_LR_SPACE, TRUE ); + SwCntntNode::GetAttr( RES_LR_SPACE, sal_True ); long nTabPosition = aToken.nTabStopPosition; if( !GetTOXForm().IsRelTabPos() && rLR.GetTxtLeft() ) @@ -1680,20 +1679,20 @@ void SwTOXBaseSection::GenerateText( USHORT nArrayIdx, const SwPageDesc* pPageDesc = ((SwFmtPageDesc&)pTOXNd-> SwCntntNode::GetAttr( RES_PAGEDESC )).GetPageDesc(); - BOOL bCallFindRect = TRUE; + sal_Bool bCallFindRect = sal_True; long nRightMargin; if( pPageDesc ) { - const SwFrm* pFrm = pTOXNd->GetFrm( 0, 0, TRUE ); + const SwFrm* pFrm = pTOXNd->GetFrm( 0, 0, sal_True ); if( !pFrm || 0 == ( pFrm = pFrm->FindPageFrm() ) || pPageDesc != ((SwPageFrm*)pFrm)->GetPageDesc() ) // dann muss man ueber den PageDesc gehen - bCallFindRect = FALSE; + bCallFindRect = sal_False; } SwRect aNdRect; if( bCallFindRect ) - aNdRect = pTOXNd->FindLayoutRect( TRUE ); + aNdRect = pTOXNd->FindLayoutRect( sal_True ); if( aNdRect.IsEmpty() ) { @@ -1701,7 +1700,7 @@ void SwTOXBaseSection::GenerateText( USHORT nArrayIdx, // vorlage gehen. sal_uInt32 nPgDescNdIdx = pTOXNd->GetIndex() + 1; sal_uInt32* pPgDescNdIdx = &nPgDescNdIdx; - pPageDesc = pTOXNd->FindPageDesc( FALSE, pPgDescNdIdx ); + pPageDesc = pTOXNd->FindPageDesc( sal_False, pPgDescNdIdx ); if ( !pPageDesc || *pPgDescNdIdx < _nTOXSectNdIdx ) { @@ -1743,11 +1742,11 @@ void SwTOXBaseSection::GenerateText( USHORT nArrayIdx, { // Die Anzahl der gleichen Eintrage bestimmt die Seitennummern-Pattern // - USHORT nSize = rBase.aTOXSources.Count(); + sal_uInt16 nSize = rBase.aTOXSources.Count(); if( nSize > 0 ) { String aInsStr( cNumRepl ); - for(USHORT i=1; i < nSize; ++i) + for(sal_uInt16 i=1; i < nSize; ++i) { aInsStr.AppendAscii( sPageDeli ); aInsStr += cNumRepl; @@ -1774,11 +1773,11 @@ void SwTOXBaseSection::GenerateText( USHORT nArrayIdx, { SwChapterFieldType aFldTyp; SwChapterField aFld( &aFldTyp, aToken.nChapterFormat ); - aFld.SetLevel( static_cast<BYTE>(aToken.nOutlineLevel - 1) ); + aFld.SetLevel( static_cast<sal_uInt8>(aToken.nOutlineLevel - 1) ); // #i53420# aFld.ChangeExpansion( pFrm, dynamic_cast<const SwCntntNode*>(pTOXSource->pNd), - TRUE ); + sal_True ); // <-- //---> #i89791# // continue to support CF_NUMBER @@ -1828,7 +1827,7 @@ void SwTOXBaseSection::GenerateText( USHORT nArrayIdx, pNewLink->aINetFmt.SetINetFmt(sLinkCharacterStyle); if(sLinkCharacterStyle.Len()) { - USHORT nPoolId = + sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sLinkCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ); pNewLink->aINetFmt.SetVisitedFmtId(nPoolId); pNewLink->aINetFmt.SetINetFmtId(nPoolId); @@ -1848,7 +1847,7 @@ void SwTOXBaseSection::GenerateText( USHORT nArrayIdx, { ToxAuthorityField eField = (ToxAuthorityField)aToken.nAuthorityField; SwIndex aIdx( pTOXNd, rTxt.Len() ); - rBase.FillText( *pTOXNd, aIdx, static_cast<USHORT>(eField) ); + rBase.FillText( *pTOXNd, aIdx, static_cast<sal_uInt16>(eField) ); } break; case TOKEN_END: break; @@ -1877,7 +1876,7 @@ void SwTOXBaseSection::GenerateText( USHORT nArrayIdx, } if(aLinkArr.Count()) - for(USHORT i = 0; i < aLinkArr.Count(); ++i ) + for(sal_uInt16 i = 0; i < aLinkArr.Count(); ++i ) { LinkStruct* pTmp = aLinkArr.GetObject(i); pTOXNd->InsertItem( pTmp->aINetFmt, pTmp->nStartTextPos, @@ -1896,7 +1895,7 @@ void SwTOXBaseSection::UpdatePageNum() // die aktuellen Seitennummern ins Verzeichnis eintragen SwPageFrm* pAktPage = 0; - USHORT nPage = 0; + sal_uInt16 nPage = 0; SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc(); SwTOXInternational aIntl( GetLanguage(), @@ -1904,7 +1903,7 @@ void SwTOXBaseSection::UpdatePageNum() GetOptions() : 0, GetSortAlgorithm() ); - for( USHORT nCnt = 0; nCnt < aSortArr.Count(); ++nCnt ) + for( sal_uInt16 nCnt = 0; nCnt < aSortArr.Count(); ++nCnt ) { // Schleife ueber alle SourceNodes SvUShorts aNums; //Die Seitennummern @@ -1912,7 +1911,7 @@ void SwTOXBaseSection::UpdatePageNum() SvUShorts* pMainNums = 0; // contains page numbers of main entries // process run in lines - USHORT nRange = 0; + sal_uInt16 nRange = 0; if(GetTOXForm().IsCommaSeparated() && aSortArr[nCnt]->GetType() == TOX_SORT_INDEX) { @@ -1930,12 +1929,12 @@ void SwTOXBaseSection::UpdatePageNum() else nRange = 1; - for(USHORT nRunInEntry = nCnt; nRunInEntry < nCnt + nRange; nRunInEntry++) + for(sal_uInt16 nRunInEntry = nCnt; nRunInEntry < nCnt + nRange; nRunInEntry++) { SwTOXSortTabBase* pSortBase = aSortArr[nRunInEntry]; - USHORT nSize = pSortBase->aTOXSources.Count(); - USHORT i; - for( USHORT j = 0; j < nSize; ++j ) + sal_uInt16 nSize = pSortBase->aTOXSources.Count(); + sal_uInt16 i; + for( sal_uInt16 j = 0; j < nSize; ++j ) { ::SetProgressState( 0, pDoc->GetDocShell() ); @@ -2004,12 +2003,12 @@ void SwTOXBaseSection::UpdatePageNum() Beschreibung: Austausch der Seitennummer-Platzhalter --------------------------------------------------------------------*/ // search for the page no in the array of main entry page numbers -BOOL lcl_HasMainEntry( const SvUShorts* pMainEntryNums, USHORT nToFind ) +sal_Bool lcl_HasMainEntry( const SvUShorts* pMainEntryNums, sal_uInt16 nToFind ) { - for(USHORT i = 0; pMainEntryNums && i < pMainEntryNums->Count(); ++i) + for(sal_uInt16 i = 0; pMainEntryNums && i < pMainEntryNums->Count(); ++i) if(nToFind == (*pMainEntryNums)[i]) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, @@ -2026,7 +2025,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, xub_StrLen nStartPos = pNd->GetTxt().Search( sSrchStr ); ( sSrchStr = cNumRepl ) += cEndPageNum; xub_StrLen nEndPos = pNd->GetTxt().Search( sSrchStr ); - USHORT i; + sal_uInt16 i; if( STRING_NOTFOUND == nEndPos || !rNums.Count() ) return; @@ -2034,14 +2033,14 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, if( STRING_NOTFOUND == nStartPos || nStartPos > nEndPos) nStartPos = nEndPos; - USHORT nOld = rNums[0], + sal_uInt16 nOld = rNums[0], nBeg = nOld, nCount = 0; String aNumStr( SvxNumberType( ((SwPageDesc*)rDescs[0])->GetNumType() ). GetNumStr( nBeg ) ); if( pCharStyleIdx && lcl_HasMainEntry( pMainEntryNums, nBeg )) { - USHORT nTemp = 0; + sal_uInt16 nTemp = 0; pCharStyleIdx->Insert( nTemp, pCharStyleIdx->Count()); } @@ -2050,7 +2049,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, SwCharFmt* pPageNoCharFmt = 0; SwpHints* pHints = pNd->GetpSwpHints(); if(pHints) - for(USHORT nHintIdx = 0; nHintIdx < pHints->GetStartCount(); nHintIdx++) + for(sal_uInt16 nHintIdx = 0; nHintIdx < pHints->GetStartCount(); nHintIdx++) { SwTxtAttr* pAttr = pHints->GetStart(nHintIdx); xub_StrLen nTmpEnd = pAttr->GetEnd() ? *pAttr->GetEnd() : 0; @@ -2072,7 +2071,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, // Alle folgenden aufaddieren // break up if main entry starts or ends and // insert a char style index - BOOL bMainEntryChanges = lcl_HasMainEntry(pMainEntryNums, nOld) + sal_Bool bMainEntryChanges = lcl_HasMainEntry(pMainEntryNums, nOld) != lcl_HasMainEntry(pMainEntryNums, rNums[i]); if(nOld == rNums[i]-1 && !bMainEntryChanges && @@ -2111,7 +2110,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, } else { // Alle Nummern eintragen - aNumStr += aType.GetNumStr( USHORT(rNums[i]) ); + aNumStr += aType.GetNumStr( sal_uInt16(rNums[i]) ); if(i != (rNums.Count()-1)) aNumStr.AppendAscii( sPageDeli ); } @@ -2155,7 +2154,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, //search by name SwDoc* pDoc = pNd->GetDoc(); - USHORT nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( GetMainEntryCharStyle(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ); + sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( GetMainEntryCharStyle(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ); SwCharFmt* pCharFmt = 0; if(USHRT_MAX != nPoolId) pCharFmt = pDoc->GetCharFmtFromPool(nPoolId); @@ -2167,7 +2166,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, //find the page numbers in aNumStr and set the character style xub_StrLen nOffset = pNd->GetTxt().Len() - aNumStr.Len(); SwFmtCharFmt aCharFmt(pCharFmt); - for(USHORT j = 0; j < pCharStyleIdx->Count(); j += 2) + for(sal_uInt16 j = 0; j < pCharStyleIdx->Count(); j += 2) { xub_StrLen nStartIdx = (*pCharStyleIdx)[j] + nOffset; xub_StrLen nEndIdx = (*pCharStyleIdx)[j + 1] + nOffset; @@ -2278,7 +2277,7 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew) --------------------------------------------------------------------*/ Range SwTOXBaseSection::GetKeyRange(const String& rStr, const String& rStrReading, const SwTOXSortTabBase& rNew, - USHORT nLevel, const Range& rRange ) + sal_uInt16 nLevel, const Range& rRange ) { const SwTOXInternational& rIntl = *rNew.pTOXIntl; String sToCompare(rStr); @@ -2292,10 +2291,10 @@ Range SwTOXBaseSection::GetKeyRange(const String& rStr, const String& rStrReadin OSL_ENSURE(rRange.Min() >= 0 && rRange.Max() >= 0, "Min Max < 0"); - const USHORT nMin = (USHORT)rRange.Min(); - const USHORT nMax = (USHORT)rRange.Max(); + const sal_uInt16 nMin = (sal_uInt16)rRange.Min(); + const sal_uInt16 nMax = (sal_uInt16)rRange.Max(); - USHORT i; + sal_uInt16 i; for( i = nMin; i < nMax; ++i) { @@ -2306,8 +2305,7 @@ Range SwTOXBaseSection::GetKeyRange(const String& rStr, const String& rStrReadin if( rIntl.IsEqual( sMyString, sMyStringReading, pBase->GetLocale(), sToCompare, sToCompareReading, rNew.GetLocale() ) && - pBase->GetLevel() == nLevel && - pBase->GetType() == TOX_SORT_CUSTOM ) + pBase->GetLevel() == nLevel ) break; } if(i == nMax) @@ -2322,8 +2320,8 @@ Range SwTOXBaseSection::GetKeyRange(const String& rStr, const String& rStrReadin } aSortArr.Insert(pKey, i ); } - USHORT nStart = i+1; - USHORT nEnd = aSortArr.Count(); + sal_uInt16 nStart = i+1; + sal_uInt16 nEnd = aSortArr.Count(); // Ende des Bereiches suchen for(i = nStart; i < aSortArr.Count(); ++i) @@ -2336,10 +2334,10 @@ Range SwTOXBaseSection::GetKeyRange(const String& rStr, const String& rStrReadin return Range(nStart, nEnd); } -BOOL SwTOXBase::IsTOXBaseInReadonly() const +sal_Bool SwTOXBase::IsTOXBaseInReadonly() const { const SwTOXBaseSection *pSect = PTR_CAST(SwTOXBaseSection, this); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; const SwSectionNode* pSectNode; if(pSect && pSect->GetFmt() && 0 != (pSectNode = pSect->GetFmt()->GetSectionNode())) @@ -2369,7 +2367,7 @@ void SwTOXBase::SetAttrSet( const SfxItemSet& rSet ) pSect->GetFmt()->SetFmtAttr( rSet ); } -BOOL SwTOXBase::GetInfo( SfxPoolItem& rInfo ) const +sal_Bool SwTOXBase::GetInfo( SfxPoolItem& rInfo ) const { switch( rInfo.Which() ) { @@ -2379,9 +2377,9 @@ BOOL SwTOXBase::GetInfo( SfxPoolItem& rInfo ) const if( pSect && pSect->GetFmt() ) pSect->GetFmt()->GetInfo( rInfo ); } - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx index fdfe5ca10310..6ed12fd4cce5 100644 --- a/sw/source/core/doc/extinput.cxx +++ b/sw/source/core/doc/extinput.cxx @@ -29,19 +29,23 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <com/sun/star/i18n/ScriptType.hpp> + +#include <editeng/langitem.hxx> +#include <editeng/scripttypeitem.hxx> -#include <hintids.hxx> #include <vcl/keycodes.hxx> #include <vcl/cmdevt.hxx> + +#include <hintids.hxx> #include <extinput.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <index.hxx> #include <ndtxt.hxx> #include <txtfrm.hxx> #include <swundo.hxx> -#include <editeng/langitem.hxx> -#include <editeng/scripttypeitem.hxx> -#include <com/sun/star/i18n/ScriptType.hpp> + using namespace ::com::sun::star; @@ -49,8 +53,8 @@ SwExtTextInput::SwExtTextInput( const SwPaM& rPam, Ring* pRing ) : SwPaM( *rPam.GetPoint(), (SwPaM*)pRing ), eInputLanguage(LANGUAGE_DONTKNOW) { - bIsOverwriteCursor = FALSE; - bInsText = TRUE; + bIsOverwriteCursor = sal_False; + bInsText = sal_True; } SwExtTextInput::~SwExtTextInput() @@ -79,7 +83,7 @@ SwExtTextInput::~SwExtTextInput() // for CJK/CTL scripts. bool bLang = true; // <-- - USHORT nWhich = RES_CHRATR_LANGUAGE; + sal_uInt16 nWhich = RES_CHRATR_LANGUAGE; switch(GetI18NScriptTypeOfLanguage(eInputLanguage)) { case i18n::ScriptType::ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break; @@ -107,12 +111,14 @@ SwExtTextInput::~SwExtTextInput() if( bInsText ) { rIdx = nSttCnt; - pDoc->StartUndo( UNDO_OVERWRITE, NULL ); + pDoc->GetIDocumentUndoRedo().StartUndo( + UNDO_OVERWRITE, NULL ); pDoc->Overwrite( *this, sTxt.Copy( 0, sOverwriteText.Len() )); pDoc->InsertString( *this, sTxt.Copy( sOverwriteText.Len() ) ); - pDoc->EndUndo( UNDO_OVERWRITE, NULL ); + pDoc->GetIDocumentUndoRedo().EndUndo( + UNDO_OVERWRITE, NULL ); } } else @@ -206,7 +212,7 @@ void SwExtTextInput::SetInputData( const CommandExtTextInputData& rData ) } } -void SwExtTextInput::SetOverwriteCursor( BOOL bFlag ) +void SwExtTextInput::SetOverwriteCursor( sal_Bool bFlag ) { bIsOverwriteCursor = bFlag; @@ -259,17 +265,17 @@ SwExtTextInput* SwDoc::GetExtTextInput( const SwNode& rNd, SwExtTextInput* pRet = 0; if( pExtInputRing ) { - ULONG nNdIdx = rNd.GetIndex(); + sal_uLong nNdIdx = rNd.GetIndex(); SwExtTextInput* pTmp = (SwExtTextInput*)pExtInputRing; do { - ULONG nPt = pTmp->GetPoint()->nNode.GetIndex(), + sal_uLong nPt = pTmp->GetPoint()->nNode.GetIndex(), nMk = pTmp->GetMark()->nNode.GetIndex(); xub_StrLen nPtCnt = pTmp->GetPoint()->nContent.GetIndex(), nMkCnt = pTmp->GetMark()->nContent.GetIndex(); if( nPt < nMk || ( nPt == nMk && nPtCnt < nMkCnt )) { - ULONG nTmp = nMk; nMk = nPt; nPt = nTmp; + sal_uLong nTmp = nMk; nMk = nPt; nPt = nTmp; nTmp = nMkCnt; nMkCnt = nPtCnt; nPtCnt = (xub_StrLen)nTmp; } diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index 05bb8965548f..cbbb1afaeef3 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -79,7 +79,7 @@ namespace TxtFmtCollFunc { if ( !pNewNumRuleItem ) { - pTxtFmtColl->GetItemState( RES_PARATR_NUMRULE, FALSE, (const SfxPoolItem**)&pNewNumRuleItem ); + pTxtFmtColl->GetItemState( RES_PARATR_NUMRULE, sal_False, (const SfxPoolItem**)&pNewNumRuleItem ); } if ( pNewNumRuleItem ) { @@ -100,7 +100,7 @@ namespace TxtFmtCollFunc SwNumRule* pNumRule( 0 ); const SwNumRuleItem* pNumRuleItem( 0 ); - rTxtFmtColl.GetItemState( RES_PARATR_NUMRULE, FALSE, (const SfxPoolItem**)&pNumRuleItem ); + rTxtFmtColl.GetItemState( RES_PARATR_NUMRULE, sal_False, (const SfxPoolItem**)&pNumRuleItem ); if ( pNumRuleItem ) { const String sNumRuleName = pNumRuleItem->GetValue(); @@ -162,21 +162,21 @@ void SwTxtFmtColl::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) pNewChgSet = (SwAttrSetChg*)pNew; pOldChgSet = (SwAttrSetChg*)pOld; pNewChgSet->GetChgSet()->GetItemState( - RES_LR_SPACE, FALSE, (const SfxPoolItem**)&pNewLRSpace ); + RES_LR_SPACE, sal_False, (const SfxPoolItem**)&pNewLRSpace ); pNewChgSet->GetChgSet()->GetItemState( - RES_UL_SPACE, FALSE, (const SfxPoolItem**)&pNewULSpace ); + RES_UL_SPACE, sal_False, (const SfxPoolItem**)&pNewULSpace ); pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_FONTSIZE, - FALSE, (const SfxPoolItem**)&(aFontSizeArr[0]) ); + sal_False, (const SfxPoolItem**)&(aFontSizeArr[0]) ); pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_CJK_FONTSIZE, - FALSE, (const SfxPoolItem**)&(aFontSizeArr[1]) ); + sal_False, (const SfxPoolItem**)&(aFontSizeArr[1]) ); pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_CTL_FONTSIZE, - FALSE, (const SfxPoolItem**)&(aFontSizeArr[2]) ); + sal_False, (const SfxPoolItem**)&(aFontSizeArr[2]) ); // #i70223#, #i84745# // check, if attribute set is applied to this paragraph style if ( bAssignedToListLevelOfOutlineStyle && pNewChgSet->GetTheChgdSet() == &GetAttrSet() ) { - pNewChgSet->GetChgSet()->GetItemState( RES_PARATR_NUMRULE, FALSE, + pNewChgSet->GetChgSet()->GetItemState( RES_PARATR_NUMRULE, sal_False, (const SfxPoolItem**)&pNewNumRuleItem ); } // <-- @@ -232,13 +232,13 @@ void SwTxtFmtColl::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) } // <-- - int bWeiter = TRUE; + int bWeiter = sal_True; // dann pruefe doch mal gegen die eigenen Attribute - if( pNewLRSpace && SFX_ITEM_SET == GetItemState( RES_LR_SPACE, FALSE, + if( pNewLRSpace && SFX_ITEM_SET == GetItemState( RES_LR_SPACE, sal_False, (const SfxPoolItem**)&pOldLRSpace )) { - int bChg = FALSE; + int bChg = sal_False; if( pOldLRSpace != pNewLRSpace ) // verhinder Rekursion (SetAttr!!) { SvxLRSpaceItem aNew( *pOldLRSpace ); @@ -277,22 +277,22 @@ void SwTxtFmtColl::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) } if( pNewULSpace && SFX_ITEM_SET == GetItemState( - RES_UL_SPACE, FALSE, (const SfxPoolItem**)&pOldULSpace ) && + RES_UL_SPACE, sal_False, (const SfxPoolItem**)&pOldULSpace ) && pOldULSpace != pNewULSpace ) // verhinder Rekursion (SetAttr!!) { SvxULSpaceItem aNew( *pOldULSpace ); - int bChg = FALSE; + int bChg = sal_False; // wir hatten eine relative Angabe -> neu berechnen if( 100 != aNew.GetPropUpper() ) { - USHORT nTmp = aNew.GetUpper(); // alten zum Vergleichen + sal_uInt16 nTmp = aNew.GetUpper(); // alten zum Vergleichen aNew.SetUpper( pNewULSpace->GetUpper(), aNew.GetPropUpper() ); bChg |= nTmp != aNew.GetUpper(); } // wir hatten eine relative Angabe -> neu berechnen if( 100 != aNew.GetPropLower() ) { - USHORT nTmp = aNew.GetLower(); // alten zum Vergleichen + sal_uInt16 nTmp = aNew.GetLower(); // alten zum Vergleichen aNew.SetLower( pNewULSpace->GetLower(), aNew.GetPropLower() ); bChg |= nTmp != aNew.GetLower(); } @@ -313,7 +313,7 @@ void SwTxtFmtColl::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) { SvxFontHeightItem *pFSize = aFontSizeArr[ nC ], *pOldFSize; if( pFSize && SFX_ITEM_SET == GetItemState( - pFSize->Which(), FALSE, (const SfxPoolItem**)&pOldFSize ) && + pFSize->Which(), sal_False, (const SfxPoolItem**)&pOldFSize ) && // verhinder Rekursion (SetAttr!!) pFSize != pOldFSize ) { @@ -328,7 +328,7 @@ void SwTxtFmtColl::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) else { // wir hatten eine relative Angabe -> neu berechnen - UINT32 nTmp = pOldFSize->GetHeight(); // alten zum Vergleichen + sal_uInt32 nTmp = pOldFSize->GetHeight(); // alten zum Vergleichen SvxFontHeightItem aNew(240 , 100, pFSize->Which()); aNew.SetHeight( pFSize->GetHeight(), pOldFSize->GetProp(), pOldFSize->GetPropUnit() ); @@ -349,18 +349,18 @@ void SwTxtFmtColl::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) SwFmtColl::Modify( pOld, pNew ); } -BOOL SwTxtFmtColl::IsAtDocNodeSet() const +sal_Bool SwTxtFmtColl::IsAtDocNodeSet() const { SwClientIter aIter( *(SwModify*)this ); const SwNodes& rNds = GetDoc()->GetNodes(); for( SwClient* pC = aIter.First(TYPE(SwCntntNode)); pC; pC = aIter.Next() ) if( &((SwCntntNode*)pC)->GetNodes() == &rNds ) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } -BOOL SwTxtFmtColl::SetFmtAttr( const SfxPoolItem& rAttr ) +sal_Bool SwTxtFmtColl::SetFmtAttr( const SfxPoolItem& rAttr ) { const bool bIsNumRuleItem = rAttr.Which() == RES_PARATR_NUMRULE; if ( bIsNumRuleItem ) @@ -368,7 +368,7 @@ BOOL SwTxtFmtColl::SetFmtAttr( const SfxPoolItem& rAttr ) TxtFmtCollFunc::RemoveFromNumRule( *this ); } - const BOOL bRet = SwFmtColl::SetFmtAttr( rAttr ); + const sal_Bool bRet = SwFmtColl::SetFmtAttr( rAttr ); if ( bIsNumRuleItem ) { @@ -378,16 +378,16 @@ BOOL SwTxtFmtColl::SetFmtAttr( const SfxPoolItem& rAttr ) return bRet; } -BOOL SwTxtFmtColl::SetFmtAttr( const SfxItemSet& rSet ) +sal_Bool SwTxtFmtColl::SetFmtAttr( const SfxItemSet& rSet ) { const bool bIsNumRuleItemAffected = - rSet.GetItemState( RES_PARATR_NUMRULE, FALSE ) == SFX_ITEM_SET; + rSet.GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_SET; if ( bIsNumRuleItemAffected ) { TxtFmtCollFunc::RemoveFromNumRule( *this ); } - const BOOL bRet = SwFmtColl::SetFmtAttr( rSet ); + const sal_Bool bRet = SwFmtColl::SetFmtAttr( rSet ); if ( bIsNumRuleItemAffected ) { @@ -397,7 +397,7 @@ BOOL SwTxtFmtColl::SetFmtAttr( const SfxItemSet& rSet ) return bRet; } -BOOL SwTxtFmtColl::ResetFmtAttr( USHORT nWhich1, USHORT nWhich2 ) +sal_Bool SwTxtFmtColl::ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 ) { const bool bIsNumRuleItemAffected = ( nWhich2 != 0 && nWhich2 > nWhich1 ) @@ -409,14 +409,14 @@ BOOL SwTxtFmtColl::ResetFmtAttr( USHORT nWhich1, USHORT nWhich2 ) TxtFmtCollFunc::RemoveFromNumRule( *this ); } - const BOOL bRet = SwFmtColl::ResetFmtAttr( nWhich1, nWhich2 ); + const sal_Bool bRet = SwFmtColl::ResetFmtAttr( nWhich1, nWhich2 ); return bRet; } // <-- // #i73790# -USHORT SwTxtFmtColl::ResetAllFmtAttr() +sal_uInt16 SwTxtFmtColl::ResetAllFmtAttr() { const bool bOldState( mbStayAssignedToListLevelOfOutlineStyle ); mbStayAssignedToListLevelOfOutlineStyle = true; @@ -429,7 +429,7 @@ USHORT SwTxtFmtColl::ResetAllFmtAttr() : -1; // <-- - USHORT nRet = SwFmtColl::ResetAllFmtAttr(); + sal_uInt16 nRet = SwFmtColl::ResetAllFmtAttr(); // #i70748# if ( nAssignedOutlineStyleLevel != -1 ) @@ -453,12 +453,12 @@ bool SwTxtFmtColl::AreListLevelIndentsApplicable() const // no list style applied to paragraph style bAreListLevelIndentsApplicable = false; } - else if ( GetItemState( RES_LR_SPACE, FALSE ) == SFX_ITEM_SET ) + else if ( GetItemState( RES_LR_SPACE, sal_False ) == SFX_ITEM_SET ) { // paragraph style has hard-set indent attributes bAreListLevelIndentsApplicable = false; } - else if ( GetItemState( RES_PARATR_NUMRULE, FALSE ) == SFX_ITEM_SET ) + else if ( GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_SET ) { // list style is directly applied to paragraph style and paragraph // style has no hard-set indent attributes @@ -473,14 +473,14 @@ bool SwTxtFmtColl::AreListLevelIndentsApplicable() const const SwTxtFmtColl* pColl = dynamic_cast<const SwTxtFmtColl*>(DerivedFrom()); while ( pColl ) { - if ( pColl->GetAttrSet().GetItemState( RES_LR_SPACE, FALSE ) == SFX_ITEM_SET ) + if ( pColl->GetAttrSet().GetItemState( RES_LR_SPACE, sal_False ) == SFX_ITEM_SET ) { // indent attributes found in the paragraph style hierarchy. bAreListLevelIndentsApplicable = false; break; } - if ( pColl->GetAttrSet().GetItemState( RES_PARATR_NUMRULE, FALSE ) == SFX_ITEM_SET ) + if ( pColl->GetAttrSet().GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_SET ) { // paragraph style with the list style found and until now no // indent attributes are found in the paragraph style hierarchy. @@ -500,15 +500,15 @@ bool SwTxtFmtColl::AreListLevelIndentsApplicable() const //FEATURE::CONDCOLL -SwCollCondition::SwCollCondition( SwTxtFmtColl* pColl, ULONG nMasterCond, - ULONG nSubCond ) +SwCollCondition::SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond, + sal_uLong nSubCond ) : SwClient( pColl ), nCondition( nMasterCond ) { aSubCondition.nSubCondition = nSubCond; } -SwCollCondition::SwCollCondition( SwTxtFmtColl* pColl, ULONG nMasterCond, +SwCollCondition::SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond, const String& rSubExp ) : SwClient( pColl ), nCondition( nMasterCond ) { @@ -568,7 +568,7 @@ int SwCollCondition::operator==( const SwCollCondition& rCmp ) const } -void SwCollCondition::SetCondition( ULONG nCond, ULONG nSubCond ) +void SwCollCondition::SetCondition( sal_uLong nCond, sal_uLong nSubCond ) { if( USRFLD_EXPRESSION & nCondition ) delete aSubCondition.pFldExpression; @@ -585,7 +585,7 @@ const SwCollCondition* SwConditionTxtFmtColl::HasCondition( const SwCollCondition& rCond ) const { const SwCollCondition* pFnd = 0; - USHORT n; + sal_uInt16 n; for( n = 0; n < aCondColls.Count(); ++n ) if( *( pFnd = aCondColls[ n ]) == rCond ) @@ -597,7 +597,7 @@ const SwCollCondition* SwConditionTxtFmtColl::HasCondition( void SwConditionTxtFmtColl::InsertCondition( const SwCollCondition& rCond ) { - for( USHORT n = 0; n < aCondColls.Count(); ++n ) + for( sal_uInt16 n = 0; n < aCondColls.Count(); ++n ) if( *aCondColls[ n ] == rCond ) { aCondColls.DeleteAndDestroy( n ); @@ -610,14 +610,14 @@ void SwConditionTxtFmtColl::InsertCondition( const SwCollCondition& rCond ) } -BOOL SwConditionTxtFmtColl::RemoveCondition( const SwCollCondition& rCond ) +sal_Bool SwConditionTxtFmtColl::RemoveCondition( const SwCollCondition& rCond ) { - BOOL bRet = FALSE; - for( USHORT n = 0; n < aCondColls.Count(); ++n ) + sal_Bool bRet = sal_False; + for( sal_uInt16 n = 0; n < aCondColls.Count(); ++n ) if( *aCondColls[ n ] == rCond ) { aCondColls.DeleteAndDestroy( n ); - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -630,7 +630,7 @@ void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls ) if( aCondColls.Count() ) aCondColls.DeleteAndDestroy( 0, aCondColls.Count() ); SwDoc& rDoc = *GetDoc(); - for( USHORT n = 0; n < rCndClls.Count(); ++n ) + for( sal_uInt16 n = 0; n < rCndClls.Count(); ++n ) { SwCollCondition* pFnd = rCndClls[ n ]; SwTxtFmtColl* pTmpColl = pFnd->GetTxtFmtColl() @@ -651,7 +651,7 @@ void SwTxtFmtColl::SetAttrOutlineLevel( int nLevel) { OSL_ENSURE( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTxtFmtColl: Level Out Of Range" ); SetFmtAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL, - static_cast<UINT16>(nLevel) ) ); + static_cast<sal_uInt16>(nLevel) ) ); } int SwTxtFmtColl::GetAttrOutlineLevel() const @@ -679,12 +679,12 @@ void SwTxtFmtColl::AssignToListLevelOfOutlineStyle(const int nAssignedListLevel) { if ( !pDerivedTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() ) { - if ( pDerivedTxtFmtColl->GetItemState( RES_PARATR_NUMRULE, FALSE ) == SFX_ITEM_DEFAULT ) + if ( pDerivedTxtFmtColl->GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_DEFAULT ) { SwNumRuleItem aItem(aEmptyStr); pDerivedTxtFmtColl->SetFmtAttr( aItem ); } - if ( pDerivedTxtFmtColl->GetItemState( RES_PARATR_OUTLINELEVEL, FALSE ) == SFX_ITEM_DEFAULT ) + if ( pDerivedTxtFmtColl->GetItemState( RES_PARATR_OUTLINELEVEL, sal_False ) == SFX_ITEM_DEFAULT ) { pDerivedTxtFmtColl->SetAttrOutlineLevel( 0 ); } diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx index afd96de4ba90..e0e257505ba7 100644 --- a/sw/source/core/doc/ftnidx.cxx +++ b/sw/source/core/doc/ftnidx.cxx @@ -43,24 +43,24 @@ _SV_IMPL_SORTAR_ALG( _SwFtnIdxs, SwTxtFtnPtr ) -BOOL _SwFtnIdxs::Seek_Entry( const SwTxtFtnPtr rSrch, USHORT* pFndPos ) const +sal_Bool _SwFtnIdxs::Seek_Entry( const SwTxtFtnPtr rSrch, sal_uInt16* pFndPos ) const { - ULONG nIdx = _SwTxtFtn_GetIndex( rSrch ); + sal_uLong nIdx = _SwTxtFtn_GetIndex( rSrch ); xub_StrLen nCntIdx = *rSrch->GetStart(); - USHORT nO = Count(), nM, nU = 0; + sal_uInt16 nO = Count(), nM, nU = 0; if( nO > 0 ) { nO--; while( nU <= nO ) { nM = nU + ( nO - nU ) / 2; - ULONG nFndIdx = _SwTxtFtn_GetIndex( (*this)[ nM ] ); + sal_uLong nFndIdx = _SwTxtFtn_GetIndex( (*this)[ nM ] ); if( nFndIdx == nIdx && *(*this)[ nM ]->GetStart() == nCntIdx ) { if( pFndPos ) *pFndPos = nM; - return TRUE; + return sal_True; } else if( nFndIdx < nIdx || (nFndIdx == nIdx && *(*this)[ nM ]->GetStart() < nCntIdx )) @@ -69,7 +69,7 @@ BOOL _SwFtnIdxs::Seek_Entry( const SwTxtFtnPtr rSrch, USHORT* pFndPos ) const { if( pFndPos ) *pFndPos = nU; - return FALSE; + return sal_False; } else nO = nM - 1; @@ -77,7 +77,7 @@ BOOL _SwFtnIdxs::Seek_Entry( const SwTxtFtnPtr rSrch, USHORT* pFndPos ) const } if( pFndPos ) *pFndPos = nU; - return FALSE; + return sal_False; } @@ -102,11 +102,11 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt ) { const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds(); const SwNode* pCapStt = &pDoc->GetNodes().GetEndOfExtras(); - ULONG nCapEnd = pDoc->GetNodes().GetEndOfContent().GetIndex(); + sal_uLong nCapEnd = pDoc->GetNodes().GetEndOfContent().GetIndex(); if( rOutlNds.Count() ) { // suche den Start des Kapitels, in den rStt steht. - USHORT n; + sal_uInt16 n; for( n = 0; n < rOutlNds.Count(); ++n ) if( rOutlNds[ n ]->GetIndex() > rStt.GetIndex() ) @@ -124,7 +124,7 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt ) } } - USHORT nPos, nFtnNo = 1; + sal_uInt16 nPos, nFtnNo = 1; if( SeekEntry( *pCapStt, &nPos ) && nPos ) { // gehe nach vorne bis der Index nicht mehr gleich ist @@ -156,12 +156,12 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt ) SwUpdFtnEndNtAtEnd aNumArr; - // BOOL, damit hier auch bei Chapter-Einstellung die Endnoten + // sal_Bool, damit hier auch bei Chapter-Einstellung die Endnoten // durchlaufen. - const BOOL bEndNoteOnly = FTNNUM_DOC != rFtnInfo.eNum; + const sal_Bool bEndNoteOnly = FTNNUM_DOC != rFtnInfo.eNum; - USHORT nPos, nFtnNo = 1, nEndNo = 1; - ULONG nUpdNdIdx = rStt.GetIndex(); + sal_uInt16 nPos, nFtnNo = 1, nEndNo = 1; + sal_uLong nUpdNdIdx = rStt.GetIndex(); for( nPos = 0; nPos < Count(); ++nPos ) { pTxtFtn = (*this)[ nPos ]; @@ -188,7 +188,7 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt ) const SwFmtFtn &rFtn = pTxtFtn->GetFtn(); if( !rFtn.GetNumStr().Len() ) { - USHORT nSectNo = aNumArr.ChkNumber( *pTxtFtn ); + sal_uInt16 nSectNo = aNumArr.ChkNumber( *pTxtFtn ); if( !nSectNo && ( rFtn.IsEndNote() || !bEndNoteOnly )) nSectNo = rFtn.IsEndNote() ? rEndInfo.nFtnOffset + nEndNo++ @@ -227,14 +227,14 @@ void SwFtnIdxs::UpdateAllFtn() if( FTNNUM_CHAPTER == rFtnInfo.eNum ) { const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds(); - USHORT nNo = 1, // Nummer fuer die Fussnoten + sal_uInt16 nNo = 1, // Nummer fuer die Fussnoten nFtnIdx = 0; // Index in das FtnIdx-Array - for( USHORT n = 0; n < rOutlNds.Count(); ++n ) + for( sal_uInt16 n = 0; n < rOutlNds.Count(); ++n ) { //if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei if ( rOutlNds[ n ]->GetTxtNode()->GetAttrOutlineLevel() == 1 )//<-end,zhaojianwei { - ULONG nCapStt = rOutlNds[ n ]->GetIndex(); // Start eines neuen Kapitels + sal_uLong nCapStt = rOutlNds[ n ]->GetIndex(); // Start eines neuen Kapitels for( ; nFtnIdx < Count(); ++nFtnIdx ) { pTxtFtn = (*this)[ nFtnIdx ]; @@ -267,17 +267,17 @@ void SwFtnIdxs::UpdateAllFtn() } - // BOOL, damit hier auch bei Chapter-Einstellung die Endnoten + // sal_Bool, damit hier auch bei Chapter-Einstellung die Endnoten // durchlaufen. - const BOOL bEndNoteOnly = FTNNUM_DOC != rFtnInfo.eNum; - USHORT nFtnNo = 0, nEndNo = 0; - for( USHORT nPos = 0; nPos < Count(); ++nPos ) + const sal_Bool bEndNoteOnly = FTNNUM_DOC != rFtnInfo.eNum; + sal_uInt16 nFtnNo = 0, nEndNo = 0; + for( sal_uInt16 nPos = 0; nPos < Count(); ++nPos ) { pTxtFtn = (*this)[ nPos ]; const SwFmtFtn &rFtn = pTxtFtn->GetFtn(); if( !rFtn.GetNumStr().Len() ) { - USHORT nSectNo = aNumArr.ChkNumber( *pTxtFtn ); + sal_uInt16 nSectNo = aNumArr.ChkNumber( *pTxtFtn ); if( !nSectNo && ( rFtn.IsEndNote() || !bEndNoteOnly )) nSectNo = rFtn.IsEndNote() ? rEndInfo.nFtnOffset + (++nEndNo) @@ -297,18 +297,18 @@ void SwFtnIdxs::UpdateAllFtn() pDoc->GetRootFrm()->UpdateFtnNums(); } -SwTxtFtn* SwFtnIdxs::SeekEntry( const SwNodeIndex& rPos, USHORT* pFndPos ) const +SwTxtFtn* SwFtnIdxs::SeekEntry( const SwNodeIndex& rPos, sal_uInt16* pFndPos ) const { - ULONG nIdx = rPos.GetIndex(); + sal_uLong nIdx = rPos.GetIndex(); - USHORT nO = Count(), nM, nU = 0; + sal_uInt16 nO = Count(), nM, nU = 0; if( nO > 0 ) { nO--; while( nU <= nO ) { nM = nU + ( nO - nU ) / 2; - ULONG nNdIdx = _SwTxtFtn_GetIndex( (*this)[ nM ] ); + sal_uLong nNdIdx = _SwTxtFtn_GetIndex( (*this)[ nM ] ); if( nNdIdx == nIdx ) { if( pFndPos ) @@ -337,23 +337,23 @@ SwTxtFtn* SwFtnIdxs::SeekEntry( const SwNodeIndex& rPos, USHORT* pFndPos ) const const SwSectionNode* SwUpdFtnEndNtAtEnd::FindSectNdWithEndAttr( const SwTxtFtn& rTxtFtn ) { - USHORT nWh = static_cast<USHORT>( rTxtFtn.GetFtn().IsEndNote() ? + sal_uInt16 nWh = static_cast<sal_uInt16>( rTxtFtn.GetFtn().IsEndNote() ? RES_END_AT_TXTEND : RES_FTN_AT_TXTEND ); - USHORT nVal; + sal_uInt16 nVal; const SwSectionNode* pNd = rTxtFtn.GetTxtNode().FindSectionNode(); while( pNd && FTNEND_ATTXTEND_OWNNUMSEQ != ( nVal = ((const SwFmtFtnAtTxtEnd&)pNd->GetSection().GetFmt()-> - GetFmtAttr( nWh, TRUE )).GetValue() ) && + GetFmtAttr( nWh, sal_True )).GetValue() ) && FTNEND_ATTXTEND_OWNNUMANDFMT != nVal ) pNd = pNd->StartOfSectionNode()->FindSectionNode(); return pNd; } -USHORT SwUpdFtnEndNtAtEnd::GetNumber( const SwTxtFtn& rTxtFtn, +sal_uInt16 SwUpdFtnEndNtAtEnd::GetNumber( const SwTxtFtn& rTxtFtn, const SwSectionNode& rNd ) { - USHORT nRet = 0, nWh; + sal_uInt16 nRet = 0, nWh; SvPtrarr* pArr; SvUShorts* pNum; if( rTxtFtn.GetFtn().IsEndNote() ) @@ -370,7 +370,7 @@ USHORT SwUpdFtnEndNtAtEnd::GetNumber( const SwTxtFtn& rTxtFtn, } void* pNd = (void*)&rNd; - for( USHORT n = pArr->Count(); n; ) + for( sal_uInt16 n = pArr->Count(); n; ) if( pArr->GetObject( --n ) == pNd ) { nRet = ++pNum->GetObject( n ); @@ -388,7 +388,7 @@ USHORT SwUpdFtnEndNtAtEnd::GetNumber( const SwTxtFtn& rTxtFtn, return nRet; } -USHORT SwUpdFtnEndNtAtEnd::ChkNumber( const SwTxtFtn& rTxtFtn ) +sal_uInt16 SwUpdFtnEndNtAtEnd::ChkNumber( const SwTxtFtn& rTxtFtn ) { const SwSectionNode* pSectNd = FindSectNdWithEndAttr( rTxtFtn ); return pSectNd ? GetNumber( rTxtFtn, *pSectNd ) : 0; diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx index 6e49dc8108d5..eb1864073088 100644 --- a/sw/source/core/doc/gctable.cxx +++ b/sw/source/core/doc/gctable.cxx @@ -36,40 +36,40 @@ #include <swtblfmt.hxx> -inline const SvxBorderLine* GetLineTB( const SvxBoxItem* pBox, BOOL bTop ) +inline const SvxBorderLine* GetLineTB( const SvxBoxItem* pBox, sal_Bool bTop ) { return bTop ? pBox->GetTop() : pBox->GetBottom(); } -BOOL _SwGCBorder_BoxBrd::CheckLeftBorderOfFormat( const SwFrmFmt& rFmt ) +sal_Bool _SwGCBorder_BoxBrd::CheckLeftBorderOfFormat( const SwFrmFmt& rFmt ) { const SvxBorderLine* pBrd; const SfxPoolItem* pItem; - if( SFX_ITEM_SET == rFmt.GetItemState( RES_BOX, TRUE, &pItem ) && + if( SFX_ITEM_SET == rFmt.GetItemState( RES_BOX, sal_True, &pItem ) && 0 != ( pBrd = ((SvxBoxItem*)pItem)->GetLeft() ) ) { if( *pBrdLn == *pBrd ) - bAnyBorderFnd = TRUE; - return TRUE; + bAnyBorderFnd = sal_True; + return sal_True; } - return FALSE; + return sal_False; } -BOOL lcl_GCBorder_ChkBoxBrd_L( const SwTableLine*& rpLine, void* pPara ) +sal_Bool lcl_GCBorder_ChkBoxBrd_L( const SwTableLine*& rpLine, void* pPara ) { const SwTableBox* pBox = rpLine->GetTabBoxes()[ 0 ]; return lcl_GCBorder_ChkBoxBrd_B( pBox, pPara ); } -BOOL lcl_GCBorder_ChkBoxBrd_B( const SwTableBox*& rpBox, void* pPara ) +sal_Bool lcl_GCBorder_ChkBoxBrd_B( const SwTableBox*& rpBox, void* pPara ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if( rpBox->GetTabLines().Count() ) { - for( USHORT n = 0, nLines = rpBox->GetTabLines().Count(); + for( sal_uInt16 n = 0, nLines = rpBox->GetTabLines().Count(); n < nLines && bRet; ++n ) { const SwTableLine* pLine = rpBox->GetTabLines()[ n ]; @@ -84,36 +84,36 @@ BOOL lcl_GCBorder_ChkBoxBrd_B( const SwTableBox*& rpBox, void* pPara ) return bRet; } -BOOL lcl_GCBorder_GetLastBox_L( const SwTableLine*& rpLine, void* pPara ) +sal_Bool lcl_GCBorder_GetLastBox_L( const SwTableLine*& rpLine, void* pPara ) { const SwTableBoxes& rBoxes = rpLine->GetTabBoxes(); const SwTableBox* pBox = rBoxes[ rBoxes.Count()-1 ]; ::lcl_GCBorder_GetLastBox_B( pBox, pPara ); - return TRUE; + return sal_True; } -BOOL lcl_GCBorder_GetLastBox_B( const SwTableBox*& rpBox, void* pPara ) +sal_Bool lcl_GCBorder_GetLastBox_B( const SwTableBox*& rpBox, void* pPara ) { SwTableLines& rLines = (SwTableLines&)rpBox->GetTabLines(); if( rLines.Count() ) rLines.ForEach( &lcl_GCBorder_GetLastBox_L, pPara ); else ((SwTableBoxes*)pPara)->Insert( rpBox, ((SwTableBoxes*)pPara)->Count() ); - return TRUE; + return sal_True; } // suche das "Ende" der vorgegebene BorderLine. Returnt wird die "Layout"Pos! -USHORT lcl_FindEndPosOfBorder( const SwCollectTblLineBoxes& rCollTLB, - const SvxBorderLine& rBrdLn, USHORT& rStt, BOOL bTop ) +sal_uInt16 lcl_FindEndPosOfBorder( const SwCollectTblLineBoxes& rCollTLB, + const SvxBorderLine& rBrdLn, sal_uInt16& rStt, sal_Bool bTop ) { - USHORT nPos, nLastPos = 0; - for( USHORT nEnd = rCollTLB.Count(); rStt < nEnd; ++rStt ) + sal_uInt16 nPos, nLastPos = 0; + for( sal_uInt16 nEnd = rCollTLB.Count(); rStt < nEnd; ++rStt ) { const SfxPoolItem* pItem; const SvxBorderLine* pBrd; const SwTableBox& rBox = rCollTLB.GetBox( rStt, &nPos ); - if( SFX_ITEM_SET != rBox.GetFrmFmt()->GetItemState(RES_BOX,TRUE, &pItem ) + if( SFX_ITEM_SET != rBox.GetFrmFmt()->GetItemState(RES_BOX,sal_True, &pItem ) || 0 == ( pBrd = GetLineTB( (SvxBoxItem*)pItem, bTop )) || !( *pBrd == rBrdLn )) break; @@ -123,23 +123,23 @@ USHORT lcl_FindEndPosOfBorder( const SwCollectTblLineBoxes& rCollTLB, } inline const SvxBorderLine* lcl_GCBorder_GetBorder( const SwTableBox& rBox, - BOOL bTop, + sal_Bool bTop, const SfxPoolItem** ppItem ) { - return SFX_ITEM_SET == rBox.GetFrmFmt()->GetItemState( RES_BOX, TRUE, ppItem ) + return SFX_ITEM_SET == rBox.GetFrmFmt()->GetItemState( RES_BOX, sal_True, ppItem ) ? GetLineTB( (SvxBoxItem*)*ppItem, bTop ) : 0; } void lcl_GCBorder_DelBorder( const SwCollectTblLineBoxes& rCollTLB, - USHORT& rStt, BOOL bTop, + sal_uInt16& rStt, sal_Bool bTop, const SvxBorderLine& rLine, const SfxPoolItem* pItem, - USHORT nEndPos, + sal_uInt16 nEndPos, SwShareBoxFmts* pShareFmts ) { SwTableBox* pBox = (SwTableBox*)&rCollTLB.GetBox( rStt ); - USHORT nNextPos; + sal_uInt16 nNextPos; const SvxBorderLine* pLn = &rLine; do { @@ -166,11 +166,11 @@ void lcl_GCBorder_DelBorder( const SwCollectTblLineBoxes& rCollTLB, pLn = lcl_GCBorder_GetBorder( *pBox, bTop, &pItem ); - } while( TRUE ); + } while( sal_True ); } -BOOL lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) +sal_Bool lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) { _SwGCLineBorder* pGCPara = (_SwGCLineBorder*)pPara; @@ -181,7 +181,7 @@ BOOL lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) const SvxBorderLine* pBrd; const SfxPoolItem* pItem; const SwTableBoxes& rBoxes = rpLine->GetTabBoxes(); - for( USHORT n = 0, nBoxes = rBoxes.Count() - 1; n < nBoxes; ++n ) + for( sal_uInt16 n = 0, nBoxes = rBoxes.Count() - 1; n < nBoxes; ++n ) { SwTableBoxes aBoxes; { @@ -193,9 +193,9 @@ BOOL lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) } SwTableBox* pBox; - for( USHORT i = aBoxes.Count(); i; ) + for( sal_uInt16 i = aBoxes.Count(); i; ) if( SFX_ITEM_SET == (pBox = aBoxes[ --i ])->GetFrmFmt()-> - GetItemState( RES_BOX, TRUE, &pItem ) && + GetItemState( RES_BOX, sal_True, &pItem ) && 0 != ( pBrd = ((SvxBoxItem*)pItem)->GetRight() ) ) { aBPara.SetBorder( *pBrd ); @@ -219,8 +219,8 @@ BOOL lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) // und jetzt die eigene untere Kante mit der nachfolgenden oberen Kante if( !pGCPara->IsLastLine() ) { - SwCollectTblLineBoxes aBottom( FALSE ); - SwCollectTblLineBoxes aTop( TRUE ); + SwCollectTblLineBoxes aBottom( sal_False ); + SwCollectTblLineBoxes aTop( sal_True ); ::lcl_Line_CollectBox( rpLine, &aBottom ); @@ -228,7 +228,7 @@ BOOL lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) ::lcl_Line_CollectBox( pNextLine, &aTop ); // dann entferne mal alle "doppelten" gleichen Lines - USHORT nBtmPos, nTopPos, + sal_uInt16 nBtmPos, nTopPos, nSttBtm = 0, nSttTop = 0, nEndBtm = aBottom.Count(), nEndTop = aTop.Count(); @@ -236,23 +236,23 @@ BOOL lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) *pTopBox = &aTop.GetBox( nSttTop++, &nTopPos ); const SfxPoolItem *pBtmItem = 0, *pTopItem = 0; const SvxBorderLine *pBtmLine(0), *pTopLine(0); - BOOL bGetTopItem = TRUE, bGetBtmItem = TRUE; + sal_Bool bGetTopItem = sal_True, bGetBtmItem = sal_True; do { if( bGetBtmItem ) - pBtmLine = lcl_GCBorder_GetBorder( *pBtmBox, FALSE, &pBtmItem ); + pBtmLine = lcl_GCBorder_GetBorder( *pBtmBox, sal_False, &pBtmItem ); if( bGetTopItem ) - pTopLine = lcl_GCBorder_GetBorder( *pTopBox, TRUE, &pTopItem ); + pTopLine = lcl_GCBorder_GetBorder( *pTopBox, sal_True, &pTopItem ); if( pTopLine && pBtmLine && *pTopLine == *pBtmLine ) { // dann kann einer entfernt werden, aber welche? - USHORT nSavSttBtm = nSttBtm, nSavSttTop = nSttTop; - USHORT nBtmEndPos = ::lcl_FindEndPosOfBorder( aBottom, - *pTopLine, nSttBtm, FALSE ); + sal_uInt16 nSavSttBtm = nSttBtm, nSavSttTop = nSttTop; + sal_uInt16 nBtmEndPos = ::lcl_FindEndPosOfBorder( aBottom, + *pTopLine, nSttBtm, sal_False ); if( !nBtmEndPos ) nBtmEndPos = nBtmPos; - USHORT nTopEndPos = ::lcl_FindEndPosOfBorder( aTop, - *pTopLine, nSttTop, TRUE ); + sal_uInt16 nTopEndPos = ::lcl_FindEndPosOfBorder( aTop, + *pTopLine, nSttTop, sal_True ); if( !nTopEndPos ) nTopEndPos = nTopPos; @@ -261,7 +261,7 @@ BOOL lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) // dann die TopBorder bis zur BottomEndPos loeschen nSttTop = nSavSttTop; if( nTopPos <= nBtmEndPos ) - lcl_GCBorder_DelBorder( aTop, --nSttTop, TRUE, + lcl_GCBorder_DelBorder( aTop, --nSttTop, sal_True, *pBtmLine, pTopItem, nBtmEndPos, pGCPara->pShareFmts ); else @@ -272,7 +272,7 @@ BOOL lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) // sonst die BottomBorder bis zur TopEndPos loeschen nSttBtm = nSavSttBtm; if( nBtmPos <= nTopEndPos ) - lcl_GCBorder_DelBorder( aBottom, --nSttBtm, FALSE, + lcl_GCBorder_DelBorder( aBottom, --nSttBtm, sal_False, *pTopLine, pBtmItem, nTopEndPos, pGCPara->pShareFmts ); else @@ -288,36 +288,36 @@ BOOL lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara ) pBtmBox = &aBottom.GetBox( nSttBtm++, &nBtmPos ); pTopBox = &aTop.GetBox( nSttTop++, &nTopPos ); - bGetTopItem = bGetBtmItem = TRUE; + bGetTopItem = bGetBtmItem = sal_True; } else if( nTopPos < nBtmPos ) { if( nSttTop >= nEndTop ) break; pTopBox = &aTop.GetBox( nSttTop++, &nTopPos ); - bGetTopItem = TRUE; - bGetBtmItem = FALSE; + bGetTopItem = sal_True; + bGetBtmItem = sal_False; } else { if( nSttBtm >= nEndBtm ) break; pBtmBox = &aBottom.GetBox( nSttBtm++, &nBtmPos ); - bGetTopItem = FALSE; - bGetBtmItem = TRUE; + bGetTopItem = sal_False; + bGetBtmItem = sal_True; } - } while( TRUE ); + } while( sal_True ); } ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_GC_Box_Border, pPara ); ++pGCPara->nLinePos; - return TRUE; + return sal_True; } -BOOL lcl_GC_Box_Border( const SwTableBox*& rpBox, void* pPara ) +sal_Bool lcl_GC_Box_Border( const SwTableBox*& rpBox, void* pPara ) { if( rpBox->GetTabLines().Count() ) { @@ -325,7 +325,7 @@ BOOL lcl_GC_Box_Border( const SwTableBox*& rpBox, void* pPara ) aPara.pShareFmts = ((_SwGCLineBorder*)pPara)->pShareFmts; ((SwTableBox*)rpBox)->GetTabLines().ForEach( &lcl_GC_Line_Border, &aPara ); } - return TRUE; + return sal_True; } struct _GCLinePara @@ -338,10 +338,10 @@ struct _GCLinePara {} }; -BOOL lcl_MergeGCBox( const SwTableBox*& rpTblBox, void* pPara ) +sal_Bool lcl_MergeGCBox( const SwTableBox*& rpTblBox, void* pPara ) { SwTableBox*& rpBox = (SwTableBox*&)rpTblBox; - USHORT n, nLen = rpBox->GetTabLines().Count(); + sal_uInt16 n, nLen = rpBox->GetTabLines().Count(); if( nLen ) { // ACHTUNG: die Anzahl der Lines kann sich aendern! @@ -357,7 +357,7 @@ BOOL lcl_MergeGCBox( const SwTableBox*& rpTblBox, void* pPara ) // hinter diese Box in der Parent-Line und loesche diese Box SwTableLine* pInsLine = rpBox->GetUpper(); SwTableLine* pCpyLine = rpBox->GetTabLines()[0]; - USHORT nInsPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, rpBox ); + sal_uInt16 nInsPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, rpBox ); for( n = 0; n < pCpyLine->GetTabBoxes().Count(); ++n ) pCpyLine->GetTabBoxes()[n]->SetUpper( pInsLine ); @@ -366,16 +366,16 @@ BOOL lcl_MergeGCBox( const SwTableBox*& rpTblBox, void* pPara ) // loesche alte die Box mit der Line pInsLine->GetTabBoxes().DeleteAndDestroy( nInsPos ); - return FALSE; // neu aufsetzen + return sal_False; // neu aufsetzen } } - return TRUE; + return sal_True; } -BOOL lcl_MergeGCLine( const SwTableLine*& rpLine, void* pPara ) +sal_Bool lcl_MergeGCLine( const SwTableLine*& rpLine, void* pPara ) { SwTableLine* pLn = (SwTableLine*)rpLine; - USHORT nLen = pLn->GetTabBoxes().Count(); + sal_uInt16 nLen = pLn->GetTabBoxes().Count(); if( nLen ) { _GCLinePara* pGCPara = (_GCLinePara*)pPara; @@ -396,7 +396,7 @@ BOOL lcl_MergeGCLine( const SwTableLine*& rpLine, void* pPara ) SwTableLines& rLns = *pGCPara->pLns; const SwTableLine* pTmp = pLn; - USHORT nInsPos = rLns.GetPos( pTmp ); + sal_uInt16 nInsPos = rLns.GetPos( pTmp ); OSL_ENSURE( USHRT_MAX != nInsPos, "Line nicht gefunden!" ); SwTableBox* pUpper = pLn->GetUpper(); @@ -408,12 +408,12 @@ BOOL lcl_MergeGCLine( const SwTableLine*& rpLine, void* pPara ) // Line an die "eingefuegten" uebertragen const SfxPoolItem* pItem; if( SFX_ITEM_SET == pLn->GetFrmFmt()->GetItemState( - RES_BACKGROUND, TRUE, &pItem )) + RES_BACKGROUND, sal_True, &pItem )) { SwTableLines& rBoxLns = pBox->GetTabLines(); - for( USHORT nLns = 0; nLns < nLen; ++nLns ) + for( sal_uInt16 nLns = 0; nLns < nLen; ++nLns ) if( SFX_ITEM_SET != rBoxLns[ nLns ]->GetFrmFmt()-> - GetItemState( RES_BACKGROUND, TRUE )) + GetItemState( RES_BACKGROUND, sal_True )) pGCPara->pShareFmts->SetAttr( *rBoxLns[ nLns ], *pItem ); } @@ -434,7 +434,7 @@ BOOL lcl_MergeGCLine( const SwTableLine*& rpLine, void* pPara ) if( !lcl_MergeGCBox( *(pLn->GetTabBoxes().GetData() + nLen ), pPara )) --nLen; } - return TRUE; + return sal_True; } // Struktur ein wenig aufraeumen @@ -444,7 +444,7 @@ void SwTable::GCLines() _GCLinePara aPara( GetTabLines() ); SwShareBoxFmts aShareFmts; aPara.pShareFmts = &aShareFmts; - for( USHORT n = 0; n < GetTabLines().Count() && + for( sal_uInt16 n = 0; n < GetTabLines().Count() && lcl_MergeGCLine( *(GetTabLines().GetData() + n ), &aPara ); ++n ) ; } diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index 0ea5eea71363..8252e86feb2b 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -59,36 +59,36 @@ using namespace ::com::sun::star; class SwHTMLTableLayoutConstraints { - USHORT nRow; // Start-Zeile - USHORT nCol; // Start-Spalte - USHORT nColSpan; // COLSPAN der Zelle + sal_uInt16 nRow; // Start-Zeile + sal_uInt16 nCol; // Start-Spalte + sal_uInt16 nColSpan; // COLSPAN der Zelle SwHTMLTableLayoutConstraints *pNext; // die naechste Bedingung - ULONG nMinNoAlign, nMaxNoAlign; // Zwischenergebnisse AL-Pass 1 + sal_uLong nMinNoAlign, nMaxNoAlign; // Zwischenergebnisse AL-Pass 1 public: - SwHTMLTableLayoutConstraints( ULONG nMin, ULONG nMax, USHORT nRow, - USHORT nCol, USHORT nColSp ); + SwHTMLTableLayoutConstraints( sal_uLong nMin, sal_uLong nMax, sal_uInt16 nRow, + sal_uInt16 nCol, sal_uInt16 nColSp ); ~SwHTMLTableLayoutConstraints(); - ULONG GetMinNoAlign() const { return nMinNoAlign; } - ULONG GetMaxNoAlign() const { return nMaxNoAlign; } + sal_uLong GetMinNoAlign() const { return nMinNoAlign; } + sal_uLong GetMaxNoAlign() const { return nMaxNoAlign; } SwHTMLTableLayoutConstraints *InsertNext( SwHTMLTableLayoutConstraints *pNxt ); SwHTMLTableLayoutConstraints* GetNext() const { return pNext; } - USHORT GetRow() const { return nRow; } + sal_uInt16 GetRow() const { return nRow; } - USHORT GetColSpan() const { return nColSpan; } - USHORT GetColumn() const { return nCol; } + sal_uInt16 GetColSpan() const { return nColSpan; } + sal_uInt16 GetColumn() const { return nCol; } }; SwHTMLTableLayoutCnts::SwHTMLTableLayoutCnts( const SwStartNode *pSttNd, SwHTMLTableLayout* pTab, - BOOL bNoBrTag, + sal_Bool bNoBrTag, SwHTMLTableLayoutCnts* pNxt ) : pNext( pNxt ), pBox( 0 ), pTable( pTab ), pStartNode( pSttNd ), nPass1Done( 0 ), nWidthSet( 0 ), bNoBreakTag( bNoBrTag ) @@ -107,9 +107,9 @@ const SwStartNode *SwHTMLTableLayoutCnts::GetStartNode() const SwHTMLTableLayoutCell::SwHTMLTableLayoutCell( SwHTMLTableLayoutCnts *pCnts, - USHORT nRSpan, USHORT nCSpan, - USHORT nWidth, BOOL bPrcWidth, - BOOL bNWrapOpt ) : + sal_uInt16 nRSpan, sal_uInt16 nCSpan, + sal_uInt16 nWidth, sal_Bool bPrcWidth, + sal_Bool bNWrapOpt ) : pContents( pCnts ), nRowSpan( nRSpan ), nColSpan( nCSpan ), nWidthOption( nWidth ), bPrcWidthOption( bPrcWidth ), @@ -125,9 +125,9 @@ SwHTMLTableLayoutCell::~SwHTMLTableLayoutCell() } -SwHTMLTableLayoutColumn::SwHTMLTableLayoutColumn( USHORT nWidth, - BOOL bRelWidth, - BOOL bLBorder ) : +SwHTMLTableLayoutColumn::SwHTMLTableLayoutColumn( sal_uInt16 nWidth, + sal_Bool bRelWidth, + sal_Bool bLBorder ) : nMinNoAlign(MINLAY), nMaxNoAlign(MINLAY), nAbsMinNoAlign(MINLAY), nMin(0), nMax(0), nAbsColWidth(0), nRelColWidth(0), @@ -137,7 +137,7 @@ SwHTMLTableLayoutColumn::SwHTMLTableLayoutColumn( USHORT nWidth, SwHTMLTableLayoutConstraints::SwHTMLTableLayoutConstraints( - ULONG nMin, ULONG nMax, USHORT nRw, USHORT nColumn, USHORT nColSp ): + sal_uLong nMin, sal_uLong nMax, sal_uInt16 nRw, sal_uInt16 nColumn, sal_uInt16 nColSp ): nRow( nRw ), nCol( nColumn ), nColSpan( nColSp ), pNext( 0 ), nMinNoAlign( nMin ), nMaxNoAlign( nMax ) @@ -183,13 +183,13 @@ typedef SwHTMLTableLayoutCell *SwHTMLTableLayoutCellPtr; SwHTMLTableLayout::SwHTMLTableLayout( const SwTable * pSwTbl, - USHORT nRws, USHORT nCls, BOOL bColsOpt, BOOL bColTgs, - USHORT nWdth, BOOL bPrcWdth, USHORT nBorderOpt, - USHORT nCellPad, USHORT nCellSp, SvxAdjust eAdjust, - USHORT nLMargin, USHORT nRMargin, - USHORT nBWidth, USHORT nLeftBWidth, - USHORT nRightBWidth, - USHORT nInhLeftBWidth, USHORT nInhRightBWidth ) : + sal_uInt16 nRws, sal_uInt16 nCls, sal_Bool bColsOpt, sal_Bool bColTgs, + sal_uInt16 nWdth, sal_Bool bPrcWdth, sal_uInt16 nBorderOpt, + sal_uInt16 nCellPad, sal_uInt16 nCellSp, SvxAdjust eAdjust, + sal_uInt16 nLMargin, sal_uInt16 nRMargin, + sal_uInt16 nBWidth, sal_uInt16 nLeftBWidth, + sal_uInt16 nRightBWidth, + sal_uInt16 nInhLeftBWidth, sal_uInt16 nInhRightBWidth ) : aColumns( new SwHTMLTableLayoutColumnPtr[nCls] ), aCells( new SwHTMLTableLayoutCellPtr[nRws*nCls] ), pSwTable( pSwTbl ), pLeftFillerBox( 0 ), pRightFillerBox( 0 ), @@ -207,9 +207,9 @@ SwHTMLTableLayout::SwHTMLTableLayout( nDelayedResizeAbsAvail( 0 ), nLastResizeAbsAvail( 0 ), nPass1Done( 0 ), nWidthSet( 0 ), eTableAdjust( eAdjust ), bColsOption( bColsOpt ), bColTags( bColTgs ), - bPrcWidthOption( bPrcWdth ), bUseRelWidth( FALSE ), - bMustResize( TRUE ), bExportable( TRUE ), bBordersChanged( FALSE ), - bMustNotResize( FALSE ), bMustNotRecalc( FALSE ) + bPrcWidthOption( bPrcWdth ), bUseRelWidth( sal_False ), + bMustResize( sal_True ), bExportable( sal_True ), bBordersChanged( sal_False ), + bMustNotResize( sal_False ), bMustNotRecalc( sal_False ) { aResizeTimer.SetTimeoutHdl( STATIC_LINK( this, SwHTMLTableLayout, DelayedResize_Impl ) ); @@ -217,13 +217,13 @@ SwHTMLTableLayout::SwHTMLTableLayout( SwHTMLTableLayout::~SwHTMLTableLayout() { - USHORT i; + sal_uInt16 i; for( i = 0; i < nCols; i++ ) delete aColumns[i]; delete[] aColumns; - USHORT nCount = nRows*nCols; + sal_uInt16 nCount = nRows*nCols; for( i=0; i<nCount; i++ ) delete aCells[i]; delete[] aCells; @@ -237,10 +237,10 @@ SwHTMLTableLayout::~SwHTMLTableLayout() // MIB 27.6.97: Dabei muss auch der Abstand zum Inhalt berueckichtigt werden, // und zwar auch dann, wenn wenn nur die gegenueberliegende Seite // eine Umrandung hat. -USHORT SwHTMLTableLayout::GetLeftCellSpace( USHORT nCol, USHORT nColSpan, - BOOL bSwBorders ) const +sal_uInt16 SwHTMLTableLayout::GetLeftCellSpace( sal_uInt16 nCol, sal_uInt16 nColSpan, + sal_Bool bSwBorders ) const { - USHORT nSpace = nCellSpacing + nCellPadding; + sal_uInt16 nSpace = nCellSpacing + nCellPadding; if( nCol == 0 ) { @@ -271,10 +271,10 @@ USHORT SwHTMLTableLayout::GetLeftCellSpace( USHORT nCol, USHORT nColSpan, return nSpace; } -USHORT SwHTMLTableLayout::GetRightCellSpace( USHORT nCol, USHORT nColSpan, - BOOL bSwBorders ) const +sal_uInt16 SwHTMLTableLayout::GetRightCellSpace( sal_uInt16 nCol, sal_uInt16 nColSpan, + sal_Bool bSwBorders ) const { - USHORT nSpace = nCellPadding; + sal_uInt16 nSpace = nCellPadding; if( nCol+nColSpan == nCols ) { @@ -296,12 +296,12 @@ USHORT SwHTMLTableLayout::GetRightCellSpace( USHORT nCol, USHORT nColSpan, return nSpace; } -void SwHTMLTableLayout::AddBorderWidth( ULONG &rMin, ULONG &rMax, - ULONG &rAbsMin, - USHORT nCol, USHORT nColSpan, - BOOL bSwBorders ) const +void SwHTMLTableLayout::AddBorderWidth( sal_uLong &rMin, sal_uLong &rMax, + sal_uLong &rAbsMin, + sal_uInt16 nCol, sal_uInt16 nColSpan, + sal_Bool bSwBorders ) const { - ULONG nAdd = GetLeftCellSpace( nCol, nColSpan, bSwBorders ) + + sal_uLong nAdd = GetLeftCellSpace( nCol, nColSpan, bSwBorders ) + GetRightCellSpace( nCol, nColSpan, bSwBorders ); rMin += nAdd; @@ -309,8 +309,8 @@ void SwHTMLTableLayout::AddBorderWidth( ULONG &rMin, ULONG &rMax, rAbsMin += nAdd; } -void SwHTMLTableLayout::SetBoxWidth( SwTableBox *pBox, USHORT nCol, - USHORT nColSpan ) const +void SwHTMLTableLayout::SetBoxWidth( SwTableBox *pBox, sal_uInt16 nCol, + sal_uInt16 nColSpan ) const { SwFrmFmt *pFrmFmt = pBox->GetFrmFmt(); @@ -324,12 +324,12 @@ void SwHTMLTableLayout::SetBoxWidth( SwTableBox *pBox, USHORT nCol, pFrmFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nFrmWidth, 0 )); } -void SwHTMLTableLayout::GetAvail( USHORT nCol, USHORT nColSpan, - USHORT& rAbsAvail, USHORT& rRelAvail ) const +void SwHTMLTableLayout::GetAvail( sal_uInt16 nCol, sal_uInt16 nColSpan, + sal_uInt16& rAbsAvail, sal_uInt16& rRelAvail ) const { rAbsAvail = 0; rRelAvail = 0; - for( USHORT i=nCol; i<nCol+nColSpan;i++ ) + for( sal_uInt16 i=nCol; i<nCol+nColSpan;i++ ) { const SwHTMLTableLayoutColumn *pColumn = GetColumn(i); rAbsAvail = rAbsAvail + pColumn->GetAbsColWidth(); @@ -337,19 +337,19 @@ void SwHTMLTableLayout::GetAvail( USHORT nCol, USHORT nColSpan, } } -USHORT SwHTMLTableLayout::GetBrowseWidthByVisArea( const SwDoc& rDoc ) +sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByVisArea( const SwDoc& rDoc ) { ViewShell *pVSh = 0; rDoc.GetEditShell( &pVSh ); if( pVSh ) { - return (USHORT)pVSh->GetBrowseWidth(); + return (sal_uInt16)pVSh->GetBrowseWidth(); } return 0; } -USHORT SwHTMLTableLayout::GetBrowseWidth( const SwDoc& rDoc ) +sal_uInt16 SwHTMLTableLayout::GetBrowseWidth( const SwDoc& rDoc ) { // Wenn ein Layout da ist, koennen wir die Breite dort herholen. const SwRootFrm *pRootFrm = rDoc.GetRootFrm(); @@ -357,7 +357,7 @@ USHORT SwHTMLTableLayout::GetBrowseWidth( const SwDoc& rDoc ) { const SwFrm *pPageFrm = pRootFrm->GetLower(); if( pPageFrm ) - return (USHORT)pPageFrm->Prt().Width(); + return (sal_uInt16)pPageFrm->Prt().Width(); } // #i91658# @@ -368,7 +368,7 @@ USHORT SwHTMLTableLayout::GetBrowseWidth( const SwDoc& rDoc ) // <-- } -USHORT SwHTMLTableLayout::GetBrowseWidthByTabFrm( +sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByTabFrm( const SwTabFrm& rTabFrm ) const { SwTwips nWidth = 0; @@ -397,12 +397,12 @@ USHORT SwHTMLTableLayout::GetBrowseWidthByTabFrm( rTabFrm.CalcFlyOffsets( nUpperDummy, nLeftOffset, nRightOffset ); nWidth -= (nLeftOffset + nRightOffset); - return nWidth < USHRT_MAX ? static_cast<USHORT>(nWidth) : USHRT_MAX; + return nWidth < USHRT_MAX ? static_cast<sal_uInt16>(nWidth) : USHRT_MAX; } -USHORT SwHTMLTableLayout::GetBrowseWidthByTable( const SwDoc& rDoc ) const +sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByTable( const SwDoc& rDoc ) const { - USHORT nBrowseWidth = 0; + sal_uInt16 nBrowseWidth = 0; SwClientIter aIter( *(SwModify*)pSwTable->GetFrmFmt() ); SwClient* pCli = aIter.First( TYPE( SwTabFrm )); if( pCli ) @@ -441,9 +441,9 @@ SwFrmFmt *SwHTMLTableLayout::FindFlyFrmFmt() const return pTblNd->GetFlyFmt(); } -static void lcl_GetMinMaxSize( ULONG& rMinNoAlignCnts, ULONG& rMaxNoAlignCnts, - ULONG& rAbsMinNoAlignCnts, - SwTxtNode *pTxtNd, ULONG nIdx, BOOL bNoBreak ) +static void lcl_GetMinMaxSize( sal_uLong& rMinNoAlignCnts, sal_uLong& rMaxNoAlignCnts, + sal_uLong& rAbsMinNoAlignCnts, + SwTxtNode *pTxtNd, sal_uLong nIdx, sal_Bool bNoBreak ) { pTxtNd->GetMinMaxSize( nIdx, rMinNoAlignCnts, rMaxNoAlignCnts, rAbsMinNoAlignCnts ); @@ -476,8 +476,8 @@ void SwHTMLTableLayout::AutoLayoutPass1() ClearPass1Info(); - BOOL bFixRelWidths = FALSE; - USHORT i; + sal_Bool bFixRelWidths = sal_False; + sal_uInt16 i; SwHTMLTableLayoutConstraints *pConstraints = 0; @@ -485,19 +485,19 @@ void SwHTMLTableLayout::AutoLayoutPass1() { SwHTMLTableLayoutColumn *pColumn = GetColumn( i ); pColumn->ClearPass1Info( !HasColTags() ); - USHORT nMinColSpan = USHRT_MAX; // Spaltenzahl, auf die sich dir + sal_uInt16 nMinColSpan = USHRT_MAX; // Spaltenzahl, auf die sich dir // berechnete Breite bezieht - USHORT nColSkip = USHRT_MAX; // Wie viele Spalten muessen + sal_uInt16 nColSkip = USHRT_MAX; // Wie viele Spalten muessen // uebersprungen werden - for( USHORT j=0; j<nRows; j++ ) + for( sal_uInt16 j=0; j<nRows; j++ ) { SwHTMLTableLayoutCell *pCell = GetCell(j,i); SwHTMLTableLayoutCnts *pCnts = pCell->GetContents(); // Zum Ermitteln der naechsten zu berechnenden // Spalte muessen alle Zeilen herangezogen werden - USHORT nColSpan = pCell->GetColSpan(); + sal_uInt16 nColSpan = pCell->GetColSpan(); if( nColSpan < nColSkip ) nColSkip = nColSpan; @@ -508,11 +508,11 @@ void SwHTMLTableLayout::AutoLayoutPass1() if( nColSpan < nMinColSpan ) nMinColSpan = nColSpan; - ULONG nMinNoAlignCell = 0; - ULONG nMaxNoAlignCell = 0; - ULONG nAbsMinNoAlignCell = 0; - ULONG nMaxTableCell = 0; - ULONG nAbsMinTableCell = 0; + sal_uLong nMinNoAlignCell = 0; + sal_uLong nMaxNoAlignCell = 0; + sal_uLong nAbsMinNoAlignCell = 0; + sal_uLong nMaxTableCell = 0; + sal_uLong nAbsMinTableCell = 0; while( pCnts ) { @@ -520,15 +520,15 @@ void SwHTMLTableLayout::AutoLayoutPass1() if( pSttNd ) { const SwDoc *pDoc = pSttNd->GetDoc(); - ULONG nIdx = pSttNd->GetIndex(); + sal_uLong nIdx = pSttNd->GetIndex(); while( !(pDoc->GetNodes()[nIdx])->IsEndNode() ) { SwTxtNode *pTxtNd = (pDoc->GetNodes()[nIdx])->GetTxtNode(); if( pTxtNd ) { - ULONG nMinNoAlignCnts = 0; - ULONG nMaxNoAlignCnts = 0; - ULONG nAbsMinNoAlignCnts = 0; + sal_uLong nMinNoAlignCnts = 0; + sal_uLong nMaxNoAlignCnts = 0; + sal_uLong nAbsMinNoAlignCnts = 0; lcl_GetMinMaxSize( nMinNoAlignCnts, nMaxNoAlignCnts, @@ -552,14 +552,14 @@ void SwHTMLTableLayout::AutoLayoutPass1() if( pChild ) { pChild->AutoLayoutPass1(); - ULONG nMaxTableCnts = pChild->nMax; - ULONG nAbsMinTableCnts = pChild->nMin; + sal_uLong nMaxTableCnts = pChild->nMax; + sal_uLong nAbsMinTableCnts = pChild->nMin; // Eine feste Tabellen-Breite wird als Minimum // und Maximum gleichzeitig uebernommen if( !pChild->bPrcWidthOption && pChild->nWidthOption ) { - ULONG nTabWidth = pChild->nWidthOption; + sal_uLong nTabWidth = pChild->nWidthOption; if( nTabWidth >= nAbsMinTableCnts ) { nMaxTableCnts = nTabWidth; @@ -587,14 +587,14 @@ void SwHTMLTableLayout::AutoLayoutPass1() OSL_ENSURE( !this, "Sub tables in HTML import?" ); SwHTMLTableLayout *pChild = pCnts->GetTable(); pChild->AutoLayoutPass1(); - ULONG nMaxTableCnts = pChild->nMax; - ULONG nAbsMinTableCnts = pChild->nMin; + sal_uLong nMaxTableCnts = pChild->nMax; + sal_uLong nAbsMinTableCnts = pChild->nMin; // Eine feste Tabellen-Breite wird als Minimum // und Maximum gleichzeitig uebernommen if( !pChild->bPrcWidthOption && pChild->nWidthOption ) { - ULONG nTabWidth = pChild->nWidthOption; + sal_uLong nTabWidth = pChild->nWidthOption; if( nTabWidth >= nAbsMinTableCnts ) { nMaxTableCnts = nTabWidth; @@ -631,8 +631,8 @@ void SwHTMLTableLayout::AutoLayoutPass1() } // War frueher hinter AddBorderWidth - BOOL bRelWidth = pCell->IsPrcWidthOption(); - USHORT nWidth = pCell->GetWidthOption(); + sal_Bool bRelWidth = pCell->IsPrcWidthOption(); + sal_uInt16 nWidth = pCell->GetWidthOption(); // Eine NOWRAP-Option bezieht sich auf Text und auf // Tabellen, wird aber bei fester Zellenbreite @@ -686,9 +686,9 @@ void SwHTMLTableLayout::AutoLayoutPass1() // unten erklaert. if( !HasColTags() && nWidth && !bRelWidth ) { - ULONG nAbsWidth = nWidth, nDummy = 0, nDummy2 = 0; + sal_uLong nAbsWidth = nWidth, nDummy = 0, nDummy2 = 0; AddBorderWidth( nAbsWidth, nDummy, nDummy2, - i, nColSpan, FALSE ); + i, nColSpan, sal_False ); if( nAbsWidth >= nMinNoAlignCell ) { @@ -755,9 +755,9 @@ void SwHTMLTableLayout::AutoLayoutPass1() { // absolute Breiten als Minimal- und Maximalbreite // uebernehmen. - ULONG nAbsWidth = pColumn->GetWidthOption(); - ULONG nDummy = 0, nDummy2 = 0; - AddBorderWidth( nAbsWidth, nDummy, nDummy2, i, 1, FALSE ); + sal_uLong nAbsWidth = pColumn->GetWidthOption(); + sal_uLong nDummy = 0, nDummy2 = 0; + AddBorderWidth( nAbsWidth, nDummy, nDummy2, i, 1, sal_False ); if( nAbsWidth >= pColumn->GetMinNoAlign() ) { @@ -803,16 +803,16 @@ void SwHTMLTableLayout::AutoLayoutPass1() { // Erstmal muss die Breite analog zu den den Spaltenbreiten // aufbereitet werden - USHORT nCol = pConstr->GetColumn(); - USHORT nColSpan = pConstr->GetColSpan(); - ULONG nConstrMin = pConstr->GetMinNoAlign(); - ULONG nConstrMax = pConstr->GetMaxNoAlign(); + sal_uInt16 nCol = pConstr->GetColumn(); + sal_uInt16 nColSpan = pConstr->GetColSpan(); + sal_uLong nConstrMin = pConstr->GetMinNoAlign(); + sal_uLong nConstrMax = pConstr->GetMaxNoAlign(); // jetzt holen wir uns die bisherige Breite der ueberspannten // Spalten - ULONG nColsMin = 0; - ULONG nColsMax = 0; - for( USHORT j=nCol; j<nCol+nColSpan; j++ ) + sal_uLong nColsMin = 0; + sal_uLong nColsMax = 0; + for( sal_uInt16 j=nCol; j<nCol+nColSpan; j++ ) { SwHTMLTableLayoutColumn *pColumn = GetColumn( j ); nColsMin += pColumn->GetMin(); @@ -822,22 +822,22 @@ void SwHTMLTableLayout::AutoLayoutPass1() if( nColsMin<nConstrMin ) { // den Minimalwert anteilig auf die Spalten verteilen - ULONG nMinD = nConstrMin-nColsMin; + sal_uLong nMinD = nConstrMin-nColsMin; if( nConstrMin > nColsMax ) { // Anteilig anhand der Mindestbreiten - USHORT nEndCol = nCol+nColSpan; - ULONG nDiff = nMinD; - for( USHORT ic=nCol; ic<nEndCol; ic++ ) + sal_uInt16 nEndCol = nCol+nColSpan; + sal_uLong nDiff = nMinD; + for( sal_uInt16 ic=nCol; ic<nEndCol; ic++ ) { SwHTMLTableLayoutColumn *pColumn = GetColumn( ic ); - ULONG nColMin = pColumn->GetMin(); - ULONG nColMax = pColumn->GetMax(); + sal_uLong nColMin = pColumn->GetMin(); + sal_uLong nColMax = pColumn->GetMax(); nMin -= nColMin; - ULONG nAdd = ic<nEndCol-1 ? (nColMin * nMinD) / nColsMin + sal_uLong nAdd = ic<nEndCol-1 ? (nColMin * nMinD) / nColsMin : nDiff; nColMin += nAdd; nMin += nColMin; @@ -859,11 +859,11 @@ void SwHTMLTableLayout::AutoLayoutPass1() else { // Anteilig anhand der Differenz zwischen Max und Min - for( USHORT ic=nCol; ic<nCol+nColSpan; ic++ ) + for( sal_uInt16 ic=nCol; ic<nCol+nColSpan; ic++ ) { SwHTMLTableLayoutColumn *pColumn = GetColumn( ic ); - ULONG nDiff = pColumn->GetMax()-pColumn->GetMin(); + sal_uLong nDiff = pColumn->GetMax()-pColumn->GetMin(); if( nMinD < nDiff ) nDiff = nMinD; @@ -880,9 +880,9 @@ void SwHTMLTableLayout::AutoLayoutPass1() if( !HasColTags() && nColsMax<nConstrMax ) { - ULONG nMaxD = nConstrMax-nColsMax; + sal_uLong nMaxD = nConstrMax-nColsMax; - for( USHORT ic=nCol; ic<nCol+nColSpan; ic++ ) + for( sal_uInt16 ic=nCol; ic<nCol+nColSpan; ic++ ) { SwHTMLTableLayoutColumn *pColumn = GetColumn( ic ); @@ -913,9 +913,9 @@ void SwHTMLTableLayout::AutoLayoutPass1() // erhalten und dient als Ausgangsbasis fuer die andern Breiten. // Es werden auch hier nur die Maximalbreiten beeinflusst! - ULONG nAbsMin = 0; // absolte Min-Breite alter Spalten mit + sal_uLong nAbsMin = 0; // absolte Min-Breite alter Spalten mit // relativer Breite - ULONG nRel = 0; // Summe der relativen Breiten aller Spalten + sal_uLong nRel = 0; // Summe der relativen Breiten aller Spalten for( i=0; i<nCols; i++ ) { SwHTMLTableLayoutColumn *pColumn = GetColumn( i ); @@ -926,7 +926,7 @@ void SwHTMLTableLayout::AutoLayoutPass1() } } - ULONG nQuot = ULONG_MAX; + sal_uLong nQuot = ULONG_MAX; for( i=0; i<nCols; i++ ) { SwHTMLTableLayoutColumn *pColumn = GetColumn( i ); @@ -936,7 +936,7 @@ void SwHTMLTableLayout::AutoLayoutPass1() if( pColumn->GetWidthOption() && pColumn->GetMin() ) { pColumn->SetMax( nAbsMin * pColumn->GetWidthOption() ); - ULONG nColQuot = pColumn->GetMax() / pColumn->GetMin(); + sal_uLong nColQuot = pColumn->GetMax() / pColumn->GetMin(); if( nColQuot<nQuot ) nQuot = nColQuot; } @@ -961,9 +961,9 @@ void SwHTMLTableLayout::AutoLayoutPass1() } else { - USHORT nRel = 0; // Summe der relativen Breiten aller Spalten - USHORT nRelCols = 0; // Anzahl Spalten mit relativer Angabe - ULONG nRelMax = 0; // Anteil am Maximum dieser Spalten + sal_uInt16 nRel = 0; // Summe der relativen Breiten aller Spalten + sal_uInt16 nRelCols = 0; // Anzahl Spalten mit relativer Angabe + sal_uLong nRelMax = 0; // Anteil am Maximum dieser Spalten for( i=0; i<nCols; i++ ) { OSL_ENSURE( nRel<=100, "relative Breite aller Spalten>100%" ); @@ -972,11 +972,11 @@ void SwHTMLTableLayout::AutoLayoutPass1() { // Sicherstellen, dass die relativen breiten nicht // ueber 100% landen - USHORT nColWidth = pColumn->GetWidthOption(); + sal_uInt16 nColWidth = pColumn->GetWidthOption(); if( nRel+nColWidth > 100 ) { nColWidth = 100 - nRel; - pColumn->SetWidthOption( nColWidth, TRUE, FALSE ); + pColumn->SetWidthOption( nColWidth, sal_True, sal_False ); } nRelMax += pColumn->GetMax(); nRel = nRel + nColWidth; @@ -1000,8 +1000,8 @@ void SwHTMLTableLayout::AutoLayoutPass1() // mit fester Breite. Ist das richtig??? if( nRel < 100 && nRelCols < nCols ) { - USHORT nRelLeft = 100 - nRel; - ULONG nFixMax = nMax - nRelMax; + sal_uInt16 nRelLeft = 100 - nRel; + sal_uLong nFixMax = nMax - nRelMax; for( i=0; i<nCols; i++ ) { SwHTMLTableLayoutColumn *pColumn = GetColumn( i ); @@ -1010,16 +1010,16 @@ void SwHTMLTableLayout::AutoLayoutPass1() pColumn->GetMin() ) { // den Rest bekommt die naechste Spalte - USHORT nColWidth = - (USHORT)((pColumn->GetMax() * nRelLeft) / nFixMax); - pColumn->SetWidthOption( nColWidth, TRUE, FALSE ); + sal_uInt16 nColWidth = + (sal_uInt16)((pColumn->GetMax() * nRelLeft) / nFixMax); + pColumn->SetWidthOption( nColWidth, sal_True, sal_False ); } } } // nun die Maximalbreiten entsprechend anpassen - ULONG nQuotMax = ULONG_MAX; - ULONG nOldMax = nMax; + sal_uLong nQuotMax = ULONG_MAX; + sal_uLong nOldMax = nMax; nMax = 0; for( i=0; i<nCols; i++ ) { @@ -1031,8 +1031,8 @@ void SwHTMLTableLayout::AutoLayoutPass1() SwHTMLTableLayoutColumn *pColumn = GetColumn( i ); if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption() ) { - ULONG nNewMax; - ULONG nColQuotMax; + sal_uLong nNewMax; + sal_uLong nColQuotMax; if( !nWidthOption ) { nNewMax = nOldMax * pColumn->GetWidthOption(); @@ -1080,10 +1080,10 @@ void SwHTMLTableLayout::AutoLayoutPass1() // nRelAvail ist der auf USHRT_MAX bezogene verfuegbare Platz oder 0 // nAbsSpace ist der Anteil von nAbsAvail, der durch der umgebende Zelle // fur die Umrandung und den Abstand zum Inhalt reserviert ist. -void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, - USHORT nAbsLeftSpace, - USHORT nAbsRightSpace, - USHORT nParentInhAbsSpace ) +void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAvail, + sal_uInt16 nAbsLeftSpace, + sal_uInt16 nAbsRightSpace, + sal_uInt16 nParentInhAbsSpace ) { // Erstmal fuehren wie jede Menge Plausibilaets-Test durch @@ -1109,7 +1109,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, // vorhandene Filler-Zellen und Abstande angepasst // Abstand zum Inhalt und Unrandung - USHORT nAbsLeftFill = 0, nAbsRightFill = 0; + sal_uInt16 nAbsLeftFill = 0, nAbsRightFill = 0; if( !IsTopTable() && GetMin() + nAbsLeftSpace + nAbsRightSpace <= nAbsAvail ) { @@ -1149,10 +1149,10 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, nRelRightFill = 0; if( !IsTopTable() && (nAbsLeftFill>0 || nAbsRightFill) ) { - ULONG nAbsLeftFillL = nAbsLeftFill, nAbsRightFillL = nAbsRightFill; + sal_uLong nAbsLeftFillL = nAbsLeftFill, nAbsRightFillL = nAbsRightFill; - nRelLeftFill = (USHORT)((nAbsLeftFillL * nRelAvail) / nAbsAvail); - nRelRightFill = (USHORT)((nAbsRightFillL * nRelAvail) / nAbsAvail); + nRelLeftFill = (sal_uInt16)((nAbsLeftFillL * nRelAvail) / nAbsAvail); + nRelRightFill = (sal_uInt16)((nAbsRightFillL * nRelAvail) / nAbsAvail); nAbsAvail -= (nAbsLeftFill + nAbsRightFill); if( nRelAvail ) @@ -1161,8 +1161,8 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, // Schritt 2: Die absolute Tabellenbreite wird berechnet. - USHORT nAbsTabWidth = 0; - bUseRelWidth = FALSE; + sal_uInt16 nAbsTabWidth = 0; + bUseRelWidth = sal_False; if( nWidthOption ) { if( bPrcWidthOption ) @@ -1184,12 +1184,12 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, // Spielen wir solche Spielchen // jetzt doch. Dort war eine Grafik in einer 1%-breiten // Tabelle und hat da natuerlich nicht hineingepasst. - nAbsTabWidth = (USHORT)( ((ULONG)nAbsAvail * nWidthOption) / 100 ); + nAbsTabWidth = (sal_uInt16)( ((sal_uLong)nAbsAvail * nWidthOption) / 100 ); if( IsTopTable() && - ( /*MayBeInFlyFrame() ||*/ (ULONG)nAbsTabWidth > nMin ) ) + ( /*MayBeInFlyFrame() ||*/ (sal_uLong)nAbsTabWidth > nMin ) ) { nRelAvail = USHRT_MAX; - bUseRelWidth = TRUE; + bUseRelWidth = sal_True; } } else @@ -1217,7 +1217,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, // Schritt 3: Bestimmen der Spaltenbreiten und ggf. auch der // absoluten und relativen Tabellenbreiten. - if( (!IsTopTable() && nMin > (ULONG)nAbsAvail) || + if( (!IsTopTable() && nMin > (sal_uLong)nAbsAvail) || nMin > MAX_TABWIDTH ) { // Wenn @@ -1235,10 +1235,10 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, // that are: Every cell's width excluding the borders must be at least // MINLAY: - ULONG nRealMin = 0; - for( USHORT i=0; i<nCols; i++ ) + sal_uLong nRealMin = 0; + for( sal_uInt16 i=0; i<nCols; i++ ) { - ULONG nRealColMin = MINLAY, nDummy1, nDummy2; + sal_uLong nRealColMin = MINLAY, nDummy1, nDummy2; AddBorderWidth( nRealColMin, nDummy1, nDummy2, i, 1 ); nRealMin += nRealColMin; } @@ -1247,30 +1247,30 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, // "Nichts geht mehr". We cannot get the minimum column widths // the layout wants to have. - USHORT nAbs = 0, nRel = 0; + sal_uInt16 nAbs = 0, nRel = 0; SwHTMLTableLayoutColumn *pColumn; - for( USHORT i=0; i<nCols-1; i++ ) + for( sal_uInt16 i=0; i<nCols-1; i++ ) { pColumn = GetColumn( i ); - ULONG nColMin = pColumn->GetMin(); + sal_uLong nColMin = pColumn->GetMin(); if( nColMin <= USHRT_MAX ) { pColumn->SetAbsColWidth( - (USHORT)((nColMin * nAbsTabWidth) / nMin) ); + (sal_uInt16)((nColMin * nAbsTabWidth) / nMin) ); pColumn->SetRelColWidth( - (USHORT)((nColMin * nRelTabWidth) / nMin) ); + (sal_uInt16)((nColMin * nRelTabWidth) / nMin) ); } else { double nColMinD = nColMin; pColumn->SetAbsColWidth( - (USHORT)((nColMinD * nAbsTabWidth) / nMin) ); + (sal_uInt16)((nColMinD * nAbsTabWidth) / nMin) ); pColumn->SetRelColWidth( - (USHORT)((nColMinD * nRelTabWidth) / nMin) ); + (sal_uInt16)((nColMinD * nRelTabWidth) / nMin) ); } - nAbs = nAbs + (USHORT)pColumn->GetAbsColWidth(); - nRel = nRel + (USHORT)pColumn->GetRelColWidth(); + nAbs = nAbs + (sal_uInt16)pColumn->GetAbsColWidth(); + nRel = nRel + (sal_uInt16)pColumn->GetRelColWidth(); } pColumn = GetColumn( nCols-1 ); pColumn->SetAbsColWidth( nAbsTabWidth - nAbs ); @@ -1278,43 +1278,43 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, } else { - ULONG nDistAbs = nAbsTabWidth - nRealMin; - ULONG nDistRel = nRelTabWidth - nRealMin; - ULONG nDistMin = nMin - nRealMin; - USHORT nAbs = 0, nRel = 0; + sal_uLong nDistAbs = nAbsTabWidth - nRealMin; + sal_uLong nDistRel = nRelTabWidth - nRealMin; + sal_uLong nDistMin = nMin - nRealMin; + sal_uInt16 nAbs = 0, nRel = 0; SwHTMLTableLayoutColumn *pColumn; - for( USHORT i=0; i<nCols-1; i++ ) + for( sal_uInt16 i=0; i<nCols-1; i++ ) { pColumn = GetColumn( i ); - ULONG nColMin = pColumn->GetMin(); - ULONG nRealColMin = MINLAY, nDummy1, nDummy2; + sal_uLong nColMin = pColumn->GetMin(); + sal_uLong nRealColMin = MINLAY, nDummy1, nDummy2; AddBorderWidth( nRealColMin, nDummy1, nDummy2, i, 1 ); if( nColMin <= USHRT_MAX ) { pColumn->SetAbsColWidth( - (USHORT)((((nColMin-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) ); + (sal_uInt16)((((nColMin-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) ); pColumn->SetRelColWidth( - (USHORT)((((nColMin-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) ); + (sal_uInt16)((((nColMin-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) ); } else { double nColMinD = nColMin; pColumn->SetAbsColWidth( - (USHORT)((((nColMinD-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) ); + (sal_uInt16)((((nColMinD-nRealColMin) * nDistAbs) / nDistMin) + nRealColMin) ); pColumn->SetRelColWidth( - (USHORT)((((nColMinD-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) ); + (sal_uInt16)((((nColMinD-nRealColMin) * nDistRel) / nDistMin) + nRealColMin) ); } - nAbs = nAbs + (USHORT)pColumn->GetAbsColWidth(); - nRel = nRel + (USHORT)pColumn->GetRelColWidth(); + nAbs = nAbs + (sal_uInt16)pColumn->GetAbsColWidth(); + nRel = nRel + (sal_uInt16)pColumn->GetRelColWidth(); } pColumn = GetColumn( nCols-1 ); pColumn->SetAbsColWidth( nAbsTabWidth - nAbs ); pColumn->SetRelColWidth( nRelTabWidth - nRel ); } } - else if( nMax <= (ULONG)(nAbsTabWidth ? nAbsTabWidth : nAbsAvail) ) + else if( nMax <= (sal_uLong)(nAbsTabWidth ? nAbsTabWidth : nAbsAvail) ) { // Wenn // - die Tabelle eine fixe Breite besitzt und das Maximum der @@ -1326,7 +1326,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, // Keine fixe Breite, dann das Maximum nehmen. if( !nAbsTabWidth ) - nAbsTabWidth = (USHORT)nMax; + nAbsTabWidth = (sal_uInt16)nMax; // Eine Top-Table darf auch beriter werden als der verfuegbare Platz. if( nAbsTabWidth > nAbsAvail ) @@ -1338,14 +1338,14 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, // Nur den Anteil der relativen Breite verwenden, der auch fuer // die absolute Breite verwendet wuerde. - ULONG nAbsTabWidthL = nAbsTabWidth; + sal_uLong nAbsTabWidthL = nAbsTabWidth; nRelTabWidth = - ( nRelAvail ? (USHORT)((nAbsTabWidthL * nRelAvail) / nAbsAvail) + ( nRelAvail ? (sal_uInt16)((nAbsTabWidthL * nRelAvail) / nAbsAvail) : nAbsTabWidth ); // Gibt es Spalten mit und Spalten ohne %-Angabe? - ULONG nFixMax = nMax; - for( USHORT i=0; i<nCols; i++ ) + sal_uLong nFixMax = nMax; + for( sal_uInt16 i=0; i<nCols; i++ ) { const SwHTMLTableLayoutColumn *pColumn = GetColumn( i ); if( pColumn->IsRelWidthOption() && pColumn->GetWidthOption()>0 ) @@ -1365,9 +1365,9 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, // werden zuerst die fixen Breiten entsprechend korrigiert // eingestellt und erst danach die relativen. - USHORT nAbs = 0, nRel = 0; - USHORT nFixedCols = 0; - USHORT i; + sal_uInt16 nAbs = 0, nRel = 0; + sal_uInt16 nFixedCols = 0; + sal_uInt16 i; for( i = 0; i < nCols; i++ ) { @@ -1376,21 +1376,21 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, { // Die Spalte behaelt ihre Breite bei. nFixedCols++; - ULONG nColMax = pColumn->GetMax(); - pColumn->SetAbsColWidth( (USHORT)nColMax ); + sal_uLong nColMax = pColumn->GetMax(); + pColumn->SetAbsColWidth( (sal_uInt16)nColMax ); - ULONG nRelColWidth = + sal_uLong nRelColWidth = (nColMax * nRelTabWidth) / nAbsTabWidth; - ULONG nChkWidth = + sal_uLong nChkWidth = (nRelColWidth * nAbsTabWidth) / nRelTabWidth; if( nChkWidth < nColMax ) nRelColWidth++; else if( nChkWidth > nColMax ) nRelColWidth--; - pColumn->SetRelColWidth( (USHORT)nRelColWidth ); + pColumn->SetRelColWidth( (sal_uInt16)nRelColWidth ); - nAbs = nAbs + (USHORT)nColMax; - nRel = nRel + (USHORT)nRelColWidth; + nAbs = nAbs + (sal_uInt16)nColMax; + nRel = nRel + (sal_uInt16)nRelColWidth; } } @@ -1399,9 +1399,9 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, // nAbs, so dass man gleich nFixMax haette nehmen koennen. // Der Code ist so aber verstaendlicher. OSL_ENSURE( nFixMax == nAbs, "Zwei Schleifen, zwei Summen?" ); - ULONG nDistMax = nMax - nFixMax; - USHORT nDistAbsTabWidth = nAbsTabWidth - nAbs; - USHORT nDistRelTabWidth = nRelTabWidth - nRel; + sal_uLong nDistMax = nMax - nFixMax; + sal_uInt16 nDistAbsTabWidth = nAbsTabWidth - nAbs; + sal_uInt16 nDistRelTabWidth = nRelTabWidth - nRel; for( i=0; i<nCols; i++ ) { @@ -1417,11 +1417,11 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, } else { - ULONG nColMax = pColumn->GetMax(); + sal_uLong nColMax = pColumn->GetMax(); pColumn->SetAbsColWidth( - (USHORT)((nColMax * nDistAbsTabWidth) / nDistMax) ); + (sal_uInt16)((nColMax * nDistAbsTabWidth) / nDistMax) ); pColumn->SetRelColWidth( - (USHORT)((nColMax * nDistRelTabWidth) / nDistMax) ); + (sal_uInt16)((nColMax * nDistRelTabWidth) / nDistMax) ); } nAbs = nAbs + pColumn->GetAbsColWidth(); nRel = nRel + pColumn->GetRelColWidth(); @@ -1433,13 +1433,13 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, { // nein, dann den zu verteilenden Platz auf alle Spalten // gleichmaessig vertilen. - for( USHORT i=0; i<nCols; i++ ) + for( sal_uInt16 i=0; i<nCols; i++ ) { - ULONG nColMax = GetColumn( i )->GetMax(); + sal_uLong nColMax = GetColumn( i )->GetMax(); GetColumn( i )->SetAbsColWidth( - (USHORT)((nColMax * nAbsTabWidth) / nMax) ); + (sal_uInt16)((nColMax * nAbsTabWidth) / nMax) ); GetColumn( i )->SetRelColWidth( - (USHORT)((nColMax * nRelTabWidth) / nMax) ); + (sal_uInt16)((nColMax * nRelTabWidth) / nMax) ); } } } @@ -1450,7 +1450,7 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, if( !nAbsTabWidth ) nAbsTabWidth = nAbsAvail; if( nAbsTabWidth < nMin ) - nAbsTabWidth = (USHORT)nMin; + nAbsTabWidth = (sal_uInt16)nMin; if( nAbsTabWidth > nAbsAvail ) { @@ -1459,25 +1459,25 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, nAbsAvail = nAbsTabWidth; } - ULONG nAbsTabWidthL = nAbsTabWidth; + sal_uLong nAbsTabWidthL = nAbsTabWidth; nRelTabWidth = - ( nRelAvail ? (USHORT)((nAbsTabWidthL * nRelAvail) / nAbsAvail) + ( nRelAvail ? (sal_uInt16)((nAbsTabWidthL * nRelAvail) / nAbsAvail) : nAbsTabWidth ); double nW = nAbsTabWidth - nMin; double nD = (nMax==nMin ? 1 : nMax-nMin); - USHORT nAbs = 0, nRel = 0; - for( USHORT i=0; i<nCols-1; i++ ) + sal_uInt16 nAbs = 0, nRel = 0; + for( sal_uInt16 i=0; i<nCols-1; i++ ) { double nd = GetColumn( i )->GetMax() - GetColumn( i )->GetMin(); - ULONG nAbsColWidth = GetColumn( i )->GetMin() + (ULONG)((nd*nW)/nD); - ULONG nRelColWidth = nRelAvail + sal_uLong nAbsColWidth = GetColumn( i )->GetMin() + (sal_uLong)((nd*nW)/nD); + sal_uLong nRelColWidth = nRelAvail ? (nAbsColWidth * nRelTabWidth) / nAbsTabWidth : nAbsColWidth; - GetColumn( i )->SetAbsColWidth( (USHORT)nAbsColWidth ); - GetColumn( i )->SetRelColWidth( (USHORT)nRelColWidth ); - nAbs = nAbs + (USHORT)nAbsColWidth; - nRel = nRel + (USHORT)nRelColWidth; + GetColumn( i )->SetAbsColWidth( (sal_uInt16)nAbsColWidth ); + GetColumn( i )->SetRelColWidth( (sal_uInt16)nRelColWidth ); + nAbs = nAbs + (sal_uInt16)nAbsColWidth; + nRel = nRel + (sal_uInt16)nRelColWidth; } GetColumn( nCols-1 )->SetAbsColWidth( nAbsTabWidth - nAbs ); GetColumn( nCols-1 )->SetRelColWidth( nRelTabWidth - nRel ); @@ -1493,9 +1493,9 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, { // Die Breite von zusaetzlichen Zellen zur Ausrichtung der // inneren Tabelle bestimmen - USHORT nAbsDist = (USHORT)(nAbsAvail-nAbsTabWidth); - USHORT nRelDist = (USHORT)(nRelAvail-nRelTabWidth); - USHORT nParentInhAbsLeftSpace = 0, nParentInhAbsRightSpace = 0; + sal_uInt16 nAbsDist = (sal_uInt16)(nAbsAvail-nAbsTabWidth); + sal_uInt16 nRelDist = (sal_uInt16)(nRelAvail-nRelTabWidth); + sal_uInt16 nParentInhAbsLeftSpace = 0, nParentInhAbsRightSpace = 0; // Groesse und Position der zusaetzlichen Zellen bestimmen switch( eTableAdjust ) @@ -1507,10 +1507,10 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, break; case SVX_ADJUST_CENTER: { - USHORT nAbsLeftDist = nAbsDist / 2; + sal_uInt16 nAbsLeftDist = nAbsDist / 2; nAbsLeftFill = nAbsLeftFill + nAbsLeftDist; nAbsRightFill += nAbsDist - nAbsLeftDist; - USHORT nRelLeftDist = nRelDist / 2; + sal_uInt16 nRelLeftDist = nRelDist / 2; nRelLeftFill = nRelLeftFill + nRelLeftDist; nRelRightFill += nRelDist - nRelLeftDist; nParentInhAbsLeftSpace = nParentInhAbsSpace / 2; @@ -1559,32 +1559,32 @@ void SwHTMLTableLayout::AutoLayoutPass2( USHORT nAbsAvail, USHORT nRelAvail, } } -static BOOL lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara ); +static sal_Bool lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara ); -static BOOL lcl_ResizeBox( const SwTableBox*& rpBox, void* pPara ) +static sal_Bool lcl_ResizeBox( const SwTableBox*& rpBox, void* pPara ) { - USHORT *pWidth = (USHORT *)pPara; + sal_uInt16 *pWidth = (sal_uInt16 *)pPara; if( !rpBox->GetSttNd() ) { - USHORT nWidth = 0; + sal_uInt16 nWidth = 0; ((SwTableBox *)rpBox)->GetTabLines().ForEach( &lcl_ResizeLine, &nWidth ); rpBox->GetFrmFmt()->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth, 0 )); *pWidth = *pWidth + nWidth; } else { - *pWidth = *pWidth + (USHORT)rpBox->GetFrmFmt()->GetFrmSize().GetSize().Width(); + *pWidth = *pWidth + (sal_uInt16)rpBox->GetFrmFmt()->GetFrmSize().GetSize().Width(); } - return TRUE; + return sal_True; } -static BOOL lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara ) +static sal_Bool lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara ) { - USHORT *pWidth = (USHORT *)pPara; + sal_uInt16 *pWidth = (sal_uInt16 *)pPara; #if OSL_DEBUG_LEVEL > 1 - USHORT nOldWidth = *pWidth; + sal_uInt16 nOldWidth = *pWidth; #endif *pWidth = 0; ((SwTableLine *)rpLine)->GetTabBoxes().ForEach( &lcl_ResizeBox, pWidth ); @@ -1594,13 +1594,13 @@ static BOOL lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara ) "Zeilen einer Box sind unterschiedlich lang" ); #endif - return TRUE; + return sal_True; } -void SwHTMLTableLayout::SetWidths( BOOL bCallPass2, USHORT nAbsAvail, - USHORT nRelAvail, USHORT nAbsLeftSpace, - USHORT nAbsRightSpace, - USHORT nParentInhAbsSpace ) +void SwHTMLTableLayout::SetWidths( sal_Bool bCallPass2, sal_uInt16 nAbsAvail, + sal_uInt16 nRelAvail, sal_uInt16 nAbsLeftSpace, + sal_uInt16 nAbsRightSpace, + sal_uInt16 nParentInhAbsSpace ) { // SetWidth muss am Ende einmal mehr fuer jede Zelle durchlaufen // worden sein. @@ -1616,9 +1616,9 @@ void SwHTMLTableLayout::SetWidths( BOOL bCallPass2, USHORT nAbsAvail, // Da die Boxen nichts von der HTML-Tabellen-Struktur wissen, wird // ueber die HTML-Tabellen-Struktur iteriert. Fuer Tabellen in Tabellen // in Tabellen wird rekursiv SetWidth aufgerufen. - for( USHORT i=0; i<nRows; i++ ) + for( sal_uInt16 i=0; i<nRows; i++ ) { - for( USHORT j=0; j<nCols; j++ ) + for( sal_uInt16 j=0; j<nCols; j++ ) { SwHTMLTableLayoutCell *pCell = GetCell( i, j ); @@ -1632,11 +1632,11 @@ void SwHTMLTableLayout::SetWidths( BOOL bCallPass2, USHORT nAbsAvail, } else { - USHORT nAbs = 0, nRel = 0, nLSpace = 0, nRSpace = 0, + sal_uInt16 nAbs = 0, nRel = 0, nLSpace = 0, nRSpace = 0, nInhSpace = 0; if( bCallPass2 ) { - USHORT nColSpan = pCell->GetColSpan(); + sal_uInt16 nColSpan = pCell->GetColSpan(); GetAvail( j, nColSpan, nAbs, nRel ); nLSpace = GetLeftCellSpace( j, nColSpan ); nRSpace = GetRightCellSpace( j, nColSpan ); @@ -1661,7 +1661,7 @@ void SwHTMLTableLayout::SetWidths( BOOL bCallPass2, USHORT nAbsAvail, // stattdessen die Breiten der Filler-Zellen gesetzt. if( IsTopTable() ) { - USHORT nCalcTabWidth = 0; + sal_uInt16 nCalcTabWidth = 0; ((SwTable *)pSwTable)->GetTabLines().ForEach( &lcl_ResizeLine, &nCalcTabWidth ); OSL_ENSURE( Abs( nRelTabWidth-nCalcTabWidth ) < COLFUZZY, @@ -1674,9 +1674,9 @@ void SwHTMLTableLayout::SetWidths( BOOL bCallPass2, USHORT nAbsAvail, ((SwTable *)pSwTable)->LockModify(); SwFmtFrmSize aFrmSize( pFrmFmt->GetFrmSize() ); aFrmSize.SetWidth( nRelTabWidth ); - BOOL bRel = bUseRelWidth && + sal_Bool bRel = bUseRelWidth && text::HoriOrientation::FULL!=pFrmFmt->GetHoriOrient().GetHoriOrient(); - aFrmSize.SetWidthPercent( (BYTE)(bRel ? nWidthOption : 0) ); + aFrmSize.SetWidthPercent( (sal_uInt8)(bRel ? nWidthOption : 0) ); pFrmFmt->SetFmtAttr( aFrmSize ); ((SwTable *)pSwTable)->UnlockModify(); @@ -1694,7 +1694,7 @@ void SwHTMLTableLayout::SetWidths( BOOL bCallPass2, USHORT nAbsAvail, // Bei %-Angaben wird die Breite auf das Minimum gesetzt. aFlyFrmSize.SetWidth( nMin > USHRT_MAX ? USHRT_MAX : nMin ); - aFlyFrmSize.SetWidthPercent( (BYTE)nWidthOption ); + aFlyFrmSize.SetWidthPercent( (sal_uInt8)nWidthOption ); } pFlyFrmFmt->SetFmtAttr( aFlyFrmSize ); } @@ -1708,7 +1708,7 @@ void SwHTMLTableLayout::SetWidths( BOOL bCallPass2, USHORT nAbsAvail, // checke doch mal ob die Tabellen korrekte Breiten haben SwTwips nSize = pSwTable->GetFrmFmt()->GetFrmSize().GetWidth(); const SwTableLines& rLines = pSwTable->GetTabLines(); - for( USHORT n = 0; n < rLines.Count(); ++n ) + for( sal_uInt16 n = 0; n < rLines.Count(); ++n ) _CheckBoxWidth( *rLines[ n ], nSize ); } #endif @@ -1729,7 +1729,7 @@ void SwHTMLTableLayout::SetWidths( BOOL bCallPass2, USHORT nAbsAvail, } } -void SwHTMLTableLayout::_Resize( USHORT nAbsAvail, BOOL bRecalc ) +void SwHTMLTableLayout::_Resize( sal_uInt16 nAbsAvail, sal_Bool bRecalc ) { // Wenn bRecalc gestzt ist, hat sich am Inhalt der Tabelle etwas // geaendert. Es muss dann der erste Pass noch einmal durchgefuehrt @@ -1743,10 +1743,10 @@ void SwHTMLTableLayout::_Resize( USHORT nAbsAvail, BOOL bRecalc ) // Sonst koennen die Breiten gesetzt werden, wobei zuvor aber jewils // noch der Pass 2 laufen muss. - SetWidths( TRUE, nAbsAvail ); + SetWidths( sal_True, nAbsAvail ); if ( pRoot && pRoot->IsCallbackActionEnabled() ) - pRoot->EndAllAction( TRUE ); //True per VirDev (Browsen ruhiger) + pRoot->EndAllAction( sal_True ); //True per VirDev (Browsen ruhiger) } IMPL_STATIC_LINK( SwHTMLTableLayout, DelayedResize_Impl, void*, EMPTYARG ) @@ -1759,20 +1759,20 @@ IMPL_STATIC_LINK( SwHTMLTableLayout, DelayedResize_Impl, void*, EMPTYARG ) } -BOOL SwHTMLTableLayout::Resize( USHORT nAbsAvail, BOOL bRecalc, - BOOL bForce, ULONG nDelay ) +sal_Bool SwHTMLTableLayout::Resize( sal_uInt16 nAbsAvail, sal_Bool bRecalc, + sal_Bool bForce, sal_uLong nDelay ) { if( 0 == nAbsAvail ) - return FALSE; + return sal_False; OSL_ENSURE( IsTopTable(), "Resize darf nur an Top-Tabellen aufgerufen werden" ); // Darf die Tabelle uberhaupt Resized werden oder soll sie es trotzdem? if( bMustNotResize && !bForce ) - return FALSE; + return sal_False; // Darf ein Recalc der Tabelle durchgefuehrt werden? if( bMustNotRecalc && !bForce ) - bRecalc = FALSE; + bRecalc = sal_False; const SwDoc *pDoc = GetDoc(); @@ -1782,7 +1782,7 @@ BOOL SwHTMLTableLayout::Resize( USHORT nAbsAvail, BOOL bRecalc, // weil sond die Umschaltung von relativ nach absolut nicht funktioniert. if( pDoc->GetRootFrm() && pDoc->get(IDocumentSettingAccess::BROWSE_MODE) ) { - const USHORT nVisAreaWidth = GetBrowseWidthByVisArea( *pDoc ); + const sal_uInt16 nVisAreaWidth = GetBrowseWidthByVisArea( *pDoc ); if( nVisAreaWidth < nAbsAvail && !FindFlyFrmFmt() ) nAbsAvail = nVisAreaWidth; } @@ -1794,7 +1794,7 @@ BOOL SwHTMLTableLayout::Resize( USHORT nAbsAvail, BOOL bRecalc, bRecalc |= bDelayedResizeRecalc; nDelayedResizeAbsAvail = nAbsAvail; - return FALSE; + return sal_False; } // Optimierung: @@ -1810,7 +1810,7 @@ BOOL SwHTMLTableLayout::Resize( USHORT nAbsAvail, BOOL bRecalc, (nLastResizeAbsAvail==nAbsAvail) || (nAbsAvail<=nMin && nRelTabWidth==nMin) || (!bPrcWidthOption && nAbsAvail>=nMax && nRelTabWidth==nMax) ) ) - return FALSE; + return sal_False; if( nDelay==HTMLTABLE_RESIZE_NOW ) { @@ -1830,12 +1830,12 @@ BOOL SwHTMLTableLayout::Resize( USHORT nAbsAvail, BOOL bRecalc, _Resize( nAbsAvail, bRecalc ); } - return TRUE; + return sal_True; } -void SwHTMLTableLayout::BordersChanged( USHORT nAbsAvail, BOOL bRecalc ) +void SwHTMLTableLayout::BordersChanged( sal_uInt16 nAbsAvail, sal_Bool bRecalc ) { - bBordersChanged = TRUE; + bBordersChanged = sal_True; Resize( nAbsAvail, bRecalc ); } diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx index 3d6b872522ee..8addb27cf01e 100644 --- a/sw/source/core/doc/lineinfo.cxx +++ b/sw/source/core/doc/lineinfo.cxx @@ -62,10 +62,10 @@ SwLineNumberInfo::SwLineNumberInfo() : nCountBy( 5 ), nDividerCountBy( 3 ), ePos( LINENUMBER_POS_LEFT ), - bPaintLineNumbers( FALSE ), - bCountBlankLines( TRUE ), - bCountInFlys( FALSE ), - bRestartEachPage( FALSE ) + bPaintLineNumbers( sal_False ), + bCountBlankLines( sal_True ), + bCountInFlys( sal_False ), + bRestartEachPage( sal_False ) { } @@ -106,7 +106,7 @@ SwLineNumberInfo& SwLineNumberInfo::operator=(const SwLineNumberInfo &rCpy) return *this; } -BOOL SwLineNumberInfo::operator==( const SwLineNumberInfo& rInf ) const +sal_Bool SwLineNumberInfo::operator==( const SwLineNumberInfo& rInf ) const { return GetRegisteredIn() == rInf.GetRegisteredIn() && aType.GetNumberingType() == rInf.GetNumType().GetNumberingType() && diff --git a/sw/source/core/doc/list.cxx b/sw/source/core/doc/list.cxx index 69883e3af67f..3fc2ee0500dd 100644 --- a/sw/source/core/doc/list.cxx +++ b/sw/source/core/doc/list.cxx @@ -61,7 +61,7 @@ class SwListImpl void ValidateListTree(); void MarkListLevel( const int nListLevel, - const BOOL bValue ); + const sal_Bool bValue ); bool IsListLevelMarked( const int nListLevel ) const; @@ -103,7 +103,7 @@ SwListImpl::SwListImpl( const String sListId, pNode = pNode->EndOfSectionNode(); if (pNode != &rNodes.GetEndOfContent()) { - ULONG nIndex = pNode->GetIndex(); + sal_uLong nIndex = pNode->GetIndex(); nIndex++; pNode = rNodes[nIndex]; } @@ -187,7 +187,7 @@ void SwListImpl::ValidateListTree() } void SwListImpl::MarkListLevel( const int nListLevel, - const BOOL bValue ) + const sal_Bool bValue ) { if ( bValue ) { @@ -280,7 +280,7 @@ void SwList::ValidateListTree() } void SwList::MarkListLevel( const int nListLevel, - const BOOL bValue ) + const sal_Bool bValue ) { mpListImpl->MarkListLevel( nListLevel, bValue ); } diff --git a/sw/source/core/doc/makefile.mk b/sw/source/core/doc/makefile.mk deleted file mode 100644 index 3399c694b8fc..000000000000 --- a/sw/source/core/doc/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=doc - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES = \ - $(SLO)$/SwStyleNameMapper.obj \ - $(SLO)$/acmplwrd.obj \ - $(SLO)$/dbgoutsw.obj \ - $(SLO)$/doc.obj \ - $(SLO)$/docbasic.obj \ - $(SLO)$/docbm.obj \ - $(SLO)$/docchart.obj \ - $(SLO)$/doccomp.obj \ - $(SLO)$/doccorr.obj \ - $(SLO)$/docdde.obj \ - $(SLO)$/docdesc.obj \ - $(SLO)$/docdraw.obj \ - $(SLO)$/docedt.obj \ - $(SLO)$/docfld.obj \ - $(SLO)$/docfly.obj \ - $(SLO)$/docfmt.obj \ - $(SLO)$/docftn.obj \ - $(SLO)$/docglbl.obj \ - $(SLO)$/docglos.obj \ - $(SLO)$/doclay.obj \ - $(SLO)$/docnew.obj \ - $(SLO)$/docnum.obj \ - $(SLO)$/docredln.obj \ - $(SLO)$/docruby.obj \ - $(SLO)$/docsort.obj \ - $(SLO)$/doctxm.obj \ - $(SLO)$/docxforms.obj \ - $(SLO)$/extinput.obj \ - $(SLO)$/fmtcol.obj \ - $(SLO)$/ftnidx.obj \ - $(SLO)$/gctable.obj \ - $(SLO)$/htmltbl.obj \ - $(SLO)$/lineinfo.obj \ - $(SLO)$/list.obj \ - $(SLO)$/notxtfrm.obj \ - $(SLO)$/number.obj \ - $(SLO)$/poolfmt.obj \ - $(SLO)$/swserv.obj \ - $(SLO)$/swstylemanager.obj \ - $(SLO)$/tblafmt.obj \ - $(SLO)$/tblcpy.obj \ - $(SLO)$/tblrwcl.obj \ - $(SLO)$/visiturl.obj - -SLOFILES = $(EXCEPTIONSFILES) \ - $(SLO)$/docstat.obj \ - $(SLO)$/sortopt.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index f5666ce73968..15aaccd7c9a1 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -88,9 +88,9 @@ using namespace com::sun::star; extern void ClrContourCache( const SdrObject *pObj ); // TxtFly.Cxx -inline BOOL GetRealURL( const SwGrfNode& rNd, String& rTxt ) +inline sal_Bool GetRealURL( const SwGrfNode& rNd, String& rTxt ) { - BOOL bRet = rNd.GetFileFilterNms( &rTxt, 0 ); + sal_Bool bRet = rNd.GetFileFilterNms( &rTxt, 0 ); if( bRet ) rTxt = URIHelper::removePassword( rTxt, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_UNAMBIGUOUS); @@ -99,7 +99,7 @@ inline BOOL GetRealURL( const SwGrfNode& rNd, String& rTxt ) void lcl_PaintReplacement( const SwRect &rRect, const String &rText, const ViewShell &rSh, const SwNoTxtFrm *pFrm, - BOOL bDefect ) + sal_Bool bDefect ) { static Font *pFont = 0; if ( !pFont ) @@ -110,7 +110,7 @@ void lcl_PaintReplacement( const SwRect &rRect, const String &rText, pFont->SetName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "Arial Unicode" ))); pFont->SetFamily( FAMILY_SWISS ); - pFont->SetTransparent( TRUE ); + pFont->SetTransparent( sal_True ); } Color aCol( COL_RED ); @@ -118,16 +118,16 @@ void lcl_PaintReplacement( const SwRect &rRect, const String &rText, const SwFmtURL &rURL = pFrm->FindFlyFrm()->GetFmt()->GetURL(); if( rURL.GetURL().Len() || rURL.GetMap() ) { - BOOL bVisited = FALSE; + sal_Bool bVisited = sal_False; if ( rURL.GetMap() ) { ImageMap *pMap = (ImageMap*)rURL.GetMap(); - for( USHORT i = 0; i < pMap->GetIMapObjectCount(); i++ ) + for( sal_uInt16 i = 0; i < pMap->GetIMapObjectCount(); i++ ) { IMapObject *pObj = pMap->GetIMapObject( i ); if( rSh.GetDoc()->IsVisitedURL( pObj->GetURL() ) ) { - bVisited = TRUE; + bVisited = sal_True; break; } } @@ -144,7 +144,7 @@ void lcl_PaintReplacement( const SwRect &rRect, const String &rText, pFont->SetUnderline( eUnderline ); pFont->SetColor( aCol ); - const BitmapEx& rBmp = ViewShell::GetReplacementBitmap( bDefect != FALSE ); + const BitmapEx& rBmp = ViewShell::GetReplacementBitmap( bDefect != sal_False ); Graphic::DrawEx( rSh.GetOut(), rText, *pFont, rBmp, rRect.Pos(), rRect.SSize() ); } @@ -221,15 +221,15 @@ void lcl_ClearArea( const SwFrm &rFrm, if ( aRegion.Count() ) { const SvxBrushItem *pItem; const Color *pCol; SwRect aOrigRect; - if ( rFrm.GetBackgroundBrush( pItem, pCol, aOrigRect, FALSE ) ) - for( USHORT i = 0; i < aRegion.Count(); ++i ) + if ( rFrm.GetBackgroundBrush( pItem, pCol, aOrigRect, sal_False ) ) + for( sal_uInt16 i = 0; i < aRegion.Count(); ++i ) ::DrawGraphic( pItem, &rOut, aOrigRect, aRegion[i] ); else { rOut.Push( PUSH_FILLCOLOR|PUSH_LINECOLOR ); rOut.SetFillColor( rFrm.GetShell()->Imp()->GetRetoucheColor()); rOut.SetLineColor(); - for( USHORT i = 0; i < aRegion.Count(); ++i ) + for( sal_uInt16 i = 0; i < aRegion.Count(); ++i ) rOut.DrawRect( aRegion[i].SVRect() ); rOut.Pop(); } @@ -242,7 +242,7 @@ void lcl_ClearArea( const SwFrm &rFrm, |* *************************************************************************/ -void SwNoTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ ) const +void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const { if ( Frm().IsEmpty() ) return; @@ -260,7 +260,7 @@ void SwNoTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ GetRealURL( *(SwGrfNode*)pNd, aTxt ); if( !aTxt.Len() ) aTxt = FindFlyFrm()->GetFmt()->GetName(); - lcl_PaintReplacement( Frm(), aTxt, *pSh, this, FALSE ); + lcl_PaintReplacement( Frm(), aTxt, *pSh, this, sal_False ); } return; } @@ -275,13 +275,13 @@ void SwNoTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ OutputDevice *pOut = pSh->GetOut(); pOut->Push(); - BOOL bClip = TRUE; + sal_Bool bClip = sal_True; PolyPolygon aPoly; SwNoTxtNode& rNoTNd = *(SwNoTxtNode*)GetNode(); SwGrfNode* pGrfNd = rNoTNd.GetGrfNode(); if( pGrfNd ) - pGrfNd->SetFrameInPaint( TRUE ); + pGrfNd->SetFrameInPaint( sal_True ); // #i13147# - add 2nd parameter with value <sal_True> to // method call <FindFlyFrm().GetContour(..)> to indicate that it is called @@ -292,7 +292,7 @@ void SwNoTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ ) { pOut->SetClipRegion( aPoly ); - bClip = FALSE; + bClip = sal_False; } SwRect aOrigPaint( rRect ); @@ -327,7 +327,7 @@ void SwNoTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ // wenn nicht sichtbar, loesche einfach den angegebenen Bereich lcl_ClearArea( *this, *pSh->GetOut(), aPaintArea, SwRect() ); if( pGrfNd ) - pGrfNd->SetFrameInPaint( FALSE ); + pGrfNd->SetFrameInPaint( sal_False ); pOut->Pop(); SfxProgress::LeaveLock(); @@ -336,7 +336,7 @@ void SwNoTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ /************************************************************************* |* |* void lcl_CalcRect( Point & aPt, Size & aDim, -|* USHORT nMirror ) +|* sal_uInt16 nMirror ) |* |* Beschreibung Errechne die Position und die Groesse der Grafik im |* Frame, entsprechen der aktuellen Grafik-Attribute @@ -348,7 +348,7 @@ void SwNoTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ *************************************************************************/ -void lcl_CalcRect( Point& rPt, Size& rDim, USHORT nMirror ) +void lcl_CalcRect( Point& rPt, Size& rDim, sal_uInt16 nMirror ) { if( nMirror == RES_MIRROR_GRAPH_VERT || nMirror == RES_MIRROR_GRAPH_BOTH ) { @@ -373,7 +373,7 @@ void lcl_CalcRect( Point& rPt, Size& rDim, USHORT nMirror ) *************************************************************************/ void SwNoTxtFrm::GetGrfArea( SwRect &rRect, SwRect* pOrigRect, - BOOL ) const + sal_Bool ) const { //currently only used for scaling, cropping and mirroring the contour of graphics! //all other is handled by the GraphicObject @@ -383,7 +383,7 @@ void SwNoTxtFrm::GetGrfArea( SwRect &rRect, SwRect* pOrigRect, const SwAttrSet& rAttrSet = GetNode()->GetSwAttrSet(); const SwCropGrf& rCrop = rAttrSet.GetCropGrf(); - USHORT nMirror = rAttrSet.GetMirrorGrf().GetValue(); + sal_uInt16 nMirror = rAttrSet.GetMirrorGrf().GetValue(); if( rAttrSet.GetMirrorGrf().IsGrfToggle() ) { @@ -530,7 +530,7 @@ void SwNoTxtFrm::MakeAll() MakePrtArea( rAttrs ); if ( !bValidSize ) - { bValidSize = TRUE; + { bValidSize = sal_True; Format(); } } @@ -566,11 +566,11 @@ void SwNoTxtFrm::Format( const SwBorderAttrs * ) |*************************************************************************/ -BOOL SwNoTxtFrm::GetCharRect( SwRect &rRect, const SwPosition& rPos, +sal_Bool SwNoTxtFrm::GetCharRect( SwRect &rRect, const SwPosition& rPos, SwCrsrMoveState *pCMS ) const { if ( &rPos.nNode.GetNode() != (SwNode*)GetNode() ) - return FALSE; + return sal_False; Calc(); SwRect aFrameRect( Frm() ); @@ -599,17 +599,17 @@ BOOL SwNoTxtFrm::GetCharRect( SwRect &rRect, const SwPosition& rPos, } } - return TRUE; + return sal_True; } -BOOL SwNoTxtFrm::GetCrsrOfst(SwPosition* pPos, Point& , +sal_Bool SwNoTxtFrm::GetCrsrOfst(SwPosition* pPos, Point& , SwCrsrMoveState* ) const { SwCntntNode* pCNd = (SwCntntNode*)GetNode(); pPos->nNode = *pCNd; pPos->nContent.Assign( pCNd, 0 ); - return TRUE; + return sal_True; } #define CLEARCACHE( pNd ) {\ @@ -624,7 +624,7 @@ BOOL SwNoTxtFrm::GetCrsrOfst(SwPosition* pPos, Point& , void SwNoTxtFrm::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) { - USHORT nWhich = pNew ? pNew->Which() : pOld ? pOld->Which() : 0; + sal_uInt16 nWhich = pNew ? pNew->Which() : pOld ? pOld->Which() : 0; // #i73788# // no <SwCntntFrm::Modify(..)> for RES_LINKED_GRAPHIC_STREAM_ARRIVED @@ -637,7 +637,7 @@ void SwNoTxtFrm::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) SwCntntFrm::Modify( pOld, pNew ); } - BOOL bComplete = TRUE; + sal_Bool bComplete = sal_True; switch( nWhich ) { @@ -647,7 +647,7 @@ void SwNoTxtFrm::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) case RES_GRF_REREAD_AND_INCACHE: if( ND_GRFNODE == GetNode()->GetNodeType() ) { - bComplete = FALSE; + bComplete = sal_False; SwGrfNode* pNd = (SwGrfNode*) GetNode(); ViewShell *pVSh = 0; @@ -683,10 +683,10 @@ void SwNoTxtFrm::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) case RES_ATTRSET_CHG: { - USHORT n; + sal_uInt16 n; for( n = RES_GRFATR_BEGIN; n < RES_GRFATR_END; ++n ) if( SFX_ITEM_SET == ((SwAttrSetChg*)pOld)->GetChgSet()-> - GetItemState( n, FALSE )) + GetItemState( n, sal_False )) { CLEARCACHE( (SwGrfNode*) GetNode() ) break; @@ -702,7 +702,7 @@ void SwNoTxtFrm::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) case RES_LINKED_GRAPHIC_STREAM_ARRIVED: if ( GetNode()->GetNodeType() == ND_GRFNODE ) { - bComplete = FALSE; + bComplete = sal_False; SwGrfNode* pNd = (SwGrfNode*) GetNode(); CLEARCACHE( pNd ) @@ -789,7 +789,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons SwGrfNode* pGrfNd = rNoTNd.GetGrfNode(); SwOLENode* pOLENd = rNoTNd.GetOLENode(); - const BOOL bPrn = pOut == rNoTNd.getIDocumentDeviceAccess()->getPrinter( false ) || + const sal_Bool bPrn = pOut == rNoTNd.getIDocumentDeviceAccess()->getPrinter( false ) || pOut->GetConnectMetaFile(); const bool bIsChart = pOLENd && ChartPrettyPainter::IsChart( pOLENd->GetOLEObj().GetObject() ); @@ -818,7 +818,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons if( pGrfNd ) { - BOOL bForceSwap = FALSE, bContinue = TRUE; + sal_Bool bForceSwap = sal_False, bContinue = sal_True; GraphicObject& rGrfObj = pGrfNd->GetGrfObj(); GraphicAttr aGrfAttr; @@ -853,8 +853,8 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons String aTxt( pGrfNd->GetTitle() ); if ( !aTxt.Len() ) GetRealURL( *pGrfNd, aTxt ); - ::lcl_PaintReplacement( aAlignedGrfArea, aTxt, *pShell, this, FALSE ); - bContinue = FALSE; + ::lcl_PaintReplacement( aAlignedGrfArea, aTxt, *pShell, this, sal_False ); + bContinue = sal_False; } else if( rGrfObj.IsCached( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), &aGrfAttr )) @@ -862,17 +862,17 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons rGrfObj.DrawWithPDFHandling( *pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), &aGrfAttr ); - bContinue = FALSE; + bContinue = sal_False; } } if( bContinue ) { - const BOOL bSwapped = rGrfObj.IsSwappedOut(); - const BOOL bSwappedIn = 0 != pGrfNd->SwapIn( bPrn ); + const sal_Bool bSwapped = rGrfObj.IsSwappedOut(); + const sal_Bool bSwappedIn = 0 != pGrfNd->SwapIn( bPrn ); if( bSwappedIn && rGrfObj.GetGraphic().IsSupportedGraphic()) { - const BOOL bAnimate = rGrfObj.IsAnimated() && + const sal_Bool bAnimate = rGrfObj.IsAnimated() && !pShell->IsPreView() && !pShell->GetAccessibilityOptions()->IsStopAnimatedGraphics() && // --> FME 2004-06-21 #i9684# Stop animation during printing/pdf export @@ -906,7 +906,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons } else { - USHORT nResId = 0; + sal_uInt16 nResId = 0; if( bSwappedIn ) { if( GRAPHIC_NONE == rGrfObj.GetType() ) @@ -925,12 +925,12 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons if ( nResId ) aText = SW_RESSTR( nResId ); - ::lcl_PaintReplacement( aAlignedGrfArea, aText, *pShell, this, TRUE ); + ::lcl_PaintReplacement( aAlignedGrfArea, aText, *pShell, this, sal_True ); } //Beim Drucken duerfen wir nicht die Grafiken sammeln... if( bSwapped && bPrn ) - bForceSwap = TRUE; + bForceSwap = sal_True; } if( bForceSwap ) pGrfNd->SwapOut(); @@ -948,11 +948,11 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons { // #i99665# // Adjust AntiAliasing mode at output device for chart OLE - const USHORT nFormerAntialiasingAtOutput( pOut->GetAntialiasing() ); + const sal_uInt16 nFormerAntialiasingAtOutput( pOut->GetAntialiasing() ); if ( pOLENd->IsChart() && pShell->Imp()->GetDrawView()->IsAntiAliasing() ) { - const USHORT nAntialiasingForChartOLE = + const sal_uInt16 nAntialiasingForChartOLE = nFormerAntialiasingAtOutput | ANTIALIASING_PIXELSNAPHAIRLINE; pOut->SetAntialiasing( nAntialiasingForChartOLE ); } @@ -964,7 +964,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons // Im BrowseModus gibt es nicht unbedingt einen Drucker und // damit kein JobSetup, also legen wir eines an ... const JobSetup* pJobSetup = pOLENd->getIDocumentDeviceAccess()->getJobsetup(); - BOOL bDummyJobSetup = 0 == pJobSetup; + sal_Bool bDummyJobSetup = 0 == pJobSetup; if( bDummyJobSetup ) pJobSetup = new JobSetup(); @@ -1011,18 +1011,18 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons } -BOOL SwNoTxtFrm::IsTransparent() const +sal_Bool SwNoTxtFrm::IsTransparent() const { const ViewShell* pSh = GetShell(); if ( !pSh || !pSh->GetViewOptions()->IsGraphic() ) - return TRUE; + return sal_True; const SwGrfNode *pNd; if( 0 != (pNd = GetNode()->GetGrfNode()) ) return pNd->IsTransparent(); //#29381# OLE sind immer Transparent. - return TRUE; + return sal_True; } @@ -1035,7 +1035,7 @@ void SwNoTxtFrm::StopAnimation( OutputDevice* pOut ) const } -BOOL SwNoTxtFrm::HasAnimation() const +sal_Bool SwNoTxtFrm::HasAnimation() const { const SwGrfNode* pGrfNd = GetNode()->GetGrfNode(); return pGrfNd && pGrfNd->IsAnimated(); diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 0f76481194dc..1f6a31036de8 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -66,7 +66,7 @@ using namespace ::com::sun::star; -USHORT SwNumRule::nRefCount = 0; +sal_uInt16 SwNumRule::nRefCount = 0; SwNumFmt* SwNumRule::aBaseFmts[ RULE_END ][ MAXLEVEL ] = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; @@ -76,13 +76,13 @@ SwNumFmt* SwNumRule::aLabelAlignmentBaseFmts[ RULE_END ][ MAXLEVEL ] = { char sOutline[] = "Outline"; char* SwNumRule::pDefOutlineName = sOutline; -USHORT SwNumRule::aDefNumIndents[ MAXLEVEL ] = { +sal_uInt16 SwNumRule::aDefNumIndents[ MAXLEVEL ] = { //inch: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0 1440/4, 1440/2, 1440*3/4, 1440, 1440*5/4, 1440*3/2, 1440*7/4, 1440*2, 1440*9/4, 1440*5/2 }; -const SwNumFmt& SwNumRule::Get( USHORT i ) const +const SwNumFmt& SwNumRule::Get( sal_uInt16 i ) const { OSL_ASSERT( i < MAXLEVEL && eRuleType < RULE_END ); return aFmts[ i ] @@ -92,7 +92,7 @@ const SwNumFmt& SwNumRule::Get( USHORT i ) const : *aLabelAlignmentBaseFmts[ eRuleType ][ i ] ); } -const SwNumFmt* SwNumRule::GetNumFmt( USHORT i ) const +const SwNumFmt* SwNumRule::GetNumFmt( sal_uInt16 i ) const { const SwNumFmt * pResult = NULL; @@ -170,21 +170,19 @@ void SwNumRule::SetNumRuleMap(boost::unordered_map<String, SwNumRule *, StringHa pNumRuleMap = _pNumRuleMap; } - -USHORT SwNumRule::GetNumIndent( BYTE nLvl ) +sal_uInt16 SwNumRule::GetNumIndent( sal_uInt8 nLvl ) { OSL_ENSURE( MAXLEVEL > nLvl, "NumLevel is out of range" ); return aDefNumIndents[ nLvl ]; } - -USHORT SwNumRule::GetBullIndent( BYTE nLvl ) +sal_uInt16 SwNumRule::GetBullIndent( sal_uInt8 nLvl ) { OSL_ENSURE( MAXLEVEL > nLvl, "NumLevel is out of range" ); return aDefNumIndents[ nLvl ]; } -static void lcl_SetRuleChgd( SwTxtNode& rNd, BYTE nLevel ) +static void lcl_SetRuleChgd( SwTxtNode& rNd, sal_uInt8 nLevel ) { if( rNd.GetActualListLevel() == nLevel ) rNd.NumRuleChgd(); @@ -220,7 +218,7 @@ SwNumFmt::SwNumFmt(const SvxNumberFormat& rNumFmt, SwDoc* pDoc) : SwCharFmt* pCFmt = pDoc->FindCharFmtByName( rCharStyleName ); if( !pCFmt ) { - USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName( rCharStyleName, + sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rCharStyleName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ); pCFmt = nId != USHRT_MAX ? pDoc->GetCharFmtFromPool( nId ) @@ -245,7 +243,7 @@ void SwNumFmt::NotifyGraphicArrived() } // #i22362# -BOOL SwNumFmt::IsEnumeration() const +sal_Bool SwNumFmt::IsEnumeration() const { // --> FME 2004-08-12 #i30655# native numbering did not work any longer // using this code. Therefore HBRINKM and I agreed upon defining @@ -254,20 +252,20 @@ BOOL SwNumFmt::IsEnumeration() const } -BOOL SwNumFmt::IsItemize() const +sal_Bool SwNumFmt::IsItemize() const { - BOOL bResult; + sal_Bool bResult; switch(GetNumberingType()) { case SVX_NUM_CHAR_SPECIAL: case SVX_NUM_BITMAP: - bResult = TRUE; + bResult = sal_True; break; default: - bResult = FALSE; + bResult = sal_False; } return bResult; @@ -284,9 +282,9 @@ SwNumFmt& SwNumFmt::operator=( const SwNumFmt& rNumFmt) return *this; } -BOOL SwNumFmt::operator==( const SwNumFmt& rNumFmt) const +sal_Bool SwNumFmt::operator==( const SwNumFmt& rNumFmt) const { - BOOL bRet = SvxNumberFormat::operator==(rNumFmt) && + sal_Bool bRet = SvxNumberFormat::operator==(rNumFmt) && pRegisteredIn == rNumFmt.pRegisteredIn; return bRet; } @@ -351,13 +349,13 @@ sal_Int16 SwNumFmt::GetVertOrient() const void SwNumFmt::UpdateNumNodes( SwDoc* pDoc ) { - BOOL bDocIsModified = pDoc->IsModified(); - BOOL bFnd = FALSE; + sal_Bool bDocIsModified = pDoc->IsModified(); + sal_Bool bFnd = sal_False; const SwNumRule* pRule; - for( USHORT n = pDoc->GetNumRuleTbl().Count(); !bFnd && n; ) + for( sal_uInt16 n = pDoc->GetNumRuleTbl().Count(); !bFnd && n; ) { pRule = pDoc->GetNumRuleTbl()[ --n ]; - for( BYTE i = 0; i < MAXLEVEL; ++i ) + for( sal_uInt8 i = 0; i < MAXLEVEL; ++i ) if( pRule->GetNumFmt( i ) == this ) { SwNumRule::tTxtNodeList aTxtNodeList; @@ -368,7 +366,7 @@ void SwNumFmt::UpdateNumNodes( SwDoc* pDoc ) lcl_SetRuleChgd( *(*aIter), i ); } // <-- - bFnd = TRUE; + bFnd = sal_True; break; } } @@ -397,7 +395,7 @@ long int SwNumRule::nInstances = 0; SwNumRule::SwNumRule( const String& rNm, const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode, SwNumRuleType eType, - BOOL bAutoFlg ) + sal_Bool bAutoFlg ) : maTxtNodeList(), maParagraphStyleList(), pNumRuleMap(0), @@ -407,9 +405,9 @@ SwNumRule::SwNumRule( const String& rNm, nPoolHelpId( USHRT_MAX ), nPoolHlpFileId( UCHAR_MAX ), bAutoRuleFlag( bAutoFlg ), - bInvalidRuleFlag( TRUE ), - bContinusNum( FALSE ), - bAbsSpaces( FALSE ), + bInvalidRuleFlag( sal_True ), + bContinusNum( sal_False ), + bAbsSpaces( sal_False ), mbCountPhantoms( true ), meDefaultNumberFormatPositionAndSpaceMode( eDefaultNumberFormatPositionAndSpaceMode ), msDefaultListId() @@ -421,7 +419,7 @@ SwNumRule::SwNumRule( const String& rNm, if( !nRefCount++ ) // zum erstmal, also initialisiern { SwNumFmt* pFmt; - BYTE n; + sal_uInt8 n; // numbering: // position-and-space mode LABEL_WIDTH_AND_POSITION: @@ -509,7 +507,7 @@ SwNumRule::SwNumRule( const SwNumRule& rNumRule ) nPoolHelpId( rNumRule.GetPoolHelpId() ), nPoolHlpFileId( rNumRule.GetPoolHlpFileId() ), bAutoRuleFlag( rNumRule.bAutoRuleFlag ), - bInvalidRuleFlag( TRUE ), + bInvalidRuleFlag( sal_True ), bContinusNum( rNumRule.bContinusNum ), bAbsSpaces( rNumRule.bAbsSpaces ), mbCountPhantoms( true ), @@ -522,14 +520,14 @@ SwNumRule::SwNumRule( const SwNumRule& rNumRule ) ++nRefCount; memset( aFmts, 0, sizeof( aFmts )); - for( USHORT n = 0; n < MAXLEVEL; ++n ) + for( sal_uInt16 n = 0; n < MAXLEVEL; ++n ) if( rNumRule.aFmts[ n ] ) Set( n, *rNumRule.aFmts[ n ] ); } SwNumRule::~SwNumRule() { - for( USHORT n = 0; n < MAXLEVEL; ++n ) + for( sal_uInt16 n = 0; n < MAXLEVEL; ++n ) delete aFmts[ n ]; if (pNumRuleMap) @@ -564,7 +562,7 @@ SwNumRule::~SwNumRule() void SwNumRule::CheckCharFmts( SwDoc* pDoc ) { SwCharFmt* pFmt; - for( BYTE n = 0; n < MAXLEVEL; ++n ) + for( sal_uInt8 n = 0; n < MAXLEVEL; ++n ) if( aFmts[ n ] && 0 != ( pFmt = aFmts[ n ]->GetCharFmt() ) && pFmt->GetDoc() != pDoc ) { @@ -580,13 +578,13 @@ SwNumRule& SwNumRule::operator=( const SwNumRule& rNumRule ) { if( this != &rNumRule ) { - for( USHORT n = 0; n < MAXLEVEL; ++n ) + for( sal_uInt16 n = 0; n < MAXLEVEL; ++n ) Set( n, rNumRule.aFmts[ n ] ); eRuleType = rNumRule.eRuleType; sName = rNumRule.sName; bAutoRuleFlag = rNumRule.bAutoRuleFlag; - bInvalidRuleFlag = TRUE; + bInvalidRuleFlag = sal_True; bContinusNum = rNumRule.bContinusNum; bAbsSpaces = rNumRule.bAbsSpaces; nPoolFmtId = rNumRule.GetPoolFmtId(); @@ -596,9 +594,9 @@ SwNumRule& SwNumRule::operator=( const SwNumRule& rNumRule ) return *this; } -BOOL SwNumRule::operator==( const SwNumRule& rRule ) const +sal_Bool SwNumRule::operator==( const SwNumRule& rRule ) const { - BOOL bRet = eRuleType == rRule.eRuleType && + sal_Bool bRet = eRuleType == rRule.eRuleType && sName == rRule.sName && bAutoRuleFlag == rRule.bAutoRuleFlag && bContinusNum == rRule.bContinusNum && @@ -608,17 +606,17 @@ BOOL SwNumRule::operator==( const SwNumRule& rRule ) const nPoolHlpFileId == rRule.GetPoolHlpFileId(); if( bRet ) { - for( BYTE n = 0; n < MAXLEVEL; ++n ) + for( sal_uInt8 n = 0; n < MAXLEVEL; ++n ) if( !( rRule.Get( n ) == Get( n ) )) { - bRet = FALSE; + bRet = sal_False; break; } } return bRet; } -void SwNumRule::Set( USHORT i, const SwNumFmt& rNumFmt ) +void SwNumRule::Set( sal_uInt16 i, const SwNumFmt& rNumFmt ) { OSL_ENSURE( i < MAXLEVEL, "Serious defect, please inform OD" ); if( i < MAXLEVEL ) @@ -627,12 +625,12 @@ void SwNumRule::Set( USHORT i, const SwNumFmt& rNumFmt ) { delete aFmts[ i ]; aFmts[ i ] = new SwNumFmt( rNumFmt ); - bInvalidRuleFlag = TRUE; + bInvalidRuleFlag = sal_True; } } } -void SwNumRule::Set( USHORT i, const SwNumFmt* pNumFmt ) +void SwNumRule::Set( sal_uInt16 i, const SwNumFmt* pNumFmt ) { OSL_ENSURE( i < MAXLEVEL, "Serious defect, please inform OD" ); if( i >= MAXLEVEL ) @@ -643,17 +641,17 @@ void SwNumRule::Set( USHORT i, const SwNumFmt* pNumFmt ) if( pNumFmt ) { aFmts[ i ] = new SwNumFmt( *pNumFmt ); - bInvalidRuleFlag = TRUE; + bInvalidRuleFlag = sal_True; } } else if( !pNumFmt ) - delete pOld, aFmts[ i ] = 0, bInvalidRuleFlag = TRUE; + delete pOld, aFmts[ i ] = 0, bInvalidRuleFlag = sal_True; else if( *pOld != *pNumFmt ) - *pOld = *pNumFmt, bInvalidRuleFlag = TRUE; + *pOld = *pNumFmt, bInvalidRuleFlag = sal_True; } -String SwNumRule::MakeNumString( const SwNodeNum& rNum, BOOL bInclStrings, - BOOL bOnlyArabic ) const +String SwNumRule::MakeNumString( const SwNodeNum& rNum, sal_Bool bInclStrings, + sal_Bool bOnlyArabic ) const { String aStr; @@ -665,8 +663,8 @@ String SwNumRule::MakeNumString( const SwNodeNum& rNum, BOOL bInclStrings, } String SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVector, - const BOOL bInclStrings, - const BOOL bOnlyArabic, + const sal_Bool bInclStrings, + const sal_Bool bOnlyArabic, const unsigned int _nRestrictToThisLevel ) const { String aStr; @@ -680,17 +678,17 @@ String SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVector, if (nLevel < MAXLEVEL) { - const SwNumFmt& rMyNFmt = Get( static_cast<USHORT>(nLevel) ); + const SwNumFmt& rMyNFmt = Get( static_cast<sal_uInt16>(nLevel) ); { - BYTE i = static_cast<BYTE>(nLevel); + sal_uInt8 i = static_cast<sal_uInt8>(nLevel); if( !IsContinusNum() && // - do not include upper levels, if level isn't numbered. rMyNFmt.GetNumberingType() != SVX_NUM_NUMBER_NONE && rMyNFmt.GetIncludeUpperLevels() ) // nur der eigene Level ? { - BYTE n = rMyNFmt.GetIncludeUpperLevels(); + sal_uInt8 n = rMyNFmt.GetIncludeUpperLevels(); if( 1 < n ) { if( i+1 >= n ) @@ -754,7 +752,7 @@ String SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum, bool bMakeNumStringForPhantom( false ); if ( pWorkingNodeNum->IsPhantom() ) { - SwNumFmt aFmt( Get( static_cast<USHORT>(pWorkingNodeNum->GetLevelInListTree()) ) ); + SwNumFmt aFmt( Get( static_cast<sal_uInt16>(pWorkingNodeNum->GetLevelInListTree()) ) ); bMakeNumStringForPhantom = aFmt.IsEnumeration() && SVX_NUM_NUMBER_NONE != aFmt.GetNumberingType(); @@ -773,7 +771,7 @@ String SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum, if ( bInclSuperiorNumLabels && pWorkingNodeNum->GetLevelInListTree() > 0 ) { - BYTE n = Get( static_cast<USHORT>(pWorkingNodeNum->GetLevelInListTree()) ).GetIncludeUpperLevels(); + sal_uInt8 n = Get( static_cast<sal_uInt16>(pWorkingNodeNum->GetLevelInListTree()) ).GetIncludeUpperLevels(); pWorkingNodeNum = dynamic_cast<SwNodeNum*>(pWorkingNodeNum->GetParent()); // skip parents, whose list label is already contained in the actual list label. while ( pWorkingNodeNum && n > 1 ) @@ -801,7 +799,7 @@ String SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum, // (Kopiert die NumFormate und returnt sich selbst) SwNumRule& SwNumRule::CopyNumRule( SwDoc* pDoc, const SwNumRule& rNumRule ) { - for( USHORT n = 0; n < MAXLEVEL; ++n ) + for( sal_uInt16 n = 0; n < MAXLEVEL; ++n ) { Set( n, rNumRule.aFmts[ n ] ); if( aFmts[ n ] && aFmts[ n ]->GetCharFmt() && @@ -818,20 +816,20 @@ SwNumRule& SwNumRule::CopyNumRule( SwDoc* pDoc, const SwNumRule& rNumRule ) nPoolFmtId = rNumRule.GetPoolFmtId(); nPoolHelpId = rNumRule.GetPoolHelpId(); nPoolHlpFileId = rNumRule.GetPoolHlpFileId(); - bInvalidRuleFlag = TRUE; + bInvalidRuleFlag = sal_True; return *this; } void SwNumRule::SetSvxRule(const SvxNumRule& rNumRule, SwDoc* pDoc) { - for( USHORT n = 0; n < MAXLEVEL; ++n ) + for( sal_uInt16 n = 0; n < MAXLEVEL; ++n ) { const SvxNumberFormat* pSvxFmt = rNumRule.Get(n); delete aFmts[n]; aFmts[n] = pSvxFmt ? new SwNumFmt(*pSvxFmt, pDoc) : 0; } - bInvalidRuleFlag = TRUE; + bInvalidRuleFlag = sal_True; bContinusNum = rNumRule.IsContinuousNumbering(); } @@ -844,7 +842,7 @@ SvxNumRule SwNumRule::MakeSvxNumRule() const NUM_RULE ? SVX_RULETYPE_NUMBERING : SVX_RULETYPE_OUTLINE_NUMBERING ); - for( USHORT n = 0; n < MAXLEVEL; ++n ) + for( sal_uInt16 n = 0; n < MAXLEVEL; ++n ) { SwNumFmt aNumFmt = Get(n); if(aNumFmt.GetCharFmt()) @@ -854,8 +852,7 @@ SvxNumRule SwNumRule::MakeSvxNumRule() const return aRule; } - -void SwNumRule::SetInvalidRule(BOOL bFlag) +void SwNumRule::SetInvalidRule(sal_Bool bFlag) { if (bFlag) { @@ -885,7 +882,7 @@ void SwNumRule::SetInvalidRule(BOOL bFlag) // change indent of all list levels by given difference void SwNumRule::ChangeIndent( const short nDiff ) { - for ( USHORT i = 0; i < MAXLEVEL; ++i ) + for ( sal_uInt16 i = 0; i < MAXLEVEL; ++i ) { SwNumFmt aTmpNumFmt( Get(i) ); @@ -918,12 +915,12 @@ void SwNumRule::ChangeIndent( const short nDiff ) Set( i, aTmpNumFmt ); } - SetInvalidRule( TRUE ); + SetInvalidRule( sal_True ); } // set indent of certain list level to given value void SwNumRule::SetIndent( const short nNewIndent, - const USHORT nListLevel ) + const sal_uInt16 nListLevel ) { SwNumFmt aTmpNumFmt( Get(nListLevel) ); @@ -946,7 +943,7 @@ void SwNumRule::SetIndent( const short nNewIndent, aTmpNumFmt.SetIndentAt( nNewIndent ); } - SetInvalidRule( TRUE ); + SetInvalidRule( sal_True ); } // set indent of first list level to given value and change other list level's @@ -989,7 +986,7 @@ void SwNumRule::Validate() std::mem_fun( &SwList::ValidateListTree ) ); - SetInvalidRule(FALSE); + SetInvalidRule(sal_False); } @@ -1078,8 +1075,7 @@ namespace numfunc { return static_cast<short>(meFontItalic); } - - inline sal_Unicode GetChar( BYTE p_nListLevel ) const + inline sal_Unicode GetChar( sal_uInt8 p_nListLevel ) const { if ( p_nListLevel > MAXLEVEL ) { @@ -1290,7 +1286,7 @@ namespace numfunc return SwDefBulletConfig::getInstance()->GetFont(); } - sal_Unicode GetBulletChar( BYTE nLevel ) + sal_Unicode GetBulletChar( sal_uInt8 nLevel ) { return SwDefBulletConfig::getInstance()->GetChar( nLevel ); } diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx index e5edcbb15252..7f822c8c6afd 100644 --- a/sw/source/core/doc/poolfmt.cxx +++ b/sw/source/core/doc/poolfmt.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <i18npool/mslangid.hxx> #include <unotools/localedatawrapper.hxx> @@ -55,6 +56,7 @@ #include <editeng/scriptspaceitem.hxx> #include <viewopt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <fmtanchr.hxx> #include <fmtornt.hxx> #include <fmtsrnd.hxx> @@ -75,27 +77,27 @@ using namespace ::com::sun::star; -const USHORT PT_3 = 3 * 20; // 3 pt -const USHORT PT_6 = 6 * 20; // 6 pt -const USHORT PT_7 = 7 * 20; // 6 pt -const USHORT PT_8 = 8 * 20; // 8 pt -const USHORT PT_9 = 9 * 20; // 9 pt -const USHORT PT_10 = 10 * 20; // 10 pt -const USHORT PT_11 = 11 * 20; // 11 pt -const USHORT PT_12 = 12 * 20; // 12 pt -const USHORT PT_14 = 14 * 20; // 14 pt -const USHORT PT_16 = 16 * 20; // 16 pt -const USHORT PT_18 = 18 * 20; // 18 pt -const USHORT PT_22 = 22 * 20; // 22 pt -const USHORT PT_24 = 24 * 20; // 22 pt - - -//const USHORT HTML_PARSPACE = ((CM_05 * 7) / 10); +const sal_uInt16 PT_3 = 3 * 20; // 3 pt +const sal_uInt16 PT_6 = 6 * 20; // 6 pt +const sal_uInt16 PT_7 = 7 * 20; // 6 pt +const sal_uInt16 PT_8 = 8 * 20; // 8 pt +const sal_uInt16 PT_9 = 9 * 20; // 9 pt +const sal_uInt16 PT_10 = 10 * 20; // 10 pt +const sal_uInt16 PT_11 = 11 * 20; // 11 pt +const sal_uInt16 PT_12 = 12 * 20; // 12 pt +const sal_uInt16 PT_14 = 14 * 20; // 14 pt +const sal_uInt16 PT_16 = 16 * 20; // 16 pt +const sal_uInt16 PT_18 = 18 * 20; // 18 pt +const sal_uInt16 PT_22 = 22 * 20; // 22 pt +const sal_uInt16 PT_24 = 24 * 20; // 22 pt + + +//const sal_uInt16 HTML_PARSPACE = ((CM_05 * 7) / 10); #define HTML_PARSPACE GetMetricVal( CM_05 ) static const sal_Char sKomma[] = ", "; -static const USHORT aHeadlineSizes[ 2 * MAXLEVEL ] = { +static const sal_uInt16 aHeadlineSizes[ 2 * MAXLEVEL ] = { // PT_16, PT_14, PT_14, PT_12, PT_12, // normal //JP 10.12.96: jetzt soll alles prozentual sein: 115, 100, 100, 85, 85, @@ -121,7 +123,7 @@ long lcl_GetRightMargin( SwDoc& rDoc ) void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem ) { rSet.Put( rItem ); - USHORT nWhCJK = 0, nWhCTL = 0; + sal_uInt16 nWhCJK = 0, nWhCTL = 0; switch( rItem.Which() ) { case RES_CHRATR_FONTSIZE: @@ -147,19 +149,19 @@ void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem ) rSet.Put( rItem, nWhCTL ); } -void lcl_SetDfltFont( USHORT nFntType, SfxItemSet& rSet ) +void lcl_SetDfltFont( sal_uInt16 nFntType, SfxItemSet& rSet ) { static struct { - USHORT nResLngId; - USHORT nResFntId; + sal_uInt16 nResLngId; + sal_uInt16 nResFntId; } aArr[ 3 ] = { { RES_CHRATR_LANGUAGE, RES_CHRATR_FONT }, { RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT }, { RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT } }; - for( USHORT n = 0; n < 3; ++n ) + for( sal_uInt16 n = 0; n < 3; ++n ) { - USHORT nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem( + sal_uInt16 nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem( aArr[n].nResLngId )).GetLanguage(); Font aFnt( OutputDevice::GetDefaultFont( nFntType, nLng, DEFAULTFONT_FLAGS_ONLYONE ) ); @@ -170,13 +172,13 @@ void lcl_SetDfltFont( USHORT nFntType, SfxItemSet& rSet ) } } -void lcl_SetDfltFont( USHORT nLatinFntType, USHORT nCJKFntType, - USHORT nCTLFntType, SfxItemSet& rSet ) +void lcl_SetDfltFont( sal_uInt16 nLatinFntType, sal_uInt16 nCJKFntType, + sal_uInt16 nCTLFntType, SfxItemSet& rSet ) { static struct { - USHORT nResLngId; - USHORT nResFntId; - USHORT nFntType; + sal_uInt16 nResLngId; + sal_uInt16 nResFntId; + sal_uInt16 nFntType; } aArr[ 3 ] = { { RES_CHRATR_LANGUAGE, RES_CHRATR_FONT, 0 }, { RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT, 0 }, @@ -186,9 +188,9 @@ void lcl_SetDfltFont( USHORT nLatinFntType, USHORT nCJKFntType, aArr[1].nFntType = nCJKFntType; aArr[2].nFntType = nCTLFntType; - for( USHORT n = 0; n < 3; ++n ) + for( sal_uInt16 n = 0; n < 3; ++n ) { - USHORT nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem( + sal_uInt16 nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem( aArr[n].nResLngId )).GetLanguage(); Font aFnt( OutputDevice::GetDefaultFont( aArr[n].nFntType, nLng, DEFAULTFONT_FLAGS_ONLYONE ) ); @@ -201,7 +203,7 @@ void lcl_SetDfltFont( USHORT nLatinFntType, USHORT nCJKFntType, void lcl_SetHeadline( SwDoc* pDoc, SwTxtFmtColl* pColl, SfxItemSet& rSet, - USHORT nOutLvlBits, BYTE nLevel, BOOL bItalic ) + sal_uInt16 nOutLvlBits, sal_uInt8 nLevel, sal_Bool bItalic ) { SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) ); SvxFontHeightItem aHItem(240, 100, RES_CHRATR_FONTSIZE); @@ -260,11 +262,11 @@ void lcl_SetHeadline( SwDoc* pDoc, SwTxtFmtColl* pColl, -void lcl_SetRegister( SwDoc* pDoc, SfxItemSet& rSet, USHORT nFact, - BOOL bHeader, BOOL bTab ) +void lcl_SetRegister( SwDoc* pDoc, SfxItemSet& rSet, sal_uInt16 nFact, + sal_Bool bHeader, sal_Bool bTab ) { SvxLRSpaceItem aLR( RES_LR_SPACE ); - USHORT nLeft = nFact ? GetMetricVal( CM_05 ) * nFact : 0; + sal_uInt16 nLeft = nFact ? GetMetricVal( CM_05 ) * nFact : 0; aLR.SetTxtLeft( nLeft ); rSet.Put( aLR ); @@ -288,13 +290,13 @@ void lcl_SetRegister( SwDoc* pDoc, SfxItemSet& rSet, USHORT nFact, void lcl_SetNumBul( SwDoc* pDoc, SwTxtFmtColl* pColl, SfxItemSet& rSet, - USHORT nNxt, SwTwips nEZ, SwTwips nLeft, + sal_uInt16 nNxt, SwTwips nEZ, SwTwips nLeft, SwTwips nUpper, SwTwips nLower ) { SvxLRSpaceItem aLR( RES_LR_SPACE ); SvxULSpaceItem aUL( RES_UL_SPACE ); - aLR.SetTxtFirstLineOfst( USHORT(nEZ) ); aLR.SetTxtLeft( USHORT(nLeft) ); - aUL.SetUpper( USHORT(nUpper) ); aUL.SetLower( USHORT(nLower) ); + aLR.SetTxtFirstLineOfst( sal_uInt16(nEZ) ); aLR.SetTxtLeft( sal_uInt16(nLeft) ); + aUL.SetUpper( sal_uInt16(nUpper) ); aUL.SetLower( sal_uInt16(nLower) ); rSet.Put( aLR ); rSet.Put( aUL ); @@ -309,14 +311,14 @@ void lcl_SetNumBul( SwDoc* pDoc, SwTxtFmtColl* pColl, // Ist der String-Pointer definiert, dann erfrage nur die // Beschreibung der Attribute, !! es legt keine Vorlage an !! -SvxFrameDirection GetDefaultFrameDirection(ULONG nLanguage) +SvxFrameDirection GetDefaultFrameDirection(sal_uLong nLanguage) { SvxFrameDirection eResult = (MsLangId::isRightToLeft( static_cast<LanguageType>(nLanguage)) ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP); return eResult; } -SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) +SwTxtFmtColl* SwDoc::GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage ) { OSL_ENSURE( (RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) || @@ -328,8 +330,8 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) "Falsche AutoFormat-Id" ); SwTxtFmtColl* pNewColl; - USHORT nOutLvlBits = 0; - for( USHORT n = 0; n < pTxtFmtCollTbl->Count(); ++n ) + sal_uInt16 nOutLvlBits = 0; + for( sal_uInt16 n = 0; n < pTxtFmtCollTbl->Count(); ++n ) { if( nId == ( pNewColl = (*pTxtFmtCollTbl)[ n ] )->GetPoolFmtId() ) { @@ -341,7 +343,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) } // bis hierher nicht gefunden -> neu anlegen - USHORT nResId = 0; + sal_uInt16 nResId = 0; if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END ) nResId = RC_POOLCOLL_TEXT_BEGIN - RES_POOLCOLL_TEXT_BEGIN; else if (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) @@ -364,7 +366,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) // ein Set fuer alle zusetzenden Attribute SwAttrSet aSet( GetAttrPool(), aTxtFmtCollSetRange ); - USHORT nParent = GetPoolParent( nId ); + sal_uInt16 nParent = GetPoolParent( nId ); { @@ -389,7 +391,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) /* koreans do not like SvxScriptItem(TRUE) */ if (bRegardLanguage) { - ULONG nAppLanguage = GetAppLanguage(); + sal_uLong nAppLanguage = GetAppLanguage(); if (GetDefaultFrameDirection(nAppLanguage) == FRMDIR_HORI_RIGHT_TOP) { @@ -398,7 +400,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) } if (nAppLanguage == LANGUAGE_KOREAN) { - SvxScriptSpaceItem aScriptSpace(FALSE, RES_PARATR_SCRIPTSPACE); + SvxScriptSpaceItem aScriptSpace(sal_False, RES_PARATR_SCRIPTSPACE); aSet.Put(aScriptSpace); } } @@ -459,7 +461,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) case RES_POOLCOLL_HEADLINE_BASE: // Basis Ueberschrift { - static const USHORT aFntInit[] = { + static const sal_uInt16 aFntInit[] = { DEFAULTFONT_LATIN_HEADING, RES_CHRATR_FONT, RES_CHRATR_LANGUAGE, LANGUAGE_ENGLISH_US, DEFAULTFONT_CJK_HEADING, RES_CHRATR_CJK_FONT, @@ -469,9 +471,9 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) 0 }; - for( const USHORT* pArr = aFntInit; *pArr; pArr += 4 ) + for( const sal_uInt16* pArr = aFntInit; *pArr; pArr += 4 ) { - USHORT nLng = ((SvxLanguageItem&)GetDefault( *(pArr+2) )).GetLanguage(); + sal_uInt16 nLng = ((SvxLanguageItem&)GetDefault( *(pArr+2) )).GetLanguage(); if( LANGUAGE_DONTKNOW == nLng ) nLng = *(pArr+3); @@ -487,7 +489,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) SvxULSpaceItem aUL( PT_12, PT_6, RES_UL_SPACE ); if( get(IDocumentSettingAccess::HTML_MODE) ) aUL.SetLower( HTML_PARSPACE ); - aSet.Put( SvxFmtKeepItem( TRUE, RES_KEEP )); + aSet.Put( SvxFmtKeepItem( sal_True, RES_KEEP )); pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool( RES_POOLCOLL_TEXT )); @@ -504,40 +506,40 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) case RES_POOLCOLL_SIGNATURE: // Unterschrift case RES_POOLCOLL_TABLE: // Tabelle-Inhalt { - SwFmtLineNumber aLN; aLN.SetCountLines( FALSE ); + SwFmtLineNumber aLN; aLN.SetCountLines( sal_False ); aSet.Put( aLN ); } break; case RES_POOLCOLL_HEADLINE1: // Ueberschrift 1 - lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 0, FALSE ); + lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 0, sal_False ); break; case RES_POOLCOLL_HEADLINE2: // Ueberschrift 2 - lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 1, TRUE ); + lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 1, sal_True ); break; case RES_POOLCOLL_HEADLINE3: // Ueberschrift 3 - lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 2, FALSE ); + lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 2, sal_False ); break; case RES_POOLCOLL_HEADLINE4: // Ueberschrift 4 - lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 3, TRUE ); + lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 3, sal_True ); break; case RES_POOLCOLL_HEADLINE5: // Ueberschrift 5 - lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 4, FALSE ); + lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 4, sal_False ); break; case RES_POOLCOLL_HEADLINE6: // Ueberschrift 6 - lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 5, FALSE ); + lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 5, sal_False ); break; case RES_POOLCOLL_HEADLINE7: // Ueberschrift 7 - lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 6, FALSE ); + lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 6, sal_False ); break; case RES_POOLCOLL_HEADLINE8: // Ueberschrift 8 - lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 7, FALSE ); + lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 7, sal_False ); break; case RES_POOLCOLL_HEADLINE9: // Ueberschrift 9 - lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 8, FALSE ); + lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 8, sal_False ); break; case RES_POOLCOLL_HEADLINE10: // Ueberschrift 10 - lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 9, FALSE ); + lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 9, sal_False ); break; @@ -551,7 +553,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) case RES_POOLCOLL_FOOTERL: case RES_POOLCOLL_FOOTERR: { - SwFmtLineNumber aLN; aLN.SetCountLines( FALSE ); + SwFmtLineNumber aLN; aLN.SetCountLines( sal_False ); aSet.Put( aLN ); long nRightMargin = lcl_GetRightMargin( *this ); @@ -568,7 +570,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) { SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) ); aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) ); - SwFmtLineNumber aLN; aLN.SetCountLines( FALSE ); + SwFmtLineNumber aLN; aLN.SetCountLines( sal_False ); aSet.Put( aLN ); } break; @@ -581,7 +583,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) aLR.SetTxtLeft( GetMetricVal( CM_05 )); SetAllScriptItem( aSet, SvxFontHeightItem( PT_10, 100, RES_CHRATR_FONTSIZE ) ); aSet.Put( aLR ); - SwFmtLineNumber aLN; aLN.SetCountLines( FALSE ); + SwFmtLineNumber aLN; aLN.SetCountLines( sal_False ); aSet.Put( aLN ); } break; @@ -592,7 +594,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) aSet.Put( aUL ); SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ) ); SetAllScriptItem( aSet, SvxFontHeightItem( PT_10, 100, RES_CHRATR_FONTSIZE ) ); - SwFmtLineNumber aLN; aLN.SetCountLines( FALSE ); + SwFmtLineNumber aLN; aLN.SetCountLines( sal_False ); aSet.Put( aLN ); } break; @@ -608,7 +610,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) { SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetLower( PT_3 ); aSet.Put( aUL ); - SwFmtLineNumber aLN; aLN.SetCountLines( FALSE ); + SwFmtLineNumber aLN; aLN.SetCountLines( sal_False ); aSet.Put( aLN ); } break; @@ -622,117 +624,117 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetLower( PT_3 ); aSet.Put( aUL ); } - SwFmtLineNumber aLN; aLN.SetCountLines( FALSE ); + SwFmtLineNumber aLN; aLN.SetCountLines( sal_False ); aSet.Put( aLN ); } break; // Benutzer-Verzeichnisse: case RES_POOLCOLL_TOX_USERH: // Header - lcl_SetRegister( this, aSet, 0, TRUE, FALSE ); + lcl_SetRegister( this, aSet, 0, sal_True, sal_False ); { - SwFmtLineNumber aLN; aLN.SetCountLines( FALSE ); + SwFmtLineNumber aLN; aLN.SetCountLines( sal_False ); aSet.Put( aLN ); } break; case RES_POOLCOLL_TOX_USER1: // 1. Ebene - lcl_SetRegister( this, aSet, 0, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 0, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_USER2: // 2. Ebene - lcl_SetRegister( this, aSet, 1, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 1, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_USER3: // 3. Ebene - lcl_SetRegister( this, aSet, 2, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 2, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_USER4: // 4. Ebene - lcl_SetRegister( this, aSet, 3, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 3, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_USER5: // 5. Ebene - lcl_SetRegister( this, aSet, 4, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 4, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_USER6: // 6. Ebene - lcl_SetRegister( this, aSet, 5, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 5, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_USER7: // 7. Ebene - lcl_SetRegister( this, aSet, 6, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 6, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_USER8: // 8. Ebene - lcl_SetRegister( this, aSet, 7, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 7, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_USER9: // 9. Ebene - lcl_SetRegister( this, aSet, 8, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 8, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_USER10: // 10. Ebene - lcl_SetRegister( this, aSet, 9, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 9, sal_False, sal_True ); break; // Index-Verzeichnisse case RES_POOLCOLL_TOX_IDXH: // Header - lcl_SetRegister( this, aSet, 0, TRUE, FALSE ); + lcl_SetRegister( this, aSet, 0, sal_True, sal_False ); { - SwFmtLineNumber aLN; aLN.SetCountLines( FALSE ); + SwFmtLineNumber aLN; aLN.SetCountLines( sal_False ); aSet.Put( aLN ); } break; case RES_POOLCOLL_TOX_IDX1: // 1. Ebene - lcl_SetRegister( this, aSet, 0, FALSE, FALSE ); + lcl_SetRegister( this, aSet, 0, sal_False, sal_False ); break; case RES_POOLCOLL_TOX_IDX2: // 2. Ebene - lcl_SetRegister( this, aSet, 1, FALSE, FALSE ); + lcl_SetRegister( this, aSet, 1, sal_False, sal_False ); break; case RES_POOLCOLL_TOX_IDX3: // 3. Ebene - lcl_SetRegister( this, aSet, 2, FALSE, FALSE ); + lcl_SetRegister( this, aSet, 2, sal_False, sal_False ); break; case RES_POOLCOLL_TOX_IDXBREAK: // Trenner - lcl_SetRegister( this, aSet, 0, FALSE, FALSE ); + lcl_SetRegister( this, aSet, 0, sal_False, sal_False ); break; // Inhalts-Verzeichnisse case RES_POOLCOLL_TOX_CNTNTH: // Header - lcl_SetRegister( this, aSet, 0, TRUE, FALSE ); + lcl_SetRegister( this, aSet, 0, sal_True, sal_False ); { - SwFmtLineNumber aLN; aLN.SetCountLines( FALSE ); + SwFmtLineNumber aLN; aLN.SetCountLines( sal_False ); aSet.Put( aLN ); } break; case RES_POOLCOLL_TOX_CNTNT1: // 1. Ebene - lcl_SetRegister( this, aSet, 0, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 0, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_CNTNT2: // 2. Ebene - lcl_SetRegister( this, aSet, 1, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 1, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_CNTNT3: // 3. Ebene - lcl_SetRegister( this, aSet, 2, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 2, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_CNTNT4: // 4. Ebene - lcl_SetRegister( this, aSet, 3, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 3, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_CNTNT5: // 5. Ebene - lcl_SetRegister( this, aSet, 4, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 4, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_CNTNT6: // 6. Ebene - lcl_SetRegister( this, aSet, 5, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 5, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_CNTNT7: // 7. Ebene - lcl_SetRegister( this, aSet, 6, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 6, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_CNTNT8: // 8. Ebene - lcl_SetRegister( this, aSet, 7, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 7, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_CNTNT9: // 9. Ebene - lcl_SetRegister( this, aSet, 8, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 8, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_CNTNT10: // 10. Ebene - lcl_SetRegister( this, aSet, 9, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 9, sal_False, sal_True ); break; case RES_POOLCOLL_TOX_ILLUSH: case RES_POOLCOLL_TOX_OBJECTH: case RES_POOLCOLL_TOX_TABLESH: case RES_POOLCOLL_TOX_AUTHORITIESH: - lcl_SetRegister( this, aSet, 0, TRUE, FALSE ); + lcl_SetRegister( this, aSet, 0, sal_True, sal_False ); { - SwFmtLineNumber aLN; aLN.SetCountLines( FALSE ); + SwFmtLineNumber aLN; aLN.SetCountLines( sal_False ); aSet.Put( aLN ); } break; @@ -740,7 +742,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) case RES_POOLCOLL_TOX_OBJECT1: case RES_POOLCOLL_TOX_TABLES1: case RES_POOLCOLL_TOX_AUTHORITIES1: - lcl_SetRegister( this, aSet, 0, FALSE, TRUE ); + lcl_SetRegister( this, aSet, 0, sal_False, sal_True ); break; @@ -1001,7 +1003,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) aBox.SetLine( &aNew, BOX_LINE_BOTTOM ); aSet.Put( aBox ); - aSet.Put( SwParaConnectBorderItem( FALSE ) ); + aSet.Put( SwParaConnectBorderItem( sal_False ) ); SetAllScriptItem( aSet, SvxFontHeightItem(120, 100, RES_CHRATR_FONTSIZE) ); SvxULSpaceItem aUL( RES_UL_SPACE ); @@ -1012,7 +1014,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) } aUL.SetLower( HTML_PARSPACE ); aSet.Put( aUL); - SwFmtLineNumber aLN; aLN.SetCountLines( FALSE ); + SwFmtLineNumber aLN; aLN.SetCountLines( sal_False ); aSet.Put( aLN ); } break; @@ -1054,7 +1056,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) // pruefe, ob diese "Auto-Collection" in Dokument schon/noch // benutzt wird -bool SwDoc::IsPoolTxtCollUsed( USHORT nId ) const +bool SwDoc::IsPoolTxtCollUsed( sal_uInt16 nId ) const { OSL_ENSURE( (RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) || @@ -1066,32 +1068,32 @@ bool SwDoc::IsPoolTxtCollUsed( USHORT nId ) const "Falsche AutoFormat-Id" ); SwTxtFmtColl* pNewColl = 0; - BOOL bFnd = FALSE; - for( USHORT n = 0; !bFnd && n < pTxtFmtCollTbl->Count(); ++n ) + sal_Bool bFnd = sal_False; + for( sal_uInt16 n = 0; !bFnd && n < pTxtFmtCollTbl->Count(); ++n ) { pNewColl = (*pTxtFmtCollTbl)[ n ]; if( nId == pNewColl->GetPoolFmtId() ) - bFnd = TRUE; + bFnd = sal_True; } if( !bFnd || !pNewColl->GetDepends() ) - return FALSE; + return sal_False; - SwAutoFmtGetDocNode aGetHt( &aNodes ); + SwAutoFmtGetDocNode aGetHt( &GetNodes() ); return !pNewColl->GetInfo( aGetHt ); } // Gebe das "Auto[matische]-Format" mit der Id zurueck. Existiert // es noch nicht, dann erzeuge es -SwFmt* SwDoc::GetFmtFromPool( USHORT nId ) +SwFmt* SwDoc::GetFmtFromPool( sal_uInt16 nId ) { SwFmt *pNewFmt = 0; SwFmt *pDeriveFmt = 0; SvPtrarr* pArray[ 2 ]; - USHORT nArrCnt = 1, nRCId = 0; - USHORT* pWhichRange = 0; + sal_uInt16 nArrCnt = 1, nRCId = 0; + sal_uInt16* pWhichRange = 0; switch( nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) ) { @@ -1142,7 +1144,7 @@ SwFmt* SwDoc::GetFmtFromPool( USHORT nId ) OSL_ENSURE( nRCId, "ungueltige Id" ); while( nArrCnt-- ) - for( USHORT n = 0; n < (*pArray[nArrCnt]).Count(); ++n ) + for( sal_uInt16 n = 0; n < (*pArray[nArrCnt]).Count(); ++n ) if( nId == ( pNewFmt = (SwFmt*)(*pArray[ nArrCnt ] )[ n ] )-> GetPoolFmtId() ) { @@ -1154,30 +1156,27 @@ SwFmt* SwDoc::GetFmtFromPool( USHORT nId ) SwAttrSet aSet( GetAttrPool(), pWhichRange ); { - BOOL bIsModified = IsModified(); + sal_Bool bIsModified = IsModified(); - BOOL bDoesUndo = DoesUndo(); - DoUndo(FALSE); - switch (nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) ) { - case POOLGRP_CHARFMT: - pNewFmt = _MakeCharFmt( aNm, pDeriveFmt, FALSE, TRUE ); - - break; - case POOLGRP_FRAMEFMT: - pNewFmt = _MakeFrmFmt(aNm, pDeriveFmt, FALSE, TRUE ); - - break; - default: - break; + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); + switch (nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) ) + { + case POOLGRP_CHARFMT: + pNewFmt = _MakeCharFmt(aNm, pDeriveFmt, sal_False, sal_True); + break; + case POOLGRP_FRAMEFMT: + pNewFmt = _MakeFrmFmt(aNm, pDeriveFmt, sal_False, sal_True); + break; + default: + break; + } } - DoUndo(bDoesUndo); - if( !bIsModified ) ResetModified(); pNewFmt->SetPoolFmtId( nId ); - pNewFmt->SetAuto( FALSE ); // kein Auto-Format + pNewFmt->SetAuto( sal_False ); // kein Auto-Format } switch( nId ) @@ -1338,7 +1337,7 @@ SwFmt* SwDoc::GetFmtFromPool( USHORT nId ) aSet.Put( SwFmtAnchor( FLY_AT_PAGE )); aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME )); aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::CENTER, text::RelOrientation::FRAME )); - aSet.Put( SvxOpaqueItem( FALSE )); + aSet.Put( SvxOpaqueItem( sal_False )); aSet.Put( SwFmtSurround( SURROUND_THROUGHT )); } break; @@ -1350,11 +1349,11 @@ SwFmt* SwDoc::GetFmtFromPool( USHORT nId ) aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) ); SvxProtectItem aProtect( RES_PROTECT ); - aProtect.SetSizeProtect( TRUE ); - aProtect.SetPosProtect( TRUE ); + aProtect.SetSizeProtect( sal_True ); + aProtect.SetPosProtect( sal_True ); aSet.Put( aProtect ); - pNewFmt->SetAutoUpdateFmt( TRUE ); + pNewFmt->SetAutoUpdateFmt( sal_True ); } break; } @@ -1379,12 +1378,12 @@ SwCharFmt* SwDoc::GetCharFmtFromPool( sal_uInt16 nId ) // pruefe, ob diese "Auto-Collection" in Dokument schon/noch // benutzt wird -bool SwDoc::IsPoolFmtUsed( USHORT nId ) const +bool SwDoc::IsPoolFmtUsed( sal_uInt16 nId ) const { SwFmt *pNewFmt = 0; const SvPtrarr* pArray[ 2 ]; - USHORT nArrCnt = 1; - BOOL bFnd = TRUE; + sal_uInt16 nArrCnt = 1; + sal_Bool bFnd = sal_True; if( RES_POOLCHR_BEGIN <= nId && nId < RES_POOLCHR_END ) { @@ -1398,18 +1397,18 @@ bool SwDoc::IsPoolFmtUsed( USHORT nId ) const } else { - OSL_ENSURE( FALSE, "ungueltige Id" ); - bFnd = FALSE; + OSL_ENSURE( sal_False, "ungueltige Id" ); + bFnd = sal_False; } if( bFnd ) { - bFnd = FALSE; + bFnd = sal_False; while( nArrCnt-- && !bFnd ) - for( USHORT n = 0; !bFnd && n < (*pArray[nArrCnt]).Count(); ++n ) + for( sal_uInt16 n = 0; !bFnd && n < (*pArray[nArrCnt]).Count(); ++n ) if( nId == ( pNewFmt = (SwFmt*)(*pArray[ nArrCnt ] )[ n ] )-> GetPoolFmtId() ) - bFnd = TRUE; + bFnd = sal_True; } // nicht gefunden oder keine Abhaengigen ? @@ -1417,11 +1416,11 @@ bool SwDoc::IsPoolFmtUsed( USHORT nId ) const { // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt // (auch indirekte fuer Format-Ableitung! ) - SwAutoFmtGetDocNode aGetHt( &aNodes ); + SwAutoFmtGetDocNode aGetHt( &GetNodes() ); bFnd = !pNewFmt->GetInfo( aGetHt ); } else - bFnd = FALSE; + bFnd = sal_False; return bFnd; } @@ -1447,7 +1446,7 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) "Falsche AutoFormat-Id" ); SwPageDesc *pNewPgDsc; - USHORT n; + sal_uInt16 n; for( n = 0; n < aPageDescs.Count(); ++n ) if( nId == ( pNewPgDsc = aPageDescs[ n ] )->GetPoolFmtId() ) @@ -1465,12 +1464,12 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) ResId aResId( sal_uInt32(RC_POOLPAGEDESC_BEGIN + nId - RES_POOLPAGE_BEGIN), *pSwResMgr ); String aNm( aResId ); { - BOOL bIsModified = IsModified(); + sal_Bool bIsModified = IsModified(); - BOOL bDoesUndo = DoesUndo(); - DoUndo(FALSE); - n = MakePageDesc( aNm, 0, bRegardLanguage ); - DoUndo(bDoesUndo); + { + ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); + n = MakePageDesc( aNm, 0, bRegardLanguage ); + } pNewPgDsc = aPageDescs[ n ]; pNewPgDsc->SetPoolFmtId( nId ); @@ -1483,11 +1482,11 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) aLR.SetLeft( GetMetricVal( CM_1 ) * 2 ); aLR.SetRight( aLR.GetLeft() ); SvxULSpaceItem aUL( RES_UL_SPACE ); - aUL.SetUpper( (USHORT)aLR.GetLeft() ); - aUL.SetLower( (USHORT)aLR.GetLeft() ); + aUL.SetUpper( (sal_uInt16)aLR.GetLeft() ); + aUL.SetLower( (sal_uInt16)aLR.GetLeft() ); SwAttrSet aSet( GetAttrPool(), aPgFrmFmtSetRange ); - BOOL bSetLeft = TRUE; + sal_Bool bSetLeft = sal_True; switch( nId ) { @@ -1520,7 +1519,7 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) lcl_GetStdPgSize( this, aSet ); aSet.Put( aLR ); aSet.Put( aUL ); - bSetLeft = FALSE; + bSetLeft = sal_False; if( pNewPgDsc ) pNewPgDsc->SetUseOn( nsUseOnPage::PD_LEFT ); } @@ -1530,7 +1529,7 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) lcl_GetStdPgSize( this, aSet ); aSet.Put( aLR ); aSet.Put( aUL ); - bSetLeft = FALSE; + bSetLeft = sal_False; if( pNewPgDsc ) pNewPgDsc->SetUseOn( nsUseOnPage::PD_RIGHT ); } @@ -1549,7 +1548,7 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) if( pNewPgDsc ) { pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL ); - pNewPgDsc->SetLandscape( TRUE ); + pNewPgDsc->SetLandscape( sal_True ); } } break; @@ -1558,8 +1557,8 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) { lcl_GetStdPgSize( this, aSet ); aLR.SetRight( GetMetricVal( CM_1 )); - aUL.SetUpper( (USHORT)aLR.GetRight() ); - aUL.SetLower( (USHORT)aLR.GetRight() ); + aUL.SetUpper( (sal_uInt16)aLR.GetRight() ); + aUL.SetLower( (sal_uInt16)aLR.GetRight() ); aSet.Put( aLR ); aSet.Put( aUL ); @@ -1595,7 +1594,7 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) if( pNewPgDsc ) { pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL ); - pNewPgDsc->SetLandscape( TRUE ); + pNewPgDsc->SetLandscape( sal_True ); } } break; @@ -1613,13 +1612,13 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) return pNewPgDsc; } -SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) +SwNumRule* SwDoc::GetNumRuleFromPool( sal_uInt16 nId ) { OSL_ENSURE( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END, "Falsche AutoFormat-Id" ); SwNumRule* pNewRule; - USHORT n; + sal_uInt16 n; for( n = 0; n < GetNumRuleTbl().Count(); ++n ) if( nId == ( pNewRule = GetNumRuleTbl()[ n ] )->GetPoolFmtId() ) @@ -1643,13 +1642,13 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) = numfunc::GetDefaultPositionAndSpaceMode(); //#i89178# // <-- { - BOOL bIsModified = IsModified(); + sal_Bool bIsModified = IsModified(); - n = MakeNumRule( aNm, 0, FALSE, eNumberFormatPositionAndSpaceMode ); + n = MakeNumRule( aNm, 0, sal_False, eNumberFormatPositionAndSpaceMode ); pNewRule = GetNumRuleTbl()[ n ]; pNewRule->SetPoolFmtId( nId ); - pNewRule->SetAutoRule( FALSE ); + pNewRule->SetAutoRule( sal_False ); if( RES_POOLNUMRULE_NUM1 <= nId && nId <= RES_POOLNUMRULE_NUM5 ) pNumCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL ); @@ -1674,22 +1673,22 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) aFmt.SetIncludeUpperLevels( 1 ); aFmt.SetSuffix( aDotStr ); - static const USHORT aAbsSpace[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = { // cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835 }; #ifdef USE_MEASUREMENT - static const USHORT aAbsSpaceInch[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] = { 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835 }; - const USHORT* pArr = MEASURE_METRIC == + const sal_uInt16* pArr = MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() ? aAbsSpace : aAbsSpaceInch; #else - const USHORT* pArr = aAbsSpace; + const sal_uInt16* pArr = aAbsSpace; #endif if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) @@ -1721,7 +1720,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) case RES_POOLNUMRULE_NUM2: { - static const USHORT aAbsSpace[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = { 283, 283, 567, 709, // 0.50, 0.50, 1.00, 1.25 850, 1021, 1304, 1474, // 1.50, 1.80, 2.30, 2.60 @@ -1729,19 +1728,19 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) }; #ifdef USE_MEASUREMENT - static const USHORT aAbsSpaceInch[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] = { 385, 385, 770, 963, 1155, 1386, 1771, 2002, 2156, 2387 }; - const USHORT* pArr = MEASURE_METRIC == + const sal_uInt16* pArr = MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() ? aAbsSpace : aAbsSpaceInch; #else - const USHORT* pArr = aAbsSpace; + const sal_uInt16* pArr = aAbsSpace; #endif SwNumFmt aFmt; @@ -1755,7 +1754,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB ); } - USHORT nSpace = 0; + sal_uInt16 nSpace = 0; for( n = 0; n < MAXLEVEL; ++n ) { if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) @@ -1784,7 +1783,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) aFmt.SetCharFmt( pNumCFmt ); aFmt.SetIncludeUpperLevels( 1 ); - USHORT nOffs = GetMetricVal( CM_1 ) * 3; + sal_uInt16 nOffs = GetMetricVal( CM_1 ) * 3; if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { @@ -1823,22 +1822,22 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) aFmt.SetIncludeUpperLevels( 1 ); aFmt.SetSuffix( aDotStr ); - static const USHORT aAbsSpace[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = { // cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835 }; #ifdef USE_MEASUREMENT - static const USHORT aAbsSpaceInch[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] = { 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835 }; - const USHORT* pArr = MEASURE_METRIC == + const sal_uInt16* pArr = MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() ? aAbsSpace : aAbsSpaceInch; #else - const USHORT* pArr = aAbsSpace; + const sal_uInt16* pArr = aAbsSpace; #endif if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) @@ -1872,7 +1871,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) case RES_POOLNUMRULE_NUM5: { // [ First, LSpace ] - static const USHORT aAbsSpace0to2[] = + static const sal_uInt16 aAbsSpace0to2[] = { 227, 227, // 0.40, 0.40, 369, 624, // 0.65, 1.10, @@ -1880,18 +1879,18 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) }; #ifdef USE_MEASUREMENT - static const USHORT aAbsSpaceInch0to2[] = + static const sal_uInt16 aAbsSpaceInch0to2[] = { 308, 308, 501, 847, 347, 1194 }; - const USHORT* pArr0to2 = MEASURE_METRIC == + const sal_uInt16* pArr0to2 = MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() ? aAbsSpace0to2 : aAbsSpaceInch0to2; #else - const USHORT* pArr0to2 = aAbsSpace0to2; + const sal_uInt16* pArr0to2 = aAbsSpace0to2; #endif SwNumFmt aFmt; @@ -1962,7 +1961,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) aFmt.SetCharFmt( pBullCFmt ); aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); aFmt.SetBulletChar( cBulletChar ); - USHORT nOffs = GetMetricVal( CM_01 ) * 4, + sal_uInt16 nOffs = GetMetricVal( CM_01 ) * 4, nOffs2 = GetMetricVal( CM_1 ) * 2; if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) @@ -2006,22 +2005,22 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); aFmt.SetBulletChar( cBulletChar ); - static const USHORT aAbsSpace[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = { // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268 }; #ifdef USE_MEASUREMENT - static const USHORT aAbsSpaceInch[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] = { 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268 }; - const USHORT* pArr = MEASURE_METRIC == + const sal_uInt16* pArr = MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() ? aAbsSpace : aAbsSpaceInch; #else - const USHORT* pArr = aAbsSpace; + const sal_uInt16* pArr = aAbsSpace; #endif if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) @@ -2062,22 +2061,22 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); aFmt.SetBulletChar( 0x2013 ); - static const USHORT aAbsSpace[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = { // cm: 0,3 0,6 0,9 1,2 1,5 1,8 2,1 2,4 2,7 3,0 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701 }; #ifdef USE_MEASUREMENT - static const USHORT aAbsSpaceInch[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] = { 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701 }; - const USHORT* pArr = MEASURE_METRIC == + const sal_uInt16* pArr = MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() ? aAbsSpace : aAbsSpaceInch; #else - const USHORT* pArr = aAbsSpace; + const sal_uInt16* pArr = aAbsSpace; #endif if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) @@ -2118,7 +2117,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) aFmt.SetIncludeUpperLevels( 1 ); aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); - USHORT nOffs = GetMetricVal( CM_01 ) * 4; + sal_uInt16 nOffs = GetMetricVal( CM_01 ) * 4; if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { @@ -2159,22 +2158,22 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) aFmt.SetIncludeUpperLevels( 1 ); aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); - static const USHORT aAbsSpace[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = { // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268 }; #ifdef USE_MEASUREMENT - static const USHORT aAbsSpaceInch[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] = { 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268 }; - const USHORT* pArr = MEASURE_METRIC == + const sal_uInt16* pArr = MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() ? aAbsSpace : aAbsSpaceInch; #else - const USHORT* pArr = aAbsSpace; + const sal_uInt16* pArr = aAbsSpace; #endif if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) @@ -2222,22 +2221,22 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) aFmt.SetBulletChar( 0x2717 ); aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); - static const USHORT aAbsSpace[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = { // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268 }; #ifdef USE_MEASUREMENT - static const USHORT aAbsSpaceInch[ MAXLEVEL ] = + static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] = { 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268 }; - const USHORT* pArr = MEASURE_METRIC == + const sal_uInt16* pArr = MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() ? aAbsSpace : aAbsSpaceInch; #else - const USHORT* pArr = aAbsSpace; + const sal_uInt16* pArr = aAbsSpace; #endif if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) @@ -2275,26 +2274,26 @@ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId ) // pruefe, ob diese "Auto-Collection" in Dokument schon/noch // benutzt wird -bool SwDoc::IsPoolPageDescUsed( USHORT nId ) const +bool SwDoc::IsPoolPageDescUsed( sal_uInt16 nId ) const { OSL_ENSURE( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END, "Falsche AutoFormat-Id" ); SwPageDesc *pNewPgDsc = 0; - BOOL bFnd = FALSE; - for( USHORT n = 0; !bFnd && n < aPageDescs.Count(); ++n ) + sal_Bool bFnd = sal_False; + for( sal_uInt16 n = 0; !bFnd && n < aPageDescs.Count(); ++n ) { pNewPgDsc = aPageDescs[ n ]; if( nId == pNewPgDsc->GetPoolFmtId() ) - bFnd = TRUE; + bFnd = sal_True; } // nicht gefunden oder keine Abhaengigen ? if( !bFnd || !pNewPgDsc->GetDepends() ) // ?????? - return FALSE; + return sal_False; // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt // (auch indirekte fuer Format-Ableitung! ) - SwAutoFmtGetDocNode aGetHt( &aNodes ); + SwAutoFmtGetDocNode aGetHt( &GetNodes() ); return !pNewPgDsc->GetInfo( aGetHt ); } @@ -2303,7 +2302,7 @@ sal_Bool SwDoc::IsUsed( const SwModify& rModify ) const { // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt // (auch indirekte fuer Format-Ableitung! ) - SwAutoFmtGetDocNode aGetHt( &aNodes ); + SwAutoFmtGetDocNode aGetHt( &GetNodes() ); return !rModify.GetInfo( aGetHt ); } @@ -2319,12 +2318,12 @@ sal_Bool SwDoc::IsUsed( const SwNumRule& rRule ) const // Suche die Position vom Vorlagen-Namen. Ist nicht vorhanden // dann fuege neu ein -USHORT SwDoc::SetDocPattern( const String& rPatternName ) +sal_uInt16 SwDoc::SetDocPattern( const String& rPatternName ) { OSL_ENSURE( rPatternName.Len(), "kein Dokument-Vorlagenname" ); - USHORT nNewPos = aPatternNms.Count(); - for( USHORT n = 0; n < aPatternNms.Count(); ++n ) + sal_uInt16 nNewPos = aPatternNms.Count(); + for( sal_uInt16 n = 0; n < aPatternNms.Count(); ++n ) if( !aPatternNms[n] ) { if( nNewPos == aPatternNms.Count() ) @@ -2342,9 +2341,9 @@ USHORT SwDoc::SetDocPattern( const String& rPatternName ) return nNewPos; } -USHORT GetPoolParent( USHORT nId ) +sal_uInt16 GetPoolParent( sal_uInt16 nId ) { - USHORT nRet = USHRT_MAX; + sal_uInt16 nRet = USHRT_MAX; if( POOLGRP_NOCOLLID & nId ) // 1 == Formate / 0 == Collections { switch( ( COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID ) & nId ) diff --git a/sw/source/core/doc/sortopt.cxx b/sw/source/core/doc/sortopt.cxx index 9e432f8402f7..eaee0fddd513 100644 --- a/sw/source/core/doc/sortopt.cxx +++ b/sw/source/core/doc/sortopt.cxx @@ -42,11 +42,11 @@ SV_IMPL_PTRARR(SwSortKeys, SwSortKey*) SwSortKey::SwSortKey() : eSortOrder( SRT_ASCENDING ), nColumnId( 0 ), - bIsNumeric( TRUE ) + bIsNumeric( sal_True ) { } -SwSortKey::SwSortKey(USHORT nId, const String& rSrtType, SwSortOrder eOrder) : +SwSortKey::SwSortKey(sal_uInt16 nId, const String& rSrtType, SwSortOrder eOrder) : sSortType( rSrtType ), eSortOrder( eOrder ), nColumnId( nId ), @@ -69,8 +69,8 @@ SwSortOptions::SwSortOptions() : eDirection( SRT_ROWS ), cDeli( 9 ), nLanguage( LANGUAGE_SYSTEM ), - bTable( FALSE ), - bIgnoreCase( FALSE ) + bTable( sal_False ), + bIgnoreCase( sal_False ) { } @@ -81,7 +81,7 @@ SwSortOptions::SwSortOptions(const SwSortOptions& rOpt) : bTable( rOpt.bTable ), bIgnoreCase( rOpt.bIgnoreCase ) { - for( USHORT i=0; i < rOpt.aKeys.Count(); ++i ) + for( sal_uInt16 i=0; i < rOpt.aKeys.Count(); ++i ) { SwSortKey* pNew = new SwSortKey(*rOpt.aKeys[i]); aKeys.C40_INSERT( SwSortKey, pNew, aKeys.Count()); diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index 27cca42ac203..3359f1d9385a 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -53,10 +53,10 @@ SwServerObject::~SwServerObject() } -BOOL SwServerObject::GetData( uno::Any & rData, - const String & rMimeType, BOOL ) +sal_Bool SwServerObject::GetData( uno::Any & rData, + const String & rMimeType, sal_Bool ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; WriterRef xWrt; switch( SotExchange::GetFormatIdFromMimeType( rMimeType ) ) { @@ -103,14 +103,14 @@ BOOL SwServerObject::GetData( uno::Any & rData, { // Stream anlegen SvMemoryStream aMemStm( 65535, 65535 ); - SwWriter aWrt( aMemStm, *pPam, FALSE ); + SwWriter aWrt( aMemStm, *pPam, sal_False ); if( !IsError( aWrt.Write( xWrt )) ) { aMemStm << '\0'; // append a zero char rData <<= uno::Sequence< sal_Int8 >( (sal_Int8*)aMemStm.GetData(), aMemStm.Seek( STREAM_SEEK_TO_END ) ); - bRet = TRUE; + bRet = sal_True; } delete pPam; @@ -120,11 +120,11 @@ BOOL SwServerObject::GetData( uno::Any & rData, } -BOOL SwServerObject::SetData( const String & , +sal_Bool SwServerObject::SetData( const String & , const uno::Any& ) { // set new data into the "server" -> at first nothing to do - return FALSE; + return sal_False; } @@ -133,7 +133,7 @@ void SwServerObject::SendDataChanged( const SwPosition& rPos ) // ist an unseren Aenderungen jemand interessiert ? if( HasDataLinks() ) { - int bCall = FALSE; + int bCall = sal_False; const SwStartNode* pNd = 0; switch( eType ) { @@ -151,7 +151,7 @@ void SwServerObject::SendDataChanged( const SwPosition& rPos ) } if( pNd ) { - ULONG nNd = rPos.nNode.GetIndex(); + sal_uLong nNd = rPos.nNode.GetIndex(); bCall = pNd->GetIndex() < nNd && nNd < pNd->EndOfSectionIndex(); } @@ -170,7 +170,7 @@ void SwServerObject::SendDataChanged( const SwPaM& rRange ) // ist an unseren Aenderungen jemand interessiert ? if( HasDataLinks() ) { - int bCall = FALSE; + int bCall = sal_False; const SwStartNode* pNd = 0; const SwPosition* pStt = rRange.Start(), *pEnd = rRange.End(); switch( eType ) @@ -204,9 +204,9 @@ void SwServerObject::SendDataChanged( const SwPaM& rRange ) } -BOOL SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const +sal_Bool SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const { - ULONG nSttNd = 0, nEndNd = 0; + sal_uLong nSttNd = 0, nEndNd = 0; xub_StrLen nStt = 0; xub_StrLen nEnd = 0; const SwNode* pNd = 0; @@ -232,7 +232,7 @@ BOOL SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const case SECTION_SERVER: pNd = CNTNT_TYPE.pSectNd; break; case SECTION_SERVER+1: - return TRUE; + return sal_True; } if( pNd ) @@ -252,7 +252,7 @@ BOOL SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const SwServerObject::ServerModes eSave = eType; if( !pChkLnk ) ((SwServerObject*)this)->eType = NONE_SERVER; - for( USHORT n = rLnks.Count(); n; ) + for( sal_uInt16 n = rLnks.Count(); n; ) { const ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]); if( pLnk && OBJECT_CLIENT_GRF != pLnk->GetObjType() && @@ -264,7 +264,7 @@ if( !pChkLnk ) { if( pLnk == pChkLnk || ((SwBaseLink*)pLnk)->IsRecursion( pChkLnk ) ) - return TRUE; + return sal_True; } else if( ((SwBaseLink*)pLnk)->IsRecursion( (SwBaseLink*)pLnk ) ) ((SwBaseLink*)pLnk)->SetNoDataFlag(); @@ -275,7 +275,7 @@ if( !pChkLnk ) ((SwServerObject*)this)->eType = eSave; } - return FALSE; + return sal_False; } void SwServerObject::SetNoServer() @@ -309,7 +309,7 @@ void SwServerObject::SetDdeBookmark( ::sw::mark::IMark& rBookmark) /* */ -SwDataChanged::SwDataChanged( const SwPaM& rPam, USHORT nTyp ) +SwDataChanged::SwDataChanged( const SwPaM& rPam, sal_uInt16 nTyp ) : pPam( &rPam ), pPos( 0 ), pDoc( rPam.GetDoc() ), nType( nTyp ) { nNode = rPam.GetPoint()->nNode.GetIndex(); @@ -317,7 +317,7 @@ SwDataChanged::SwDataChanged( const SwPaM& rPam, USHORT nTyp ) } -SwDataChanged::SwDataChanged( SwDoc* pDc, const SwPosition& rPos, USHORT nTyp ) +SwDataChanged::SwDataChanged( SwDoc* pDc, const SwPosition& rPos, sal_uInt16 nTyp ) : pPam( 0 ), pPos( &rPos ), pDoc( pDc ), nType( nTyp ) { nNode = rPos.nNode.GetIndex(); @@ -332,7 +332,7 @@ SwDataChanged::~SwDataChanged() { const ::sfx2::SvLinkSources& rServers = pDoc->GetLinkManager().GetServers(); - for( USHORT nCnt = rServers.Count(); nCnt; ) + for( sal_uInt16 nCnt = rServers.Count(); nCnt; ) { ::sfx2::SvLinkSourceRef refObj( rServers[ --nCnt ] ); // noch jemand am Object interessiert ? diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index eb6f375033c5..9d16beb1b4d0 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -52,43 +52,43 @@ #include <SwStyleNameMapper.hxx> // bis SO5PF -const USHORT AUTOFORMAT_ID_X = 9501; -const USHORT AUTOFORMAT_ID_358 = 9601; -const USHORT AUTOFORMAT_DATA_ID_X = 9502; +const sal_uInt16 AUTOFORMAT_ID_X = 9501; +const sal_uInt16 AUTOFORMAT_ID_358 = 9601; +const sal_uInt16 AUTOFORMAT_DATA_ID_X = 9502; // ab SO5 //! in nachfolgenden Versionen muss der Betrag dieser IDs groesser sein -const USHORT AUTOFORMAT_ID_504 = 9801; -const USHORT AUTOFORMAT_DATA_ID_504 = 9802; +const sal_uInt16 AUTOFORMAT_ID_504 = 9801; +const sal_uInt16 AUTOFORMAT_DATA_ID_504 = 9802; -const USHORT AUTOFORMAT_ID_552 = 9901; -const USHORT AUTOFORMAT_DATA_ID_552 = 9902; +const sal_uInt16 AUTOFORMAT_ID_552 = 9901; +const sal_uInt16 AUTOFORMAT_DATA_ID_552 = 9902; // --- from 641 on: CJK and CTL font settings -const USHORT AUTOFORMAT_ID_641 = 10001; -const USHORT AUTOFORMAT_DATA_ID_641 = 10002; +const sal_uInt16 AUTOFORMAT_ID_641 = 10001; +const sal_uInt16 AUTOFORMAT_DATA_ID_641 = 10002; // --- from 680/dr14 on: diagonal frame lines -const USHORT AUTOFORMAT_ID_680DR14 = 10011; -const USHORT AUTOFORMAT_DATA_ID_680DR14 = 10012; +const sal_uInt16 AUTOFORMAT_ID_680DR14 = 10011; +const sal_uInt16 AUTOFORMAT_DATA_ID_680DR14 = 10012; // --- from 680/dr25 on: store strings as UTF-8 -const USHORT AUTOFORMAT_ID_680DR25 = 10021; -const USHORT AUTOFORMAT_DATA_ID_680DR25 = 10022; +const sal_uInt16 AUTOFORMAT_ID_680DR25 = 10021; +const sal_uInt16 AUTOFORMAT_DATA_ID_680DR25 = 10022; // --- from DEV300/overline2 on: overline -const USHORT AUTOFORMAT_ID_300OVRLN = 10031; -const USHORT AUTOFORMAT_DATA_ID_300OVRLN = 10032; +const sal_uInt16 AUTOFORMAT_ID_300OVRLN = 10031; +const sal_uInt16 AUTOFORMAT_DATA_ID_300OVRLN = 10032; // current version -const USHORT AUTOFORMAT_ID = AUTOFORMAT_ID_300OVRLN; -const USHORT AUTOFORMAT_DATA_ID = AUTOFORMAT_DATA_ID_300OVRLN; +const sal_uInt16 AUTOFORMAT_ID = AUTOFORMAT_ID_300OVRLN; +const sal_uInt16 AUTOFORMAT_DATA_ID = AUTOFORMAT_DATA_ID_300OVRLN; #ifdef READ_OLDVERS -const USHORT AUTOFORMAT_OLD_ID = 8201; -const USHORT AUTOFORMAT_OLD_ID1 = 8301; -const USHORT AUTOFORMAT_OLD_DATA_ID = 8202; +const sal_uInt16 AUTOFORMAT_OLD_ID = 8201; +const sal_uInt16 AUTOFORMAT_OLD_ID1 = 8301; +const sal_uInt16 AUTOFORMAT_OLD_DATA_ID = 8202; #endif @@ -105,34 +105,34 @@ SV_IMPL_PTRARR( _SwTableAutoFmtTbl, SwTableAutoFmt* ) struct SwAfVersions { public: - USHORT nFontVersion; - USHORT nFontHeightVersion; - USHORT nWeightVersion; - USHORT nPostureVersion; - USHORT nUnderlineVersion; - USHORT nOverlineVersion; - USHORT nCrossedOutVersion; - USHORT nContourVersion; - USHORT nShadowedVersion; - USHORT nColorVersion; - USHORT nBoxVersion; - USHORT nLineVersion; - USHORT nBrushVersion; - - USHORT nAdjustVersion; - - USHORT nHorJustifyVersion; - USHORT nVerJustifyVersion; - USHORT nOrientationVersion; - USHORT nMarginVersion; - USHORT nBoolVersion; - USHORT nInt32Version; - USHORT nRotateModeVersion; - - USHORT nNumFmtVersion; + sal_uInt16 nFontVersion; + sal_uInt16 nFontHeightVersion; + sal_uInt16 nWeightVersion; + sal_uInt16 nPostureVersion; + sal_uInt16 nUnderlineVersion; + sal_uInt16 nOverlineVersion; + sal_uInt16 nCrossedOutVersion; + sal_uInt16 nContourVersion; + sal_uInt16 nShadowedVersion; + sal_uInt16 nColorVersion; + sal_uInt16 nBoxVersion; + sal_uInt16 nLineVersion; + sal_uInt16 nBrushVersion; + + sal_uInt16 nAdjustVersion; + + sal_uInt16 nHorJustifyVersion; + sal_uInt16 nVerJustifyVersion; + sal_uInt16 nOrientationVersion; + sal_uInt16 nMarginVersion; + sal_uInt16 nBoolVersion; + sal_uInt16 nInt32Version; + sal_uInt16 nRotateModeVersion; + + sal_uInt16 nNumFmtVersion; SwAfVersions(); - void Load( SvStream& rStream, USHORT nVer ); + void Load( SvStream& rStream, sal_uInt16 nVer ); }; SwAfVersions::SwAfVersions() : @@ -161,7 +161,7 @@ SwAfVersions::SwAfVersions() : { } -void SwAfVersions::Load( SvStream& rStream, USHORT nVer ) +void SwAfVersions::Load( SvStream& rStream, sal_uInt16 nVer ) { rStream >> nFontVersion; rStream >> nFontHeightVersion; @@ -327,7 +327,7 @@ SwBoxAutoFmt& SwBoxAutoFmt::operator=( const SwBoxAutoFmt& rNew ) aItem = *(aItemType*)pNew; \ delete pNew; -BOOL SwBoxAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, USHORT nVer ) +sal_Bool SwBoxAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer ) { SfxPoolItem* pNew; SvxOrientationItem aOrientation( SVX_ORIENTATION_STANDARD, 0); @@ -398,7 +398,7 @@ BOOL SwBoxAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, USHOR if( 0 == rVersions.nNumFmtVersion ) { - USHORT eSys, eLge; + sal_uInt16 eSys, eLge; // --- from 680/dr25 on: store strings as UTF-8 CharSet eCharSet = (nVer >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet(); rStream.ReadByteString( sNumFmtString, eCharSet ) @@ -417,7 +417,7 @@ BOOL SwBoxAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, USHOR #ifdef READ_OLDVERS -BOOL SwBoxAutoFmt::LoadOld( SvStream& rStream, USHORT aLoadVer[] ) +sal_Bool SwBoxAutoFmt::LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] ) { SfxPoolItem* pNew; READ( aFont, SvxFontItem , 0) @@ -447,7 +447,7 @@ BOOL SwBoxAutoFmt::LoadOld( SvStream& rStream, USHORT aLoadVer[] ) #endif -BOOL SwBoxAutoFmt::Save( SvStream& rStream ) const +sal_Bool SwBoxAutoFmt::Save( SvStream& rStream ) const { SvxOrientationItem aOrientation( aRotateAngle.GetValue(), aStacked.GetValue(), 0 ); @@ -487,13 +487,13 @@ BOOL SwBoxAutoFmt::Save( SvStream& rStream ) const // --- from 680/dr25 on: store strings as UTF-8 rStream.WriteByteString( sNumFmtString, RTL_TEXTENCODING_UTF8 ) - << (USHORT)eSysLanguage << (USHORT)eNumFmtLanguage; + << (sal_uInt16)eSysLanguage << (sal_uInt16)eNumFmtLanguage; return 0 == rStream.GetError(); } -BOOL SwBoxAutoFmt::SaveVerionNo( SvStream& rStream ) const +sal_Bool SwBoxAutoFmt::SaveVerionNo( SvStream& rStream ) const { rStream << aFont.GetVersion( SOFFICE_FILEFORMAT_40 ); rStream << aHeight.GetVersion( SOFFICE_FILEFORMAT_40 ); @@ -519,7 +519,7 @@ BOOL SwBoxAutoFmt::SaveVerionNo( SvStream& rStream ) const rStream << aRotateAngle.GetVersion( SOFFICE_FILEFORMAT_40 ); rStream << aRotateMode.GetVersion( SOFFICE_FILEFORMAT_40 ); - rStream << (USHORT)0; // NumberFormat + rStream << (sal_uInt16)0; // NumberFormat return 0 == rStream.GetError(); } @@ -530,12 +530,12 @@ BOOL SwBoxAutoFmt::SaveVerionNo( SvStream& rStream ) const SwTableAutoFmt::SwTableAutoFmt( const String& rName ) : aName( rName ), nStrResId( USHRT_MAX ) { - bInclFont = TRUE; - bInclJustify = TRUE; - bInclFrame = TRUE; - bInclBackground = TRUE; - bInclValueFormat = TRUE; - bInclWidthHeight = TRUE; + bInclFont = sal_True; + bInclJustify = sal_True; + bInclFrame = sal_True; + bInclBackground = sal_True; + bInclValueFormat = sal_True; + bInclWidthHeight = sal_True; memset( aBoxAutoFmt, 0, sizeof( aBoxAutoFmt ) ); } @@ -543,14 +543,14 @@ SwTableAutoFmt::SwTableAutoFmt( const String& rName ) SwTableAutoFmt::SwTableAutoFmt( const SwTableAutoFmt& rNew ) { - for( BYTE n = 0; n < 16; ++n ) + for( sal_uInt8 n = 0; n < 16; ++n ) aBoxAutoFmt[ n ] = 0; *this = rNew; } SwTableAutoFmt& SwTableAutoFmt::operator=( const SwTableAutoFmt& rNew ) { - for( BYTE n = 0; n < 16; ++n ) + for( sal_uInt8 n = 0; n < 16; ++n ) { if( aBoxAutoFmt[ n ] ) delete aBoxAutoFmt[ n ]; @@ -578,13 +578,13 @@ SwTableAutoFmt& SwTableAutoFmt::operator=( const SwTableAutoFmt& rNew ) SwTableAutoFmt::~SwTableAutoFmt() { SwBoxAutoFmt** ppFmt = aBoxAutoFmt; - for( BYTE n = 0; n < 16; ++n, ++ppFmt ) + for( sal_uInt8 n = 0; n < 16; ++n, ++ppFmt ) if( *ppFmt ) delete *ppFmt; } -void SwTableAutoFmt::SetBoxFmt( const SwBoxAutoFmt& rNew, BYTE nPos ) +void SwTableAutoFmt::SetBoxFmt( const SwBoxAutoFmt& rNew, sal_uInt8 nPos ) { OSL_ENSURE( nPos < 16, "falscher Bereich" ); @@ -596,7 +596,7 @@ void SwTableAutoFmt::SetBoxFmt( const SwBoxAutoFmt& rNew, BYTE nPos ) } -const SwBoxAutoFmt& SwTableAutoFmt::GetBoxFmt( BYTE nPos ) const +const SwBoxAutoFmt& SwTableAutoFmt::GetBoxFmt( sal_uInt8 nPos ) const { OSL_ENSURE( nPos < 16, "falscher Bereich" ); @@ -614,7 +614,7 @@ const SwBoxAutoFmt& SwTableAutoFmt::GetBoxFmt( BYTE nPos ) const -SwBoxAutoFmt& SwTableAutoFmt::UpdateFromSet( BYTE nPos, +SwBoxAutoFmt& SwTableAutoFmt::UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet, UpdateFlags eFlags, SvNumberFormatter* pNFmtr ) @@ -660,7 +660,7 @@ SwBoxAutoFmt& SwTableAutoFmt::UpdateFromSet( BYTE nPos, const SwTblBoxNumFormat* pNumFmtItem; const SvNumberformat* pNumFormat = 0; - if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMAT, TRUE, + if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMAT, sal_True, (const SfxPoolItem**)&pNumFmtItem ) && pNFmtr && 0 != (pNumFormat = pNFmtr->GetEntry( pNumFmtItem->GetValue() )) ) pFmt->SetValueFormat( ((SvNumberformat*)pNumFormat)->GetFormatstring(), @@ -679,7 +679,7 @@ SwBoxAutoFmt& SwTableAutoFmt::UpdateFromSet( BYTE nPos, } -void SwTableAutoFmt::UpdateToSet( BYTE nPos, SfxItemSet& rSet, +void SwTableAutoFmt::UpdateToSet( sal_uInt8 nPos, SfxItemSet& rSet, UpdateFlags eFlags, SvNumberFormatter* pNFmtr ) const { const SwBoxAutoFmt& rChg = GetBoxFmt( nPos ); @@ -752,7 +752,7 @@ void SwTableAutoFmt::UpdateToSet( BYTE nPos, SfxItemSet& rSet, if( sFmt.Len() ) { short nType; - BOOL bNew; + sal_Bool bNew; xub_StrLen nCheckPos; sal_uInt32 nKey = pNFmtr->GetIndexPuttingAndConverting( sFmt, eLng, eSys, nType, bNew, nCheckPos); @@ -767,24 +767,24 @@ void SwTableAutoFmt::UpdateToSet( BYTE nPos, SfxItemSet& rSet, } -BOOL SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions ) +sal_Bool SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions ) { - BOOL bRet = TRUE; - USHORT nVal = 0; + sal_Bool bRet = sal_True; + sal_uInt16 nVal = 0; rStream >> nVal; bRet = 0 == rStream.GetError(); if( bRet && (nVal == AUTOFORMAT_DATA_ID_X || (AUTOFORMAT_DATA_ID_504 <= nVal && nVal <= AUTOFORMAT_DATA_ID)) ) { - BOOL b; + sal_Bool b; // --- from 680/dr25 on: store strings as UTF-8 CharSet eCharSet = (nVal >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet(); rStream.ReadByteString( aName, eCharSet ); if( AUTOFORMAT_DATA_ID_552 <= nVal ) { rStream >> nStrResId; - USHORT nId = RID_SVXSTR_TBLAFMT_BEGIN + nStrResId; + sal_uInt16 nId = RID_SVXSTR_TBLAFMT_BEGIN + nStrResId; if( RID_SVXSTR_TBLAFMT_BEGIN <= nId && nId < RID_SVXSTR_TBLAFMT_END ) { @@ -802,7 +802,7 @@ BOOL SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions ) bRet = 0 == rStream.GetError(); - for( BYTE i = 0; i < 16; ++i ) + for( sal_uInt8 i = 0; i < 16; ++i ) { SwBoxAutoFmt* pFmt = new SwBoxAutoFmt; bRet = pFmt->Load( rStream, rVersions, nVal ); @@ -820,16 +820,16 @@ BOOL SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions ) #ifdef READ_OLDVERS -BOOL SwTableAutoFmt::LoadOld( SvStream& rStream, USHORT aLoadVer[] ) +sal_Bool SwTableAutoFmt::LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] ) { - BOOL bRet = TRUE; - USHORT nVal = 0; + sal_Bool bRet = sal_True; + sal_uInt16 nVal = 0; rStream >> nVal; bRet = 0 == rStream.GetError(); if( bRet && ( AUTOFORMAT_OLD_DATA_ID == nVal )) { - BOOL b; + sal_Bool b; rStream.ReadByteString( aName, rStream.GetStreamCharSet() ); rStream >> b; bInclFont = b; rStream >> b; bInclJustify = b; @@ -855,10 +855,10 @@ BOOL SwTableAutoFmt::LoadOld( SvStream& rStream, USHORT aLoadVer[] ) #endif -BOOL SwTableAutoFmt::Save( SvStream& rStream ) const +sal_Bool SwTableAutoFmt::Save( SvStream& rStream ) const { - USHORT nVal = AUTOFORMAT_DATA_ID; - BOOL b; + sal_uInt16 nVal = AUTOFORMAT_DATA_ID; + sal_Bool b; rStream << nVal; // --- from 680/dr25 on: store strings as UTF-8 rStream.WriteByteString( aName, RTL_TEXTENCODING_UTF8 ); @@ -870,7 +870,7 @@ BOOL SwTableAutoFmt::Save( SvStream& rStream ) const rStream << ( b = bInclValueFormat ); rStream << ( b = bInclWidthHeight ); - BOOL bRet = 0 == rStream.GetError(); + sal_Bool bRet = 0 == rStream.GetError(); for( int i = 0; bRet && i < 16; ++i ) { @@ -896,7 +896,7 @@ SwTableAutoFmtTbl::SwTableAutoFmtTbl() SwBoxAutoFmt aNew; - BYTE i; + sal_uInt8 i; Color aColor( COL_BLUE ); SvxBrushItem aBrushItem( aColor, RES_BACKGROUND ); @@ -946,39 +946,39 @@ SwTableAutoFmtTbl::SwTableAutoFmtTbl() Insert( pNew, Count() ); } -BOOL SwTableAutoFmtTbl::Load() +sal_Bool SwTableAutoFmtTbl::Load() { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; String sNm( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( sAutoTblFmtName ))); SvtPathOptions aOpt; if( aOpt.SearchFile( sNm, SvtPathOptions::PATH_USERCONFIG )) { - SfxMedium aStream( sNm, STREAM_STD_READ, TRUE ); + SfxMedium aStream( sNm, STREAM_STD_READ, sal_True ); bRet = Load( *aStream.GetInStream() ); } else - bRet = FALSE; + bRet = sal_False; return bRet; } -BOOL SwTableAutoFmtTbl::Save() const +sal_Bool SwTableAutoFmtTbl::Save() const { SvtPathOptions aPathOpt; String sNm( aPathOpt.GetUserConfigPath() ); sNm += INET_PATH_TOKEN; sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sAutoTblFmtName )); - SfxMedium aStream(sNm, STREAM_STD_WRITE, TRUE ); + SfxMedium aStream(sNm, STREAM_STD_WRITE, sal_True ); return Save( *aStream.GetOutStream() ) && aStream.Commit(); } -BOOL SwTableAutoFmtTbl::Load( SvStream& rStream ) +sal_Bool SwTableAutoFmtTbl::Load( SvStream& rStream ) { - BOOL bRet = 0 == rStream.GetError(); + sal_Bool bRet = 0 == rStream.GetError(); if (bRet) { // Achtung hier muss ein allgemeiner Header gelesen werden - USHORT nVal = 0; + sal_uInt16 nVal = 0; rStream >> nVal; bRet = 0 == rStream.GetError(); @@ -989,13 +989,13 @@ BOOL SwTableAutoFmtTbl::Load( SvStream& rStream ) if( nVal == AUTOFORMAT_ID_358 || (AUTOFORMAT_ID_504 <= nVal && nVal <= AUTOFORMAT_ID) ) { - UINT16 nFileVers = SOFFICE_FILEFORMAT_40; - BYTE nChrSet, nCnt; + sal_uInt16 nFileVers = SOFFICE_FILEFORMAT_40; + sal_uInt8 nChrSet, nCnt; long nPos = rStream.Tell(); rStream >> nCnt >> nChrSet; // if( 4 <= nCnt ) // rStream >> nFileVers; - if( rStream.Tell() != ULONG(nPos + nCnt) ) + if( rStream.Tell() != sal_uLong(nPos + nCnt) ) { OSL_ENSURE( !this, "Der Header enthaelt mehr/neuere Daten" ); rStream.Seek( nPos + nCnt ); @@ -1010,12 +1010,12 @@ BOOL SwTableAutoFmtTbl::Load( SvStream& rStream ) aVersions.Load( rStream, nVal ); // Item-Versionen SwTableAutoFmt* pNew; - USHORT nAnz = 0; + sal_uInt16 nAnz = 0; rStream >> nAnz; bRet = 0 == rStream.GetError(); - for( USHORT i = 0; i < nAnz; ++i ) + for( sal_uInt16 i = 0; i < nAnz; ++i ) { pNew = new SwTableAutoFmt( aEmptyStr ); bRet = pNew->Load( rStream, aVersions ); @@ -1034,18 +1034,18 @@ BOOL SwTableAutoFmtTbl::Load( SvStream& rStream ) else if( AUTOFORMAT_OLD_ID == nVal || AUTOFORMAT_OLD_ID1 == nVal ) { SwTableAutoFmt* pNew; - USHORT nAnz = 0; + sal_uInt16 nAnz = 0; rStream >> nAnz; - USHORT aArr[ 12 ]; - memset( aArr, 0, 12 * sizeof( USHORT ) ); + sal_uInt16 aArr[ 12 ]; + memset( aArr, 0, 12 * sizeof( sal_uInt16 ) ); if( AUTOFORMAT_OLD_ID1 == nVal ) - for( USHORT n = 0; n < 12; ++n ) + for( sal_uInt16 n = 0; n < 12; ++n ) rStream >> aArr[ n ]; bRet = 0 == rStream.GetError(); - for( USHORT i = 0; i < nAnz; ++i ) + for( sal_uInt16 i = 0; i < nAnz; ++i ) { pNew = new SwTableAutoFmt( aEmptyStr ); bRet = pNew->LoadOld( rStream, aArr ); @@ -1067,18 +1067,18 @@ BOOL SwTableAutoFmtTbl::Load( SvStream& rStream ) } -BOOL SwTableAutoFmtTbl::Save( SvStream& rStream ) const +sal_Bool SwTableAutoFmtTbl::Save( SvStream& rStream ) const { - BOOL bRet = 0 == rStream.GetError(); + sal_Bool bRet = 0 == rStream.GetError(); if (bRet) { rStream.SetVersion( SOFFICE_FILEFORMAT_40 ); // Achtung hier muss ein allgemeiner Header gespeichert werden - USHORT nVal = AUTOFORMAT_ID; + sal_uInt16 nVal = AUTOFORMAT_ID; rStream << nVal - << (BYTE)2 // Anzahl von Zeichen des Headers incl. diesem - << (BYTE)GetStoreCharSet( ::gsl_getSystemTextEncoding() ); + << (sal_uInt8)2 // Anzahl von Zeichen des Headers incl. diesem + << (sal_uInt8)GetStoreCharSet( ::gsl_getSystemTextEncoding() ); bRet = 0 == rStream.GetError(); @@ -1086,10 +1086,10 @@ BOOL SwTableAutoFmtTbl::Save( SvStream& rStream ) const // die VersionsNummer fuer alle Attribute schreiben (*this)[ 0 ]->GetBoxFmt( 0 ).SaveVerionNo( rStream ); - rStream << (USHORT)(Count() - 1); + rStream << (sal_uInt16)(Count() - 1); bRet = 0 == rStream.GetError(); - for( USHORT i = 1; bRet && i < Count(); ++i ) + for( sal_uInt16 i = 1; bRet && i < Count(); ++i ) { SwTableAutoFmt* pFmt = (*this)[ i ]; bRet = pFmt->Save( rStream ); diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index fdc56a2c572d..d83bf854c645 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -36,6 +36,7 @@ #include <svl/zforlist.hxx> #include <frmfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <swtable.hxx> @@ -48,16 +49,17 @@ #include <mvsave.hxx> #include <docary.hxx> #include <fmtanchr.hxx> -#include <undobj.hxx> +#include <hints.hxx> +#include <UndoTable.hxx> #include <redline.hxx> #include <fmtfsize.hxx> #include <list> -BOOL _FndCntntLine( const SwTableLine*& rpLine, void* pPara ); -BOOL _FndCntntBox( const SwTableBox*& rpBox, void* pPara ); +sal_Bool _FndCntntLine( const SwTableLine*& rpLine, void* pPara ); +sal_Bool _FndCntntBox( const SwTableBox*& rpBox, void* pPara ); void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, SwTable& rDstTbl, SwTableBox* pDstBox, - BOOL bDelCntnt, SwUndoTblCpyTbl* pUndo ); + sal_Bool bDelCntnt, SwUndoTblCpyTbl* pUndo ); // The following type will be used by table copy functions to describe // the structure of tables (or parts of tables). @@ -69,13 +71,13 @@ namespace { SwTableBox* mpBox; SwTableBox* mpCopy; - USHORT mnColSpan; + sal_uInt16 mnColSpan; bool mbSelected; }; typedef std::vector< BoxSpanInfo > BoxStructure; typedef std::vector< BoxStructure > LineStructure; - typedef std::list< ULONG > ColumnStructure; + typedef std::list< sal_uLong > ColumnStructure; struct SubBox { @@ -91,14 +93,14 @@ namespace public: LineStructure maLines; ColumnStructure maCols; - USHORT mnStartCol; - USHORT mnAddLine; - void addLine( USHORT &rLine, const SwTableBoxes&, const SwSelBoxes*, + sal_uInt16 mnStartCol; + sal_uInt16 mnAddLine; + void addLine( sal_uInt16 &rLine, const SwTableBoxes&, const SwSelBoxes*, bool bNewModel ); - void addBox( USHORT nLine, const SwSelBoxes*, SwTableBox *pBox, - ULONG &rnB, USHORT &rnC, ColumnStructure::iterator& rpCl, + void addBox( sal_uInt16 nLine, const SwSelBoxes*, SwTableBox *pBox, + sal_uLong &rnB, sal_uInt16 &rnC, ColumnStructure::iterator& rpCl, BoxStructure::iterator& rpSel, bool &rbSel, bool bCover ); - void incColSpan( USHORT nLine, USHORT nCol ); + void incColSpan( sal_uInt16 nLine, sal_uInt16 nCol ); TableStructure( const SwTable& rTable ); TableStructure( const SwTable& rTable, _FndBox &rFndBox, const SwSelBoxes& rSelBoxes, @@ -138,7 +140,7 @@ namespace rSubTable.insert( pEndLn, aSubLine ); } while( ++nSize < rBox.GetTabLines().Count() ); } - for( USHORT nLine = 0; nLine < rBox.GetTabLines().Count(); ++nLine ) + for( sal_uInt16 nLine = 0; nLine < rBox.GetTabLines().Count(); ++nLine ) pStartLn = insertSubLine( rSubTable, *rBox.GetTabLines()[nLine], pStartLn ); OSL_ENSURE( pStartLn == pEndLn, "Sub line confusion" ); @@ -164,7 +166,7 @@ namespace SubTable::iterator pMax = pStartLn; ++pMax; SubTable::difference_type nMax = 1; - for( USHORT nBox = 0; nBox < rLine.GetTabBoxes().Count(); ++nBox ) + for( sal_uInt16 nBox = 0; nBox < rLine.GetTabBoxes().Count(); ++nBox ) { SubTable::iterator pTmp = insertSubBox( rSubTable, *rLine.GetTabBoxes()[nBox], pStartLn, pMax ); @@ -184,8 +186,8 @@ namespace { maCols.push_front(0); const SwTableLines &rLines = rTable.GetTabLines(); - USHORT nCnt = 0; - for( USHORT nLine = 0; nLine < rLines.Count(); ++nLine ) + sal_uInt16 nCnt = 0; + for( sal_uInt16 nLine = 0; nLine < rLines.Count(); ++nLine ) addLine( nCnt, rLines[nLine]->GetTabBoxes(), 0, rTable.IsNewModel() ); } @@ -200,8 +202,8 @@ namespace _FndLines &rFndLines = rFndBox.GetLines(); maCols.push_front(0); const SwTableLine* pLine = rFndLines[0]->GetLine(); - USHORT nStartLn = rTable.GetTabLines().C40_GETPOS( SwTableLine, pLine ); - USHORT nEndLn = nStartLn; + sal_uInt16 nStartLn = rTable.GetTabLines().C40_GETPOS( SwTableLine, pLine ); + sal_uInt16 nEndLn = nStartLn; if( rFndLines.Count() > 1 ) { pLine = rFndLines[ rFndLines.Count()-1 ]->GetLine(); @@ -211,9 +213,9 @@ namespace { const SwTableLines &rLines = rTable.GetTabLines(); if( bNoSelection && - (USHORT)nMinSize > nEndLn - nStartLn + 1 ) + (sal_uInt16)nMinSize > nEndLn - nStartLn + 1 ) { - USHORT nNewEndLn = nStartLn + (USHORT)nMinSize - 1; + sal_uInt16 nNewEndLn = nStartLn + (sal_uInt16)nMinSize - 1; if( nNewEndLn >= rLines.Count() ) { mnAddLine = nNewEndLn - rLines.Count() + 1; @@ -231,8 +233,8 @@ namespace } maLines.resize( nEndLn - nStartLn + 1 ); const SwSelBoxes* pSelBoxes = &rSelBoxes; - USHORT nCnt = 0; - for( USHORT nLine = nStartLn; nLine <= nEndLn; ++nLine ) + sal_uInt16 nCnt = 0; + for( sal_uInt16 nLine = nStartLn; nLine <= nEndLn; ++nLine ) { addLine( nCnt, rLines[nLine]->GetTabBoxes(), pSelBoxes, rTable.IsNewModel() ); @@ -244,7 +246,7 @@ namespace { BoxStructure::iterator pC = maLines[0].begin(); BoxStructure::iterator pEnd = maLines[0].end(); - USHORT nIdx = mnStartCol; + sal_uInt16 nIdx = mnStartCol; mnStartCol = 0; while( nIdx && pC != pEnd ) { @@ -258,12 +260,12 @@ namespace } } - void TableStructure::addLine( USHORT &rLine, const SwTableBoxes& rBoxes, + void TableStructure::addLine( sal_uInt16 &rLine, const SwTableBoxes& rBoxes, const SwSelBoxes* pSelBoxes, bool bNewModel ) { bool bComplex = false; if( !bNewModel ) - for( USHORT nBox = 0; !bComplex && nBox < rBoxes.Count(); ++nBox ) + for( sal_uInt16 nBox = 0; !bComplex && nBox < rBoxes.Count(); ++nBox ) bComplex = rBoxes[nBox]->GetTabLines().Count() > 0; if( bComplex ) { @@ -272,7 +274,7 @@ namespace aSubTable.push_back( aSubLine ); SubTable::iterator pStartLn = aSubTable.begin(); SubTable::iterator pEndLn = aSubTable.end(); - for( USHORT nBox = 0; nBox < rBoxes.Count(); ++nBox ) + for( sal_uInt16 nBox = 0; nBox < rBoxes.Count(); ++nBox ) insertSubBox( aSubTable, *rBoxes[nBox], pStartLn, pEndLn ); SubTable::size_type nSize = aSubTable.size(); if( nSize ) @@ -281,8 +283,8 @@ namespace while( pStartLn != pEndLn ) { bool bSelected = false; - ULONG nBorder = 0; - USHORT nCol = 0; + sal_uLong nBorder = 0; + sal_uInt16 nCol = 0; maLines[rLine].reserve( pStartLn->size() ); BoxStructure::iterator pSel = maLines[rLine].end(); ColumnStructure::iterator pCol = maCols.begin(); @@ -302,20 +304,20 @@ namespace else { bool bSelected = false; - ULONG nBorder = 0; - USHORT nCol = 0; + sal_uLong nBorder = 0; + sal_uInt16 nCol = 0; maLines[rLine].reserve( rBoxes.Count() ); ColumnStructure::iterator pCol = maCols.begin(); BoxStructure::iterator pSel = maLines[rLine].end(); - for( USHORT nBox = 0; nBox < rBoxes.Count(); ++nBox ) + for( sal_uInt16 nBox = 0; nBox < rBoxes.Count(); ++nBox ) addBox( rLine, pSelBoxes, rBoxes[nBox], nBorder, nCol, pCol, pSel, bSelected, false ); ++rLine; } } - void TableStructure::addBox( USHORT nLine, const SwSelBoxes* pSelBoxes, - SwTableBox *pBox, ULONG &rnBorder, USHORT &rnCol, + void TableStructure::addBox( sal_uInt16 nLine, const SwSelBoxes* pSelBoxes, + SwTableBox *pBox, sal_uLong &rnBorder, sal_uInt16 &rnCol, ColumnStructure::iterator& rpCol, BoxStructure::iterator& rpSel, bool &rbSelected, bool bCovered ) { @@ -326,7 +328,7 @@ namespace aInfo.mbSelected = true; if( mnStartCol == USHRT_MAX ) { - mnStartCol = (USHORT)maLines[nLine].size(); + mnStartCol = (sal_uInt16)maLines[nLine].size(); if( pSelBoxes->Count() < 2 ) { pSelBoxes = 0; @@ -337,7 +339,7 @@ namespace else aInfo.mbSelected = false; rnBorder += pBox->GetFrmFmt()->GetFrmSize().GetWidth(); - USHORT nLeftCol = rnCol; + sal_uInt16 nLeftCol = rnCol; while( rpCol != maCols.end() && *rpCol < rnBorder ) { ++rnCol; @@ -377,10 +379,10 @@ namespace if( mnAddLine ) { const SwTableLines &rLines = rTable.GetTabLines(); - USHORT nLineCount = rLines.Count(); + sal_uInt16 nLineCount = rLines.Count(); if( nLineCount < mnAddLine ) mnAddLine = nLineCount; - USHORT nLine = (USHORT)maLines.size(); + sal_uInt16 nLine = (sal_uInt16)maLines.size(); maLines.resize( nLine + mnAddLine ); while( mnAddLine ) { @@ -391,9 +393,9 @@ namespace } } - void TableStructure::incColSpan( USHORT nLineMax, USHORT nNewCol ) + void TableStructure::incColSpan( sal_uInt16 nLineMax, sal_uInt16 nNewCol ) { - for( USHORT nLine = 0; nLine < nLineMax; ++nLine ) + for( sal_uInt16 nLine = 0; nLine < nLineMax; ++nLine ) { BoxStructure::iterator pInfo = maLines[nLine].begin(); BoxStructure::iterator pEnd = maLines[nLine].end(); @@ -413,7 +415,7 @@ namespace return; LineStructure::const_iterator pCurrLine = pFirstLine; LineStructure::size_type nLineCount = maLines.size(); - USHORT nFirstStartCol = 0; + sal_uInt16 nFirstStartCol = 0; { BoxStructure::const_iterator pFirstBox = pFirstLine->begin(); if( pFirstBox != pFirstLine->end() && pFirstBox->mpBox && @@ -424,7 +426,7 @@ namespace { BoxStructure::const_iterator pFirstBox = pCurrLine->begin(); BoxStructure::const_iterator pLastBox = pCurrLine->end(); - USHORT nCurrStartCol = mnStartCol; + sal_uInt16 nCurrStartCol = mnStartCol; if( pFirstBox != pLastBox ) { BoxStructure::const_iterator pTmpBox = pLastBox; @@ -448,7 +450,7 @@ namespace BoxStructure::const_iterator pCurrBox = pFirstBox; BoxStructure &rBox = maLines[nLine]; BoxStructure::size_type nBoxCount = rBox.size(); - USHORT nCol = 0; + sal_uInt16 nCol = 0; for( BoxStructure::size_type nBox = 0; nBox < nBoxCount; ++nBox ) { BoxSpanInfo& rInfo = rBox[nBox]; @@ -505,7 +507,7 @@ namespace SwTableBox *pBox = rInfo.mpBox; if( pBox && pBox->getRowSpan() > 0 ) lcl_CpyBox( rSource, rInfo.mpCopy, rDstTbl, pBox, - TRUE, pUndo ); + sal_True, pUndo ); } } } @@ -525,7 +527,7 @@ namespace void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, SwTable& rDstTbl, SwTableBox* pDstBox, - BOOL bDelCntnt, SwUndoTblCpyTbl* pUndo ) + sal_Bool bDelCntnt, SwUndoTblCpyTbl* pUndo ) { OSL_ENSURE( ( !pCpyBox || pCpyBox->GetSttNd() ) && pDstBox->GetSttNd(), "Keine inhaltstragende Box" ); @@ -546,13 +548,12 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, if( pUndo ) pUndo->AddBoxBefore( *pDstBox, bDelCntnt ); - BOOL bUndo = pDoc->DoesUndo(); bool bUndoRedline = pUndo && pDoc->IsRedlineOn(); - pDoc->DoUndo( FALSE ); + ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); SwNodeIndex aSavePos( aInsIdx, -1 ); if( pRg.get() ) - pCpyDoc->CopyWithFlyInFly( *pRg, 0, aInsIdx, FALSE ); + pCpyDoc->CopyWithFlyInFly( *pRg, 0, aInsIdx, sal_False ); else pDoc->GetNodes().MakeTxtNode( aInsIdx, (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() ); aSavePos++; @@ -561,7 +562,7 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, while( pLine->GetUpper() ) pLine = pLine->GetUpper()->GetUpper(); - BOOL bReplaceColl = TRUE; + sal_Bool bReplaceColl = sal_True; if( bDelCntnt && !bUndoRedline ) { // zuerst die Fly loeschen, dann die entsprechenden Nodes @@ -572,11 +573,11 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, SwPosition aMvPos( aInsIdx ); SwCntntNode* pCNd = pDoc->GetNodes().GoPrevious( &aMvPos.nNode ); aMvPos.nContent.Assign( pCNd, pCNd->Len() ); - pDoc->CorrAbs( aInsIdx, aEndNdIdx, aMvPos, /*TRUE*/FALSE ); + pDoc->CorrAbs( aInsIdx, aEndNdIdx, aMvPos, /*sal_True*/sal_False ); } // stehen noch FlyFrames rum, loesche auch diese - for( USHORT n = 0; n < pDoc->GetSpzFrmFmts()->Count(); ++n ) + for( sal_uInt16 n = 0; n < pDoc->GetSpzFrmFmts()->Count(); ++n ) { SwFrmFmt *const pFly = (*pDoc->GetSpzFrmFmts())[n]; SwFmtAnchor const*const pAnchor = &pFly->GetAnchor(); @@ -605,7 +606,7 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, if( pCNd && RES_POOLCOLL_TABLE_HDLN != pCNd->GetFmtColl()->GetPoolFmtId() ) - bReplaceColl = FALSE; + bReplaceColl = sal_False; } pDoc->GetNodes().Delete( aInsIdx, aEndNdIdx.GetIndex() - aInsIdx.GetIndex() ); @@ -615,11 +616,11 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, if( pUndo ) pUndo->AddBoxAfter( *pDstBox, aInsIdx, bDelCntnt ); - // Ueberschrift - SwTxtNode* pTxtNd = pDoc->GetNodes()[ aSavePos ]->GetTxtNode(); + // heading + SwTxtNode *const pTxtNd = aSavePos.GetNode().GetTxtNode(); if( pTxtNd ) { - USHORT nPoolId = pTxtNd->GetTxtColl()->GetPoolFmtId(); + sal_uInt16 nPoolId = pTxtNd->GetTxtColl()->GetPoolFmtId(); if( bReplaceColl && (( 1 < rDstTbl.GetTabLines().Count() && pLine == rDstTbl.GetTabLines()[0] ) @@ -659,12 +660,12 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, if( aBoxAttrSet.Count() ) { const SfxPoolItem* pItem; - SvNumberFormatter* pN = pDoc->GetNumberFormatter( FALSE ); + SvNumberFormatter* pN = pDoc->GetNumberFormatter( sal_False ); if( pN && pN->HasMergeFmtTbl() && SFX_ITEM_SET == aBoxAttrSet. - GetItemState( RES_BOXATR_FORMAT, FALSE, &pItem ) ) + GetItemState( RES_BOXATR_FORMAT, sal_False, &pItem ) ) { - ULONG nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue(); - ULONG nNewIdx = pN->GetMergeFmtIndex( nOldIdx ); + sal_uLong nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue(); + sal_uLong nNewIdx = pN->GetMergeFmtIndex( nOldIdx ); if( nNewIdx != nOldIdx ) aBoxAttrSet.Put( SwTblBoxNumFormat( nNewIdx )); } @@ -672,11 +673,9 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, } } } - - pDoc->DoUndo( bUndo ); } -BOOL SwTable::InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, +sal_Bool SwTable::InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, SwUndoTblCpyTbl* pUndo ) { SwDoc* pDoc = GetFrmFmt()->GetDoc(); @@ -703,7 +702,7 @@ BOOL SwTable::InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, if( pUndo ) pUndo->InsertRow( *this, aBoxes, aTarget.mnAddLine ); else - InsertRow( pDoc, aBoxes, aTarget.mnAddLine, TRUE ); + InsertRow( pDoc, aBoxes, aTarget.mnAddLine, sal_True ); aTarget.moreLines( *this ); bClear = true; @@ -733,7 +732,7 @@ BOOL SwTable::InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, // make frames aFndBox.MakeFrms( *this ); - return TRUE; + return sal_True; } // kopiere die Tabelle in diese. @@ -743,7 +742,7 @@ BOOL SwTable::InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, // Box einer "GrundLine". // Ist auch keine Line mehr vorhanden, -> auch in die letzte Box // einer "GrundLine" -BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwNodeIndex& rSttBox, +sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwNodeIndex& rSttBox, SwUndoTblCpyTbl* pUndo ) { SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen @@ -773,10 +772,10 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwNodeIndex& rSttBox, SwTblNumFmtMerge aTNFM( *pCpyDoc, *pDoc ); - BOOL bDelCntnt = TRUE; + sal_Bool bDelCntnt = sal_True; const SwTableBox* pTmp; - for( USHORT nLines = 0; nLines < rCpyTbl.GetTabLines().Count(); ++nLines ) + for( sal_uInt16 nLines = 0; nLines < rCpyTbl.GetTabLines().Count(); ++nLines ) { // hole die erste Box von der Copy-Line const SwTableBox* pCpyBox = rCpyTbl.GetTabLines()[nLines] @@ -789,25 +788,25 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwNodeIndex& rSttBox, // (keine leeren Section erzeugen, werden sonst geloescht!) lcl_CpyBox( rCpyTbl, pCpyBox, *this, pMyBox, bDelCntnt, pUndo ); - if( 0 == (pTmp = pCpyBox->FindNextBox( rCpyTbl, pCpyBox, FALSE ))) + if( 0 == (pTmp = pCpyBox->FindNextBox( rCpyTbl, pCpyBox, sal_False ))) break; // es folgt keine weitere Box mehr pCpyBox = pTmp; - if( 0 == ( pTmp = pMyBox->FindNextBox( *this, pMyBox, FALSE ))) - bDelCntnt = FALSE; // kein Platz mehr ?? + if( 0 == ( pTmp = pMyBox->FindNextBox( *this, pMyBox, sal_False ))) + bDelCntnt = sal_False; // kein Platz mehr ?? else pMyBox = (SwTableBox*)pTmp; - } while( TRUE ); + } while( sal_True ); // suche die oberste Line SwTableLine* pNxtLine = pMyBox->GetUpper(); while( pNxtLine->GetUpper() ) pNxtLine = pNxtLine->GetUpper()->GetUpper(); - USHORT nPos = GetTabLines().C40_GETPOS( SwTableLine, pNxtLine ); + sal_uInt16 nPos = GetTabLines().C40_GETPOS( SwTableLine, pNxtLine ); // gibt es eine naechste ?? if( nPos + 1 >= GetTabLines().Count() ) - bDelCntnt = FALSE; // es gibt keine, alles in die letzte Box + bDelCntnt = sal_False; // es gibt keine, alles in die letzte Box else { // suche die naechste "Inhaltstragende Box" @@ -815,15 +814,15 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwNodeIndex& rSttBox, pMyBox = pNxtLine->GetTabBoxes()[0]; while( pMyBox->GetTabLines().Count() ) pMyBox = pMyBox->GetTabLines()[0]->GetTabBoxes()[0]; - bDelCntnt = TRUE; + bDelCntnt = sal_True; } } aFndBox.MakeFrms( pTblNd->GetTable() ); // erzeuge die Frames neu - return TRUE; + return sal_True; } -BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, +sal_Bool SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, SwUndoTblCpyTbl* pUndo ) { OSL_ENSURE( rSelBoxes.Count(), "Missing selection" ); @@ -842,7 +841,7 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, SwTableBox *pTmpBox, *pSttBox = (SwTableBox*)rSelBoxes[0]; - USHORT nLn, nBx; + sal_uInt16 nLn, nBx; _FndLine *pFLine, *pInsFLine = 0; _FndBox aFndBox( 0, 0 ); // suche alle Boxen / Lines @@ -856,16 +855,16 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, if( 1 != rCpyTbl.GetTabSortBoxes().Count() ) { SwTableLine* pSttLine = pSttBox->GetUpper(); - USHORT nSttBox = pSttLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSttBox ); - USHORT nSttLine = GetTabLines().C40_GETPOS( SwTableLine, pSttLine ); + sal_uInt16 nSttBox = pSttLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSttBox ); + sal_uInt16 nSttLine = GetTabLines().C40_GETPOS( SwTableLine, pSttLine ); _FndBox* pFndBox; - USHORT nFndCnt = aFndBox.GetLines().Count(); + sal_uInt16 nFndCnt = aFndBox.GetLines().Count(); if( !nFndCnt ) - return FALSE; + return sal_False; // teste ob genug Platz fuer die einzelnen Lines und Boxen ist: - USHORT nTstLns = 0; + sal_uInt16 nTstLns = 0; pFLine = aFndBox.GetLines()[ 0 ]; pSttLine = pFLine->GetLine(); nSttLine = GetTabLines().C40_GETPOS( SwTableLine, pSttLine ); @@ -880,9 +879,9 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, // teste, ob man durch einfuegen neuer zum Ziel kommt. Aber // nur wenn die SSelection eine Box umfasst !! if( 1 < rSelBoxes.Count() ) - return FALSE; + return sal_False; - USHORT nNewLns = rCpyTbl.GetTabLines().Count() - + sal_uInt16 nNewLns = rCpyTbl.GetTabLines().Count() - (GetTabLines().Count() - nSttLine ); // Dann teste mal ob die Anzahl der Boxen fuer die Lines reicht @@ -890,7 +889,7 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, pSttBox = pFLine->GetBoxes()[0]->GetBox(); nSttBox = pFLine->GetLine()->GetTabBoxes().C40_GETPOS( SwTableBox, pSttBox ); - for( USHORT n = rCpyTbl.GetTabLines().Count() - nNewLns; + for( sal_uInt16 n = rCpyTbl.GetTabLines().Count() - nNewLns; n < rCpyTbl.GetTabLines().Count(); ++n ) { SwTableLine* pCpyLn = rCpyTbl.GetTabLines()[ n ]; @@ -898,13 +897,13 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, if( pLastLn->GetTabBoxes().Count() < nSttBox || ( pLastLn->GetTabBoxes().Count() - nSttBox ) < pCpyLn->GetTabBoxes().Count() ) - return FALSE; + return sal_False; // Test auf Verschachtelungen for( nBx = 0; nBx < pCpyLn->GetTabBoxes().Count(); ++nBx ) if( !( pTmpBox = pLastLn->GetTabBoxes()[ nSttBox + nBx ]) ->GetSttNd() ) - return FALSE; + return sal_False; } // es ist also Platz fuer das zu kopierende vorhanden, also // fuege entsprechend neue Zeilen ein. @@ -915,10 +914,10 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, if( pUndo ? !pUndo->InsertRow( *this, SelLineFromBox( pInsBox, - aBoxes, TRUE ), nNewLns ) + aBoxes, sal_True ), nNewLns ) : !InsertRow( pDoc, SelLineFromBox( pInsBox, - aBoxes, TRUE ), nNewLns, TRUE ) ) - return FALSE; + aBoxes, sal_True ), nNewLns, sal_True ) ) + return sal_False; } nTstLns = rCpyTbl.GetTabLines().Count(); // soviele Kopieren @@ -926,7 +925,7 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, else if( 0 == (nFndCnt % rCpyTbl.GetTabLines().Count()) ) nTstLns = nFndCnt; else - return FALSE; // kein Platz fuer die Zeilen + return sal_False; // kein Platz fuer die Zeilen for( nLn = 0; nLn < nTstLns; ++nLn ) { @@ -953,14 +952,14 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, if( pLine->GetTabBoxes().Count() < nSttBox || ( pLine->GetTabBoxes().Count() - nSttBox ) < pFLine->GetBoxes().Count() ) - return FALSE; + return sal_False; // Test auf Verschachtelungen for( nBx = 0; nBx < pFLine->GetBoxes().Count(); ++nBx ) { if( !( pTmpBox = pLine->GetTabBoxes()[ nSttBox + nBx ]) ->GetSttNd() ) - return FALSE; + return sal_False; // wenn Ok, fuege die Box in die FndLine zu pFndBox = new _FndBox( pTmpBox, pInsFLine ); pInsFLine->GetBoxes().C40_INSERT( _FndBox, pFndBox, nBx ); @@ -972,14 +971,14 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, if( pLine->GetTabBoxes().Count() < nSttBox || ( pLine->GetTabBoxes().Count() - nSttBox ) < pCpyLn->GetTabBoxes().Count() ) - return FALSE; + return sal_False; // Test auf Verschachtelungen for( nBx = 0; nBx < pCpyLn->GetTabBoxes().Count(); ++nBx ) { if( !( pTmpBox = pLine->GetTabBoxes()[ nSttBox + nBx ]) ->GetSttNd() ) - return FALSE; + return sal_False; // wenn Ok, fuege die Box in die FndLine zu if( nBx == pFLine->GetBoxes().Count() ) { @@ -994,17 +993,17 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, // (n-Fach) if( 0 != ( pFLine->GetBoxes().Count() % pCpyLn->GetTabBoxes().Count() )) - return FALSE; + return sal_False; // Test auf Verschachtelungen for( nBx = 0; nBx < pFLine->GetBoxes().Count(); ++nBx ) if( !pFLine->GetBoxes()[ nBx ]->GetBox()->GetSttNd() ) - return FALSE; + return sal_False; } } if( !aFndBox.GetLines().Count() ) - return FALSE; + return sal_False; } { @@ -1021,9 +1020,9 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, if( 1 == rCpyTbl.GetTabSortBoxes().Count() ) { SwTableBox *pTmpBx = rCpyTbl.GetTabSortBoxes()[0]; - for( USHORT n = 0; n < rSelBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rSelBoxes.Count(); ++n ) lcl_CpyBox( rCpyTbl, pTmpBx, *this, - (SwTableBox*)rSelBoxes[n], TRUE, pUndo ); + (SwTableBox*)rSelBoxes[n], sal_True, pUndo ); } else for( nLn = 0; nLn < aFndBox.GetLines().Count(); ++nLn ) @@ -1036,33 +1035,33 @@ BOOL SwTable::InsTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, // Kopiere in pMyBox die pCpyBox lcl_CpyBox( rCpyTbl, pCpyLn->GetTabBoxes()[ nBx % pCpyLn->GetTabBoxes().Count() ], - *this, pFLine->GetBoxes()[ nBx ]->GetBox(), TRUE, pUndo ); + *this, pFLine->GetBoxes()[ nBx ]->GetBox(), sal_True, pUndo ); } } aFndBox.MakeFrms( *this ); - return TRUE; + return sal_True; } -BOOL _FndCntntBox( const SwTableBox*& rpBox, void* pPara ) +sal_Bool _FndCntntBox( const SwTableBox*& rpBox, void* pPara ) { SwTableBox* pBox = (SwTableBox*)rpBox; if( rpBox->GetTabLines().Count() ) pBox->GetTabLines().ForEach( &_FndCntntLine, pPara ); else ((SwSelBoxes*)pPara)->Insert( pBox ); - return TRUE; + return sal_True; } -BOOL _FndCntntLine( const SwTableLine*& rpLine, void* pPara ) +sal_Bool _FndCntntLine( const SwTableLine*& rpLine, void* pPara ) { ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &_FndCntntBox, pPara ); - return TRUE; + return sal_True; } // suche alle Inhaltstragenden-Boxen dieser Box SwSelBoxes& SwTable::SelLineFromBox( const SwTableBox* pBox, - SwSelBoxes& rBoxes, BOOL bToTop ) const + SwSelBoxes& rBoxes, sal_Bool bToTop ) const { SwTableLine* pLine = (SwTableLine*)pBox->GetUpper(); if( bToTop ) @@ -1070,7 +1069,7 @@ SwSelBoxes& SwTable::SelLineFromBox( const SwTableBox* pBox, pLine = pLine->GetUpper()->GetUpper(); // alle alten loeschen - rBoxes.Remove( USHORT(0), rBoxes.Count() ); + rBoxes.Remove( sal_uInt16(0), rBoxes.Count() ); pLine->GetTabBoxes().ForEach( &_FndCntntBox, &rBoxes ); return rBoxes; } diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 01e831532b3e..92676eb272ab 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -53,7 +53,8 @@ #include <swundo.hxx> #include <rowfrm.hxx> #include <ddefld.hxx> -#include <undobj.hxx> +#include <hints.hxx> +#include <UndoTable.hxx> #include <cellatr.hxx> #include <mvsave.hxx> #include <swtblfmt.hxx> @@ -99,10 +100,10 @@ struct _CpyTabFrm _CpyTabFrm& operator=( const _CpyTabFrm& ); - BOOL operator==( const _CpyTabFrm& rCpyTabFrm ) - { return (ULONG)Value.nSize == (ULONG)rCpyTabFrm.Value.nSize; } - BOOL operator<( const _CpyTabFrm& rCpyTabFrm ) - { return (ULONG)Value.nSize < (ULONG)rCpyTabFrm.Value.nSize; } + sal_Bool operator==( const _CpyTabFrm& rCpyTabFrm ) + { return (sal_uLong)Value.nSize == (sal_uLong)rCpyTabFrm.Value.nSize; } + sal_Bool operator<( const _CpyTabFrm& rCpyTabFrm ) + { return (sal_uLong)Value.nSize < (sal_uLong)rCpyTabFrm.Value.nSize; } }; struct CR_SetBoxWidth @@ -115,15 +116,15 @@ struct CR_SetBoxWidth SwUndoTblNdsChg* pUndo; SwTwips nDiff, nSide, nMaxSize, nLowerDiff; TblChgMode nMode; - USHORT nTblWidth, nRemainWidth, nBoxWidth; - BOOL bBigger, bLeft, bSplittBox, bAnyBoxFnd; + sal_uInt16 nTblWidth, nRemainWidth, nBoxWidth; + sal_Bool bBigger, bLeft, bSplittBox, bAnyBoxFnd; - CR_SetBoxWidth( USHORT eType, SwTwips nDif, SwTwips nSid, SwTwips nTblW, + CR_SetBoxWidth( sal_uInt16 eType, SwTwips nDif, SwTwips nSid, SwTwips nTblW, SwTwips nMax, SwTableNode* pTNd ) : pTblNd( pTNd ), nDiff( nDif ), nSide( nSid ), nMaxSize( nMax ), nLowerDiff( 0 ), - nTblWidth( (USHORT)nTblW ), nRemainWidth( 0 ), nBoxWidth( 0 ), - bSplittBox( FALSE ), bAnyBoxFnd( FALSE ) + nTblWidth( (sal_uInt16)nTblW ), nRemainWidth( 0 ), nBoxWidth( 0 ), + bSplittBox( sal_False ), bAnyBoxFnd( sal_False ) { bLeft = nsTblChgWidthHeightType::WH_COL_LEFT == ( eType & 0xff ) || nsTblChgWidthHeightType::WH_CELL_LEFT == ( eType & 0xff ); @@ -154,20 +155,20 @@ struct CR_SetBoxWidth nLowerDiff = 0; nRemainWidth = 0; } - void AddBoxWidth( const SwTableBox& rBox, USHORT nWidth ) + void AddBoxWidth( const SwTableBox& rBox, sal_uInt16 nWidth ) { SwTableLinePtr p = (SwTableLine*)rBox.GetUpper(); - USHORT nFndPos; + sal_uInt16 nFndPos; if( aLines.Insert( p, nFndPos )) aLinesWidth.Insert( nWidth, nFndPos ); else aLinesWidth[ nFndPos ] = aLinesWidth[ nFndPos ] + nWidth; } - USHORT GetBoxWidth( const SwTableLine& rLn ) const + sal_uInt16 GetBoxWidth( const SwTableLine& rLn ) const { SwTableLinePtr p = (SwTableLine*)&rLn; - USHORT nFndPos; + sal_uInt16 nFndPos; if( aLines.Seek_Entry( p, &nFndPos ) ) nFndPos = aLinesWidth[ nFndPos ]; else @@ -176,20 +177,20 @@ struct CR_SetBoxWidth } }; -BOOL lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, - SwTwips nDist, BOOL bCheck ); -BOOL lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, - SwTwips nDist, BOOL bCheck ); -BOOL lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, - SwTwips nDist, BOOL bCheck ); -BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, - SwTwips nDist, BOOL bCheck ); -BOOL lcl_DelSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, - SwTwips nDist, BOOL bCheck ); -BOOL lcl_DelOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, - SwTwips nDist, BOOL bCheck ); - -typedef BOOL (*FN_lcl_SetBoxWidth)(SwTableLine*, CR_SetBoxWidth&, SwTwips, BOOL ); +sal_Bool lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, + SwTwips nDist, sal_Bool bCheck ); +sal_Bool lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, + SwTwips nDist, sal_Bool bCheck ); +sal_Bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, + SwTwips nDist, sal_Bool bCheck ); +sal_Bool lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, + SwTwips nDist, sal_Bool bCheck ); +sal_Bool lcl_DelSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, + SwTwips nDist, sal_Bool bCheck ); +sal_Bool lcl_DelOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, + SwTwips nDist, sal_Bool bCheck ); + +typedef sal_Bool (*FN_lcl_SetBoxWidth)(SwTableLine*, CR_SetBoxWidth&, SwTwips, sal_Bool ); #if OSL_DEBUG_LEVEL > 1 @@ -198,13 +199,13 @@ void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize ); #define CHECKBOXWIDTH \ { \ SwTwips nSize = GetFrmFmt()->GetFrmSize().GetWidth(); \ - for( USHORT nTmp = 0; nTmp < aLines.Count(); ++nTmp ) \ + for( sal_uInt16 nTmp = 0; nTmp < aLines.Count(); ++nTmp ) \ ::_CheckBoxWidth( *aLines[ nTmp ], nSize ); \ } #define CHECKTABLELAYOUT \ { \ - for ( USHORT i = 0; i < GetTabLines().Count(); ++i ) \ + for ( sal_uInt16 i = 0; i < GetTabLines().Count(); ++i ) \ { \ SwFrmFmt* pFmt = GetTabLines()[i]->GetFrmFmt(); \ SwClientIter aIter( *pFmt ); \ @@ -240,13 +241,13 @@ struct CR_SetLineHeight SwUndoTblNdsChg* pUndo; SwTwips nMaxSpace, nMaxHeight; TblChgMode nMode; - USHORT nLines; - BOOL bBigger, bTop, bSplittBox, bAnyBoxFnd; + sal_uInt16 nLines; + sal_Bool bBigger, bTop, bSplittBox, bAnyBoxFnd; - CR_SetLineHeight( USHORT eType, SwTableNode* pTNd ) + CR_SetLineHeight( sal_uInt16 eType, SwTableNode* pTNd ) : pTblNd( pTNd ), pUndo( 0 ), nMaxSpace( 0 ), nMaxHeight( 0 ), nLines( 0 ), - bSplittBox( FALSE ), bAnyBoxFnd( FALSE ) + bSplittBox( sal_False ), bAnyBoxFnd( sal_False ) { bTop = nsTblChgWidthHeightType::WH_ROW_TOP == ( eType & 0xff ) || nsTblChgWidthHeightType::WH_CELL_TOP == ( eType & 0xff ); bBigger = 0 != (eType & nsTblChgWidthHeightType::WH_FLAG_BIGGER ); @@ -268,14 +269,14 @@ struct CR_SetLineHeight } }; -BOOL lcl_SetSelLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam, - SwTwips nDist, BOOL bCheck ); -BOOL lcl_SetOtherLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam, - SwTwips nDist, BOOL bCheck ); -BOOL lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, - SwTwips nDist, BOOL bCheck ); +sal_Bool lcl_SetSelLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam, + SwTwips nDist, sal_Bool bCheck ); +sal_Bool lcl_SetOtherLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam, + SwTwips nDist, sal_Bool bCheck ); +sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, + SwTwips nDist, sal_Bool bCheck ); -typedef BOOL (*FN_lcl_SetLineHeight)(SwTableLine*, CR_SetLineHeight&, SwTwips, BOOL ); +typedef sal_Bool (*FN_lcl_SetLineHeight)(SwTableLine*, CR_SetLineHeight&, SwTwips, sal_Bool ); _CpyTabFrm& _CpyTabFrm::operator=( const _CpyTabFrm& rCpyTabFrm ) { @@ -291,21 +292,21 @@ void lcl_DelCpyTabFrmFmts( _CpyTabFrm& rArr ); struct _CpyPara { - boost::shared_ptr< std::vector< std::vector< ULONG > > > pWidths; + boost::shared_ptr< std::vector< std::vector< sal_uLong > > > pWidths; SwDoc* pDoc; SwTableNode* pTblNd; _CpyTabFrms& rTabFrmArr; SwTableLine* pInsLine; SwTableBox* pInsBox; - ULONG nOldSize, nNewSize; // zum Korrigieren der Size-Attribute - ULONG nMinLeft, nMaxRight; - USHORT nCpyCnt, nInsPos; - USHORT nLnIdx, nBoxIdx; - BYTE nDelBorderFlag; - BOOL bCpyCntnt; - - _CpyPara( SwTableNode* pNd, USHORT nCopies, _CpyTabFrms& rFrmArr, - BOOL bCopyContent = TRUE ) + sal_uLong nOldSize, nNewSize; // zum Korrigieren der Size-Attribute + sal_uLong nMinLeft, nMaxRight; + sal_uInt16 nCpyCnt, nInsPos; + sal_uInt16 nLnIdx, nBoxIdx; + sal_uInt8 nDelBorderFlag; + sal_Bool bCpyCntnt; + + _CpyPara( SwTableNode* pNd, sal_uInt16 nCopies, _CpyTabFrms& rFrmArr, + sal_Bool bCopyContent = sal_True ) : pDoc( pNd->GetDoc() ), pTblNd( pNd ), rTabFrmArr(rFrmArr), pInsLine(0), pInsBox(0), nOldSize(0), nNewSize(0), nMinLeft(ULONG_MAX), nMaxRight(0), @@ -332,7 +333,7 @@ struct _CpyPara void SetBoxWidth( SwTableBox* pBox ); }; -BOOL lcl_CopyCol( const _FndBox*& rpFndBox, void* pPara ) +sal_Bool lcl_CopyCol( const _FndBox*& rpFndBox, void* pPara ) { _CpyPara* pCpyPara = (_CpyPara*)pPara; @@ -340,7 +341,7 @@ BOOL lcl_CopyCol( const _FndBox*& rpFndBox, void* pPara ) SwTableBox* pBox = (SwTableBox*)rpFndBox->GetBox(); _CpyTabFrm aFindFrm( (SwTableBoxFmt*)pBox->GetFrmFmt() ); - USHORT nFndPos; + sal_uInt16 nFndPos; if( pCpyPara->nCpyCnt ) { if( !pCpyPara->rTabFrmArr.Seek_Entry( aFindFrm, &nFndPos )) @@ -366,7 +367,7 @@ BOOL lcl_CopyCol( const _FndBox*& rpFndBox, void* pPara ) // die erste Line sollte reichen _FndBoxes& rFndBoxes = pCmpLine->GetBoxes(); long nSz = 0; - for( USHORT n = rFndBoxes.Count(); n; ) + for( sal_uInt16 n = rFndBoxes.Count(); n; ) nSz += rFndBoxes[ --n ]->GetBox()->GetFrmFmt()->GetFrmSize().GetWidth(); aFrmSz.SetWidth( aFrmSz.GetWidth() - nSz / ( pCpyPara->nCpyCnt + 1 ) ); @@ -458,10 +459,10 @@ BOOL lcl_CopyCol( const _FndBox*& rpFndBox, void* pPara ) } } } - return TRUE; + return sal_True; } -BOOL lcl_CopyRow( const _FndLine*& rpFndLine, void* pPara ) +sal_Bool lcl_CopyRow( const _FndLine*& rpFndLine, void* pPara ) { _CpyPara* pCpyPara = (_CpyPara*)pPara; SwTableLine* pNewLine = new SwTableLine( @@ -481,11 +482,11 @@ BOOL lcl_CopyRow( const _FndLine*& rpFndLine, void* pPara ) ((_FndLine*)rpFndLine)->GetBoxes().ForEach( &lcl_CopyCol, &aPara ); pCpyPara->nDelBorderFlag &= 0xf8; - return TRUE; + return sal_True; } -void lcl_InsCol( _FndLine* pFndLn, _CpyPara& rCpyPara, USHORT nCpyCnt, - BOOL bBehind ) +void lcl_InsCol( _FndLine* pFndLn, _CpyPara& rCpyPara, sal_uInt16 nCpyCnt, + sal_Bool bBehind ) { // Bug 29124: nicht nur in den Grundlines kopieren. Wenns geht, so weit // runter wie moeglich. @@ -494,7 +495,7 @@ void lcl_InsCol( _FndLine* pFndLn, _CpyPara& rCpyPara, USHORT nCpyCnt, !( pFBox = pFndLn->GetBoxes()[ 0 ] )->GetBox()->GetSttNd() ) { // eine Box mit mehreren Lines, also in diese Lines einfuegen - for( USHORT n = 0; n < pFBox->GetLines().Count(); ++n ) + for( sal_uInt16 n = 0; n < pFBox->GetLines().Count(); ++n ) lcl_InsCol( pFBox->GetLines()[ n ], rCpyPara, nCpyCnt, bBehind ); } else @@ -506,7 +507,7 @@ void lcl_InsCol( _FndLine* pFndLn, _CpyPara& rCpyPara, USHORT nCpyCnt, if( bBehind ) ++rCpyPara.nInsPos; - for( USHORT n = 0; n < nCpyCnt; ++n ) + for( sal_uInt16 n = 0; n < nCpyCnt; ++n ) { if( n + 1 == nCpyCnt && bBehind ) rCpyPara.nDelBorderFlag = 9; @@ -527,14 +528,14 @@ SwRowFrm* GetRowFrm( SwTableLine& rLine ) return 0; } -BOOL SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) +sal_Bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool bBehind ) { OSL_ENSURE( rBoxes.Count() && nCnt, "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; - BOOL bRes = TRUE; + sal_Bool bRes = sal_True; if( IsNewModel() ) bRes = NewInsertCol( pDoc, rBoxes, nCnt, bBehind ); else @@ -546,7 +547,7 @@ BOOL SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, BOO GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); } if( !aFndBox.GetLines().Count() ) - return FALSE; + return sal_False; SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen @@ -560,7 +561,7 @@ BOOL SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, BOO _CpyTabFrms aTabFrmArr; _CpyPara aCpyPara( pTblNd, nCnt, aTabFrmArr ); - for( USHORT n = 0; n < aFndBox.GetLines().Count(); ++n ) + for( sal_uInt16 n = 0; n < aFndBox.GetLines().Count(); ++n ) lcl_InsCol( aFndBox.GetLines()[ n ], aCpyPara, nCnt, bBehind ); // dann raeume die Struktur dieser Line noch mal auf, generell alle @@ -571,7 +572,7 @@ BOOL SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, BOO CHECKBOXWIDTH; CHECKTABLELAYOUT; - bRes = TRUE; + bRes = sal_True; } SwChartDataProvider *pPCD = pDoc->GetChartDataProvider(); @@ -582,13 +583,13 @@ BOOL SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, BOO return bRes; } -BOOL SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, - USHORT nCnt, BOOL bBehind ) +sal_Bool SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, + sal_uInt16 nCnt, sal_Bool bBehind ) { OSL_ENSURE( pDoc && rBoxes.Count() && nCnt, "keine gueltige Box-Liste" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; // suche alle Boxen / Lines _FndBox aFndBox( 0, 0 ); @@ -597,7 +598,7 @@ BOOL SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); } if( !aFndBox.GetLines().Count() ) - return FALSE; + return sal_False; SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen @@ -617,7 +618,7 @@ BOOL SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, } //Lines fuer das Layout-Update herausuchen. - const BOOL bLayout = !IsNewModel() && + const sal_Bool bLayout = !IsNewModel() && 0 != SwClientIter( *GetFrmFmt() ).First( TYPE(SwTabFrm) ); if ( bLayout ) @@ -650,7 +651,7 @@ BOOL SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, else aCpyPara.nDelBorderFlag = 2; - for( USHORT nCpyCnt = 0; nCpyCnt < nCnt; ++nCpyCnt ) + for( sal_uInt16 nCpyCnt = 0; nCpyCnt < nCnt; ++nCpyCnt ) { if( bBehind ) aCpyPara.nDelBorderFlag = 1; @@ -678,12 +679,12 @@ BOOL SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind ); pDoc->UpdateCharts( GetFrmFmt()->GetName() ); - return TRUE; + return sal_True; } -BOOL _FndBoxAppendRowLine( const SwTableLine*& rpLine, void* pPara ); +sal_Bool _FndBoxAppendRowLine( const SwTableLine*& rpLine, void* pPara ); -BOOL _FndBoxAppendRowBox( const SwTableBox*& rpBox, void* pPara ) +sal_Bool _FndBoxAppendRowBox( const SwTableBox*& rpBox, void* pPara ) { _FndPara* pFndPara = (_FndPara*)pPara; _FndBox* pFndBox = new _FndBox( (SwTableBox*)rpBox, pFndPara->pFndLine ); @@ -697,10 +698,10 @@ BOOL _FndBoxAppendRowBox( const SwTableBox*& rpBox, void* pPara ) else pFndPara->pFndLine->GetBoxes().C40_INSERT( _FndBox, pFndBox, pFndPara->pFndLine->GetBoxes().Count() ); - return TRUE; + return sal_True; } -BOOL _FndBoxAppendRowLine( const SwTableLine*& rpLine, void* pPara ) +sal_Bool _FndBoxAppendRowLine( const SwTableLine*& rpLine, void* pPara ) { _FndPara* pFndPara = (_FndPara*)pPara; _FndLine* pFndLine = new _FndLine( (SwTableLine*)rpLine, pFndPara->pFndBox ); @@ -713,14 +714,14 @@ BOOL _FndBoxAppendRowLine( const SwTableLine*& rpLine, void* pPara ) } else delete pFndLine; - return TRUE; + return sal_True; } -BOOL SwTable::AppendRow( SwDoc* pDoc, USHORT nCnt ) +sal_Bool SwTable::AppendRow( SwDoc* pDoc, sal_uInt16 nCnt ) { SwTableNode* pTblNd = (SwTableNode*)aSortCntBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; // suche alle Boxen / Lines _FndBox aFndBox( 0, 0 ); @@ -733,12 +734,12 @@ BOOL SwTable::AppendRow( SwDoc* pDoc, USHORT nCnt ) _FndBoxAppendRowLine( pLLine, &aPara ); } if( !aFndBox.GetLines().Count() ) - return FALSE; + return sal_False; SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen //Lines fuer das Layout-Update herausuchen. - const BOOL bLayout = 0 != SwClientIter( *GetFrmFmt() ).First( TYPE(SwTabFrm) ); + const sal_Bool bLayout = 0 != SwClientIter( *GetFrmFmt() ).First( TYPE(SwTabFrm) ); if( bLayout ) { aFndBox.SetTableLines( *this ); @@ -751,7 +752,7 @@ BOOL SwTable::AppendRow( SwDoc* pDoc, USHORT nCnt ) aCpyPara.nInsPos = GetTabLines().Count(); aCpyPara.nDelBorderFlag = 1; - for( USHORT nCpyCnt = 0; nCpyCnt < nCnt; ++nCpyCnt ) + for( sal_uInt16 nCpyCnt = 0; nCpyCnt < nCnt; ++nCpyCnt ) { aCpyPara.nDelBorderFlag = 1; aFndBox.GetLines().ForEach( &lcl_CopyRow, &aCpyPara ); @@ -764,7 +765,7 @@ BOOL SwTable::AppendRow( SwDoc* pDoc, USHORT nCnt ) //Layout updaten if ( bLayout ) { - aFndBox.MakeNewFrms( *this, nCnt, TRUE ); + aFndBox.MakeNewFrms( *this, nCnt, sal_True ); } // TL_CHART2: need to inform chart of probably changed cell names pDoc->UpdateCharts( GetFrmFmt()->GetName() ); @@ -772,22 +773,22 @@ BOOL SwTable::AppendRow( SwDoc* pDoc, USHORT nCnt ) CHECKBOXWIDTH; CHECKTABLELAYOUT; - return TRUE; + return sal_True; } void lcl_LastBoxSetWidth( SwTableBoxes &rBoxes, const long nOffset, - BOOL bFirst, SwShareBoxFmts& rShareFmts ); + sal_Bool bFirst, SwShareBoxFmts& rShareFmts ); void lcl_LastBoxSetWidthLine( SwTableLines &rLines, const long nOffset, - BOOL bFirst, SwShareBoxFmts& rShareFmts ) + sal_Bool bFirst, SwShareBoxFmts& rShareFmts ) { - for ( USHORT i = 0; i < rLines.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rLines.Count(); ++i ) ::lcl_LastBoxSetWidth( rLines[i]->GetTabBoxes(), nOffset, bFirst, rShareFmts ); } void lcl_LastBoxSetWidth( SwTableBoxes &rBoxes, const long nOffset, - BOOL bFirst, SwShareBoxFmts& rShareFmts ) + sal_Bool bFirst, SwShareBoxFmts& rShareFmts ) { SwTableBox& rBox = *rBoxes[ bFirst ? 0 : rBoxes.Count() - 1 ]; if( !rBox.GetSttNd() ) @@ -814,7 +815,7 @@ void lcl_LastBoxSetWidth( SwTableBoxes &rBoxes, const long nOffset, } void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, - BOOL bCalcNewSize, const BOOL bCorrBorder, + sal_Bool bCalcNewSize, const sal_Bool bCorrBorder, SwShareBoxFmts* pShareFmts ) { do { @@ -822,13 +823,13 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, pBox->GetFrmFmt()->GetFrmSize().GetWidth() : 0; SwTableLine* pLine = pBox->GetUpper(); SwTableBoxes& rTblBoxes = pLine->GetTabBoxes(); - USHORT nDelPos = rTblBoxes.C40_GETPOS( SwTableBox, pBox ); + sal_uInt16 nDelPos = rTblBoxes.C40_GETPOS( SwTableBox, pBox ); SwTableBox* pUpperBox = pBox->GetUpper()->GetUpper(); // Sonderbehandlung fuer Umrandung: if( bCorrBorder && 1 < rTblBoxes.Count() ) { - BOOL bChgd = FALSE; + sal_Bool bChgd = sal_False; const SvxBoxItem& rBoxItem = pBox->GetFrmFmt()->GetBox(); if( rBoxItem.GetLeft() || rBoxItem.GetRight() ) @@ -853,7 +854,7 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, pShareFmts->SetAttr( *pNxtBox, aTmp ); else pNxtBox->ClaimFrmFmt()->SetFmtAttr( aTmp ); - bChgd = TRUE; + bChgd = sal_True; } } if( !bChgd && nDelPos ) @@ -900,7 +901,7 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, if( rTblBoxes.Count() ) { // dann passe noch die Frame-SSize an - BOOL bLastBox = nDelPos == rTblBoxes.Count(); + sal_Bool bLastBox = nDelPos == rTblBoxes.Count(); if( bLastBox ) --nDelPos; pBox = rTblBoxes[nDelPos]; @@ -948,8 +949,8 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo, SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns, SwTwips nBoxStt, SwTwips nBoxWidth, - USHORT nLinePos, BOOL bNxt, - SwSelBoxes* pAllDelBoxes, USHORT* pCurPos ) + sal_uInt16 nLinePos, sal_Bool bNxt, + SwSelBoxes* pAllDelBoxes, sal_uInt16* pCurPos ) { SwTableBox* pFndBox = 0; do { @@ -960,10 +961,10 @@ SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns, SwTableLine* pLine = rTblLns[ nLinePos ]; SwTwips nFndBoxWidth = 0; SwTwips nFndWidth = nBoxStt + nBoxWidth; - USHORT nBoxCnt = pLine->GetTabBoxes().Count(); + sal_uInt16 nBoxCnt = pLine->GetTabBoxes().Count(); pFndBox = pLine->GetTabBoxes()[ 0 ]; - for( USHORT n = 0; 0 < nFndWidth && n < nBoxCnt; ++n ) + for( sal_uInt16 n = 0; 0 < nFndWidth && n < nBoxCnt; ++n ) { pFndBox = pLine->GetTabBoxes()[ n ]; nFndWidth -= (nFndBoxWidth = pFndBox->GetFrmFmt()-> @@ -986,7 +987,7 @@ SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns, else if( pAllDelBoxes ) { // falls der Vorganger auch geloscht wird, ist nicht zu tun - USHORT nFndPos; + sal_uInt16 nFndPos; if( !pAllDelBoxes->Seek_Entry( pFndBox, &nFndPos ) ) break; @@ -1004,45 +1005,45 @@ SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns, void lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox, SwShareBoxFmts& rShareFmts, SwSelBoxes* pAllDelBoxes = 0, - USHORT* pCurPos = 0 ) + sal_uInt16* pCurPos = 0 ) { //JP 16.04.97: 2.Teil fuer Bug 36271 - BOOL bChgd = FALSE; + sal_Bool bChgd = sal_False; const SwTableLine* pLine = rBox.GetUpper(); const SwTableBoxes& rTblBoxes = pLine->GetTabBoxes(); const SwTableBox* pUpperBox = &rBox; - USHORT nDelPos = rTblBoxes.C40_GETPOS( SwTableBox, pUpperBox ); + sal_uInt16 nDelPos = rTblBoxes.C40_GETPOS( SwTableBox, pUpperBox ); pUpperBox = rBox.GetUpper()->GetUpper(); const SvxBoxItem& rBoxItem = rBox.GetFrmFmt()->GetBox(); // dann die unteren/oberen Kanten if( rBoxItem.GetTop() || rBoxItem.GetBottom() ) { - bChgd = FALSE; + bChgd = sal_False; const SwTableLines* pTblLns; if( pUpperBox ) pTblLns = &pUpperBox->GetTabLines(); else pTblLns = &rTbl.GetTabLines(); - USHORT nLnPos = pTblLns->GetPos( pLine ); + sal_uInt16 nLnPos = pTblLns->GetPos( pLine ); // bestimme die Attr.Position der akt. zu loeschenden Box // und suche dann in der unteren / oberen Line die entspr. // Gegenstuecke SwTwips nBoxStt = 0; - for( USHORT n = 0; n < nDelPos; ++n ) + for( sal_uInt16 n = 0; n < nDelPos; ++n ) nBoxStt += rTblBoxes[ n ]->GetFrmFmt()->GetFrmSize().GetWidth(); SwTwips nBoxWidth = rBox.GetFrmFmt()->GetFrmSize().GetWidth(); SwTableBox *pPrvBox = 0, *pNxtBox = 0; if( nLnPos ) // Vorgaenger? pPrvBox = ::lcl_FndNxtPrvDelBox( *pTblLns, nBoxStt, nBoxWidth, - nLnPos, FALSE, pAllDelBoxes, pCurPos ); + nLnPos, sal_False, pAllDelBoxes, pCurPos ); if( nLnPos + 1 < pTblLns->Count() ) // Nachfolger? pNxtBox = ::lcl_FndNxtPrvDelBox( *pTblLns, nBoxStt, nBoxWidth, - nLnPos, TRUE, pAllDelBoxes, pCurPos ); + nLnPos, sal_True, pAllDelBoxes, pCurPos ); if( pNxtBox && pNxtBox->GetSttNd() ) { @@ -1055,7 +1056,7 @@ void lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox, : rBoxItem.GetBottom(), BOX_LINE_TOP ); rShareFmts.SetAttr( *pNxtBox, aTmp ); - bChgd = TRUE; + bChgd = sal_True; } } if( !bChgd && pPrvBox && pPrvBox->GetSttNd() ) @@ -1075,12 +1076,12 @@ void lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox, } } -BOOL SwTable::DeleteSel( +sal_Bool SwTable::DeleteSel( SwDoc* pDoc , const SwSelBoxes& rBoxes, const SwSelBoxes* pMerged, SwUndo* pUndo, - const BOOL bDelMakeFrms, const BOOL bCorrBorder ) + const sal_Bool bDelMakeFrms, const sal_Bool bCorrBorder ) { OSL_ENSURE( pDoc, "No doc?" ); SwTableNode* pTblNd = 0; @@ -1088,7 +1089,7 @@ BOOL SwTable::DeleteSel( { pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; } SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen @@ -1111,7 +1112,7 @@ BOOL SwTable::DeleteSel( { SwSelBoxes aBoxes; aBoxes.Insert( &rBoxes ); - for( USHORT n = 0; n < aBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < aBoxes.Count(); ++n ) ::lcl_SaveUpperLowerBorder( *this, *rBoxes[ n ], aShareFmts, &aBoxes, &n ); } @@ -1121,9 +1122,9 @@ BOOL SwTable::DeleteSel( SwChartDataProvider *pPCD = pDoc->GetChartDataProvider(); // // delete boxes from last to first - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) { - USHORT nIdx = rBoxes.Count() - 1 - n; + sal_uInt16 nIdx = rBoxes.Count() - 1 - n; // first adapt the data-sequence for chart if necessary // (needed to move the implementation cursor properly to it's new @@ -1132,7 +1133,7 @@ BOOL SwTable::DeleteSel( pPCD->DeleteBox( &pTblNd->GetTable(), *rBoxes[nIdx] ); // ... then delete the boxes - _DeleteBox( *this, rBoxes[nIdx], pUndo, TRUE, bCorrBorder, &aShareFmts ); + _DeleteBox( *this, rBoxes[nIdx], pUndo, sal_True, bCorrBorder, &aShareFmts ); } // dann raeume die Struktur aller Lines auf @@ -1147,16 +1148,16 @@ BOOL SwTable::DeleteSel( CHECKTABLELAYOUT; CHECK_TABLE( *this ); - return TRUE; + return sal_True; } -BOOL SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, - BOOL bSameHeight ) +sal_Bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, + sal_Bool bSameHeight ) { OSL_ENSURE( pDoc && rBoxes.Count() && nCnt, "keine gueltigen Werte" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; // TL_CHART2: splitting/merging of a number of cells or rows will usually make // the table to complex to be handled with chart. @@ -1171,7 +1172,7 @@ BOOL SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, if ( bSameHeight ) { pRowHeights = new long[ rBoxes.Count() ]; - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) { SwTableBox* pSelBox = *( rBoxes.GetData() + n ); const SwRowFrm* pRow = GetRowFrm( *pSelBox->GetUpper() ); @@ -1186,7 +1187,7 @@ BOOL SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, aFndBox.SetTableLines( rBoxes, *this ); aFndBox.DelFrms( *this ); - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) { SwTableBox* pSelBox = *( rBoxes.GetData() + n ); OSL_ENSURE( pSelBox, "Box steht nicht in der Tabelle" ); @@ -1200,13 +1201,13 @@ BOOL SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, if ( bSameHeight && ATT_VAR_SIZE == aFSz.GetHeightSizeType() ) aFSz.SetHeightSizeType( ATT_MIN_SIZE ); - BOOL bChgLineSz = 0 != aFSz.GetHeight() || bSameHeight; + sal_Bool bChgLineSz = 0 != aFSz.GetHeight() || bSameHeight; if ( bChgLineSz ) aFSz.SetHeight( ( bSameHeight ? pRowHeights[ n ] : aFSz.GetHeight() ) / (nCnt + 1) ); SwTableBox* pNewBox = new SwTableBox( pFrmFmt, nCnt, pInsLine ); - USHORT nBoxPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSelBox ); + sal_uInt16 nBoxPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSelBox ); pInsLine->GetTabBoxes().Remove( nBoxPos ); // alte loeschen pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pNewBox, nBoxPos ); @@ -1214,24 +1215,24 @@ BOOL SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, SwTableBox* pLastBox = pSelBox; // zum verteilen der TextNodes !! // sollte Bereiche in der Box stehen, dann bleibt sie so bestehen // !! FALLS DAS GEAENDERT WIRD MUSS DAS UNDO ANGEPASST WERDEN !!! - BOOL bMoveNodes = TRUE; + sal_Bool bMoveNodes = sal_True; { - ULONG nSttNd = pLastBox->GetSttIdx() + 1, + sal_uLong nSttNd = pLastBox->GetSttIdx() + 1, nEndNd = pLastBox->GetSttNd()->EndOfSectionIndex(); while( nSttNd < nEndNd ) if( !pDoc->GetNodes()[ nSttNd++ ]->IsTxtNode() ) { - bMoveNodes = FALSE; + bMoveNodes = sal_False; break; } } SwTableBoxFmt* pCpyBoxFrmFmt = (SwTableBoxFmt*)pSelBox->GetFrmFmt(); - BOOL bChkBorder = 0 != pCpyBoxFrmFmt->GetBox().GetTop(); + sal_Bool bChkBorder = 0 != pCpyBoxFrmFmt->GetBox().GetTop(); if( bChkBorder ) pCpyBoxFrmFmt = (SwTableBoxFmt*)pSelBox->ClaimFrmFmt(); - for( USHORT i = 0; i <= nCnt; ++i ) + for( sal_uInt16 i = 0; i <= nCnt; ++i ) { // also erstmal eine neue Linie in der neuen Box SwTableLine* pNewLine = new SwTableLine( @@ -1259,7 +1260,7 @@ BOOL SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, SvxBoxItem aTmp( pCpyBoxFrmFmt->GetBox() ); aTmp.SetLine( 0, BOX_LINE_TOP ); pCpyBoxFrmFmt->SetFmtAttr( aTmp ); - bChkBorder = FALSE; + bChkBorder = sal_False; } if( bMoveNodes ) @@ -1271,7 +1272,7 @@ BOOL SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, SwNodeRange aRg( *pLastBox->GetSttNd(), +2, *pEndNd ); pLastBox = pNewLine->GetTabBoxes()[0]; // neu setzen SwNodeIndex aInsPos( *pLastBox->GetSttNd(), 1 ); - pDoc->GetNodes()._MoveNodes(aRg, pDoc->GetNodes(), aInsPos, FALSE); + pDoc->GetNodes()._MoveNodes(aRg, pDoc->GetNodes(), aInsPos, sal_False); pDoc->GetNodes().Delete( aInsPos, 1 ); // den leeren noch loeschen } } @@ -1291,15 +1292,15 @@ BOOL SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt, CHECKBOXWIDTH CHECKTABLELAYOUT - return TRUE; + return sal_True; } -BOOL SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt ) +sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt ) { OSL_ENSURE( pDoc && rBoxes.Count() && nCnt, "keine gueltigen Werte" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; // TL_CHART2: splitting/merging of a number of cells or rows will usually make // the table to complex to be handled with chart. @@ -1318,8 +1319,8 @@ BOOL SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt ) _CpyTabFrms aFrmArr; SvPtrarr aLastBoxArr; - USHORT nFndPos; - for( USHORT n = 0; n < aSelBoxes.Count(); ++n ) + sal_uInt16 nFndPos; + for( sal_uInt16 n = 0; n < aSelBoxes.Count(); ++n ) { SwTableBox* pSelBox = *( aSelBoxes.GetData() + n ); OSL_ENSURE( pSelBox, "Box steht nicht in der Tabelle" ); @@ -1330,7 +1331,7 @@ BOOL SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt ) // dann teile die Box nCnt in nCnt Boxen SwTableLine* pInsLine = pSelBox->GetUpper(); - USHORT nBoxPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSelBox ); + sal_uInt16 nBoxPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, pSelBox ); // suche das FrmFmt im Array aller Frame-Formate SwTableBoxFmt* pLastBoxFmt; @@ -1365,7 +1366,7 @@ BOOL SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt ) } // dann fuege mal an der Position die neuen Boxen ein - for( USHORT i = 1; i < nCnt; ++i ) + for( sal_uInt16 i = 1; i < nCnt; ++i ) ::_InsTblBox( pDoc, pTblNd, pInsLine, aFindFrm.pNewFrmFmt, pSelBox, nBoxPos + i ); // dahinter einfuegen @@ -1383,7 +1384,7 @@ BOOL SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt ) aFindFrm.pNewFrmFmt->SetFmtAttr( aTmp ); // und dann das Format aus dem "cache" entfernen - for( USHORT i = aFrmArr.Count(); i; ) + for( sal_uInt16 i = aFrmArr.Count(); i; ) { const _CpyTabFrm& rCTF = aFrmArr[ --i ]; if( rCTF.pNewFrmFmt == aFindFrm.pNewFrmFmt || @@ -1401,7 +1402,7 @@ BOOL SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt ) CHECKBOXWIDTH CHECKTABLELAYOUT - return TRUE; + return sal_True; } /* @@ -1418,12 +1419,12 @@ BOOL SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt ) ----------------------- >> MERGE << ------------------------ */ -void lcl_CpyLines( USHORT nStt, USHORT nEnd, +void lcl_CpyLines( sal_uInt16 nStt, sal_uInt16 nEnd, SwTableLines& rLines, SwTableBox* pInsBox, - USHORT nPos = USHRT_MAX ) + sal_uInt16 nPos = USHRT_MAX ) { - for( USHORT n = nStt; n < nEnd; ++n ) + for( sal_uInt16 n = nStt; n < nEnd; ++n ) rLines[n]->SetUpper( pInsBox ); if( USHRT_MAX == nPos ) nPos = pInsBox->GetTabLines().Count(); @@ -1431,12 +1432,12 @@ void lcl_CpyLines( USHORT nStt, USHORT nEnd, rLines.Remove( nStt, nEnd - nStt ); } -void lcl_CpyBoxes( USHORT nStt, USHORT nEnd, +void lcl_CpyBoxes( sal_uInt16 nStt, sal_uInt16 nEnd, SwTableBoxes& rBoxes, SwTableLine* pInsLine, - USHORT nPos = USHRT_MAX ) + sal_uInt16 nPos = USHRT_MAX ) { - for( USHORT n = nStt; n < nEnd; ++n ) + for( sal_uInt16 n = nStt; n < nEnd; ++n ) rBoxes[n]->SetUpper( pInsLine ); if( USHRT_MAX == nPos ) nPos = pInsLine->GetTabBoxes().Count(); @@ -1454,7 +1455,7 @@ void lcl_CalcWidth( SwTableBox* pBox ) OSL_ENSURE( pLine, "Box steht in keiner Line" ); long nWidth = 0; - for( USHORT n = 0; n < pLine->GetTabBoxes().Count(); ++n ) + for( sal_uInt16 n = 0; n < pLine->GetTabBoxes().Count(); ++n ) nWidth += pLine->GetTabBoxes()[n]->GetFrmFmt()->GetFrmSize().GetWidth(); pFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth, 0 )); @@ -1469,14 +1470,14 @@ struct _InsULPara SwTableNode* pTblNd; SwTableLine* pInsLine; SwTableBox* pInsBox; - BOOL bUL_LR : 1; // Upper-Lower(TRUE) oder Left-Right(FALSE) ? - BOOL bUL : 1; // Upper-Left(TRUE) oder Lower-Right(FALSE) ? + sal_Bool bUL_LR : 1; // Upper-Lower(sal_True) oder Left-Right(sal_False) ? + sal_Bool bUL : 1; // Upper-Left(sal_True) oder Lower-Right(sal_False) ? SwTableBox* pLeftBox; SwTableBox* pRightBox; SwTableBox* pMergeBox; - _InsULPara( SwTableNode* pTNd, BOOL bUpperLower, BOOL bUpper, + _InsULPara( SwTableNode* pTNd, sal_Bool bUpperLower, sal_Bool bUpper, SwTableBox* pLeft, SwTableBox* pMerge, SwTableBox* pRight, SwTableLine* pLine=0, SwTableBox* pBox=0 ) : pTblNd( pTNd ), pInsLine( pLine ), pInsBox( pBox ), @@ -1484,25 +1485,25 @@ struct _InsULPara { bUL_LR = bUpperLower; bUL = bUpper; } void SetLeft( SwTableBox* pBox=0 ) - { bUL_LR = FALSE; bUL = TRUE; if( pBox ) pInsBox = pBox; } + { bUL_LR = sal_False; bUL = sal_True; if( pBox ) pInsBox = pBox; } void SetRight( SwTableBox* pBox=0 ) - { bUL_LR = FALSE; bUL = FALSE; if( pBox ) pInsBox = pBox; } + { bUL_LR = sal_False; bUL = sal_False; if( pBox ) pInsBox = pBox; } void SetUpper( SwTableLine* pLine=0 ) - { bUL_LR = TRUE; bUL = TRUE; if( pLine ) pInsLine = pLine; } + { bUL_LR = sal_True; bUL = sal_True; if( pLine ) pInsLine = pLine; } void SetLower( SwTableLine* pLine=0 ) - { bUL_LR = TRUE; bUL = FALSE; if( pLine ) pInsLine = pLine; } + { bUL_LR = sal_True; bUL = sal_False; if( pLine ) pInsLine = pLine; } }; -BOOL lcl_Merge_MoveBox( const _FndBox*& rpFndBox, void* pPara ) +sal_Bool lcl_Merge_MoveBox( const _FndBox*& rpFndBox, void* pPara ) { _InsULPara* pULPara = (_InsULPara*)pPara; SwTableBoxes* pBoxes; - USHORT nStt = 0, nEnd = rpFndBox->GetLines().Count(); - USHORT nInsPos = USHRT_MAX; + sal_uInt16 nStt = 0, nEnd = rpFndBox->GetLines().Count(); + sal_uInt16 nInsPos = USHRT_MAX; if( !pULPara->bUL_LR ) // Left/Right { - USHORT nPos; + sal_uInt16 nPos; SwTableBox* pFndBox = (SwTableBox*)rpFndBox->GetBox(); pBoxes = &pFndBox->GetUpper()->GetTabBoxes(); if( pULPara->bUL ) // Left ? @@ -1549,19 +1550,19 @@ BOOL lcl_Merge_MoveBox( const _FndBox*& rpFndBox, void* pPara ) else delete pBox; } - return TRUE; + return sal_True; } -BOOL lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara ) +sal_Bool lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara ) { _InsULPara* pULPara = (_InsULPara*)pPara; SwTableLines* pLines; - USHORT nStt = 0, nEnd = rpFndLine->GetBoxes().Count(); - USHORT nInsPos = USHRT_MAX; + sal_uInt16 nStt = 0, nEnd = rpFndLine->GetBoxes().Count(); + sal_uInt16 nInsPos = USHRT_MAX; if( pULPara->bUL_LR ) // UpperLower ? { - USHORT nPos; + sal_uInt16 nPos; SwTableLine* pFndLn = (SwTableLine*)rpFndLine->GetLine(); pLines = pFndLn->GetUpper() ? &pFndLn->GetUpper()->GetTabLines() : @@ -1570,8 +1571,8 @@ BOOL lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara ) SwTableBox* pLBx = rpFndLine->GetBoxes()[0]->GetBox(); SwTableBox* pRBx = rpFndLine->GetBoxes()[ rpFndLine->GetBoxes().Count()-1]->GetBox(); - USHORT nLeft = pFndLn->GetTabBoxes().C40_GETPOS( SwTableBox, pLBx ); - USHORT nRight = pFndLn->GetTabBoxes().C40_GETPOS( SwTableBox, pRBx ); + sal_uInt16 nLeft = pFndLn->GetTabBoxes().C40_GETPOS( SwTableBox, pLBx ); + sal_uInt16 nRight = pFndLn->GetTabBoxes().C40_GETPOS( SwTableBox, pRBx ); if( !nLeft || nRight == pFndLn->GetTabBoxes().Count() ) { @@ -1649,7 +1650,7 @@ BOOL lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara ) // Right auch mit in die Line pInsLine = pULPara->pLeftBox->GetUpper(); - USHORT nMvPos = pULPara->pRightBox->GetUpper()->GetTabBoxes(). + sal_uInt16 nMvPos = pULPara->pRightBox->GetUpper()->GetTabBoxes(). C40_GETPOS( SwTableBox, pULPara->pRightBox ); lcl_CpyBoxes( nMvPos, nMvPos+1, pULPara->pRightBox->GetUpper()->GetTabBoxes(), @@ -1671,7 +1672,7 @@ BOOL lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara ) pRMBox = new SwTableBox( (SwTableBoxFmt*)pRMBox->GetFrmFmt(), 0, pNewLn ); pNewLn->GetTabBoxes().C40_INSERT( SwTableBox, pRMBox, 0 ); - USHORT nPos1, nPos2; + sal_uInt16 nPos1, nPos2; if( pULPara->bUL ) nPos1 = 0, nPos2 = nMvPos; @@ -1702,7 +1703,7 @@ BOOL lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara ) lcl_CalcWidth( pRMBox ); // bereche die Breite der Box } else { - OSL_ENSURE( FALSE , "Was denn nun" ); + OSL_ENSURE( sal_False, "Was denn nun" ); } } // Left/Right @@ -1729,16 +1730,16 @@ BOOL lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara ) else delete pNewLine; - return TRUE; + return sal_True; } -BOOL SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, +sal_Bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, SwTableBox* pMergeBox, SwUndoTblMerge* pUndo ) { OSL_ENSURE( rBoxes.Count() && pMergeBox, "keine gueltigen Werte" ); SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode(); if( !pTblNd ) - return FALSE; + return sal_False; // suche alle Boxen / Lines _FndBox aFndBox( 0, 0 ); @@ -1747,7 +1748,7 @@ BOOL SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, GetTabLines().ForEach( &_FndLineCopyCol, &aPara ); } if( !aFndBox.GetLines().Count() ) - return FALSE; + return sal_False; // TL_CHART2: splitting/merging of a number of cells or rows will usually make // the table to complex to be handled with chart. @@ -1778,7 +1779,7 @@ BOOL SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, &pFndBox->GetBox()->GetTabLines() : &GetTabLines(); SwTableLine* pNewLine = pFndBox->GetLines()[0]->GetLine(); - USHORT nInsPos = pLines->C40_GETPOS( SwTableLine, pNewLine ); + sal_uInt16 nInsPos = pLines->C40_GETPOS( SwTableLine, pNewLine ); pLines->C40_INSERT( SwTableLine, pInsLine, nInsPos ); SwTableBox* pLeftBox = new SwTableBox( (SwTableBoxFmt*)pMergeBox->GetFrmFmt(), 0, pInsLine ); @@ -1792,13 +1793,13 @@ BOOL SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, // in diese kommen alle Lines, die ueber dem selektierten Bereich stehen // Sie bilden also eine Upper/Lower Line - _InsULPara aPara( pTblNd, TRUE, TRUE, pLeftBox, pMergeBox, pRightBox, pInsLine ); + _InsULPara aPara( pTblNd, sal_True, sal_True, pLeftBox, pMergeBox, pRightBox, pInsLine ); // move die oben/unten ueberhaengenden Lines vom selektierten Bereich pFndBox->GetLines()[0]->GetBoxes().ForEach( &lcl_Merge_MoveBox, &aPara ); aPara.SetLower( pInsLine ); - USHORT nEnd = pFndBox->GetLines().Count()-1; + sal_uInt16 nEnd = pFndBox->GetLines().Count()-1; pFndBox->GetLines()[nEnd]->GetBoxes().ForEach( &lcl_Merge_MoveBox, &aPara ); @@ -1810,7 +1811,7 @@ BOOL SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, pFndBox->GetLines().ForEach( &lcl_Merge_MoveLine, &aPara ); if( !pLeftBox->GetTabLines().Count() ) - _DeleteBox( *this, pLeftBox, 0, FALSE, FALSE ); + _DeleteBox( *this, pLeftBox, 0, sal_False, sal_False ); else { lcl_CalcWidth( pLeftBox ); // bereche die Breite der Box @@ -1818,7 +1819,7 @@ BOOL SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, pUndo->AddNewBox( pLeftBox->GetSttIdx() ); } if( !pRightBox->GetTabLines().Count() ) - _DeleteBox( *this, pRightBox, 0, FALSE, FALSE ); + _DeleteBox( *this, pRightBox, 0, sal_False, sal_False ); else { lcl_CalcWidth( pRightBox ); // bereche die Breite der Box @@ -1826,7 +1827,7 @@ BOOL SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, pUndo->AddNewBox( pRightBox->GetSttIdx() ); } - DeleteSel( pDoc, rBoxes, 0, 0, FALSE, FALSE ); + DeleteSel( pDoc, rBoxes, 0, 0, sal_False, sal_False ); // dann raeume die Struktur dieser Line noch mal auf: // generell alle Aufraeumen @@ -1839,18 +1840,18 @@ BOOL SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, CHECKBOXWIDTH CHECKTABLELAYOUT - return TRUE; + return sal_True; } void lcl_CheckRowSpan( SwTable &rTbl ) { - USHORT nLineCount = rTbl.GetTabLines().Count(); - USHORT nMaxSpan = nLineCount; + sal_uInt16 nLineCount = rTbl.GetTabLines().Count(); + sal_uInt16 nMaxSpan = nLineCount; long nMinSpan = 1; while( nMaxSpan ) { SwTableLine* pLine = rTbl.GetTabLines()[ nLineCount - nMaxSpan ]; - for( USHORT nBox = 0; nBox < pLine->GetTabBoxes().Count(); ++nBox ) + for( sal_uInt16 nBox = 0; nBox < pLine->GetTabBoxes().Count(); ++nBox ) { SwTableBox* pBox = pLine->GetTabBoxes()[nBox]; long nRowSpan = pBox->getRowSpan(); @@ -1864,31 +1865,31 @@ void lcl_CheckRowSpan( SwTable &rTbl ) } } -USHORT lcl_GetBoxOffset( const _FndBox& rBox ) +sal_uInt16 lcl_GetBoxOffset( const _FndBox& rBox ) { // suche die erste Box const _FndBox* pFirstBox = &rBox; while( pFirstBox->GetLines().Count() ) pFirstBox = pFirstBox->GetLines()[ 0 ]->GetBoxes()[ 0 ]; - USHORT nRet = 0; + sal_uInt16 nRet = 0; // dann ueber die Lines nach oben die Position bestimmen const SwTableBox* pBox = pFirstBox->GetBox(); do { const SwTableBoxes& rBoxes = pBox->GetUpper()->GetTabBoxes(); const SwTableBox* pCmp; - for( USHORT n = 0; pBox != ( pCmp = rBoxes[ n ] ); ++n ) - nRet = nRet + (USHORT) pCmp->GetFrmFmt()->GetFrmSize().GetWidth(); + for( sal_uInt16 n = 0; pBox != ( pCmp = rBoxes[ n ] ); ++n ) + nRet = nRet + (sal_uInt16) pCmp->GetFrmFmt()->GetFrmSize().GetWidth(); pBox = pBox->GetUpper()->GetUpper(); } while( pBox ); return nRet; } -USHORT lcl_GetLineWidth( const _FndLine& rLine ) +sal_uInt16 lcl_GetLineWidth( const _FndLine& rLine ) { - USHORT nRet = 0; - for( USHORT n = rLine.GetBoxes().Count(); n; ) - nRet = nRet + (USHORT)rLine.GetBoxes()[ --n ]->GetBox()->GetFrmFmt() + sal_uInt16 nRet = 0; + for( sal_uInt16 n = rLine.GetBoxes().Count(); n; ) + nRet = nRet + (sal_uInt16)rLine.GetBoxes()[ --n ]->GetBox()->GetFrmFmt() ->GetFrmSize().GetWidth(); return nRet; } @@ -1896,27 +1897,27 @@ USHORT lcl_GetLineWidth( const _FndLine& rLine ) void lcl_CalcNewWidths( const _FndLines& rFndLines, _CpyPara& rPara ) { rPara.pWidths.reset(); - USHORT nLineCount = rFndLines.Count(); + sal_uInt16 nLineCount = rFndLines.Count(); if( nLineCount ) { - rPara.pWidths = boost::shared_ptr< std::vector< std::vector< ULONG > > > - ( new std::vector< std::vector< ULONG > >( nLineCount )); + rPara.pWidths = boost::shared_ptr< std::vector< std::vector< sal_uLong > > > + ( new std::vector< std::vector< sal_uLong > >( nLineCount )); // First we collect information about the left/right borders of all // selected cells - for( USHORT nLine = 0; nLine < nLineCount; ++nLine ) + for( sal_uInt16 nLine = 0; nLine < nLineCount; ++nLine ) { - std::vector< ULONG > &rWidth = (*rPara.pWidths.get())[ nLine ]; + std::vector< sal_uLong > &rWidth = (*rPara.pWidths.get())[ nLine ]; const _FndLine *pFndLine = rFndLines[ nLine ]; if( pFndLine && pFndLine->GetBoxes().Count() ) { const SwTableLine *pLine = pFndLine->GetLine(); if( pLine && pLine->GetTabBoxes().Count() ) { - USHORT nBoxCount = pLine->GetTabBoxes().Count(); - ULONG nPos = 0; + sal_uInt16 nBoxCount = pLine->GetTabBoxes().Count(); + sal_uLong nPos = 0; // The first selected box... const SwTableBox *pSel = pFndLine->GetBoxes()[0]->GetBox(); - USHORT nBox = 0; + sal_uInt16 nBox = 0; // Sum up the width of all boxes before the first selected box while( nBox < nBoxCount ) { @@ -1930,7 +1931,7 @@ void lcl_CalcNewWidths( const _FndLines& rFndLines, _CpyPara& rPara ) if( rPara.nMinLeft > nPos ) rPara.nMinLeft = nPos; nBoxCount = pFndLine->GetBoxes().Count(); - rWidth = std::vector< ULONG >( nBoxCount+2 ); + rWidth = std::vector< sal_uLong >( nBoxCount+2 ); rWidth[ 0 ] = nPos; // Add now the widths of all selected boxes and store // the positions in the vector @@ -1950,39 +1951,39 @@ void lcl_CalcNewWidths( const _FndLines& rFndLines, _CpyPara& rPara ) } } // Second step: calculate the new widths for the copied cells - ULONG nSelSize = rPara.nMaxRight - rPara.nMinLeft; + sal_uLong nSelSize = rPara.nMaxRight - rPara.nMinLeft; if( nSelSize ) { - for( USHORT nLine = 0; nLine < nLineCount; ++nLine ) + for( sal_uInt16 nLine = 0; nLine < nLineCount; ++nLine ) { - std::vector< ULONG > &rWidth = (*rPara.pWidths.get())[ nLine ]; - USHORT nCount = (USHORT)rWidth.size(); + std::vector< sal_uLong > &rWidth = (*rPara.pWidths.get())[ nLine ]; + sal_uInt16 nCount = (sal_uInt16)rWidth.size(); if( nCount > 2 ) { rWidth[ nCount - 1 ] = rPara.nMaxRight; - ULONG nLastPos = 0; - for( USHORT nBox = 0; nBox < nCount; ++nBox ) + sal_uLong nLastPos = 0; + for( sal_uInt16 nBox = 0; nBox < nCount; ++nBox ) { sal_uInt64 nNextPos = rWidth[ nBox ]; nNextPos -= rPara.nMinLeft; nNextPos *= rPara.nNewSize; nNextPos /= nSelSize; - rWidth[ nBox ] = (ULONG)(nNextPos - nLastPos); - nLastPos = (ULONG)nNextPos; + rWidth[ nBox ] = (sal_uLong)(nNextPos - nLastPos); + nLastPos = (sal_uLong)nNextPos; } } } } } -BOOL lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara ) +sal_Bool lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara ) { _CpyPara* pCpyPara = (_CpyPara*)pPara; // Calculation of new size - ULONG nRealSize; - ULONG nDummy1 = 0; - ULONG nDummy2 = 0; + sal_uLong nRealSize; + sal_uLong nDummy1 = 0; + sal_uLong nDummy2 = 0; if( pCpyPara->pTblNd->GetTable().IsNewModel() ) { if( pCpyPara->nBoxIdx == 1 ) @@ -1998,7 +1999,7 @@ BOOL lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara ) nRealSize /= pCpyPara->nOldSize; } - ULONG nSize; + sal_uLong nSize; bool bDummy = nDummy1 > 0; if( bDummy ) nSize = nDummy1; @@ -2013,7 +2014,7 @@ BOOL lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara ) _CpyTabFrm aFindFrm( (SwTableBoxFmt*)rpFndBox->GetBox()->GetFrmFmt() ); SwFmtFrmSize aFrmSz; - USHORT nFndPos; + sal_uInt16 nFndPos; if( !pCpyPara->rTabFrmArr.Seek_Entry( aFindFrm, &nFndPos ) || ( aFrmSz = ( aFindFrm = pCpyPara->rTabFrmArr[ nFndPos ]).pNewFrmFmt-> GetFrmSize()).GetWidth() != (SwTwips)nSize ) @@ -2062,12 +2063,12 @@ BOOL lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara ) if( aBoxAttrSet.Count() ) { const SfxPoolItem* pItem; - SvNumberFormatter* pN = pCpyPara->pDoc->GetNumberFormatter( FALSE ); + SvNumberFormatter* pN = pCpyPara->pDoc->GetNumberFormatter( sal_False ); if( pN && pN->HasMergeFmtTbl() && SFX_ITEM_SET == aBoxAttrSet. - GetItemState( RES_BOXATR_FORMAT, FALSE, &pItem ) ) + GetItemState( RES_BOXATR_FORMAT, sal_False, &pItem ) ) { - ULONG nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue(); - ULONG nNewIdx = pN->GetMergeFmtIndex( nOldIdx ); + sal_uLong nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue(); + sal_uLong nNewIdx = pN->GetMergeFmtIndex( nOldIdx ); if( nNewIdx != nOldIdx ) aBoxAttrSet.Put( SwTblBoxNumFormat( nNewIdx )); } @@ -2079,7 +2080,7 @@ BOOL lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara ) *rpFndBox->GetBox()->GetSttNd()->EndOfSectionNode() ); SwNodeIndex aInsIdx( *pBox->GetSttNd(), 1 ); - pFromDoc->CopyWithFlyInFly( aCpyRg, 0, aInsIdx, FALSE ); + pFromDoc->CopyWithFlyInFly( aCpyRg, 0, aInsIdx, sal_False ); // den initialen TextNode loeschen pCpyPara->pDoc->GetNodes().Delete( aInsIdx, 1 ); } @@ -2099,16 +2100,16 @@ BOOL lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara ) } } while( nSize ); - return TRUE; + return sal_True; } -BOOL lcl_CopyLineToDoc( const _FndLine*& rpFndLine, void* pPara ) +sal_Bool lcl_CopyLineToDoc( const _FndLine*& rpFndLine, void* pPara ) { _CpyPara* pCpyPara = (_CpyPara*)pPara; // suche das Format in der Liste aller Formate _CpyTabFrm aFindFrm( (SwTableBoxFmt*)rpFndLine->GetLine()->GetFrmFmt() ); - USHORT nFndPos; + sal_uInt16 nFndPos; if( !pCpyPara->rTabFrmArr.Seek_Entry( aFindFrm, &nFndPos )) { // es ist noch nicht vorhanden, also kopiere es @@ -2152,23 +2153,23 @@ BOOL lcl_CopyLineToDoc( const _FndLine*& rpFndLine, void* pPara ) } else // errechne sie - for( USHORT n = 0; n < rpFndLine->GetBoxes().Count(); ++n ) + for( sal_uInt16 n = 0; n < rpFndLine->GetBoxes().Count(); ++n ) aPara.nOldSize += rpFndLine->GetBoxes()[n] ->GetBox()->GetFrmFmt()->GetFrmSize().GetWidth(); ((_FndLine*)rpFndLine)->GetBoxes().ForEach( &lcl_CopyBoxToDoc, &aPara ); if( pCpyPara->pTblNd->GetTable().IsNewModel() ) ++pCpyPara->nLnIdx; - return TRUE; + return sal_True; } -BOOL SwTable::CopyHeadlineIntoTable( SwTableNode& rTblNd ) +sal_Bool SwTable::CopyHeadlineIntoTable( SwTableNode& rTblNd ) { // suche alle Boxen / Lines SwSelBoxes aSelBoxes; SwTableBox* pBox = GetTabSortBoxes()[ 0 ]; pBox = GetTblBox( pBox->GetSttNd()->StartOfSectionNode()->GetIndex() + 1 ); - SelLineFromBox( pBox, aSelBoxes, TRUE ); + SelLineFromBox( pBox, aSelBoxes, sal_True ); _FndBox aFndBox( 0, 0 ); { @@ -2176,7 +2177,7 @@ BOOL SwTable::CopyHeadlineIntoTable( SwTableNode& rTblNd ) ((SwTableLines&)GetTabLines()).ForEach( &_FndLineCopyCol, &aPara ); } if( !aFndBox.GetLines().Count() ) - return FALSE; + return sal_False; { // Tabellen-Formeln in die relative Darstellung umwandeln @@ -2186,7 +2187,7 @@ BOOL SwTable::CopyHeadlineIntoTable( SwTableNode& rTblNd ) } _CpyTabFrms aCpyFmt; - _CpyPara aPara( &rTblNd, 1, aCpyFmt, TRUE ); + _CpyPara aPara( &rTblNd, 1, aCpyFmt, sal_True ); aPara.nNewSize = aPara.nOldSize = rTblNd.GetTable().GetFrmFmt()->GetFrmSize().GetWidth(); // dann kopiere mal if( IsNewModel() ) @@ -2195,9 +2196,9 @@ BOOL SwTable::CopyHeadlineIntoTable( SwTableNode& rTblNd ) if( rTblNd.GetTable().IsNewModel() ) { // The copied line must not contain any row span attributes > 1 SwTableLine* pLine = rTblNd.GetTable().GetTabLines()[0]; - USHORT nColCount = pLine->GetTabBoxes().Count(); + sal_uInt16 nColCount = pLine->GetTabBoxes().Count(); OSL_ENSURE( nColCount, "Empty Table Line" ); - for( USHORT nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) + for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol ) { SwTableBox* pTableBox = pLine->GetTabBoxes()[nCurrCol]; OSL_ENSURE( pTableBox, "Missing Table Box" ); @@ -2205,12 +2206,12 @@ BOOL SwTable::CopyHeadlineIntoTable( SwTableNode& rTblNd ) } } - return TRUE; + return sal_True; } -BOOL SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, - const SwSelBoxes& rSelBoxes, BOOL bCpyNds, - BOOL bCpyName ) const +sal_Bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, + const SwSelBoxes& rSelBoxes, sal_Bool bCpyNds, + sal_Bool bCpyName ) const { // suche alle Boxen / Lines _FndBox aFndBox( 0, 0 ); @@ -2219,7 +2220,7 @@ BOOL SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, ((SwTableLines&)GetTabLines()).ForEach( &_FndLineCopyCol, &aPara ); } if( !aFndBox.GetLines().Count() ) - return FALSE; + return sal_False; // erst die Poolvorlagen fuer die Tabelle kopieren, damit die dann // wirklich kopiert und damit die gueltigen Werte haben. @@ -2233,9 +2234,9 @@ BOOL SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, SwTable* pNewTbl = (SwTable*)pInsDoc->InsertTable( SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 1 ), rPos, 1, 1, GetFrmFmt()->GetHoriOrient().GetHoriOrient(), - 0, 0, FALSE, IsNewModel() ); + 0, 0, sal_False, IsNewModel() ); if( !pNewTbl ) - return FALSE; + return sal_False; SwNodeIndex aIdx( rPos.nNode, -1 ); SwTableNode* pTblNd = aIdx.GetNode().FindTableNode(); @@ -2255,7 +2256,7 @@ BOOL SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, // tauschen am Node den Tabellen-Pointer aus pNewTbl = new SwDDETable( *pNewTbl, (SwDDEFieldType*)pFldType ); - pTblNd->SetNewTable( pNewTbl, FALSE ); + pTblNd->SetNewTable( pNewTbl, sal_False ); } pNewTbl->GetFrmFmt()->CopyAttrs( *GetFrmFmt() ); @@ -2291,11 +2292,11 @@ BOOL SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, _FndLine* pFndLn = aFndBox.GetLines()[ 0 ]; SwTableLine* pLn = pFndLn->GetLine(); const SwTableLine* pTmp = pLn; - USHORT nLnPos = GetTabLines().GetPos( pTmp ); + sal_uInt16 nLnPos = GetTabLines().GetPos( pTmp ); if( USHRT_MAX != nLnPos && nLnPos ) { // es gibt eine Line davor - SwCollectTblLineBoxes aLnPara( FALSE, HEADLINE_BORDERCOPY ); + SwCollectTblLineBoxes aLnPara( sal_False, HEADLINE_BORDERCOPY ); pLn = GetTabLines()[ nLnPos - 1 ]; pLn->GetTabBoxes().ForEach( &lcl_Box_CollectBox, &aLnPara ); @@ -2303,7 +2304,7 @@ BOOL SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, if( aLnPara.Resize( lcl_GetBoxOffset( aFndBox ), lcl_GetLineWidth( *pFndLn )) ) { - aLnPara.SetValues( TRUE ); + aLnPara.SetValues( sal_True ); pLn = pNewTbl->GetTabLines()[ 0 ]; pLn->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, &aLnPara ); } @@ -2316,7 +2317,7 @@ BOOL SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, if( nLnPos < GetTabLines().Count() - 1 ) { // es gibt eine Line dahinter - SwCollectTblLineBoxes aLnPara( TRUE, HEADLINE_BORDERCOPY ); + SwCollectTblLineBoxes aLnPara( sal_True, HEADLINE_BORDERCOPY ); pLn = GetTabLines()[ nLnPos + 1 ]; pLn->GetTabBoxes().ForEach( &lcl_Box_CollectBox, &aLnPara ); @@ -2324,7 +2325,7 @@ BOOL SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, if( aLnPara.Resize( lcl_GetBoxOffset( aFndBox ), lcl_GetLineWidth( *pFndLn )) ) { - aLnPara.SetValues( FALSE ); + aLnPara.SetValues( sal_False ); pLn = pNewTbl->GetTabLines()[ pNewTbl->GetTabLines().Count()-1 ]; pLn->GetTabBoxes().ForEach( &lcl_BoxSetSplitBoxFmts, &aLnPara ); } @@ -2334,7 +2335,7 @@ BOOL SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, // die initiale Box muss noch geloescht werden _DeleteBox( *pNewTbl, pNewTbl->GetTabLines()[ pNewTbl->GetTabLines().Count() - 1 ]->GetTabBoxes()[0], - 0, FALSE, FALSE ); + 0, sal_False, sal_False ); if( pNewTbl->IsNewModel() ) lcl_CheckRowSpan( *pNewTbl ); @@ -2345,16 +2346,16 @@ BOOL SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, CHECKTABLELAYOUT - return TRUE; + return sal_True; } // suche ab dieser Line nach der naechsten Box mit Inhalt SwTableBox* SwTableLine::FindNextBox( const SwTable& rTbl, - const SwTableBox* pSrchBox, BOOL bOvrTblLns ) const + const SwTableBox* pSrchBox, sal_Bool bOvrTblLns ) const { const SwTableLine* pLine = this; // fuer M800 SwTableBox* pBox; - USHORT nFndPos; + sal_uInt16 nFndPos; if( GetTabBoxes().Count() && pSrchBox && USHRT_MAX != ( nFndPos = GetTabBoxes().GetPos( pSrchBox )) && nFndPos + 1 != GetTabBoxes().Count() ) @@ -2398,11 +2399,11 @@ SwTableBox* SwTableLine::FindNextBox( const SwTable& rTbl, // suche ab dieser Line nach der vorherigen Box SwTableBox* SwTableLine::FindPreviousBox( const SwTable& rTbl, - const SwTableBox* pSrchBox, BOOL bOvrTblLns ) const + const SwTableBox* pSrchBox, sal_Bool bOvrTblLns ) const { const SwTableLine* pLine = this; // fuer M800 SwTableBox* pBox; - USHORT nFndPos; + sal_uInt16 nFndPos; if( GetTabBoxes().Count() && pSrchBox && USHRT_MAX != ( nFndPos = GetTabBoxes().GetPos( pSrchBox )) && nFndPos ) @@ -2452,7 +2453,7 @@ SwTableBox* SwTableLine::FindPreviousBox( const SwTable& rTbl, // suche ab dieser Line nach der naechsten Box mit Inhalt SwTableBox* SwTableBox::FindNextBox( const SwTable& rTbl, - const SwTableBox* pSrchBox, BOOL bOvrTblLns ) const + const SwTableBox* pSrchBox, sal_Bool bOvrTblLns ) const { if( !pSrchBox && !GetTabLines().Count() ) return (SwTableBox*)this; @@ -2463,7 +2464,7 @@ SwTableBox* SwTableBox::FindNextBox( const SwTable& rTbl, // suche ab dieser Line nach der naechsten Box mit Inhalt SwTableBox* SwTableBox::FindPreviousBox( const SwTable& rTbl, - const SwTableBox* pSrchBox, BOOL bOvrTblLns ) const + const SwTableBox* pSrchBox, sal_Bool bOvrTblLns ) const { if( !pSrchBox && !GetTabLines().Count() ) return (SwTableBox*)this; @@ -2471,7 +2472,7 @@ SwTableBox* SwTableBox::FindPreviousBox( const SwTable& rTbl, bOvrTblLns ); } -BOOL lcl_BoxSetHeadCondColl( const SwTableBox*& rpBox, void* ) +sal_Bool lcl_BoxSetHeadCondColl( const SwTableBox*& rpBox, void* ) { // in der HeadLine sind die Absaetze mit BedingtenVorlage anzupassen const SwStartNode* pSttNd = rpBox->GetSttNd(); @@ -2479,27 +2480,27 @@ BOOL lcl_BoxSetHeadCondColl( const SwTableBox*& rpBox, void* ) pSttNd->CheckSectionCondColl(); else ((SwTableBox*)rpBox)->GetTabLines().ForEach( &lcl_LineSetHeadCondColl, 0 ); - return TRUE; + return sal_True; } -BOOL lcl_LineSetHeadCondColl( const SwTableLine*& rpLine, void* ) +sal_Bool lcl_LineSetHeadCondColl( const SwTableLine*& rpLine, void* ) { ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_BoxSetHeadCondColl, 0 ); - return TRUE; + return sal_True; } -SwTwips lcl_GetDistance( SwTableBox* pBox, BOOL bLeft ) +SwTwips lcl_GetDistance( SwTableBox* pBox, sal_Bool bLeft ) { - BOOL bFirst = TRUE; + sal_Bool bFirst = sal_True; SwTwips nRet = 0; SwTableLine* pLine; while( pBox && 0 != ( pLine = pBox->GetUpper() ) ) { - USHORT nStt = 0, nPos = pLine->GetTabBoxes().C40_GETPOS( SwTableBox, pBox ); + sal_uInt16 nStt = 0, nPos = pLine->GetTabBoxes().C40_GETPOS( SwTableBox, pBox ); if( bFirst && !bLeft ) ++nPos; - bFirst = FALSE; + bFirst = sal_False; while( nStt < nPos ) nRet += pLine->GetTabBoxes()[ nStt++ ]->GetFrmFmt() @@ -2509,30 +2510,30 @@ SwTwips lcl_GetDistance( SwTableBox* pBox, BOOL bLeft ) return nRet; } -BOOL lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, - SwTwips nDist, BOOL bCheck ) +sal_Bool lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, + SwTwips nDist, sal_Bool bCheck ) { SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) { SwTableBox* pBox = rBoxes[ n ]; SwFrmFmt* pFmt = pBox->GetFrmFmt(); const SwFmtFrmSize& rSz = pFmt->GetFrmSize(); SwTwips nWidth = rSz.GetWidth(); - BOOL bGreaterBox = FALSE; + sal_Bool bGreaterBox = sal_False; if( bCheck ) { - for( USHORT i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) if( !::lcl_SetSelBoxWidth( pBox->GetTabLines()[ i ], rParam, - nDist, TRUE )) - return FALSE; + nDist, sal_True )) + return sal_False; // dann noch mal alle "ContentBoxen" sammeln if( ( 0 != ( bGreaterBox = TBLFIX_CHGABS != rParam.nMode && ( nDist + ( rParam.bLeft ? 0 : nWidth ) ) >= rParam.nSide)) || ( !rParam.bBigger && ( Abs( nDist + (( rParam.nMode && rParam.bLeft ) ? 0 : nWidth ) - rParam.nSide ) < COLFUZZY ) ) ) { - rParam.bAnyBoxFnd = TRUE; + rParam.bAnyBoxFnd = sal_True; SwTwips nLowerDiff; if( bGreaterBox && TBLFIX_CHGPROP == rParam.nMode ) { @@ -2547,16 +2548,16 @@ BOOL lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, nLowerDiff = rParam.nDiff; if( nWidth < nLowerDiff || nWidth - nLowerDiff < MINLAY ) - return FALSE; + return sal_False; } } else { SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff; - for( USHORT i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) { rParam.nLowerDiff = 0; - lcl_SetSelBoxWidth( pBox->GetTabLines()[ i ], rParam, nDist, FALSE ); + lcl_SetSelBoxWidth( pBox->GetTabLines()[ i ], rParam, nDist, sal_False ); if( nLowerDiff < rParam.nLowerDiff ) nLowerDiff = rParam.nLowerDiff; @@ -2609,14 +2610,14 @@ BOOL lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, nDist >= rParam.nSide ) break; } - return TRUE; + return sal_True; } -BOOL lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, - SwTwips nDist, BOOL bCheck ) +sal_Bool lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, + SwTwips nDist, sal_Bool bCheck ) { SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) { SwTableBox* pBox = rBoxes[ n ]; SwFrmFmt* pFmt = pBox->GetFrmFmt(); @@ -2625,17 +2626,17 @@ BOOL lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( bCheck ) { - for( USHORT i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) if( !::lcl_SetOtherBoxWidth( pBox->GetTabLines()[ i ], - rParam, nDist, TRUE )) - return FALSE; + rParam, nDist, sal_True )) + return sal_False; if( rParam.bBigger && ( TBLFIX_CHGABS == rParam.nMode ? Abs( nDist - rParam.nSide ) < COLFUZZY : ( rParam.bLeft ? nDist < rParam.nSide - COLFUZZY : nDist >= rParam.nSide - COLFUZZY )) ) { - rParam.bAnyBoxFnd = TRUE; + rParam.bAnyBoxFnd = sal_True; SwTwips nDiff; if( TBLFIX_CHGPROP == rParam.nMode ) // Tabelle fix, proport. { @@ -2648,17 +2649,17 @@ BOOL lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, nDiff = rParam.nDiff; if( nWidth < nDiff || nWidth - nDiff < MINLAY ) - return FALSE; + return sal_False; } } else { SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff; - for( USHORT i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) { rParam.nLowerDiff = 0; lcl_SetOtherBoxWidth( pBox->GetTabLines()[ i ], rParam, - nDist, FALSE ); + nDist, sal_False ); if( nLowerDiff < rParam.nLowerDiff ) nLowerDiff = rParam.nLowerDiff; @@ -2703,14 +2704,14 @@ BOOL lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, nDist > rParam.nSide ) break; } - return TRUE; + return sal_True; } -BOOL lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, - SwTwips nDist, BOOL bCheck ) +sal_Bool lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, + SwTwips nDist, sal_Bool bCheck ) { SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - USHORT n, nCmp; + sal_uInt16 n, nCmp; for( n = 0; n < rBoxes.Count(); ++n ) { SwTableBox* pBox = rBoxes[ n ]; @@ -2720,10 +2721,10 @@ BOOL lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( bCheck ) { - for( USHORT i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) if( !::lcl_InsSelBox( pBox->GetTabLines()[ i ], rParam, - nDist, TRUE )) - return FALSE; + nDist, sal_True )) + return sal_False; // dann noch mal alle "ContentBoxen" sammeln if( Abs( nDist + ( rParam.bLeft ? 0 : nWidth ) @@ -2736,14 +2737,14 @@ BOOL lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( nCmp ) { - rParam.bAnyBoxFnd = TRUE; + rParam.bAnyBoxFnd = sal_True; if( pFmt->GetProtect().IsCntntProtected() ) - return FALSE; + return sal_False; if( rParam.bSplittBox && nWidth - rParam.nDiff <= COLFUZZY + ( 567 / 2 /* min. 0,5 cm Platz lassen*/) ) - return FALSE; + return sal_False; if( pBox->GetSttNd() ) rParam.aBoxes.Insert( pBox ); @@ -2754,10 +2755,10 @@ BOOL lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, else { SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff; - for( USHORT i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) { rParam.nLowerDiff = 0; - lcl_InsSelBox( pBox->GetTabLines()[ i ], rParam, nDist, FALSE ); + lcl_InsSelBox( pBox->GetTabLines()[ i ], rParam, nDist, sal_False ); if( nLowerDiff < rParam.nLowerDiff ) nLowerDiff = rParam.nLowerDiff; @@ -2837,18 +2838,18 @@ BOOL lcl_InsSelBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, nDist += nWidth; } - return TRUE; + return sal_True; } -BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, - SwTwips nDist, BOOL bCheck ) +sal_Bool lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, + SwTwips nDist, sal_Bool bCheck ) { // Sonderfall: kein Platz in den anderen Boxen aber in der Zelle if( rParam.bSplittBox ) - return TRUE; + return sal_True; SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - USHORT n; + sal_uInt16 n; // Tabelle fix, proport. if( !rParam.nRemainWidth && TBLFIX_CHGPROP == rParam.nMode ) @@ -2862,8 +2863,8 @@ BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( (nTmpDist + nWidth / 2 ) > rParam.nSide ) { rParam.nRemainWidth = rParam.bLeft - ? USHORT(nTmpDist) - : USHORT(rParam.nTblWidth - nTmpDist); + ? sal_uInt16(nTmpDist) + : sal_uInt16(rParam.nTblWidth - nTmpDist); break; } nTmpDist += nWidth; @@ -2879,22 +2880,22 @@ BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( bCheck ) { - for( USHORT i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) if( !::lcl_InsOtherBox( pBox->GetTabLines()[ i ], - rParam, nDist, TRUE )) - return FALSE; + rParam, nDist, sal_True )) + return sal_False; if( rParam.bLeft ? ((nDist + nWidth / 2 ) <= rParam.nSide && (TBLFIX_CHGABS != rParam.nMode || - (n < rBoxes.Count() && + (n < rBoxes.Count() && (nDist + nWidth + rBoxes[ n+1 ]-> GetFrmFmt()->GetFrmSize().GetWidth() / 2) - > rParam.nSide ))) + > rParam.nSide) )) : (nDist + nWidth / 2 ) > rParam.nSide ) { - rParam.bAnyBoxFnd = TRUE; + rParam.bAnyBoxFnd = sal_True; SwTwips nDiff; if( TBLFIX_CHGPROP == rParam.nMode ) // Tabelle fix, proport. { @@ -2904,7 +2905,7 @@ BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, nDiff /= rParam.nRemainWidth; if( nWidth < nDiff || nWidth - nDiff < MINLAY ) - return FALSE; + return sal_False; } else { @@ -2917,7 +2918,7 @@ BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( rParam.bLeft && pBox->GetUpper()->GetUpper() ) { const SwTableBox* pTmpBox = pBox; - USHORT nBoxPos = n; + sal_uInt16 nBoxPos = n; while( !nBoxPos && pTmpBox->GetUpper()->GetUpper() ) { pTmpBox = pTmpBox->GetUpper()->GetUpper(); @@ -2930,7 +2931,7 @@ BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, } if( nTmpWidth < nDiff || nTmpWidth - nDiff < MINLAY ) - return FALSE; + return sal_False; break; } } @@ -2938,11 +2939,11 @@ BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, else { SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff; - for( USHORT i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) { rParam.nLowerDiff = 0; lcl_InsOtherBox( pBox->GetTabLines()[ i ], rParam, - nDist, FALSE ); + nDist, sal_False ); if( nLowerDiff < rParam.nLowerDiff ) nLowerDiff = rParam.nLowerDiff; @@ -2952,10 +2953,10 @@ BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( nLowerDiff || (rParam.bLeft ? ((nDist + nWidth / 2 ) <= rParam.nSide && (TBLFIX_CHGABS != rParam.nMode || - (n < rBoxes.Count() && + (n < rBoxes.Count() && (nDist + nWidth + rBoxes[ n+1 ]-> GetFrmFmt()->GetFrmSize().GetWidth() / 2) - > rParam.nSide ))) + > rParam.nSide) )) : (nDist + nWidth / 2 ) > rParam.nSide )) { if( !nLowerDiff ) @@ -2987,7 +2988,7 @@ BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, nDist += nWidth; } - return TRUE; + return sal_True; } // das Ergebnis des Positions Vergleiches @@ -2998,8 +2999,8 @@ BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, // POS_EQUAL, // Box und Start/End sind gleich // POS_OVERLAP_BEFORE, // Box ueberlappt den Start // POS_OVERLAP_BEHIND // Box ueberlappt das Ende -SwComparePosition _CheckBoxInRange( USHORT nStt, USHORT nEnd, - USHORT nBoxStt, USHORT nBoxEnd ) +SwComparePosition _CheckBoxInRange( sal_uInt16 nStt, sal_uInt16 nEnd, + sal_uInt16 nBoxStt, sal_uInt16 nBoxEnd ) { // COLFUZZY noch beachten!! SwComparePosition nRet; @@ -3040,7 +3041,7 @@ void lcl_DelSelBox_CorrLowers( SwTableLine& rLine, CR_SetBoxWidth& rParam, // 1. Schritt die eigene Breite feststellen SwTableBoxes& rBoxes = rLine.GetTabBoxes(); SwTwips nBoxWidth = 0; - USHORT n; + sal_uInt16 n; for( n = rBoxes.Count(); n; ) nBoxWidth += rBoxes[ --n ]->GetFrmFmt()->GetFrmSize().GetWidth(); @@ -3062,7 +3063,7 @@ void lcl_DelSelBox_CorrLowers( SwTableLine& rLine, CR_SetBoxWidth& rParam, if( !pBox->GetSttNd() ) { // hat selbst auch Lower, also auch die anpassen - for( USHORT i = pBox->GetTabLines().Count(); i; ) + for( sal_uInt16 i = pBox->GetTabLines().Count(); i; ) ::lcl_DelSelBox_CorrLowers( *pBox->GetTabLines()[ --i ], rParam, nDiff ); } @@ -3072,16 +3073,16 @@ void lcl_DelSelBox_CorrLowers( SwTableLine& rLine, CR_SetBoxWidth& rParam, void lcl_ChgBoxSize( SwTableBox& rBox, CR_SetBoxWidth& rParam, const SwFmtFrmSize& rOldSz, - USHORT& rDelWidth, SwTwips nDist ) + sal_uInt16& rDelWidth, SwTwips nDist ) { - long nDiff; - BOOL bSetSize = FALSE; + long nDiff = 0; + sal_Bool bSetSize = sal_False; switch( rParam.nMode ) { case TBLFIX_CHGABS: // Tabelle feste Breite, den Nachbar andern nDiff = rDelWidth + rParam.nLowerDiff; - bSetSize = TRUE; + bSetSize = sal_True; break; case TBLFIX_CHGPROP: // Tabelle feste Breite, alle Nachbarn aendern @@ -3089,9 +3090,9 @@ void lcl_ChgBoxSize( SwTableBox& rBox, CR_SetBoxWidth& rParam, { // dann kurz berechnen: if( rParam.bLeft ) - rParam.nRemainWidth = USHORT(nDist); + rParam.nRemainWidth = sal_uInt16(nDist); else - rParam.nRemainWidth = USHORT(rParam.nTblWidth - nDist); + rParam.nRemainWidth = sal_uInt16(rParam.nTblWidth - nDist); } // relativ berechnen @@ -3099,7 +3100,7 @@ void lcl_ChgBoxSize( SwTableBox& rBox, CR_SetBoxWidth& rParam, nDiff *= rDelWidth + rParam.nLowerDiff; nDiff /= rParam.nRemainWidth; - bSetSize = TRUE; + bSetSize = sal_True; break; case TBLVAR_CHGABS: // Tabelle variable, alle Nachbarn aendern @@ -3108,10 +3109,10 @@ void lcl_ChgBoxSize( SwTableBox& rBox, CR_SetBoxWidth& rParam, { nDiff = rDelWidth + rParam.nLowerDiff - rParam.nBoxWidth; if( 0 < nDiff ) - rDelWidth = rDelWidth - USHORT(nDiff); + rDelWidth = rDelWidth - sal_uInt16(nDiff); else - rDelWidth = rDelWidth + USHORT(-nDiff); - bSetSize = TRUE; + rDelWidth = rDelWidth + sal_uInt16(-nDiff); + bSetSize = sal_True; } break; } @@ -3123,23 +3124,23 @@ void lcl_ChgBoxSize( SwTableBox& rBox, CR_SetBoxWidth& rParam, rParam.aShareFmts.SetSize( rBox, aNew ); // dann leider nochmals die Lower anpassen - for( USHORT i = rBox.GetTabLines().Count(); i; ) + for( sal_uInt16 i = rBox.GetTabLines().Count(); i; ) ::lcl_DelSelBox_CorrLowers( *rBox.GetTabLines()[ --i ], rParam, aNew.GetWidth() ); } } -BOOL lcl_DeleteBox_Rekursiv( CR_SetBoxWidth& rParam, SwTableBox& rBox, - BOOL bCheck ) +sal_Bool lcl_DeleteBox_Rekursiv( CR_SetBoxWidth& rParam, SwTableBox& rBox, + sal_Bool bCheck ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if( rBox.GetSttNd() ) { if( bCheck ) { - rParam.bAnyBoxFnd = TRUE; + rParam.bAnyBoxFnd = sal_True; if( rBox.GetFrmFmt()->GetProtect().IsCntntProtected() ) - bRet = FALSE; + bRet = sal_False; else { SwTableBox* pBox = &rBox; @@ -3148,42 +3149,42 @@ BOOL lcl_DeleteBox_Rekursiv( CR_SetBoxWidth& rParam, SwTableBox& rBox, } else ::_DeleteBox( rParam.pTblNd->GetTable(), &rBox, - rParam.pUndo, FALSE, TRUE, &rParam.aShareFmts ); + rParam.pUndo, sal_False, sal_True, &rParam.aShareFmts ); } else { // die muessen leider alle sequentiel ueber die // Contentboxen geloescht werden - for( USHORT i = rBox.GetTabLines().Count(); i; ) + for( sal_uInt16 i = rBox.GetTabLines().Count(); i; ) { SwTableLine& rLine = *rBox.GetTabLines()[ --i ]; - for( USHORT n = rLine.GetTabBoxes().Count(); n; ) + for( sal_uInt16 n = rLine.GetTabBoxes().Count(); n; ) if( !::lcl_DeleteBox_Rekursiv( rParam, *rLine.GetTabBoxes()[ --n ], bCheck )) - return FALSE; + return sal_False; } } return bRet; } -BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, - SwTwips nDist, BOOL bCheck ) +sal_Bool lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, + SwTwips nDist, sal_Bool bCheck ) { SwTableBoxes& rBoxes = pTabLine->GetTabBoxes(); - USHORT n, nCntEnd, nBoxChkStt, nBoxChkEnd, nDelWidth = 0; + sal_uInt16 n, nCntEnd, nBoxChkStt, nBoxChkEnd, nDelWidth = 0; if( rParam.bLeft ) { n = rBoxes.Count(); nCntEnd = 0; - nBoxChkStt = (USHORT)rParam.nSide; - nBoxChkEnd = static_cast<USHORT>(rParam.nSide + rParam.nBoxWidth); + nBoxChkStt = (sal_uInt16)rParam.nSide; + nBoxChkEnd = static_cast<sal_uInt16>(rParam.nSide + rParam.nBoxWidth); } else { n = 0; nCntEnd = rBoxes.Count(); - nBoxChkStt = static_cast<USHORT>(rParam.nSide - rParam.nBoxWidth); - nBoxChkEnd = (USHORT)rParam.nSide; + nBoxChkStt = static_cast<sal_uInt16>(rParam.nSide - rParam.nBoxWidth); + nBoxChkEnd = (sal_uInt16)rParam.nSide; } @@ -3198,13 +3199,13 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, SwFrmFmt* pFmt = pBox->GetFrmFmt(); const SwFmtFrmSize& rSz = pFmt->GetFrmSize(); long nWidth = rSz.GetWidth(); - BOOL bDelBox = FALSE, bChgLowers = FALSE; + sal_Bool bDelBox = sal_False, bChgLowers = sal_False; // die Boxenbreite testen und entpsrechend reagieren SwComparePosition ePosType = ::_CheckBoxInRange( nBoxChkStt, nBoxChkEnd, - USHORT(rParam.bLeft ? nDist - nWidth : nDist), - USHORT(rParam.bLeft ? nDist : nDist + nWidth)); + sal_uInt16(rParam.bLeft ? nDist - nWidth : nDist), + sal_uInt16(rParam.bLeft ? nDist : nDist + nWidth)); switch( ePosType ) { @@ -3212,7 +3213,7 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, if( bCheck ) { if( rParam.bLeft ) - return TRUE; + return sal_True; } else if( rParam.bLeft ) { @@ -3226,7 +3227,7 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, if( bCheck ) { if( !rParam.bLeft ) - return TRUE; + return sal_True; } else if( !rParam.bLeft ) { @@ -3239,7 +3240,7 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, case POS_OUTSIDE: // Box ueberlappt Start/End vollstaendig case POS_INSIDE: // Box liegt vollstaendig in Start/End case POS_EQUAL: // Box und Start/End sind gleich - bDelBox = TRUE; + bDelBox = sal_True; break; case POS_OVERLAP_BEFORE: // Box ueberlappt den Start @@ -3247,14 +3248,14 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, : nWidth / 2 ))) { if( !pBox->GetSttNd() ) - bChgLowers = TRUE; + bChgLowers = sal_True; else - bDelBox = TRUE; + bDelBox = sal_True; } else if( !bCheck && rParam.bLeft ) { if( !pBox->GetSttNd() ) - bChgLowers = TRUE; + bChgLowers = sal_True; else { ::lcl_ChgBoxSize( *pBox, rParam, rSz, nDelWidth, nDist ); @@ -3269,16 +3270,16 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, // generell loeschen oder wie beim OVERLAP_Before nur die, die // bis zur Haelfte in die "Loesch-"Box reicht ??? if( !pBox->GetSttNd() ) - bChgLowers = TRUE; + bChgLowers = sal_True; else - bDelBox = TRUE; + bDelBox = sal_True; break; default: break; } if( bDelBox ) { - nDelWidth = nDelWidth + USHORT(nWidth); + nDelWidth = nDelWidth + sal_uInt16(nWidth); if( bCheck ) { // die letzte/erste Box kann nur bei Tbl-Var geloescht werden, @@ -3289,10 +3290,10 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, ? nWidth - nDist : (nDist + nWidth - rParam.nTblWidth ))) || !::lcl_DeleteBox_Rekursiv( rParam, *pBox, bCheck ) ) - return FALSE; + return sal_False; if( pFmt->GetProtect().IsCntntProtected() ) - return FALSE; + return sal_False; } else { @@ -3304,11 +3305,11 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, } else if( bChgLowers ) { - BOOL bFirst = TRUE, bCorrLowers = FALSE; + sal_Bool bFirst = sal_True, bCorrLowers = sal_False; long nLowerDiff = 0; long nOldLower = rParam.nLowerDiff; - USHORT nOldRemain = rParam.nRemainWidth; - USHORT i; + sal_uInt16 nOldRemain = rParam.nRemainWidth; + sal_uInt16 i; for( i = pBox->GetTabLines().Count(); i; ) { @@ -3316,7 +3317,7 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, rParam.nRemainWidth = nOldRemain; SwTableLine* pLine = pBox->GetTabLines()[ --i ]; if( !::lcl_DelSelBox( pLine, rParam, nDist, bCheck )) - return FALSE; + return sal_False; // gibt es die Box und die darin enthaltenen Lines noch?? if( n < rBoxes.Count() && @@ -3326,14 +3327,14 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, { if( !bFirst && !bCorrLowers && COLFUZZY < Abs( nLowerDiff - rParam.nLowerDiff ) ) - bCorrLowers = TRUE; + bCorrLowers = sal_True; // die groesste "loesch" Breite entscheidet, aber nur wenn // nicht die gesamte Line geloescht wurde if( nLowerDiff < rParam.nLowerDiff ) nLowerDiff = rParam.nLowerDiff; - bFirst = FALSE; + bFirst = sal_False; } } rParam.nLowerDiff = nOldLower; @@ -3345,7 +3346,7 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, nLowerDiff = nWidth; // DelBreite anpassen!! - nDelWidth = nDelWidth + USHORT(nLowerDiff); + nDelWidth = nDelWidth + sal_uInt16(nLowerDiff); if( !bCheck ) { @@ -3361,7 +3362,7 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, { // sonst muss die Groesse der Box angepasst werden SwFmtFrmSize aNew( rSz ); - BOOL bCorrRel = FALSE; + sal_Bool bCorrRel = sal_False; if( TBLVAR_CHGABS != rParam.nMode ) { @@ -3373,7 +3374,7 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, else if( rParam.bLeft ) // TBLFIX_CHGABS { nLowerDiff = nLowerDiff - nDelWidth; - bCorrLowers = TRUE; + bCorrLowers = sal_True; n = nCntEnd; } break; @@ -3384,7 +3385,7 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, else if( !rParam.bLeft ) // TBLFIX_CHGABS { nLowerDiff = nLowerDiff - nDelWidth; - bCorrLowers = TRUE; + bCorrLowers = sal_True; n = nCntEnd; } break; @@ -3401,9 +3402,9 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, { // dann kurz berechnen: if( rParam.bLeft ) - rParam.nRemainWidth = USHORT(nDist - nLowerDiff); + rParam.nRemainWidth = sal_uInt16(nDist - nLowerDiff); else - rParam.nRemainWidth = USHORT(rParam.nTblWidth - nDist + rParam.nRemainWidth = sal_uInt16(rParam.nTblWidth - nDist - nLowerDiff ); } @@ -3434,19 +3435,19 @@ BOOL lcl_DelSelBox( SwTableLine* pTabLine, CR_SetBoxWidth& rParam, nDist += nWidth; } rParam.nLowerDiff = nDelWidth; - return TRUE; + return sal_True; } // Dummy Funktion fuer die Methode SetColWidth -BOOL lcl_DelOtherBox( SwTableLine* , CR_SetBoxWidth& , SwTwips , BOOL ) +sal_Bool lcl_DelOtherBox( SwTableLine* , CR_SetBoxWidth& , SwTwips , sal_Bool ) { - return TRUE; + return sal_True; } void lcl_AjustLines( SwTableLine* pLine, CR_SetBoxWidth& rParam ) { SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) { SwTableBox* pBox = rBoxes[ n ]; @@ -3457,7 +3458,7 @@ void lcl_AjustLines( SwTableLine* pLine, CR_SetBoxWidth& rParam ) aSz.SetWidth( nWidth ); rParam.aShareFmts.SetSize( *pBox, aSz ); - for( USHORT i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) ::lcl_AjustLines( pBox->GetTabLines()[ i ], rParam ); } } @@ -3470,13 +3471,13 @@ void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize ) SwTwips nAktSize = 0; // checke doch mal ob die Tabellen korrekte Breiten haben - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) { const SwTableBox* pBox = rBoxes[ n ]; const SwTwips nBoxW = pBox->GetFrmFmt()->GetFrmSize().GetWidth(); nAktSize += nBoxW; - for( USHORT i = 0; i < pBox->GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < pBox->GetTabLines().Count(); ++i ) _CheckBoxWidth( *pBox->GetTabLines()[ i ], nBoxW ); } @@ -3498,11 +3499,11 @@ _FndBox* lcl_SaveInsDelData( CR_SetBoxWidth& rParam, SwUndo** ppUndo, { // erstmal die Boxen besorgen ! if( rParam.bBigger ) - for( USHORT n = 0; n < rTbl.GetTabLines().Count(); ++n ) - ::lcl_DelSelBox( rTbl.GetTabLines()[ n ], rParam, nDistStt, TRUE ); + for( sal_uInt16 n = 0; n < rTbl.GetTabLines().Count(); ++n ) + ::lcl_DelSelBox( rTbl.GetTabLines()[ n ], rParam, nDistStt, sal_True ); else - for( USHORT n = 0; n < rTbl.GetTabLines().Count(); ++n ) - ::lcl_InsSelBox( rTbl.GetTabLines()[ n ], rParam, nDistStt, TRUE ); + for( sal_uInt16 n = 0; n < rTbl.GetTabLines().Count(); ++n ) + ::lcl_InsSelBox( rTbl.GetTabLines()[ n ], rParam, nDistStt, sal_True ); } // loeschen der gesamten Tabelle verhindern @@ -3534,7 +3535,7 @@ _FndBox* lcl_SaveInsDelData( CR_SetBoxWidth& rParam, SwUndo** ppUndo, return pFndBox; } -BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, +sal_Bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, SwTwips nAbsDiff, SwTwips nRelDiff, SwUndo** ppUndo ) { SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen @@ -3544,13 +3545,13 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, _FndBox* pFndBox = 0; // fuers Einfuegen/Loeschen SwTableSortBoxes aTmpLst( 0, 5 ); // fuers Undo - BOOL bBigger, - bRet = FALSE, + sal_Bool bBigger, + bRet = sal_False, bLeft = nsTblChgWidthHeightType::WH_COL_LEFT == ( eType & 0xff ) || nsTblChgWidthHeightType::WH_CELL_LEFT == ( eType & 0xff ), bInsDel = 0 != (eType & nsTblChgWidthHeightType::WH_FLAG_INSDEL ); - USHORT n; - ULONG nBoxIdx = rAktBox.GetSttIdx(); + sal_uInt16 n; + sal_uLong nBoxIdx = rAktBox.GetSttIdx(); // bestimme die akt. Kante der Box // wird nur fuer die Breitenmanipulation benoetigt! @@ -3568,7 +3569,7 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, { fnSelBox = lcl_DelSelBox; fnOtherBox = lcl_DelOtherBox; - aParam.nBoxWidth = (USHORT)rAktBox.GetFrmFmt()->GetFrmSize().GetWidth(); + aParam.nBoxWidth = (sal_uInt16)rAktBox.GetFrmFmt()->GetFrmSize().GetWidth(); if( bLeft ) nDistStt = rSz.GetWidth(); } @@ -3595,7 +3596,7 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, bBigger = !bBigger; // erstmal testen, ob ueberhaupt Platz ist - BOOL bChgLRSpace = TRUE; + sal_Bool bChgLRSpace = sal_True; if( bBigger ) { if( GetFrmFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) && @@ -3614,7 +3615,7 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, ( bLeft ? rLR.GetRight() >= nAbsDiff : rLR.GetLeft() >= nAbsDiff )) { - bRet = TRUE; bLeft = !bLeft; + bRet = sal_True; bLeft = !bLeft; } if( !bRet ) @@ -3632,13 +3633,13 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, } else { - bRet = TRUE; + bRet = sal_True; for( n = 0; n < aLines.Count(); ++n ) { aParam.LoopClear(); - if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, TRUE )) + if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_True )) { - bRet = FALSE; + bRet = sal_False; break; } } @@ -3655,7 +3656,7 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, { // dies gesamte Tabelle soll geloescht werden!! GetFrmFmt()->GetDoc()->DeleteRowCol( aParam.aBoxes ); - return FALSE; + return sal_False; } if( ppUndo ) @@ -3664,7 +3665,7 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, : UNDO_TABLE_INSCOL ); } else if( ppUndo ) - *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, TRUE ); + *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, sal_True ); long nFrmWidth = LONG_MAX; LockModify(); @@ -3679,7 +3680,7 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, // dann mal herunterbrechen auf USHRT_MAX / 2 CR_SetBoxWidth aTmpPara( 0, aSz.GetWidth() / 2, 0, aSz.GetWidth(), aSz.GetWidth(), aParam.pTblNd ); - for( USHORT nLn = 0; nLn < aLines.Count(); ++nLn ) + for( sal_uInt16 nLn = 0; nLn < aLines.Count(); ++nLn ) ::lcl_AjustLines( aLines[ nLn ], aTmpPara ); aSz.SetWidth( aSz.GetWidth() / 2 ); aParam.nDiff = nRelDiff /= 2; @@ -3688,14 +3689,14 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, } if( bLeft ) - aLR.SetLeft( USHORT( aLR.GetLeft() - nAbsDiff ) ); + aLR.SetLeft( sal_uInt16( aLR.GetLeft() - nAbsDiff ) ); else - aLR.SetRight( USHORT( aLR.GetRight() - nAbsDiff ) ); + aLR.SetRight( sal_uInt16( aLR.GetRight() - nAbsDiff ) ); } else if( bLeft ) - aLR.SetLeft( USHORT( aLR.GetLeft() + nAbsDiff ) ); + aLR.SetLeft( sal_uInt16( aLR.GetLeft() + nAbsDiff ) ); else - aLR.SetRight( USHORT( aLR.GetRight() + nAbsDiff ) ); + aLR.SetRight( sal_uInt16( aLR.GetRight() + nAbsDiff ) ); if( bChgLRSpace ) GetFrmFmt()->SetFmtAttr( aLR ); @@ -3734,11 +3735,11 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, aSz.SetWidth( aSz.GetWidth() - nRelDiff ); if( rSz.GetWidthPercent() ) - aSz.SetWidthPercent( static_cast<BYTE>(( aSz.GetWidth() * 100 ) / + aSz.SetWidthPercent( static_cast<sal_uInt8>(( aSz.GetWidth() * 100 ) / ( aSz.GetWidth() + aLR.GetRight() + aLR.GetLeft()))); GetFrmFmt()->SetFmtAttr( aSz ); - aParam.nTblWidth = USHORT( aSz.GetWidth() ); + aParam.nTblWidth = sal_uInt16( aSz.GetWidth() ); UnlockModify(); @@ -3746,7 +3747,7 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, { --n; aParam.LoopClear(); - (*fnSelBox)( aLines[ n ], aParam, nDistStt, FALSE ); + (*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_False ); } // sollte die Tabelle noch auf relativen Werten @@ -3763,7 +3764,7 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, else if( bInsDel || ( bLeft ? nDist : Abs( rSz.GetWidth() - nDist ) > COLFUZZY ) ) { - bRet = TRUE; + bRet = sal_True; if( bLeft && TBLFIX_CHGABS == eTblChgMode && !bInsDel ) aParam.bBigger = !bBigger; @@ -3775,9 +3776,9 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, for( n = 0; n < aLines.Count(); ++n ) { aParam.LoopClear(); - if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, TRUE )) + if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_True )) { - bRet = FALSE; + bRet = sal_False; break; } } @@ -3790,14 +3791,14 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, for( n = 0; n < aLines.Count(); ++n ) { aParam.LoopClear(); - if( !(*fnOtherBox)( aLines[ n ], aParam, 0, TRUE )) + if( !(*fnOtherBox)( aLines[ n ], aParam, 0, sal_True )) { - bRet = FALSE; + bRet = sal_False; break; } } if( bRet && !aParam.bAnyBoxFnd ) - bRet = FALSE; + bRet = sal_False; } if( !bRet && rAktBox.GetFrmFmt()->GetFrmSize().GetWidth() @@ -3805,16 +3806,16 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, ( 567 / 2 /* min. 0,5 cm Platz lassen*/) ) { // dann den Platz von der akt. Zelle nehmen - aParam.bSplittBox = TRUE; + aParam.bSplittBox = sal_True; // aber das muss auch mal getestet werden! - bRet = TRUE; + bRet = sal_True; for( n = 0; n < aLines.Count(); ++n ) { aParam.LoopClear(); - if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, TRUE )) + if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_True )) { - bRet = FALSE; + bRet = sal_False; break; } } @@ -3826,9 +3827,9 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, for( n = 0; n < aLines.Count(); ++n ) { aParam.LoopClear(); - if( !(*fnOtherBox)( aLines[ n ], aParam, 0, TRUE )) + if( !(*fnOtherBox)( aLines[ n ], aParam, 0, sal_True )) { - bRet = FALSE; + bRet = sal_False; break; } } @@ -3838,9 +3839,9 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, for( n = 0; n < aLines.Count(); ++n ) { aParam.LoopClear(); - if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, TRUE )) + if( !(*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_True )) { - bRet = FALSE; + bRet = sal_False; break; } } @@ -3861,7 +3862,7 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, : UNDO_TABLE_INSCOL ); } else if( ppUndo ) - *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, TRUE ); + *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, sal_True ); if( bInsDel ? ( TBLFIX_CHGABS == eTblChgMode ? bLeft : bLeft ) @@ -3872,8 +3873,8 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, --n; aParam.LoopClear(); aParam1.LoopClear(); - (*fnSelBox)( aLines[ n ], aParam, nDistStt, FALSE ); - (*fnOtherBox)( aLines[ n ], aParam1, nDistStt, FALSE ); + (*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_False ); + (*fnOtherBox)( aLines[ n ], aParam1, nDistStt, sal_False ); } } else @@ -3882,8 +3883,8 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, --n; aParam.LoopClear(); aParam1.LoopClear(); - (*fnOtherBox)( aLines[ n ], aParam1, nDistStt, FALSE ); - (*fnSelBox)( aLines[ n ], aParam, nDistStt, FALSE ); + (*fnOtherBox)( aLines[ n ], aParam1, nDistStt, sal_False ); + (*fnSelBox)( aLines[ n ], aParam, nDistStt, sal_False ); } } } @@ -3914,7 +3915,7 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, SwTableLine* pLine = rAktBox.GetUpper(); while( pLine->GetUpper() ) { - USHORT nPos = pLine->GetTabBoxes().C40_GETPOS( SwTableBox, pBox ); + sal_uInt16 nPos = pLine->GetTabBoxes().C40_GETPOS( SwTableBox, pBox ); if( bLeft ? nPos : nPos + 1 != pLine->GetTabBoxes().Count() ) break; @@ -3925,7 +3926,7 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, if( pLine->GetUpper() ) { // dann muss die Distanz wieder korriegiert werden! - aParam.nSide -= ::lcl_GetDistance( pLine->GetUpper(), TRUE ); + aParam.nSide -= ::lcl_GetDistance( pLine->GetUpper(), sal_True ); if( bLeft ) aParam.nMaxSize = aParam.nSide; @@ -3941,9 +3942,9 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, : ( rSz.GetWidth() - nDist ) > COLFUZZY ) && !aParam.bBigger ) { - bRet = (*fnOtherBox)( pLine, aParam, 0, TRUE ); + bRet = (*fnOtherBox)( pLine, aParam, 0, sal_True ); if( bRet && !aParam.bAnyBoxFnd ) - bRet = FALSE; + bRet = sal_False; } if( !bRet && !aParam.bBigger && rAktBox.GetFrmFmt()-> @@ -3951,14 +3952,14 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, ( 567 / 2 /* min. 0,5 cm Platz lassen*/) ) { // dann den Platz von der akt. Zelle nehmen - aParam.bSplittBox = TRUE; - bRet = TRUE; + aParam.bSplittBox = sal_True; + bRet = sal_True; } } else { FN_lcl_SetBoxWidth fnTmp = aParam.bBigger ? fnOtherBox : fnSelBox; - bRet = (*fnTmp)( pLine, aParam, nDistStt, TRUE ); + bRet = (*fnTmp)( pLine, aParam, nDistStt, sal_True ); } // wenn ja, dann setzen @@ -3975,19 +3976,19 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, : UNDO_TABLE_INSCOL ); } else if( ppUndo ) - *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, TRUE ); + *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, sal_True ); if( bInsDel ? ( TBLFIX_CHGABS == eTblChgMode ? (bBigger && bLeft) : bLeft ) : ( TBLFIX_CHGABS != eTblChgMode && bLeft ) ) { - (*fnSelBox)( pLine, aParam, nDistStt, FALSE ); - (*fnOtherBox)( pLine, aParam1, nDistStt, FALSE ); + (*fnSelBox)( pLine, aParam, nDistStt, sal_False ); + (*fnOtherBox)( pLine, aParam1, nDistStt, sal_False ); } else { - (*fnOtherBox)( pLine, aParam1, nDistStt, FALSE ); - (*fnSelBox)( pLine, aParam, nDistStt, FALSE ); + (*fnOtherBox)( pLine, aParam1, nDistStt, sal_False ); + (*fnSelBox)( pLine, aParam, nDistStt, sal_False ); } } } @@ -4012,7 +4013,7 @@ BOOL SwTable::SetColWidth( SwTableBox& rAktBox, USHORT eType, if( ppUndo && *ppUndo ) { - aParam.pUndo->SetColWidthParam( nBoxIdx, static_cast<USHORT>(eTblChgMode), eType, + aParam.pUndo->SetColWidthParam( nBoxIdx, static_cast<sal_uInt16>(eTblChgMode), eType, nAbsDiff, nRelDiff ); if( !aParam.bBigger ) aParam.pUndo->SaveNewBoxes( *aParam.pTblNd, aTmpLst ); @@ -4064,7 +4065,7 @@ _FndBox* lcl_SaveInsDelData( CR_SetLineHeight& rParam, SwUndo** ppUndo, } void SetLineHeight( SwTableLine& rLine, SwTwips nOldHeight, SwTwips nNewHeight, - BOOL bMinSize ) + sal_Bool bMinSize ) { SwLayoutFrm* pLineFrm = GetRowFrm( rLine ); OSL_ENSURE( pLineFrm, "wo ist der Frm von der SwTableLine?" ); @@ -4092,18 +4093,18 @@ void SetLineHeight( SwTableLine& rLine, SwTwips nOldHeight, SwTwips nNewHeight, // erst alle inneren anpassen SwTableBoxes& rBoxes = rLine.GetTabBoxes(); - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) { SwTableBox& rBox = *rBoxes[ n ]; - for( USHORT i = 0; i < rBox.GetTabLines().Count(); ++i ) + for( sal_uInt16 i = 0; i < rBox.GetTabLines().Count(); ++i ) SetLineHeight( *rBox.GetTabLines()[ i ], nMyOldH, nMyNewH, bMinSize ); } } -BOOL lcl_SetSelLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam, - SwTwips nDist, BOOL bCheck ) +sal_Bool lcl_SetSelLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam, + SwTwips nDist, sal_Bool bCheck ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if( !bCheck ) { // Zeilenhoehe einstellen @@ -4117,15 +4118,15 @@ BOOL lcl_SetSelLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam, OSL_ENSURE( pLineFrm, "wo ist der Frm von der SwTableLine?" ); SwTwips nRstHeight = CalcRowRstHeight( pLineFrm ); if( (nRstHeight + ROWFUZZY) < nDist ) - bRet = FALSE; + bRet = sal_False; } return bRet; } -BOOL lcl_SetOtherLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam, - SwTwips nDist, BOOL bCheck ) +sal_Bool lcl_SetOtherLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam, + SwTwips nDist, sal_Bool bCheck ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if( bCheck ) { if( rParam.bBigger ) @@ -4172,17 +4173,17 @@ BOOL lcl_SetOtherLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam, return bRet; } -BOOL lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, - SwTwips nDist, BOOL bCheck ) +sal_Bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, + SwTwips nDist, sal_Bool bCheck ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if( !bCheck ) { SwTableBoxes& rBoxes = pLine->GetTabBoxes(); SwDoc* pDoc = pLine->GetFrmFmt()->GetDoc(); if( !rParam.bBigger ) { - USHORT n; + sal_uInt16 n; for( n = rBoxes.Count(); n; ) ::lcl_SaveUpperLowerBorder( rParam.pTblNd->GetTable(), @@ -4190,8 +4191,8 @@ BOOL lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, rParam.aShareFmts ); for( n = rBoxes.Count(); n; ) ::_DeleteBox( rParam.pTblNd->GetTable(), - rBoxes[ --n ], rParam.pUndo, FALSE, - FALSE, &rParam.aShareFmts ); + rBoxes[ --n ], rParam.pUndo, sal_False, + sal_False, &rParam.aShareFmts ); } else { @@ -4203,7 +4204,7 @@ BOOL lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, pLines = &pLine->GetUpper()->GetTabLines(); else pLines = &rParam.pTblNd->GetTable().GetTabLines(); - USHORT nPos = pLines->C40_GETPOS( SwTableLine, pLine ); + sal_uInt16 nPos = pLines->C40_GETPOS( SwTableLine, pLine ); if( !rParam.bTop ) ++nPos; pLines->C40_INSERT( SwTableLine, pNewLine, nPos ); @@ -4213,7 +4214,7 @@ BOOL lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, // und noch mal die Anzahl Boxen erzeugen SwTableBoxes& rNewBoxes = pNewLine->GetTabBoxes(); - for( USHORT n = 0; n < rBoxes.Count(); ++n ) + for( sal_uInt16 n = 0; n < rBoxes.Count(); ++n ) { SwTwips nWidth = 0; SwTableBox* pOld = rBoxes[ n ]; @@ -4250,26 +4251,26 @@ BOOL lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, { // Boxen einsammeln! SwTableBoxes& rBoxes = pLine->GetTabBoxes(); - for( USHORT n = rBoxes.Count(); n; ) + for( sal_uInt16 n = rBoxes.Count(); n; ) { SwTableBox* pBox = rBoxes[ --n ]; if( pBox->GetFrmFmt()->GetProtect().IsCntntProtected() ) - return FALSE; + return sal_False; if( pBox->GetSttNd() ) rParam.aBoxes.Insert( pBox ); else { - for( USHORT i = pBox->GetTabLines().Count(); i; ) + for( sal_uInt16 i = pBox->GetTabLines().Count(); i; ) lcl_InsDelSelLine( pBox->GetTabLines()[ --i ], - rParam, 0, TRUE ); + rParam, 0, sal_True ); } } } return bRet; } -BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, +sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType, SwTwips nAbsDiff, SwTwips nRelDiff,SwUndo** ppUndo ) { SwTableLine* pLine = rAktBox.GetUpper(); @@ -4280,13 +4281,13 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, _FndBox* pFndBox = 0; // fuers Einfuegen/Loeschen SwTableSortBoxes aTmpLst( 0, 5 ); // fuers Undo - BOOL bBigger, - bRet = FALSE, + sal_Bool bBigger, + bRet = sal_False, bTop = nsTblChgWidthHeightType::WH_ROW_TOP == ( eType & 0xff ) || nsTblChgWidthHeightType::WH_CELL_TOP == ( eType & 0xff ), bInsDel = 0 != (eType & nsTblChgWidthHeightType::WH_FLAG_INSDEL ); - USHORT n, nBaseLinePos = GetTabLines().C40_GETPOS( SwTableLine, pBaseLine ); - ULONG nBoxIdx = rAktBox.GetSttIdx(); + sal_uInt16 n, nBaseLinePos = GetTabLines().C40_GETPOS( SwTableLine, pBaseLine ); + sal_uLong nBoxIdx = rAktBox.GetSttIdx(); CR_SetLineHeight aParam( eType, (SwTableNode*)rAktBox.GetSttNd()->FindTableNode() ); @@ -4327,7 +4328,7 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, // erstmal testen, ob ueberhaupt Platz ist if( bBigger ) { - bRet = TRUE; + bRet = sal_True; // was ist mit Top, was ist mit Tabelle im Rahmen oder in Kopf-/Fusszeile // mit fester Hoehe ?? if( !bRet ) @@ -4346,7 +4347,7 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, } else bRet = (*fnSelLine)( (*pLines)[ nBaseLinePos ], aParam, - nAbsDiff, TRUE ); + nAbsDiff, sal_True ); if( bRet ) { @@ -4354,7 +4355,7 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, { if( !aParam.aBoxes.Count() ) ::lcl_InsDelSelLine( (*pLines)[ nBaseLinePos ], - aParam, 0, TRUE ); + aParam, 0, sal_True ); pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo, aTmpLst ); @@ -4363,7 +4364,7 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, aParam.aBoxes.Count() == aSortCntBoxes.Count() ) { GetFrmFmt()->GetDoc()->DeleteRowCol( aParam.aBoxes ); - return FALSE; + return sal_False; } @@ -4373,16 +4374,16 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, : UNDO_ROW_DELETE ); } else if( ppUndo ) - *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, TRUE ); + *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, sal_True ); (*fnSelLine)( (*pLines)[ nBaseLinePos ], aParam, - nAbsDiff, FALSE ); + nAbsDiff, sal_False ); } } else { - bRet = TRUE; - USHORT nStt, nEnd; + bRet = sal_True; + sal_uInt16 nStt, nEnd; if( bTop ) nStt = 0, nEnd = nBaseLinePos; else @@ -4399,7 +4400,7 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, aParam.nMaxHeight += pLineFrm->Frm().Height(); } if( bBigger && aParam.nMaxSpace < nAbsDiff ) - bRet = FALSE; + bRet = sal_False; } else { @@ -4411,7 +4412,7 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, nEnd = nStt + 1; } else - bRet = FALSE; + bRet = sal_False; } if( bRet ) @@ -4421,16 +4422,16 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, for( n = nStt; n < nEnd; ++n ) { if( !(*fnOtherLine)( (*pLines)[ n ], aParam, - nAbsDiff, TRUE )) + nAbsDiff, sal_True )) { - bRet = FALSE; + bRet = sal_False; break; } } } else bRet = (*fnSelLine)( (*pLines)[ nBaseLinePos ], aParam, - nAbsDiff, TRUE ); + nAbsDiff, sal_True ); } if( bRet ) @@ -4440,7 +4441,7 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, { if( !aParam.aBoxes.Count() ) ::lcl_InsDelSelLine( (*pLines)[ nBaseLinePos ], - aParam, 0, TRUE ); + aParam, 0, sal_True ); pFndBox = ::lcl_SaveInsDelData( aParam, ppUndo, aTmpLst ); if( ppUndo ) *ppUndo = aParam.CreateUndo( @@ -4448,7 +4449,7 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, : UNDO_ROW_DELETE ); } else if( ppUndo ) - *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, TRUE ); + *ppUndo = new SwUndoAttrTbl( *aParam.pTblNd, sal_True ); CR_SetLineHeight aParam1( aParam ); if( TBLFIX_CHGPROP == eTblChgMode && !bBigger && @@ -4463,18 +4464,18 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, if( bTop ) { (*fnSelLine)( (*pLines)[ nBaseLinePos ], aParam, - nAbsDiff, FALSE ); + nAbsDiff, sal_False ); for( n = nStt; n < nEnd; ++n ) (*fnOtherLine)( (*pLines)[ n ], aParam1, - nAbsDiff, FALSE ); + nAbsDiff, sal_False ); } else { for( n = nStt; n < nEnd; ++n ) (*fnOtherLine)( (*pLines)[ n ], aParam1, - nAbsDiff, FALSE ); + nAbsDiff, sal_False ); (*fnSelLine)( (*pLines)[ nBaseLinePos ], aParam, - nAbsDiff, FALSE ); + nAbsDiff, sal_False ); } } else @@ -4510,7 +4511,7 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, if( ppUndo && *ppUndo ) { - aParam.pUndo->SetColWidthParam( nBoxIdx, static_cast<USHORT>(eTblChgMode), eType, + aParam.pUndo->SetColWidthParam( nBoxIdx, static_cast<sal_uInt16>(eTblChgMode), eType, nAbsDiff, nRelDiff ); if( bBigger ) aParam.pUndo->SaveNewBoxes( *aParam.pTblNd, aTmpLst ); @@ -4525,7 +4526,7 @@ BOOL SwTable::SetRowHeight( SwTableBox& rAktBox, USHORT eType, SwFrmFmt* SwShareBoxFmt::GetFormat( long nWidth ) const { SwFrmFmt *pRet = 0, *pTmp; - for( USHORT n = aNewFmts.Count(); n; ) + for( sal_uInt16 n = aNewFmts.Count(); n; ) if( ( pTmp = (SwFrmFmt*)aNewFmts[ --n ])->GetFrmSize().GetWidth() == nWidth ) { @@ -4538,13 +4539,13 @@ SwFrmFmt* SwShareBoxFmt::GetFormat( long nWidth ) const SwFrmFmt* SwShareBoxFmt::GetFormat( const SfxPoolItem& rItem ) const { const SfxPoolItem* pItem; - USHORT nWhich = rItem.Which(); + sal_uInt16 nWhich = rItem.Which(); SwFrmFmt *pRet = 0, *pTmp; - const SfxPoolItem& rFrmSz = pOldFmt->GetFmtAttr( RES_FRM_SIZE, FALSE ); - for( USHORT n = aNewFmts.Count(); n; ) + const SfxPoolItem& rFrmSz = pOldFmt->GetFmtAttr( RES_FRM_SIZE, sal_False ); + for( sal_uInt16 n = aNewFmts.Count(); n; ) if( SFX_ITEM_SET == ( pTmp = (SwFrmFmt*)aNewFmts[ --n ])-> - GetItemState( nWhich, FALSE, &pItem ) && *pItem == rItem && - pTmp->GetFmtAttr( RES_FRM_SIZE, FALSE ) == rFrmSz ) + GetItemState( nWhich, sal_False, &pItem ) && *pItem == rItem && + pTmp->GetFmtAttr( RES_FRM_SIZE, sal_False ) == rFrmSz ) { pRet = pTmp; break; @@ -4558,14 +4559,14 @@ void SwShareBoxFmt::AddFormat( const SwFrmFmt& rNew ) aNewFmts.Insert( pFmt, aNewFmts.Count() ); } -BOOL SwShareBoxFmt::RemoveFormat( const SwFrmFmt& rFmt ) +sal_Bool SwShareBoxFmt::RemoveFormat( const SwFrmFmt& rFmt ) { - // returnt TRUE, wenn geloescht werden kann + // returnt sal_True, wenn geloescht werden kann if( pOldFmt == &rFmt ) - return TRUE; + return sal_True; void* p = (void*)&rFmt; - USHORT nFnd = aNewFmts.GetPos( p ); + sal_uInt16 nFnd = aNewFmts.GetPos( p ); if( USHRT_MAX != nFnd ) aNewFmts.Remove( nFnd ); return 0 == aNewFmts.Count(); @@ -4577,7 +4578,7 @@ SwShareBoxFmts::~SwShareBoxFmts() SwFrmFmt* SwShareBoxFmts::GetFormat( const SwFrmFmt& rFmt, long nWidth ) const { - USHORT nPos; + sal_uInt16 nPos; return Seek_Entry( rFmt, &nPos ) ? aShareArr[ nPos ]->GetFormat( nWidth ) : 0; @@ -4585,7 +4586,7 @@ SwFrmFmt* SwShareBoxFmts::GetFormat( const SwFrmFmt& rFmt, long nWidth ) const SwFrmFmt* SwShareBoxFmts::GetFormat( const SwFrmFmt& rFmt, const SfxPoolItem& rItem ) const { - USHORT nPos; + sal_uInt16 nPos; return Seek_Entry( rFmt, &nPos ) ? aShareArr[ nPos ]->GetFormat( rItem ) : 0; @@ -4594,7 +4595,7 @@ SwFrmFmt* SwShareBoxFmts::GetFormat( const SwFrmFmt& rFmt, void SwShareBoxFmts::AddFormat( const SwFrmFmt& rOld, const SwFrmFmt& rNew ) { { - USHORT nPos; + sal_uInt16 nPos; SwShareBoxFmt* pEntry; if( !Seek_Entry( rOld, &nPos )) { @@ -4676,27 +4677,27 @@ void SwShareBoxFmts::SetAttr( SwTableLine& rLine, const SfxPoolItem& rItem ) void SwShareBoxFmts::RemoveFormat( const SwFrmFmt& rFmt ) { - for( USHORT i = aShareArr.Count(); i; ) + for( sal_uInt16 i = aShareArr.Count(); i; ) if( aShareArr[ --i ]->RemoveFormat( rFmt )) aShareArr.DeleteAndDestroy( i ); } -BOOL SwShareBoxFmts::Seek_Entry( const SwFrmFmt& rFmt, USHORT* pPos ) const +sal_Bool SwShareBoxFmts::Seek_Entry( const SwFrmFmt& rFmt, sal_uInt16* pPos ) const { - ULONG nIdx = (ULONG)&rFmt; - USHORT nO = aShareArr.Count(), nM, nU = 0; + sal_uLong nIdx = (sal_uLong)&rFmt; + sal_uInt16 nO = aShareArr.Count(), nM, nU = 0; if( nO > 0 ) { nO--; while( nU <= nO ) { nM = nU + ( nO - nU ) / 2; - ULONG nFmt = (ULONG)&aShareArr[ nM ]->GetOldFormat(); + sal_uLong nFmt = (sal_uLong)&aShareArr[ nM ]->GetOldFormat(); if( nFmt == nIdx ) { if( pPos ) *pPos = nM; - return TRUE; + return sal_True; } else if( nFmt < nIdx ) nU = nM + 1; @@ -4704,7 +4705,7 @@ BOOL SwShareBoxFmts::Seek_Entry( const SwFrmFmt& rFmt, USHORT* pPos ) const { if( pPos ) *pPos = nU; - return FALSE; + return sal_False; } else nO = nM - 1; @@ -4712,7 +4713,7 @@ BOOL SwShareBoxFmts::Seek_Entry( const SwFrmFmt& rFmt, USHORT* pPos ) const } if( pPos ) *pPos = nU; - return FALSE; + return sal_False; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx index 6de29cd3d866..a39ced3f767e 100644 --- a/sw/source/core/doc/visiturl.cxx +++ b/sw/source/core/doc/visiturl.cxx @@ -68,13 +68,13 @@ void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint ) sURL == pDoc->GetDocShell()->GetMedium()->GetName() ) (sBkmk = pIURL->GetMark()).Insert( INET_MARK_TOKEN, 0 ); - BOOL bAction = FALSE, bUnLockView = FALSE; + sal_Bool bAction = sal_False, bUnLockView = sal_False; const SwFmtINetFmt* pItem; const SwTxtINetFmt* pTxtAttr; const SwTxtNode* pTxtNd; - USHORT n, nMaxItems = pDoc->GetAttrPool().GetItemCount( RES_TXTATR_INETFMT ); + sal_uInt32 n, nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT ); for( n = 0; n < nMaxItems; ++n ) - if( 0 != (pItem = (SwFmtINetFmt*)pDoc->GetAttrPool().GetItem( + if( 0 != (pItem = (SwFmtINetFmt*)pDoc->GetAttrPool().GetItem2( RES_TXTATR_INETFMT, n ) ) && ( pItem->GetValue() == sURL || ( sBkmk.Len() && pItem->GetValue() == sBkmk )) && @@ -84,9 +84,9 @@ void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint ) if( !bAction && pESh ) { pESh->StartAllAction(); - bAction = TRUE; + bAction = sal_True; bUnLockView = !pESh->IsViewLocked(); - pESh->LockView( TRUE ); + pESh->LockView( sal_True ); } const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid( false ); const SwTxtAttr* pAttr = pTxtAttr; @@ -99,20 +99,20 @@ void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint ) if( bAction ) pESh->EndAllAction(); if( bUnLockView ) - pESh->LockView( FALSE ); + pESh->LockView( sal_False ); } } // erfrage ob die URL besucht war. Uebers Doc, falls nur ein Bookmark // angegeben ist. Dann muss der Doc. Name davor gesetzt werden! -BOOL SwDoc::IsVisitedURL( const String& rURL ) const +sal_Bool SwDoc::IsVisitedURL( const String& rURL ) const { #if OSL_DEBUG_LEVEL > 1 static long nTmp = 0; ++nTmp; #endif - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( rURL.Len() ) { INetURLHistory *pHist = INetURLHistory::GetOrCreate(); |