Kaydet (Commit) cca4e470 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1233486 Unchecked dynamic_cast

Change-Id: Icc4faeb5597267c04591e8d68ec429344d5bd126
üst 0065cb5d
...@@ -1674,14 +1674,14 @@ SwXText::convertToTextFrame( ...@@ -1674,14 +1674,14 @@ SwXText::convertToTextFrame(
const uno::Reference<text::XTextFrame> xNewFrame( const uno::Reference<text::XTextFrame> xNewFrame(
SwXTextFrame::CreateXTextFrame(*m_pImpl->m_pDoc, 0)); SwXTextFrame::CreateXTextFrame(*m_pImpl->m_pDoc, 0));
SwXTextFrame *const pNewFrame = dynamic_cast<SwXTextFrame*>(xNewFrame.get()); SwXTextFrame& rNewFrame = dynamic_cast<SwXTextFrame&>(*xNewFrame.get());
pNewFrame->SetSelection( aStartPam ); rNewFrame.SetSelection( aStartPam );
try try
{ {
const beans::PropertyValue* pValues = rFrameProperties.getConstArray(); const beans::PropertyValue* pValues = rFrameProperties.getConstArray();
for (sal_Int32 nProp = 0; nProp < rFrameProperties.getLength(); ++nProp) for (sal_Int32 nProp = 0; nProp < rFrameProperties.getLength(); ++nProp)
{ {
pNewFrame->SwXFrame::setPropertyValue( rNewFrame.SwXFrame::setPropertyValue(
pValues[nProp].Name, pValues[nProp].Value); pValues[nProp].Name, pValues[nProp].Value);
} }
...@@ -1690,8 +1690,8 @@ SwXText::convertToTextFrame( ...@@ -1690,8 +1690,8 @@ SwXText::convertToTextFrame(
const uno::Reference< text::XTextRange> xInsertTextRange = const uno::Reference< text::XTextRange> xInsertTextRange =
new SwXTextRange(aStartPam, this); new SwXTextRange(aStartPam, this);
aStartPam.DeleteMark(); // mark position node may be deleted! aStartPam.DeleteMark(); // mark position node may be deleted!
pNewFrame->attach( xInsertTextRange ); rNewFrame.attach( xInsertTextRange );
pNewFrame->setName(m_pImpl->m_pDoc->GetUniqueFrameName()); rNewFrame.setName(m_pImpl->m_pDoc->GetUniqueFrameName());
} }
SwTxtNode *const pTxtNode(aStartPam.GetNode().GetTxtNode()); SwTxtNode *const pTxtNode(aStartPam.GetNode().GetTxtNode());
...@@ -1704,10 +1704,10 @@ SwXText::convertToTextFrame( ...@@ -1704,10 +1704,10 @@ SwXText::convertToTextFrame(
if (aMovePam.Move( fnMoveForward, fnGoCntnt )) if (aMovePam.Move( fnMoveForward, fnGoCntnt ))
{ {
// move the anchor to the next paragraph // move the anchor to the next paragraph
SwFmtAnchor aNewAnchor(pNewFrame->GetFrmFmt()->GetAnchor()); SwFmtAnchor aNewAnchor(rNewFrame.GetFrmFmt()->GetAnchor());
aNewAnchor.SetAnchor( aMovePam.Start() ); aNewAnchor.SetAnchor( aMovePam.Start() );
m_pImpl->m_pDoc->SetAttr( m_pImpl->m_pDoc->SetAttr(
aNewAnchor, *pNewFrame->GetFrmFmt() ); aNewAnchor, *rNewFrame.GetFrmFmt() );
// also move frames anchored to us // also move frames anchored to us
for (size_t i = 0; i < m_pImpl->m_pDoc->GetSpzFrmFmts()->size(); ++i) for (size_t i = 0; i < m_pImpl->m_pDoc->GetSpzFrmFmts()->size(); ++i)
...@@ -1736,11 +1736,11 @@ SwXText::convertToTextFrame( ...@@ -1736,11 +1736,11 @@ SwXText::convertToTextFrame(
sMessage = rRuntime.Message; sMessage = rRuntime.Message;
bRuntimeException = true; bRuntimeException = true;
} }
xRet = pNewFrame; xRet = &rNewFrame;
if (bParaBeforeInserted || bParaAfterInserted) if (bParaBeforeInserted || bParaAfterInserted)
{ {
const uno::Reference<text::XTextCursor> xFrameTextCursor = const uno::Reference<text::XTextCursor> xFrameTextCursor =
pNewFrame->createTextCursor(); rNewFrame.createTextCursor();
const uno::Reference<XUnoTunnel> xTunnel(xFrameTextCursor, const uno::Reference<XUnoTunnel> xTunnel(xFrameTextCursor,
uno::UNO_QUERY); uno::UNO_QUERY);
SwXTextCursor *const pFrameCursor = SwXTextCursor *const pFrameCursor =
......
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