32 #include <unoprnms.hxx>
39 #include <com/sun/star/beans/PropertyAttribute.hpp>
40 #include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
41 #include <com/sun/star/beans/GetPropertyTolerantResult.hpp>
42 #include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
43 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
44 #include <com/sun/star/text/XFootnote.hpp>
45 #include <com/sun/star/text/XTextField.hpp>
64 uno::Reference< text::XText >
const& rParent,
71 , m_xParentText(rParent)
72 , m_pFrameFormat(nullptr)
73 , m_ePortionType(eType)
74 , m_bIsCollapsed(
false)
76 init( pPortionCursor);
81 uno::Reference< text::XText >
const& rParent,
85 , m_xParentText(rParent)
86 , m_pFrameFormat(&rFormat)
88 , m_bIsCollapsed(
false)
91 init( pPortionCursor);
97 uno::Reference< text::XText >
const& xParent,
101 , m_xParentText(xParent)
102 , m_pRubyText ( bIsEnd ? nullptr : new
uno::
Any )
103 , m_pRubyStyle ( bIsEnd ? nullptr : new
uno::
Any )
104 , m_pRubyAdjust ( bIsEnd ? nullptr : new
uno::
Any )
105 , m_pRubyIsAbove( bIsEnd ? nullptr : new
uno::
Any )
106 , m_pRubyPosition( bIsEnd ? nullptr : new
uno::
Any )
107 , m_pFrameFormat(nullptr)
109 , m_bIsCollapsed(
false)
111 init( pPortionCursor);
139 uno::Reference< text::XTextRange > xRet;
143 uno::Reference< text::XText > xParent =
getText();
151 uno::Reference< text::XTextRange > xRet;
155 uno::Reference< text::XText > xParent =
getText();
189 static uno::Reference< beans::XPropertySetInfo >
193 static uno::Reference< beans::XPropertySetInfo >
208 rPropertyName, aValue);
215 std::unique_ptr<SfxItemSet> &pSet )
217 OSL_ENSURE( pUnoCursor,
"UNO cursor missing" );
251 pRet =
"AnnotationEnd";
265 sRet = OUString::createFromAscii( pRet );
321 bool bStart =
true, bPut =
true;
364 beans::PropertyState eTemp;
366 rEntry, *pUnoCursor, &rVal, eTemp );
383 const uno::Sequence< OUString >& rPropertyNames )
385 sal_Int32
nLength = rPropertyNames.getLength();
386 const OUString *pPropertyNames = rPropertyNames.getConstArray();
387 uno::Sequence< uno::Any > aValues(nLength);
392 std::unique_ptr<SfxItemSet> pSet;
396 for(sal_Int32 nProp = 0; nProp < nLength; nProp++)
400 throw beans::UnknownPropertyException(
"Unknown property: " + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > (
this ) );
408 const OUString& rPropertyName)
411 uno::Sequence< OUString > aPropertyNames { rPropertyName };
416 const uno::Sequence< OUString >& rPropertyNames,
417 const uno::Sequence< uno::Any >& rValues )
422 const OUString* pPropertyNames = rPropertyNames.getConstArray();
425 uno::Sequence< beans::PropertyValue > aValues( rPropertyNames.getLength() );
426 auto aValuesRange = asNonConstRange(aValues);
427 for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
431 throw beans::UnknownPropertyException(
"Unknown property: " + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > (
this ) );
432 if ( pEntry->
nFlags & beans::PropertyAttribute::READONLY)
433 throw beans::PropertyVetoException (
"Property is read-only: " + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > (
this ) );
435 aValuesRange[nProp].Name = pPropertyNames[nProp];
436 aValuesRange[nProp].Value = pValues[nProp];
443 const uno::Sequence< OUString >& rPropertyNames,
444 const uno::Sequence< uno::Any >& rValues )
453 catch (
const beans::UnknownPropertyException &rException)
457 lang::WrappedTargetException aWExc;
458 aWExc.TargetException <<= rException;
464 const uno::Sequence< OUString >& rPropertyNames )
467 uno::Sequence< uno::Any > aValues;
474 catch (beans::UnknownPropertyException &)
477 throw lang::WrappedTargetRuntimeException(
"Unknown property exception caught",
478 static_cast < cppu::OWeakObject * > (
this ), anyEx );
480 catch (lang::WrappedTargetException &)
483 throw lang::WrappedTargetRuntimeException(
"WrappedTargetException caught",
484 static_cast < cppu::OWeakObject * > (
this ), anyEx );
492 const uno::Sequence< OUString >& rPropertyNames,
493 const uno::Sequence< uno::Any >& rValues )
497 if (rPropertyNames.getLength() != rValues.getLength())
498 throw lang::IllegalArgumentException();
501 sal_Int32 nProps = rPropertyNames.getLength();
502 const OUString *pProp = rPropertyNames.getConstArray();
505 const uno::Any *pValue = rValues.getConstArray();
507 sal_Int32 nFailed = 0;
508 uno::Sequence< beans::SetPropertyTolerantFailed > aFailed( nProps );
509 beans::SetPropertyTolerantFailed *pFailed = aFailed.getArray();
513 for (sal_Int32
i = 0;
i < nProps; ++
i)
517 pFailed[ nFailed ].Name = pProp[
i];
521 pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
526 if (pEntry->
nFlags & beans::PropertyAttribute::READONLY)
527 pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
531 rUnoCursor, *
m_pPropSet, pProp[i], pValue[i] );
535 catch (beans::UnknownPropertyException &)
539 pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
541 catch (lang::IllegalArgumentException &)
543 pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
545 catch (beans::PropertyVetoException &)
547 pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
549 catch (lang::WrappedTargetException &)
551 pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET;
555 aFailed.realloc( nFailed );
560 const uno::Sequence< OUString >& rPropertyNames )
564 const uno::Sequence< beans::GetDirectPropertyTolerantResult > aTmpRes(
568 sal_Int32 nLen = aTmpRes.getLength();
569 uno::Sequence< beans::GetPropertyTolerantResult > aRes( nLen );
570 std::copy(aTmpRes.begin(), aTmpRes.end(), aRes.getArray());
575 const uno::Sequence< OUString >& rPropertyNames )
582 const uno::Sequence< OUString >& rPropertyNames,
583 bool bDirectValuesOnly )
589 std::vector< beans::GetDirectPropertyTolerantResult > aResultVector;
593 sal_Int32 nProps = rPropertyNames.getLength();
594 const OUString *pProp = rPropertyNames.getConstArray();
596 std::unique_ptr<SfxItemSet> pSet;
601 uno::Sequence< beans::PropertyState > aPropertyStates =
606 const beans::PropertyState* pPropertyStates = aPropertyStates.getConstArray();
608 for (sal_Int32
i = 0;
i < nProps; ++
i)
610 beans::GetDirectPropertyTolerantResult aResult;
613 aResult.Name = pProp[
i];
614 if(pPropertyStates[
i] == beans::PropertyState::PropertyState_MAKE_FIXED_SIZE)
616 if( bDirectValuesOnly )
619 aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
625 throw beans::UnknownPropertyException(
"Unknown property: " + pProp[i], static_cast < cppu::OWeakObject * > (
this ) );
626 aResult.State = pPropertyStates[i];
628 aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_FAILURE;
633 aResult.State = beans::PropertyState_DIRECT_VALUE;
635 if (!bDirectValuesOnly || beans::PropertyState_DIRECT_VALUE == aResult.State)
640 aResult.Result = beans::TolerantPropertySetResultType::SUCCESS;
641 aResultVector.push_back( aResult );
645 catch (
const beans::UnknownPropertyException &)
649 aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
651 catch (
const lang::IllegalArgumentException &)
653 aResult.Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
655 catch (
const beans::PropertyVetoException &)
657 aResult.Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
659 catch (
const lang::WrappedTargetException &)
661 aResult.Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET;
665 catch (
const uno::RuntimeException&)
669 catch (
const uno::Exception& e)
672 throw css::lang::WrappedTargetRuntimeException(
673 "wrapped Exception " + e.Message,
674 css::uno::Reference<css::uno::XInterface>(), a);
681 const uno::Sequence< OUString >& ,
682 const uno::Reference< beans::XPropertiesChangeListener >& )
686 const uno::Reference< beans::XPropertiesChangeListener >& )
690 const uno::Sequence< OUString >& ,
691 const uno::Reference< beans::XPropertiesChangeListener >& )
696 const uno::Reference< beans::XPropertyChangeListener > & )
698 OSL_FAIL(
"not implemented");
703 OSL_FAIL(
"not implemented");
708 OSL_FAIL(
"not implemented");
713 OSL_FAIL(
"not implemented");
719 beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
723 rPropertyName.startsWith(
"Ruby"))
725 eRet = beans::PropertyState_DIRECT_VALUE;
736 const uno::Sequence< OUString >& rPropertyNames)
741 uno::Sequence< beans::PropertyState > aRet =
747 const OUString* pNames = rPropertyNames.getConstArray();
748 beans::PropertyState* pStates = aRet.getArray();
749 for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength();nProp++)
751 if (pNames[nProp].startsWith(
"Ruby"))
752 pStates[nProp] = beans::PropertyState_DIRECT_VALUE;
789 return theSwXTextPortionUnoTunnelId.
getSeq();
799 return {
"com.sun.star.text.TextContent" };
804 return {
"SwXTextPortion" };
814 return {
"com.sun.star.text.TextPortion",
815 "com.sun.star.style.CharacterProperties",
816 "com.sun.star.style.CharacterPropertiesAsian",
817 "com.sun.star.style.CharacterPropertiesComplex",
818 "com.sun.star.style.ParagraphProperties",
819 "com.sun.star.style.ParagraphPropertiesAsian",
820 "com.sun.star.style.ParagraphPropertiesComplex" };
825 if(rHint.
GetId() == SfxHintId::Dying)
std::shared_ptr< SwUnoCursor > CreateUnoCursor(const SwPosition &rPos, bool bTableCursor=false)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN)
std::unique_ptr< css::uno::Any > m_pRubyPosition
SwNode & GetNode(bool bPoint=true) const
#define UNO_NAME_BOOKMARK
#define FN_UNO_DOCUMENT_INDEX_MARK
bool getCursorPropertyValue(const SfxItemPropertyMapEntry &rEntry, SwPaM &rPam, Any *pAny, PropertyState &eState, const SwTextNode *pNode)
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override
sw::UnoCursorPointer m_pUnoCursor
#define FN_UNO_TEXT_PORTION_TYPE
#define FN_UNO_CONTROL_CHARACTER
#define MID_RUBY_CHARSTYLE
void GetPropertyValue(css::uno::Any &rVal, const SfxItemPropertyMapEntry &rEntry, SwUnoCursor *pUnoCursor, std::unique_ptr< SfxItemSet > &pSet)
const SwPosition * GetMark() const
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
constexpr sal_uInt16 RES_FRMATR_END(133)
virtual css::uno::Sequence< css::beans::SetPropertyTolerantFailed > SAL_CALL setPropertyValuesTolerant(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues) override
std::unique_ptr< css::uno::Any > m_pRubyStyle
css::uno::Reference< css::text::XTextField > m_xTextField
#define UNO_NAME_REFERENCE_MARK
void SetPropertyValues(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const css::uno::Sequence< css::beans::PropertyValue > &rPropertyValues, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
css::uno::Any GetPropertyDefault(SwPaM const &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
SwXTextPortion(const SwUnoCursor *pPortionCursor, css::uno::Reference< css::text::XText > const &rParent, SwTextPortionType eType)
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
virtual void SAL_CALL removePropertiesChangeListener(const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues) override
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
const SwTextPortionType m_ePortionType
void SetString(SwCursor &rCursor, const OUString &rString)
css::uno::Reference< css::text::XTextContent > m_xRefMark
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
void GetCursorAttr(SwPaM &rPam, SfxItemSet &rSet, const bool bOnlyTextAttr=false, const bool bGetFromChrFormat=true)
Any SAL_CALL getCaughtException()
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
#define UNO_NAME_DOCUMENT_INDEX_MARK
SwFrameFormat * m_pFrameFormat
void getPropertyValue(const SfxItemPropertyMapEntry &rEntry, const SfxItemSet &rSet, css::uno::Any &rAny) const
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::unique_ptr< css::uno::Any > m_pRubyText
const css::uno::Reference< css::text::XText > m_xParentText
constexpr TypedWhichId< SwFormatRuby > RES_TXTATR_CJK_RUBY(53)
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
css::uno::Reference< css::text::XTextContent > m_xTOXMark
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
css::uno::Sequence< css::beans::GetDirectPropertyTolerantResult > GetPropertyValuesTolerant_Impl(const css::uno::Sequence< OUString > &rPropertyNames, bool bDirectValuesOnly)
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
css::uno::Reference< css::text::XTextContent > m_xBookmark
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
#define FN_UNO_IS_COLLAPSED
#define UNO_NAME_CONTENT_CONTROL
virtual void Notify(const SfxHint &rHint) override
const css::uno::Sequence< sal_Int8 > & getSeq() const
void SetPropertyToDefault(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
PaM is Point and Mark: a selection of the document model.
#define TOOLS_WARN_EXCEPTION(area, stream)
const SwPosition * GetPoint() const
css::uno::Sequence< css::uno::Any > GetPropertyValues_Impl(const css::uno::Sequence< OUString > &aPropertyNames)
#define FN_UNO_CONTENT_CONTROL
void SetPropertyValues_Impl(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues)
virtual css::uno::Sequence< css::beans::GetPropertyTolerantResult > SAL_CALL getPropertyValuesTolerant(const css::uno::Sequence< OUString > &aPropertyNames) override
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
const SfxItemPropertyMap & getPropertyMap() const
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
bool StartListening(SvtBroadcaster &rBroadcaster)
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
const SwPosition * Start() const
void init(const SwUnoCursor *pPortionCursor)
SvtBroadcaster & GetNotifier()
#define FN_UNO_TEXT_FIELD
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
const PropertyValue * pValues
SwTextNode is a paragraph in the document model.
css::uno::Reference< css::text::XTextContent > m_xLineBreak
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames) override
OUString GetExpandText(SwRootFrame const *pLayout, const sal_Int32 nIdx=0, const sal_Int32 nLen=-1, const bool bWithNum=false, const bool bAddSpaceAfterListLabelStr=false, const bool bWithSpacesForLevel=false, const ExpandMode eAdditionalMode=ExpandMode::ExpandFootnote) const
add 4th optional parameter indicating, when that a spa...
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &aPropertyName) override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createContentEnumeration(const OUString &aServiceName) override
void reset(std::shared_ptr< SwUnoCursor > pNew)
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
css::uno::Reference< css::text::XTextContent > m_xMeta
css::uno::Sequence< css::beans::PropertyState > GetPropertyStates(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const css::uno::Sequence< OUString > &rPropertyNames, const SwGetPropertyStatesCaller eCaller=SW_PROPERTY_STATE_CALLER_DEFAULT)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
#define FN_UNO_REFERENCE_MARK
sal_Int32 GetIndex() const
void SetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName, const css::uno::Any &rValue, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
SwUnoCursor & GetCursor() const
const SwPosition * End() const
virtual OUString SAL_CALL getString() override
SwUnoPropertyMapProvider aSwMapProvider
css::uno::Reference< css::text::XFootnote > m_xFootnote
static rtl::Reference< SwXParaFrameEnumeration > Create(const SwPaM &rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat *const pFormat=nullptr)
virtual css::uno::Sequence< css::beans::GetDirectPropertyTolerantResult > SAL_CALL getDirectPropertyValuesTolerant(const css::uno::Sequence< OUString > &aPropertyNames) override
virtual void SAL_CALL firePropertiesChangeEvent(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
#define PROPERTY_MAP_REDLINE_PORTION
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
const SfxPoolItem & GetAttr() const
virtual ~SwXTextPortion() override
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
css::beans::PropertyState GetPropertyState(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName)
std::unique_ptr< css::uno::Any > m_pRubyAdjust
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
const SfxItemPropertySet * m_pPropSet
virtual void SAL_CALL addPropertiesChangeListener(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
#define PROPERTY_MAP_TEXTPORTION_EXTENSIONS
SwTextPortionType GetTextPortionType() const
css::uno::Reference< css::text::XTextContent > m_xContentControl
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL setString(const OUString &aString) override
const SwAttrPool & GetAttrPool() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
#define MID_RUBY_POSITION
std::unique_ptr< css::uno::Any > m_pRubyIsAbove
bool m_bDetectedRangeSegmentation false