diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-11-18 09:05:12 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-11-18 09:05:33 +0100 |
commit | 2608512056b706bab57e36765e15f5c00668577a (patch) | |
tree | 57950007dfd0db0e8d7b35213bc4f88e8514c22e /sw/source/core | |
parent | dca29d672a7a908972fa2735a44fa51fc75c2e93 (diff) |
fdo#86131 SwXTextField::getAnchor: handle postit field with annotation mark
Change-Id: I3881c4577375a2eda053f64800d0991de6f009ad
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/unocore/unofield.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index fce4fffb3a08..07a996cef162 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -2078,6 +2078,20 @@ SwXTextField::getAnchor() throw (uno::RuntimeException, std::exception) if (pPamForTxtFld.get() == NULL) return 0; + // If this is a postit field, then return the range of its annotation mark if it has one. + if (const SwPostItField* pPostItField = dynamic_cast<const SwPostItField*>(pField)) + { + IDocumentMarkAccess* pMarkAccess = m_pImpl->m_pDoc->getIDocumentMarkAccess(); + for (IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAnnotationMarksBegin(); ppMark != pMarkAccess->getAnnotationMarksEnd(); ++ppMark) + { + if (ppMark->get()->GetName() == pPostItField->GetName()) + { + pPamForTxtFld.reset(new SwPaM(ppMark->get()->GetMarkStart(), ppMark->get()->GetMarkEnd())); + break; + } + } + } + uno::Reference<text::XTextRange> xRange = SwXTextRange::CreateXTextRange( *m_pImpl->m_pDoc, *(pPamForTxtFld->GetPoint()), pPamForTxtFld->GetMark()); return xRange; |