diff options
Diffstat (limited to 'sw/source/core/text')
52 files changed, 849 insertions, 814 deletions
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 773bf3392e..98b5e14e6f 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -102,7 +102,7 @@ LanguageType SwEnhancedPDFExportHelper::eLanguageDefault = 0; #if OSL_DEBUG_LEVEL > 1 -static std::vector< USHORT > aStructStack; +static std::vector< sal_uInt16 > aStructStack; void lcl_DBGCheckStack() { @@ -119,8 +119,8 @@ void lcl_DBGCheckStack() * Formula = 35 Form = 36 Continued frame = 99 */ - USHORT nElement; - std::vector< USHORT >::iterator aIter; + sal_uInt16 nElement; + std::vector< sal_uInt16 >::iterator aIter; for ( aIter = aStructStack.begin(); aIter != aStructStack.end(); ++aIter ) { nElement = *aIter; @@ -436,7 +436,7 @@ void SwTaggedPDFHelper::BeginTag( vcl::PDFWriter::StructElement eType, const Str ++nEndStructureElement; #if OSL_DEBUG_LEVEL > 1 - aStructStack.push_back( static_cast<USHORT>(eType) ); + aStructStack.push_back( static_cast<sal_uInt16>(eType) ); #endif // Store the id of the current structure element if @@ -1017,7 +1017,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() if ( CheckReopenTag() ) return; - USHORT nPDFType = USHRT_MAX; + sal_uInt16 nPDFType = USHRT_MAX; String aPDFType; switch ( pFrm->GetType() ) @@ -1115,7 +1115,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // This is the default. If the paragraph could not be mapped to // any of the standard pdf tags, we write a user defined tag // <stylename> with role = P - nPDFType = static_cast<USHORT>(vcl::PDFWriter::Paragraph); + nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Paragraph); aPDFType = sStyleName; // @@ -1123,7 +1123,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // if ( sStyleName == aQuotations ) { - nPDFType = static_cast<USHORT>(vcl::PDFWriter::BlockQuote); + nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::BlockQuote); aPDFType = aBlockQuoteString; } @@ -1132,7 +1132,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // else if ( sStyleName == aCaption) { - nPDFType = static_cast<USHORT>(vcl::PDFWriter::Caption); + nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Caption); aPDFType = aCaptionString; } @@ -1141,7 +1141,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // else if ( sParentStyleName == aCaption) { - nPDFType = static_cast<USHORT>(vcl::PDFWriter::Caption); + nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Caption); aPDFType = sStyleName.Append(aCaptionString); } @@ -1150,7 +1150,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // else if ( sStyleName == aHeading ) { - nPDFType = static_cast<USHORT>(vcl::PDFWriter::Heading); + nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Heading); aPDFType = aHString; } @@ -1163,7 +1163,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() int nRealLevel = pTxtNd->GetAttrOutlineLevel()-1; //<-end,zhaojianwei nRealLevel = nRealLevel > 5 ? 5 : nRealLevel; - nPDFType = static_cast<USHORT>(vcl::PDFWriter::H1 + nRealLevel); + nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::H1 + nRealLevel); switch(nRealLevel) { case 0 : @@ -1376,7 +1376,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() if ( lcl_IsInNonStructEnv( *pFrm ) ) return; - USHORT nPDFType = USHRT_MAX; + sal_uInt16 nPDFType = USHRT_MAX; String aPDFType; switch ( pPor->GetWhichPor() ) @@ -1428,7 +1428,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() else { const LanguageType nCurrentLanguage = rInf.GetFont()->GetLanguage(); - const USHORT nFont = rInf.GetFont()->GetActual(); + const sal_uInt16 nFont = rInf.GetFont()->GetActual(); const LanguageType nDefaultLang = SwEnhancedPDFExportHelper::GetDefaultLanguage(); if ( UNDERLINE_NONE != rInf.GetFont()->GetUnderline() || @@ -1530,8 +1530,8 @@ SwEnhancedPDFExportHelper::SwEnhancedPDFExportHelper( SwEditShell& rSh, aStructStack.clear(); #endif - const BYTE nScript = (BYTE)GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ); - USHORT nLangRes = RES_CHRATR_LANGUAGE; + const sal_uInt8 nScript = (sal_uInt8)GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); + sal_uInt16 nLangRes = RES_CHRATR_LANGUAGE; if ( i18n::ScriptType::ASIAN == nScript ) nLangRes = RES_CHRATR_CJK_LANGUAGE; @@ -1579,8 +1579,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() SwDoc* pDoc = mrSh.GetDoc(); mrSh.SwCrsrShell::Push(); mrSh.SwCrsrShell::ClearMark(); - const BOOL bOldLockView = mrSh.IsViewLocked(); - mrSh.LockView( TRUE ); + const sal_Bool bOldLockView = mrSh.IsViewLocked(); + mrSh.LockView( sal_True ); if ( !mbEditEngineOnly ) { @@ -1623,7 +1623,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() SvNumberFormatter* pNumFormatter = pDoc->GetNumberFormatter(); const Date aDateDiff( pField->GetDate() - *pNumFormatter->GetNullDate() ); - const ULONG nFormat = + const sal_uLong nFormat = pNumFormatter->GetStandardFormat( NUMBERFORMAT_DATE, pField->GetLanguage() ); String sDate; Color* pColor; @@ -1718,8 +1718,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // <-- // Create links for all selected rectangles: - const USHORT nNumOfRects = aTmp.Count(); - for ( USHORT i = 0; i < nNumOfRects; ++i ) + const sal_uInt16 nNumOfRects = aTmp.Count(); + for ( sal_uInt16 i = 0; i < nNumOfRects; ++i ) { // Link Rectangle const SwRect& rLinkRect( aTmp[ i ] ); @@ -1765,7 +1765,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() const SwFrmFmt* pFrmFmt = (*pTbl)[n]; const SfxPoolItem* pItem; if ( RES_DRAWFRMFMT != pFrmFmt->Which() && - SFX_ITEM_SET == pFrmFmt->GetAttrSet().GetItemState( RES_URL, TRUE, &pItem ) ) + SFX_ITEM_SET == pFrmFmt->GetAttrSet().GetItemState( RES_URL, sal_True, &pItem ) ) { String aURL( static_cast<const SwFmtURL*>(pItem)->GetURL() ); const bool bIntern = '#' == aURL.GetChar( 0 ); @@ -1882,8 +1882,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // <-- // Create links for all selected rectangles: - const USHORT nNumOfRects = aTmp.Count(); - for ( USHORT i = 0; i < nNumOfRects; ++i ) + const sal_uInt16 nNumOfRects = aTmp.Count(); + for ( sal_uInt16 i = 0; i < nNumOfRects; ++i ) { // Link rectangle const SwRect& rLinkRect( aTmp[ i ] ); @@ -1923,8 +1923,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // // FOOTNOTES // - const USHORT nFtnCount = pDoc->GetFtnIdxs().Count(); - for ( USHORT nIdx = 0; nIdx < nFtnCount; ++nIdx ) + const sal_uInt16 nFtnCount = pDoc->GetFtnIdxs().Count(); + for ( sal_uInt16 nIdx = 0; nIdx < nFtnCount; ++nIdx ) { // Set cursor to text node that contains the footnote: const SwTxtFtn* pTxtFtn = pDoc->GetFtnIdxs()[ nIdx ]; @@ -2125,7 +2125,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // Restore view, cursor, and outdev: mrSh.LockView( bOldLockView ); - mrSh.SwCrsrShell::Pop( FALSE ); + mrSh.SwCrsrShell::Pop( sal_False ); mrOut.Pop(); } diff --git a/sw/source/core/text/atrhndl.hxx b/sw/source/core/text/atrhndl.hxx index 513ca18f97..d003132d50 100644 --- a/sw/source/core/text/atrhndl.hxx +++ b/sw/source/core/text/atrhndl.hxx @@ -39,7 +39,7 @@ class SwAttrSet; class IDocumentSettingAccess; class ViewShell; class SfxPoolItem; -extern const BYTE StackPos[]; +extern const sal_uInt8 StackPos[]; /************************************************************************* * class SwAttrHandler @@ -63,8 +63,8 @@ private: private: SwTxtAttr* pInitialArray[ INITIAL_NUM_ATTR ]; SwTxtAttr** pArray; - USHORT nCount; // number of elements on stack - USHORT nSize; // number of positions in Array + sal_uInt16 nCount; // number of elements on stack + sal_uInt16 nSize; // number of positions in Array public: // Ctor, Dtor @@ -79,7 +79,7 @@ private: inline void Push( const SwTxtAttr& rAttr ) { Insert( rAttr, nCount ); }; // insert at specified position, take care for not inserting behind // the value returned by Count() - void Insert( const SwTxtAttr& rAttr, const USHORT nPos ); + void Insert( const SwTxtAttr& rAttr, const sal_uInt16 nPos ); // remove specified attribute void Remove( const SwTxtAttr& rAttr ); @@ -88,11 +88,11 @@ private: const SwTxtAttr* Top() const; // number of elements on stack - inline USHORT Count() const { return nCount; }; + inline sal_uInt16 Count() const { return nCount; }; // returns position of rAttr on Stack if found, otherwise USHRT_MAX // can be used for Remove of an attribute - USHORT Pos( const SwTxtAttr& rAttr ) const; + sal_uInt16 Pos( const SwTxtAttr& rAttr ) const; }; SwAttrStack aAttrStack[ NUM_ATTRIBUTE_STACKS ]; // stack collection @@ -115,7 +115,7 @@ private: sal_Bool Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem ); // apply top attribute on stack to font - void ActivateTop( SwFont& rFnt, USHORT nStackPos ); + void ActivateTop( SwFont& rFnt, sal_uInt16 nStackPos ); public: // Ctor @@ -142,21 +142,21 @@ public: void Pop( const SwTxtAttr& rAttr ); // apply script dependent attributes -// void ChangeScript( SwFont& rFnt, const BYTE nScr ); +// void ChangeScript( SwFont& rFnt, const sal_uInt8 nScr ); // returns the default value for stack nStack - inline const SfxPoolItem& GetDefault( const USHORT nAttribID ) const; + inline const SfxPoolItem& GetDefault( const sal_uInt16 nAttribID ) const; // do not call these if you only used the small init function inline void ResetFont( SwFont& rFnt ) const; inline const SwFont* GetFont() const; void GetDefaultAscentAndHeight(ViewShell* pShell, OutputDevice& rOut, - USHORT& nAscent, - USHORT& nHeight) const; + sal_uInt16& nAscent, + sal_uInt16& nHeight) const; }; -inline const SfxPoolItem& SwAttrHandler::GetDefault( const USHORT nAttribID ) const +inline const SfxPoolItem& SwAttrHandler::GetDefault( const sal_uInt16 nAttribID ) const { OSL_ENSURE( nAttribID < RES_TXTATR_END, "this attrib does not ex." diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx index e33799a731..8ae39320d5 100644 --- a/sw/source/core/text/atrstck.cxx +++ b/sw/source/core/text/atrstck.cxx @@ -81,8 +81,8 @@ * Also adjust NUM_ATTRIBUTE_STACKS in atrhndl.hxx. *************************************************************************/ -const BYTE StackPos[ static_cast<USHORT>(RES_TXTATR_WITHEND_END) - - static_cast<USHORT>(RES_CHRATR_BEGIN) + 1 ] = +const sal_uInt8 StackPos[ static_cast<sal_uInt16>(RES_TXTATR_WITHEND_END) - + static_cast<sal_uInt16>(RES_CHRATR_BEGIN) + 1 ] = { 0, // // 0 1, // RES_CHRATR_CASEMAP = RES_CHRATR_BEGIN // 1 @@ -173,7 +173,7 @@ const SfxItemSet* GetItemSet( const SfxPoolItem& rAttr ) * extracts pool item of type nWhich from rAttr *************************************************************************/ -const SfxPoolItem* GetItem( const SwTxtAttr& rAttr, USHORT nWhich ) +const SfxPoolItem* GetItem( const SwTxtAttr& rAttr, sal_uInt16 nWhich ) { if ( RES_TXTATR_INETFMT == rAttr.Which() || RES_TXTATR_CHARFMT == rAttr.Which() || @@ -184,7 +184,7 @@ const SfxPoolItem* GetItem( const SwTxtAttr& rAttr, USHORT nWhich ) bool bInParent = RES_TXTATR_AUTOFMT != rAttr.Which(); const SfxPoolItem* pItem; - BOOL bRet = SFX_ITEM_SET == pSet->GetItemState( nWhich, bInParent, &pItem ); + sal_Bool bRet = SFX_ITEM_SET == pSet->GetItemState( nWhich, bInParent, &pItem ); return bRet ? pItem : 0; } @@ -197,13 +197,13 @@ const SfxPoolItem* GetItem( const SwTxtAttr& rAttr, USHORT nWhich ) * checks if item is included in character/inet/auto style *************************************************************************/ -BOOL IsItemIncluded( const USHORT nWhich, const SwTxtAttr *pAttr ) +sal_Bool IsItemIncluded( const sal_uInt16 nWhich, const SwTxtAttr *pAttr ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; const SfxItemSet* pItemSet = CharFmt::GetItemSet( pAttr->GetAttr() ); if ( pItemSet ) - bRet = SFX_ITEM_SET == pItemSet->GetItemState( nWhich, TRUE ); + bRet = SFX_ITEM_SET == pItemSet->GetItemState( nWhich, sal_True ); return bRet; } @@ -248,7 +248,7 @@ bool lcl_ChgHyperLinkColor( const SwTxtAttr& rAttr, rInetAttr.SetVisited( false ); const SwCharFmt* pTmpFmt = ((SwTxtINetFmt&)rAttr).GetCharFmt(); const SfxPoolItem* pItem; - pTmpFmt->GetItemState( RES_CHRATR_COLOR, TRUE, &pItem ); + pTmpFmt->GetItemState( RES_CHRATR_COLOR, sal_True, &pItem ); *pColor = ((SvxColorItem*)pItem)->GetValue(); rInetAttr.SetVisited( true ); } @@ -304,7 +304,7 @@ inline SwAttrHandler::SwAttrStack::SwAttrStack() * SwAttrHandler::SwAttrStack::Insert() *************************************************************************/ -void SwAttrHandler::SwAttrStack::Insert( const SwTxtAttr& rAttr, const USHORT nPos ) +void SwAttrHandler::SwAttrStack::Insert( const SwTxtAttr& rAttr, const sal_uInt16 nPos ) { // do we still have enough space? if ( nCount >= nSize ) @@ -349,7 +349,7 @@ void SwAttrHandler::SwAttrStack::Insert( const SwTxtAttr& rAttr, const USHORT nP void SwAttrHandler::SwAttrStack::Remove( const SwTxtAttr& rAttr ) { - USHORT nPos = Pos( rAttr ); + sal_uInt16 nPos = Pos( rAttr ); if ( nPos < nCount ) { memmove( pArray + nPos, pArray + nPos + 1, @@ -372,13 +372,13 @@ const SwTxtAttr* SwAttrHandler::SwAttrStack::Top() const * SwAttrHandler::SwAttrStack::Pos() *************************************************************************/ -USHORT SwAttrHandler::SwAttrStack::Pos( const SwTxtAttr& rAttr ) const +sal_uInt16 SwAttrHandler::SwAttrStack::Pos( const SwTxtAttr& rAttr ) const { if ( ! nCount ) // empty stack return USHRT_MAX; - for ( USHORT nIdx = nCount; nIdx > 0; ) + for ( sal_uInt16 nIdx = nCount; nIdx > 0; ) { if ( &rAttr == pArray[ --nIdx ] ) return nIdx; @@ -414,8 +414,8 @@ void SwAttrHandler::Init( const SwAttrSet& rAttrSet, mpIDocumentSettingAccess = &rIDocumentSettingAcces; mpShell = pSh; - for ( USHORT i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++ ) - pDefaultArray[ StackPos[ i ] ] = &rAttrSet.Get( i, TRUE ); + for ( sal_uInt16 i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++ ) + pDefaultArray[ StackPos[ i ] ] = &rAttrSet.Get( i, sal_True ); } void SwAttrHandler::Init( const SfxPoolItem** pPoolItem, const SwAttrSet* pAS, @@ -436,9 +436,9 @@ void SwAttrHandler::Init( const SfxPoolItem** pPoolItem, const SwAttrSet* pAS, if ( pAS && pAS->Count() ) { SfxItemIter aIter( *pAS ); - USHORT nWhich; + sal_uInt16 nWhich; const SfxPoolItem* pItem = aIter.GetCurItem(); - while( TRUE ) + while( sal_True ) { nWhich = pItem->Which(); if (isCHRATR(nWhich)) @@ -462,7 +462,7 @@ void SwAttrHandler::Init( const SfxPoolItem** pPoolItem, const SwAttrSet* pAS, void SwAttrHandler::Reset( ) { - for ( USHORT i = 0; i < NUM_ATTRIBUTE_STACKS; i++ ) + for ( sal_uInt16 i = 0; i < NUM_ATTRIBUTE_STACKS; i++ ) aAttrStack[ i ].Reset(); } @@ -481,10 +481,10 @@ void SwAttrHandler::PushAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) const SfxItemSet* pSet = CharFmt::GetItemSet( rAttr.GetAttr() ); if ( !pSet ) return; - for ( USHORT i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++) + for ( sal_uInt16 i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++) { const SfxPoolItem* pItem; - BOOL bRet = SFX_ITEM_SET == pSet->GetItemState( i, rAttr.Which() != RES_TXTATR_AUTOFMT, &pItem ); + sal_Bool bRet = SFX_ITEM_SET == pSet->GetItemState( i, rAttr.Which() != RES_TXTATR_AUTOFMT, &pItem ); if ( bRet ) { @@ -527,7 +527,7 @@ sal_Bool SwAttrHandler::Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem ) if ( RES_TXTATR_WITHEND_END <= rItem.Which() ) return sal_False; - USHORT nStack = StackPos[ rItem.Which() ]; + sal_uInt16 nStack = StackPos[ rItem.Which() ]; // attributes originating from redlining have highest priority // second priority are hyperlink attributes, which have a color replacement @@ -540,7 +540,7 @@ sal_Bool SwAttrHandler::Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem ) return sal_True; } - USHORT nPos = aAttrStack[ nStack ].Count(); + sal_uInt16 nPos = aAttrStack[ nStack ].Count(); OSL_ENSURE( nPos, "empty stack?" ); aAttrStack[ nStack ].Insert( rAttr, nPos - 1 ); return sal_False; @@ -564,14 +564,14 @@ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) const SfxItemSet* pSet = CharFmt::GetItemSet( rAttr.GetAttr() ); if ( !pSet ) return; - for ( USHORT i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++) + for ( sal_uInt16 i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++) { const SfxPoolItem* pItem; - BOOL bRet = SFX_ITEM_SET == pSet->GetItemState( i, RES_TXTATR_AUTOFMT != rAttr.Which(), &pItem ); + sal_Bool bRet = SFX_ITEM_SET == pSet->GetItemState( i, RES_TXTATR_AUTOFMT != rAttr.Which(), &pItem ); if ( bRet ) { // we remove rAttr from the appropriate stack - USHORT nStackPos = StackPos[ i ]; + sal_uInt16 nStackPos = StackPos[ i ]; aAttrStack[ nStackPos ].Remove( rAttr ); // reset font according to attribute on top of stack // or default value @@ -610,12 +610,12 @@ void SwAttrHandler::Pop( const SwTxtAttr& rAttr ) /************************************************************************* * SwAttrHandler::ActivateTop() *************************************************************************/ -void SwAttrHandler::ActivateTop( SwFont& rFnt, const USHORT nAttr ) +void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr ) { OSL_ENSURE( nAttr < RES_TXTATR_WITHEND_END, "I cannot activate this attribute, nWhich >= RES_TXTATR_WITHEND_END" ); - const USHORT nStackPos = StackPos[ nAttr ]; + const sal_uInt16 nStackPos = StackPos[ nAttr ]; const SwTxtAttr* pTopAt = aAttrStack[ nStackPos ].Top(); if ( pTopAt ) { @@ -656,7 +656,7 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const USHORT nAttr ) { // ruby stack has no more attributes // check, if an rotation attribute has to be applied - USHORT nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ]; + sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ]; sal_Bool bTwoLineAct = sal_False; const SfxPoolItem* pTwoLineItem = 0; const SwTxtAttr* pTwoLineAttr = aAttrStack[ nTwoLineStack ].Top(); @@ -674,7 +674,7 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const USHORT nAttr ) return; // eventually, an rotate attribute has to be activated - USHORT nRotateStack = StackPos[ RES_CHRATR_ROTATE ]; + sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ]; const SfxPoolItem* pRotateItem = 0; const SwTxtAttr* pRotateAttr = aAttrStack[ nRotateStack ].Top(); @@ -744,7 +744,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, sal_Bool bPu break; case RES_CHRATR_UNDERLINE : { - const USHORT nStackPos = StackPos[ RES_CHRATR_HIDDEN ]; + const sal_uInt16 nStackPos = StackPos[ RES_CHRATR_HIDDEN ]; const SwTxtAttr* pTopAt = aAttrStack[ nStackPos ].Top(); const SfxPoolItem* pTmpItem = pTopAt ? @@ -856,7 +856,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, sal_Bool bPu if ( bRuby ) break; - USHORT nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ]; + sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ]; sal_Bool bTwoLineAct = sal_False; const SfxPoolItem* pTwoLineItem = 0; const SwTxtAttr* pTwoLineAttr = aAttrStack[ nTwoLineStack ].Top(); @@ -898,7 +898,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, sal_Bool bPu if ( bRuby ) break; - USHORT nRotateStack = StackPos[ RES_CHRATR_ROTATE ]; + sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ]; const SfxPoolItem* pRotateItem = 0; const SwTxtAttr* pRotateAttr = aAttrStack[ nRotateStack ].Top(); @@ -942,7 +942,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, sal_Bool bPu // Takes the default font and calculated the ascent and height void SwAttrHandler::GetDefaultAscentAndHeight( ViewShell* pShell, OutputDevice& rOut, - USHORT& nAscent, USHORT& nHeight ) const + sal_uInt16& nAscent, sal_uInt16& nHeight ) const { OSL_ENSURE( pFnt, "No font available for GetDefaultAscentAndHeight" ); diff --git a/sw/source/core/text/blink.cxx b/sw/source/core/text/blink.cxx index ee138a4a9d..3421f2100f 100644 --- a/sw/source/core/text/blink.cxx +++ b/sw/source/core/text/blink.cxx @@ -137,7 +137,7 @@ IMPL_LINK( SwBlink, Blinker, Timer *, EMPTYARG ) } void SwBlink::Insert( const Point& rPoint, const SwLinePortion* pPor, - const SwTxtFrm *pTxtFrm, USHORT nDir ) + const SwTxtFrm *pTxtFrm, sal_uInt16 nDir ) { SwBlinkPortion *pBlinkPor = new SwBlinkPortion( pPor, nDir ); diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index b69a42d30b..50e40ac0c1 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -79,7 +79,7 @@ using namespace ::com::sun::star; *************************************************************************/ SwTxtFrm *GetAdjFrmAtPos( SwTxtFrm *pFrm, const SwPosition &rPos, - const sal_Bool bRightMargin, const sal_Bool bNoScroll = TRUE ) + const sal_Bool bRightMargin, const sal_Bool bNoScroll = sal_True ) { // 8810: vgl. 1170, RightMargin in der letzten Masterzeile... const xub_StrLen nOffset = rPos.nContent.GetIndex(); @@ -222,10 +222,11 @@ sal_Bool SwTxtFrm::GetCharRect( SwRect& rOrig, const SwPosition &rPos, SWRECTFN ( pFrm ) const SwTwips nUpperMaxY = (pTmpFrm->*fnRect->fnGetPrtBottom)(); const SwTwips nFrmMaxY = (pFrm->*fnRect->fnGetPrtBottom)(); - + // nMaxY is an absolute value + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin SwTwips nMaxY = bVert ? - Max( nFrmMaxY, nUpperMaxY ) : + ( bVertL2R ? Min( nFrmMaxY, nUpperMaxY ) : Max( nFrmMaxY, nUpperMaxY ) ) : Min( nFrmMaxY, nUpperMaxY ); sal_Bool bRet = sal_False; @@ -242,8 +243,8 @@ sal_Bool SwTxtFrm::GetCharRect( SwRect& rOrig, const SwPosition &rPos, { if( nFirstOffset > 0 ) aPnt1.Y() += nFirstOffset; - - if ( aPnt1.X() < nMaxY ) + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if ( aPnt1.X() < nMaxY && !bVertL2R ) aPnt1.X() = nMaxY; aPnt2.X() = aPnt1.X() + pFrm->Prt().Width(); aPnt2.Y() = aPnt1.Y(); @@ -396,8 +397,9 @@ sal_Bool SwTxtFrm::GetAutoPos( SwRect& rOrig, const SwPosition &rPos ) const SwTwips nUpperMaxY = (pTmpFrm->*fnRect->fnGetPrtBottom)(); // nMaxY is in absolute value + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin SwTwips nMaxY = bVert ? - Max( (pFrm->*fnRect->fnGetPrtBottom)(), nUpperMaxY ) : + ( bVertL2R ? Min( (pFrm->*fnRect->fnGetPrtBottom)(), nUpperMaxY ) : Max( (pFrm->*fnRect->fnGetPrtBottom)(), nUpperMaxY ) ) : Min( (pFrm->*fnRect->fnGetPrtBottom)(), nUpperMaxY ); if ( pFrm->IsEmpty() || ! (pFrm->Prt().*fnRect->fnGetHeight)() ) @@ -406,8 +408,9 @@ sal_Bool SwTxtFrm::GetAutoPos( SwRect& rOrig, const SwPosition &rPos ) const Point aPnt2; if ( bVert ) { - if ( aPnt1.X() < nMaxY ) + if ( aPnt1.X() < nMaxY && !bVertL2R ) aPnt1.X() = nMaxY; + aPnt2.X() = aPnt1.X() + pFrm->Prt().Width(); aPnt2.Y() = aPnt1.Y(); if( aPnt2.X() < nMaxY ) @@ -437,7 +440,7 @@ sal_Bool SwTxtFrm::GetAutoPos( SwRect& rOrig, const SwPosition &rPos ) const SwTxtSizeInfo aInf( pFrm ); SwTxtCursor aLine( pFrm, &aInf ); SwCrsrMoveState aTmpState( MV_SETONLYTEXT ); - aTmpState.bRealHeight = TRUE; + aTmpState.bRealHeight = sal_True; if( aLine.GetCharRect( &rOrig, nOffset, &aTmpState, nMaxY ) ) { if( aTmpState.aRealHeight.X() >= 0 ) @@ -779,7 +782,7 @@ sal_Bool SwTxtFrm::RightMargin(SwPaM *pPam, sal_Bool bAPI) const if( aLine.GetCurr()->GetLen() && CH_BREAK == aInf.GetTxt().GetChar( nRightMargin - 1 ) ) --nRightMargin; - if( !bAPI && (aLine.GetNext() || pFrm->GetFollow()) ) + else if( !bAPI && (aLine.GetNext() || pFrm->GetFollow()) ) { while( nRightMargin > aLine.GetStart() && ' ' == aInf.GetTxt().GetChar( nRightMargin - 1 ) ) @@ -884,7 +887,7 @@ sal_Bool SwTxtFrm::_UnitUp( SwPaM *pPam, const SwTwips nOffset, // siehe Kommentar in SwTxtFrm::GetCrsrOfst() #if OSL_DEBUG_LEVEL > 1 - const ULONG nOldNode = pPam->GetPoint()->nNode.GetIndex(); + const sal_uLong nOldNode = pPam->GetPoint()->nNode.GetIndex(); #endif // Der Node soll nicht gewechselt werden xub_StrLen nTmpOfst = aLine.GetCrsrOfst( pPam->GetPoint(), @@ -955,7 +958,7 @@ sal_Bool SwTxtFrm::_UnitUp( SwPaM *pPam, const SwTwips nOffset, // current position void lcl_VisualMoveRecursion( const SwLineLayout& rCurrLine, xub_StrLen nIdx, xub_StrLen& nPos, sal_Bool& bRight, - BYTE& nCrsrLevel, BYTE nDefaultDir ) + sal_uInt8& nCrsrLevel, sal_uInt8 nDefaultDir ) { const SwLinePortion* pPor = rCurrLine.GetFirstPortion(); const SwLinePortion* pLast = 0; @@ -1010,7 +1013,7 @@ void lcl_VisualMoveRecursion( const SwLineLayout& rCurrLine, xub_StrLen nIdx, const SwLineLayout& rLine = ((SwMultiPortion*)pPor)->GetRoot(); xub_StrLen nTmpPos = nPos - nIdx; sal_Bool bTmpForward = ! bRight; - BYTE nTmpCrsrLevel = nCrsrLevel; + sal_uInt8 nTmpCrsrLevel = nCrsrLevel; lcl_VisualMoveRecursion( rLine, 0, nTmpPos, bTmpForward, nTmpCrsrLevel, nDefaultDir + 1 ); @@ -1069,7 +1072,7 @@ void lcl_VisualMoveRecursion( const SwLineLayout& rCurrLine, xub_StrLen nIdx, const SwLineLayout& rLine = ((SwMultiPortion*)pPor)->GetRoot(); xub_StrLen nTmpPos = nPos - nIdx; sal_Bool bTmpForward = ! bRight; - BYTE nTmpCrsrLevel = nCrsrLevel; + sal_uInt8 nTmpCrsrLevel = nCrsrLevel; lcl_VisualMoveRecursion( rLine, 0, nTmpPos, bTmpForward, nTmpCrsrLevel, nDefaultDir + 1 ); @@ -1098,7 +1101,7 @@ void lcl_VisualMoveRecursion( const SwLineLayout& rCurrLine, xub_StrLen nIdx, } } -void SwTxtFrm::PrepareVisualMove( xub_StrLen& nPos, BYTE& nCrsrLevel, +void SwTxtFrm::PrepareVisualMove( xub_StrLen& nPos, sal_uInt8& nCrsrLevel, sal_Bool& bForward, sal_Bool bInsertCrsr ) { if( IsEmpty() || IsHiddenNow() ) @@ -1134,7 +1137,7 @@ void SwTxtFrm::PrepareVisualMove( xub_StrLen& nPos, BYTE& nCrsrLevel, return; } - const BYTE nDefaultDir = static_cast<BYTE>(IsRightToLeft() ? UBIDI_RTL : UBIDI_LTR); + const sal_uInt8 nDefaultDir = static_cast<sal_uInt8>(IsRightToLeft() ? UBIDI_RTL : UBIDI_LTR); const sal_Bool bVisualRight = ( nDefaultDir == UBIDI_LTR && bForward ) || ( nDefaultDir == UBIDI_RTL && ! bForward ); @@ -1253,7 +1256,7 @@ sal_Bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset, aCharBox.SSize().Width() /= 2; #if OSL_DEBUG_LEVEL > 1 // siehe Kommentar in SwTxtFrm::GetCrsrOfst() - const ULONG nOldNode = pPam->GetPoint()->nNode.GetIndex(); + const sal_uLong nOldNode = pPam->GetPoint()->nNode.GetIndex(); #endif if ( pNextLine && ! bFirstOfDouble ) aLine.NextLine(); @@ -1474,7 +1477,7 @@ void SwTxtFrm::FillCrsrPos( SwFillData& rFill ) const nFirst = 0; } else if( nDist < nFirst ) - nFirst = nFirst - (USHORT)nDist; + nFirst = nFirst - (sal_uInt16)nDist; else nFirst = 0; nDist = Max( nDist, long( GetLineSpace() ) ); @@ -1484,7 +1487,7 @@ void SwTxtFrm::FillCrsrPos( SwFillData& rFill ) const if( nDiff > 0 ) { nDiff /= nDist; - rFill.Fill().nParaCnt = static_cast<USHORT>(nDiff + 1); + rFill.Fill().nParaCnt = static_cast<sal_uInt16>(nDiff + 1); rFill.nLineWidth = 0; rFill.bInner = sal_False; rFill.bEmpty = sal_True; diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index e6f3285515..44ee491173 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -467,9 +467,17 @@ void SwTxtFrm::AdjustFrm( const SwTwips nChgHght, sal_Bool bHasToFit ) if ( IsVertical() ) { OSL_ENSURE( ! IsSwapped(),"Swapped frame while calculating nRstHeight" ); - nRstHeight = Frm().Left() + Frm().Width() - - ( GetUpper()->Frm().Left() + GetUpper()->Prt().Left() ); - } + + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if ( IsVertLR() ) + nRstHeight = GetUpper()->Frm().Left() + + GetUpper()->Prt().Left() + + GetUpper()->Prt().Width() + - Frm().Left(); + else + nRstHeight = Frm().Left() + Frm().Width() - + ( GetUpper()->Frm().Left() + GetUpper()->Prt().Left() ); + } else nRstHeight = GetUpper()->Frm().Top() + GetUpper()->Prt().Top() @@ -625,7 +633,7 @@ SwCntntFrm *SwTxtFrm::JoinFrm() { SwFtnBossFrm *pFtnBoss = 0; SwFtnBossFrm *pEndBoss = 0; - for ( USHORT i = 0; i < pHints->Count(); ++i ) + for ( sal_uInt16 i = 0; i < pHints->Count(); ++i ) { const SwTxtAttr *pHt = (*pHints)[i]; if( RES_TXTATR_FTN==pHt->Which() && *pHt->GetStart()>=nStart ) @@ -658,7 +666,7 @@ SwCntntFrm *SwTxtFrm::JoinFrm() #endif pFoll->MoveFlyInCnt( this, nStart, STRING_LEN ); - pFoll->SetFtn( FALSE ); + pFoll->SetFtn( sal_False ); // --> OD 2005-12-01 #i27138# // notify accessibility paragraphs objects about changed CONTENT_FLOWS_FROM/_TO relation. // Relation CONTENT_FLOWS_FROM for current next paragraph will change @@ -725,7 +733,7 @@ SwCntntFrm *SwTxtFrm::SplitFrm( const xub_StrLen nTxtPos ) { SwFtnBossFrm *pFtnBoss = 0; SwFtnBossFrm *pEndBoss = 0; - for ( USHORT i = 0; i < pHints->Count(); ++i ) + for ( sal_uInt16 i = 0; i < pHints->Count(); ++i ) { const SwTxtAttr *pHt = (*pHints)[i]; if( RES_TXTATR_FTN==pHt->Which() && *pHt->GetStart()>=nTxtPos ) @@ -1114,7 +1122,9 @@ void SwTxtFrm::FormatAdjust( SwTxtFormatter &rLine, // If the frame grows (or shirks) the repaint rectangle cannot simply // be rotated back after formatting, because we use the upper left point // of the frame for rotation. This point changes when growing/shrinking. - if ( IsVertical() && nChg ) + + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if ( IsVertical() && !IsVertLR() && nChg ) { SwRect &rRepaint = *(pPara->GetRepaint()); rRepaint.Left( rRepaint.Left() - nChg ); diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index c41dd9799e..b26712ebe8 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -94,7 +94,7 @@ class SwExtraPainter const SwLineNumberInfo &rLineInf; SwTwips nX; SwTwips nRedX; - ULONG nLineNr; + sal_uLong nLineNr; MSHORT nDivider; sal_Bool bGoLeft; sal_Bool bLineNum; @@ -448,6 +448,10 @@ SwRect SwTxtFrm::Paint() // d.h. als linken Rand den berechneten PaintOfst! SwRepaint *pRepaint = GetPara()->GetRepaint(); long l; + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if ( IsVertLR() ) // mba: the following line was added, but we don't need it for the existing directions; kept for IsVertLR(), but should be checked + pRepaint->Chg( ( GetUpper()->Frm() ).Pos() + ( GetUpper()->Prt() ).Pos(), ( GetUpper()->Prt() ).SSize() ); + if( pRepaint->GetOfst() ) pRepaint->Left( pRepaint->GetOfst() ); @@ -596,7 +600,7 @@ sal_Bool SwTxtFrm::PaintEmpty( const SwRect &rRect, sal_Bool bCheck ) const * SwTxtFrm::Paint() *************************************************************************/ -void SwTxtFrm::Paint( const SwRect &rRect, const SwPrtOptions * /*pPrintData*/ ) const +void SwTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const { ResetRepaint(); diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index 522f707289..cd489f3539 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -77,13 +77,13 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, OSL_ENSURE( nPorHeight, "+SwTxtGuess::Guess: no height" ); - USHORT nMinSize; - USHORT nMaxSizeDiff; + sal_uInt16 nMinSize; + sal_uInt16 nMaxSizeDiff; const SwScriptInfo& rSI = ((SwParaPortion*)rInf.GetParaPortion())->GetScriptInfo(); - USHORT nMaxComp = ( SW_CJK == rInf.GetFont()->GetActual() ) && + sal_uInt16 nMaxComp = ( SW_CJK == rInf.GetFont()->GetActual() ) && rSI.CountCompChg() && ! rInf.IsMulti() && ! rPor.InFldGrp() && @@ -149,7 +149,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // save maximum width for later use if ( nMaxSizeDiff ) - rInf.SetMaxWidthDiff( (ULONG)&rPor, nMaxSizeDiff ); + rInf.SetMaxWidthDiff( (sal_uLong)&rPor, nMaxSizeDiff ); return sal_True; } @@ -200,7 +200,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // save maximum width for later use if ( nMaxSizeDiff ) - rInf.SetMaxWidthDiff( (ULONG)&rPor, nMaxSizeDiff ); + rInf.SetMaxWidthDiff( (sal_uLong)&rPor, nMaxSizeDiff ); return sal_True; } @@ -326,7 +326,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // we have to check the script type of the last "real" character if ( nLangIndex < rInf.GetIdx() ) { - USHORT nScript = pBreakIt->GetRealScriptOfText( rInf.GetTxt(), + sal_uInt16 nScript = pBreakIt->GetRealScriptOfText( rInf.GetTxt(), nLangIndex ); OSL_ENSURE( nScript, "Script is not between 1 and 4" ); @@ -393,10 +393,10 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // e.g., Schiff-fahrt, referes to the word after hyphenation const String aHyphenatedWord = xHyphWord->getHyphenatedWord(); // e.g., Schif-fahrt: 5, referes to our string - const USHORT nHyphenationPos = xHyphWord->getHyphenationPos(); + const sal_uInt16 nHyphenationPos = xHyphWord->getHyphenationPos(); (void)nHyphenationPos; // e.g., Schiff-fahrt: 6, referes to the word after hyphenation - const USHORT nHyphenPos = xHyphWord->getHyphenPos(); + const sal_uInt16 nHyphenPos = xHyphWord->getHyphenPos(); (void)nHyphenPos; #endif @@ -503,7 +503,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // save maximum width for later use if ( nMaxSizeDiff ) - rInf.SetMaxWidthDiff( (ULONG)&rPor, nMaxSizeDiff ); + rInf.SetMaxWidthDiff( (sal_uLong)&rPor, nMaxSizeDiff ); nBreakWidth = nItalic + nMinSize; } diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 18fd618e39..0aaa606e29 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -163,7 +163,7 @@ void SwLineInfo::CtorInitLineInfo( const SwAttrSet& rAttrSet, pRuler->Insert( aListTabStop ); // remove default tab stops, which are before the inserted list tab stop - for ( USHORT i = 0; i < pRuler->Count(); i++ ) + for ( sal_uInt16 i = 0; i < pRuler->Count(); i++ ) { if ( (*pRuler)[i].GetTabPos() < nListTabStopPosition && (*pRuler)[i].GetAdjustment() == SVX_TAB_ADJUST_DEFAULT ) @@ -177,7 +177,7 @@ void SwLineInfo::CtorInitLineInfo( const SwAttrSet& rAttrSet, if ( !rTxtNode.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) ) { // remove default tab stop at position 0 - for ( USHORT i = 0; i < pRuler->Count(); i++ ) + for ( sal_uInt16 i = 0; i < pRuler->Count(); i++ ) { if ( (*pRuler)[i].GetTabPos() == 0 && (*pRuler)[i].GetAdjustment() == SVX_TAB_ADJUST_DEFAULT ) @@ -423,7 +423,7 @@ SwPosSize SwTxtSizeInfo::GetTxtSize( OutputDevice* pOutDev, const XubString& rTxt, const xub_StrLen nIndex, const xub_StrLen nLength, - const USHORT nComp ) const + const sal_uInt16 nComp ) const { SwDrawTextInfo aDrawInf( pVsh, *pOutDev, pSI, rTxt, nIndex, nLength ); aDrawInf.SetFrm( pFrm ); @@ -445,7 +445,7 @@ SwPosSize SwTxtSizeInfo::GetTxtSize() const // in some cases, compression is not allowed or surpressed for // performance reasons - USHORT nComp =( SW_CJK == GetFont()->GetActual() && + sal_uInt16 nComp =( SW_CJK == GetFont()->GetActual() && rSI.CountCompChg() && ! IsMulti() ) ? GetKanaComp() : @@ -464,8 +464,8 @@ SwPosSize SwTxtSizeInfo::GetTxtSize() const *************************************************************************/ void SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIndex, - const xub_StrLen nLength, const USHORT nComp, - USHORT& nMinSize, USHORT& nMaxSizeDiff ) const + const xub_StrLen nLength, const sal_uInt16 nComp, + sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff ) const { SwDrawTextInfo aDrawInf( pVsh, *pOut, pSI, *pTxt, nIndex, nLength ); aDrawInf.SetFrm( pFrm ); @@ -473,7 +473,7 @@ void SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIndex aDrawInf.SetSnapToGrid( SnapToGrid() ); aDrawInf.SetKanaComp( nComp ); SwPosSize aSize = pFnt->_GetTxtSize( aDrawInf ); - nMaxSizeDiff = (USHORT)aDrawInf.GetKanaDiff(); + nMaxSizeDiff = (sal_uInt16)aDrawInf.GetKanaDiff(); nMinSize = aSize.Width(); } @@ -483,7 +483,7 @@ void SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIndex xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth, const xub_StrLen nMaxLen, - const USHORT nComp ) const + const sal_uInt16 nComp ) const { const SwScriptInfo& rScriptInfo = ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo(); @@ -506,7 +506,7 @@ xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth, xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth, const xub_StrLen nMaxLen, - const USHORT nComp, + const sal_uInt16 nComp, xub_StrLen& rExtraCharPos ) const { const SwScriptInfo& rScriptInfo = @@ -594,7 +594,7 @@ sal_Bool lcl_IsDarkBackground( const SwTxtPaintInfo& rInf ) /// OD 21.08.2002 #99657# /// There is a background color, if there is a background brush and /// its color is *not* "no fill"/"auto fill". - if( rInf.GetTxtFrm()->GetBackgroundBrush( pItem, pCol, aOrigBackRect, FALSE ) ) + if( rInf.GetTxtFrm()->GetBackgroundBrush( pItem, pCol, aOrigBackRect, sal_False ) ) { if ( !pCol ) pCol = &pItem->GetColor(); @@ -668,7 +668,7 @@ void SwTxtPaintInfo::_DrawText( const XubString &rText, const SwLinePortion &rPo // in some cases, kana compression is not allowed or surpressed for // performance reasons - USHORT nComp = 0; + sal_uInt16 nComp = 0; if ( ! IsMulti() ) nComp = GetKanaComp(); @@ -784,12 +784,16 @@ void SwTxtPaintInfo::CalcRect( const SwLinePortion& rPor, else { aPoint.A() = X(); - aPoint.B() = Y() - rPor.GetAscent(); + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if ( GetTxtFrm()->IsVertLR() ) + aPoint.B() = Y() - rPor.Height() + rPor.GetAscent(); + else + aPoint.B() = Y() - rPor.GetAscent(); } // Adjust x coordinate if we are inside a bidi portion - const BOOL bFrmDir = GetTxtFrm()->IsRightToLeft(); - BOOL bCounterDir = ( ! bFrmDir && DIR_RIGHT2LEFT == GetDirection() ) || + const sal_Bool bFrmDir = GetTxtFrm()->IsRightToLeft(); + sal_Bool bCounterDir = ( ! bFrmDir && DIR_RIGHT2LEFT == GetDirection() ) || ( bFrmDir && DIR_LEFT2RIGHT == GetDirection() ); if ( bCounterDir ) @@ -833,7 +837,7 @@ void SwTxtPaintInfo::CalcRect( const SwLinePortion& rPor, static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rPor, SwRect& rRect, const Color* pCol, sal_Unicode cChar, - BYTE nOptions ) + sal_uInt8 nOptions ) { sal_Bool bCenter = 0 != ( nOptions & DRAW_SPECIAL_OPTIONS_CENTER ); sal_Bool bRotate = 0 != ( nOptions & DRAW_SPECIAL_OPTIONS_ROTATE ); @@ -874,7 +878,7 @@ static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rP ((SwTxtPaintInfo&)rInf).SetFont( pFnt ); // The maximum width depends on the current orientation - const USHORT nDir = pFnt->GetOrientation( rInf.GetTxtFrm()->IsVertical() ); + const sal_uInt16 nDir = pFnt->GetOrientation( rInf.GetTxtFrm()->IsVertical() ); SwTwips nMaxWidth = 0; switch ( nDir ) { @@ -899,7 +903,7 @@ static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rP const SwTwips nOldWidth = aFontSize.Width(); // new height for font - const BYTE nAct = pFnt->GetActual(); + const sal_uInt8 nAct = pFnt->GetActual(); aFontSize.Height() = ( 100 * pFnt->GetSize( nAct ).Height() ) / nFactor; aFontSize.Width() = ( 100 * pFnt->GetSize( nAct).Width() ) / nFactor; @@ -940,8 +944,8 @@ static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rP Point aTmpPos( nX, nY ); ((SwTxtPaintInfo&)rInf).SetPos( aTmpPos ); - USHORT nOldWidth = rPor.Width(); - ((SwLinePortion&)rPor).Width( (USHORT)aFontSize.Width() ); + sal_uInt16 nOldWidth = rPor.Width(); + ((SwLinePortion&)rPor).Width( (sal_uInt16)aFontSize.Width() ); rInf.DrawText( aTmp, rPor ); ((SwLinePortion&)rPor).Width( nOldWidth ); ((SwTxtPaintInfo&)rInf).SetFont( (SwFont*)pOldFnt ); @@ -986,7 +990,7 @@ void SwTxtPaintInfo::DrawTab( const SwLinePortion &rPor ) const const sal_Unicode cChar = GetTxtFrm()->IsRightToLeft() ? CHAR_TAB_RTL : CHAR_TAB; - const BYTE nOptions = DRAW_SPECIAL_OPTIONS_CENTER | + const sal_uInt8 nOptions = DRAW_SPECIAL_OPTIONS_CENTER | DRAW_SPECIAL_OPTIONS_ROTATE; lcl_DrawSpecial( *this, rPor, aRect, 0, cChar, nOptions ); } @@ -1010,7 +1014,7 @@ void SwTxtPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const { const sal_Unicode cChar = GetTxtFrm()->IsRightToLeft() ? CHAR_LINEBREAK_RTL : CHAR_LINEBREAK; - const BYTE nOptions = 0; + const sal_uInt8 nOptions = 0; lcl_DrawSpecial( *this, rPor, aRect, 0, cChar, nOptions ); } @@ -1052,7 +1056,7 @@ void SwTxtPaintInfo::DrawRedArrow( const SwLinePortion &rPor ) const if( aRect.HasArea() ) { - const BYTE nOptions = 0; + const sal_uInt8 nOptions = 0; lcl_DrawSpecial( *this, rPor, aRect, &aCol, cChar, nOptions ); } } @@ -1069,9 +1073,9 @@ void SwTxtPaintInfo::DrawPostIts( const SwLinePortion&, sal_Bool bScript ) const Size aSize; Point aTmp; - const USHORT nPostItsWidth = pOpt->GetPostItsWidth( GetOut() ); - const USHORT nFontHeight = pFnt->GetHeight( pVsh, *GetOut() ); - const USHORT nFontAscent = pFnt->GetAscent( pVsh, *GetOut() ); + const sal_uInt16 nPostItsWidth = pOpt->GetPostItsWidth( GetOut() ); + const sal_uInt16 nFontHeight = pFnt->GetHeight( pVsh, *GetOut() ); + const sal_uInt16 nFontAscent = pFnt->GetAscent( pVsh, *GetOut() ); switch ( pFnt->GetOrientation( GetTxtFrm()->IsVertical() ) ) { @@ -1309,9 +1313,9 @@ void SwTxtPaintInfo::_NotifyURL( const SwLinePortion &rPor ) const *************************************************************************/ static void lcl_InitHyphValues( PropertyValues &rVals, - INT16 nMinLeading, INT16 nMinTrailing ) + sal_Int16 nMinLeading, sal_Int16 nMinTrailing ) { - INT32 nLen = rVals.getLength(); + sal_Int32 nLen = rVals.getLength(); if (0 == nLen) // yet to be initialized? { @@ -1366,8 +1370,8 @@ sal_Bool SwTxtFormatInfo::InitHyph( const sal_Bool bAutoHyphen ) nHyphStart = nHyphWrdStart = STRING_LEN; nHyphWrdLen = 0; - const INT16 nMinimalLeading = Max(rAttr.GetMinLead(), sal_uInt8(2)); - const INT16 nMinimalTrailing = rAttr.GetMinTrail(); + const sal_Int16 nMinimalLeading = Max(rAttr.GetMinLead(), sal_uInt8(2)); + const sal_Int16 nMinimalTrailing = rAttr.GetMinTrail(); lcl_InitHyphValues( aHyphVals, nMinimalLeading, nMinimalTrailing); } return bAuto; @@ -1528,23 +1532,23 @@ SwTxtFormatInfo::SwTxtFormatInfo( const SwTxtFormatInfo& rInf, nMinLeading = 0; nMinTrailing = 0; nMinWordLength = 0; - bFull = FALSE; - bFtnDone = TRUE; - bErgoDone = TRUE; - bNumDone = TRUE; - bArrowDone = TRUE; - bStop = FALSE; - bNewLine = TRUE; - bShift = FALSE; - bUnderFlow = FALSE; - bInterHyph = FALSE; - bAutoHyph = FALSE; - bDropInit = FALSE; + bFull = sal_False; + bFtnDone = sal_True; + bErgoDone = sal_True; + bNumDone = sal_True; + bArrowDone = sal_True; + bStop = sal_False; + bNewLine = sal_True; + bShift = sal_False; + bUnderFlow = sal_False; + bInterHyph = sal_False; + bAutoHyph = sal_False; + bDropInit = sal_False; bQuick = rInf.bQuick; - bNoEndHyph = FALSE; - bNoMidHyph = FALSE; - bIgnoreFly = FALSE; - bFakeLineStart = FALSE; + bNoEndHyph = sal_False; + bNoMidHyph = sal_False; + bIgnoreFly = sal_False; + bFakeLineStart = sal_False; cTabDecimal = 0; cHookChar = 0; @@ -1680,15 +1684,15 @@ xub_StrLen SwTxtFormatInfo::ScanPortionEnd( const xub_StrLen nStart, return i; } -BOOL SwTxtFormatInfo::LastKernPortion() +sal_Bool SwTxtFormatInfo::LastKernPortion() { if( GetLast() ) { if( GetLast()->IsKernPortion() ) - return TRUE; + return sal_True; if( GetLast()->Width() || ( GetLast()->GetLen() && !GetLast()->IsHolePortion() ) ) - return FALSE; + return sal_False; } SwLinePortion* pPor = GetRoot(); SwLinePortion *pKern = NULL; @@ -1703,9 +1707,9 @@ BOOL SwTxtFormatInfo::LastKernPortion() if( pKern ) { SetLast( pKern ); - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } /************************************************************************* @@ -1744,7 +1748,7 @@ SwTxtSlot::SwTxtSlot( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor, pOldSmartTagList = static_cast<SwTxtPaintInfo*>(pInf)->GetSmartTags(); if ( pOldSmartTagList ) { - const USHORT nPos = pOldSmartTagList->GetWrongPos(nIdx); + const sal_uInt16 nPos = pOldSmartTagList->GetWrongPos(nIdx); const xub_StrLen nListPos = pOldSmartTagList->Pos(nPos); if( nListPos == nIdx ) ((SwTxtPaintInfo*)pInf)->SetSmartTags( pOldSmartTagList->SubList( nPos ) ); @@ -1760,7 +1764,7 @@ SwTxtSlot::SwTxtSlot( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor, pOldGrammarCheckList = static_cast<SwTxtPaintInfo*>(pInf)->GetGrammarCheckList(); if ( pOldGrammarCheckList ) { - const USHORT nPos = pOldGrammarCheckList->GetWrongPos(nIdx); + const sal_uInt16 nPos = pOldGrammarCheckList->GetWrongPos(nIdx); const xub_StrLen nListPos = pOldGrammarCheckList->Pos(nPos); if( nListPos == nIdx ) ((SwTxtPaintInfo*)pInf)->SetGrammarCheckList( pOldGrammarCheckList->SubList( nPos ) ); @@ -1865,7 +1869,7 @@ SwFontSave::~SwFontSave() SwDefFontSave::SwDefFontSave( const SwTxtSizeInfo &rInf ) : pFnt( ((SwTxtSizeInfo&)rInf).GetFont() ) { - const BOOL bTmpAlter = pFnt->GetFixKerning() || + const sal_Bool bTmpAlter = pFnt->GetFixKerning() || ( RTL_TEXTENCODING_SYMBOL == pFnt->GetCharSet(pFnt->GetActual()) ) ; diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx index a0b598591b..ecb2355f88 100644 --- a/sw/source/core/text/inftxt.hxx +++ b/sw/source/core/text/inftxt.hxx @@ -96,7 +96,7 @@ class SwLineInfo SvxTabStopItem* pRuler; const SvxLineSpacingItem *pSpace; - USHORT nVertAlign; + sal_uInt16 nVertAlign; KSHORT nDefTabStop; bool bListTabStopIncluded; long nListTabStopPosition; @@ -118,14 +118,14 @@ public: { ( (SwLineInfo*)this )->nDefTabStop = nNew; } // vertical alignment - inline USHORT GetVertAlign() const { return nVertAlign; } + inline sal_uInt16 GetVertAlign() const { return nVertAlign; } inline sal_Bool HasSpecialAlign( sal_Bool bVert ) const { return bVert ? ( SvxParaVertAlignItem::BASELINE != nVertAlign ) : ( SvxParaVertAlignItem::BASELINE != nVertAlign && SvxParaVertAlignItem::AUTOMATIC != nVertAlign ); } - USHORT NumberOfTabStops() const; + sal_uInt16 NumberOfTabStops() const; inline bool IsListTabStopIncluded() const { @@ -192,7 +192,7 @@ protected: const SwViewOption *pOpt; const XubString *pTxt; xub_StrLen nIdx, nLen; - USHORT nKanaIdx; + sal_uInt16 nKanaIdx; sal_Bool bOnWin : 1; sal_Bool bNotEOL : 1; sal_Bool bURLNotify : 1; @@ -292,13 +292,13 @@ public: // SwPosSize GetTxtSize( OutputDevice* pOut, const SwScriptInfo* pSI, const XubString& rTxt, const xub_StrLen nIdx, - const xub_StrLen nLen, const USHORT nComp ) const; + const xub_StrLen nLen, const sal_uInt16 nComp ) const; SwPosSize GetTxtSize() const; void GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIdx, - const xub_StrLen nLen, const USHORT nComp, - USHORT& nMinSize, USHORT& nMaxSizeDiff ) const; + const xub_StrLen nLen, const sal_uInt16 nComp, + sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff ) const; inline SwPosSize GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIdx, - const xub_StrLen nLen, const USHORT nComp ) const; + const xub_StrLen nLen, const sal_uInt16 nComp ) const; inline SwPosSize GetTxtSize( const XubString &rTxt ) const; // @@ -306,10 +306,10 @@ public: // xub_StrLen GetTxtBreak( const long nLineWidth, const xub_StrLen nMaxLen, - const USHORT nComp ) const; + const sal_uInt16 nComp ) const; xub_StrLen GetTxtBreak( const long nLineWidth, const xub_StrLen nMaxLen, - const USHORT nComp, + const sal_uInt16 nComp, xub_StrLen& rExtraCharPos ) const; inline KSHORT GetAscent() const; @@ -341,13 +341,13 @@ public: // space among compressed kanas. // During formatting, the maximum values of compressable portions are // stored in aMaxWidth and discarded after a line has been formatted. - inline void SetMaxWidthDiff( ULONG nKey, USHORT nVal ) + inline void SetMaxWidthDiff( sal_uLong nKey, sal_uInt16 nVal ) { aMaxWidth.Insert( nKey, nVal ); }; - inline USHORT GetMaxWidthDiff( ULONG nKey ) + inline sal_uInt16 GetMaxWidthDiff( sal_uLong nKey ) { - return (USHORT)aMaxWidth.Get( nKey ); + return (sal_uInt16)aMaxWidth.Get( nKey ); }; inline void ResetMaxWidthDiff() { @@ -367,7 +367,7 @@ public: inline void IncKanaIdx() { ++nKanaIdx; } inline void SetKanaComp( SvUShorts *pNew ){ pKanaComp = pNew; } inline SvUShorts* GetpKanaComp() const { return pKanaComp; } - inline USHORT GetKanaComp() const + inline sal_uInt16 GetKanaComp() const { return ( pKanaComp && nKanaIdx < pKanaComp->Count() ) ? (*pKanaComp)[nKanaIdx] : 0; } @@ -532,7 +532,7 @@ class SwTxtFormatInfo : public SwTxtPaintInfo xub_StrLen nHyphWrdLen; // gefundene Wort-Laenge xub_StrLen nLineStart; // aktueller Zeilenbeginn im rTxt xub_StrLen nUnderScorePos; // enlarge repaint if underscore has been found - // --> FME 2004-11-25 #i34348# Changed type from USHORT to SwTwips + // --> FME 2004-11-25 #i34348# Changed type from sal_uInt16 to SwTwips SwTwips nLeft; // linker Rand SwTwips nRight; // rechter Rand SwTwips nFirst; // EZE @@ -543,9 +543,9 @@ class SwTxtFormatInfo : public SwTxtPaintInfo KSHORT nLineNettoHeight; // line height without spacing KSHORT nForcedLeftMargin; // Verschiebung des linken Rands wg. Rahmen - INT16 nMinLeading; // minimum number of chars before hyphenation point - INT16 nMinTrailing; // minimum number of chars after hyphenation point - INT16 nMinWordLength; // minimum length of word to be hyphenated + sal_Int16 nMinLeading; // minimum number of chars before hyphenation point + sal_Int16 nMinTrailing; // minimum number of chars after hyphenation point + sal_Int16 nMinWordLength; // minimum length of word to be hyphenated sal_Bool bFull : 1; // Zeile ist voll sal_Bool bFtnDone : 1; // Ftn bereits formatiert @@ -713,7 +713,7 @@ public: // ruft HyphenateWord() des Hyphenators ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > - HyphWord( const String &rTxt, const USHORT nMinTrail ); + HyphWord( const String &rTxt, const sal_uInt16 nMinTrail ); const com::sun::star::beans::PropertyValues & GetHyphValues() const; @@ -727,7 +727,7 @@ public: void Reset( const SwTxtFrm *pFrame); // , const sal_Bool bAll ); // Sets the last SwKernPortion as pLast, if it is followed by empty portions - BOOL LastKernPortion(); + sal_Bool LastKernPortion(); // Sucht ab nIdx bis nEnd nach Tabs, TabDec, TXTATR und BRK. // Return: gefundene Position, setzt ggf. cHookChar @@ -821,7 +821,7 @@ inline SwPosSize SwTxtSizeInfo::GetTxtSize( const XubString &rTxt ) const inline SwPosSize SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nNewIdx, const xub_StrLen nNewLen, - const USHORT nCompress ) const + const sal_uInt16 nCompress ) const { return GetTxtSize( pOut, pSI, *pTxt, nNewIdx, nNewLen, nCompress ); } diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx index af03c4f77d..83cfd36ef5 100644 --- a/sw/source/core/text/itradj.cxx +++ b/sw/source/core/text/itradj.cxx @@ -174,7 +174,7 @@ bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, SwTxtIte } else { - ULONG nOldLayout = rInf.GetOut()->GetLayoutMode(); + sal_uLong nOldLayout = rInf.GetOut()->GetLayoutMode(); rInf.GetOut()->SetLayoutMode ( nOldLayout | TEXT_LAYOUT_BIDI_RTL ); nKashidasDropped = rInf.GetOut()->ValidateKashidas ( rInf.GetTxt(), nIdx, nNext - nIdx, nKashidasInAttr, pKashidaPos + nKashidaIdx, @@ -427,7 +427,7 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent ) SvUShorts *pNewKana = new SvUShorts; pCurrent->SetKanaComp( pNewKana ); - const USHORT nNull = 0; + const sal_uInt16 nNull = 0; MSHORT nKanaIdx = 0; long nKanaDiffSum = 0; SwTwips nRepaintOfst = 0; @@ -446,11 +446,11 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent ) { // get maximum portion width from info structure, calculated // during text formatting - USHORT nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (ULONG)pPos ); + sal_uInt16 nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (sal_uLong)pPos ); // check, if information is stored under other key if ( !nMaxWidthDiff && pPos == pCurrent->GetFirstPortion() ) - nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (ULONG)pCurrent ); + nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (sal_uLong)pCurrent ); // calculate difference between portion width and max. width nKanaDiffSum += nMaxWidthDiff; @@ -465,7 +465,7 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent ) if ( nKanaIdx == pCurrent->GetKanaComp().Count() ) pCurrent->GetKanaComp().Insert( nNull, nKanaIdx ); - USHORT nRest; + sal_uInt16 nRest; if ( pPos->InTabGrp() ) { @@ -490,7 +490,7 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent ) if( nKanaDiffSum ) { - ULONG nCompress = ( 10000 * nRest ) / nKanaDiffSum; + sal_uLong nCompress = ( 10000 * nRest ) / nKanaDiffSum; if ( nCompress >= 10000 ) // kanas can be expanded to 100%, and there is still @@ -500,7 +500,7 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent ) else nCompress = 10000 - nCompress; - ( pCurrent->GetKanaComp() )[ nKanaIdx ] = (USHORT)nCompress; + ( pCurrent->GetKanaComp() )[ nKanaIdx ] = (sal_uInt16)nCompress; nKanaDiffSum = 0; } @@ -513,7 +513,7 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent ) // set portion width nKanaIdx = 0; - USHORT nCompress = ( pCurrent->GetKanaComp() )[ nKanaIdx ]; + sal_uInt16 nCompress = ( pCurrent->GetKanaComp() )[ nKanaIdx ]; pPos = pCurrent->GetPortion(); long nDecompress = 0; nKanaDiffSum = 0; @@ -522,15 +522,15 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent ) { if ( pPos->InTxtGrp() ) { - const USHORT nMinWidth = pPos->Width(); + const sal_uInt16 nMinWidth = pPos->Width(); // get maximum portion width from info structure, calculated // during text formatting - USHORT nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (ULONG)pPos ); + sal_uInt16 nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (sal_uLong)pPos ); // check, if information is stored under other key if ( !nMaxWidthDiff && pPos == pCurrent->GetFirstPortion() ) - nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (ULONG)pCurrent ); + nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (sal_uLong)pCurrent ); nKanaDiffSum += nMaxWidthDiff; pPos->Width( nMinWidth + ( ( 10000 - nCompress ) * nMaxWidthDiff ) / 10000 ); @@ -544,7 +544,7 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent ) nKanaDiffSum /= 10000; } - pPos->Width( static_cast<USHORT>(pPos->Width() - nDecompress) ); + pPos->Width( static_cast<sal_uInt16>(pPos->Width() - nDecompress) ); if ( pPos->InTabGrp() ) // set fix width to width @@ -571,8 +571,8 @@ SwMarginPortion *SwTxtAdjuster::CalcRightMargin( SwLineLayout *pCurrent, SwTwips nReal ) { long nRealWidth; - const USHORT nRealHeight = GetLineHeight(); - const USHORT nLineHeight = pCurrent->Height(); + const sal_uInt16 nRealHeight = GetLineHeight(); + const sal_uInt16 nLineHeight = pCurrent->Height(); KSHORT nPrtWidth = pCurrent->PrtWidth(); SwLinePortion *pLast = pCurrent->FindLastPortion(); diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 35adb12b49..2be75b1d87 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -332,7 +332,7 @@ xub_StrLen SwAttrIter::GetNextAttr( ) const if (m_pTxtNode!=NULL) { //TODO maybe use hints like FieldHints for this instead of looking at the text... int l=(nNext<m_pTxtNode->Len()?nNext:m_pTxtNode->Len()); - USHORT p=nPos; + sal_uInt16 p=nPos; const sal_Unicode *txt=m_pTxtNode->GetTxt().GetBuffer(); while(p<l && txt[p]!=CH_TXT_ATR_FIELDSTART && txt[p]!=CH_TXT_ATR_FIELDEND && txt[p]!=CH_TXT_ATR_FORMELEMENT) p++; if ((p<l && p>nPos) || nNext<=p) @@ -362,14 +362,14 @@ class SwMinMaxArgs public: OutputDevice* pOut; ViewShell* pSh; - ULONG &rMin; - ULONG &rMax; - ULONG &rAbsMin; + sal_uLong &rMin; + sal_uLong &rMax; + sal_uLong &rAbsMin; long nRowWidth; long nWordWidth; long nWordAdd; xub_StrLen nNoLineBreak; - SwMinMaxArgs( OutputDevice* pOutI, ViewShell* pShI, ULONG& rMinI, ULONG &rMaxI, ULONG &rAbsI ) + SwMinMaxArgs( OutputDevice* pOutI, ViewShell* pShI, sal_uLong& rMinI, sal_uLong &rMaxI, sal_uLong &rAbsI ) : pOut( pOutI ), pSh( pShI ), rMin( rMinI ), rMax( rMaxI ), rAbsMin( rAbsI ) { nRowWidth = nWordWidth = nWordAdd = 0; nNoLineBreak = STRING_LEN; } void Minimum( long nNew ) const { if( (long)rMin < nNew ) rMin = nNew; } @@ -390,7 +390,7 @@ sal_Bool lcl_MinMaxString( SwMinMaxArgs& rArg, SwFont* pFnt, const XubString &rT bClear = CH_BLANK == rTxt.GetChar( nStop ); Boundary aBndry( pBreakIt->GetBreakIter()->getWordBoundary( rTxt, nIdx, pBreakIt->GetLocale( eLang ), - WordType::DICTIONARY_WORD, TRUE ) ); + WordType::DICTIONARY_WORD, sal_True ) ); nStop = (xub_StrLen)aBndry.endPos; if( nIdx <= aBndry.startPos && nIdx && nIdx-1 != rArg.nNoLineBreak ) rArg.NewWord(); @@ -444,13 +444,13 @@ sal_Bool SwTxtNode::IsSymbol( const xub_StrLen nBegin ) const class SwMinMaxNodeArgs { public: - ULONG nMaxWidth; // Summe aller Rahmenbreite + sal_uLong nMaxWidth; // Summe aller Rahmenbreite long nMinWidth; // Breitester Rahmen long nLeftRest; // noch nicht von Rahmen ueberdeckter Platz im l. Rand long nRightRest; // noch nicht von Rahmen ueberdeckter Platz im r. Rand long nLeftDiff; // Min/Max-Differenz des Rahmens im linken Rand long nRightDiff; // Min/Max-Differenz des Rahmens im rechten Rand - ULONG nIndx; // Indexnummer des Nodes + sal_uLong nIndx; // Indexnummer des Nodes void Minimum( long nNew ) { if( nNew > nMinWidth ) nMinWidth = nNew; } }; @@ -484,7 +484,7 @@ sal_Bool lcl_MinMaxNode( const SwFrmFmtPtr& rpNd, void* pArgs ) // Enthaelt der Rahmen zu Beginn oder am Ende eine Tabelle? const SwNodes& rNodes = static_cast<SwFrmFmt*>(rpNd)->GetDoc()->GetNodes(); const SwFmtCntnt& rFlyCntnt = ((SwFrmFmt*)rpNd)->GetCntnt(); - ULONG nStt = rFlyCntnt.GetCntntIdx()->GetIndex(); + sal_uLong nStt = rFlyCntnt.GetCntntIdx()->GetIndex(); SwTableNode* pTblNd = rNodes[nStt+1]->GetTableNode(); if( !pTblNd ) { @@ -590,8 +590,8 @@ sal_Bool lcl_MinMaxNode( const SwFrmFmtPtr& rpNd, void* pArgs ) // changing this method very likely requires changing of // "GetScalingOfSelectedText" -void SwTxtNode::GetMinMaxSize( ULONG nIndex, ULONG& rMin, ULONG &rMax, - ULONG& rAbsMin, OutputDevice* pOut ) const +void SwTxtNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMax, + sal_uLong& rAbsMin, OutputDevice* pOut ) const { ViewShell* pSh = 0; GetDoc()->GetEditShell( &pSh ); @@ -780,7 +780,7 @@ void SwTxtNode::GetMinMaxSize( ULONG nIndex, ULONG& rMin, ULONG &rMax, case RES_TXTATR_FIELD : { SwField *pFld = (SwField*)pHint->GetFld().GetFld(); - const String aTxt = pFld->GetCntnt( FALSE ); + const String aTxt = pFld->ExpandField(true); if( lcl_MinMaxString( aArg, aIter.GetFnt(), aTxt, 0, aTxt.Len() ) ) nAdd = 20; @@ -828,7 +828,7 @@ void SwTxtNode::GetMinMaxSize( ULONG nIndex, ULONG& rMin, ULONG &rMax, * changing this method very likely requires changing of "GetMinMaxSize" *************************************************************************/ -USHORT SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) +sal_uInt16 SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) const { ViewShell* pSh = NULL; @@ -896,8 +896,8 @@ USHORT SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) xub_StrLen nIdx = nStt; - ULONG nWidth = 0; - ULONG nProWidth = 0; + sal_uLong nWidth = 0; + sal_uLong nProWidth = 0; while( nIdx < nEnd ) { @@ -983,7 +983,7 @@ USHORT SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) case RES_TXTATR_FIELD : { SwField *pFld = (SwField*)pHint->GetFld().GetFld(); - const String aTxt = pFld->GetCntnt( FALSE ); + String const aTxt = pFld->ExpandField(true); SwDrawTextInfo aDrawInf( pSh, *pOut, 0, aTxt, 0, aTxt.Len() ); nProWidth += aIter.GetFnt()->_GetTxtSize( aDrawInf ).Width(); @@ -1028,7 +1028,7 @@ USHORT SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) SwTxtIter aLine( pFrm, &aInf ); aLine.CharToLine( nStt ); pOut->SetMapMode( aOldMap ); - return (USHORT)( nWidth ? + return (sal_uInt16)( nWidth ? ( ( 100 * aLine.GetCurr()->Height() ) / nWidth ) : 0 ); } // no frame or no paragraph, we take the height of the character @@ -1038,13 +1038,13 @@ USHORT SwTxtNode::GetScalingOfSelectedText( xub_StrLen nStt, xub_StrLen nEnd ) pOut->SetMapMode( aOldMap ); SwDrawTextInfo aDrawInf( pSh, *pOut, 0, GetTxt(), nStt, 1 ); - return (USHORT) + return (sal_uInt16) ( nWidth ? ((100 * aIter.GetFnt()->_GetTxtSize( aDrawInf ).Height()) / nWidth ) : 0 ); } -USHORT SwTxtNode::GetWidthOfLeadingTabs() const +sal_uInt16 SwTxtNode::GetWidthOfLeadingTabs() const { - USHORT nRet = 0; + sal_uInt16 nRet = 0; xub_StrLen nIdx = 0; sal_Unicode cCh; @@ -1073,7 +1073,7 @@ USHORT SwTxtNode::GetWidthOfLeadingTabs() const SWRECTFN( pFrm ) SwRect aRect; pFrm->GetCharRect( aRect, aPos ); - nRet = (USHORT) + nRet = (sal_uInt16) ( pFrm->IsRightToLeft() ? (pFrm->*fnRect->fnGetPrtRight)() - (aRect.*fnRect->fnGetRight)() : (aRect.*fnRect->fnGetLeft)() - (pFrm->*fnRect->fnGetPrtLeft)() ); diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx index d00a86e4c5..ef6a63fcad 100644 --- a/sw/source/core/text/itratr.hxx +++ b/sw/source/core/text/itratr.hxx @@ -68,7 +68,7 @@ private: MSHORT nChgCnt; SwRedlineItr *pRedln; xub_StrLen nStartIndex, nEndIndex, nPos; - BYTE nPropFont; + sal_uInt8 nPropFont; void SeekFwd( const xub_StrLen nPos ); inline void SetFnt( SwFont* pNew ) { pFnt = pNew; } const void* aMagicNo[ SW_SCRIPTS ]; @@ -121,8 +121,8 @@ public: inline SwFont *GetFnt() { return pFnt; } inline const SwFont *GetFnt() const { return pFnt; } - inline BYTE GetPropFont() const { return nPropFont; } - inline void SetPropFont( const BYTE nNew ) { nPropFont = nNew; } + inline sal_uInt8 GetPropFont() const { return nPropFont; } + inline void SetPropFont( const sal_uInt8 nNew ) { nPropFont = nNew; } inline SwAttrHandler& GetAttrHandler() { return aAttrHandler; } diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 5aed6230f9..9234bc1315 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -80,9 +80,9 @@ void lcl_GetCharRectInsideField( SwTxtSizeInfo& rInf, SwRect& rOrig, if ( rPor.InFldGrp() && ((SwFldPortion&)rPor).GetExp().Len() ) { - const USHORT nCharOfst = rCMS.pSpecialPos->nCharOfst; - USHORT nFldIdx = 0; - USHORT nFldLen = 0; + const sal_uInt16 nCharOfst = rCMS.pSpecialPos->nCharOfst; + sal_uInt16 nFldIdx = 0; + sal_uInt16 nFldLen = 0; const XubString* pString = 0; const SwLinePortion* pPor = &rPor; @@ -106,10 +106,10 @@ void lcl_GetCharRectInsideField( SwTxtSizeInfo& rInf, SwRect& rOrig, rOrig.Pos().X() += pPor->Width(); pPor = pPor->GetPortion(); - } while ( TRUE ); + } while ( sal_True ); OSL_ENSURE( nCharOfst >= nFldIdx, "Request of position inside field failed" ); - USHORT nLen = nCharOfst - nFldIdx + 1; + sal_uInt16 nLen = nCharOfst - nFldIdx + 1; if ( pString ) { @@ -154,7 +154,7 @@ namespace { if ( rTxtNode.AreListLevelIndentsApplicable() ) { const SwNumFmt& rNumFmt = - rTxtNode.GetNumRule()->Get( static_cast<USHORT>(rTxtNode.GetActualListLevel()) ); + rTxtNode.GetNumRule()->Get( static_cast<sal_uInt16>(rTxtNode.GetActualListLevel()) ); if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) { bRet = true; @@ -346,7 +346,7 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) nFirst = nRight - 1; } const SvxAdjustItem& rAdjust = pFrm->GetTxtNode()->GetSwAttrSet().GetAdjust(); - nAdjust = static_cast<USHORT>(rAdjust.GetAdjust()); + nAdjust = static_cast<sal_uInt16>(rAdjust.GetAdjust()); // left is left and right is right if ( pFrm->IsRightToLeft() ) @@ -640,7 +640,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, // For common portions (including BidiPortions) we want to add // the portion width to nX. For MultiPortions, nExtra = 0, // therefore we go to the 'else' branch and start a recursion. - const BYTE nExtra = pPor->IsMultiPortion() && + const sal_uInt8 nExtra = pPor->IsMultiPortion() && ! ((SwMultiPortion*)pPor)->IsBidi() && ! bWidth ? 0 : 1; if ( aInf.GetIdx() + pPor->GetLen() < nOfst + nExtra ) @@ -752,7 +752,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, // of the multi-portion. xub_StrLen nOldStart = nStart; SwTwips nOldY = nY; - BYTE nOldProp = GetPropFont(); + sal_uInt8 nOldProp = GetPropFont(); nStart = aInf.GetIdx(); SwLineLayout* pOldCurr = pCurr; pCurr = &((SwMultiPortion*)pPor)->GetRoot(); @@ -761,14 +761,14 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, GETGRID( GetTxtFrm()->FindPageFrm() ) const sal_Bool bHasGrid = pGrid && GetInfo().SnapToGrid(); - const USHORT nRubyHeight = bHasGrid ? + const sal_uInt16 nRubyHeight = bHasGrid ? pGrid->GetRubyHeight() : 0; if( nStart + pCurr->GetLen() <= nOfst && GetNext() && ( ! ((SwMultiPortion*)pPor)->IsRuby() || ((SwMultiPortion*)pPor)->OnTop() ) ) { - USHORT nOffset; + sal_uInt16 nOffset; // in grid mode we may only add the height of the // ruby line if ruby line is on top if ( bHasGrid && @@ -790,8 +790,8 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, // temporarily set the inner line height to the // outer line height because that value is needed // for the adjustment inside the recursion - const USHORT nOldRubyHeight = pCurr->Height(); - const USHORT nOldRubyRealHeight = pCurr->GetRealHeight(); + const sal_uInt16 nOldRubyHeight = pCurr->Height(); + const sal_uInt16 nOldRubyRealHeight = pCurr->GetRealHeight(); const sal_Bool bChgHeight = ((SwMultiPortion*)pPor)->IsRuby() && bHasGrid; @@ -1066,7 +1066,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, if( nTmpHeight < pOrig->Height() ) { nTmpAscent = nPorAscent; - nTmpHeight = USHORT( pOrig->Height() ); + nTmpHeight = sal_uInt16( pOrig->Height() ); } } if( bWidth && pPor->PrtWidth() && pPor->GetLen() && @@ -1126,7 +1126,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, // the bidi portion if ( pLastBidiPor ) { - const BYTE nPortionLevel = pLastBidiPor->GetLevel(); + const sal_uInt8 nPortionLevel = pLastBidiPor->GetLevel(); if ( pCMS->nCursorBidiLevel >= nPortionLevel ) { @@ -1153,7 +1153,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, } else { - const BYTE nPortionLevel = ((SwBidiPortion*)pPor)->GetLevel(); + const sal_uInt8 nPortionLevel = ((SwBidiPortion*)pPor)->GetLevel(); if ( pCMS->nCursorBidiLevel >= nPortionLevel ) { @@ -1199,7 +1199,7 @@ sal_Bool SwTxtCursor::GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, if ( bSpecialPos ) { - const BYTE nExtendRange = pCMS->pSpecialPos->nExtendRange; + const sal_uInt8 nExtendRange = pCMS->pSpecialPos->nExtendRange; OSL_ENSURE( ! pCMS->pSpecialPos->nLineOfst || SP_EXTEND_RANGE_BEFORE != nExtendRange, "LineOffset AND Number Portion?" ); @@ -1209,7 +1209,7 @@ sal_Bool SwTxtCursor::GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, ++nFindOfst; // skip lines for fields which cover more than one line - for ( USHORT i = 0; i < pCMS->pSpecialPos->nLineOfst; i++ ) + for ( sal_uInt16 i = 0; i < pCMS->pSpecialPos->nLineOfst; i++ ) Next(); } @@ -1328,7 +1328,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, if ( pPor->InSpaceGrp() && nSpaceAdd ) { ((SwTxtSizeInfo&)GetInfo()).SetIdx( nCurrStart ); - nWidth = nWidth + USHORT( pPor->CalcSpacing( nSpaceAdd, GetInfo() ) ); + nWidth = nWidth + sal_uInt16( pPor->CalcSpacing( nSpaceAdd, GetInfo() ) ); } if( ( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() ) || ( pPor->IsMultiPortion() && ((SwMultiPortion*)pPor)->HasTabulator() ) @@ -1372,7 +1372,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, if ( pPor->InSpaceGrp() && nSpaceAdd ) { ((SwTxtSizeInfo&)GetInfo()).SetIdx( nCurrStart ); - nWidth = nWidth + USHORT( pPor->CalcSpacing( nSpaceAdd, GetInfo() ) ); + nWidth = nWidth + sal_uInt16( pPor->CalcSpacing( nSpaceAdd, GetInfo() ) ); } if( ( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() ) || @@ -1577,7 +1577,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, SwLayoutModeModifier aLayoutModeModifier( *GetInfo().GetOut() ); if ( ((SwMultiPortion*)pPor)->IsBidi() ) { - const BYTE nBidiLevel = ((SwBidiPortion*)pPor)->GetLevel(); + const sal_uInt8 nBidiLevel = ((SwBidiPortion*)pPor)->GetLevel(); aLayoutModeModifier.Modify( nBidiLevel % 2 ); } @@ -1593,7 +1593,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, if( ((SwMultiPortion*)pPor)->HasBrackets() ) { - USHORT nPreWidth = ((SwDoubleLinePortion*)pPor)->PreWidth(); + sal_uInt16 nPreWidth = ((SwDoubleLinePortion*)pPor)->PreWidth(); if ( nX > nPreWidth ) nX = nX - nPreWidth; else @@ -1605,7 +1605,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, } if( pPor->InTxtGrp() ) { - BYTE nOldProp; + sal_uInt8 nOldProp; if( GetPropFont() ) { ((SwFont*)GetFnt())->SetProportion( GetPropFont() ); @@ -1864,7 +1864,7 @@ bool SwTxtFrm::FillSelection( SwSelectionList& rSelList, const SwRect& rRect ) c if( GetDrawObjs() ) { const SwSortedObjs &rObjs = *GetDrawObjs(); - for ( USHORT i = 0; i < rObjs.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i ) { const SwAnchoredObject* pAnchoredObj = rObjs[i]; if( !pAnchoredObj->ISA(SwFlyFrm) ) diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index b90e600ce2..277650f255 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -288,7 +288,7 @@ SwLinePortion *SwTxtFormatter::UnderFlow( SwTxtFormatInfo &rInf ) // line width is adjusted, so that pPor does not fit to current // line anymore - rInf.Width( (USHORT)(rInf.X() + (pPor->Width() ? pPor->Width() - 1 : 0)) ); + rInf.Width( (sal_uInt16)(rInf.X() + (pPor->Width() ? pPor->Width() - 1 : 0)) ); rInf.SetLen( pPor->GetLen() ); rInf.SetFull( sal_False ); if( pFly ) @@ -424,7 +424,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) GRID_LINES_CHARS == pGrid->GetGridType(); const SwDoc *pDoc = rInf.GetTxtFrm()->GetNode()->GetDoc(); - const USHORT nGridWidth = bHasGrid ? + const sal_uInt16 nGridWidth = bHasGrid ? GETGRIDWIDTH(pGrid,pDoc) : 0; //for textgrid refactor // used for grid mode only: @@ -451,9 +451,9 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) rInf.GetLast() && rInf.GetLast()->InTxtGrp() && rInf.GetLast()->Width() && !rInf.GetLast()->InNumberGrp() ) { - BYTE nNxtActual = rInf.GetFont()->GetActual(); - BYTE nLstActual = nNxtActual; - USHORT nLstHeight = (USHORT)rInf.GetFont()->GetHeight(); + sal_uInt8 nNxtActual = rInf.GetFont()->GetActual(); + sal_uInt8 nLstActual = nNxtActual; + sal_uInt16 nLstHeight = (sal_uInt16)rInf.GetFont()->GetHeight(); sal_Bool bAllowBefore = sal_False; sal_Bool bAllowBehind = sal_False; const CharClass& rCC = GetAppCharClass(); @@ -491,7 +491,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) if ( pTmpFnt ) { nLstActual = pTmpFnt->GetActual(); - nLstHeight = (USHORT)pTmpFnt->GetHeight(); + nLstHeight = (sal_uInt16)pTmpFnt->GetHeight(); } } } @@ -545,14 +545,14 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) const SwTwips nOfst = nStartX - nGridOrigin; if ( nOfst ) { - const ULONG i = ( nOfst > 0 ) ? + const sal_uLong i = ( nOfst > 0 ) ? ( ( nOfst - 1 ) / nGridWidth + 1 ) : 0; const SwTwips nKernWidth = i * nGridWidth - nOfst; const SwTwips nRestWidth = rInf.Width() - rInf.X(); if ( nKernWidth <= nRestWidth ) - pGridKernPortion->Width( (USHORT)nKernWidth ); + pGridKernPortion->Width( (sal_uInt16)nKernWidth ); } if ( pGridKernPortion != pPor ) @@ -635,7 +635,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) if( nTmp == pScriptInfo->NextScriptChg( nTmp - 1 ) && nTmp != rInf.GetTxt().Len() ) { - USHORT nDist = (USHORT)(rInf.GetFont()->GetHeight()/5); + sal_uInt16 nDist = (sal_uInt16)(rInf.GetFont()->GetHeight()/5); if( nDist ) { @@ -661,8 +661,8 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) xub_StrLen nTmp = rInf.GetIdx() + pPor->GetLen(); const SwTwips nRestWidth = rInf.Width() - rInf.X() - pPor->Width(); - const BYTE nCurrScript = pFnt->GetActual(); // pScriptInfo->ScriptType( rInf.GetIdx() ); - const BYTE nNextScript = nTmp >= rInf.GetTxt().Len() ? + const sal_uInt8 nCurrScript = pFnt->GetActual(); // pScriptInfo->ScriptType( rInf.GetIdx() ); + const sal_uInt8 nNextScript = nTmp >= rInf.GetTxt().Len() ? SW_CJK : SwScriptInfo::WhichFont( nTmp, 0, pScriptInfo ); @@ -677,20 +677,20 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) // calculate size SwLinePortion* pTmpPor = pGridKernPortion->GetPortion(); - USHORT nSumWidth = pPor->Width(); + sal_uInt16 nSumWidth = pPor->Width(); while ( pTmpPor ) { nSumWidth = nSumWidth + pTmpPor->Width(); pTmpPor = pTmpPor->GetPortion(); } - const USHORT i = nSumWidth ? + const sal_uInt16 i = nSumWidth ? ( nSumWidth - 1 ) / nGridWidth + 1 : 0; const SwTwips nTmpWidth = i * nGridWidth; const SwTwips nKernWidth = Min( (SwTwips)(nTmpWidth - nSumWidth), nRestWidth ); - const USHORT nKernWidth_1 = (USHORT)(nKernWidth / 2); + const sal_uInt16 nKernWidth_1 = (sal_uInt16)(nKernWidth / 2); OSL_ENSURE( nKernWidth <= nRestWidth, "Not enough space left for adjusting non-asian text in grid mode" ); @@ -961,7 +961,7 @@ SwTxtPortion *SwTxtFormatter::NewTxtPortion( SwTxtFormatInfo &rInf ) KSHORT( pPor->GetAscent() ) ) / 8; if ( !nExpect ) nExpect = 1; - nExpect = (USHORT)(rInf.GetIdx() + ((rInf.Width() - rInf.X()) / nExpect)); + nExpect = (sal_uInt16)(rInf.GetIdx() + ((rInf.Width() - rInf.X()) / nExpect)); if( nExpect > rInf.GetIdx() && nNextChg > nExpect ) nNextChg = Min( nExpect, rInf.GetTxt().Len() ); @@ -1354,7 +1354,7 @@ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf ) POR_TABDECIMAL == pLastTabPortion->GetWhichPor() ) { OSL_ENSURE( rInf.X() >= pLastTabPortion->Fix(), "Decimal tab stop position cannot be calculated" ); - const USHORT nWidthOfPortionsUpToDecimalPosition = (USHORT)(rInf.X() - pLastTabPortion->Fix() ); + const sal_uInt16 nWidthOfPortionsUpToDecimalPosition = (sal_uInt16)(rInf.X() - pLastTabPortion->Fix() ); static_cast<SwTabDecimalPortion*>(pLastTabPortion)->SetWidthOfPortionsUpToDecimalPosition( nWidthOfPortionsUpToDecimalPosition ); rInf.SetTabDecimal( 0 ); } @@ -1418,7 +1418,7 @@ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf ) const SwAttrSet& rSet = pInfo->GetAnchorCharFmt((SwDoc&)*pDoc)->GetAttrSet(); const SfxPoolItem* pItem; - USHORT nDir = 0; + sal_uInt16 nDir = 0; if( SFX_ITEM_SET == rSet.GetItemState( RES_CHRATR_ROTATE, sal_True, &pItem )) nDir = ((SvxCharRotateItem*)pItem)->GetValue(); @@ -1438,7 +1438,7 @@ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf ) if ( pNumFnt ) { - USHORT nDir = pNumFnt->GetOrientation( rInf.GetTxtFrm()->IsVertical() ); + sal_uInt16 nDir = pNumFnt->GetOrientation( rInf.GetTxtFrm()->IsVertical() ); if ( 0 != nDir ) { delete pPor; @@ -1695,12 +1695,12 @@ void SwTxtFormatter::CalcRealHeight( sal_Bool bNewLine ) GETGRID( pFrm->FindPageFrm() ) if ( pGrid && GetInfo().SnapToGrid() ) { - const USHORT nGridWidth = pGrid->GetBaseHeight(); - const USHORT nRubyHeight = pGrid->GetRubyHeight(); + const sal_uInt16 nGridWidth = pGrid->GetBaseHeight(); + const sal_uInt16 nRubyHeight = pGrid->GetRubyHeight(); const sal_Bool bRubyTop = ! pGrid->GetRubyTextBelow(); nLineHeight = nGridWidth + nRubyHeight; - USHORT nLineDist = nLineHeight; + sal_uInt16 nLineDist = nLineHeight; while ( pCurr->Height() > nLineHeight ) nLineHeight = nLineHeight + nLineDist; @@ -1719,13 +1719,13 @@ void SwTxtFormatter::CalcRealHeight( sal_Bool bNewLine ) if ( ! IsParaLine() && pSpace && SVX_INTER_LINE_SPACE_PROP == pSpace->GetInterLineSpaceRule() ) { - ULONG nTmp = pSpace->GetPropLineSpace(); + sal_uLong nTmp = pSpace->GetPropLineSpace(); if( nTmp < 100 ) nTmp = 100; nTmp *= nLineHeight; - nLineHeight = (USHORT)(nTmp / 100); + nLineHeight = (sal_uInt16)(nTmp / 100); } pCurr->SetRealHeight( nLineHeight ); @@ -1852,7 +1852,7 @@ void SwTxtFormatter::FeedInf( SwTxtFormatInfo &rInf ) const rInf.SetIdx( nStart ); // Handle overflows: - // --> FME 2004-11-25 #i34348# Changed type from USHORT to SwTwips + // --> FME 2004-11-25 #i34348# Changed type from sal_uInt16 to SwTwips SwTwips nTmpLeft = Left(); SwTwips nTmpRight = Right(); SwTwips nTmpFirst = FirstLeft(); @@ -2104,9 +2104,9 @@ namespace { // if anything has changed, we carefully have to adjust the right // repaint position long nPOfst = 0; - USHORT nCnt = 0; - USHORT nX = 0; - USHORT nIdx = txtFmtInfo.GetLineStart(); + sal_uInt16 nCnt = 0; + sal_uInt16 nX = 0; + sal_uInt16 nIdx = rThis.GetInfo().GetLineStart(); SwLinePortion* pPor = rCurr.GetFirstPortion(); while ( pPor ) @@ -2140,7 +2140,7 @@ namespace { // Only if hidden text should not be shown: // if ( rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar() ) const bool bShowInDocView = rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar(); - const bool bShowForPrinting = rInf.GetOpt().IsShowHiddenChar( TRUE ) && rInf.GetOpt().IsPrinting(); + const bool bShowForPrinting = rInf.GetOpt().IsShowHiddenChar( sal_True ) && rInf.GetOpt().IsPrinting(); if (bShowInDocView || bShowForPrinting) return false; diff --git a/sw/source/core/text/itrform2.hxx b/sw/source/core/text/itrform2.hxx index 70d4d1e2ce..e2faab99fa 100644 --- a/sw/source/core/text/itrform2.hxx +++ b/sw/source/core/text/itrform2.hxx @@ -57,7 +57,7 @@ class SwTxtFormatter : public SwTxtPainter sal_Bool bChanges : 1; // Flag, fuer die Berechnung des Repaint-Rechtecks sal_Bool bTruncLines : 1; // Flag, Repaint-Rechtecks ggf. erweitern sal_Bool bUnclipped : 1; // Flag, ob Repaint groesser als feste Zeilenhoehe - USHORT m_nHintEndIndex; // HACK for TryNewNoLengthPortion + sal_uInt16 m_nHintEndIndex; // HACK for TryNewNoLengthPortion SwLinePortion *NewPortion( SwTxtFormatInfo &rInf ); SwTxtPortion *NewTxtPortion( SwTxtFormatInfo &rInf ); SwLinePortion *NewExtraPortion( SwTxtFormatInfo &rInf ); @@ -77,7 +77,7 @@ class SwTxtFormatter : public SwTxtPainter // Das Herzstueck der Formatierung void BuildPortions( SwTxtFormatInfo &rInf ); - BOOL BuildMultiPortion( SwTxtFormatInfo &rInf, SwMultiPortion& rMulti ); + sal_Bool BuildMultiPortion( SwTxtFormatInfo &rInf, SwMultiPortion& rMulti ); // Berechnung des emulierten rechten Rands void CalcFlyWidth( SwTxtFormatInfo &rInf ); diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index e82732362f..8e677354c4 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -171,8 +171,8 @@ void SwTxtPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, const sal_Bool bUnderSz ) { #if OSL_DEBUG_LEVEL > 1 -// USHORT nFntHeight = GetInfo().GetFont()->GetHeight( GetInfo().GetVsh(), GetInfo().GetOut() ); -// USHORT nFntAscent = GetInfo().GetFont()->GetAscent( GetInfo().GetVsh(), GetInfo().GetOut() ); +// sal_uInt16 nFntHeight = GetInfo().GetFont()->GetHeight( GetInfo().GetVsh(), GetInfo().GetOut() ); +// sal_uInt16 nFntAscent = GetInfo().GetFont()->GetAscent( GetInfo().GetVsh(), GetInfo().GetOut() ); #endif // Adjustierung ggf. nachholen @@ -606,11 +606,11 @@ void SwTxtPainter::CheckSpecialUnderline( const SwLinePortion* pPor, rScriptInfo ); xub_StrLen nTmpIdx = nIndx; - ULONG nSumWidth = 0; - ULONG nSumHeight = 0; - ULONG nBold = 0; - USHORT nMaxBaseLineOfst = 0; - USHORT nNumberOfPortions = 0; + sal_uLong nSumWidth = 0; + sal_uLong nSumHeight = 0; + sal_uLong nBold = 0; + sal_uInt16 nMaxBaseLineOfst = 0; + sal_uInt16 nNumberOfPortions = 0; while( nTmpIdx <= nUnderEnd && pPor ) { @@ -629,13 +629,13 @@ void SwTxtPainter::CheckSpecialUnderline( const SwLinePortion* pPor, if ( !aIter.GetFnt()->GetEscapement() ) { nSumWidth += pPor->Width(); - const ULONG nFontHeight = aIter.GetFnt()->GetHeight(); + const sal_uLong nFontHeight = aIter.GetFnt()->GetHeight(); // If we do not have a common baseline we take the baseline // and the font of the lowest portion. if ( nAdjustBaseLine ) { - USHORT nTmpBaseLineOfst = AdjustBaseLine( *pCurr, pPor ); + sal_uInt16 nTmpBaseLineOfst = AdjustBaseLine( *pCurr, pPor ); if ( nMaxBaseLineOfst < nTmpBaseLineOfst ) { nMaxBaseLineOfst = nTmpBaseLineOfst; @@ -659,14 +659,14 @@ void SwTxtPainter::CheckSpecialUnderline( const SwLinePortion* pPor, // resulting height if ( nNumberOfPortions > 1 && nSumWidth ) { - const ULONG nNewFontHeight = nAdjustBaseLine ? + const sal_uLong nNewFontHeight = nAdjustBaseLine ? nSumHeight : nSumHeight / nSumWidth; pUnderlineFnt = new SwFont( *GetInfo().GetFont() ); // font height - const BYTE nActual = pUnderlineFnt->GetActual(); + const sal_uInt8 nActual = pUnderlineFnt->GetActual(); pUnderlineFnt->SetSize( Size( pUnderlineFnt->GetSize( nActual ).Width(), nNewFontHeight ), nActual ); diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx index 2658b4081e..7f155117c8 100644 --- a/sw/source/core/text/itrtxt.cxx +++ b/sw/source/core/text/itrtxt.cxx @@ -288,9 +288,9 @@ const SwLineLayout *SwTxtCursor::CharCrsrToLine( const xub_StrLen nPosition ) * SwTxtCrsr::AdjustBaseLine() *************************************************************************/ -USHORT SwTxtCursor::AdjustBaseLine( const SwLineLayout& rLine, +sal_uInt16 SwTxtCursor::AdjustBaseLine( const SwLineLayout& rLine, const SwLinePortion* pPor, - USHORT nPorHeight, USHORT nPorAscent, + sal_uInt16 nPorHeight, sal_uInt16 nPorAscent, const sal_Bool bAutoToCentered ) const { if ( pPor ) @@ -299,14 +299,14 @@ USHORT SwTxtCursor::AdjustBaseLine( const SwLineLayout& rLine, nPorAscent = pPor->GetAscent(); } - USHORT nOfst = rLine.GetRealHeight() - rLine.Height(); + sal_uInt16 nOfst = rLine.GetRealHeight() - rLine.Height(); GETGRID( pFrm->FindPageFrm() ) const sal_Bool bHasGrid = pGrid && GetInfo().SnapToGrid(); if ( bHasGrid ) { - const USHORT nRubyHeight = pGrid->GetRubyHeight(); + const sal_uInt16 nRubyHeight = pGrid->GetRubyHeight(); const sal_Bool bRubyTop = ! pGrid->GetRubyTextBelow(); if ( GetInfo().IsMulti() ) @@ -326,8 +326,8 @@ USHORT SwTxtCursor::AdjustBaseLine( const SwLineLayout& rLine, // centered inside the whole line. //for text refactor - const USHORT nLineNetto = rLine.Height() - nRubyHeight; - //const USHORT nLineNetto = ( nPorHeight > nGridWidth ) ? + const sal_uInt16 nLineNetto = rLine.Height() - nRubyHeight; + //const sal_uInt16 nLineNetto = ( nPorHeight > nGridWidth ) ? // rLine.Height() - nRubyHeight : // nGridWidth; nOfst += ( nLineNetto - nPorHeight ) / 2; @@ -352,7 +352,11 @@ USHORT SwTxtCursor::AdjustBaseLine( const SwLineLayout& rLine, case SvxParaVertAlignItem::AUTOMATIC : if ( bAutoToCentered || GetInfo().GetTxtFrm()->IsVertical() ) { - nOfst += ( rLine.Height() - nPorHeight ) / 2 + nPorAscent; + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if( GetInfo().GetTxtFrm()->IsVertLR() ) + nOfst += rLine.Height() - ( rLine.Height() - nPorHeight ) / 2 - nPorAscent; + else + nOfst += ( rLine.Height() - nPorHeight ) / 2 + nPorAscent; break; } case SvxParaVertAlignItem::BASELINE : @@ -430,13 +434,13 @@ void SwTxtIter::TruncLines( sal_Bool bNoteFollow ) SwpHints* pTmpHints = GetTxtFrm()->GetTxtNode()->GetpSwpHints(); // examine hints in range nEnd - (nEnd + nRangeChar) - for( USHORT i = 0; i < pTmpHints->Count(); i++ ) + for( sal_uInt16 i = 0; i < pTmpHints->Count(); i++ ) { const SwTxtAttr* pHt = pTmpHints->GetTextHint( i ); if( RES_TXTATR_FLYCNT == pHt->Which() ) { // check, if hint is in our range - const USHORT nTmpPos = *pHt->GetStart(); + const sal_uInt16 nTmpPos = *pHt->GetStart(); if ( nEnd <= nTmpPos && nTmpPos < nRangeEnd ) pFollow->_InvalidateRange( SwCharRange( nTmpPos, nTmpPos ), 0 ); diff --git a/sw/source/core/text/itrtxt.hxx b/sw/source/core/text/itrtxt.hxx index 3d4a9a4bfc..84c027ef72 100644 --- a/sw/source/core/text/itrtxt.hxx +++ b/sw/source/core/text/itrtxt.hxx @@ -284,8 +284,8 @@ public: // calculates baseline for portion rPor // bAutoToCentered indicates, if AUTOMATIC mode means CENTERED or BASELINE - USHORT AdjustBaseLine( const SwLineLayout& rLine, const SwLinePortion* pPor, - USHORT nPorHeight = 0, USHORT nAscent = 0, + sal_uInt16 AdjustBaseLine( const SwLineLayout& rLine, const SwLinePortion* pPor, + sal_uInt16 nPorHeight = 0, sal_uInt16 nAscent = 0, const sal_Bool bAutoToCentered = sal_False ) const; static inline void SetRightMargin( const sal_Bool bNew ){ bRightMargin = bNew; } diff --git a/sw/source/core/text/makefile.mk b/sw/source/core/text/makefile.mk deleted file mode 100644 index 7e1cc176dd..0000000000 --- a/sw/source/core/text/makefile.mk +++ /dev/null @@ -1,104 +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=text - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(mydebug)" != "" -CDEFS+=-Dmydebug -.ENDIF - -.IF "$(ENABLE_GRAPHITE)" == "TRUE" -CFLAGS+=-DENABLE_GRAPHITE -.ENDIF -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(EXCEPTIONSFILES) \ - $(SLO)$/txtcache.obj \ - $(SLO)$/txtinit.obj - -.IF "$(DBG_LEVEL)">="2" -SLOFILES += \ - $(SLO)$/xmldump.obj \ - $(SLO)$/txtio.obj -.ENDIF - -EXCEPTIONSFILES = \ - $(SLO)$/EnhancedPDFExportHelper.obj \ - $(SLO)$/SwGrammarMarkUp.obj \ - $(SLO)$/atrstck.obj \ - $(SLO)$/blink.obj \ - $(SLO)$/frmcrsr.obj \ - $(SLO)$/frmform.obj \ - $(SLO)$/frminf.obj \ - $(SLO)$/frmpaint.obj \ - $(SLO)$/guess.obj \ - $(SLO)$/inftxt.obj \ - $(SLO)$/itradj.obj \ - $(SLO)$/itratr.obj \ - $(SLO)$/itrcrsr.obj \ - $(SLO)$/itrform2.obj \ - $(SLO)$/itrpaint.obj \ - $(SLO)$/itrtxt.obj \ - $(SLO)$/noteurl.obj \ - $(SLO)$/porexp.obj \ - $(SLO)$/porfld.obj \ - $(SLO)$/porfly.obj \ - $(SLO)$/porglue.obj \ - $(SLO)$/porlay.obj \ - $(SLO)$/porlin.obj \ - $(SLO)$/pormulti.obj \ - $(SLO)$/porref.obj \ - $(SLO)$/porrst.obj \ - $(SLO)$/portox.obj \ - $(SLO)$/portxt.obj \ - $(SLO)$/redlnitr.obj \ - $(SLO)$/txtdrop.obj \ - $(SLO)$/txtfld.obj \ - $(SLO)$/txtfly.obj \ - $(SLO)$/txtfrm.obj \ - $(SLO)$/txtftn.obj \ - $(SLO)$/txthyph.obj \ - $(SLO)$/txtpaint.obj \ - $(SLO)$/txttab.obj \ - $(SLO)$/widorp.obj \ - $(SLO)$/wrong.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/text/pordrop.hxx b/sw/source/core/text/pordrop.hxx index 659cf6a41f..f498d19f51 100644 --- a/sw/source/core/text/pordrop.hxx +++ b/sw/source/core/text/pordrop.hxx @@ -50,7 +50,7 @@ class SwDropPortionPart SwDropPortionPart* pFollow; SwFont* pFnt; xub_StrLen nLen; - USHORT nWidth; + sal_uInt16 nWidth; public: SwDropPortionPart( SwFont& rFont, const xub_StrLen nL ) @@ -61,8 +61,8 @@ public: inline void SetFollow( SwDropPortionPart* pNew ) { pFollow = pNew; }; inline SwFont& GetFont() const { return *pFnt; } inline xub_StrLen GetLen() const { return nLen; } - inline USHORT GetWidth() const { return nWidth; } - inline void SetWidth( USHORT nNew ) { nWidth = nNew; } + inline sal_uInt16 GetWidth() const { return nWidth; } + inline void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; } }; /************************************************************************* diff --git a/sw/source/core/text/porexp.hxx b/sw/source/core/text/porexp.hxx index a9f0a92dd6..5d142edfdf 100644 --- a/sw/source/core/text/porexp.hxx +++ b/sw/source/core/text/porexp.hxx @@ -59,14 +59,14 @@ public: class SwBlankPortion : public SwExpandPortion { xub_Unicode cChar; - BOOL bMulti; // For multiportion brackets + sal_Bool bMulti; // For multiportion brackets public: - inline SwBlankPortion( xub_Unicode cCh, BOOL bMult = sal_False ) + inline SwBlankPortion( xub_Unicode cCh, sal_Bool bMult = sal_False ) : cChar( cCh ), bMulti( bMult ) { cChar = cCh; SetLen(1); SetWhichPor( POR_BLANK ); } - BOOL IsMulti() const { return bMulti; } - void SetMulti( BOOL bNew ) { bMulti = bNew; } + sal_Bool IsMulti() const { return bMulti; } + void SetMulti( sal_Bool bNew ) { bMulti = bNew; } virtual SwLinePortion *Compress(); virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 0843bda453..8fe0803276 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -212,8 +212,8 @@ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf ) String aTxt; if( GetExpTxt( rInf, aTxt ) && aTxt.Len() && pBreakIt->GetBreakIter().is() ) { - BYTE nActual = pFnt ? pFnt->GetActual() : rInf.GetFont()->GetActual(); - USHORT nScript; + sal_uInt8 nActual = pFnt ? pFnt->GetActual() : rInf.GetFont()->GetActual(); + sal_uInt16 nScript; { nScript = pBreakIt->GetBreakIter()->getScriptType( aTxt, 0 ); xub_StrLen nChg = 0; @@ -233,7 +233,7 @@ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf ) nNextScriptChg = aTxt.Len(); } - BYTE nTmp; + sal_uInt8 nTmp; switch ( nScript ) { case i18n::ScriptType::LATIN : nTmp = SW_LATIN; break; case i18n::ScriptType::ASIAN : nTmp = SW_CJK; break; @@ -244,8 +244,8 @@ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf ) // #i16354# Change script type for RTL text to CTL. const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo(); // --> OD 2009-01-29 #i98418# -// const BYTE nFldDir = IsNumberPortion() ? - const BYTE nFldDir = ( IsNumberPortion() || IsFtnNumPortion() ) ? +// const sal_uInt8 nFldDir = IsNumberPortion() ? + const sal_uInt8 nFldDir = ( IsNumberPortion() || IsFtnNumPortion() ) ? rSI.GetDefaultDir() : rSI.DirType( IsFollow() ? rInf.GetIdx() - 1 : rInf.GetIdx() ); // <-- @@ -685,8 +685,8 @@ void SwNumberPortion::Paint( const SwTxtPaintInfo &rInf ) const // calculate the width of the number portion, including follows const KSHORT nOldWidth = Width(); - USHORT nSumWidth = 0; - USHORT nOffset = 0; + sal_uInt16 nSumWidth = 0; + sal_uInt16 nOffset = 0; const SwLinePortion* pTmp = this; while ( pTmp && pTmp->InNumberGrp() ) @@ -845,7 +845,7 @@ SwGrfNumPortion::SwGrfNumPortion( nYPos = 0; eOrient = text::VertOrientation::TOP; } - Width( static_cast<USHORT>(rGrfSize.Width() + 2 * GRFNUM_SECURE) ); + Width( static_cast<sal_uInt16>(rGrfSize.Width() + 2 * GRFNUM_SECURE) ); nFixWidth = Width(); nGrfHeight = rGrfSize.Height() + 2 * GRFNUM_SECURE; Height( KSHORT(nGrfHeight) ); @@ -881,7 +881,7 @@ sal_Bool SwGrfNumPortion::Format( SwTxtFormatInfo &rInf ) const sal_Bool bFull = rInf.Width() < rInf.X() + Width(); const sal_Bool bFly = rInf.GetFly() || ( rInf.GetLast() && rInf.GetLast()->IsFlyPortion() ); - SetAscent( static_cast<USHORT>(GetRelPos() > 0 ? GetRelPos() : 0) ); + SetAscent( static_cast<sal_uInt16>(GetRelPos() > 0 ? GetRelPos() : 0) ); if( GetAscent() > Height() ) Height( GetAscent() ); @@ -1116,10 +1116,10 @@ SwCombinedPortion::SwCombinedPortion( const XubString &rTxt ) // the arrays of width and position are filled by the format function if( pBreakIt->GetBreakIter().is() ) { - BYTE nScr = SW_SCRIPTS; - for( USHORT i = 0; i < rTxt.Len(); ++i ) + sal_uInt8 nScr = SW_SCRIPTS; + for( sal_uInt16 i = 0; i < rTxt.Len(); ++i ) { - USHORT nScript = pBreakIt->GetBreakIter()->getScriptType( rTxt, i ); + sal_uInt16 nScript = pBreakIt->GetBreakIter()->getScriptType( rTxt, i ); switch ( nScript ) { case i18n::ScriptType::LATIN : nScr = SW_LATIN; break; case i18n::ScriptType::ASIAN : nScr = SW_CJK; break; @@ -1130,7 +1130,7 @@ SwCombinedPortion::SwCombinedPortion( const XubString &rTxt ) } else { - for( USHORT i = 0; i < 6; aScrType[i++] = 0 ) + for( sal_uInt16 i = 0; i < 6; aScrType[i++] = 0 ) ; // nothing } memset( &aWidth, 0, sizeof(aWidth) ); @@ -1152,19 +1152,19 @@ void SwCombinedPortion::Paint( const SwTxtPaintInfo &rInf ) const if( rInf.OnWin() && pPortion && !pPortion->Width() ) pPortion->PrePaint( rInf, this ); - USHORT nCount = aExpand.Len(); + sal_uInt16 nCount = aExpand.Len(); if( !nCount ) return; OSL_ENSURE( nCount < 7, "Too much combined characters" ); // the first character of the second row - USHORT nTop = ( nCount + 1 ) / 2; + sal_uInt16 nTop = ( nCount + 1 ) / 2; SwFont aTmpFont( *rInf.GetFont() ); aTmpFont.SetProportion( nProportion ); // a smaller font SwFontSave aFontSave( rInf, &aTmpFont ); - USHORT i = 0; + sal_uInt16 i = 0; Point aOldPos = rInf.GetPos(); Point aOutPos( aOldPos.X(), aOldPos.Y() - nUpPos );// Y of the first row while( i < nCount ) @@ -1172,7 +1172,7 @@ void SwCombinedPortion::Paint( const SwTxtPaintInfo &rInf ) const if( i == nTop ) // change the row aOutPos.Y() = aOldPos.Y() + nLowPos; // Y of the second row aOutPos.X() = aOldPos.X() + aPos[i]; // X position - const BYTE nAct = aScrType[i]; // script type + const sal_uInt8 nAct = aScrType[i]; // script type aTmpFont.SetActual( nAct ); // if there're more than 4 characters to display, we choose fonts // with 2/3 of the original font width. @@ -1200,7 +1200,7 @@ void SwCombinedPortion::Paint( const SwTxtPaintInfo &rInf ) const sal_Bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf ) { - USHORT nCount = aExpand.Len(); + sal_uInt16 nCount = aExpand.Len(); if( !nCount ) { Width( 0 ); @@ -1210,7 +1210,7 @@ sal_Bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf ) OSL_ENSURE( nCount < 7, "Too much combined characters" ); // If there are leading "weak"-scripttyped characters in this portion, // they get the actual scripttype. - USHORT i = 0; + sal_uInt16 i = 0; while( i < nCount && SW_SCRIPTS == aScrType[i] ) aScrType[i++] = rInf.GetFont()->GetActual(); if( nCount > 4 ) @@ -1224,22 +1224,22 @@ sal_Bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf ) { rInf.GetOut()->SetFont( rInf.GetFont()->GetFnt( aScrType[i] ) ); aWidth[ aScrType[i] ] = - static_cast<USHORT>(2 * rInf.GetOut()->GetFontMetric().GetSize().Width() / 3); + static_cast<sal_uInt16>(2 * rInf.GetOut()->GetFontMetric().GetSize().Width() / 3); } ++i; } } - USHORT nTop = ( nCount + 1 ) / 2; // the first character of the second line + sal_uInt16 nTop = ( nCount + 1 ) / 2; // the first character of the second line ViewShell *pSh = rInf.GetTxtFrm()->GetShell(); SwFont aTmpFont( *rInf.GetFont() ); SwFontSave aFontSave( rInf, &aTmpFont ); nProportion = 55; // In nMainAscent/Descent we store the ascent and descent // of the original surrounding font - USHORT nMaxDescent, nMaxAscent, nMaxWidth; - USHORT nMainDescent = rInf.GetFont()->GetHeight( pSh, *rInf.GetOut() ); - const USHORT nMainAscent = rInf.GetFont()->GetAscent( pSh, *rInf.GetOut() ); + sal_uInt16 nMaxDescent, nMaxAscent, nMaxWidth; + sal_uInt16 nMainDescent = rInf.GetFont()->GetHeight( pSh, *rInf.GetOut() ); + const sal_uInt16 nMainAscent = rInf.GetFont()->GetAscent( pSh, *rInf.GetOut() ); nMainDescent = nMainDescent - nMainAscent; // we start with a 50% font, but if we notice that the combined portion // becomes bigger than the surrounding font, we check 45% and maybe 40%. @@ -1261,7 +1261,7 @@ sal_Bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf ) // local nMaxAscent, nMaxDescent and nMaxWidth variables. while( i < nCount ) { - BYTE nScrp = aScrType[i]; + sal_uInt8 nScrp = aScrType[i]; aTmpFont.SetActual( nScrp ); if( aWidth[ nScrp ] ) { @@ -1272,8 +1272,8 @@ sal_Bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf ) SwDrawTextInfo aDrawInf( pSh, *rInf.GetOut(), 0, aExpand, i, 1 ); Size aSize = aTmpFont._GetTxtSize( aDrawInf ); - USHORT nAsc = aTmpFont.GetAscent( pSh, *rInf.GetOut() ); - aPos[ i ] = (USHORT)aSize.Width(); + sal_uInt16 nAsc = aTmpFont.GetAscent( pSh, *rInf.GetOut() ); + aPos[ i ] = (sal_uInt16)aSize.Width(); if( i == nTop ) // enter the second line { nLowPos = nMaxDescent; @@ -1288,7 +1288,7 @@ sal_Bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf ) if( nAsc > nMaxAscent ) nMaxAscent = nAsc; if( aSize.Height() - nAsc > nMaxDescent ) - nMaxDescent = static_cast<USHORT>(aSize.Height() - nAsc); + nMaxDescent = static_cast<sal_uInt16>(aSize.Height() - nAsc); } // for one or two characters we double the width of the portion if( nCount < 3 ) @@ -1317,8 +1317,8 @@ sal_Bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf ) Height( nMainAscent + nMainDescent ); // We calculate the x positions of the characters in both lines.. - USHORT nTopDiff = 0; - USHORT nBotDiff = 0; + sal_uInt16 nTopDiff = 0; + sal_uInt16 nBotDiff = 0; if( nMaxWidth > Width() ) { nTopDiff = ( nMaxWidth - Width() ) / 2; @@ -1347,7 +1347,7 @@ sal_Bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf ) { if( rInf.GetLineStart() == rInf.GetIdx() && (!rInf.GetLast()->InFldGrp() || !((SwFldPortion*)rInf.GetLast())->IsFollow() ) ) - Width( (USHORT)( rInf.Width() - rInf.X() ) ); + Width( (sal_uInt16)( rInf.Width() - rInf.X() ) ); else { Truncate(); diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx index 61f6c8e861..a4948fd6d9 100644 --- a/sw/source/core/text/porfld.hxx +++ b/sw/source/core/text/porfld.hxx @@ -242,12 +242,12 @@ public: class SwCombinedPortion : public SwFldPortion { - USHORT aPos[6]; // up to six X positions - USHORT aWidth[3]; // one width for every scripttype - BYTE aScrType[6]; // scripttype of every character - USHORT nUpPos; // the Y position of the upper baseline - USHORT nLowPos; // the Y position of the lower baseline - BYTE nProportion; // relative font height + sal_uInt16 aPos[6]; // up to six X positions + sal_uInt16 aWidth[3]; // one width for every scripttype + sal_uInt8 aScrType[6]; // scripttype of every character + sal_uInt16 nUpPos; // the Y position of the upper baseline + sal_uInt16 nLowPos; // the Y position of the lower baseline + sal_uInt8 nProportion; // relative font height public: SwCombinedPortion( const XubString &rExpand ); virtual void Paint( const SwTxtPaintInfo &rInf ) const; diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx index 8cfd8a4ed4..1a71bdaab4 100644 --- a/sw/source/core/text/porfly.cxx +++ b/sw/source/core/text/porfly.cxx @@ -76,7 +76,7 @@ sal_Bool SwFlyPortion::Format( SwTxtFormatInfo &rInf ) // Der Glue wird aufgespannt. rInf.GetLast()->FormatEOL( rInf ); - PrtWidth( static_cast<USHORT>(Fix() - rInf.X() + PrtWidth()) ); + PrtWidth( static_cast<sal_uInt16>(Fix() - rInf.X() + PrtWidth()) ); if( !Width() ) { OSL_ENSURE( Width(), "+SwFlyPortion::Format: a fly is a fly is a fly" ); @@ -99,7 +99,7 @@ sal_Bool SwFlyPortion::Format( SwTxtFormatInfo &rInf ) SetLen( 1 ); } - const USHORT nNewWidth = static_cast<USHORT>(rInf.X() + PrtWidth()); + const sal_uInt16 nNewWidth = static_cast<sal_uInt16>(rInf.X() + PrtWidth()); if( rInf.Width() <= nNewWidth ) { Truncate(); @@ -129,7 +129,7 @@ sal_Bool SwFlyCntPortion::Format( SwTxtFormatInfo &rInf ) // KerningPortions at beginning of line, e.g., for grid layout // must be considered. const SwLinePortion* pLastPor = rInf.GetLast(); - const USHORT nLeft = ( pLastPor && + const sal_uInt16 nLeft = ( pLastPor && ( pLastPor->IsKernPortion() || pLastPor->IsErgoSumPortion() ) ) ? pLastPor->Width() : @@ -209,7 +209,7 @@ xub_StrLen SwTxtFrm::CalcFlyPos( SwFrmFmt* pSearch ) if( !pHints ) return STRING_LEN; SwTxtAttr* pFound = NULL; - for ( USHORT i = 0; i < pHints->Count(); i++) + for ( sal_uInt16 i = 0; i < pHints->Count(); i++) { SwTxtAttr *pHt = pHints->GetTextHint( i ); if( RES_TXTATR_FLYCNT == pHt->Which() ) @@ -408,14 +408,14 @@ void SwFlyCntPortion::SetBase( const SwTxtFrm& rFrm, const Point &rBase, SwTwips nRelPos = aObjPositioning.GetRelPosY(); if ( nRelPos < 0 ) { - nAscent = static_cast<USHORT>(-nRelPos); + nAscent = static_cast<sal_uInt16>(-nRelPos); if( nAscent > Height() ) Height( nAscent ); } else { nAscent = 0; - Height( Height() + static_cast<USHORT>(nRelPos) ); + Height( Height() + static_cast<sal_uInt16>(nRelPos) ); } } else diff --git a/sw/source/core/text/porftn.hxx b/sw/source/core/text/porftn.hxx index 4ab1764f97..9f3434b598 100644 --- a/sw/source/core/text/porftn.hxx +++ b/sw/source/core/text/porftn.hxx @@ -44,7 +44,7 @@ class SwFtnPortion : public SwFldPortion KSHORT nOrigHeight; // --> OD 2009-01-29 #i98418# bool mbPreferredScriptTypeSet; - BYTE mnPreferredScriptType; + sal_uInt8 mnPreferredScriptType; // <-- public: SwFtnPortion( const XubString &rExpand, SwTxtFrm *pFrm, SwTxtFtn *pFtn, @@ -57,7 +57,7 @@ public: virtual sal_Bool Format( SwTxtFormatInfo &rInf ); // --> OD 2009-01-29 #i98418# - void SetPreferredScriptType( BYTE nPreferredScriptType ); + void SetPreferredScriptType( sal_uInt8 nPreferredScriptType ); // <-- const SwTxtFtn* GetTxtFtn() const { return pFtn; }; diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx index c9891e23a4..98a8ab77f8 100644 --- a/sw/source/core/text/porglue.cxx +++ b/sw/source/core/text/porglue.cxx @@ -214,7 +214,7 @@ SwMarginPortion::SwMarginPortion( const KSHORT nFixedWidth ) void SwMarginPortion::AdjustRight( const SwLineLayout *pCurr ) { SwGluePortion *pRight = 0; - BOOL bNoMove = 0 != pCurr->GetpKanaComp(); + sal_Bool bNoMove = 0 != pCurr->GetpKanaComp(); while( pRight != this ) { diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index bca7dba3ed..123da7568a 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -638,8 +638,8 @@ void SwLineLayout::CalcLine( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf ) // --> FME 2006-03-01 #i3952# if ( bHasBlankPortion && bHasOnlyBlankPortions ) { - USHORT nTmpAscent = GetAscent(); - USHORT nTmpHeight = Height(); + sal_uInt16 nTmpAscent = GetAscent(); + sal_uInt16 nTmpHeight = Height(); rLine.GetAttrHandler().GetDefaultAscentAndHeight( rInf.GetVsh(), *rInf.GetOut(), nTmpAscent, nTmpHeight ); SetAscent( nTmpAscent ); Height( nTmpHeight ); @@ -752,10 +752,10 @@ SwScriptInfo::~SwScriptInfo() * Converts i18n Script Type (LATIN, ASIAN, COMPLEX, WEAK) to * Sw Script Types (SW_LATIN, SW_CJK, SW_CTL), used to identify the font *************************************************************************/ -BYTE SwScriptInfo::WhichFont( xub_StrLen nIdx, const String* pTxt, const SwScriptInfo* pSI ) +sal_uInt8 SwScriptInfo::WhichFont( xub_StrLen nIdx, const String* pTxt, const SwScriptInfo* pSI ) { OSL_ENSURE( pTxt || pSI,"How should I determine the script type?" ); - USHORT nScript; + sal_uInt16 nScript; // First we try to use our SwScriptInfo if ( pSI ) @@ -799,17 +799,16 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) MultiSelection aHiddenMulti( aRange ); CalcHiddenRanges( rNode, aHiddenMulti ); - aHiddenChg.Remove( 0, aHiddenChg.Count() ); - USHORT nHiddenIdx = 0; - USHORT i = 0; + aHiddenChg.clear(); + sal_uInt16 i = 0; for( i = 0; i < aHiddenMulti.GetRangeCount(); ++i ) { const Range& rRange = aHiddenMulti.GetRange( i ); const xub_StrLen nStart = (xub_StrLen)rRange.Min(); const xub_StrLen nEnd = (xub_StrLen)rRange.Max() + 1; - aHiddenChg.Insert( nStart, nHiddenIdx++ ); - aHiddenChg.Insert( nEnd, nHiddenIdx++ ); + aHiddenChg.push_back( nStart ); + aHiddenChg.push_back( nEnd ); } // @@ -822,16 +821,16 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) nInvalidityPos = STRING_LEN; // this is the default direction - nDefaultDir = static_cast<BYTE>(bRTL ? UBIDI_RTL : UBIDI_LTR); + nDefaultDir = static_cast<sal_uInt8>(bRTL ? UBIDI_RTL : UBIDI_LTR); // counter for script info arrays - USHORT nCnt = 0; + sal_uInt16 nCnt = 0; // counter for compression information arrays - USHORT nCntComp = 0; + sal_uInt16 nCntComp = 0; // counter for kashida array - USHORT nCntKash = 0; + sal_uInt16 nCntKash = 0; - BYTE nScript = i18n::ScriptType::LATIN; + sal_uInt8 nScript = i18n::ScriptType::LATIN; // compression type const SwCharCompressType aCompEnum = rNode.getIDocumentSettingAccess()->getCharacterCompressionType(); @@ -902,7 +901,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) // If we are at the start of a group, we do not trust nScript, // we better get nScript from the breakiterator: if ( nChg == nGrpStart ) - nScript = (BYTE)pBreakIt->GetBreakIter()->getScriptType( rTxt, nChg ); + nScript = (sal_uInt8)pBreakIt->GetBreakIter()->getScriptType( rTxt, nChg ); // // INVALID DATA FROM THE SCRIPT INFO ARRAYS HAS TO BE DELETED: @@ -912,7 +911,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) aScriptChanges.erase( aScriptChanges.begin() + nCnt, aScriptChanges.end() ); // get the start of the last compression group - USHORT nLastCompression = nChg; + sal_uInt16 nLastCompression = nChg; if( nCntComp ) { --nCntComp; @@ -928,7 +927,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) aCompressionChanges.erase(aCompressionChanges.begin() + nCntComp, aCompressionChanges.end() ); // get the start of the last kashida group - USHORT nLastKashida = nChg; + sal_uInt16 nLastKashida = nChg; if( nCntKash && i18n::ScriptType::COMPLEX == nScript ) { --nCntKash; @@ -936,7 +935,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) } // remove invalid entries from kashida array - aKashida.Remove( nCntKash, aKashida.Count() - nCntKash ); + aKashida.erase( aKashida.begin() + nCntKash, aKashida.end() ); // // TAKE CARE OF WEAK CHARACTERS: WE MUST FIND AN APPROPRIATE @@ -955,7 +954,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) if( nEnd > rTxt.Len() ) nEnd = rTxt.Len(); - nScript = (BYTE)GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ); + nScript = (sal_uInt8)GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); OSL_ENSURE( i18n::ScriptType::LATIN == nScript || i18n::ScriptType::ASIAN == nScript || @@ -964,9 +963,9 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) nChg = nEnd; // Get next script type or set to weak in order to exit - BYTE nNextScript = ( nEnd < rTxt.Len() ) ? - (BYTE)pBreakIt->GetBreakIter()->getScriptType( rTxt, nEnd ) : - (BYTE)WEAK; + sal_uInt8 nNextScript = ( nEnd < rTxt.Len() ) ? + (sal_uInt8)pBreakIt->GetBreakIter()->getScriptType( rTxt, nEnd ) : + (sal_uInt8)WEAK; if ( nScript != nNextScript ) { @@ -1039,9 +1038,9 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) if ( CHARCOMPRESS_NONE != aCompEnum && i18n::ScriptType::ASIAN == nScript ) { - BYTE ePrevState = NONE; - BYTE eState; - USHORT nPrevChg = nLastCompression; + sal_uInt8 ePrevState = NONE; + sal_uInt8 eState; + sal_uInt16 nPrevChg = nLastCompression; while ( nLastCompression < nChg ) { @@ -1064,7 +1063,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) eState = SPECIAL_RIGHT; break; default: - eState = static_cast<BYTE>( ( 0x3040 <= cChar && 0x3100 > cChar ) ? KANA : NONE ); + eState = static_cast<sal_uInt8>( ( 0x3040 <= cChar && 0x3100 > cChar ) ? KANA : NONE ); } // insert range of compressable characters @@ -1116,7 +1115,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) xub_Unicode cCh; xub_Unicode cPrevCh = 0; - USHORT nPriorityLevel = 7; // 0..6 = level found + sal_uInt16 nPriorityLevel = 7; // 0..6 = level found // 7 not found xub_StrLen nWordLen = rWord.Len(); @@ -1260,12 +1259,15 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) } // end of current word if ( STRING_LEN != nKashidaPos ) - aKashida.Insert( nKashidaPos, nCntKash++ ); + { + aKashida.insert( aKashida.begin() + nCntKash, nKashidaPos); + nCntKash++; + } } // end of kashida search } if ( nChg < rTxt.Len() ) - nScript = (BYTE)pBreakIt->GetBreakIter()->getScriptType( rTxt, nChg ); + nScript = (sal_uInt8)pBreakIt->GetBreakIter()->getScriptType( rTxt, nChg ); nLastCompression = nChg; nLastKashida = nChg; @@ -1275,7 +1277,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) // check kashida data long nTmpKashidaPos = -1; sal_Bool bWrongKash = sal_False; - for (i = 0; i < aKashida.Count(); ++i ) + for (i = 0; i < aKashida.size(); ++i ) { long nCurrKashidaPos = GetKashida( i ); if ( nCurrKashidaPos <= nTmpKashidaPos ) @@ -1309,9 +1311,9 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) // 1. All text in RTL runs will use the CTL font // #i89825# change the script type also to CTL (hennerdrewes) // 2. Text in embedded LTR runs that does not have any strong LTR characters (numbers!) - for ( USHORT nDirIdx = 0; nDirIdx < aDirectionChanges.size(); ++nDirIdx ) + for ( sal_uInt32 nDirIdx = 0; nDirIdx < aDirectionChanges.size(); ++nDirIdx ) { - const BYTE nCurrDirType = GetDirType( nDirIdx ); + const sal_uInt8 nCurrDirType = GetDirType( nDirIdx ); // nStart ist start of RTL run: const xub_StrLen nStart = nDirIdx > 0 ? GetDirChg( nDirIdx - 1 ) : 0; // nEnd is end of RTL run: @@ -1321,7 +1323,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) ( nCurrDirType > UBIDI_LTR && !lcl_HasStrongLTR( rTxt, nStart, nEnd ) ) ) // non-strong text in embedded LTR run { // nScriptIdx points into the ScriptArrays: - USHORT nScriptIdx = 0; + size_t nScriptIdx = 0; // Skip entries in ScriptArray which are not inside the RTL run: // Make nScriptIdx become the index of the script group with @@ -1331,7 +1333,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) ++nScriptIdx; const xub_StrLen nStartPosOfGroup = nScriptIdx ? GetScriptChg( nScriptIdx - 1 ) : 0; - const BYTE nScriptTypeOfGroup = GetScriptType( nScriptIdx ); + const sal_uInt8 nScriptTypeOfGroup = GetScriptType( nScriptIdx ); OSL_ENSURE( nStartPosOfGroup <= nStart && GetScriptChg( nScriptIdx ) > nStart, "Script override with CTL font trouble" ); @@ -1359,7 +1361,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) #if OSL_DEBUG_LEVEL > 1 // Check that ScriptChangeInfos are in increasing order of // position and that we don't have "empty" changes. - BYTE nLastTyp = i18n::ScriptType::WEAK; + sal_uInt8 nLastTyp = i18n::ScriptType::WEAK; xub_StrLen nLastPos = 0; for (std::vector<ScriptChangeInfo>::const_iterator i2 = aScriptChanges.begin(); i2 < aScriptChanges.end(); ++i2) { @@ -1393,7 +1395,7 @@ void SwScriptInfo::UpdateBidiInfo( const String& rTxt ) int32_t nStart = 0; int32_t nEnd; UBiDiLevel nCurrDir; - for ( USHORT nIdx = 0; nIdx < nCount; ++nIdx ) + for ( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx ) { ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir ); aDirectionChanges.push_back( DirectionChangeInfo(nEnd, nCurrDir) ); @@ -1417,8 +1419,8 @@ void SwScriptInfo::UpdateBidiInfo( const String& rTxt ) xub_StrLen SwScriptInfo::NextScriptChg( const xub_StrLen nPos ) const { - USHORT nEnd = CountScriptChg(); - for( USHORT nX = 0; nX < nEnd; ++nX ) + sal_uInt16 nEnd = CountScriptChg(); + for( sal_uInt16 nX = 0; nX < nEnd; ++nX ) { if( nPos < GetScriptChg( nX ) ) return GetScriptChg( nX ); @@ -1432,25 +1434,25 @@ xub_StrLen SwScriptInfo::NextScriptChg( const xub_StrLen nPos ) const * returns the script of the character at the input position *************************************************************************/ -BYTE SwScriptInfo::ScriptType( const xub_StrLen nPos ) const +sal_uInt8 SwScriptInfo::ScriptType( const xub_StrLen nPos ) const { - USHORT nEnd = CountScriptChg(); - for( USHORT nX = 0; nX < nEnd; ++nX ) + sal_uInt16 nEnd = CountScriptChg(); + for( sal_uInt16 nX = 0; nX < nEnd; ++nX ) { if( nPos < GetScriptChg( nX ) ) return GetScriptType( nX ); } // the default is the application language script - return (BYTE)GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ); + return (sal_uInt8)GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); } xub_StrLen SwScriptInfo::NextDirChg( const xub_StrLen nPos, - const BYTE* pLevel ) const + const sal_uInt8* pLevel ) const { - BYTE nCurrDir = pLevel ? *pLevel : 62; - USHORT nEnd = CountDirChg(); - for( USHORT nX = 0; nX < nEnd; ++nX ) + sal_uInt8 nCurrDir = pLevel ? *pLevel : 62; + sal_uInt16 nEnd = CountDirChg(); + for( sal_uInt16 nX = 0; nX < nEnd; ++nX ) { if( nPos < GetDirChg( nX ) && ( nX + 1 == nEnd || GetDirType( nX + 1 ) <= nCurrDir ) ) @@ -1460,10 +1462,10 @@ xub_StrLen SwScriptInfo::NextDirChg( const xub_StrLen nPos, return STRING_LEN; } -BYTE SwScriptInfo::DirType( const xub_StrLen nPos ) const +sal_uInt8 SwScriptInfo::DirType( const xub_StrLen nPos ) const { - USHORT nEnd = CountDirChg(); - for( USHORT nX = 0; nX < nEnd; ++nX ) + sal_uInt16 nEnd = CountDirChg(); + for( sal_uInt16 nX = 0; nX < nEnd; ++nX ) { if( nPos < GetDirChg( nX ) ) return GetDirType( nX ); @@ -1477,7 +1479,7 @@ BYTE SwScriptInfo::DirType( const xub_StrLen nPos ) const * Takes a string and replaced the hidden ranges with cChar. **************************************************************************/ -USHORT SwScriptInfo::MaskHiddenRanges( const SwTxtNode& rNode, XubString& rText, +sal_uInt16 SwScriptInfo::MaskHiddenRanges( const SwTxtNode& rNode, XubString& rText, const xub_StrLen nStt, const xub_StrLen nEnd, const xub_Unicode cChar ) { @@ -1486,7 +1488,7 @@ USHORT SwScriptInfo::MaskHiddenRanges( const SwTxtNode& rNode, XubString& rText, PositionList aList; xub_StrLen nHiddenStart; xub_StrLen nHiddenEnd; - USHORT nNumOfHiddenChars = 0; + sal_uInt16 nNumOfHiddenChars = 0; GetBoundsOfHiddenRange( rNode, 0, nHiddenStart, nHiddenEnd, &aList ); PositionList::const_reverse_iterator rFirst( aList.end() ); PositionList::const_reverse_iterator rLast( aList.begin() ); @@ -1591,7 +1593,7 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( const SwTxtNode& rNode, xub_StrLen nP Range aRange( 0, rNode.GetTxt().Len() ? rNode.GetTxt().Len() - 1 : 0 ); MultiSelection aHiddenMulti( aRange ); SwScriptInfo::CalcHiddenRanges( rNode, aHiddenMulti ); - for( USHORT i = 0; i < aHiddenMulti.GetRangeCount(); ++i ) + for( sal_uInt16 i = 0; i < aHiddenMulti.GetRangeCount(); ++i ) { const Range& rRange = aHiddenMulti.GetRange( i ); const xub_StrLen nHiddenStart = (xub_StrLen)rRange.Min(); @@ -1609,7 +1611,7 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( const SwTxtNode& rNode, xub_StrLen nP if ( pList ) { - for( USHORT i = 0; i < aHiddenMulti.GetRangeCount(); ++i ) + for( sal_uInt16 i = 0; i < aHiddenMulti.GetRangeCount(); ++i ) { const Range& rRange = aHiddenMulti.GetRange( i ); pList->push_back( (xub_StrLen)rRange.Min() ); @@ -1634,8 +1636,8 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( xub_StrLen nPos, xub_StrLen& rnStartP rnStartPos = STRING_LEN; rnEndPos = 0; - USHORT nEnd = CountHiddenChg(); - for( USHORT nX = 0; nX < nEnd; ++nX ) + sal_uInt16 nEnd = CountHiddenChg(); + for( sal_uInt16 nX = 0; nX < nEnd; ++nX ) { const xub_StrLen nHiddenStart = GetHiddenChg( nX++ ); const xub_StrLen nHiddenEnd = GetHiddenChg( nX ); @@ -1652,7 +1654,7 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( xub_StrLen nPos, xub_StrLen& rnStartP if ( pList ) { - for( USHORT nX = 0; nX < nEnd; ++nX ) + for( sal_uInt16 nX = 0; nX < nEnd; ++nX ) { pList->push_back( GetHiddenChg( nX++ ) ); pList->push_back( GetHiddenChg( nX ) ); @@ -1681,10 +1683,10 @@ bool SwScriptInfo::IsInHiddenRange( const SwTxtNode& rNode, xub_StrLen nPos ) * returns the type of the compressed character *************************************************************************/ -BYTE SwScriptInfo::CompType( const xub_StrLen nPos ) const +sal_uInt8 SwScriptInfo::CompType( const xub_StrLen nPos ) const { - USHORT nEnd = CountCompChg(); - for( USHORT nX = 0; nX < nEnd; ++nX ) + sal_uInt16 nEnd = CountCompChg(); + for( sal_uInt16 nX = 0; nX < nEnd; ++nX ) { xub_StrLen nChg = GetCompStart( nX ); @@ -1704,12 +1706,12 @@ BYTE SwScriptInfo::CompType( const xub_StrLen nPos ) const * betwenn nStart and nEnd *************************************************************************/ -USHORT SwScriptInfo::HasKana( xub_StrLen nStart, const xub_StrLen nLen ) const +sal_uInt16 SwScriptInfo::HasKana( xub_StrLen nStart, const xub_StrLen nLen ) const { - USHORT nCnt = CountCompChg(); + sal_uInt16 nCnt = CountCompChg(); xub_StrLen nEnd = nStart + nLen; - for( USHORT nX = 0; nX < nCnt; ++nX ) + for( sal_uInt16 nX = 0; nX < nCnt; ++nX ) { xub_StrLen nKanaStart = GetCompStart( nX ); xub_StrLen nKanaEnd = nKanaStart + GetCompLen( nX ); @@ -1729,26 +1731,26 @@ USHORT SwScriptInfo::HasKana( xub_StrLen nStart, const xub_StrLen nLen ) const *************************************************************************/ long SwScriptInfo::Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen nLen, - const USHORT nCompress, const USHORT nFontHeight, + const sal_uInt16 nCompress, const sal_uInt16 nFontHeight, Point* pPoint ) const { OSL_ENSURE( nCompress, "Compression without compression?!" ); OSL_ENSURE( nLen, "Compression without text?!" ); - USHORT nCompCount = CountCompChg(); + sal_uInt16 nCompCount = CountCompChg(); // In asian typography, there are full width and half width characters. // Full width punctuation characters can be compressed by 50 % // to determine this, we compare the font width with 75 % of its height - USHORT nMinWidth = ( 3 * nFontHeight ) / 4; + sal_uInt16 nMinWidth = ( 3 * nFontHeight ) / 4; - USHORT nCompIdx = HasKana( nIdx, nLen ); + sal_uInt16 nCompIdx = HasKana( nIdx, nLen ); if ( USHRT_MAX == nCompIdx ) return 0; xub_StrLen nChg = GetCompStart( nCompIdx ); xub_StrLen nCompLen = GetCompLen( nCompIdx ); - USHORT nI = 0; + sal_uInt16 nI = 0; nLen = nLen + nIdx; if( nChg > nIdx ) @@ -1766,7 +1768,7 @@ long SwScriptInfo::Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen long nLast = nI ? pKernArray[ nI - 1 ] : 0; do { - USHORT nType = GetCompType( nCompIdx ); + sal_uInt16 nType = GetCompType( nCompIdx ); #if OSL_DEBUG_LEVEL > 1 OSL_ENSURE( nType == CompType( nIdx ), "Gimme the right type!" ); #endif @@ -1849,7 +1851,7 @@ long SwScriptInfo::Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen // total number of kashida positions, or the number of kashida positions after some positions // have been dropped, depending on the state of the aKashidaInvalid array. -USHORT SwScriptInfo::KashidaJustify( sal_Int32* pKernArray, +sal_uInt16 SwScriptInfo::KashidaJustify( sal_Int32* pKernArray, sal_Int32* pScrArray, xub_StrLen nStt, xub_StrLen nLen, @@ -1862,7 +1864,7 @@ USHORT SwScriptInfo::KashidaJustify( sal_Int32* pKernArray, // evaluate kashida informatin in collected in SwScriptInfo - USHORT nCntKash = 0; + sal_uInt16 nCntKash = 0; while( nCntKash < CountKashida() ) { if ( nStt <= GetKashida( nCntKash ) ) @@ -1873,7 +1875,7 @@ USHORT SwScriptInfo::KashidaJustify( sal_Int32* pKernArray, const xub_StrLen nEnd = nStt + nLen; - USHORT nCntKashEnd = nCntKash; + sal_uInt16 nCntKashEnd = nCntKash; while ( nCntKashEnd < CountKashida() ) { if ( nEnd <= GetKashida( nCntKashEnd ) ) @@ -1882,8 +1884,8 @@ USHORT SwScriptInfo::KashidaJustify( sal_Int32* pKernArray, nCntKashEnd++; } - USHORT nActualKashCount = nCntKashEnd - nCntKash; - for ( USHORT i = nCntKash; i < nCntKashEnd; ++i ) + sal_uInt16 nActualKashCount = nCntKashEnd - nCntKash; + for ( sal_uInt16 i = nCntKash; i < nCntKashEnd; ++i ) { if ( nActualKashCount && !IsKashidaValid ( i ) ) --nActualKashCount; @@ -1905,7 +1907,7 @@ USHORT SwScriptInfo::KashidaJustify( sal_Int32* pKernArray, while ( nIdx < nEnd ) { - USHORT nArrayPos = nIdx - nStt; + sal_uInt16 nArrayPos = nIdx - nStt; // next kashida position ++nCntKash; @@ -1916,7 +1918,7 @@ USHORT SwScriptInfo::KashidaJustify( sal_Int32* pKernArray, if ( nIdx > nEnd ) nIdx = nEnd; - const USHORT nArrayEnd = nIdx - nStt; + const sal_uInt16 nArrayEnd = nIdx - nStt; while ( nArrayPos < nArrayEnd ) { @@ -1981,7 +1983,7 @@ sal_Bool SwScriptInfo::IsArabicText( const XubString& rTxt, xub_StrLen nStt, xub sal_Bool SwScriptInfo::IsKashidaValid ( xub_StrLen nKashPos ) const { - for ( xub_StrLen i = 0; i < aKashidaInvalid.Count(); ++i ) + for ( size_t i = 0; i < aKashidaInvalid.size(); ++i ) { if ( aKashidaInvalid [ i ] == nKashPos ) return false; @@ -1993,13 +1995,13 @@ sal_Bool SwScriptInfo::IsKashidaValid ( xub_StrLen nKashPos ) const * SwScriptInfo::ClearKashidaInvalid() *************************************************************************/ -void SwScriptInfo::ClearKashidaInvalid ( xub_StrLen nKashPos ) +void SwScriptInfo::ClearKashidaInvalid ( xub_StrLen nKashPos ) { - for ( xub_StrLen i = 0; i < aKashidaInvalid.Count(); ++i ) + for ( size_t i = 0; i < aKashidaInvalid.size(); ++i ) { if ( aKashidaInvalid [ i ] == nKashPos ) { - aKashidaInvalid.Remove (i, 1); + aKashidaInvalid.erase ( aKashidaInvalid.begin() + i ); return; } } @@ -2016,7 +2018,7 @@ void SwScriptInfo::ClearKashidaInvalid ( xub_StrLen nKashPos ) bool SwScriptInfo::MarkOrClearKashidaInvalid ( xub_StrLen nStt, xub_StrLen nLen, bool bMark, xub_StrLen nMarkCount ) { - USHORT nCntKash = 0; + sal_uInt16 nCntKash = 0; while( nCntKash < CountKashida() ) { if ( nStt <= GetKashida( nCntKash ) ) @@ -2055,17 +2057,17 @@ bool SwScriptInfo::MarkOrClearKashidaInvalid ( xub_StrLen nStt, xub_StrLen nLen, void SwScriptInfo::MarkKashidaInvalid ( xub_StrLen nKashPos ) { - aKashidaInvalid.Insert( nKashPos, aKashidaInvalid.Count() ); + aKashidaInvalid.push_back( nKashPos ); } /************************************************************************* * SwScriptInfo::GetKashidaPositions() *************************************************************************/ // retrieve the kashida positions in the given text range -USHORT SwScriptInfo::GetKashidaPositions ( xub_StrLen nStt, xub_StrLen nLen, +sal_uInt16 SwScriptInfo::GetKashidaPositions ( xub_StrLen nStt, xub_StrLen nLen, xub_StrLen* pKashidaPosition ) { - USHORT nCntKash = 0; + sal_uInt16 nCntKash = 0; while( nCntKash < CountKashida() ) { if ( nStt <= GetKashida( nCntKash ) ) @@ -2076,7 +2078,7 @@ USHORT SwScriptInfo::GetKashidaPositions ( xub_StrLen nStt, xub_StrLen nLen, const xub_StrLen nEnd = nStt + nLen; - USHORT nCntKashEnd = nCntKash; + sal_uInt16 nCntKashEnd = nCntKash; while ( nCntKashEnd < CountKashida() ) { if ( nEnd <= GetKashida( nCntKashEnd ) ) @@ -2092,8 +2094,8 @@ USHORT SwScriptInfo::GetKashidaPositions ( xub_StrLen nStt, xub_StrLen nLen, void SwScriptInfo::SetNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen ) { - aNoKashidaLine.Insert( nStt, aNoKashidaLine.Count()); - aNoKashidaLineEnd.Insert( nStt+nLen, aNoKashidaLineEnd.Count()); + aNoKashidaLine.push_back( nStt ); + aNoKashidaLineEnd.push_back( nStt+nLen ); } /************************************************************************* @@ -2103,7 +2105,7 @@ void SwScriptInfo::SetNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen ) bool SwScriptInfo::IsKashidaLine ( xub_StrLen nCharIdx ) const { - for( xub_StrLen i = 0; i < aNoKashidaLine.Count(); ++i ) + for( size_t i = 0; i < aNoKashidaLine.size(); ++i ) { if( nCharIdx >= aNoKashidaLine[ i ] && nCharIdx < aNoKashidaLineEnd[ i ]) return false; @@ -2116,13 +2118,13 @@ bool SwScriptInfo::IsKashidaLine ( xub_StrLen nCharIdx ) const void SwScriptInfo::ClearNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen ) { - xub_StrLen i = 0; - while( i < aNoKashidaLine.Count()) + size_t i = 0; + while( i < aNoKashidaLine.size()) { if( nStt + nLen >= aNoKashidaLine[ i ] && nStt < aNoKashidaLineEnd [ i ] ) { - aNoKashidaLine.Remove(i, 1); - aNoKashidaLineEnd.Remove(i, 1); + aNoKashidaLine.erase(aNoKashidaLine.begin() + i); + aNoKashidaLineEnd.erase(aNoKashidaLineEnd.begin() + i); } else ++i; @@ -2137,7 +2139,7 @@ bool SwScriptInfo::MarkKashidasInvalid ( xub_StrLen nCnt, xub_StrLen* pKashidaPo { OSL_ENSURE( pKashidaPositions && nCnt > 0, "Where are kashidas?" ); - USHORT nCntKash = 0; + sal_uInt16 nCntKash = 0; xub_StrLen nKashidaPosIdx = 0; while ( nCntKash < CountKashida() && nKashidaPosIdx < nCnt ) @@ -2163,7 +2165,7 @@ bool SwScriptInfo::MarkKashidasInvalid ( xub_StrLen nCnt, xub_StrLen* pKashidaPo * SwScriptInfo::ThaiJustify() *************************************************************************/ -USHORT SwScriptInfo::ThaiJustify( const XubString& rTxt, sal_Int32* pKernArray, +sal_uInt16 SwScriptInfo::ThaiJustify( const XubString& rTxt, sal_Int32* pKernArray, sal_Int32* pScrArray, xub_StrLen nStt, xub_StrLen nLen, xub_StrLen nNumberOfBlanks, long nSpaceAdd ) @@ -2174,9 +2176,9 @@ USHORT SwScriptInfo::ThaiJustify( const XubString& rTxt, sal_Int32* pKernArray, SPACING_PRECISION_FACTOR; long nSpaceSum = 0; - USHORT nCnt = 0; + sal_uInt16 nCnt = 0; - for ( USHORT nI = 0; nI < nLen; ++nI ) + for ( sal_uInt16 nI = 0; nI < nLen; ++nI ) { const xub_Unicode cCh = rTxt.GetChar( nStt + nI ); @@ -2307,7 +2309,7 @@ void SwLineLayout::Init( SwLinePortion* pNextPortion ) SwTwips SwLineLayout::_GetHangingMargin() const { SwLinePortion* pPor = GetPortion(); - BOOL bFound = sal_False; + sal_Bool bFound = sal_False; SwTwips nDiff = 0; while( pPor) { @@ -2357,7 +2359,7 @@ SwTwips SwTxtFrm::HangingMargin() const void SwScriptInfo::CalcHiddenRanges( const SwTxtNode& rNode, MultiSelection& rHiddenMulti ) { const SfxPoolItem* pItem = 0; - if( SFX_ITEM_SET == rNode.GetSwAttrSet().GetItemState( RES_CHRATR_HIDDEN, TRUE, &pItem ) && + if( SFX_ITEM_SET == rNode.GetSwAttrSet().GetItemState( RES_CHRATR_HIDDEN, sal_True, &pItem ) && ((SvxCharHiddenItem*)pItem)->GetValue() ) { rHiddenMulti.SelectAll(); @@ -2392,7 +2394,7 @@ void SwScriptInfo::CalcHiddenRanges( const SwTxtNode& rNode, MultiSelection& rHi const IDocumentRedlineAccess& rIDRA = *rNode.getIDocumentRedlineAccess(); if ( rHiddenMulti.GetRangeCount() && IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) { - USHORT nAct = rIDRA.GetRedlinePos( rNode, USHRT_MAX ); + sal_uInt16 nAct = rIDRA.GetRedlinePos( rNode, USHRT_MAX ); for ( ; nAct < rIDRA.GetRedlineTbl().Count(); nAct++ ) { diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx index 5a90ac88c6..7aa26e2150 100644 --- a/sw/source/core/text/porlay.hxx +++ b/sw/source/core/text/porlay.hxx @@ -195,15 +195,15 @@ public: void InitSpaceAdd(); // Creates pLLSpaceAdd if necessary void CreateSpaceAdd( const long nInit = 0 ); inline void FinishSpaceAdd() { delete pLLSpaceAdd; pLLSpaceAdd = NULL; } - inline USHORT GetLLSpaceAddCount() const { return sal::static_int_cast< USHORT >(pLLSpaceAdd->size()); } - inline void SetLLSpaceAdd( long nNew, USHORT nIdx ) + inline sal_uInt16 GetLLSpaceAddCount() const { return sal::static_int_cast< sal_uInt16 >(pLLSpaceAdd->size()); } + inline void SetLLSpaceAdd( long nNew, sal_uInt16 nIdx ) { if ( nIdx == GetLLSpaceAddCount() ) pLLSpaceAdd->push_back( nNew ); else (*pLLSpaceAdd)[ nIdx ] = nNew; } - inline long GetLLSpaceAdd( USHORT nIdx ) { return (*pLLSpaceAdd)[ nIdx ]; } + inline long GetLLSpaceAdd( sal_uInt16 nIdx ) { return (*pLLSpaceAdd)[ nIdx ]; } inline void RemoveFirstLLSpaceAdd() { pLLSpaceAdd->erase( pLLSpaceAdd->begin() ); } inline std::vector<long>* GetpLLSpaceAdd() const { return pLLSpaceAdd; } @@ -260,7 +260,7 @@ public: void DebugPortions( SvStream &rOs, const XubString &rTxt, const xub_StrLen nStart ); //$ ostream - void dumpLineAsXml(xmlTextWriter* writer, USHORT& ofs, String& aText); + void dumpLineAsXml(xmlTextWriter* writer, sal_uInt16& ofs, String& aText); #endif OUTPUT_OPERATOR diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx index 1351a028fc..31672c76a9 100644 --- a/sw/source/core/text/porlin.cxx +++ b/sw/source/core/text/porlin.cxx @@ -112,18 +112,18 @@ void SwLinePortion::PrePaint( const SwTxtPaintInfo& rInf, return; const KSHORT nHalfView = nViewWidth / 2; - USHORT nLastWidth = pLast->Width(); + sal_uInt16 nLastWidth = pLast->Width(); if ( pLast->InSpaceGrp() && rInf.GetSpaceAdd() ) - nLastWidth = nLastWidth + (USHORT)pLast->CalcSpacing( rInf.GetSpaceAdd(), rInf ); + nLastWidth = nLastWidth + (sal_uInt16)pLast->CalcSpacing( rInf.GetSpaceAdd(), rInf ); KSHORT nPos; SwTxtPaintInfo aInf( rInf ); - const BOOL bBidiPor = ( rInf.GetTxtFrm()->IsRightToLeft() ) != + const sal_Bool bBidiPor = ( rInf.GetTxtFrm()->IsRightToLeft() ) != ( 0 != ( TEXT_LAYOUT_BIDI_RTL & rInf.GetOut()->GetLayoutMode() ) ); - USHORT nDir = bBidiPor ? + sal_uInt16 nDir = bBidiPor ? 1800 : rInf.GetFont()->GetOrientation( rInf.GetTxtFrm()->IsVertical() ); @@ -325,7 +325,7 @@ sal_Bool SwLinePortion::Format( SwTxtFormatInfo &rInf ) const SwLinePortion *pLast = rInf.GetLast(); Height( pLast->Height() ); SetAscent( pLast->GetAscent() ); - const KSHORT nNewWidth = static_cast<USHORT>(rInf.X() + PrtWidth()); + const KSHORT nNewWidth = static_cast<sal_uInt16>(rInf.X() + PrtWidth()); // Nur Portions mit echter Breite koennen ein sal_True zurueckliefern // Notizen beispielsweise setzen niemals bFull==sal_True if( rInf.Width() <= nNewWidth && PrtWidth() && ! IsKernPortion() ) @@ -354,9 +354,9 @@ void SwLinePortion::FormatEOL( SwTxtFormatInfo & ) void SwLinePortion::Move( SwTxtPaintInfo &rInf ) { - BOOL bB2T = rInf.GetDirection() == DIR_BOTTOM2TOP; - const BOOL bFrmDir = rInf.GetTxtFrm()->IsRightToLeft(); - BOOL bCounterDir = ( ! bFrmDir && DIR_RIGHT2LEFT == rInf.GetDirection() ) || + sal_Bool bB2T = rInf.GetDirection() == DIR_BOTTOM2TOP; + const sal_Bool bFrmDir = rInf.GetTxtFrm()->IsRightToLeft(); + sal_Bool bCounterDir = ( ! bFrmDir && DIR_RIGHT2LEFT == rInf.GetDirection() ) || ( bFrmDir && DIR_LEFT2RIGHT == rInf.GetDirection() ); if ( InSpaceGrp() && rInf.GetSpaceAdd() ) diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx index 0d7461308b..8d9693fdb9 100644 --- a/sw/source/core/text/porlin.hxx +++ b/sw/source/core/text/porlin.hxx @@ -201,7 +201,7 @@ public: virtual void HandlePortion( SwPortionHandler& rPH ) const; #if OSL_DEBUG_LEVEL > 1 - void dumpPortionAsXml(USHORT ofs, String& aText, xmlTextWriter* writer); + void dumpPortionAsXml(sal_uInt16 ofs, String& aText, xmlTextWriter* writer); #endif OUTPUT_OPERATOR }; diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 598cc9df9a..e191389731 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -80,7 +80,7 @@ SwMultiPortion::~SwMultiPortion() void SwMultiPortion::Paint( const SwTxtPaintInfo & ) const { - OSL_ENSURE( FALSE, + OSL_ENSURE( sal_False, "Don't try SwMultiPortion::Paint, try SwTxtPainter::PaintMultiPortion" ); } @@ -213,7 +213,7 @@ SwRotatedPortion::SwRotatedPortion( const SwMultiCreator& rCreate, * SwBidiPortion::SwBidiPortion(..) * --------------------------------------------------*/ -SwBidiPortion::SwBidiPortion( xub_StrLen nEnd, BYTE nLv ) +SwBidiPortion::SwBidiPortion( xub_StrLen nEnd, sal_uInt8 nLv ) : SwMultiPortion( nEnd ), nLevel( nLv ) { SetBidi(); @@ -330,7 +330,7 @@ SwDoubleLinePortion::SwDoubleLinePortion( const SwMultiCreator& rCreate, pBracket->cPre = 0; pBracket->cPost = 0; } - BYTE nTmp = SW_SCRIPTS; + sal_uInt8 nTmp = SW_SCRIPTS; if( pBracket->cPre > 255 ) { String aTxt( pBracket->cPre ); @@ -387,7 +387,7 @@ void SwDoubleLinePortion::PaintBracket( SwTxtPaintInfo &rInf, aBlank.Height( pBracket->nHeight ); { SwFont* pTmpFnt = new SwFont( *rInf.GetFont() ); - BYTE nAct = bOpen ? pBracket->nPreScript : pBracket->nPostScript; + sal_uInt8 nAct = bOpen ? pBracket->nPreScript : pBracket->nPostScript; if( SW_SCRIPTS > nAct ) pTmpFnt->SetActual( nAct ); pTmpFnt->SetProportion( 100 ); @@ -434,7 +434,7 @@ void SwDoubleLinePortion::FormatBrackets( SwTxtFormatInfo &rInf, SwTwips& nMaxWi if( pBracket->cPre ) { String aStr( pBracket->cPre ); - BYTE nActualScr = pTmpFnt->GetActual(); + sal_uInt8 nActualScr = pTmpFnt->GetActual(); if( SW_SCRIPTS > pBracket->nPreScript ) pTmpFnt->SetActual( pBracket->nPreScript ); SwFontSave aSave( rInf, pTmpFnt ); @@ -714,11 +714,11 @@ void SwRubyPortion::_Adjust( SwTxtFormatInfo &rInf ) } KSHORT nLeft = 0; // the space in front of the first letter KSHORT nRight = 0; // the space at the end of the last letter - USHORT nSub = 0; + sal_uInt16 nSub = 0; switch ( nAdjustment ) { - case 1: nRight = static_cast<USHORT>(nLineDiff / 2); // no break - case 2: nLeft = static_cast<USHORT>(nLineDiff - nRight); break; + case 1: nRight = static_cast<sal_uInt16>(nLineDiff / 2); // no break + case 2: nLeft = static_cast<sal_uInt16>(nLineDiff - nRight); break; case 3: nSub = 1; // no break case 4: { @@ -744,8 +744,8 @@ void SwRubyPortion::_Adjust( SwTxtFormatInfo &rInf ) } if( nLineDiff > 1 ) { - nRight = static_cast<USHORT>(nLineDiff / 2); - nLeft = static_cast<USHORT>(nLineDiff - nRight); + nRight = static_cast<sal_uInt16>(nLineDiff / 2); + nLeft = static_cast<sal_uInt16>(nLineDiff - nRight); } break; } @@ -825,7 +825,7 @@ void SwRubyPortion::CalcRubyOffset() * lcl_Has2Lines(..) * is a little help function for GetMultiCreator(..) * It extracts the 2-line-format from a 2-line-attribute or a character style. - * The rValue is set to TRUE, if the 2-line-attribute's value is set and + * The rValue is set to sal_True, if the 2-line-attribute's value is set and * no 2-line-format reference is passed. If there is a 2-line-format reference, * then the rValue is set only, if the 2-line-attribute's value is set _and_ * the 2-line-formats has the same brackets. @@ -854,7 +854,7 @@ sal_Bool lcl_Has2Lines( const SwTxtAttr& rAttr, const SvxTwoLinesItem* &rpRef, * lcl_HasRotation(..) * is a little help function for GetMultiCreator(..) * It extracts the charrotation from a charrotate-attribute or a character style. - * The rValue is set to TRUE, if the charrotate-attribute's value is set and + * The rValue is set to sal_True, if the charrotate-attribute's value is set and * no charrotate-format reference is passed. * If there is a charrotate-format reference, then the rValue is set only, * if the charrotate-attribute's value is set _and_ identical @@ -885,7 +885,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, SwScriptInfo& rSI = ((SwParaPortion*)GetParaPortion())->GetScriptInfo(); // get the last embedding level - BYTE nCurrLevel; + sal_uInt8 nCurrLevel; if ( pMulti ) { OSL_ENSURE( pMulti->IsBidi(), "Nested MultiPortion is not BidiPortion" ); @@ -897,7 +897,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, nCurrLevel = GetTxtFrm()->IsRightToLeft() ? 1 : 0; // check if there is a field at rPos: - BYTE nNextLevel = nCurrLevel; + sal_uInt8 nNextLevel = nCurrLevel; sal_Bool bFldBidi = sal_False; if ( CH_TXTATR_BREAKWORD == GetChar( rPos ) ) @@ -943,7 +943,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, const SvxCharRotateItem* pRotate = NULL; const SfxPoolItem* pRotItem; if( SFX_ITEM_SET == pFrm->GetTxtNode()->GetSwAttrSet(). - GetItemState( RES_CHRATR_ROTATE, TRUE, &pRotItem ) && + GetItemState( RES_CHRATR_ROTATE, sal_True, &pRotItem ) && ((SvxCharRotateItem*)pRotItem)->GetValue() ) pRotate = (SvxCharRotateItem*)pRotItem; else @@ -951,7 +951,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, const SvxTwoLinesItem* p2Lines = NULL; const SfxPoolItem* pItem; if( SFX_ITEM_SET == pFrm->GetTxtNode()->GetSwAttrSet(). - GetItemState( RES_CHRATR_TWO_LINES, TRUE, &pItem ) && + GetItemState( RES_CHRATR_TWO_LINES, sal_True, &pItem ) && ((SvxTwoLinesItem*)pItem)->GetValue() ) p2Lines = (SvxTwoLinesItem*)pItem; else @@ -963,10 +963,10 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, const SwTxtAttr *pRuby = NULL; sal_Bool bTwo = sal_False; sal_Bool bRot = sal_False; - USHORT n2Lines = USHRT_MAX; - USHORT nRotate = USHRT_MAX; - USHORT nCount = pHints ? pHints->Count() : 0; - USHORT i; + sal_uInt16 n2Lines = USHRT_MAX; + sal_uInt16 nRotate = USHRT_MAX; + sal_uInt16 nCount = pHints ? pHints->Count() : 0; + sal_uInt16 i; for( i = 0; i < nCount; ++i ) { const SwTxtAttr *pTmp = (*pHints)[i]; @@ -1023,10 +1023,10 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, { pRet->pItem = NULL; pRet->pAttr = (*pHints)[n2Lines]; - aEnd.Insert( *pRet->pAttr->GetEnd(), 0 ); + aEnd.push_front( *pRet->pAttr->GetEnd() ); if( pItem ) { - aEnd[ 0 ] = GetTxt().Len(); + aEnd.front() = GetTxt().Len(); bOn = ((SvxTwoLinesItem*)pItem)->GetEndBracket() == p2Lines->GetEndBracket() && ((SvxTwoLinesItem*)pItem)->GetStartBracket() == @@ -1037,7 +1037,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, { pRet->pItem = pItem; pRet->pAttr = NULL; - aEnd.Insert( GetTxt().Len(), 0 ); + aEnd.push_front( GetTxt().Len() ); } pRet->nId = SW_MC_DOUBLE; pRet->nLevel = GetTxtFrm()->IsRightToLeft() ? 1 : 0; @@ -1066,28 +1066,28 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, continue; if( rPos < *pTmp->GetStart() ) { - // If bOn is FALSE and the next attribute starts later than rPos + // If bOn is sal_False and the next attribute starts later than rPos // the winner attribute is interrupted at rPos. // If the start of the next atribute is behind the end of // the last attribute on the aEnd-stack, this is the endposition // on the stack is the end of the 2-line portion. - if( !bOn || aEnd[ aEnd.Count()-1 ] < *pTmp->GetStart() ) + if( !bOn || aEnd.back() < *pTmp->GetStart() ) break; - // At this moment, bOn is TRUE and the next attribute starts + // At this moment, bOn is sal_True and the next attribute starts // behind rPos, so we could move rPos to the next startpoint rPos = *pTmp->GetStart(); // We clean up the aEnd-stack, endpositions equal to rPos are // superfluous. - while( aEnd.Count() && aEnd[ aEnd.Count()-1 ] <= rPos ) + while( !aEnd.empty() && aEnd.back() <= rPos ) { bOn = !bOn; - aEnd.Remove( aEnd.Count()-1, 1 ); + aEnd.pop_back(); } // If the endstack is empty, we simulate an attribute with - // state TRUE and endposition rPos - if( !aEnd.Count() ) + // state sal_True and endposition rPos + if( aEnd.empty() ) { - aEnd.Insert( rPos, 0 ); + aEnd.push_front( rPos ); bOn = sal_True; } } @@ -1099,8 +1099,8 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, if( bTwo == bOn ) { // .. with the same state, so the last attribute could // be continued. - if( aEnd[ aEnd.Count()-1 ] < *pTmp->GetEnd() ) - aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd(); + if( aEnd.back() < *pTmp->GetEnd() ) + aEnd.back() = *pTmp->GetEnd(); } else { // .. with a different state. @@ -1108,17 +1108,17 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, // If this is smaller than the last on the stack, we put // it on the stack. If it has the same endposition, the last // could be removed. - if( aEnd[ aEnd.Count()-1 ] > *pTmp->GetEnd() ) - aEnd.Insert( *pTmp->GetEnd(), aEnd.Count() ); - else if( aEnd.Count() > 1 ) - aEnd.Remove( aEnd.Count()-1, 1 ); + if( aEnd.back() > *pTmp->GetEnd() ) + aEnd.push_back( *pTmp->GetEnd() ); + else if( aEnd.size() > 1 ) + aEnd.pop_back(); else - aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd(); + aEnd.back() = *pTmp->GetEnd(); } } } - if( bOn && aEnd.Count() ) - rPos = aEnd[ aEnd.Count()-1 ]; + if( bOn && !aEnd.empty() ) + rPos = aEnd.back(); return pRet; } if( nRotate < nCount || ( pRotItem && pRotItem == pRotate && @@ -1134,7 +1134,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, // The bOn flag signs the state of the last 2-line attribute in the // aEnd-stack, which could interrupts the winning rotation attribute. sal_Bool bOn = pItem ? sal_True : sal_False; - aEnd.Insert( GetTxt().Len(), 0 ); + aEnd.push_front( GetTxt().Len() ); // n2Lines is the index of the last 2-line-attribute, which contains // the actual position. i = 0; @@ -1146,17 +1146,17 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, continue; if( n2Start < *pTmp->GetStart() ) { - if( bOn || aEnd[ aEnd.Count()-1 ] < *pTmp->GetStart() ) + if( bOn || aEnd.back() < *pTmp->GetStart() ) break; n2Start = *pTmp->GetStart(); - while( aEnd.Count() && aEnd[ aEnd.Count()-1 ] <= n2Start ) + while( !aEnd.empty() && aEnd.back() <= n2Start ) { bOn = !bOn; - aEnd.Remove( aEnd.Count()-1, 1 ); + aEnd.pop_back(); } - if( !aEnd.Count() ) + if( aEnd.empty() ) { - aEnd.Insert( n2Start, 0 ); + aEnd.push_front( n2Start ); bOn = sal_False; } } @@ -1171,36 +1171,36 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, { if( bTwo == bOn ) { - if( aEnd[ aEnd.Count()-1 ] < *pTmp->GetEnd() ) - aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd(); + if( aEnd.back() < *pTmp->GetEnd() ) + aEnd.back() = *pTmp->GetEnd(); } else { bOn = bTwo; - if( aEnd[ aEnd.Count()-1 ] > *pTmp->GetEnd() ) - aEnd.Insert( *pTmp->GetEnd(), aEnd.Count() ); - else if( aEnd.Count() > 1 ) - aEnd.Remove( aEnd.Count()-1, 1 ); + if( aEnd.back() > *pTmp->GetEnd() ) + aEnd.push_back( *pTmp->GetEnd() ); + else if( aEnd.size() > 1 ) + aEnd.pop_back(); else - aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd(); + aEnd.back() = *pTmp->GetEnd(); } } } - if( !bOn && aEnd.Count() ) - n2Start = aEnd[ aEnd.Count()-1 ]; + if( !bOn && !aEnd.empty() ) + n2Start = aEnd.back(); - if( aEnd.Count() ) - aEnd.Remove( 0, aEnd.Count() ); + if( !aEnd.empty() ) + aEnd.clear(); bOn = sal_True; if( nRotate < nCount ) { pRet->pItem = NULL; pRet->pAttr = (*pHints)[nRotate]; - aEnd.Insert( *pRet->pAttr->GetEnd(), 0 ); + aEnd.push_front( *pRet->pAttr->GetEnd() ); if( pRotItem ) { - aEnd[ 0 ] = GetTxt().Len(); + aEnd.front() = GetTxt().Len(); bOn = ((SvxCharRotateItem*)pRotItem)->GetValue() == pRotate->GetValue(); } @@ -1209,7 +1209,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, { pRet->pItem = pRotItem; pRet->pAttr = NULL; - aEnd.Insert( GetTxt().Len(), 0 ); + aEnd.push_front( GetTxt().Len() ); } i = 0; while( i < nCount ) @@ -1219,17 +1219,17 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, continue; if( rPos < *pTmp->GetStart() ) { - if( !bOn || aEnd[ aEnd.Count()-1 ] < *pTmp->GetStart() ) + if( !bOn || aEnd.back() < *pTmp->GetStart() ) break; rPos = *pTmp->GetStart(); - while( aEnd.Count() && aEnd[ aEnd.Count()-1 ] <= rPos ) + while( !aEnd.empty() && aEnd.back() <= rPos ) { bOn = !bOn; - aEnd.Remove( aEnd.Count()-1, 1 ); + aEnd.pop_back(); } - if( !aEnd.Count() ) + if( aEnd.empty() ) { - aEnd.Insert( rPos, 0 ); + aEnd.push_front( rPos ); bOn = sal_True; } } @@ -1242,23 +1242,23 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, { if( bTwo == bOn ) { - if( aEnd[ aEnd.Count()-1 ] < *pTmp->GetEnd() ) - aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd(); + if( aEnd.back() < *pTmp->GetEnd() ) + aEnd.back() = *pTmp->GetEnd(); } else { bOn = bTwo; - if( aEnd[ aEnd.Count()-1 ] > *pTmp->GetEnd() ) - aEnd.Insert( *pTmp->GetEnd(), aEnd.Count() ); - else if( aEnd.Count() > 1 ) - aEnd.Remove( aEnd.Count()-1, 1 ); + if( aEnd.back() > *pTmp->GetEnd() ) + aEnd.push_back( *pTmp->GetEnd() ); + else if( aEnd.size() > 1 ) + aEnd.pop_back(); else - aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd(); + aEnd.back() = *pTmp->GetEnd(); } } } - if( bOn && aEnd.Count() ) - rPos = aEnd[ aEnd.Count()-1 ]; + if( bOn && !aEnd.empty() ) + rPos = aEnd.back(); if( rPos > n2Start ) rPos = n2Start; return pRet; @@ -1367,7 +1367,7 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint, { GETGRID( pFrm->FindPageFrm() ) const sal_Bool bHasGrid = pGrid && GetInfo().SnapToGrid(); - USHORT nRubyHeight = 0; + sal_uInt16 nRubyHeight = 0; sal_Bool bRubyTop = sal_False; if ( bHasGrid ) @@ -1379,7 +1379,7 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint, // do not allow grid mode for first line in ruby portion const sal_Bool bRubyInGrid = bHasGrid && rMulti.IsRuby(); - const USHORT nOldHeight = rMulti.Height(); + const sal_uInt16 nOldHeight = rMulti.Height(); const sal_Bool bOldGridModeAllowed = GetInfo().SnapToGrid(); if ( bRubyInGrid ) @@ -1389,9 +1389,9 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint, } SwLayoutModeModifier aLayoutModeModifier( *GetInfo().GetOut() ); - BYTE nEnvDir = 0; - BYTE nThisDir = 0; - BYTE nFrmDir = 0; + sal_uInt8 nEnvDir = 0; + sal_uInt8 nThisDir = 0; + sal_uInt8 nFrmDir = 0; if ( rMulti.IsBidi() ) { // these values are needed for the calculation of the x coordinate @@ -1510,7 +1510,7 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint, { if( rMulti.HasRotation() ) { - const USHORT nAdjustment = ( pLay->Height() - pPor->Height() ) / 2 + + const sal_uInt16 nAdjustment = ( pLay->Height() - pPor->Height() ) / 2 + pPor->GetAscent(); if( rMulti.IsRevers() ) GetInfo().X( nOfst - nAdjustment ); @@ -1743,7 +1743,7 @@ void lcl_TruncateMultiPortion( SwMultiPortion& rMulti, SwTxtFormatInfo& rInf, * SwTxtFrm::_Format with multiple BuildPortions *---------------------------------------------------------------------------*/ -BOOL SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf, +sal_Bool SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf, SwMultiPortion& rMulti ) { SwTwips nMaxWidth = rInf.Width(); @@ -1867,7 +1867,7 @@ BOOL SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf, SwLinePortion *pNextFirst = NULL; SwLinePortion *pNextSecond = NULL; - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; GETGRID( pFrm->FindPageFrm() ) const sal_Bool bHasGrid = pGrid && GRID_LINES_CHARS == pGrid->GetGridType(); @@ -1881,7 +1881,7 @@ BOOL SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf, { pCurr = &rMulti.GetRoot(); nStart = nStartIdx; - bRet = FALSE; + bRet = sal_False; FormatReset( aInf ); aInf.X( nTmpX ); aInf.Width( KSHORT(nActWidth) ); @@ -2009,7 +2009,7 @@ BOOL SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf, } delete pNextFirst; pNextFirst = NULL; - } while ( TRUE ); + } while ( sal_True ); pMulti = pOldMulti; @@ -2354,7 +2354,7 @@ SwLinePortion* SwTxtFormatter::MakeRestPortion( const SwLineLayout* pLine, SwTxtCursorSave::SwTxtCursorSave( SwTxtCursor* pTxtCursor, SwMultiPortion* pMulti, SwTwips nY, - USHORT& nX, + sal_uInt16& nX, xub_StrLen nCurrStart, long nSpaceAdd ) { @@ -2373,7 +2373,7 @@ SwTxtCursorSave::SwTxtCursorSave( SwTxtCursor* pTxtCursor, { bSpaceChg = pMulti->ChgSpaceAdd( pTxtCursor->pCurr, nSpaceAdd ); - USHORT nSpaceCnt; + sal_uInt16 nSpaceCnt; if ( pMulti->IsDouble() ) { pTxtCursor->SetPropFont( 50 ); @@ -2388,7 +2388,7 @@ SwTxtCursorSave::SwTxtCursorSave( SwTxtCursor* pTxtCursor, } if( nSpaceAdd > 0 && !pMulti->HasTabulator() ) - pTxtCursor->pCurr->Width( static_cast<USHORT>(nWidth + nSpaceAdd * nSpaceCnt / SPACING_PRECISION_FACTOR ) ); + pTxtCursor->pCurr->Width( static_cast<sal_uInt16>(nWidth + nSpaceAdd * nSpaceCnt / SPACING_PRECISION_FACTOR ) ); // For a BidiPortion we have to calculate the offset from the // end of the portion diff --git a/sw/source/core/text/pormulti.hxx b/sw/source/core/text/pormulti.hxx index 4de447fc32..d8be480df8 100644 --- a/sw/source/core/text/pormulti.hxx +++ b/sw/source/core/text/pormulti.hxx @@ -57,8 +57,8 @@ struct SwMultiCreator { const SwTxtAttr* pAttr; const SfxPoolItem* pItem; - BYTE nId; - BYTE nLevel; + sal_uInt8 nId; + sal_uInt8 nLevel; }; /*-------------------------------------------------- @@ -75,8 +75,8 @@ struct SwBracket KSHORT nPostWidth; // Width of the closing bracket sal_Unicode cPre; // Initial character, e.g. '(' sal_Unicode cPost; // Final character, e.g. ')' - BYTE nPreScript; // Script of the initial character - BYTE nPostScript; // Script of the final character + sal_uInt8 nPreScript; // Script of the initial character + sal_uInt8 nPostScript; // Script of the final character }; /*-------------------------------------------------- @@ -148,7 +148,7 @@ public: inline sal_Bool HasRotation() const { return 0 != (1 & nDirection); } inline sal_Bool IsRevers() const { return 0 != (2 & nDirection); } inline sal_uInt8 GetDirection() const { return nDirection; } - inline USHORT GetFontRotation() const + inline sal_uInt16 GetFontRotation() const { return ( HasRotation() ? ( IsRevers() ? 2700 : 900 ) : 0 ); } // Accessibility: pass information about this portion to the PortionHandler @@ -195,7 +195,7 @@ public: class SwRubyPortion : public SwMultiPortion { xub_StrLen nRubyOffset; - USHORT nAdjustment; + sal_uInt16 nAdjustment; void _Adjust( SwTxtFormatInfo &rInf); public: SwRubyPortion( const SwRubyPortion& rRuby, xub_StrLen nEnd ); @@ -208,7 +208,7 @@ public: void CalcRubyOffset(); inline void Adjust( SwTxtFormatInfo &rInf ) { if(nAdjustment && GetRoot().GetNext()) _Adjust(rInf); } - inline USHORT GetAdjustment() const { return nAdjustment; } + inline sal_uInt16 GetAdjustment() const { return nAdjustment; } inline xub_StrLen GetRubyOffset() const { return nRubyOffset; } }; @@ -223,12 +223,12 @@ public: class SwBidiPortion : public SwMultiPortion { - BYTE nLevel; + sal_uInt8 nLevel; public: - SwBidiPortion( xub_StrLen nEnd, BYTE nLv ); + SwBidiPortion( xub_StrLen nEnd, sal_uInt8 nLv ); - inline BYTE GetLevel() const { return nLevel; } + inline sal_uInt8 GetLevel() const { return nLevel; } // Get number of blanks for justified alignment xub_StrLen GetSpaceCnt( const SwTxtSizeInfo &rInf ) const; // Calculates extra spacing based on number of blanks @@ -245,11 +245,11 @@ class SwTxtCursorSave SwLineLayout* pCurr; SwTwips nWidth; xub_StrLen nStart; - BYTE nOldProp; + sal_uInt8 nOldProp; sal_Bool bSpaceChg; public: SwTxtCursorSave( SwTxtCursor* pTxtCursor, SwMultiPortion* pMulti, - SwTwips nY, USHORT& nX, xub_StrLen nCurrStart, long nSpaceAdd ); + SwTwips nY, sal_uInt16& nX, xub_StrLen nCurrStart, long nSpaceAdd ); ~SwTxtCursorSave(); }; diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 2f51b693aa..93f2763aee 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -213,7 +213,7 @@ SwArrowPortion::SwArrowPortion( const SwLinePortion &rPortion ) : SwArrowPortion::SwArrowPortion( const SwTxtPaintInfo &rInf ) : bLeft( sal_False ) { - Height( (USHORT)(rInf.GetTxtFrm()->Prt().Height()) ); + Height( (sal_uInt16)(rInf.GetTxtFrm()->Prt().Height()) ); aPos.X() = rInf.GetTxtFrm()->Frm().Left() + rInf.GetTxtFrm()->Prt().Right(); aPos.Y() = rInf.GetTxtFrm()->Frm().Top() + @@ -537,7 +537,7 @@ void SwControlCharPortion::Paint( const SwTxtPaintInfo &rInf ) const { SwFont aTmpFont( *rInf.GetFont() ); aTmpFont.SetEscapement( CHAR_ZWSP == mcChar ? DFLT_ESC_AUTO_SUB : -25 ); - const USHORT nProp = 40; + const sal_uInt16 nProp = 40; aTmpFont.SetProportion( nProp ); // a smaller font SwFontSave aFontSave( rInf, &aTmpFont ); diff --git a/sw/source/core/text/porrst.hxx b/sw/source/core/text/porrst.hxx index 865ba82666..f1978f0443 100644 --- a/sw/source/core/text/porrst.hxx +++ b/sw/source/core/text/porrst.hxx @@ -157,8 +157,8 @@ class SwControlCharPortion : public SwLinePortion { private: - mutable USHORT mnViewWidth; // used to cache a calculated value - mutable USHORT mnHalfCharWidth; // used to cache a calculated value + mutable sal_uInt16 mnViewWidth; // used to cache a calculated value + mutable sal_uInt16 mnHalfCharWidth; // used to cache a calculated value sal_Unicode mcChar; public: diff --git a/sw/source/core/text/portab.hxx b/sw/source/core/text/portab.hxx index 4757aeaa1e..b4b49924dc 100644 --- a/sw/source/core/text/portab.hxx +++ b/sw/source/core/text/portab.hxx @@ -108,7 +108,7 @@ class SwTabDecimalPortion : public SwTabPortion * following the tab stop up to the decimal position. This value is * evaluated during pLastTab->FormatEOL. FME 2006-01-06 #127428#. */ - USHORT mnWidthOfPortionsUpTpDecimalPosition; + sal_uInt16 mnWidthOfPortionsUpTpDecimalPosition; public: inline SwTabDecimalPortion( const KSHORT nTabPosVal, const xub_Unicode cTab, @@ -120,11 +120,11 @@ public: inline xub_Unicode GetTabDecimal() const { return mcTab; } - inline void SetWidthOfPortionsUpToDecimalPosition( USHORT nNew ) + inline void SetWidthOfPortionsUpToDecimalPosition( sal_uInt16 nNew ) { mnWidthOfPortionsUpTpDecimalPosition = nNew; } - inline USHORT GetWidthOfPortionsUpToDecimalPosition() const + inline sal_uInt16 GetWidthOfPortionsUpToDecimalPosition() const { return mnWidthOfPortionsUpTpDecimalPosition; } diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 3fefec0f73..01ce44937f 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -61,7 +61,7 @@ using namespace ::com::sun::star::i18n::ScriptType; * (for justified alignment). *************************************************************************/ -USHORT lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr, +sal_uInt16 lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr, const SwLinePortion& rPor ) { xub_StrLen nPos, nEnd; @@ -81,8 +81,8 @@ USHORT lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr, pSI = &((SwParaPortion*)rInf.GetParaPortion())->GetScriptInfo(); } - USHORT nCnt = 0; - BYTE nScript = 0; + sal_uInt16 nCnt = 0; + sal_uInt8 nScript = 0; // If portion consists of Asian characters and language is not // Korean, we add extra space to each character. @@ -90,7 +90,7 @@ USHORT lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr, if ( pSI ) nScript = pSI->ScriptType( nPos ); else if ( pBreakIt->GetBreakIter().is() ) - nScript = (BYTE)pBreakIt->GetBreakIter()->getScriptType( *pStr, nPos ); + nScript = (sal_uInt8)pBreakIt->GetBreakIter()->getScriptType( *pStr, nPos ); // Note: rInf.GetIdx() can differ from nPos, // e.g., when rPor is a field portion. nPos referes to the string passed @@ -128,7 +128,7 @@ USHORT lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr, { if ( SwScriptInfo::IsArabicText( *pStr, nPos, nEnd - nPos ) && pSI->CountKashida() ) { - const USHORT nKashRes = pSI->KashidaJustify( 0, 0, nPos, nEnd - nPos ); + const sal_uInt16 nKashRes = pSI->KashidaJustify( 0, 0, nPos, nEnd - nPos ); // i60591: need to check result of KashidaJustify // determine if kashida justification is applicable if( nKashRes != STRING_LEN ) @@ -185,7 +185,7 @@ USHORT lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr, nPos = rInf.GetIdx() + rPor.GetLen(); if ( nPos < rInf.GetTxt().Len() ) { - BYTE nNextScript = 0; + sal_uInt8 nNextScript = 0; const SwLinePortion* pPor = rPor.GetPortion(); if ( pPor && pPor->IsKernPortion() ) pPor = pPor->GetPortion(); @@ -203,10 +203,10 @@ USHORT lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr, pPor->GetExpTxt( rInf, aStr ); ((SwTxtSizeInfo &)rInf).SetOnWin( bOldOnWin ); - nNextScript = (BYTE)pBreakIt->GetBreakIter()->getScriptType( aStr, 0 ); + nNextScript = (sal_uInt8)pBreakIt->GetBreakIter()->getScriptType( aStr, 0 ); } else - nNextScript = (BYTE)pBreakIt->GetBreakIter()->getScriptType( rInf.GetTxt(), nPos ); + nNextScript = (sal_uInt8)pBreakIt->GetBreakIter()->getScriptType( rInf.GetTxt(), nPos ); if( ASIAN == nNextScript ) { @@ -516,7 +516,7 @@ void SwTxtPortion::FormatEOL( SwTxtFormatInfo &rInf ) { // calculate number of blanks xub_StrLen nX = rInf.GetIdx() - 1; - USHORT nHoleLen = 1; + sal_uInt16 nHoleLen = 1; while( nX && nHoleLen < GetLen() && CH_BLANK == rInf.GetChar( --nX ) ) nHoleLen++; diff --git a/sw/source/core/text/portxt.hxx b/sw/source/core/text/portxt.hxx index 2715c67356..5fe9a939b5 100644 --- a/sw/source/core/text/portxt.hxx +++ b/sw/source/core/text/portxt.hxx @@ -68,7 +68,7 @@ public: virtual void HandlePortion( SwPortionHandler& rPH ) const; #if OSL_DEBUG_LEVEL > 1 - void dumpPortionAsXml(USHORT ofs, String& aText, xmlTextWriter* writer); + void dumpPortionAsXml(sal_uInt16 ofs, String& aText, xmlTextWriter* writer); #endif OUTPUT_OPERATOR diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 343acded1e..98caf7df4f 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -109,13 +109,13 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S pFnt->SetActual( SwScriptInfo::WhichFont( 0, 0, pScriptInfo ) ); xub_StrLen nChg = 0; - USHORT nCnt = 0; + sal_uInt16 nCnt = 0; do { nChg = pScriptInfo->GetScriptChg( nCnt ); - USHORT nScript = pScriptInfo->GetScriptType( nCnt++ ); - BYTE nTmp = 4; + sal_uInt16 nScript = pScriptInfo->GetScriptType( nCnt++ ); + sal_uInt8 nTmp = 4; switch ( nScript ) { case i18n::ScriptType::ASIAN : if( !aMagicNo[SW_CJK] ) nTmp = SW_CJK; break; diff --git a/sw/source/core/text/redlnitr.hxx b/sw/source/core/text/redlnitr.hxx index a807cbe484..762aeab152 100644 --- a/sw/source/core/text/redlnitr.hxx +++ b/sw/source/core/text/redlnitr.hxx @@ -75,7 +75,7 @@ class SwRedlineItr SwAttrHandler& rAttrHandler; SfxItemSet *pSet; SwExtend *pExt; - ULONG nNdIdx; + sal_uLong nNdIdx; xub_StrLen nFirst; xub_StrLen nAct; xub_StrLen nStart; diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 551282381f..c0112acc9c 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -62,7 +62,7 @@ using namespace ::com::sun::star; *************************************************************************/ sal_Bool lcl_IsDropFlyInter( const SwTxtFormatInfo &rInf, - USHORT nWidth, USHORT nHeight ) + sal_uInt16 nWidth, sal_uInt16 nHeight ) { const SwTxtFly *pTxtFly = rInf.GetTxtFly(); if( pTxtFly && pTxtFly->IsOn() ) @@ -167,7 +167,7 @@ MSHORT SwTxtNode::GetDropLen( MSHORT nWishLen ) const { // find first word const SwAttrSet& rAttrSet = GetSwAttrSet(); - const USHORT nTxtScript = pBreakIt->GetRealScriptOfText( GetTxt(), 0 ); + const sal_uInt16 nTxtScript = pBreakIt->GetRealScriptOfText( GetTxt(), 0 ); LanguageType eLanguage; @@ -269,7 +269,7 @@ bool SwTxtNode::GetDropSize(int& rFontHeight, int& rDropHeight, int& rDropDescen if (rFontHeight==0 && rDropHeight==0 && rDropDescent==0) { - const USHORT nLines = rDrop.GetLines(); + const sal_uInt16 nLines = rDrop.GetLines(); const SvxFontHeightItem& rItem = (SvxFontHeightItem&)rSet.Get( RES_CHRATR_FONTSIZE ); rFontHeight = rItem.GetHeight(); @@ -432,7 +432,7 @@ sal_Bool SwDropPortion::FormatTxt( SwTxtFormatInfo &rInf ) SwPosSize SwDropPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const { - USHORT nMyX = 0; + sal_uInt16 nMyX = 0; xub_StrLen nIdx = 0; const SwDropPortionPart* pCurrPart = GetPart(); @@ -713,7 +713,7 @@ class SwDropCapCache { long aMagicNo[ DROP_CACHE_SIZE ]; XubString aTxt[ DROP_CACHE_SIZE ]; - USHORT aFactor[ DROP_CACHE_SIZE ]; + sal_uInt16 aFactor[ DROP_CACHE_SIZE ]; KSHORT aWishedHeight[ DROP_CACHE_SIZE ]; short aDescent[ DROP_CACHE_SIZE ]; MSHORT nIndex; @@ -805,7 +805,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) aTxt[ nTmpIdx ] = aStr; aWishedHeight[ nTmpIdx ] = KSHORT(nWishedHeight); // save initial scaling factor - aFactor[ nTmpIdx ] = (USHORT)nFactor; + aFactor[ nTmpIdx ] = (sal_uInt16)nFactor; } sal_Bool bGrow = ( pDrop->GetLen() != 0 ); @@ -841,11 +841,11 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) SwFont& rFnt = pCurrPart->GetFont(); // Get height including proportion - const USHORT nCurrHeight = - (USHORT)rFnt.GetHeight( rFnt.GetActual() ); + const sal_uInt16 nCurrHeight = + (sal_uInt16)rFnt.GetHeight( rFnt.GetActual() ); // Get without proportion - const BYTE nOldProp = rFnt.GetPropr(); + const sal_uInt8 nOldProp = rFnt.GetPropr(); rFnt.SetProportion( 100 ); Size aOldSize = Size( 0, rFnt.GetHeight( rFnt.GetActual() ) ); @@ -938,7 +938,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) else { if ( bUseCache ) - aFactor[ nTmpIdx ] = (USHORT)nFactor; + aFactor[ nTmpIdx ] = (sal_uInt16)nFactor; nMin = nFactor; } @@ -982,7 +982,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) SwFont& rFnt = pCurrPart->GetFont(); Size aNewSize( 0, ( nFactor * rFnt.GetHeight( rFnt.GetActual() ) ) / 1000 ); - const BYTE nOldProp = rFnt.GetPropr(); + const sal_uInt8 nOldProp = rFnt.GetPropr(); rFnt.SetProportion( 100 ); rFnt.SetSize( aNewSize, rFnt.GetActual() ); rFnt.SetProportion( nOldProp ); @@ -999,7 +999,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf ) sal_Bool SwDropPortion::Format( SwTxtFormatInfo &rInf ) { sal_Bool bFull = sal_False; - Fix( (USHORT)rInf.X() ); + Fix( (sal_uInt16)rInf.X() ); SwLayoutModeModifier aLayoutModeModifier( *rInf.GetOut() ); aLayoutModeModifier.SetAuto(); @@ -1035,7 +1035,7 @@ sal_Bool SwDropPortion::Format( SwTxtFormatInfo &rInf ) Width(); // set values - pCurrPart->SetWidth( (USHORT)nTmpWidth ); + pCurrPart->SetWidth( (sal_uInt16)nTmpWidth ); // Move rInf.SetIdx( rInf.GetIdx() + pCurrPart->GetLen() ); @@ -1043,7 +1043,7 @@ sal_Bool SwDropPortion::Format( SwTxtFormatInfo &rInf ) pCurrPart = pCurrPart->GetFollow(); } - Width( (USHORT)(rInf.X() - nOldX) ); + Width( (sal_uInt16)(rInf.X() - nOldX) ); } // reset my length @@ -1081,7 +1081,7 @@ sal_Bool SwDropPortion::Format( SwTxtFormatInfo &rInf ) else { const KSHORT nWant = Width() + GetDistance(); - const KSHORT nRest = (USHORT)(rInf.Width() - rInf.X()); + const KSHORT nRest = (sal_uInt16)(rInf.Width() - rInf.X()); if( ( nWant > nRest ) || lcl_IsDropFlyInter( rInf, Width() + GetDistance(), nDropHeight ) ) nDistance = 0; diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index d143b57bf1..d037cad465 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -106,6 +106,8 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, } ViewShell *pSh = rInf.GetVsh(); + SwDoc *const pDoc( (pSh) ? pSh->GetDoc() : 0 ); + bool const bInClipboard( (pDoc) ? pDoc->IsClipBoard() : true ); sal_Bool bPlaceHolder = sal_False; switch( pFld->GetTyp()->Which() ) @@ -117,16 +119,26 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, case RES_COMBINED_CHARS: { - String sStr( pFld->GetCntnt( bName )); if( bName ) - pRet = new SwFldPortion( sStr ); + { + String const sName( pFld->GetFieldName() ); + pRet = new SwFldPortion(sName); + } else - pRet = new SwCombinedPortion( sStr ); + { + String const sContent( pFld->ExpandField(bInClipboard) ); + pRet = new SwCombinedPortion(sContent); + } } break; case RES_HIDDENTXTFLD: - pRet = new SwHiddenPortion(pFld->GetCntnt( bName )); + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwHiddenPortion(str); + } break; case RES_CHAPTERFLD: @@ -135,13 +147,25 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, ((SwChapterField*)pFld)->ChangeExpansion( pFrame, &((SwTxtFld*)pHint)->GetTxtNode() ); } - pRet = new SwFldPortion( pFld->GetCntnt( bName ) ); + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion( str ); + } break; case RES_DOCSTATFLD: if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() ) + { ((SwDocStatField*)pFld)->ChangeExpansion( pFrame ); - pRet = new SwFldPortion( pFld->GetCntnt( bName ) ); + } + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion( str ); + } break; case RES_PAGENUMBERFLD: @@ -153,7 +177,6 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, const SwRootFrm* pTmpRootFrm = pSh->GetLayout(); const sal_Bool bVirt = pTmpRootFrm->IsVirtPageNum(); - SwDoc* pDoc = pSh->GetDoc(); MSHORT nVirtNum = pFrame->GetVirtPageNum(); MSHORT nNumPages = pTmpRootFrm->GetPageNum(); sal_Int16 nNumFmt = -1; @@ -163,7 +186,12 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, pPageNr->ChangeExpansion( pDoc, nVirtNum, nNumPages, bVirt, nNumFmt > -1 ? &nNumFmt : 0); } - pRet = new SwFldPortion( pFld->GetCntnt( bName ) ); + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion( str ); + } break; } case RES_GETEXPFLD: @@ -183,7 +211,12 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, pExpFld->ChgBodyTxtFlag( sal_True ); } } - pRet = new SwFldPortion( pFld->GetCntnt( bName ) ); + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion( str ); + } break; } case RES_DBFLD: @@ -193,13 +226,25 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, SwDBField* pDBFld = (SwDBField*)pFld; pDBFld->ChgBodyTxtFlag( ::lcl_IsInBody( pFrame ) ); } - pRet = new SwFldPortion( pFld->GetCntnt( bName ) ); + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion(str); + } break; } case RES_REFPAGEGETFLD: if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() ) + { ((SwRefPageGetField*)pFld)->ChangeExpansion( pFrame, (SwTxtFld*)pHint ); - pRet = new SwFldPortion( pFld->GetCntnt( bName ) ); + } + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion(str); + } break; case RES_JUMPEDITFLD: @@ -210,9 +255,12 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, break; default: - { - pRet = new SwFldPortion(pFld->GetCntnt( bName ) ); - } + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion(str); + } } if( bNewFlyPor ) @@ -235,7 +283,12 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf, else pTmpFnt->SetDiffFnt( &pChFmt->GetAttrSet(), pFrm->GetTxtNode()->getIDocumentSettingAccess() ); } - pRet = new SwFldPortion( pFld->GetCntnt( bName ), pTmpFnt, bPlaceHolder ); + { + String const str( (bName) + ? pFld->GetFieldName() + : pFld->ExpandField(bInClipboard) ); + pRet = new SwFldPortion(str, pTmpFnt, bPlaceHolder); + } } return pRet; @@ -373,7 +426,7 @@ SwNumberPortion *SwTxtFormatter::NewNumberPortion( SwTxtFormatInfo &rInf ) const // hat ein "gueltige" Nummer ? if( pTxtNd->IsNumbered() && pTxtNd->IsCountedInList()) { - const SwNumFmt &rNumFmt = pNumRule->Get( static_cast<USHORT>(pTxtNd->GetActualListLevel()) ); + const SwNumFmt &rNumFmt = pNumRule->Get( static_cast<sal_uInt16>(pTxtNd->GetActualListLevel()) ); const sal_Bool bLeft = SVX_ADJUST_LEFT == rNumFmt.GetNumAdjust(); const sal_Bool bCenter = SVX_ADJUST_CENTER == rNumFmt.GetNumAdjust(); const bool bLabelAlignmentPosAndSpaceModeActive( @@ -442,7 +495,7 @@ SwNumberPortion *SwTxtFormatter::NewNumberPortion( SwTxtFormatInfo &rInf ) const if ( pFmtFnt ) { - const BYTE nAct = pNumFnt->GetActual(); + const sal_uInt8 nAct = pNumFnt->GetActual(); pNumFnt->SetFamily( pFmtFnt->GetFamily(), nAct ); pNumFnt->SetName( pFmtFnt->GetName(), nAct ); pNumFnt->SetStyleName( pFmtFnt->GetStyleName(), nAct ); @@ -464,12 +517,7 @@ SwNumberPortion *SwTxtFormatter::NewNumberPortion( SwTxtFormatInfo &rInf ) const } else { - // --> OD 2006-06-02 #b6432095# - // use method <SwNumRule::MakeNumString(..)> instead of - // method <SwTxtNode::GetNumString()>, because for levels with - // numbering none the prefix and the suffix strings have to be provided. - XubString aTxt( pNumRule->MakeNumString( *(pTxtNd->GetNum()) ) ); - // <-- + XubString aTxt( pTxtNd->GetNumString() ); if ( aTxt.Len() > 0 ) { aTxt.Insert( pTxtNd->GetLabelFollowedBy() ); diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 36512cb68a..e1aff1a5c6 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -537,7 +537,7 @@ void SwTxtFormatter::CalcFlyWidth( SwTxtFormatInfo &rInf ) if( bForced ) { pCurr->SetForcedLeftMargin( sal_True ); - rInf.ForcedLeftMargin( (USHORT)aInter.Width() ); + rInf.ForcedLeftMargin( (sal_uInt16)aInter.Width() ); } if( bFullLine ) @@ -610,7 +610,7 @@ void SwTxtFormatter::CalcFlyWidth( SwTxtFormatInfo &rInf ) (pPageFrm->*fnRect->fnGetPrtLeft)(); const SwDoc *pDoc = rInf.GetTxtFrm()->GetNode()->GetDoc(); - const USHORT nGridWidth = GETGRIDWIDTH( pGrid, pDoc); //for textgrid refactor + const sal_uInt16 nGridWidth = GETGRIDWIDTH( pGrid, pDoc); //for textgrid refactor SwTwips nStartX = GetLeftMargin(); if ( bVert ) @@ -623,11 +623,11 @@ void SwTxtFormatter::CalcFlyWidth( SwTxtFormatInfo &rInf ) const SwTwips nOfst = nStartX - nGridOrigin; const SwTwips nTmpWidth = rInf.Width() + nOfst; - const ULONG i = nTmpWidth / nGridWidth + 1; + const sal_uLong i = nTmpWidth / nGridWidth + 1; const long nNewWidth = ( i - 1 ) * nGridWidth - nOfst; if ( nNewWidth > 0 ) - rInf.Width( (USHORT)nNewWidth ); + rInf.Width( (sal_uInt16)nNewWidth ); else rInf.Width( 0 ); } @@ -678,7 +678,7 @@ SwFlyCntPortion *SwTxtFormatter::NewFlyCntPortion( SwTxtFormatInfo &rInf, pFly->GetRefPoint().Y() ); if ( bUseFlyAscent ) - nAscent = static_cast<USHORT>( Abs( int( bTxtFrmVertical ? + nAscent = static_cast<sal_uInt16>( Abs( int( bTxtFrmVertical ? pFly->GetRelPos().X() : pFly->GetRelPos().Y() ) ) ); @@ -944,7 +944,7 @@ sal_Bool SwTxtFly::DrawTextOpaque( SwDrawTextInfo &rInf ) sal_Bool bOpaque = sal_False; // --> OD 2006-08-15 #i68520# - const UINT32 nCurrOrd = mpCurrAnchoredObj + const sal_uInt32 nCurrOrd = mpCurrAnchoredObj ? mpCurrAnchoredObj->GetDrawObj()->GetOrdNum() : SAL_MAX_UINT32; // <-- @@ -1139,8 +1139,8 @@ sal_Bool SwTxtFly::GetTop( const SwAnchoredObject* _pAnchoredObj, // #102344# Ignore connectors which have one or more connections if(pNew && pNew->ISA(SdrEdgeObj)) { - if(((SdrEdgeObj*)pNew)->GetConnectedNode(TRUE) - || ((SdrEdgeObj*)pNew)->GetConnectedNode(FALSE)) + if(((SdrEdgeObj*)pNew)->GetConnectedNode(sal_True) + || ((SdrEdgeObj*)pNew)->GetConnectedNode(sal_False)) { return sal_False; } @@ -1160,7 +1160,7 @@ sal_Bool SwTxtFly::GetTop( const SwAnchoredObject* _pAnchoredObj, if ( bInFooterOrHeader ) { SwFmtVertOrient aVert( rFrmFmt.GetVertOrient() ); - BOOL bVertPrt = aVert.GetRelationOrient() == text::RelOrientation::PRINT_AREA || + sal_Bool bVertPrt = aVert.GetRelationOrient() == text::RelOrientation::PRINT_AREA || aVert.GetRelationOrient() == text::RelOrientation::PAGE_PRINT_AREA; if( bVertPrt ) return sal_False; @@ -1330,7 +1330,7 @@ sal_Bool SwTxtFly::GetTop( const SwAnchoredObject* _pAnchoredObj, // Compare indices: // Den Index des anderen erhalten wir immer ueber das Ankerattr. - ULONG nTmpIndex = rNewA.GetCntntAnchor()->nNode.GetIndex(); + sal_uLong nTmpIndex = rNewA.GetCntntAnchor()->nNode.GetIndex(); // Jetzt wird noch ueberprueft, ob der aktuelle Absatz vor dem // Anker des verdraengenden Objekts im Text steht, dann wird // nicht ausgewichen. @@ -1789,7 +1789,7 @@ const SwRect SwContourCache::ContourRect( const SwFmt* pFmt, pSdrObj[ 0 ] = pObj; // Wg. #37347 darf das Object erst nach dem // GetContour() eingetragen werden. pTextRanger[ 0 ] = new TextRanger( aPolyPolygon, pPolyPolygon, 20, - (USHORT)rLRSpace.GetLeft(), (USHORT)rLRSpace.GetRight(), + (sal_uInt16)rLRSpace.GetLeft(), (sal_uInt16)rLRSpace.GetRight(), pFmt->GetSurround().IsOutside(), sal_False, pFrm->IsVertical() ); pTextRanger[ 0 ]->SetUpper( rULSpace.GetUpper() ); pTextRanger[ 0 ]->SetLower( rULSpace.GetLower() ); @@ -1923,7 +1923,7 @@ void SwContourCache::ShowContour( OutputDevice* pOut, const SdrObject* pObj, void SwTxtFly::ShowContour( OutputDevice* pOut ) { MSHORT nFlyCount; - if( bOn && ( 0 != ( nFlyCount = static_cast<USHORT>(GetAnchoredObjList()->size() ) ) ) ) + if( bOn && ( 0 != ( nFlyCount = static_cast<sal_uInt16>(GetAnchoredObjList()->size() ) ) ) ) { Color aRedColor( COL_LIGHTRED ); Color aGreenColor( COL_LIGHTGREEN ); diff --git a/sw/source/core/text/txtfly.hxx b/sw/source/core/text/txtfly.hxx index 2fdaef7d8e..e4e7fc46fa 100644 --- a/sw/source/core/text/txtfly.hxx +++ b/sw/source/core/text/txtfly.hxx @@ -108,7 +108,7 @@ class SwTxtFly SwAnchoredObjList* mpAnchoredObjList; long nMinBottom; long nNextTop; // Hier wird die Oberkante des "naechsten" Rahmens gespeichert - ULONG nIndex; + sal_uLong nIndex; sal_Bool bOn : 1; sal_Bool bLeftSide : 1; sal_Bool bTopRule: 1; diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index cee0fac126..774503937e 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -102,13 +102,22 @@ void SwTxtFrm::SwapWidthAndHeight() { const long nPrtOfstX = Prt().Pos().X(); Prt().Pos().X() = Prt().Pos().Y(); - Prt().Pos().Y() = Frm().Width() - ( nPrtOfstX + Prt().Width() ); + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if( IsVertLR() ) + Prt().Pos().Y() = nPrtOfstX; + else + Prt().Pos().Y() = Frm().Width() - ( nPrtOfstX + Prt().Width() ); + } else { const long nPrtOfstY = Prt().Pos().Y(); Prt().Pos().Y() = Prt().Pos().X(); - Prt().Pos().X() = Frm().Height() - ( nPrtOfstY + Prt().Height() ); + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if( IsVertLR() ) + Prt().Pos().X() = nPrtOfstY; + else + Prt().Pos().X() = Frm().Height() - ( nPrtOfstY + Prt().Height() ); } const long nFrmWidth = Frm().Width(); @@ -126,16 +135,33 @@ void SwTxtFrm::SwapWidthAndHeight() void SwTxtFrm::SwitchHorizontalToVertical( SwRect& rRect ) const { // calc offset inside frame - const long nOfstX = rRect.Left() - Frm().Left(); - const long nOfstY = rRect.Top() + rRect.Height() - Frm().Top(); + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + long nOfstX, nOfstY; + if ( IsVertLR() ) + { + nOfstX = rRect.Left() - Frm().Left(); + nOfstY = rRect.Top() - Frm().Top(); + } + else + { + nOfstX = rRect.Left() - Frm().Left(); + nOfstY = rRect.Top() + rRect.Height() - Frm().Top(); + } + const long nWidth = rRect.Width(); const long nHeight = rRect.Height(); - if ( bIsSwapped ) - rRect.Left( Frm().Left() + Frm().Height() - nOfstY ); + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if ( IsVertLR() ) + rRect.Left(Frm().Left() + nOfstY); else - // frame is rotated - rRect.Left( Frm().Left() + Frm().Width() - nOfstY ); + { + if ( bIsSwapped ) + rRect.Left( Frm().Left() + Frm().Height() - nOfstY ); + else + // frame is rotated + rRect.Left( Frm().Left() + Frm().Width() - nOfstY ); + } rRect.Top( Frm().Top() + nOfstX ); rRect.Width( nHeight ); @@ -149,12 +175,17 @@ void SwTxtFrm::SwitchHorizontalToVertical( Point& rPoint ) const // calc offset inside frame const long nOfstX = rPoint.X() - Frm().Left(); const long nOfstY = rPoint.Y() - Frm().Top(); - - if ( bIsSwapped ) - rPoint.X() = Frm().Left() + Frm().Height() - nOfstY; + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if ( IsVertLR() ) + rPoint.X() = Frm().Left() + nOfstY; else - // calc rotated coords - rPoint.X() = Frm().Left() + Frm().Width() - nOfstY; + { + if ( bIsSwapped ) + rPoint.X() = Frm().Left() + Frm().Height() - nOfstY; + else + // calc rotated coords + rPoint.X() = Frm().Left() + Frm().Width() - nOfstY; + } rPoint.Y() = Frm().Top() + nOfstX; } @@ -175,10 +206,17 @@ void SwTxtFrm::SwitchVerticalToHorizontal( SwRect& rRect ) const long nOfstX; // calc offset inside frame - if ( bIsSwapped ) - nOfstX = Frm().Left() + Frm().Height() - ( rRect.Left() + rRect.Width() ); + + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if ( IsVertLR() ) + nOfstX = rRect.Left() - Frm().Left(); else - nOfstX = Frm().Left() + Frm().Width() - ( rRect.Left() + rRect.Width() ); + { + if ( bIsSwapped ) + nOfstX = Frm().Left() + Frm().Height() - ( rRect.Left() + rRect.Width() ); + else + nOfstX = Frm().Left() + Frm().Width() - ( rRect.Left() + rRect.Width() ); + } const long nOfstY = rRect.Top() - Frm().Top(); const long nWidth = rRect.Height(); @@ -198,10 +236,17 @@ void SwTxtFrm::SwitchVerticalToHorizontal( Point& rPoint ) const long nOfstX; // calc offset inside frame - if ( bIsSwapped ) - nOfstX = Frm().Left() + Frm().Height() - rPoint.X(); + + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + if ( IsVertLR() ) + nOfstX = rPoint.X() - Frm().Left(); else - nOfstX = Frm().Left() + Frm().Width() - rPoint.X(); + { + if ( bIsSwapped ) + nOfstX = Frm().Left() + Frm().Height() - rPoint.X(); + else + nOfstX = Frm().Left() + Frm().Width() - rPoint.X(); + } const long nOfstY = rPoint.Y() - Frm().Top(); @@ -278,7 +323,7 @@ void SwLayoutModeModifier::Modify( sal_Bool bChgToRTL ) void SwLayoutModeModifier::SetAuto() { - const ULONG nNewLayoutMode = nOldLayoutMode & ~TEXT_LAYOUT_BIDI_STRONG; + const sal_uLong nNewLayoutMode = nOldLayoutMode & ~TEXT_LAYOUT_BIDI_STRONG; ((OutputDevice&)rOut).SetLayoutMode( nNewLayoutMode ); } @@ -441,9 +486,9 @@ void SwTxtFrm::HideFootnotes( xub_StrLen nStart, xub_StrLen nEnd ) const SwpHints *pHints = GetTxtNode()->GetpSwpHints(); if( pHints ) { - const USHORT nSize = pHints->Count(); + const sal_uInt16 nSize = pHints->Count(); SwPageFrm *pPage = 0; - for ( USHORT i = 0; i < nSize; ++i ) + for ( sal_uInt16 i = 0; i < nSize; ++i ) { const SwTxtAttr *pHt = (*pHints)[i]; if ( pHt->Which() == RES_TXTATR_FTN ) @@ -839,13 +884,13 @@ void lcl_SetWrong( SwTxtFrm& rFrm, xub_StrLen nPos, long nCnt, bool bMove ) if ( !pTxtNode->GetWrong() && !pTxtNode->IsWrongDirty() ) { pTxtNode->SetWrong( new SwWrongList( WRONGLIST_SPELL ) ); - pTxtNode->GetWrong()->SetInvalid( nPos, nPos + (USHORT)( nCnt > 0 ? nCnt : 1 ) ); + pTxtNode->GetWrong()->SetInvalid( nPos, nPos + (sal_uInt16)( nCnt > 0 ? nCnt : 1 ) ); } if ( !pTxtNode->GetSmartTags() && !pTxtNode->IsSmartTagDirty() ) { // SMARTTAGS pTxtNode->SetSmartTags( new SwWrongList( WRONGLIST_SMARTTAG ) ); - pTxtNode->GetSmartTags()->SetInvalid( nPos, nPos + (USHORT)( nCnt > 0 ? nCnt : 1 ) ); + pTxtNode->GetSmartTags()->SetInvalid( nPos, nPos + (sal_uInt16)( nCnt > 0 ? nCnt : 1 ) ); } pTxtNode->SetWrongDirty( true ); pTxtNode->SetGrammarCheckDirty( true ); @@ -858,7 +903,7 @@ void lcl_SetWrong( SwTxtFrm& rFrm, xub_StrLen nPos, long nCnt, bool bMove ) SwRootFrm *pRootFrm = rFrm.FindRootFrm(); if (pRootFrm) { - pRootFrm->SetNeedGrammarCheck( TRUE ); + pRootFrm->SetNeedGrammarCheck( sal_True ); } SwPageFrm *pPage = rFrm.FindPageFrm(); @@ -1482,7 +1527,7 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid, switch ( ePrep ) { case PREP_BOSS_CHGD: - SetInvalidVert( TRUE ); // Test + SetInvalidVert( sal_True ); // Test case PREP_WIDOWS_ORPHANS: case PREP_WIDOWS: case PREP_FTN_GONE : return; @@ -1528,7 +1573,7 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid, if( !HasPara() && PREP_MUST_FIT != ePrep ) { - SetInvalidVert( TRUE ); // Test + SetInvalidVert( sal_True ); // Test OSL_ENSURE( !IsLocked(), "SwTxtFrm::Prepare: three of a perfect pair" ); if ( bNotify ) InvalidateSize(); @@ -1608,9 +1653,9 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid, { // Test { - SetInvalidVert( FALSE ); - BOOL bOld = IsVertical(); - SetInvalidVert( TRUE ); + SetInvalidVert( sal_False ); + sal_Bool bOld = IsVertical(); + SetInvalidVert( sal_True ); if( bOld != IsVertical() ) InvalidateRange( SwCharRange( GetOfst(), STRING_LEN ) ); } @@ -1635,10 +1680,10 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid, SwpHints *pHints = GetTxtNode()->GetpSwpHints(); if( pHints ) { - const USHORT nSize = pHints->Count(); + const sal_uInt16 nSize = pHints->Count(); const xub_StrLen nEnd = GetFollow() ? GetFollow()->GetOfst() : STRING_LEN; - for ( USHORT i = 0; i < nSize; ++i ) + for ( sal_uInt16 i = 0; i < nSize; ++i ) { const SwTxtAttr *pHt = (*pHints)[i]; const xub_StrLen nStart = *pHt->GetStart(); @@ -2190,7 +2235,7 @@ void SwTxtFrm::CalcAdditionalFirstLineOffset() pTxtNode->GetNumRule() ) { const SwNumFmt& rNumFmt = - pTxtNode->GetNumRule()->Get( static_cast<USHORT>(pTxtNode->GetActualListLevel()) ); + pTxtNode->GetNumRule()->Get( static_cast<sal_uInt16>(pTxtNode->GetActualListLevel()) ); if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) { // keep current paragraph portion and apply dummy paragraph portion @@ -2490,7 +2535,7 @@ void SwTxtFrm::ChgThisLines() { //not necassary to format here (GerFormatted etc.), because we have to come from there! - ULONG nNew = 0; + sal_uLong nNew = 0; const SwLineNumberInfo &rInf = GetNode()->getIDocumentLineNumberAccess()->GetLineNumberInfo(); if ( GetTxt().Len() && HasPara() ) { @@ -2499,7 +2544,7 @@ void SwTxtFrm::ChgThisLines() if ( rInf.IsCountBlankLines() ) { aLine.Bottom(); - nNew = (ULONG)aLine.GetLineNr(); + nNew = (sal_uLong)aLine.GetLineNr(); } else { @@ -2540,6 +2585,12 @@ void SwTxtFrm::ChgThisLines() else //Paragraphs which are not counted should not manipulate the AllLines. nThisLines = nNew; } + + //mba: invalidating is not necessary; if mongolian script has a problem, it should be fixed at the ritgh place + //with invalidating we probably get too much flickering + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + //Ugly. How can we hack if better? + //InvalidatePage(); } @@ -2551,9 +2602,9 @@ void SwTxtFrm::RecalcAllLines() if ( !IsInTab() ) { - const ULONG nOld = GetAllLines(); + const sal_uLong nOld = GetAllLines(); const SwFmtLineNumber &rLineNum = pAttrSet->GetLineNumber(); - ULONG nNewNum; + sal_uLong nNewNum; const bool bRestart = GetTxtNode()->getIDocumentLineNumberAccess()->GetLineNumberInfo().IsRestartEachPage(); if ( !IsFollow() && rLineNum.GetStartValue() && rLineNum.IsCount() ) diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 856325ef5c..0872b4b2ac 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -113,7 +113,7 @@ void SwTxtFrm::CalcFtnFlag() if( !pHints ) return; - const USHORT nSize = pHints->Count(); + const sal_uInt16 nSize = pHints->Count(); #if OSL_DEBUG_LEVEL > 1 const xub_StrLen nEnd = nStop != STRING_LEN ? nStop @@ -122,7 +122,7 @@ void SwTxtFrm::CalcFtnFlag() const xub_StrLen nEnd = GetFollow() ? GetFollow()->GetOfst() : STRING_LEN; #endif - for ( USHORT i = 0; i < nSize; ++i ) + for ( sal_uInt16 i = 0; i < nSize; ++i ) { const SwTxtAttr *pHt = (*pHints)[i]; if ( pHt->Which() == RES_TXTATR_FTN ) @@ -223,7 +223,7 @@ SwTwips lcl_GetFtnLower( const SwTxtFrm* pFrm, SwTwips nLower ) OSL_ENSURE( pTabFrm && pRow && pRow->GetUpper()->IsTabFrm(), "Upper of row should be tab" ); - const BOOL bDontSplit = !pTabFrm->IsFollow() && + const sal_Bool bDontSplit = !pTabFrm->IsFollow() && !pTabFrm->IsLayoutSplitAllowed(); SwTwips nMin = 0; @@ -259,7 +259,7 @@ SwTwips lcl_GetFtnLower( const SwTxtFrm* pFrm, SwTwips nLower ) if ( pStartFrm->GetDrawObjs() ) { const SwSortedObjs &rObjs = *pStartFrm->GetDrawObjs(); - for ( USHORT i = 0; i < rObjs.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i ) { SwAnchoredObject* pAnchoredObj = rObjs[i]; SwRect aRect( pAnchoredObj->GetObjRect() ); @@ -447,7 +447,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen ) return; sal_Bool bRollBack = nLen != STRING_LEN; - USHORT nSize = pHints->Count(); + sal_uInt16 nSize = pHints->Count(); xub_StrLen nEnd; SwTxtFrm* pSource; if( bRollBack ) @@ -471,7 +471,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen ) SwFtnBossFrm *pEndBoss = 0; sal_Bool bFtnEndDoc = FTNPOS_CHAPTER == GetNode()->GetDoc()->GetFtnInfo().ePos; - for ( USHORT i = nSize; i; ) + for ( sal_uInt16 i = nSize; i; ) { SwTxtAttr *pHt = pHints->GetTextHint(--i); if ( RES_TXTATR_FTN != pHt->Which() ) @@ -1157,7 +1157,7 @@ xub_StrLen SwTxtFormatter::FormatQuoVadis( const xub_StrLen nOffset ) pQuo->SetAscent( rInf.GetAscent() ); pQuo->Height( rInf.GetTxtHeight() ); pQuo->Format( rInf ); - USHORT nQuoWidth = pQuo->Width(); + sal_uInt16 nQuoWidth = pQuo->Width(); SwLinePortion* pCurrPor = pQuo; while ( rInf.GetRest() ) @@ -1236,12 +1236,12 @@ xub_StrLen SwTxtFormatter::FormatQuoVadis( const xub_StrLen nOffset ) if( nDiff < 0 ) { nLastLeft = pQuo->GetAscent(); - nQuoWidth = (USHORT)(-nDiff + nLastLeft); + nQuoWidth = (sal_uInt16)(-nDiff + nLastLeft); } else { nQuoWidth = 0; - nLastLeft = USHORT(( pQuo->GetAscent() + nDiff ) / 2); + nLastLeft = sal_uInt16(( pQuo->GetAscent() + nDiff ) / 2); } break; } @@ -1328,7 +1328,7 @@ public: SwFtnSave( const SwTxtSizeInfo &rInf, const SwTxtFtn *pTxtFtn, const bool bApplyGivenScriptType, - const BYTE nGivenScriptType ); + const sal_uInt8 nGivenScriptType ); ~SwFtnSave(); }; @@ -1339,7 +1339,7 @@ public: SwFtnSave::SwFtnSave( const SwTxtSizeInfo &rInf, const SwTxtFtn* pTxtFtn, const bool bApplyGivenScriptType, - const BYTE nGivenScriptType ) + const sal_uInt8 nGivenScriptType ) : pInf( &((SwTxtSizeInfo&)rInf) ) , pFnt( 0 ) , pOld( 0 ) @@ -1497,7 +1497,7 @@ SwPosSize SwFtnPortion::GetTxtSize( const SwTxtSizeInfo &rInfo ) const } // --> OD 2009-01-29 #i98418# -void SwFtnPortion::SetPreferredScriptType( BYTE nPreferredScriptType ) +void SwFtnPortion::SetPreferredScriptType( sal_uInt8 nPreferredScriptType ) { mbPreferredScriptTypeSet = true; mnPreferredScriptType = nPreferredScriptType; @@ -1537,7 +1537,7 @@ sal_Bool SwQuoVadisPortion::Format( SwTxtFormatInfo &rInf ) SetLen( 0 ); if( bFull ) // dritter Versuch, es langt: jetzt wird gestaucht: - Width( USHORT(rInf.Width() - rInf.X()) ); + Width( sal_uInt16(rInf.Width() - rInf.X()) ); // 8317: keine mehrzeiligen Felder bei QuoVadis und ErgoSum if( rInf.GetRest() ) diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx index fb4bce8277..958306710a 100644 --- a/sw/source/core/text/txthyph.cxx +++ b/sw/source/core/text/txthyph.cxx @@ -632,7 +632,7 @@ sal_Bool SwSoftHyphPortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTx void SwSoftHyphPortion::HandlePortion( SwPortionHandler& rPH ) const { const String aString( '-' ); - const USHORT nWhich = ! Width() ? + const sal_uInt16 nWhich = ! Width() ? POR_SOFTHYPH_COMP : GetWhichPor(); rPH.Special( GetLen(), aString, nWhich ); diff --git a/sw/source/core/text/txtio.cxx b/sw/source/core/text/txtio.cxx index 0681091568..7932fd2d94 100644 --- a/sw/source/core/text/txtio.cxx +++ b/sw/source/core/text/txtio.cxx @@ -29,10 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - -#if !defined(OSL_DEBUG_LEVEL) || OSL_DEBUG_LEVEL == 0 -#error Who broke the makefiles? -#endif +#if OSL_DEBUG_LEVEL > 1 #include "viewsh.hxx" // IsDbg() #include "viewopt.hxx" // IsDbg() @@ -723,7 +720,8 @@ SvStream &SwDropPortion::operator<<( SvStream &rOs ) const //$ ostream return rOs; } -#endif /* OSL_DEBUG_LEVEL */ +#endif +#endif /* OSL_DEBUG_LEVEL */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index a466745bf0..e6b4738a42 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -74,7 +74,7 @@ const SvxTabStop *SwLineInfo::GetTabStop( const SwTwips nSearchPos, * SwLineInfo::NumberOfTabStops() *************************************************************************/ -USHORT SwLineInfo::NumberOfTabStops() const +sal_uInt16 SwLineInfo::NumberOfTabStops() const { return pRuler->Count(); } @@ -138,7 +138,12 @@ SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto ) nLinePos - nTabPos : nLinePos + nTabPos; - SwTwips nMyRight = Right(); + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + SwTwips nMyRight; + if ( pFrm->IsVertLR() ) + nMyRight = Left(); + else + nMyRight = Right(); if ( pFrm->IsVertical() ) { @@ -373,14 +378,14 @@ sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf ) OSL_ENSURE( rInf.X() <= GetTabPos(), "SwTabPortion::PreFormat: rush hour" ); // Hier lassen wir uns nieder... - Fix( static_cast<USHORT>(rInf.X()) ); + Fix( static_cast<sal_uInt16>(rInf.X()) ); const bool bTabCompat = rInf.GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_COMPAT); // Die Mindestbreite eines Tabs ist immer mindestens ein Blank // --> FME 2004-11-25 #i37686# In compatibility mode, the minimum width // should be 1, even for non-left tab stops. - USHORT nMinimumTabWidth = 1; + sal_uInt16 nMinimumTabWidth = 1; // <-- if ( !bTabCompat ) { @@ -410,7 +415,7 @@ sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf ) rInf.Width() <= rInf.X() + PrtWidth(); // #95477# Rotated tab stops get the width of one blank - const USHORT nDir = rInf.GetFont()->GetOrientation( rInf.GetTxtFrm()->IsVertical() ); + const sal_uInt16 nDir = rInf.GetFont()->GetOrientation( rInf.GetTxtFrm()->IsVertical() ); if( ! bFull && 0 == nDir ) { @@ -429,7 +434,7 @@ sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf ) } case POR_TABLEFT: { - PrtWidth( static_cast<USHORT>(GetTabPos() - rInf.X()) ); + PrtWidth( static_cast<sal_uInt16>(GetTabPos() - rInf.X()) ); bFull = rInf.Width() <= rInf.X() + PrtWidth(); // In tabulator compatibility mode, we reset the bFull flag @@ -456,7 +461,7 @@ sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf ) !rInf.GetFly() ) // <-- { - PrtWidth( static_cast<USHORT>(rInf.Width() - rInf.X()) ); + PrtWidth( static_cast<sal_uInt16>(rInf.Width() - rInf.X()) ); SetFixWidth( PrtWidth() ); } else diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx index 1051f45584..3ec65d18b8 100644 --- a/sw/source/core/text/widorp.cxx +++ b/sw/source/core/text/widorp.cxx @@ -222,9 +222,17 @@ void SwTxtFrmBreak::SetRstHeight( const SwTxtMargin &rLine ) { // OD, FME 2004-02-27 #106629# - consider bottom margin SWRECTFN( pFrm ) + nRstHeight = (pFrm->*fnRect->fnGetBottomMargin)(); + if ( bVert ) - nRstHeight += nOrigin - pFrm->SwitchHorizontalToVertical( rLine.Y() ); + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + { + if ( pFrm->IsVertLR() ) + nRstHeight = (*fnRect->fnYDiff)( pFrm->SwitchHorizontalToVertical( rLine.Y() ) , nOrigin ); + else + nRstHeight += nOrigin - pFrm->SwitchHorizontalToVertical( rLine.Y() ); + } else nRstHeight += rLine.Y() - nOrigin; } @@ -486,7 +494,7 @@ sal_Bool WidowsAndOrphans::FindWidows( SwTxtFrm *pFrame, SwTxtMargin &rLine ) // --> FME 2008-09-16 #i91421# if ( !pMaster->GetIndPrev() ) { - ULONG nLines = pMaster->GetThisLines(); + sal_uLong nLines = pMaster->GetThisLines(); if(nLines == 0 && pMaster->HasPara()) { const SwParaPortion *pMasterPara = pMaster->GetPara(); diff --git a/sw/source/core/text/wrong.cxx b/sw/source/core/text/wrong.cxx index ae23251e01..dd509323f0 100644 --- a/sw/source/core/text/wrong.cxx +++ b/sw/source/core/text/wrong.cxx @@ -471,7 +471,7 @@ void SwWrongList::JoinList( SwWrongList* pNext, xub_StrLen nInsertPos ) } if( pNext ) { - USHORT nCnt = Count(); + sal_uInt16 nCnt = Count(); pNext->Move( 0, nInsertPos ); Insert(nCnt, pNext->maList.begin(), pNext->maList.end()); @@ -499,7 +499,7 @@ void SwWrongList::JoinList( SwWrongList* pNext, xub_StrLen nInsertPos ) } -void SwWrongList::InsertSubList( xub_StrLen nNewPos, xub_StrLen nNewLen, USHORT nWhere, SwWrongList* pSubList ) +void SwWrongList::InsertSubList( xub_StrLen nNewPos, xub_StrLen nNewLen, sal_uInt16 nWhere, SwWrongList* pSubList ) { if (pSubList) { @@ -515,7 +515,7 @@ void SwWrongList::InsertSubList( xub_StrLen nNewPos, xub_StrLen nNewLen, USHORT // New functions: Necessary because SwWrongList has been changed to use std::vector -void SwWrongList::Insert(USHORT nWhere, std::vector<SwWrongArea>::iterator startPos, std::vector<SwWrongArea>::iterator endPos) +void SwWrongList::Insert(sal_uInt16 nWhere, std::vector<SwWrongArea>::iterator startPos, std::vector<SwWrongArea>::iterator endPos) { std::vector<SwWrongArea>::iterator i = maList.begin(); if ( nWhere >= maList.size() ) @@ -533,14 +533,14 @@ void SwWrongList::Insert(USHORT nWhere, std::vector<SwWrongArea>::iterator start } } -void SwWrongList::Remove(USHORT nIdx, USHORT nLen ) +void SwWrongList::Remove(sal_uInt16 nIdx, sal_uInt16 nLen ) { if ( nIdx >= maList.size() ) return; std::vector<SwWrongArea>::iterator i1 = maList.begin(); i1 += nIdx; std::vector<SwWrongArea>::iterator i2 = i1; - if ( nIdx + nLen >= static_cast<USHORT>(maList.size()) ) + if ( nIdx + nLen >= static_cast<sal_uInt16>(maList.size()) ) i2 = maList.end(); // robust else i2 += nLen; @@ -566,8 +566,8 @@ void SwWrongList::Remove(USHORT nIdx, USHORT nLen ) } void SwWrongList::RemoveEntry( xub_StrLen nBegin, xub_StrLen nEnd ) { - USHORT nDelPos = 0; - USHORT nDel = 0; + sal_uInt16 nDelPos = 0; + sal_uInt16 nDel = 0; std::vector<SwWrongArea>::iterator aIter = maList.begin(); while( aIter != maList.end() && (*aIter).mnPos < nBegin ) { diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index a92bb46a4c..3209fbadac 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -33,15 +33,14 @@ #include "porlin.hxx" #include "porlay.hxx" #include "portxt.hxx" +#include <libxml/xmlwriter.h> #include <SwPortionHandler.hxx> - - class XmlPortionDumper:public SwPortionHandler { private: xmlTextWriterPtr writer; - USHORT ofs; + sal_uInt16 ofs; public: XmlPortionDumper( xmlTextWriterPtr some_writer ):writer( some_writer ), ofs( 0 ) @@ -58,8 +57,8 @@ class XmlPortionDumper:public SwPortionHandler @param rText text which is painted on-screen */ - virtual void Text( USHORT nLength, - USHORT nType ) + virtual void Text( sal_uInt16 nLength, + sal_uInt16 nType ) { ofs += nLength; xmlTextWriterStartElement( writer, BAD_CAST( "Text" ) ); @@ -80,9 +79,9 @@ class XmlPortionDumper:public SwPortionHandler @param nType type of this portion */ - virtual void Special( USHORT nLength, + virtual void Special( sal_uInt16 nLength, const String & rText, - USHORT nType ) + sal_uInt16 nType ) { xmlTextWriterStartElement( writer, BAD_CAST( "Special" ) ); xmlTextWriterWriteFormatAttribute( writer, @@ -111,7 +110,7 @@ class XmlPortionDumper:public SwPortionHandler * @param nLength * number of 'model string' characters to be skipped */ - virtual void Skip( USHORT nLength ) + virtual void Skip( sal_uInt16 nLength ) { xmlTextWriterStartElement( writer, BAD_CAST( "Skip" ) ); xmlTextWriterWriteFormatAttribute( writer, @@ -129,6 +128,7 @@ class XmlPortionDumper:public SwPortionHandler }; +#if OSL_DEBUG_LEVEL > 1 void SwTxtPortion::dumpPortionAsXml( xub_StrLen ofs, XubString & /*aText */, xmlTextWriterPtr writer ) @@ -313,4 +313,6 @@ void SwTxtFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer ) xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%p", GetFollow() ); } +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |