33#include <unoprnms.hxx>
40#include <com/sun/star/beans/PropertyAttribute.hpp>
41#include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
42#include <com/sun/star/beans/GetPropertyTolerantResult.hpp>
43#include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
44#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
45#include <com/sun/star/text/XFootnote.hpp>
46#include <com/sun/star/text/XTextField.hpp>
65 uno::Reference< text::XText > xParent,
72 , m_xParentText(
std::move(xParent))
73 , m_pFrameFormat(nullptr)
75 , m_bIsCollapsed(false)
76 , m_bIsListAutoFormat(false)
82 init( pPortionCursor);
87 uno::Reference< text::XText > xParent,
91 , m_xParentText(
std::move(xParent))
92 , m_pFrameFormat(&rFormat)
94 , m_bIsCollapsed(false)
95 , m_bIsListAutoFormat(false)
98 init( pPortionCursor);
104 uno::Reference< text::XText > xParent,
108 , m_xParentText(
std::move(xParent))
109 , m_pFrameFormat(nullptr)
111 , m_bIsCollapsed(false)
112 , m_bIsListAutoFormat(false)
122 init( pPortionCursor);
150 uno::Reference< text::XTextRange > xRet;
154 uno::Reference< text::XText > xParent =
getText();
162 uno::Reference< text::XTextRange > xRet;
166 uno::Reference< text::XText > xParent =
getText();
201 static uno::Reference< beans::XPropertySetInfo >
205 static uno::Reference< beans::XPropertySetInfo >
220 rPropertyName, aValue);
227 std::unique_ptr<SfxItemSet> &pSet )
229 static constexpr OUStringLiteral
TEXT =
u"Text";
230 static constexpr OUStringLiteral
TEXTFIELD =
u"TextField";
231 static constexpr OUStringLiteral
FRAME =
u"Frame";
232 static constexpr OUStringLiteral
FOOTNOTE =
u"Footnote";
233 static constexpr OUStringLiteral
REDLINE =
u"Redline";
234 static constexpr OUStringLiteral
RUBY =
u"Ruby";
235 static constexpr OUStringLiteral SOFTPAGEBREAK =
u"SoftPageBreak";
236 static constexpr OUStringLiteral TEXTFIELDSTART =
u"TextFieldStart";
237 static constexpr OUStringLiteral TEXTFIELDSEPARATOR =
u"TextFieldSeparator";
238 static constexpr OUStringLiteral TEXTFIELDEND =
u"TextFieldEnd";
239 static constexpr OUStringLiteral TEXTFIELDSTARTEND =
u"TextFieldStartEnd";
240 static constexpr OUStringLiteral
ANNOTATION =
u"Annotation";
241 static constexpr OUStringLiteral ANNOTATIONEND =
u"AnnotationEnd";
242 static constexpr OUStringLiteral
LINEBREAK =
u"LineBreak";
244 OSL_ENSURE( pUnoCursor,
"UNO cursor missing" );
336 bool bStart =
true, bPut =
true;
365 const std::optional<uno::Any>* pToSet =
nullptr;
374 if(pToSet && *pToSet)
379 beans::PropertyState eTemp;
384 std::shared_ptr<SfxItemSet> pListSet
395 rEntry, *pUnoCursor, &rVal, eTemp );
413 const uno::Sequence< OUString >& rPropertyNames )
415 sal_Int32
nLength = rPropertyNames.getLength();
416 const OUString *pPropertyNames = rPropertyNames.getConstArray();
417 uno::Sequence< uno::Any > aValues(
nLength);
422 std::unique_ptr<SfxItemSet> pSet;
426 for(sal_Int32 nProp = 0; nProp <
nLength; nProp++)
430 throw beans::UnknownPropertyException(
"Unknown property: " + pPropertyNames[nProp],
static_cast < cppu::OWeakObject *
> (
this ) );
438 const OUString& rPropertyName)
441 uno::Sequence< OUString > aPropertyNames { rPropertyName };
446 const uno::Sequence< OUString >& rPropertyNames,
447 const uno::Sequence< uno::Any >& rValues )
449 if (rPropertyNames.getLength() != rValues.getLength())
450 throw lang::IllegalArgumentException(
"lengths do not match",
456 const OUString* pPropertyNames = rPropertyNames.getConstArray();
459 uno::Sequence< beans::PropertyValue > aValues( rPropertyNames.getLength() );
460 auto aValuesRange = asNonConstRange(aValues);
461 for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
465 throw beans::UnknownPropertyException(
"Unknown property: " + pPropertyNames[nProp],
static_cast < cppu::OWeakObject *
> (
this ) );
466 if ( pEntry->
nFlags & beans::PropertyAttribute::READONLY)
467 throw beans::PropertyVetoException (
"Property is read-only: " + pPropertyNames[nProp],
static_cast < cppu::OWeakObject *
> (
this ) );
469 aValuesRange[nProp].Name = pPropertyNames[nProp];
470 aValuesRange[nProp].Value =
pValues[nProp];
477 const uno::Sequence< OUString >& rPropertyNames,
478 const uno::Sequence< uno::Any >& rValues )
487 catch (
const beans::UnknownPropertyException &rException)
491 lang::WrappedTargetException aWExc;
492 aWExc.TargetException <<= rException;
498 const uno::Sequence< OUString >& rPropertyNames )
501 uno::Sequence< uno::Any > aValues;
508 catch (beans::UnknownPropertyException &)
511 throw lang::WrappedTargetRuntimeException(
"Unknown property exception caught",
514 catch (lang::WrappedTargetException &)
517 throw lang::WrappedTargetRuntimeException(
"WrappedTargetException caught",
526 const uno::Sequence< OUString >& rPropertyNames,
527 const uno::Sequence< uno::Any >& rValues )
531 if (rPropertyNames.getLength() != rValues.getLength())
532 throw lang::IllegalArgumentException();
535 sal_Int32 nProps = rPropertyNames.getLength();
536 const OUString *pProp = rPropertyNames.getConstArray();
539 const uno::Any *pValue = rValues.getConstArray();
541 sal_Int32 nFailed = 0;
542 uno::Sequence< beans::SetPropertyTolerantFailed > aFailed( nProps );
543 beans::SetPropertyTolerantFailed *pFailed = aFailed.getArray();
547 for (sal_Int32
i = 0;
i < nProps; ++
i)
551 pFailed[ nFailed ].Name = pProp[
i];
555 pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
560 if (pEntry->
nFlags & beans::PropertyAttribute::READONLY)
561 pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
569 catch (beans::UnknownPropertyException &)
573 pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
575 catch (lang::IllegalArgumentException &)
577 pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
579 catch (beans::PropertyVetoException &)
581 pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
583 catch (lang::WrappedTargetException &)
585 pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET;
589 aFailed.realloc( nFailed );
594 const uno::Sequence< OUString >& rPropertyNames )
598 const uno::Sequence< beans::GetDirectPropertyTolerantResult > aTmpRes(
602 sal_Int32 nLen = aTmpRes.getLength();
603 uno::Sequence< beans::GetPropertyTolerantResult > aRes( nLen );
604 std::copy(aTmpRes.begin(), aTmpRes.end(), aRes.getArray());
609 const uno::Sequence< OUString >& rPropertyNames )
616 const uno::Sequence< OUString >& rPropertyNames,
617 bool bDirectValuesOnly )
623 std::vector< beans::GetDirectPropertyTolerantResult > aResultVector;
627 sal_Int32 nProps = rPropertyNames.getLength();
628 const OUString *pProp = rPropertyNames.getConstArray();
630 std::unique_ptr<SfxItemSet> pSet;
635 uno::Sequence< beans::PropertyState > aPropertyStates;
639 std::shared_ptr<SfxItemSet> pListSet
643 std::vector<beans::PropertyState> aStates;
644 for (
const auto& rPropertyName : rPropertyNames)
651 if (!aPropertyStates.hasElements())
659 const beans::PropertyState* pPropertyStates = aPropertyStates.getConstArray();
661 for (sal_Int32
i = 0;
i < nProps; ++
i)
663 beans::GetDirectPropertyTolerantResult aResult;
666 aResult.Name = pProp[
i];
667 if(pPropertyStates[
i] == beans::PropertyState::PropertyState_MAKE_FIXED_SIZE)
669 if( bDirectValuesOnly )
672 aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
678 throw beans::UnknownPropertyException(
"Unknown property: " + pProp[
i],
static_cast < cppu::OWeakObject *
> (
this ) );
679 aResult.State = pPropertyStates[
i];
681 aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_FAILURE;
686 aResult.State = beans::PropertyState_DIRECT_VALUE;
688 if (!bDirectValuesOnly || beans::PropertyState_DIRECT_VALUE == aResult.State)
693 aResult.Result = beans::TolerantPropertySetResultType::SUCCESS;
694 aResultVector.push_back( aResult );
698 catch (
const beans::UnknownPropertyException &)
702 aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
704 catch (
const lang::IllegalArgumentException &)
706 aResult.Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
708 catch (
const beans::PropertyVetoException &)
710 aResult.Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
712 catch (
const lang::WrappedTargetException &)
714 aResult.Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET;
718 catch (
const uno::RuntimeException&)
722 catch (
const uno::Exception& e)
725 throw css::lang::WrappedTargetRuntimeException(
726 "wrapped Exception " + e.Message,
727 css::uno::Reference<css::uno::XInterface>(),
a);
734 const uno::Sequence< OUString >& ,
735 const uno::Reference< beans::XPropertiesChangeListener >& )
739 const uno::Reference< beans::XPropertiesChangeListener >& )
743 const uno::Sequence< OUString >& ,
744 const uno::Reference< beans::XPropertiesChangeListener >& )
749 const uno::Reference< beans::XPropertyChangeListener > & )
751 OSL_FAIL(
"not implemented");
756 OSL_FAIL(
"not implemented");
761 OSL_FAIL(
"not implemented");
766 OSL_FAIL(
"not implemented");
772 beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
776 rPropertyName.startsWith(
"Ruby"))
778 eRet = beans::PropertyState_DIRECT_VALUE;
789 const uno::Sequence< OUString >& rPropertyNames)
794 uno::Sequence< beans::PropertyState > aRet =
800 const OUString* pNames = rPropertyNames.getConstArray();
801 beans::PropertyState* pStates = aRet.getArray();
802 for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength();nProp++)
804 if (pNames[nProp].startsWith(
"Ruby"))
805 pStates[nProp] = beans::PropertyState_DIRECT_VALUE;
841 return {
"com.sun.star.text.TextContent" };
846 return {
"SwXTextPortion" };
856 return {
"com.sun.star.text.TextPortion",
857 "com.sun.star.style.CharacterProperties",
858 "com.sun.star.style.CharacterPropertiesAsian",
859 "com.sun.star.style.CharacterPropertiesComplex",
860 "com.sun.star.style.ParagraphProperties",
861 "com.sun.star.style.ParagraphPropertiesAsian",
862 "com.sun.star.style.ParagraphPropertiesComplex" };
867 if(rHint.
GetId() == SfxHintId::Dying)
const PropertyValue * pValues
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
css::beans::PropertyState getPropertyState(const OUString &rName, const SfxItemSet &rSet) const
const SfxItemPropertyMap & getPropertyMap() const
void getPropertyValue(const SfxItemPropertyMapEntry &rEntry, const SfxItemSet &rSet, css::uno::Any &rAny) const
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
bool StartListening(SvtBroadcaster &rBroadcaster)
std::shared_ptr< SwUnoCursor > CreateUnoCursor(const SwPosition &rPos, bool bTableCursor=false)
const SwAttrPool & GetAttrPool() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
SwNode & GetPointNode() const
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
const SwPosition * End() const
const SwPosition * GetPoint() const
const SwPosition * Start() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
const SfxPoolItem & GetAttr() const
SwTextNode is a paragraph in the document model.
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|ExpandMode::HideFieldmarkCommands) const
add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating, when <bWithNum = true> that a spa...
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
End: Data collected during idle time.
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
const SwTextPortionType m_ePortionType
virtual css::uno::Sequence< css::beans::GetPropertyTolerantResult > SAL_CALL getPropertyValuesTolerant(const css::uno::Sequence< OUString > &aPropertyNames) override
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
SwUnoCursor & GetCursor() const
SwTextPortionType GetTextPortionType() const
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &aPropertyName) override
css::uno::Reference< css::text::XTextContent > m_xRefMark
void init(const SwUnoCursor *pPortionCursor)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
virtual void SAL_CALL removePropertiesChangeListener(const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
SwFrameFormat * m_pFrameFormat
std::optional< css::uno::Any > m_oRubyPosition
css::uno::Reference< css::text::XTextContent > m_xBookmark
css::uno::Reference< css::text::XTextContent > m_xMeta
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual void SAL_CALL addPropertiesChangeListener(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
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
css::uno::Reference< css::text::XTextContent > m_xTOXMark
bool m_bIsListAutoFormat
Expose the paragraph's RES_PARATR_LIST_AUTOFMT, not the char props of the underlying (empty) text.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
SwXTextPortion(const SwUnoCursor *pPortionCursor, css::uno::Reference< css::text::XText > xParent, SwTextPortionType eType)
virtual OUString SAL_CALL getImplementationName() override
void GetPropertyValue(css::uno::Any &rVal, const SfxItemPropertyMapEntry &rEntry, SwUnoCursor *pUnoCursor, std::unique_ptr< SfxItemSet > &pSet)
const css::uno::Reference< css::text::XText > m_xParentText
virtual void SAL_CALL firePropertiesChangeEvent(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
css::uno::Reference< css::text::XTextContent > m_xLineBreak
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues) override
virtual OUString SAL_CALL getString() override
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
std::optional< css::uno::Any > m_oRubyAdjust
std::optional< css::uno::Any > m_oRubyIsAbove
css::uno::Reference< css::text::XFootnote > m_xFootnote
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
std::optional< css::uno::Any > m_oRubyStyle
css::uno::Reference< css::text::XTextField > m_xTextField
virtual void SAL_CALL setString(const OUString &aString) override
const SfxItemPropertySet * m_pPropSet
void SetPropertyValues_Impl(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues)
css::uno::Sequence< css::uno::Any > GetPropertyValues_Impl(const css::uno::Sequence< OUString > &aPropertyNames)
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
css::uno::Sequence< css::beans::GetDirectPropertyTolerantResult > GetPropertyValuesTolerant_Impl(const css::uno::Sequence< OUString > &rPropertyNames, bool bDirectValuesOnly)
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Sequence< css::beans::GetDirectPropertyTolerantResult > SAL_CALL getDirectPropertyValuesTolerant(const css::uno::Sequence< OUString > &aPropertyNames) override
virtual void Notify(const SfxHint &rHint) override
virtual ~SwXTextPortion() override
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createContentEnumeration(const OUString &aServiceName) override
std::optional< css::uno::Any > m_oRubyText
css::uno::Reference< css::text::XTextContent > m_xContentControl
sw::UnoCursorPointer m_pUnoCursor
void reset(std::shared_ptr< SwUnoCursor > pNew)
#define FN_UNO_TEXT_PORTION_TYPE
#define FN_UNO_CONTROL_CHARACTER
#define FN_UNO_CONTENT_CONTROL
#define FN_UNO_REFERENCE_MARK
#define FN_UNO_IS_COLLAPSED
#define FN_UNO_DOCUMENT_INDEX_MARK
#define FN_UNO_TEXT_FIELD
#define TOOLS_WARN_EXCEPTION(area, stream)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SwFormatAutoFormat > RES_PARATR_LIST_AUTOFMT(87)
constexpr TypedWhichId< SwFormatRuby > RES_TXTATR_CJK_RUBY(53)
void SetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName, const css::uno::Any &rValue, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
void SetPropertyValues(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const css::uno::Sequence< css::beans::PropertyValue > &rPropertyValues, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
css::beans::PropertyState GetPropertyState(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName)
void GetCursorAttr(SwPaM &rPam, SfxItemSet &rSet, const bool bOnlyTextAttr=false, const bool bGetFromChrFormat=true)
void SetPropertyToDefault(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
void SetString(SwCursor &rCursor, std::u16string_view aString)
bool getCursorPropertyValue(const SfxItemPropertyMapEntry &rEntry, SwPaM &rPam, Any *pAny, PropertyState &eState, const SwTextNode *pNode)
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::Any GetPropertyDefault(SwPaM const &rPaM, const SfxItemPropertySet &rPropSet, std::u16string_view rPropertyName)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Any SAL_CALL getCaughtException()
sal_Int32 GetContentIndex() const
static rtl::Reference< SwXParaFrameEnumeration > Create(const SwPaM &rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat *const pFormat=nullptr)
@ SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT
@ SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION
SwUnoPropertyMapProvider aSwMapProvider
#define PROPERTY_MAP_TEXTPORTION_EXTENSIONS
#define PROPERTY_MAP_REDLINE_PORTION
#define MID_RUBY_POSITION
#define MID_RUBY_CHARSTYLE
@ PORTION_CONTENT_CONTROL
@ PORTION_FIELD_START_END
constexpr OUStringLiteral UNO_NAME_REFERENCE_MARK
constexpr OUStringLiteral UNO_NAME_META
constexpr OUStringLiteral UNO_NAME_DOCUMENT_INDEX_MARK
constexpr OUStringLiteral UNO_NAME_CONTENT_CONTROL
constexpr OUStringLiteral UNO_NAME_BOOKMARK