[Libreoffice-commits] core.git: sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Feb 6 16:27:39 UTC 2019
sw/source/core/unocore/unodraw.cxx | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
New commits:
commit 70e9a35b575ba29431a421ec01af6298dfc57377
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Feb 6 14:53:55 2019 +0100
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Feb 6 17:27:14 2019 +0100
Remove useless const_cast
Change-Id: I3f8fa4bafd5b3ff5eb549076db16cb73a5dde7e0
Reviewed-on: https://gerrit.libreoffice.org/67458
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 2b59d3ef2008..03c556a5422c 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -2022,7 +2022,7 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
// get access to SwDoc
// (see also SwXTextRange::XTextRangeToSwPaM)
- SwDoc* pDoc = nullptr;
+ const SwDoc* pDoc = nullptr;
uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
if(xRangeTunnel.is())
{
@@ -2045,28 +2045,22 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
if (pRange)
pDoc = &pRange->GetDoc();
- else if (!pDoc && pText)
+ else if (pText)
pDoc = pText->GetDoc();
- else if (!pDoc && pCursor)
+ else if (pCursor)
pDoc = pCursor->GetDoc();
- else if ( !pDoc && pPortion )
- {
+ else if (pPortion)
pDoc = pPortion->GetCursor().GetDoc();
- }
- else if ( !pDoc && pParagraph && pParagraph->GetTextNode( ) )
- {
- pDoc = const_cast<SwDoc*>(pParagraph->GetTextNode()->GetDoc());
- }
+ else if (pParagraph && pParagraph->GetTextNode())
+ pDoc = pParagraph->GetTextNode()->GetDoc();
}
if(!pDoc)
throw uno::RuntimeException();
- SwDocShell *pDocSh = pDoc->GetDocShell();
- if (pDocSh)
+ if (const SwDocShell* pDocSh = pDoc->GetDocShell())
{
- uno::Reference< frame::XModel > xModel;
- xModel = pDocSh->GetModel();
+ uno::Reference<frame::XModel> xModel = pDocSh->GetModel();
uno::Reference< drawing::XDrawPageSupplier > xDPS(xModel, uno::UNO_QUERY);
if (xDPS.is())
{
More information about the Libreoffice-commits
mailing list