diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-07-27 13:59:01 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-08-24 11:11:16 +0200 |
commit | f8f9c0f50c99ec554584014a10e30b69d50b0fc8 (patch) | |
tree | 3587af42cdce7162d3d65cb401c311530d5adb76 /sw/source/core | |
parent | 98525094d44ceff0794cfb36c5494a7bd50c26a0 (diff) |
sw: add new TextParagraph property to XTextRange
A text range represents a selection or cursor position, so similar to
sections or tables, it makes sense to expose the containing paragraph as
well. This new property does exactly that.
Reviewed-on: https://gerrit.libreoffice.org/40483
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit 7ed402ba648dd0f3de3b0dadebc13403b2c0a620)
Conflicts:
sw/qa/extras/uiwriter/uiwriter.cxx
Change-Id: If92a3b5e61f13c7c14ca52bc8593a2b286a596cc
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/unocore/unocrsrhelper.cxx | 13 | ||||
-rw-r--r-- | sw/source/core/unocore/unomapproperties.hxx | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 22b41fed67fc..83646a892b97 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -85,6 +85,7 @@ #include <SwNodeNum.hxx> #include <fmtmeta.hxx> #include <txtfld.hxx> +#include <unoparagraph.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -592,6 +593,18 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry eNewState = PropertyState_DEFAULT_VALUE; } break; + case FN_UNO_TEXT_PARAGRAPH: + { + SwTextNode* pTextNode = rPam.GetPoint()->nNode.GetNode().GetTextNode(); + if (pTextNode) + { + uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(*pTextNode->GetDoc(), pTextNode); + *pAny <<= xParagraph; + } + else + eNewState = PropertyState_DEFAULT_VALUE; + } + break; case FN_UNO_ENDNOTE: case FN_UNO_FOOTNOTE: { diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx index 1f528f0ba596..8580ba0c8805 100644 --- a/sw/source/core/unocore/unomapproperties.hxx +++ b/sw/source/core/unocore/unomapproperties.hxx @@ -87,6 +87,7 @@ { OUString(UNO_NAME_CELL), FN_UNO_CELL, cppu::UnoType<css::table::XCell>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \ { OUString(UNO_NAME_TEXT_FRAME), FN_UNO_TEXT_FRAME, cppu::UnoType<css::text::XTextFrame>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \ { OUString(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, cppu::UnoType<css::text::XTextSection>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \ + { OUString(UNO_NAME_TEXT_PARAGRAPH), FN_UNO_TEXT_PARAGRAPH, cppu::UnoType<css::text::XTextContent>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \ { OUString(UNO_NAME_PARA_CHAPTER_NUMBERING_LEVEL), FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL,cppu::UnoType<sal_Int8>::get(), PROPERTY_NONE, 0}, \ { OUString(UNO_NAME_PARA_CONDITIONAL_STYLE_NAME), FN_UNO_PARA_CONDITIONAL_STYLE_NAME, cppu::UnoType<OUString>::get(), PropertyAttribute::READONLY, 0}, \ { OUString(UNO_NAME_LIST_ID), FN_UNO_LIST_ID, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, \ |