sw: use auto when initializing with a cast to avoid duplicating the type name

Change-Id: Ide7bd0f1f444824b78aa53cfe1db0129cbca1a5d
Reviewed-on: https://gerrit.libreoffice.org/31397
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
This commit is contained in:
Miklos Vajna 2016-11-30 09:08:43 +01:00
parent 032b63195e
commit b18b1e80e9
9 changed files with 19 additions and 19 deletions

View File

@ -42,7 +42,7 @@ throw(datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeExc
uno::Any aRet;
if (rFlavor.DataType == cppu::UnoType<OUString>::get())
{
sal_Char* pText = reinterpret_cast<sal_Char*>(m_aSequence.getArray());
auto pText = reinterpret_cast<sal_Char*>(m_aSequence.getArray());
aRet <<= OUString(pText, m_aSequence.getLength(), RTL_TEXTENCODING_UTF8);
}
else

View File

@ -154,7 +154,7 @@ void ClassificationCategoriesController::dispose() throw (uno::RuntimeException,
uno::Reference<awt::XWindow> ClassificationCategoriesController::createItemWindow(const uno::Reference<awt::XWindow>& rParent) throw (uno::RuntimeException, std::exception)
{
VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow(rParent);
ToolBox* pToolbar = dynamic_cast<ToolBox*>(pParent.get());
auto pToolbar = dynamic_cast<ToolBox*>(pParent.get());
if (pToolbar)
{
m_pClassification = VclPtr<ClassificationControl>::Create(pToolbar);

View File

@ -54,7 +54,7 @@ void SmRtfExport::HandleText(const SmNode* pNode, int /*nLevel*/)
if (pNode->GetToken().eType == TTEXT) // literal text
m_pBuffer->append(LO_STRING_SVTOOLS_RTF_MNOR " ");
const SmTextNode* pTemp = static_cast<const SmTextNode*>(pNode);
auto pTemp = static_cast<const SmTextNode*>(pNode);
SAL_INFO("starmath.rtf", "Text: " << pTemp->GetText());
for (sal_Int32 i = 0; i < pTemp->GetText().getLength(); i++)
{
@ -180,7 +180,7 @@ namespace
OString mathSymbolToString(const SmNode* node, rtl_TextEncoding nEncoding)
{
assert(node->GetType() == NMATH || node->GetType() == NMATHIDENT);
const SmTextNode* txtnode = static_cast<const SmTextNode*>(node);
auto txtnode = static_cast<const SmTextNode*>(node);
if (txtnode->GetText().isEmpty())
return OString();
assert(txtnode->GetText().getLength() == 1);
@ -405,7 +405,7 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel)
std::vector< const SmNode* > subnodes;
if (pNode->Body()->GetType() == NBRACEBODY)
{
const SmBracebodyNode* body = static_cast<const SmBracebodyNode*>(pNode->Body());
auto body = static_cast<const SmBracebodyNode*>(pNode->Body());
bool separatorWritten = false; // assume all separators are the same
for (int i = 0; i < body->GetNumSubNodes(); ++i)
{
@ -413,7 +413,7 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel)
if (subnode->GetType() == NMATH || subnode->GetType() == NMATHIDENT)
{
// do not write, but write what separator it is
const SmMathSymbolNode* math = static_cast<const SmMathSymbolNode*>(subnode);
auto math = static_cast<const SmMathSymbolNode*>(subnode);
if (!separatorWritten)
{
m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSEPCHR " ");

View File

@ -67,9 +67,9 @@ sal_Bool MathTypeFilter::filter(const uno::Sequence<beans::PropertyValue>& rDesc
// Is this a MathType Storage?
if (aStorage->IsStream("Equation Native"))
{
if (SmModel* pModel = dynamic_cast<SmModel*>(m_xDstDoc.get()))
if (auto pModel = dynamic_cast<SmModel*>(m_xDstDoc.get()))
{
SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell());
auto pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell());
OUString aText = pDocShell->GetText();
MathType aEquation(aText);
bSuccess = aEquation.Parse(aStorage.get());

View File

@ -51,7 +51,7 @@ void SmWordExportBase::HandleNode(const SmNode* pNode, int nLevel)
break;
case NSPECIAL:
{
const SmTextNode* pText= static_cast< const SmTextNode* >(pNode);
auto pText= static_cast<const SmTextNode*>(pNode);
//if the token str and the result text are the same then this
//is to be seen as text, else assume it's a mathchar
if (pText->GetText() == pText->GetToken().aText)

View File

@ -28,7 +28,7 @@ SfxGrabBagItem::~SfxGrabBagItem() = default;
bool SfxGrabBagItem::operator==(const SfxPoolItem& rItem) const
{
const SfxGrabBagItem* pItem = static_cast<const SfxGrabBagItem*>(&rItem);
auto pItem = static_cast<const SfxGrabBagItem*>(&rItem);
return m_aMap == pItem->m_aMap;
}

View File

@ -28,7 +28,7 @@ std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString&
std::map<OUString, OUString> aRet;
// We only read the node, but CreateXParagraph() needs a non-cost one.
SwTextNode& rTextNode = const_cast<SwTextNode&>(rNode);
auto& rTextNode = const_cast<SwTextNode&>(rNode);
uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType);

View File

@ -59,7 +59,7 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape)
// Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls).
uno::Reference<text::XTextFrame> xRealTextFrame(xTextFrame, uno::UNO_QUERY);
SwXTextFrame* pTextFrame = dynamic_cast<SwXTextFrame*>(xRealTextFrame.get());
auto pTextFrame = dynamic_cast<SwXTextFrame*>(xRealTextFrame.get());
assert(nullptr != pTextFrame);
SwFrameFormat* pFormat = pTextFrame->GetFrameFormat();
@ -151,7 +151,7 @@ bool SwTextBoxHelper::isTextBox(const SwFrameFormat* pShape, sal_uInt16 nType)
bool SwTextBoxHelper::isTextBox(const SdrObject* pObject)
{
const SwVirtFlyDrawObj* pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>(pObject);
auto pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>(pObject);
if (!pVirtFlyDrawObj)
return false;
return isTextBox(pVirtFlyDrawObj->GetFormat(), RES_FLYFRMFMT);
@ -241,7 +241,7 @@ SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(const SwFrameFormat* pForm
SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(uno::Reference<drawing::XShape> const& xShape)
{
SwXShape* pShape = dynamic_cast<SwXShape*>(xShape.get());
auto pShape = dynamic_cast<SwXShape*>(xShape.get());
if (!pShape)
return nullptr;
@ -286,7 +286,7 @@ Rectangle SwTextBoxHelper::getTextRectangle(SwFrameFormat* pShape, bool bAbsolut
{
Rectangle aRet;
aRet.SetEmpty();
SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape->FindRealSdrObject());
auto pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape->FindRealSdrObject());
if (pCustomShape)
{
// Need to temporarily release the lock acquired in
@ -608,7 +608,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet& rSet)
{
case RES_VERT_ORIENT:
{
const SwFormatVertOrient& rOrient = static_cast<const SwFormatVertOrient&>(*aIter.GetCurItem());
auto& rOrient = static_cast<const SwFormatVertOrient&>(*aIter.GetCurItem());
SwFormatVertOrient aOrient(rOrient);
Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false);
@ -628,7 +628,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet& rSet)
break;
case RES_HORI_ORIENT:
{
const SwFormatHoriOrient& rOrient = static_cast<const SwFormatHoriOrient&>(*aIter.GetCurItem());
auto& rOrient = static_cast<const SwFormatHoriOrient&>(*aIter.GetCurItem());
SwFormatHoriOrient aOrient(rOrient);
Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false);

View File

@ -950,7 +950,7 @@ void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj, const SwFrame
{
m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_AlternateContent, FSEND);
const SdrObjGroup* pObjGroup = dynamic_cast<const SdrObjGroup*>(sdrObj);
auto pObjGroup = dynamic_cast<const SdrObjGroup*>(sdrObj);
m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_Choice,
XML_Requires, (pObjGroup ? "wpg" : "wps"),
FSEND);
@ -1769,7 +1769,7 @@ bool DocxSdrExport::Impl::checkFrameBtlr(SwNode* pStartNode, bool bDML)
if (bItemSet)
{
const SvxCharRotateItem& rCharRotate = static_cast<const SvxCharRotateItem&>(*pItem);
auto& rCharRotate = static_cast<const SvxCharRotateItem&>(*pItem);
if (rCharRotate.GetValue() == 900)
{
if (bDML)