34#include <unoprnms.hxx>
47uno::Sequence< OUString >
48GetSupportedServiceNamesImpl(
49 size_t const nServices,
char const*
const pServices[])
51 uno::Sequence< OUString > ret(
static_cast<sal_Int32
>(nServices));
53 std::transform(pServices, pServices + nServices, ret.getArray(),
54 [](
const char* pService) -> OUString { return OUString::createFromAscii(pService); });
77 const bool bIsEndnote)
93 throw uno::RuntimeException(
"SwXFootnote: disposed or invalid",
nullptr);
109 uno::Reference<uno::XInterface>
const xThis(
m_wThis);
114 lang::EventObject
const ev(xThis);
115 std::unique_lock aGuard(
m_Mutex);
121 if(rHint.
GetId() == SfxHintId::Dying)
143 bool const isEndnote)
153 xNote = pFootnoteFormat
161 xNote->m_pImpl->m_wThis = xNote.get();
169 return "SwXFootnote";
174 "com.sun.star.text.TextContent",
175 "com.sun.star.text.Footnote",
176 "com.sun.star.text.Text",
177 "com.sun.star.text.Endnote",
189uno::Sequence< OUString > SAL_CALL
193 return GetSupportedServiceNamesImpl(
198uno::Sequence< uno::Type > SAL_CALL
201 const uno::Sequence< uno::Type >
aTypes = SwXFootnote_Base::getTypes();
203 return ::comphelper::concatSequences(
aTypes, aTextTypes);
206uno::Sequence< sal_Int8 > SAL_CALL
209 return css::uno::Sequence<sal_Int8>();
215 const uno::Any ret = SwXFootnote_Base::queryInterface(rType);
231 else if (
m_pImpl->m_bIsDescriptor)
237 throw uno::RuntimeException();
246 OUString newLabel(
aLabel);
248 if(newLabel.indexOf(
'\n') >=0 )
250 newLabel = newLabel.replace(
'\n',
' ');
256 OSL_ENSURE(pTextFootnote,
"No TextNode?");
262 else if (
m_pImpl->m_bIsDescriptor)
268 throw uno::RuntimeException();
279 throw uno::RuntimeException();
282 OTextCursorHelper *
const pCursor =
dynamic_cast<OTextCursorHelper*
>(xTextRange.get());
283 SwDoc *
const pNewDoc =
284 pRange ? &pRange->
GetDoc() : (pCursor ? pCursor->GetDoc() :
nullptr);
287 throw lang::IllegalArgumentException();
298 if (!
m_pImpl->m_sLabel.isEmpty())
305 const bool bForceExpandHints( pTextCursor && pTextCursor->
IsAtEndOfMeta() );
320 m_pImpl->m_pFormatFootnote = pFootnote;
321 m_pImpl->StartListening(pFootnote->GetNotifier());
332 m_pImpl->m_bIsDescriptor =
false;
336uno::Reference< text::XTextRange > SAL_CALL
340 return m_pImpl->GetFootnoteFormatOrThrow().getAnchor(*
GetDoc());
350 OSL_ENSURE(pTextFootnote,
"no TextNode?");
359 const uno::Reference< lang::XEventListener > & xListener)
362 std::unique_lock aGuard(
m_pImpl->m_Mutex);
363 m_pImpl->m_EventListeners.addInterface(aGuard, xListener);
368 const uno::Reference< lang::XEventListener > & xListener)
371 std::unique_lock aGuard(
m_pImpl->m_Mutex);
372 m_pImpl->m_EventListeners.removeInterface(aGuard, xListener);
398 auto& rUnoCursor(pXCursor->GetCursor());
405 const uno::Reference< text::XTextRange > & xTextPosition)
412 throw uno::RuntimeException();
419 if (pStart != pFootnoteStartNode)
421 throw uno::RuntimeException();
430uno::Reference< container::XEnumeration > SAL_CALL
439 auto pUnoCursor(
GetDoc()->CreateUnoCursor(aPos));
454uno::Reference< beans::XPropertySetInfo > SAL_CALL
458 static uno::Reference< beans::XPropertySetInfo > xRet =
468 throw lang::IllegalArgumentException();
494 OSL_ENSURE(pTextFootnote,
"no TextNode?");
495 aRet <<= static_cast<sal_Int16>(pTextFootnote->
GetSeqRefNo());
500 beans::UnknownPropertyException aExcept;
501 aExcept.Message = rPropertyName;
511 const uno::Reference< beans::XPropertyChangeListener >& )
513 OSL_FAIL(
"SwXFootnote::addPropertyChangeListener(): not implemented");
519 const uno::Reference< beans::XPropertyChangeListener >& )
521 OSL_FAIL(
"SwXFootnote::removePropertyChangeListener(): not implemented");
527 const uno::Reference< beans::XVetoableChangeListener >& )
529 OSL_FAIL(
"SwXFootnote::addVetoableChangeListener(): not implemented");
535 const uno::Reference< beans::XVetoableChangeListener >& )
537 OSL_FAIL(
"SwXFootnote::removeVetoableChangeListener(): not implemented");
virtual bool DeleteAndJoin(SwPaM &, SwDeleteFlags flags=SwDeleteFlags::Default)=0
complete delete of a given PaM
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
bool StartListening(SvtBroadcaster &rBroadcaster)
IDocumentContentOperations const & getIDocumentContentOperations() const
bool SetCurFootnote(const SwPaM &rPam, const OUString &rNumStr, bool bIsEndNote)
change footnotes in range
SwFootnoteIdxs & GetFootnoteIdxs()
Base class of the Writer document model elements.
SwStartNode * GetStartNode()
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
const SwStartNode * FindFootnoteStartNode() const
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
SwNode & GetPointNode() const
const SwPosition * GetPoint() const
Starts a section of nodes in the document model.
const SwFormatFootnote & GetFootnote() const
sal_Int32 GetStart() const
SwTextNode is a paragraph in the document model.
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
bool IsAtEndOfMeta() const
const SwDoc * GetDoc() const
void SetDoc(SwDoc *const pDoc)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
void disposeAndClear(::std::unique_lock<::std::mutex > &rGuard, const css::lang::EventObject &rEvt)
css::uno::Type const & get()
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(59)
#define SAL_N_ELEMENTS(arr)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange, ::sw::TextRangeMode const eMode)
bool GetDefaultTextContentValue(css::uno::Any &rAny, std::u16string_view rPropertyName, sal_uInt16 nWID=0)
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Marks a position in the document model.
sal_Int32 GetContentIndex() const
static rtl::Reference< SwXParagraphEnumeration > Create(css::uno::Reference< css::text::XText > const &xParent, const std::shared_ptr< SwUnoCursor > &pCursor, const CursorType eType, SwTableBox const *const pTableBox=nullptr)
@ FORCEHINTEXPAND
Force hint expand (only matters for hints with CH_TXTATR).
char const *const g_ServicesFootnote[]
const size_t g_nServicesEndnote(SAL_N_ELEMENTS(g_ServicesFootnote))
const size_t g_nServicesFootnote(g_nServicesEndnote - 1)
SwUnoPropertyMapProvider aSwMapProvider
#define PROPERTY_MAP_FOOTNOTE
constexpr OUStringLiteral UNO_NAME_START_REDLINE
constexpr OUStringLiteral UNO_NAME_REFERENCE_ID
constexpr OUStringLiteral UNO_NAME_END_REDLINE