diff options
author | Mark Hung <marklh9@gmail.com> | 2018-01-21 16:41:26 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2018-02-01 00:48:49 +0100 |
commit | 8ed0b54763581ba1f5ff295a59b5b040e7cd8f0f (patch) | |
tree | f3e6e211eba6d05c4bf52727fb2d281d5a1edff3 /sw/source | |
parent | d9efa12addb8fbedbc900081bdcaf9db7fd4cd66 (diff) |
tdf#35301 sw: RubyPosition text property support.
Allow RubyPosition property to be set via UNO
interface.
Change-Id: I506312b1b5b27f016d0ee1c66231ff90747e5538
Reviewed-on: https://gerrit.libreoffice.org/48327
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/inc/unoport.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/txtnode/fmtatr2.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unomapproperties.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unoport.cxx | 3 |
5 files changed, 22 insertions, 0 deletions
diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx index 25239840851f..8f772760dada 100644 --- a/sw/source/core/inc/unoport.hxx +++ b/sw/source/core/inc/unoport.hxx @@ -111,6 +111,7 @@ private: std::unique_ptr< css::uno::Any > m_pRubyStyle; std::unique_ptr< css::uno::Any > m_pRubyAdjust; std::unique_ptr< css::uno::Any > m_pRubyIsAbove; + std::unique_ptr< css::uno::Any > m_pRubyPosition; sw::UnoCursorPointer m_pUnoCursor; const SwDepend m_FrameDepend; diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index 9217779ee7b0..374326f40eb6 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -37,6 +37,7 @@ #include <unostyle.hxx> #include <unoevent.hxx> #include <com/sun/star/text/RubyAdjust.hpp> +#include <com/sun/star/text/RubyPosition.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/util/XCloneable.hpp> @@ -456,6 +457,11 @@ bool SwFormatRuby::QueryValue( uno::Any& rVal, rVal <<= static_cast<bool>(!m_nPosition); } break; + case MID_RUBY_POSITION: + { + rVal <<= static_cast<sal_uInt16>(m_nPosition); + } + break; default: bRet = false; } @@ -491,6 +497,16 @@ bool SwFormatRuby::PutValue( const uno::Any& rVal, } } break; + case MID_RUBY_POSITION: + { + sal_Int16 nSet = 0; + rVal >>= nSet; + if(nSet >= sal_Int16(text::RubyPosition::ABOVE) && nSet <= sal_Int16(text::RubyPosition::INTER_CHARACTER)) + m_nPosition = nSet; + else + bRet = false; + } + break; case MID_RUBY_CHARSTYLE: { OUString sTmp; diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 8a18ddd379f6..c179042102ec 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -156,6 +156,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { { OUString(UNO_NAME_RUBY_ADJUST), RES_TXTATR_CJK_RUBY, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_RUBY_ADJUST }, { OUString(UNO_NAME_RUBY_IS_ABOVE), RES_TXTATR_CJK_RUBY, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, MID_RUBY_ABOVE }, + { OUString(UNO_NAME_RUBY_POSITION), RES_TXTATR_CJK_RUBY, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_RUBY_POSITION }, { OUString(), 0, css::uno::Type(), 0, 0 } }; m_aMapEntriesArr[nPropertyId] = aAutoRubyStyleMap; diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx index b9825ff4a8d2..3881ef17767c 100644 --- a/sw/source/core/unocore/unomapproperties.hxx +++ b/sw/source/core/unocore/unomapproperties.hxx @@ -204,6 +204,7 @@ { OUString(UNO_NAME_RUBY_TEXT), RES_TXTATR_CJK_RUBY, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, MID_RUBY_TEXT }, \ { OUString(UNO_NAME_RUBY_ADJUST), RES_TXTATR_CJK_RUBY, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_RUBY_ADJUST }, \ { OUString(UNO_NAME_RUBY_CHAR_STYLE_NAME), RES_TXTATR_CJK_RUBY, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, MID_RUBY_CHARSTYLE }, \ + { OUString(UNO_NAME_RUBY_POSITION), RES_TXTATR_CJK_RUBY, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_RUBY_POSITION}, \ { OUString(UNO_NAME_RUBY_IS_ABOVE), RES_TXTATR_CJK_RUBY, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, MID_RUBY_ABOVE }, \ { OUString(UNO_NAME_CHAR_RELIEF), RES_CHRATR_RELIEF, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, MID_RELIEF }, \ { OUString(UNO_NAME_SNAP_TO_GRID), RES_PARATR_SNAPTOGRID, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, 0 }, \ diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index 17daea420340..09092d1501d1 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -106,6 +106,7 @@ SwXTextPortion::SwXTextPortion( , m_pRubyStyle ( bIsEnd ? nullptr : new uno::Any ) , m_pRubyAdjust ( bIsEnd ? nullptr : new uno::Any ) , m_pRubyIsAbove( bIsEnd ? nullptr : new uno::Any ) + , m_pRubyPosition( bIsEnd ? nullptr : new uno::Any ) , m_FrameDepend(this, nullptr) , m_pFrameFormat(nullptr) , m_ePortionType( bIsEnd ? PORTION_RUBY_END : PORTION_RUBY_START ) @@ -120,6 +121,7 @@ SwXTextPortion::SwXTextPortion( rItem.QueryValue(*m_pRubyStyle, MID_RUBY_CHARSTYLE); rItem.QueryValue(*m_pRubyAdjust, MID_RUBY_ADJUST); rItem.QueryValue(*m_pRubyIsAbove, MID_RUBY_ABOVE); + rItem.QueryValue(*m_pRubyPosition, MID_RUBY_POSITION); } } @@ -343,6 +345,7 @@ void SwXTextPortion::GetPropertyValue( case MID_RUBY_ADJUST : pToSet = m_pRubyAdjust.get(); break; case MID_RUBY_CHARSTYLE:pToSet = m_pRubyStyle.get(); break; case MID_RUBY_ABOVE : pToSet = m_pRubyIsAbove.get();break; + case MID_RUBY_POSITION: pToSet = m_pRubyPosition.get();break; } if(pToSet) rVal = *pToSet; |