diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-09-22 08:54:58 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-09-22 13:37:23 +0200 |
commit | caea6281967bacd38a9296e6acefe9e5baefc3a4 (patch) | |
tree | 174990ab63b67e0affeca202678d6a6d3abaaea3 /embedserv | |
parent | d80ba7354c8cecd4cba7b92a9f925f2bd0d78dd1 (diff) |
Better not modify const RECTs passed in
...through IOleInPlaceObject::SetObjectRects, via
EmbedDocument_Impl::SetObjectRects
Change-Id: Ia2533822795776d18132a457dc41f80fadb7c809
Reviewed-on: https://gerrit.libreoffice.org/42615
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'embedserv')
-rw-r--r-- | embedserv/source/embed/docholder.cxx | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx index 2998395279c4..929e8d252350 100644 --- a/embedserv/source/embed/docholder.cxx +++ b/embedserv/source/embed/docholder.cxx @@ -1176,24 +1176,26 @@ HRESULT DocumentHolder::SetContRects(LPCRECT aRect) HRESULT DocumentHolder::SetObjectRects(LPCRECT aRect, LPCRECT aClip) { - const_cast<LPRECT>(aRect)->left -= m_aBorder.left; - const_cast<LPRECT>(aRect)->right += m_aBorder.right; - const_cast<LPRECT>(aRect)->top -= m_aBorder.top; - const_cast<LPRECT>(aRect)->bottom += m_aBorder.bottom; - const_cast<LPRECT>(aClip)->left -= m_aBorder.left; - const_cast<LPRECT>(aClip)->right += m_aBorder.right; - const_cast<LPRECT>(aClip)->top -= m_aBorder.top; - const_cast<LPRECT>(aClip)->bottom += m_aBorder.bottom; + auto rect = *aRect; + rect.left -= m_aBorder.left; + rect.right += m_aBorder.right; + rect.top -= m_aBorder.top; + rect.bottom += m_aBorder.bottom; + auto clip = *aClip; + clip.left -= m_aBorder.left; + clip.right += m_aBorder.right; + clip.top -= m_aBorder.top; + clip.bottom += m_aBorder.bottom; if(m_pCHatchWin) - m_pCHatchWin->RectsSet(const_cast<LPRECT>(aRect), const_cast<LPRECT>(aClip)); + m_pCHatchWin->RectsSet(&rect, &clip); if(m_xEditWindow.is()) { m_xEditWindow->setVisible(false); m_xEditWindow->setPosSize( m_pCHatchWin ? HATCHWIN_BORDERWIDTHDEFAULT : 0, m_pCHatchWin ? HATCHWIN_BORDERWIDTHDEFAULT : 0, - aRect->right - aRect->left, - aRect->bottom - aRect->top, + rect.right - rect.left, + rect.bottom - rect.top, awt::PosSize::POSSIZE); m_xEditWindow->setVisible(true); } |