diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-03-03 13:17:39 +0530 |
---|---|---|
committer | Pranav Kant <pranavk@collabora.co.uk> | 2017-03-23 20:29:33 +0530 |
commit | 98de85d176fe2a8d77ea55e1f972d92722c5c471 (patch) | |
tree | 389f86aa610a2117c15d7f337af4b8ff2e3c011f /sw | |
parent | 27c0e2b48fb01d1916134d72c3ee0e2dbf650510 (diff) |
lok: Create change tracking position too
We want to expose change tracking comments to lok clients also. For
this, lok clients needs to know the position in the document where the
comment should be shown.
Change-Id: I38794387cef3d11b5e0c1cfd0967408d8e54ded3
Reviewed-on: https://gerrit.libreoffice.org/34949
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: pranavk <pranavk@collabora.co.uk>
(cherry picked from commit 9582fae07e9ea2df20a7265c62402180995c57da)
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index fe20071a3441..868fd19e595a 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -28,6 +28,7 @@ #include <editeng/udlnitem.hxx> #include <editeng/crossedoutitem.hxx> #include <comphelper/lok.hxx> +#include <comphelper/string.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <unotools/datetime.hxx> #include <sfx2/viewsh.hxx> @@ -49,11 +50,13 @@ #include <hints.hxx> #include <pamtyp.hxx> #include <poolfmt.hxx> +#include <view.hxx> #include <viewsh.hxx> +#include <viscrs.hxx> #include <rootfrm.hxx> - #include <comcore.hrc> #include <unoport.hxx> +#include <wrtsh.hxx> using namespace com::sun::star; @@ -317,6 +320,29 @@ static void lcl_RedlineNotification(RedlineNotification nType, size_t nPos, SwRa aRedline.put("description", pRedline->GetDescr().toUtf8().getStr()); OUString sDateTime = utl::toISO8601(pRedline->GetRedlineData().GetTimeStamp().GetUNODateTime()); aRedline.put("dateTime", sDateTime.toUtf8().getStr()); + + SwPosition* pStartPos = pRedline->Start(); + SwPosition* pEndPos = pRedline->End(); + SwContentNode* pContentNd = pRedline->GetContentNode(); + SwView* pView = dynamic_cast<SwView*>(SfxViewShell::Current()); + if (pView && pContentNd) + { + std::unique_ptr<SwShellCursor> pCursor(new SwShellCursor(pView->GetWrtShell(), *pStartPos)); + pCursor->SetMark(); + pCursor->GetMark()->nNode = *pContentNd; + pCursor->GetMark()->nContent.Assign(pContentNd, pEndPos->nContent.GetIndex()); + + pCursor->FillRects(); + + SwRects* pRects(pCursor.get()); + std::vector<OString> aRects; + for(SwRect& rNextRect : *pRects) + aRects.push_back(rNextRect.SVRect().toString()); + + const OString sRects = comphelper::string::join("; ", aRects); + aRedline.put("textRange", sRects.getStr()); + } + boost::property_tree::ptree aTree; aTree.add_child("redline", aRedline); std::stringstream aStream; @@ -1788,4 +1814,3 @@ SwTableCellRedline::~SwTableCellRedline() } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - |