diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-09-05 08:54:40 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-09-06 12:12:32 +0200 |
commit | 0a26e27d789736f87607435b9df3206274f0a363 (patch) | |
tree | d1ca544fd0b1fe36fc69a628509673c589001a2a | |
parent | ba0498a696423036360f51b15f9e21f180c7dedf (diff) |
sal_uInt16: use more proper types, avoid unneeded casts, constify
Change-Id: Ic30441307eaa391868ffbb85a67d1c0327258084
-rw-r--r-- | sw/source/core/text/EnhancedPDFExportHelper.cxx | 30 | ||||
-rw-r--r-- | sw/source/core/text/atrstck.cxx | 13 |
2 files changed, 21 insertions, 22 deletions
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index b3960cc81794..83767a709d70 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1076,14 +1076,14 @@ 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<sal_uInt16>(vcl::PDFWriter::Paragraph); + nPDFType = vcl::PDFWriter::Paragraph; aPDFType = sStyleName; // Quotations: BlockQuote if (sStyleName.equalsAscii(aQuotations)) { - nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::BlockQuote); + nPDFType = vcl::PDFWriter::BlockQuote; aPDFType = OUString(aBlockQuoteString); } @@ -1091,7 +1091,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() else if (sStyleName.equalsAscii(aCaption)) { - nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Caption); + nPDFType = vcl::PDFWriter::Caption; aPDFType = OUString(aCaptionString); } @@ -1099,7 +1099,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() else if (sParentStyleName.equalsAscii(aCaption)) { - nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Caption); + nPDFType = vcl::PDFWriter::Caption; aPDFType = sStyleName + aCaptionString; } @@ -1107,7 +1107,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() else if (sStyleName.equalsAscii(aHeading)) { - nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Heading); + nPDFType = vcl::PDFWriter::Heading; aPDFType = OUString(aHString); } @@ -1116,7 +1116,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() if ( pTxtNd->IsOutline() ) { int nRealLevel = pTxtNd->GetAttrOutlineLevel()-1; - nRealLevel = nRealLevel > 5 ? 5 : nRealLevel; + nRealLevel = nRealLevel > 5 ? 5 : nRealLevel; nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::H1 + nRealLevel); switch(nRealLevel) @@ -1375,7 +1375,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() else { const LanguageType nCurrentLanguage = rInf.GetFont()->GetLanguage(); - const sal_uInt16 nFont = rInf.GetFont()->GetActual(); + const sal_uInt8 nFont = rInf.GetFont()->GetActual(); const LanguageType nDefaultLang = SwEnhancedPDFExportHelper::GetDefaultLanguage(); if ( UNDERLINE_NONE != rInf.GetFont()->GetUnderline() || @@ -1699,8 +1699,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() const bool bHeaderFooter = pDoc->IsInHeaderFooter( aPos.nNode ); // Create links for all selected rectangles: - const sal_uInt16 nNumOfRects = aTmp.size(); - for ( sal_uInt16 i = 0; i < nNumOfRects; ++i ) + const size_t nNumOfRects = aTmp.size(); + for ( size_t i = 0; i < nNumOfRects; ++i ) { // Link Rectangle const SwRect& rLinkRect( aTmp[ i ] ); @@ -1739,8 +1739,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // HYPERLINKS (Graphics, Frames, OLEs ) const SwFrmFmts* pTbl = pDoc->GetSpzFrmFmts(); - const sal_uInt16 nSpzFrmFmtsCount = pTbl->size(); - for( sal_uInt16 n = 0; n < nSpzFrmFmtsCount; ++n ) + const size_t nSpzFrmFmtsCount = pTbl->size(); + for( size_t n = 0; n < nSpzFrmFmtsCount; ++n ) { const SwFrmFmt* pFrmFmt = (*pTbl)[n]; const SfxPoolItem* pItem; @@ -1868,8 +1868,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() const bool bHeaderFooter = pDoc->IsInHeaderFooter( aPos.nNode ); // Create links for all selected rectangles: - const sal_uInt16 nNumOfRects = aTmp.size(); - for ( sal_uInt16 i = 0; i < nNumOfRects; ++i ) + const size_t nNumOfRects = aTmp.size(); + for ( size_t i = 0; i < nNumOfRects; ++i ) { // Link rectangle const SwRect& rLinkRect( aTmp[ i ] ); @@ -1908,8 +1908,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // FOOTNOTES - const sal_uInt16 nFtnCount = pDoc->GetFtnIdxs().size(); - for ( sal_uInt16 nIdx = 0; nIdx < nFtnCount; ++nIdx ) + const size_t nFtnCount = pDoc->GetFtnIdxs().size(); + for ( size_t nIdx = 0; nIdx < nFtnCount; ++nIdx ) { // Set cursor to text node that contains the footnote: const SwTxtFtn* pTxtFtn = pDoc->GetFtnIdxs()[ nIdx ]; diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx index d0d3f02eb2e1..14e671798046 100644 --- a/sw/source/core/text/atrstck.cxx +++ b/sw/source/core/text/atrstck.cxx @@ -68,8 +68,7 @@ * NUM_DEFAULT_VALUES. * Also adjust NUM_ATTRIBUTE_STACKS in atrhndl.hxx. */ -const sal_uInt8 StackPos[ static_cast<sal_uInt16>(RES_TXTATR_WITHEND_END) - - static_cast<sal_uInt16>(RES_CHRATR_BEGIN) + 1 ] = +const sal_uInt8 StackPos[ RES_TXTATR_WITHEND_END - RES_CHRATR_BEGIN + 1 ] = { 0, // // 0 1, // RES_CHRATR_CASEMAP = RES_CHRATR_BEGIN // 1 @@ -508,7 +507,7 @@ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) if ( bRet ) { // we remove rAttr from the appropriate stack - sal_uInt16 nStackPos = StackPos[ i ]; + const sal_uInt16 nStackPos = StackPos[ i ]; aAttrStack[ nStackPos ].Remove( rAttr ); // reset font according to attribute on top of stack // or default value @@ -590,7 +589,7 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr ) { // ruby stack has no more attributes // check, if an rotation attribute has to be applied - sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ]; + const sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ]; bool bTwoLineAct = false; const SwTxtAttr* pTwoLineAttr = aAttrStack[ nTwoLineStack ].Top(); @@ -607,7 +606,7 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr ) return; // eventually, an rotate attribute has to be activated - sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ]; + const sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ]; const SwTxtAttr* pRotateAttr = aAttrStack[ nRotateStack ].Top(); if ( pRotateAttr ) @@ -809,7 +808,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush ) if ( bRuby ) break; - sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ]; + const sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ]; bool bTwoLineAct = false; const SwTxtAttr* pTwoLineAttr = aAttrStack[ nTwoLineStack ].Top(); @@ -847,7 +846,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush ) if ( bRuby ) break; - sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ]; + const sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ]; const SwTxtAttr* pRotateAttr = aAttrStack[ nRotateStack ].Top(); if ( pRotateAttr ) |