Kaydet (Commit) bf569c3f authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: use auto when initializing with a cast in rtfexport

Change-Id: I48e7f1e27ca7a221e06891e6c4ac543deaf32fa0
üst d2c2388c
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <svx/xflclit.hxx> #include <svx/xflclit.hxx>
#include <editeng/hyphenzoneitem.hxx> #include <editeng/hyphenzoneitem.hxx>
#include <fmtmeta.hxx> #include <fmtmeta.hxx>
#include <o3tl/make_unique.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -679,7 +680,7 @@ void RtfExport::ExportDocument_Impl() ...@@ -679,7 +680,7 @@ void RtfExport::ExportDocument_Impl()
sal_uInt32 const nMaxItem = rPool.GetItemCount2(RES_PROTECT); sal_uInt32 const nMaxItem = rPool.GetItemCount2(RES_PROTECT);
for (sal_uInt32 n = 0; n < nMaxItem; ++n) for (sal_uInt32 n = 0; n < nMaxItem; ++n)
{ {
const SvxProtectItem* pProtect = static_cast<const SvxProtectItem*>(rPool.GetItem2(RES_PROTECT, n)); auto pProtect = static_cast<const SvxProtectItem*>(rPool.GetItem2(RES_PROTECT, n));
if (pProtect && pProtect->IsContentProtected()) if (pProtect && pProtect->IsContentProtected())
{ {
Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FORMPROT); Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FORMPROT);
...@@ -959,13 +960,13 @@ RtfExport::RtfExport(RtfExportFilter* pFilter, SwDoc* pDocument, SwPaM* pCurrent ...@@ -959,13 +960,13 @@ RtfExport::RtfExport(RtfExportFilter* pFilter, SwDoc* pDocument, SwPaM* pCurrent
{ {
m_bExportModeRTF = true; m_bExportModeRTF = true;
// the attribute output for the document // the attribute output for the document
m_pAttrOutput.reset(new RtfAttributeOutput(*this)); m_pAttrOutput = o3tl::make_unique<RtfAttributeOutput>(*this);
// that just causes problems for RTF // that just causes problems for RTF
m_bSubstituteBullets = false; m_bSubstituteBullets = false;
// needed to have a complete font table // needed to have a complete font table
m_aFontHelper.bLoadAllFonts = true; m_aFontHelper.bLoadAllFonts = true;
// the related SdrExport // the related SdrExport
m_pSdrExport.reset(new RtfSdrExport(*this)); m_pSdrExport = o3tl::make_unique<RtfSdrExport>(*this);
if (!m_pWriter) if (!m_pWriter)
m_pWriter = &m_pFilter->m_aWriter; m_pWriter = &m_pFilter->m_aWriter;
...@@ -983,7 +984,7 @@ SvStream& RtfExport::Strm() ...@@ -983,7 +984,7 @@ SvStream& RtfExport::Strm()
void RtfExport::setStream() void RtfExport::setStream()
{ {
m_pStream.reset(new SvMemoryStream()); m_pStream = o3tl::make_unique<SvMemoryStream>();
} }
OString RtfExport::getStream() OString RtfExport::getStream()
...@@ -1114,7 +1115,7 @@ void RtfExport::OutColorTable() ...@@ -1114,7 +1115,7 @@ void RtfExport::OutColorTable()
// char color // char color
{ {
const SvxColorItem* pCol = static_cast<const SvxColorItem*>(GetDfltAttr(RES_CHRATR_COLOR)); auto pCol = static_cast<const SvxColorItem*>(GetDfltAttr(RES_CHRATR_COLOR));
InsColor(pCol->GetValue()); InsColor(pCol->GetValue());
if (nullptr != (pCol = static_cast<const SvxColorItem*>(rPool.GetPoolDefaultItem(RES_CHRATR_COLOR)))) if (nullptr != (pCol = static_cast<const SvxColorItem*>(rPool.GetPoolDefaultItem(RES_CHRATR_COLOR))))
InsColor(pCol->GetValue()); InsColor(pCol->GetValue());
...@@ -1125,7 +1126,7 @@ void RtfExport::OutColorTable() ...@@ -1125,7 +1126,7 @@ void RtfExport::OutColorTable()
InsColor(pCol->GetValue()); InsColor(pCol->GetValue());
} }
const SvxUnderlineItem* pUnder = static_cast<const SvxUnderlineItem*>(GetDfltAttr(RES_CHRATR_UNDERLINE)); auto pUnder = static_cast<const SvxUnderlineItem*>(GetDfltAttr(RES_CHRATR_UNDERLINE));
InsColor(pUnder->GetColor()); InsColor(pUnder->GetColor());
nMaxItem = rPool.GetItemCount2(RES_CHRATR_UNDERLINE); nMaxItem = rPool.GetItemCount2(RES_CHRATR_UNDERLINE);
for (sal_uInt32 n = 0; n < nMaxItem; ++n) for (sal_uInt32 n = 0; n < nMaxItem; ++n)
...@@ -1135,7 +1136,7 @@ void RtfExport::OutColorTable() ...@@ -1135,7 +1136,7 @@ void RtfExport::OutColorTable()
} }
const SvxOverlineItem* pOver = static_cast<const SvxOverlineItem*>(GetDfltAttr(RES_CHRATR_OVERLINE)); auto pOver = static_cast<const SvxOverlineItem*>(GetDfltAttr(RES_CHRATR_OVERLINE));
InsColor(pOver->GetColor()); InsColor(pOver->GetColor());
nMaxItem = rPool.GetItemCount2(RES_CHRATR_OVERLINE); nMaxItem = rPool.GetItemCount2(RES_CHRATR_OVERLINE);
for (sal_uInt32 n = 0; n < nMaxItem; ++n) for (sal_uInt32 n = 0; n < nMaxItem; ++n)
...@@ -1155,25 +1156,25 @@ void RtfExport::OutColorTable() ...@@ -1155,25 +1156,25 @@ void RtfExport::OutColorTable()
for (const sal_uInt16* pIds = aBrushIds; *pIds; ++pIds) for (const sal_uInt16* pIds = aBrushIds; *pIds; ++pIds)
{ {
const SvxBrushItem* pBkgrd = static_cast<const SvxBrushItem*>(GetDfltAttr(*pIds)); auto pBackground = static_cast<const SvxBrushItem*>(GetDfltAttr(*pIds));
InsColor(pBkgrd->GetColor()); InsColor(pBackground->GetColor());
if (nullptr != (pBkgrd = static_cast<const SvxBrushItem*>(rPool.GetPoolDefaultItem(*pIds)))) if ((pBackground = static_cast<const SvxBrushItem*>(rPool.GetPoolDefaultItem(*pIds))))
{ {
InsColor(pBkgrd->GetColor()); InsColor(pBackground->GetColor());
} }
nMaxItem = rPool.GetItemCount2(*pIds); nMaxItem = rPool.GetItemCount2(*pIds);
for (sal_uInt32 n = 0; n < nMaxItem; ++n) for (sal_uInt32 n = 0; n < nMaxItem; ++n)
{ {
if (nullptr != (pBkgrd = static_cast<const SvxBrushItem*>(rPool.GetItem2(*pIds , n)))) if ((pBackground = static_cast<const SvxBrushItem*>(rPool.GetItem2(*pIds , n))))
{ {
InsColor(pBkgrd->GetColor()); InsColor(pBackground->GetColor());
} }
} }
} }
// shadow color // shadow color
{ {
const SvxShadowItem* pShadow = static_cast<const SvxShadowItem*>(GetDfltAttr(RES_SHADOW)); auto pShadow = static_cast<const SvxShadowItem*>(GetDfltAttr(RES_SHADOW));
InsColor(pShadow->GetColor()); InsColor(pShadow->GetColor());
if (nullptr != (pShadow = static_cast<const SvxShadowItem*>(rPool.GetPoolDefaultItem(RES_SHADOW)))) if (nullptr != (pShadow = static_cast<const SvxShadowItem*>(rPool.GetPoolDefaultItem(RES_SHADOW))))
{ {
...@@ -1218,7 +1219,7 @@ void RtfExport::OutColorTable() ...@@ -1218,7 +1219,7 @@ void RtfExport::OutColorTable()
nMaxItem = rPool.GetItemCount2(XATTR_FILLCOLOR); nMaxItem = rPool.GetItemCount2(XATTR_FILLCOLOR);
for (sal_uInt32 i = 0; i < nMaxItem; ++i) for (sal_uInt32 i = 0; i < nMaxItem; ++i)
{ {
if (const XFillColorItem* pItem = static_cast<const XFillColorItem*>(rPool.GetItem2(XATTR_FILLCOLOR, i))) if (auto pItem = static_cast<const XFillColorItem*>(rPool.GetItem2(XATTR_FILLCOLOR, i)))
InsColor(pItem->GetColorValue()); InsColor(pItem->GetColorValue());
} }
...@@ -1255,7 +1256,7 @@ sal_uInt16 RtfExport::GetRedline(const OUString& rAuthor) ...@@ -1255,7 +1256,7 @@ sal_uInt16 RtfExport::GetRedline(const OUString& rAuthor)
if (it != m_aRedlineTable.end()) if (it != m_aRedlineTable.end())
return it->second; return it->second;
const sal_uInt16 nId = static_cast<sal_uInt16>(m_aRedlineTable.size()); const sal_uInt16 nId = m_aRedlineTable.size();
m_aRedlineTable.insert(std::pair<OUString,sal_uInt16>(rAuthor,nId)); m_aRedlineTable.insert(std::pair<OUString,sal_uInt16>(rAuthor,nId));
return nId; return nId;
} }
...@@ -1319,13 +1320,13 @@ void RtfExport::WriteHeaderFooter(const SfxPoolItem& rItem, bool bHeader) ...@@ -1319,13 +1320,13 @@ void RtfExport::WriteHeaderFooter(const SfxPoolItem& rItem, bool bHeader)
{ {
if (bHeader) if (bHeader)
{ {
const SwFormatHeader& rHeader = static_cast<const SwFormatHeader&>(rItem); const auto& rHeader = static_cast<const SwFormatHeader&>(rItem);
if (!rHeader.IsActive()) if (!rHeader.IsActive())
return; return;
} }
else else
{ {
const SwFormatFooter& rFooter = static_cast<const SwFormatFooter&>(rItem); const auto& rFooter = static_cast<const SwFormatFooter&>(rItem);
if (!rFooter.IsActive()) if (!rFooter.IsActive())
return; return;
} }
......
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