Kaydet (Commit) 0a26e27d authored tarafından Matteo Casalin's avatar Matteo Casalin

sal_uInt16: use more proper types, avoid unneeded casts, constify

Change-Id: Ic30441307eaa391868ffbb85a67d1c0327258084
üst ba0498a6
...@@ -1076,14 +1076,14 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() ...@@ -1076,14 +1076,14 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
// This is the default. If the paragraph could not be mapped to // This is the default. If the paragraph could not be mapped to
// any of the standard pdf tags, we write a user defined tag // any of the standard pdf tags, we write a user defined tag
// <stylename> with role = P // <stylename> with role = P
nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Paragraph); nPDFType = vcl::PDFWriter::Paragraph;
aPDFType = sStyleName; aPDFType = sStyleName;
// Quotations: BlockQuote // Quotations: BlockQuote
if (sStyleName.equalsAscii(aQuotations)) if (sStyleName.equalsAscii(aQuotations))
{ {
nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::BlockQuote); nPDFType = vcl::PDFWriter::BlockQuote;
aPDFType = OUString(aBlockQuoteString); aPDFType = OUString(aBlockQuoteString);
} }
...@@ -1091,7 +1091,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() ...@@ -1091,7 +1091,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
else if (sStyleName.equalsAscii(aCaption)) else if (sStyleName.equalsAscii(aCaption))
{ {
nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Caption); nPDFType = vcl::PDFWriter::Caption;
aPDFType = OUString(aCaptionString); aPDFType = OUString(aCaptionString);
} }
...@@ -1099,7 +1099,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() ...@@ -1099,7 +1099,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
else if (sParentStyleName.equalsAscii(aCaption)) else if (sParentStyleName.equalsAscii(aCaption))
{ {
nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Caption); nPDFType = vcl::PDFWriter::Caption;
aPDFType = sStyleName + aCaptionString; aPDFType = sStyleName + aCaptionString;
} }
...@@ -1107,7 +1107,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() ...@@ -1107,7 +1107,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
else if (sStyleName.equalsAscii(aHeading)) else if (sStyleName.equalsAscii(aHeading))
{ {
nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Heading); nPDFType = vcl::PDFWriter::Heading;
aPDFType = OUString(aHString); aPDFType = OUString(aHString);
} }
...@@ -1116,7 +1116,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() ...@@ -1116,7 +1116,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
if ( pTxtNd->IsOutline() ) if ( pTxtNd->IsOutline() )
{ {
int nRealLevel = pTxtNd->GetAttrOutlineLevel()-1; int nRealLevel = pTxtNd->GetAttrOutlineLevel()-1;
nRealLevel = nRealLevel > 5 ? 5 : nRealLevel; nRealLevel = nRealLevel > 5 ? 5 : nRealLevel;
nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::H1 + nRealLevel); nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::H1 + nRealLevel);
switch(nRealLevel) switch(nRealLevel)
...@@ -1375,7 +1375,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() ...@@ -1375,7 +1375,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
else else
{ {
const LanguageType nCurrentLanguage = rInf.GetFont()->GetLanguage(); 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(); const LanguageType nDefaultLang = SwEnhancedPDFExportHelper::GetDefaultLanguage();
if ( UNDERLINE_NONE != rInf.GetFont()->GetUnderline() || if ( UNDERLINE_NONE != rInf.GetFont()->GetUnderline() ||
...@@ -1699,8 +1699,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() ...@@ -1699,8 +1699,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
const bool bHeaderFooter = pDoc->IsInHeaderFooter( aPos.nNode ); const bool bHeaderFooter = pDoc->IsInHeaderFooter( aPos.nNode );
// Create links for all selected rectangles: // Create links for all selected rectangles:
const sal_uInt16 nNumOfRects = aTmp.size(); const size_t nNumOfRects = aTmp.size();
for ( sal_uInt16 i = 0; i < nNumOfRects; ++i ) for ( size_t i = 0; i < nNumOfRects; ++i )
{ {
// Link Rectangle // Link Rectangle
const SwRect& rLinkRect( aTmp[ i ] ); const SwRect& rLinkRect( aTmp[ i ] );
...@@ -1739,8 +1739,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() ...@@ -1739,8 +1739,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// HYPERLINKS (Graphics, Frames, OLEs ) // HYPERLINKS (Graphics, Frames, OLEs )
const SwFrmFmts* pTbl = pDoc->GetSpzFrmFmts(); const SwFrmFmts* pTbl = pDoc->GetSpzFrmFmts();
const sal_uInt16 nSpzFrmFmtsCount = pTbl->size(); const size_t nSpzFrmFmtsCount = pTbl->size();
for( sal_uInt16 n = 0; n < nSpzFrmFmtsCount; ++n ) for( size_t n = 0; n < nSpzFrmFmtsCount; ++n )
{ {
const SwFrmFmt* pFrmFmt = (*pTbl)[n]; const SwFrmFmt* pFrmFmt = (*pTbl)[n];
const SfxPoolItem* pItem; const SfxPoolItem* pItem;
...@@ -1868,8 +1868,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() ...@@ -1868,8 +1868,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
const bool bHeaderFooter = pDoc->IsInHeaderFooter( aPos.nNode ); const bool bHeaderFooter = pDoc->IsInHeaderFooter( aPos.nNode );
// Create links for all selected rectangles: // Create links for all selected rectangles:
const sal_uInt16 nNumOfRects = aTmp.size(); const size_t nNumOfRects = aTmp.size();
for ( sal_uInt16 i = 0; i < nNumOfRects; ++i ) for ( size_t i = 0; i < nNumOfRects; ++i )
{ {
// Link rectangle // Link rectangle
const SwRect& rLinkRect( aTmp[ i ] ); const SwRect& rLinkRect( aTmp[ i ] );
...@@ -1908,8 +1908,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() ...@@ -1908,8 +1908,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// FOOTNOTES // FOOTNOTES
const sal_uInt16 nFtnCount = pDoc->GetFtnIdxs().size(); const size_t nFtnCount = pDoc->GetFtnIdxs().size();
for ( sal_uInt16 nIdx = 0; nIdx < nFtnCount; ++nIdx ) for ( size_t nIdx = 0; nIdx < nFtnCount; ++nIdx )
{ {
// Set cursor to text node that contains the footnote: // Set cursor to text node that contains the footnote:
const SwTxtFtn* pTxtFtn = pDoc->GetFtnIdxs()[ nIdx ]; const SwTxtFtn* pTxtFtn = pDoc->GetFtnIdxs()[ nIdx ];
......
...@@ -68,8 +68,7 @@ ...@@ -68,8 +68,7 @@
* NUM_DEFAULT_VALUES. * NUM_DEFAULT_VALUES.
* Also adjust NUM_ATTRIBUTE_STACKS in atrhndl.hxx. * Also adjust NUM_ATTRIBUTE_STACKS in atrhndl.hxx.
*/ */
const sal_uInt8 StackPos[ static_cast<sal_uInt16>(RES_TXTATR_WITHEND_END) - const sal_uInt8 StackPos[ RES_TXTATR_WITHEND_END - RES_CHRATR_BEGIN + 1 ] =
static_cast<sal_uInt16>(RES_CHRATR_BEGIN) + 1 ] =
{ {
0, // // 0 0, // // 0
1, // RES_CHRATR_CASEMAP = RES_CHRATR_BEGIN // 1 1, // RES_CHRATR_CASEMAP = RES_CHRATR_BEGIN // 1
...@@ -508,7 +507,7 @@ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) ...@@ -508,7 +507,7 @@ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt )
if ( bRet ) if ( bRet )
{ {
// we remove rAttr from the appropriate stack // we remove rAttr from the appropriate stack
sal_uInt16 nStackPos = StackPos[ i ]; const sal_uInt16 nStackPos = StackPos[ i ];
aAttrStack[ nStackPos ].Remove( rAttr ); aAttrStack[ nStackPos ].Remove( rAttr );
// reset font according to attribute on top of stack // reset font according to attribute on top of stack
// or default value // or default value
...@@ -590,7 +589,7 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr ) ...@@ -590,7 +589,7 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr )
{ {
// ruby stack has no more attributes // ruby stack has no more attributes
// check, if an rotation attribute has to be applied // 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; bool bTwoLineAct = false;
const SwTxtAttr* pTwoLineAttr = aAttrStack[ nTwoLineStack ].Top(); const SwTxtAttr* pTwoLineAttr = aAttrStack[ nTwoLineStack ].Top();
...@@ -607,7 +606,7 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr ) ...@@ -607,7 +606,7 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr )
return; return;
// eventually, an rotate attribute has to be activated // 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(); const SwTxtAttr* pRotateAttr = aAttrStack[ nRotateStack ].Top();
if ( pRotateAttr ) if ( pRotateAttr )
...@@ -809,7 +808,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush ) ...@@ -809,7 +808,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush )
if ( bRuby ) if ( bRuby )
break; break;
sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ]; const sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ];
bool bTwoLineAct = false; bool bTwoLineAct = false;
const SwTxtAttr* pTwoLineAttr = aAttrStack[ nTwoLineStack ].Top(); const SwTxtAttr* pTwoLineAttr = aAttrStack[ nTwoLineStack ].Top();
...@@ -847,7 +846,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush ) ...@@ -847,7 +846,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush )
if ( bRuby ) if ( bRuby )
break; break;
sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ]; const sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ];
const SwTxtAttr* pRotateAttr = aAttrStack[ nRotateStack ].Top(); const SwTxtAttr* pRotateAttr = aAttrStack[ nRotateStack ].Top();
if ( pRotateAttr ) if ( pRotateAttr )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment