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

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

Change-Id: Ide7bd0f1f444824b78aa53cfe1db0129cbca1a5d
Reviewed-on: https://gerrit.libreoffice.org/31397Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 032b6319
...@@ -42,7 +42,7 @@ throw(datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeExc ...@@ -42,7 +42,7 @@ throw(datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeExc
uno::Any aRet; uno::Any aRet;
if (rFlavor.DataType == cppu::UnoType<OUString>::get()) 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); aRet <<= OUString(pText, m_aSequence.getLength(), RTL_TEXTENCODING_UTF8);
} }
else else
......
...@@ -154,7 +154,7 @@ void ClassificationCategoriesController::dispose() throw (uno::RuntimeException, ...@@ -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) uno::Reference<awt::XWindow> ClassificationCategoriesController::createItemWindow(const uno::Reference<awt::XWindow>& rParent) throw (uno::RuntimeException, std::exception)
{ {
VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow(rParent); VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow(rParent);
ToolBox* pToolbar = dynamic_cast<ToolBox*>(pParent.get()); auto pToolbar = dynamic_cast<ToolBox*>(pParent.get());
if (pToolbar) if (pToolbar)
{ {
m_pClassification = VclPtr<ClassificationControl>::Create(pToolbar); m_pClassification = VclPtr<ClassificationControl>::Create(pToolbar);
......
...@@ -54,7 +54,7 @@ void SmRtfExport::HandleText(const SmNode* pNode, int /*nLevel*/) ...@@ -54,7 +54,7 @@ void SmRtfExport::HandleText(const SmNode* pNode, int /*nLevel*/)
if (pNode->GetToken().eType == TTEXT) // literal text if (pNode->GetToken().eType == TTEXT) // literal text
m_pBuffer->append(LO_STRING_SVTOOLS_RTF_MNOR " "); 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()); SAL_INFO("starmath.rtf", "Text: " << pTemp->GetText());
for (sal_Int32 i = 0; i < pTemp->GetText().getLength(); i++) for (sal_Int32 i = 0; i < pTemp->GetText().getLength(); i++)
{ {
...@@ -180,7 +180,7 @@ namespace ...@@ -180,7 +180,7 @@ namespace
OString mathSymbolToString(const SmNode* node, rtl_TextEncoding nEncoding) OString mathSymbolToString(const SmNode* node, rtl_TextEncoding nEncoding)
{ {
assert(node->GetType() == NMATH || node->GetType() == NMATHIDENT); 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()) if (txtnode->GetText().isEmpty())
return OString(); return OString();
assert(txtnode->GetText().getLength() == 1); assert(txtnode->GetText().getLength() == 1);
...@@ -405,7 +405,7 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel) ...@@ -405,7 +405,7 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel)
std::vector< const SmNode* > subnodes; std::vector< const SmNode* > subnodes;
if (pNode->Body()->GetType() == NBRACEBODY) 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 bool separatorWritten = false; // assume all separators are the same
for (int i = 0; i < body->GetNumSubNodes(); ++i) for (int i = 0; i < body->GetNumSubNodes(); ++i)
{ {
...@@ -413,7 +413,7 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel) ...@@ -413,7 +413,7 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel)
if (subnode->GetType() == NMATH || subnode->GetType() == NMATHIDENT) if (subnode->GetType() == NMATH || subnode->GetType() == NMATHIDENT)
{ {
// do not write, but write what separator it is // 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) if (!separatorWritten)
{ {
m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSEPCHR " "); m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSEPCHR " ");
......
...@@ -67,9 +67,9 @@ sal_Bool MathTypeFilter::filter(const uno::Sequence<beans::PropertyValue>& rDesc ...@@ -67,9 +67,9 @@ sal_Bool MathTypeFilter::filter(const uno::Sequence<beans::PropertyValue>& rDesc
// Is this a MathType Storage? // Is this a MathType Storage?
if (aStorage->IsStream("Equation Native")) 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(); OUString aText = pDocShell->GetText();
MathType aEquation(aText); MathType aEquation(aText);
bSuccess = aEquation.Parse(aStorage.get()); bSuccess = aEquation.Parse(aStorage.get());
......
...@@ -51,7 +51,7 @@ void SmWordExportBase::HandleNode(const SmNode* pNode, int nLevel) ...@@ -51,7 +51,7 @@ void SmWordExportBase::HandleNode(const SmNode* pNode, int nLevel)
break; break;
case NSPECIAL: 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 //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 //is to be seen as text, else assume it's a mathchar
if (pText->GetText() == pText->GetToken().aText) if (pText->GetText() == pText->GetToken().aText)
......
...@@ -28,7 +28,7 @@ SfxGrabBagItem::~SfxGrabBagItem() = default; ...@@ -28,7 +28,7 @@ SfxGrabBagItem::~SfxGrabBagItem() = default;
bool SfxGrabBagItem::operator==(const SfxPoolItem& rItem) const 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; return m_aMap == pItem->m_aMap;
} }
......
...@@ -28,7 +28,7 @@ std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString& ...@@ -28,7 +28,7 @@ std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString&
std::map<OUString, OUString> aRet; std::map<OUString, OUString> aRet;
// We only read the node, but CreateXParagraph() needs a non-cost one. // 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<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType); uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType);
......
...@@ -59,7 +59,7 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape) ...@@ -59,7 +59,7 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape)
// Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls). // Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls).
uno::Reference<text::XTextFrame> xRealTextFrame(xTextFrame, uno::UNO_QUERY); 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); assert(nullptr != pTextFrame);
SwFrameFormat* pFormat = pTextFrame->GetFrameFormat(); SwFrameFormat* pFormat = pTextFrame->GetFrameFormat();
...@@ -151,7 +151,7 @@ bool SwTextBoxHelper::isTextBox(const SwFrameFormat* pShape, sal_uInt16 nType) ...@@ -151,7 +151,7 @@ bool SwTextBoxHelper::isTextBox(const SwFrameFormat* pShape, sal_uInt16 nType)
bool SwTextBoxHelper::isTextBox(const SdrObject* pObject) bool SwTextBoxHelper::isTextBox(const SdrObject* pObject)
{ {
const SwVirtFlyDrawObj* pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>(pObject); auto pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>(pObject);
if (!pVirtFlyDrawObj) if (!pVirtFlyDrawObj)
return false; return false;
return isTextBox(pVirtFlyDrawObj->GetFormat(), RES_FLYFRMFMT); return isTextBox(pVirtFlyDrawObj->GetFormat(), RES_FLYFRMFMT);
...@@ -241,7 +241,7 @@ SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(const SwFrameFormat* pForm ...@@ -241,7 +241,7 @@ SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(const SwFrameFormat* pForm
SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(uno::Reference<drawing::XShape> const& xShape) 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) if (!pShape)
return nullptr; return nullptr;
...@@ -286,7 +286,7 @@ Rectangle SwTextBoxHelper::getTextRectangle(SwFrameFormat* pShape, bool bAbsolut ...@@ -286,7 +286,7 @@ Rectangle SwTextBoxHelper::getTextRectangle(SwFrameFormat* pShape, bool bAbsolut
{ {
Rectangle aRet; Rectangle aRet;
aRet.SetEmpty(); aRet.SetEmpty();
SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape->FindRealSdrObject()); auto pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape->FindRealSdrObject());
if (pCustomShape) if (pCustomShape)
{ {
// Need to temporarily release the lock acquired in // Need to temporarily release the lock acquired in
...@@ -608,7 +608,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet& rSet) ...@@ -608,7 +608,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet& rSet)
{ {
case RES_VERT_ORIENT: case RES_VERT_ORIENT:
{ {
const SwFormatVertOrient& rOrient = static_cast<const SwFormatVertOrient&>(*aIter.GetCurItem()); auto& rOrient = static_cast<const SwFormatVertOrient&>(*aIter.GetCurItem());
SwFormatVertOrient aOrient(rOrient); SwFormatVertOrient aOrient(rOrient);
Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false); Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false);
...@@ -628,7 +628,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet& rSet) ...@@ -628,7 +628,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet& rSet)
break; break;
case RES_HORI_ORIENT: case RES_HORI_ORIENT:
{ {
const SwFormatHoriOrient& rOrient = static_cast<const SwFormatHoriOrient&>(*aIter.GetCurItem()); auto& rOrient = static_cast<const SwFormatHoriOrient&>(*aIter.GetCurItem());
SwFormatHoriOrient aOrient(rOrient); SwFormatHoriOrient aOrient(rOrient);
Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false); Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false);
......
...@@ -950,7 +950,7 @@ void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj, const SwFrame ...@@ -950,7 +950,7 @@ void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj, const SwFrame
{ {
m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_AlternateContent, FSEND); 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, m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_Choice,
XML_Requires, (pObjGroup ? "wpg" : "wps"), XML_Requires, (pObjGroup ? "wpg" : "wps"),
FSEND); FSEND);
...@@ -1769,7 +1769,7 @@ bool DocxSdrExport::Impl::checkFrameBtlr(SwNode* pStartNode, bool bDML) ...@@ -1769,7 +1769,7 @@ bool DocxSdrExport::Impl::checkFrameBtlr(SwNode* pStartNode, bool bDML)
if (bItemSet) if (bItemSet)
{ {
const SvxCharRotateItem& rCharRotate = static_cast<const SvxCharRotateItem&>(*pItem); auto& rCharRotate = static_cast<const SvxCharRotateItem&>(*pItem);
if (rCharRotate.GetValue() == 900) if (rCharRotate.GetValue() == 900)
{ {
if (bDML) if (bDML)
......
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