LibreOffice Module sw (master)  1
unorefmk.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <memory>
21 #include <utility>
22 
26 #include <cppuhelper/exc_hlp.hxx>
28 #include <cppuhelper/weak.hxx>
29 #include <sal/config.h>
30 #include <svl/listener.hxx>
31 #include <vcl/svapp.hxx>
32 #include <sal/log.hxx>
33 
34 #include <unotextrange.hxx>
35 #include <unorefmark.hxx>
36 #include <unotextcursor.hxx>
37 #include <unomap.hxx>
38 #include <unocrsrhelper.hxx>
39 #include <doc.hxx>
40 #include <ndtxt.hxx>
41 #include <fmtrfmrk.hxx>
42 #include <txtrfmrk.hxx>
43 #include <unometa.hxx>
44 #include <unotext.hxx>
45 #include <unoport.hxx>
46 #include <txtatr.hxx>
47 #include <fmtmeta.hxx>
48 #include <docsh.hxx>
49 
50 #include <com/sun/star/frame/XModel.hpp>
51 #include <com/sun/star/lang/NoSupportException.hpp>
52 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
53 #include <com/sun/star/rdf/Statement.hpp>
54 #include <com/sun/star/rdf/URI.hpp>
55 #include <com/sun/star/rdf/URIs.hpp>
56 #include <com/sun/star/rdf/XLiteral.hpp>
57 #include <com/sun/star/rdf/XRepositorySupplier.hpp>
58 #include <com/sun/star/lang/DisposedException.hpp>
59 
60 using namespace ::com::sun::star;
61 
63  : public SvtListener
64 {
65 public:
66  uno::WeakReference<uno::XInterface> m_wThis;
67  std::mutex m_Mutex; // just for OInterfaceContainerHelper4
72  OUString m_sMarkName;
73 
74  Impl(SwDoc* const pDoc, SwFormatRefMark* const pRefMark)
75  : m_bIsDescriptor(nullptr == pRefMark)
76  , m_pDoc(pDoc)
77  , m_pMarkFormat(pRefMark)
78  {
79  if (pRefMark)
80  {
81  StartListening(pRefMark->GetNotifier());
82  m_sMarkName = pRefMark->GetRefName();
83  }
84  }
85 
86  bool IsValid() const { return m_pMarkFormat; }
87  void InsertRefMark( SwPaM & rPam, SwXTextCursor const*const pCursor );
88  void Invalidate();
89 protected:
90  virtual void Notify(const SfxHint&) override;
91 
92 };
93 
95 {
97  m_pDoc = nullptr;
98  m_pMarkFormat = nullptr;
99  uno::Reference<uno::XInterface> const xThis(m_wThis);
100  if (!xThis.is())
101  { // fdo#72695: if UNO object is already dead, don't revive it with event
102  return;
103  }
104  lang::EventObject const ev(xThis);
105  std::unique_lock aGuard(m_Mutex);
106  m_EventListeners.disposeAndClear(aGuard, ev);
107 }
108 
110 {
111  if(rHint.GetId() == SfxHintId::Dying)
112  Invalidate();
113 }
114 
116  SwDoc *const pDoc, SwFormatRefMark *const pRefMark)
117  : m_pImpl( new SwXReferenceMark::Impl(pDoc, pRefMark) )
118 {
119 }
120 
122 {
123 }
124 
125 uno::Reference<text::XTextContent>
127  SwDoc & rDoc, SwFormatRefMark *const pMarkFormat)
128 {
129  // i#105557: do not iterate over the registered clients: race condition
130  uno::Reference<text::XTextContent> xMark;
131  if (pMarkFormat)
132  {
133  xMark = pMarkFormat->GetXRefMark();
134  }
135  if (!xMark.is())
136  {
137  rtl::Reference<SwXReferenceMark> pMark(new SwXReferenceMark(&rDoc, pMarkFormat));
138  xMark = pMark;
139  if (pMarkFormat)
140  {
141  pMarkFormat->SetXRefMark(xMark);
142  }
143  // need a permanent Reference to initialize m_wThis
144  pMark->m_pImpl->m_wThis = xMark;
145  }
146  return xMark;
147 }
148 
149 const uno::Sequence< sal_Int8 > & SwXReferenceMark::getUnoTunnelId()
150 {
151  static const comphelper::UnoIdInit theSwXReferenceMarkUnoTunnelId;
152  return theSwXReferenceMarkUnoTunnelId.getSeq();
153 }
154 
155 sal_Int64 SAL_CALL
156 SwXReferenceMark::getSomething(const uno::Sequence< sal_Int8 >& rId)
157 {
158  return comphelper::getSomethingImpl<SwXReferenceMark>(rId, this);
159 }
160 
162 {
163  return "SwXReferenceMark";
164 }
165 
166 sal_Bool SAL_CALL
167 SwXReferenceMark::supportsService(const OUString& rServiceName)
168 {
169  return cppu::supportsService(this, rServiceName);
170 }
171 
172 uno::Sequence< OUString > SAL_CALL
174 {
175  return {
176  "com.sun.star.text.TextContent",
177  "com.sun.star.text.ReferenceMark"
178  };
179 }
180 
181 namespace {
182 
183 template<typename T> struct NotContainedIn
184 {
185  std::vector<T> const& m_rVector;
186  explicit NotContainedIn(std::vector<T> const& rVector)
187  : m_rVector(rVector) { }
188  bool operator() (T const& rT) {
189  return std::find(m_rVector.begin(), m_rVector.end(), rT)
190  == m_rVector.end();
191  }
192 };
193 
194 }
195 
197  SwXTextCursor const*const pCursor)
198 {
202  SwDoc& rDoc2 = rPam.GetDoc();
203 
204  UnoActionContext aCont(&rDoc2);
205  SwFormatRefMark aRefMark(m_sMarkName);
206  bool bMark = *rPam.GetPoint() != *rPam.GetMark();
207 
208  const bool bForceExpandHints( !bMark && pCursor && pCursor->IsAtEndOfMeta() );
209  const SetAttrMode nInsertFlags = bForceExpandHints
213 
214  std::vector<SwTextAttr *> oldMarks;
215  if (bMark)
216  {
217  oldMarks = rPam.GetNode().GetTextNode()->GetTextAttrsAt(
219  }
220 
221  rDoc2.getIDocumentContentOperations().InsertPoolItem( rPam, aRefMark, nInsertFlags );
222 
223  if( bMark && *rPam.GetPoint() > *rPam.GetMark())
224  {
225  rPam.Exchange();
226  }
227 
228  // aRefMark was copied into the document pool; now retrieve real format...
229  SwTextAttr * pTextAttr(nullptr);
230  if (bMark)
231  {
232  // #i107672#
233  // ensure that we do not retrieve a different mark at the same position
234  std::vector<SwTextAttr *> const newMarks(
237  std::vector<SwTextAttr *>::const_iterator const iter(
238  std::find_if(newMarks.begin(), newMarks.end(),
239  NotContainedIn<SwTextAttr *>(oldMarks)));
240  assert(newMarks.end() != iter);
241  if (newMarks.end() != iter)
242  {
243  pTextAttr = *iter;
244  }
245  }
246  else
247  {
248  SwTextNode *pTextNd = rPam.GetNode().GetTextNode();
249  assert(pTextNd);
250  pTextAttr = pTextNd ? rPam.GetNode().GetTextNode()->GetTextAttrForCharAt(
251  rPam.GetPoint()->nContent.GetIndex() - 1, RES_TXTATR_REFMARK) : nullptr;
252  }
253 
254  if (!pTextAttr)
255  {
256  throw uno::RuntimeException(
257  "SwXReferenceMark::InsertRefMark(): cannot insert attribute", nullptr);
258  }
259 
260  m_pMarkFormat = &pTextAttr->GetRefMark();
261  EndListeningAll();
262  StartListening(const_cast<SwFormatRefMark*>(m_pMarkFormat)->GetNotifier());
263 }
264 
265 void SAL_CALL
266 SwXReferenceMark::attach(const uno::Reference< text::XTextRange > & xTextRange)
267 {
268  SolarMutexGuard aGuard;
269 
270  if (!m_pImpl->m_bIsDescriptor)
271  {
272  throw uno::RuntimeException();
273  }
274  uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
275  SwXTextRange* pRange = comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel);
276  OTextCursorHelper* pCursor = comphelper::getFromUnoTunnel<OTextCursorHelper>(xRangeTunnel);
277  SwDoc *const pDocument =
278  pRange ? &pRange->GetDoc() : (pCursor ? pCursor->GetDoc() : nullptr);
279  if (!pDocument)
280  {
281  throw lang::IllegalArgumentException();
282  }
283 
284  SwUnoInternalPaM aPam(*pDocument);
285  // this now needs to return TRUE
286  ::sw::XTextRangeToSwPaM(aPam, xTextRange);
287  m_pImpl->InsertRefMark(aPam, dynamic_cast<SwXTextCursor*>(pCursor));
288  m_pImpl->m_bIsDescriptor = false;
289  m_pImpl->m_pDoc = pDocument;
290 }
291 
292 uno::Reference< text::XTextRange > SAL_CALL
294 {
295  SolarMutexGuard aGuard;
296 
297  if (m_pImpl->IsValid())
298  {
299  SwFormatRefMark const*const pNewMark =
300  m_pImpl->m_pDoc->GetRefMark(m_pImpl->m_sMarkName);
301  if (pNewMark && (pNewMark == m_pImpl->m_pMarkFormat))
302  {
303  SwTextRefMark const*const pTextMark =
304  m_pImpl->m_pMarkFormat->GetTextRefMark();
305  if (pTextMark &&
306  (&pTextMark->GetTextNode().GetNodes() ==
307  &m_pImpl->m_pDoc->GetNodes()))
308  {
309  SwTextNode const& rTextNode = pTextMark->GetTextNode();
310  std::optional<SwPaM> pPam;
311  if ( pTextMark->End() )
312  pPam.emplace( rTextNode, *pTextMark->End(),
313  rTextNode, pTextMark->GetStart());
314  else
315  pPam.emplace( rTextNode, pTextMark->GetStart());
316 
318  *m_pImpl->m_pDoc, *pPam->Start(), pPam->End());
319  }
320  }
321  }
322  return nullptr;
323 }
324 
326 {
327  SolarMutexGuard aGuard;
328  if (m_pImpl->IsValid())
329  {
330  SwFormatRefMark const*const pNewMark =
331  m_pImpl->m_pDoc->GetRefMark(m_pImpl->m_sMarkName);
332  if (pNewMark && (pNewMark == m_pImpl->m_pMarkFormat))
333  {
334  SwTextRefMark const*const pTextMark =
335  m_pImpl->m_pMarkFormat->GetTextRefMark();
336  if (pTextMark &&
337  (&pTextMark->GetTextNode().GetNodes() ==
338  &m_pImpl->m_pDoc->GetNodes()))
339  {
340  SwTextNode const& rTextNode = pTextMark->GetTextNode();
341  const sal_Int32 nStt = pTextMark->GetStart();
342  const sal_Int32 nEnd = pTextMark->End()
343  ? *pTextMark->End()
344  : nStt + 1;
345 
346  SwPaM aPam( rTextNode, nStt, rTextNode, nEnd );
347  m_pImpl->m_pDoc->getIDocumentContentOperations().DeleteAndJoin( aPam );
348  }
349  }
350  }
351  else if (m_pImpl->m_bIsDescriptor)
352  {
353  m_pImpl->Invalidate();
354  }
355 }
356 
358  const uno::Reference< lang::XEventListener > & xListener)
359 {
360  // no need to lock here as m_pImpl is const and container threadsafe
361  std::unique_lock aGuard(m_pImpl->m_Mutex);
362  m_pImpl->m_EventListeners.addInterface(aGuard, xListener);
363 }
364 
366  const uno::Reference< lang::XEventListener > & xListener)
367 {
368  // no need to lock here as m_pImpl is const and container threadsafe
369  std::unique_lock aGuard(m_pImpl->m_Mutex);
370  m_pImpl->m_EventListeners.removeInterface(aGuard, xListener);
371 }
372 
373 OUString SAL_CALL SwXReferenceMark::getName()
374 {
375  SolarMutexGuard aGuard;
376  if (!m_pImpl->IsValid() ||
377  !m_pImpl->m_pDoc->GetRefMark(m_pImpl->m_sMarkName))
378  {
379  throw uno::RuntimeException();
380  }
381  return m_pImpl->m_sMarkName;
382 }
383 
384 void SAL_CALL SwXReferenceMark::setName(const OUString& rName)
385 {
386  SolarMutexGuard aGuard;
387  if (m_pImpl->m_bIsDescriptor)
388  {
389  m_pImpl->m_sMarkName = rName;
390  }
391  else
392  {
393  if (!m_pImpl->IsValid()
394  || !m_pImpl->m_pDoc->GetRefMark(m_pImpl->m_sMarkName)
395  || m_pImpl->m_pDoc->GetRefMark(rName))
396  {
397  throw uno::RuntimeException();
398  }
399  SwFormatRefMark const*const pCurMark =
400  m_pImpl->m_pDoc->GetRefMark(m_pImpl->m_sMarkName);
401  if ((rName != m_pImpl->m_sMarkName)
402  && pCurMark && (pCurMark == m_pImpl->m_pMarkFormat))
403  {
404  const UnoActionContext aCont(m_pImpl->m_pDoc);
405  SwTextRefMark const*const pTextMark =
406  m_pImpl->m_pMarkFormat->GetTextRefMark();
407  if (pTextMark &&
408  (&pTextMark->GetTextNode().GetNodes() ==
409  &m_pImpl->m_pDoc->GetNodes()))
410  {
411  SwTextNode const& rTextNode = pTextMark->GetTextNode();
412  const sal_Int32 nStt = pTextMark->GetStart();
413  const sal_Int32 nEnd = pTextMark->End()
414  ? *pTextMark->End()
415  : nStt + 1;
416 
417  SwPaM aPam( rTextNode, nStt, rTextNode, nEnd );
418  // deletes the m_pImpl->m_pDoc member in the SwXReferenceMark!
419  m_pImpl->m_pDoc->getIDocumentContentOperations().DeleteAndJoin( aPam );
420  // The aPam will keep the correct and functional doc though
421 
422  m_pImpl->m_sMarkName = rName;
423  //create a new one
424  m_pImpl->InsertRefMark( aPam, nullptr );
425  m_pImpl->m_pDoc = &aPam.GetDoc();
426  }
427  }
428  }
429 }
430 
431 uno::Reference< beans::XPropertySetInfo > SAL_CALL
433 {
434  SolarMutexGuard g;
435 
436  static uno::Reference< beans::XPropertySetInfo > xRef =
438  ->getPropertySetInfo();
439  return xRef;
440 }
441 
443  const OUString& /*rPropertyName*/, const uno::Any& /*rValue*/ )
444 {
445  throw lang::IllegalArgumentException();
446 }
447 
448 uno::Any SAL_CALL
449 SwXReferenceMark::getPropertyValue(const OUString& rPropertyName)
450 {
451  // does not seem to need SolarMutex
452  uno::Any aRet;
453  if (! ::sw::GetDefaultTextContentValue(aRet, rPropertyName))
454  {
455  throw beans::UnknownPropertyException(rPropertyName);
456  }
457  return aRet;
458 }
459 
461  const OUString& /*rPropertyName*/,
462  const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
463 {
464  OSL_FAIL("SwXReferenceMark::addPropertyChangeListener(): not implemented");
465 }
466 
468  const OUString& /*rPropertyName*/,
469  const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
470 {
471  OSL_FAIL("SwXReferenceMark::removePropertyChangeListener(): not implemented");
472 }
473 
475  const OUString& /*rPropertyName*/,
476  const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
477 {
478  OSL_FAIL("SwXReferenceMark::addVetoableChangeListener(): not implemented");
479 }
480 
482  const OUString& /*rPropertyName*/,
483  const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
484 {
485  OSL_FAIL("SwXReferenceMark::removeVetoableChangeListener(): not implemented");
486 }
487 
488 namespace {
489 
490 class SwXMetaText : public cppu::OWeakObject, public SwXText
491 {
492 private:
493  SwXMeta & m_rMeta;
494 
495  virtual void PrepareForAttach(uno::Reference< text::XTextRange > & xRange,
496  const SwPaM & rPam) override;
497 
498  virtual bool CheckForOwnMemberMeta(const SwPaM & rPam, const bool bAbsorb) override;
499 
500 protected:
501  virtual const SwStartNode *GetStartNode() const override;
502  virtual uno::Reference< text::XTextCursor >
503  CreateCursor() override;
504 
505 public:
506  SwXMetaText(SwDoc & rDoc, SwXMeta & rMeta);
507 
509  using SwXText::Invalidate;
510 
511  // XInterface
512  virtual void SAL_CALL acquire() noexcept override { cppu::OWeakObject::acquire(); }
513  virtual void SAL_CALL release() noexcept override { cppu::OWeakObject::release(); }
514 
515  // XTypeProvider
516  virtual uno::Sequence< sal_Int8 > SAL_CALL
517  getImplementationId() override;
518 
519  // XText
520  virtual uno::Reference< text::XTextCursor > SAL_CALL
521  createTextCursor() override;
522  virtual uno::Reference< text::XTextCursor > SAL_CALL
523  createTextCursorByRange(
524  const uno::Reference< text::XTextRange > & xTextPosition) override;
525 
526 };
527 
528 }
529 
530 SwXMetaText::SwXMetaText(SwDoc & rDoc, SwXMeta & rMeta)
531  : SwXText(&rDoc, CursorType::Meta)
532  , m_rMeta(rMeta)
533 {
534 }
535 
537 {
538  SwXText const * const pParent(
539  dynamic_cast<SwXText*>(m_rMeta.GetParentText().get()));
540  return pParent ? pParent->GetStartNode() : nullptr;
541 }
542 
543 void SwXMetaText::PrepareForAttach( uno::Reference<text::XTextRange> & xRange,
544  const SwPaM & rPam)
545 {
546  // create a new cursor to prevent modifying SwXTextRange
547  xRange = static_cast<text::XWordCursor*>(
548  new SwXTextCursor(*GetDoc(), &m_rMeta, CursorType::Meta, *rPam.GetPoint(),
549  (rPam.HasMark()) ? rPam.GetMark() : nullptr));
550 }
551 
552 bool SwXMetaText::CheckForOwnMemberMeta(const SwPaM & rPam, const bool bAbsorb)
553 {
554  return m_rMeta.CheckForOwnMemberMeta(rPam, bAbsorb);
555 }
556 
557 uno::Reference< text::XTextCursor > SwXMetaText::CreateCursor()
558 {
559  uno::Reference< text::XTextCursor > xRet;
560  if (IsValid())
561  {
562  SwTextNode * pTextNode;
563  sal_Int32 nMetaStart;
564  sal_Int32 nMetaEnd;
565  const bool bSuccess(
566  m_rMeta.SetContentRange(pTextNode, nMetaStart, nMetaEnd) );
567  if (bSuccess)
568  {
569  SwPosition aPos(*pTextNode, nMetaStart);
570  xRet = static_cast<text::XWordCursor*>(
571  new SwXTextCursor(*GetDoc(), &m_rMeta, CursorType::Meta, aPos));
572  }
573  }
574  return xRet;
575 }
576 
577 uno::Sequence<sal_Int8> SAL_CALL
578 SwXMetaText::getImplementationId()
579 {
580  return css::uno::Sequence<sal_Int8>();
581 }
582 
583 // XText
584 uno::Reference< text::XTextCursor > SAL_CALL
585 SwXMetaText::createTextCursor()
586 {
587  return CreateCursor();
588 }
589 
590 uno::Reference< text::XTextCursor > SAL_CALL
591 SwXMetaText::createTextCursorByRange(
592  const uno::Reference<text::XTextRange> & xTextPosition)
593 {
594  const uno::Reference<text::XTextCursor> xCursor( CreateCursor() );
595  xCursor->gotoRange(xTextPosition, false);
596  return xCursor;
597 }
598 
607 {
608 public:
609  uno::WeakReference<uno::XInterface> m_wThis;
610  std::mutex m_Mutex; // just for OInterfaceContainerHelper4
612  std::unique_ptr<const TextRangeList_t> m_pTextPortions;
613  // 3 possible states: not attached, attached, disposed
616  uno::Reference<text::XText> m_xParentText;
619 
620  Impl(SwXMeta& rThis, SwDoc& rDoc,
621  ::sw::Meta* const pMeta,
622  uno::Reference<text::XText> const& xParentText,
623  std::unique_ptr<TextRangeList_t const> pPortions)
624  : m_pTextPortions(std::move(pPortions))
625  , m_bIsDisposed(false)
626  , m_bIsDescriptor(nullptr == pMeta)
627  , m_xParentText(xParentText)
628  , m_xText(new SwXMetaText(rDoc, rThis))
629  , m_pMeta(pMeta)
630  {
631  !m_bIsDescriptor && StartListening(m_pMeta->GetNotifier());
632  }
633 
634  inline const ::sw::Meta* GetMeta() const;
635  // only for SwXMetaField!
636  inline const ::sw::MetaField* GetMetaField() const;
637 protected:
638  virtual void Notify(const SfxHint& rHint) override;
639 
640 };
641 
642 inline const ::sw::Meta* SwXMeta::Impl::GetMeta() const
643 {
644  return m_pMeta;
645 }
646 
647 // sw::BroadcastingModify
648 void SwXMeta::Impl::Notify(const SfxHint& rHint)
649 {
650  m_pTextPortions.reset(); // throw away cache (SwTextNode changed)
651  if(rHint.GetId() != SfxHintId::Dying && rHint.GetId() != SfxHintId::Deinitializing)
652  return;
653 
654  m_bIsDisposed = true;
655  m_pMeta = nullptr;
656  m_xText->Invalidate();
657  uno::Reference<uno::XInterface> const xThis(m_wThis);
658  if (!xThis.is())
659  { // fdo#72695: if UNO object is already dead, don't revive it with event
660  return;
661  }
662  lang::EventObject const ev(xThis);
663  std::unique_lock aGuard(m_Mutex);
664  m_EventListeners.disposeAndClear(aGuard, ev);
665 }
666 
667 uno::Reference<text::XText> const & SwXMeta::GetParentText() const
668 {
669  return m_pImpl->m_xParentText;
670 }
671 
672 SwXMeta::SwXMeta(SwDoc *const pDoc, ::sw::Meta *const pMeta,
673  uno::Reference<text::XText> const& xParentText,
674  std::unique_ptr<TextRangeList_t const> pPortions)
675  : m_pImpl( new SwXMeta::Impl(*this, *pDoc, pMeta, xParentText, std::move(pPortions)) )
676 {
677 }
678 
680  : m_pImpl( new SwXMeta::Impl(*this, *pDoc, nullptr, nullptr, nullptr) )
681 {
682 }
683 
685 {
686 }
687 
688 uno::Reference<rdf::XMetadatable>
689 SwXMeta::CreateXMeta(SwDoc & rDoc, bool const isField)
690 {
691  SwXMeta *const pXMeta(isField
692  ? new SwXMetaField(& rDoc) : new SwXMeta(& rDoc));
693  // this is why the constructor is private: need to acquire pXMeta here
694  uno::Reference<rdf::XMetadatable> const xMeta(pXMeta);
695  // need a permanent Reference to initialize m_wThis
696  pXMeta->m_pImpl->m_wThis = xMeta;
697  return xMeta;
698 }
699 
700 uno::Reference<rdf::XMetadatable>
702  uno::Reference<text::XText> const& i_xParent,
703  std::unique_ptr<TextRangeList_t const> && pPortions)
704 {
705  // re-use existing SwXMeta
706  // #i105557#: do not iterate over the registered clients: race condition
707  uno::Reference<rdf::XMetadatable> xMeta(rMeta.GetXMeta());
708  if (xMeta.is())
709  {
710  if (pPortions) // set cache in the XMeta to the given portions
711  {
712  SwXMeta *const pXMeta(
713  comphelper::getFromUnoTunnel<SwXMeta>(xMeta));
714  assert(pXMeta);
715  // NB: the meta must always be created with the complete content
716  // if SwXTextPortionEnumeration is created for a selection,
717  // it must be checked that the Meta is contained in the selection!
718  pXMeta->m_pImpl->m_pTextPortions = std::move(pPortions);
719  // ??? is this necessary?
720  if (pXMeta->m_pImpl->m_xParentText.get() != i_xParent.get())
721  {
722  SAL_WARN("sw.uno", "SwXMeta with different parent?");
723  pXMeta->m_pImpl->m_xParentText.set(i_xParent);
724  }
725  }
726  return xMeta;
727  }
728 
729  // create new SwXMeta
730  SwTextNode * const pTextNode( rMeta.GetTextNode() );
731  SAL_WARN_IF(!pTextNode, "sw.uno", "CreateXMeta: no text node?");
732  if (!pTextNode) { return nullptr; }
733  uno::Reference<text::XText> xParentText(i_xParent);
734  if (!xParentText.is())
735  {
736  SwTextMeta * const pTextAttr( rMeta.GetTextAttr() );
737  SAL_WARN_IF(!pTextAttr, "sw.uno", "CreateXMeta: no text attr?");
738  if (!pTextAttr) { return nullptr; }
739  const SwPosition aPos(*pTextNode, pTextAttr->GetStart());
740  xParentText.set( ::sw::CreateParentXText(pTextNode->GetDoc(), aPos) );
741  }
742  if (!xParentText.is()) { return nullptr; }
743  SwXMeta *const pXMeta( (RES_TXTATR_META == rMeta.GetFormatMeta()->Which())
744  ? new SwXMeta (&pTextNode->GetDoc(), &rMeta, xParentText,
745  std::move(pPortions))
746  : new SwXMetaField(&pTextNode->GetDoc(), &rMeta, xParentText,
747  std::move(pPortions)));
748  // this is why the constructor is private: need to acquire pXMeta here
749  xMeta.set(pXMeta);
750  // in order to initialize the weak pointer cache in the core object
751  rMeta.SetXMeta(xMeta);
752  // need a permanent Reference to initialize m_wThis
753  pXMeta->m_pImpl->m_wThis = xMeta;
754  return xMeta;
755 }
756 
758  SwTextNode *& rpNode, sal_Int32 & rStart, sal_Int32 & rEnd ) const
759 {
760  ::sw::Meta const * const pMeta( m_pImpl->GetMeta() );
761  if (pMeta)
762  {
763  SwTextMeta const * const pTextAttr( pMeta->GetTextAttr() );
764  if (pTextAttr)
765  {
766  rpNode = pMeta->GetTextNode();
767  if (rpNode)
768  {
769  // rStart points at the first position _within_ the meta!
770  rStart = pTextAttr->GetStart() + 1;
771  rEnd = *pTextAttr->End();
772  return true;
773  }
774  }
775  }
776  return false;
777 }
778 
779 bool SwXMeta::CheckForOwnMemberMeta(const SwPaM & rPam, const bool bAbsorb)
780 {
781  SwTextNode * pTextNode;
782  sal_Int32 nMetaStart;
783  sal_Int32 nMetaEnd;
784  const bool bSuccess( SetContentRange(pTextNode, nMetaStart, nMetaEnd) );
785  OSL_ENSURE(bSuccess, "no pam?");
786  if (!bSuccess)
787  throw lang::DisposedException();
788 
789  SwPosition const * const pStartPos( rPam.Start() );
790  if (&pStartPos->nNode.GetNode() != pTextNode)
791  {
792  throw lang::IllegalArgumentException(
793  "trying to insert into a nesting text content, but start "
794  "of text range not in same paragraph as text content",
795  nullptr, 0);
796  }
797  bool bForceExpandHints(false);
798  const sal_Int32 nStartPos(pStartPos->nContent.GetIndex());
799  // not <= but < because nMetaStart is behind dummy char!
800  // not >= but > because == means insert at end!
801  if ((nStartPos < nMetaStart) || (nStartPos > nMetaEnd))
802  {
803  throw lang::IllegalArgumentException(
804  "trying to insert into a nesting text content, but start "
805  "of text range not inside text content",
806  nullptr, 0);
807  }
808  else if (nStartPos == nMetaEnd)
809  {
810  bForceExpandHints = true;
811  }
812  if (rPam.HasMark() && bAbsorb)
813  {
814  SwPosition const * const pEndPos( rPam.End() );
815  if (&pEndPos->nNode.GetNode() != pTextNode)
816  {
817  throw lang::IllegalArgumentException(
818  "trying to insert into a nesting text content, but end "
819  "of text range not in same paragraph as text content",
820  nullptr, 0);
821  }
822  const sal_Int32 nEndPos(pEndPos->nContent.GetIndex());
823  // not <= but < because nMetaStart is behind dummy char!
824  // not >= but > because == means insert at end!
825  if ((nEndPos < nMetaStart) || (nEndPos > nMetaEnd))
826  {
827  throw lang::IllegalArgumentException(
828  "trying to insert into a nesting text content, but end "
829  "of text range not inside text content",
830  nullptr, 0);
831  }
832  else if (nEndPos == nMetaEnd)
833  {
834  bForceExpandHints = true;
835  }
836  }
837  return bForceExpandHints;
838 }
839 
840 const uno::Sequence< sal_Int8 > & SwXMeta::getUnoTunnelId()
841 {
842  static const comphelper::UnoIdInit theSwXMetaUnoTunnelId;
843  return theSwXMetaUnoTunnelId.getSeq();
844 }
845 
846 // XUnoTunnel
847 sal_Int64 SAL_CALL
848 SwXMeta::getSomething( const uno::Sequence< sal_Int8 > & i_rId )
849 {
850  return comphelper::getSomethingImpl<SwXMeta>(i_rId, this);
851 }
852 
853 // XServiceInfo
854 OUString SAL_CALL
856 {
857  return "SwXMeta";
858 }
859 
860 sal_Bool SAL_CALL
861 SwXMeta::supportsService(const OUString& rServiceName)
862 {
863  return cppu::supportsService(this, rServiceName);
864 }
865 
866 uno::Sequence< OUString > SAL_CALL
868 {
869  return {
870  "com.sun.star.text.TextContent",
871  "com.sun.star.text.InContentMetadata"
872  };
873 }
874 
875 // XComponent
876 void SAL_CALL
878  uno::Reference< lang::XEventListener> const & xListener )
879 {
880  // no need to lock here as m_pImpl is const and container threadsafe
881  std::unique_lock aGuard(m_pImpl->m_Mutex);
882  m_pImpl->m_EventListeners.addInterface(aGuard, xListener);
883 }
884 
885 void SAL_CALL
887  uno::Reference< lang::XEventListener> const & xListener )
888 {
889  // no need to lock here as m_pImpl is const and container threadsafe
890  std::unique_lock aGuard(m_pImpl->m_Mutex);
891  m_pImpl->m_EventListeners.removeInterface(aGuard, xListener);
892 }
893 
894 void SAL_CALL
896 {
897  SolarMutexGuard g;
898 
899  if (m_pImpl->m_bIsDescriptor)
900  {
901  m_pImpl->m_pTextPortions.reset();
902  lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
903  std::unique_lock aGuard(m_pImpl->m_Mutex);
904  m_pImpl->m_EventListeners.disposeAndClear(aGuard, ev);
905  m_pImpl->m_bIsDisposed = true;
906  m_pImpl->m_xText->Invalidate();
907  }
908  else if (!m_pImpl->m_bIsDisposed)
909  {
910  SwTextNode * pTextNode;
911  sal_Int32 nMetaStart;
912  sal_Int32 nMetaEnd;
913  const bool bSuccess(SetContentRange(pTextNode, nMetaStart, nMetaEnd));
914  OSL_ENSURE(bSuccess, "no pam?");
915  if (bSuccess)
916  {
917  // -1 because of CH_TXTATR
918  SwPaM aPam( *pTextNode, nMetaStart - 1, *pTextNode, nMetaEnd );
919  SwDoc& rDoc( pTextNode->GetDoc() );
921 
922  // removal should call Modify and do the dispose
923  assert(m_pImpl->m_bIsDisposed);
924  }
925  }
926 }
927 
928 void
929 SwXMeta::AttachImpl(const uno::Reference< text::XTextRange > & i_xTextRange,
930  const sal_uInt16 i_nWhich)
931 {
932  SolarMutexGuard g;
933 
934  if (m_pImpl->m_bIsDisposed)
935  {
936  throw lang::DisposedException();
937  }
938  if (!m_pImpl->m_bIsDescriptor)
939  {
940  throw uno::RuntimeException(
941  "SwXMeta::attach(): already attached",
942  static_cast< ::cppu::OWeakObject* >(this));
943  }
944 
945  uno::Reference<lang::XUnoTunnel> xRangeTunnel(i_xTextRange, uno::UNO_QUERY);
946  if (!xRangeTunnel.is())
947  {
948  throw lang::IllegalArgumentException(
949  "SwXMeta::attach(): argument is no XUnoTunnel",
950  static_cast< ::cppu::OWeakObject* >(this), 0);
951  }
952  SwXTextRange *const pRange(
953  comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel));
954  OTextCursorHelper *const pCursor( pRange ? nullptr :
955  comphelper::getFromUnoTunnel<OTextCursorHelper>(xRangeTunnel));
956  if (!pRange && !pCursor)
957  {
958  throw lang::IllegalArgumentException(
959  "SwXMeta::attach(): argument not supported type",
960  static_cast< ::cppu::OWeakObject* >(this), 0);
961  }
962 
963  SwDoc * const pDoc(
964  pRange ? &pRange->GetDoc() : pCursor->GetDoc());
965  if (!pDoc)
966  {
967  throw lang::IllegalArgumentException(
968  "SwXMeta::attach(): argument has no SwDoc",
969  static_cast< ::cppu::OWeakObject* >(this), 0);
970  }
971 
972  SwUnoInternalPaM aPam(*pDoc);
973  ::sw::XTextRangeToSwPaM(aPam, i_xTextRange);
974 
975  UnoActionContext aContext(pDoc);
976 
977  SwXTextCursor const*const pTextCursor(
978  dynamic_cast<SwXTextCursor*>(pCursor));
979  const bool bForceExpandHints(pTextCursor && pTextCursor->IsAtEndOfMeta());
980  const SetAttrMode nInsertFlags( bForceExpandHints
984 
985  const std::shared_ptr< ::sw::Meta> pMeta( (RES_TXTATR_META == i_nWhich)
986  ? std::make_shared< ::sw::Meta>( nullptr )
987  : std::shared_ptr< ::sw::Meta>(
988  pDoc->GetMetaFieldManager().makeMetaField()) );
989  SwFormatMeta meta(pMeta, i_nWhich); // this is cloned by Insert!
990  const bool bSuccess( pDoc->getIDocumentContentOperations().InsertPoolItem( aPam, meta, nInsertFlags ) );
991  SwTextAttr * const pTextAttr( pMeta->GetTextAttr() );
992  if (!bSuccess)
993  {
994  throw lang::IllegalArgumentException(
995  "SwXMeta::attach(): cannot create meta: range invalid?",
996  static_cast< ::cppu::OWeakObject* >(this), 1);
997  }
998  if (!pTextAttr)
999  {
1000  OSL_FAIL("meta inserted, but has no text attribute?");
1001  throw uno::RuntimeException(
1002  "SwXMeta::attach(): cannot create meta",
1003  static_cast< ::cppu::OWeakObject* >(this));
1004  }
1005 
1006  m_pImpl->EndListeningAll();
1007  m_pImpl->m_pMeta = pMeta.get();
1008  m_pImpl->StartListening(pMeta->GetNotifier());
1009  pMeta->SetXMeta(uno::Reference<rdf::XMetadatable>(this));
1010 
1011  m_pImpl->m_xParentText = ::sw::CreateParentXText(*pDoc, *aPam.GetPoint());
1012 
1013  m_pImpl->m_bIsDescriptor = false;
1014 }
1015 
1016 // XTextContent
1017 void SAL_CALL
1018 SwXMeta::attach(const uno::Reference< text::XTextRange > & i_xTextRange)
1019 {
1020  return SwXMeta::AttachImpl(i_xTextRange, RES_TXTATR_META);
1021 }
1022 
1023 uno::Reference< text::XTextRange > SAL_CALL
1025 {
1026  SolarMutexGuard g;
1027 
1028  if (m_pImpl->m_bIsDisposed)
1029  {
1030  throw lang::DisposedException();
1031  }
1032  if (m_pImpl->m_bIsDescriptor)
1033  {
1034  throw uno::RuntimeException(
1035  "SwXMeta::getAnchor(): not inserted",
1036  static_cast< ::cppu::OWeakObject* >(this));
1037  }
1038 
1039  SwTextNode * pTextNode;
1040  sal_Int32 nMetaStart;
1041  sal_Int32 nMetaEnd;
1042  const bool bSuccess(SetContentRange(pTextNode, nMetaStart, nMetaEnd));
1043  OSL_ENSURE(bSuccess, "no pam?");
1044  if (!bSuccess)
1045  {
1046  throw lang::DisposedException(
1047  "SwXMeta::getAnchor(): not attached",
1048  static_cast< ::cppu::OWeakObject* >(this));
1049  }
1050 
1051  const SwPosition start(*pTextNode, nMetaStart - 1); // -1 due to CH_TXTATR
1052  const SwPosition end(*pTextNode, nMetaEnd);
1053  return SwXTextRange::CreateXTextRange(pTextNode->GetDoc(), start, &end);
1054 }
1055 
1056 // XTextRange
1057 uno::Reference< text::XText > SAL_CALL
1059 {
1060  return this;
1061 }
1062 
1063 uno::Reference< text::XTextRange > SAL_CALL
1065 {
1066  SolarMutexGuard g;
1067  return m_pImpl->m_xText->getStart();
1068 }
1069 
1070 uno::Reference< text::XTextRange > SAL_CALL
1072 {
1073  SolarMutexGuard g;
1074  return m_pImpl->m_xText->getEnd();
1075 }
1076 
1077 OUString SAL_CALL
1079 {
1080  SolarMutexGuard g;
1081  return m_pImpl->m_xText->getString();
1082 }
1083 
1084 void SAL_CALL
1085 SwXMeta::setString(const OUString& rString)
1086 {
1087  SolarMutexGuard g;
1088  return m_pImpl->m_xText->setString(rString);
1089 }
1090 
1091 // XSimpleText
1092 uno::Reference< text::XTextCursor > SAL_CALL
1094 {
1095  SolarMutexGuard g;
1096  return m_pImpl->m_xText->createTextCursor();
1097 }
1098 
1099 uno::Reference< text::XTextCursor > SAL_CALL
1101  const uno::Reference<text::XTextRange> & xTextPosition)
1102 {
1103  SolarMutexGuard g;
1104  return m_pImpl->m_xText->createTextCursorByRange(xTextPosition);
1105 }
1106 
1107 void SAL_CALL
1108 SwXMeta::insertString(const uno::Reference<text::XTextRange> & xRange,
1109  const OUString& rString, sal_Bool bAbsorb)
1110 {
1111  SolarMutexGuard g;
1112  return m_pImpl->m_xText->insertString(xRange, rString, bAbsorb);
1113 }
1114 
1115 void SAL_CALL
1116 SwXMeta::insertControlCharacter(const uno::Reference<text::XTextRange> & xRange,
1117  sal_Int16 nControlCharacter, sal_Bool bAbsorb)
1118 {
1119  SolarMutexGuard g;
1120  return m_pImpl->m_xText->insertControlCharacter(xRange, nControlCharacter,
1121  bAbsorb);
1122 }
1123 
1124 // XText
1125 void SAL_CALL
1126 SwXMeta::insertTextContent( const uno::Reference<text::XTextRange> & xRange,
1127  const uno::Reference<text::XTextContent> & xContent, sal_Bool bAbsorb)
1128 {
1129  SolarMutexGuard g;
1130  return m_pImpl->m_xText->insertTextContent(xRange, xContent, bAbsorb);
1131 }
1132 
1133 void SAL_CALL
1135  const uno::Reference< text::XTextContent > & xContent)
1136 {
1137  SolarMutexGuard g;
1138  return m_pImpl->m_xText->removeTextContent(xContent);
1139 }
1140 
1141 // XChild
1142 uno::Reference< uno::XInterface > SAL_CALL
1144 {
1145  SolarMutexGuard g;
1146  SwTextNode * pTextNode;
1147  sal_Int32 nMetaStart;
1148  sal_Int32 nMetaEnd;
1149  bool const bSuccess( SetContentRange(pTextNode, nMetaStart, nMetaEnd) );
1150  OSL_ENSURE(bSuccess, "no pam?");
1151  if (!bSuccess) { throw lang::DisposedException(); }
1152  // in order to prevent getting this meta, subtract 1 from nMetaStart;
1153  // so we get the index of the dummy character, and we exclude it
1154  // by calling GetTextAttrAt(_, _, PARENT) in GetNestedTextContent
1155  uno::Reference<text::XTextContent> const xRet(
1156  SwUnoCursorHelper::GetNestedTextContent(*pTextNode, nMetaStart - 1,
1157  true) );
1158  return xRet;
1159 }
1160 
1161 void SAL_CALL
1162 SwXMeta::setParent(uno::Reference< uno::XInterface > const& /*xParent*/)
1163 {
1164  throw lang::NoSupportException("setting parent not supported", *this);
1165 }
1166 
1167 // XElementAccess
1168 uno::Type SAL_CALL
1170 {
1172 }
1173 
1175 {
1176  SolarMutexGuard g;
1177  return m_pImpl->m_pMeta != nullptr;
1178 }
1179 
1180 // XEnumerationAccess
1181 uno::Reference< container::XEnumeration > SAL_CALL
1183 {
1184  SolarMutexGuard g;
1185 
1186  if (m_pImpl->m_bIsDisposed)
1187  {
1188  throw lang::DisposedException();
1189  }
1190  if (m_pImpl->m_bIsDescriptor)
1191  {
1192  throw uno::RuntimeException(
1193  "createEnumeration(): not inserted",
1194  static_cast< ::cppu::OWeakObject* >(this));
1195  }
1196 
1197  SwTextNode * pTextNode;
1198  sal_Int32 nMetaStart;
1199  sal_Int32 nMetaEnd;
1200  const bool bSuccess(SetContentRange(pTextNode, nMetaStart, nMetaEnd));
1201  OSL_ENSURE(bSuccess, "no pam?");
1202  if (!bSuccess)
1203  throw lang::DisposedException();
1204 
1205  SwPaM aPam(*pTextNode, nMetaStart);
1206 
1207  if (!m_pImpl->m_pTextPortions)
1208  {
1209  return new SwXTextPortionEnumeration(
1210  aPam, GetParentText(), nMetaStart, nMetaEnd);
1211  }
1212  else // cached!
1213  {
1214  return new SwXTextPortionEnumeration(aPam, std::deque(*m_pImpl->m_pTextPortions));
1215  }
1216 }
1217 
1218 // MetadatableMixin
1220 {
1221  return const_cast< ::sw::Meta * >(m_pImpl->GetMeta());
1222 }
1223 
1224 uno::Reference<frame::XModel> SwXMeta::GetModel()
1225 {
1226  ::sw::Meta const * const pMeta( m_pImpl->GetMeta() );
1227  if (pMeta)
1228  {
1229  SwTextNode const * const pTextNode( pMeta->GetTextNode() );
1230  if (pTextNode)
1231  {
1232  SwDocShell const * const pShell(pTextNode->GetDoc().GetDocShell());
1233  return pShell ? pShell->GetModel() : nullptr;
1234  }
1235  }
1236  return nullptr;
1237 }
1238 
1239 inline const ::sw::MetaField* SwXMeta::Impl::GetMetaField() const
1240 {
1241  return dynamic_cast<sw::MetaField*>(m_pMeta);
1242 }
1243 
1244 SwXMetaField::SwXMetaField(SwDoc *const pDoc, ::sw::Meta *const pMeta,
1245  uno::Reference<text::XText> const& xParentText,
1246  std::unique_ptr<TextRangeList_t const> pPortions)
1247  : SwXMetaField_Base(pDoc, pMeta, xParentText, std::move(pPortions))
1248 {
1249  assert(dynamic_cast< ::sw::MetaField* >(pMeta) && "SwXMetaField created for wrong hint!");
1250 }
1251 
1253  : SwXMetaField_Base(pDoc)
1254 {
1255 }
1256 
1258 {
1259 }
1260 
1261 // XServiceInfo
1262 OUString SAL_CALL
1264 {
1265  return "SwXMetaField";
1266 }
1267 
1268 sal_Bool SAL_CALL
1269 SwXMetaField::supportsService(const OUString& rServiceName)
1270 {
1271  return cppu::supportsService(this, rServiceName);
1272 }
1273 
1274 uno::Sequence< OUString > SAL_CALL
1276 {
1277  return {
1278  "com.sun.star.text.TextContent",
1279  "com.sun.star.text.TextField",
1280  "com.sun.star.text.textfield.MetadataField"
1281  };
1282 }
1283 
1284 // XComponent
1285 void SAL_CALL
1287  uno::Reference< lang::XEventListener> const & xListener )
1288 {
1289  return SwXMeta::addEventListener(xListener);
1290 }
1291 
1292 void SAL_CALL
1294  uno::Reference< lang::XEventListener> const & xListener )
1295 {
1296  return SwXMeta::removeEventListener(xListener);
1297 }
1298 
1299 void SAL_CALL
1301 {
1302  return SwXMeta::dispose();
1303 }
1304 
1305 // XTextContent
1306 void SAL_CALL
1307 SwXMetaField::attach(const uno::Reference< text::XTextRange > & i_xTextRange)
1308 {
1309  return SwXMeta::AttachImpl(i_xTextRange, RES_TXTATR_METAFIELD);
1310 }
1311 
1312 uno::Reference< text::XTextRange > SAL_CALL
1314 {
1315  return SwXMeta::getAnchor();
1316 }
1317 
1318 // XPropertySet
1319 uno::Reference< beans::XPropertySetInfo > SAL_CALL
1321 {
1322  SolarMutexGuard g;
1323 
1324  static uno::Reference< beans::XPropertySetInfo > xRef(
1326  ->getPropertySetInfo() );
1327  return xRef;
1328 }
1329 
1330 void SAL_CALL
1332  const OUString& rPropertyName, const uno::Any& rValue)
1333 {
1334  SolarMutexGuard g;
1335 
1336  ::sw::MetaField * const pMeta(
1337  const_cast< ::sw::MetaField * >(m_pImpl->GetMetaField()) );
1338  if (!pMeta)
1339  throw lang::DisposedException();
1340 
1341  if ( rPropertyName == "NumberFormat" )
1342  {
1343  sal_Int32 nNumberFormat(0);
1344  if (rValue >>= nNumberFormat)
1345  {
1346  pMeta->SetNumberFormat(static_cast<sal_uInt32>(nNumberFormat));
1347  }
1348  }
1349  else if ( rPropertyName == "IsFixedLanguage" )
1350  {
1351  bool b(false);
1352  if (rValue >>= b)
1353  {
1354  pMeta->SetIsFixedLanguage(b);
1355  }
1356  }
1357  else
1358  {
1359  throw beans::UnknownPropertyException(rPropertyName);
1360  }
1361 }
1362 
1363 uno::Any SAL_CALL
1364 SwXMetaField::getPropertyValue(const OUString& rPropertyName)
1365 {
1366  SolarMutexGuard g;
1367 
1368  ::sw::MetaField const * const pMeta( m_pImpl->GetMetaField() );
1369  if (!pMeta)
1370  throw lang::DisposedException();
1371 
1372  uno::Any any;
1373 
1374  if ( rPropertyName == "NumberFormat" )
1375  {
1376  const OUString text( getPresentation(false) );
1377  any <<= static_cast<sal_Int32>(pMeta->GetNumberFormat(text));
1378  }
1379  else if ( rPropertyName == "IsFixedLanguage" )
1380  {
1381  any <<= pMeta->IsFixedLanguage();
1382  }
1383  else
1384  {
1385  throw beans::UnknownPropertyException(rPropertyName);
1386  }
1387 
1388  return any;
1389 }
1390 
1391 void SAL_CALL
1393  const OUString& /*rPropertyName*/,
1394  const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
1395 {
1396  OSL_FAIL("SwXMetaField::addPropertyChangeListener(): not implemented");
1397 }
1398 
1399 void SAL_CALL
1401  const OUString& /*rPropertyName*/,
1402  const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
1403 {
1404  OSL_FAIL("SwXMetaField::removePropertyChangeListener(): not implemented");
1405 }
1406 
1407 void SAL_CALL
1409  const OUString& /*rPropertyName*/,
1410  const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
1411 {
1412  OSL_FAIL("SwXMetaField::addVetoableChangeListener(): not implemented");
1413 }
1414 
1415 void SAL_CALL
1417  const OUString& /*rPropertyName*/,
1418  const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
1419 {
1420  OSL_FAIL("SwXMetaField::removeVetoableChangeListener(): not implemented");
1421 }
1422 
1423 static uno::Reference<rdf::XURI> const&
1424 lcl_getURI(const sal_Int16 eKnown)
1425 {
1426  static uno::Reference< uno::XComponentContext > xContext(
1428  static uno::Reference< rdf::XURI > xOdfPrefix(
1429  rdf::URI::createKnown(xContext, rdf::URIs::ODF_PREFIX),
1430  uno::UNO_SET_THROW);
1431  static uno::Reference< rdf::XURI > xOdfSuffix(
1432  rdf::URI::createKnown(xContext, rdf::URIs::ODF_SUFFIX),
1433  uno::UNO_SET_THROW);
1434  static uno::Reference< rdf::XURI > xOdfShading(
1435  rdf::URI::createKnown(xContext, rdf::URIs::LO_EXT_SHADING),
1436  uno::UNO_SET_THROW);
1437  switch (eKnown)
1438  {
1439  case rdf::URIs::ODF_PREFIX:
1440  return xOdfPrefix;
1441  case rdf::URIs::ODF_SUFFIX:
1442  return xOdfSuffix;
1443  default:
1444  return xOdfShading;
1445  }
1446 }
1447 
1448 static OUString
1450  uno::Reference<rdf::XRepository> const & xRepository,
1451  uno::Reference<rdf::XResource> const & xMetaField,
1452  uno::Reference<rdf::XURI> const & xPredicate)
1453 {
1454  const uno::Reference<container::XEnumeration> xEnum(
1455  xRepository->getStatements(xMetaField, xPredicate, nullptr),
1456  uno::UNO_SET_THROW);
1457  while (xEnum->hasMoreElements()) {
1458  rdf::Statement stmt;
1459  if (!(xEnum->nextElement() >>= stmt)) {
1460  throw uno::RuntimeException();
1461  }
1462  const uno::Reference<rdf::XLiteral> xObject(stmt.Object,
1463  uno::UNO_QUERY);
1464  if (!xObject.is()) continue;
1465  if (xEnum->hasMoreElements()) {
1466  SAL_INFO("sw.uno", "ignoring other odf:Prefix/odf:Suffix statements");
1467  }
1468  return xObject->getValue();
1469  }
1470  return OUString();
1471 }
1472 
1473 void
1475  const uno::Reference<frame::XModel>& xModel,
1476  const uno::Reference<rdf::XMetadatable>& xMetaField,
1477  OUString *const o_pPrefix, OUString *const o_pSuffix, OUString *const o_pShadingColor)
1478 {
1479  try {
1480  const uno::Reference<rdf::XRepositorySupplier> xRS(
1481  xModel, uno::UNO_QUERY_THROW);
1482  const uno::Reference<rdf::XRepository> xRepo(
1483  xRS->getRDFRepository(), uno::UNO_SET_THROW);
1484  const uno::Reference<rdf::XResource> xMeta(
1485  xMetaField, uno::UNO_QUERY_THROW);
1486  if (o_pPrefix)
1487  {
1488  *o_pPrefix = lcl_getPrefixOrSuffix(xRepo, xMeta, lcl_getURI(rdf::URIs::ODF_PREFIX));
1489  }
1490  if (o_pSuffix)
1491  {
1492  *o_pSuffix = lcl_getPrefixOrSuffix(xRepo, xMeta, lcl_getURI(rdf::URIs::ODF_SUFFIX));
1493  }
1494  if (o_pShadingColor)
1495  {
1496  *o_pShadingColor = lcl_getPrefixOrSuffix(xRepo, xMeta, lcl_getURI(rdf::URIs::LO_EXT_SHADING));
1497  }
1498  } catch (uno::RuntimeException &) {
1499  throw;
1500  } catch (const uno::Exception &) {
1501  css::uno::Any anyEx = cppu::getCaughtException();
1502  throw lang::WrappedTargetRuntimeException("getPrefixAndSuffix: exception", nullptr, anyEx);
1503  }
1504 }
1505 
1506 // XTextField
1507 OUString SAL_CALL
1509 {
1510  SolarMutexGuard g;
1511 
1512  if (bShowCommand)
1513  {
1514 //FIXME ?
1515  return OUString();
1516  }
1517  else
1518  {
1519  // getString should check if this is invalid
1520  const OUString content( getString() );
1521  OUString prefix;
1522  OUString suffix;
1523  getPrefixAndSuffix(GetModel(), this, &prefix, &suffix, nullptr);
1524  return prefix + content + suffix;
1525  }
1526 }
1527 
1528 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void disposeAndClear(::std::unique_lock<::std::mutex > &rGuard, const css::lang::EventObject &rEvt)
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unorefmk.cxx:1018
static uno::Reference< rdf::XURI > const & lcl_getURI(const sal_Int16 eKnown)
Definition: unorefmk.cxx:1424
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unorefmk.cxx:1275
static css::uno::Reference< css::rdf::XMetadatable > CreateXMeta(::sw::Meta &rMeta, css::uno::Reference< css::text::XText > const &xParentText=nullptr, std::unique_ptr< TextRangeList_t const > &&pPortions=std::unique_ptr< TextRangeList_t const >())
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: unorefmk.cxx:1058
SwXMeta(SwXMeta const &)=delete
Starts a section of nodes in the document model.
Definition: node.hxx:313
Impl(SwDoc *const pDoc, SwFormatRefMark *const pRefMark)
Definition: unorefmk.cxx:74
const ::sw::Meta * GetMeta() const
Definition: unorefmk.cxx:642
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:224
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unorefmk.cxx:1169
virtual const SwDoc * GetDoc() const =0
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unorefmk.cxx:1024
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unorefmk.cxx:1400
SwFormatMeta * GetFormatMeta() const
Definition: fmtmeta.hxx:145
Marks a position in the document model.
Definition: pam.hxx:36
css::uno::Reference< css::text::XText > const & GetParentText() const
Definition: unorefmk.cxx:667
OUString & GetRefName()
Definition: fmtrfmrk.hxx:61
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:357
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_METAFIELD(49)
CursorType
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unorefmk.cxx:460
SwDocShell * GetDocShell()
Definition: doc.hxx:1351
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_META(48)
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unorefmk.cxx:293
std::mutex m_Mutex
Definition: unorefmk.cxx:610
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: unorefmk.cxx:1143
void InsertRefMark(SwPaM &rPam, SwXTextCursor const *const pCursor)
Definition: unorefmk.cxx:196
const SwPosition * GetMark() const
Definition: pam.hxx:210
void Invalidate()
Definition: unotext.cxx:148
css::uno::Reference< css::frame::XModel3 > GetModel() const
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
Definition: unomap1.cxx:1090
Definition: doc.hxx:187
virtual OUString SAL_CALL getImplementationName() override
Definition: unorefmk.cxx:855
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:1286
bool IsAtEndOfMeta() const
Definition: unoobj.cxx:791
uno::WeakReference< uno::XInterface > m_wThis
Definition: unorefmk.cxx:609
virtual void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
Definition: unorefmk.cxx:1116
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:877
bool CheckForOwnMemberMeta(const SwPaM &rPam, const bool bAbsorb)
Definition: unorefmk.cxx:779
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unorefmk.cxx:467
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unorefmk.cxx:173
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unometa.hxx:67
virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unorefmk.cxx:1313
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
virtual ~SwXMetaField() override
Definition: unorefmk.cxx:1257
virtual void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > &xContent) override
Definition: unorefmk.cxx:1134
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
bool m_bIsDisposed
Definition: unorefmk.cxx:614
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > &xTextPosition) override
Definition: unorefmk.cxx:1100
const SwFormatRefMark & GetRefMark() const
Definition: txatbase.hxx:238
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &Identifier) override
Definition: unorefmk.cxx:848
SfxHintId GetId() const
virtual ~SwXMeta() override
Definition: unorefmk.cxx:684
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unorefmk.cxx:1408
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_EventListeners
Definition: unorefmk.cxx:611
virtual void Notify(const SfxHint &rHint) override
Definition: unorefmk.cxx:648
#define PROPERTY_MAP_METAFIELD
Definition: unomap.hxx:123
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...
Definition: ndtxt.cxx:3068
static OUString lcl_getPrefixOrSuffix(uno::Reference< rdf::XRepository > const &xRepository, uno::Reference< rdf::XResource > const &xMetaField, uno::Reference< rdf::XURI > const &xPredicate)
Definition: unorefmk.cxx:1449
SwXReferenceMark(SwDoc *const pDoc, SwFormatRefMark *const pMark)
Definition: unorefmk.cxx:115
const SwTextNode & GetTextNode() const
Definition: txtrfmrk.hxx:44
const SwDoc & GetDoc() const
Definition: unoobj2.cxx:767
SwIndex nContent
Definition: pam.hxx:39
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unorefmk.cxx:474
Any SAL_CALL getCaughtException()
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
Definition: txatbase.hxx:43
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unorefmk.cxx:432
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:886
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unorefmk.cxx:1331
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual OUString SAL_CALL getImplementationName() override
Definition: unorefmk.cxx:161
sal_Int32 GetStart() const
Definition: txatbase.hxx:88
css::uno::WeakReference< css::rdf::XMetadatable > const & GetXMeta() const
Definition: fmtmeta.hxx:150
virtual ~SwXReferenceMark() override
Definition: unorefmk.cxx:121
virtual void Notify(const SfxHint &) override
Definition: unorefmk.cxx:109
SwXMetaField(SwDoc *const pDoc,::sw::Meta *const pMeta, css::uno::Reference< css::text::XText > const &xParentText, std::unique_ptr< TextRangeList_t const > pPortions)
virtual void SAL_CALL dispose() override
Definition: unorefmk.cxx:895
const css::uno::Sequence< sal_Int8 > & getSeq() const
virtual void SAL_CALL dispose() override
Definition: unorefmk.cxx:325
exports com.sun.star. text
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unorefmk.cxx:167
void EndListeningAll()
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
virtual void SAL_CALL setName(const OUString &rName) override
Definition: unorefmk.cxx:384
bool GetDefaultTextContentValue(css::uno::Any &rAny, std::u16string_view rPropertyName, sal_uInt16 nWID=0)
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override
Definition: unorefmk.cxx:1093
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unorefmk.cxx:481
const SwFormatRefMark * m_pMarkFormat
Definition: unorefmk.cxx:71
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:365
SwTextMeta * GetTextAttr() const
Definition: fmtatr2.cxx:651
SwDoc & GetDoc()
Definition: node.hxx:213
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unorefmk.cxx:1307
const SwPosition * GetPoint() const
Definition: pam.hxx:208
void SetIsFixedLanguage(bool b)
Definition: fmtmeta.hxx:183
Impl(SwXMeta &rThis, SwDoc &rDoc,::sw::Meta *const pMeta, uno::Reference< text::XText > const &xParentText, std::unique_ptr< TextRangeList_t const > pPortions)
Definition: unorefmk.cxx:620
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unorefmk.cxx:266
SetAttrMode
Definition: swtypes.hxx:132
void Exchange()
Definition: pam.cxx:490
virtual OUString SAL_CALL getPresentation(sal_Bool bShowCommand) override
Definition: unorefmk.cxx:1508
void SetXMeta(css::uno::Reference< css::rdf::XMetadatable > const &xMeta)
Definition: fmtmeta.hxx:152
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:206
const Any & any
uno::WeakReference< uno::XInterface > m_wThis
Definition: unorefmk.cxx:66
Force hint expand (only matters for hints with CH_TXTATR).
unsigned char sal_Bool
virtual ::sfx2::Metadatable * GetCoreObject() override
Definition: unorefmk.cxx:1219
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unorefmk.cxx:867
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: unorefmk.cxx:1071
virtual void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
Definition: unorefmk.cxx:1108
css::uno::Type const & get()
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unorefmk.cxx:861
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:703
virtual sal_Bool SAL_CALL hasElements() override
Definition: unorefmk.cxx:1174
bool StartListening(SvtBroadcaster &rBroadcaster)
sw::Meta * m_pMeta
Definition: unorefmk.cxx:618
static css::uno::Reference< css::text::XTextContent > CreateXReferenceMark(SwDoc &rDoc, SwFormatRefMark *pMarkFormat)
Definition: unorefmk.cxx:126
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unorefmk.cxx:1320
virtual void SAL_CALL insertTextContent(const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::text::XTextContent > &xContent, sal_Bool bAbsorb) override
Definition: unorefmk.cxx:1126
uno::Reference< text::XText > m_xParentText
Definition: unorefmk.cxx:616
virtual OUString SAL_CALL getName() override
Definition: unorefmk.cxx:373
bool IsValid() const
Definition: unorefmk.cxx:86
SwTextNode * GetTextNode() const
Definition: fmtmeta.hxx:143
enumrange< T >::Iterator end(enumrange< T >)
const SwPosition * Start() const
Definition: pam.hxx:213
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange,::sw::TextRangeMode const eMode)
Definition: unoobj2.cxx:1107
void SetXRefMark(css::uno::Reference< css::text::XTextContent > const &xMark)
Definition: fmtrfmrk.hxx:66
virtual OUString SAL_CALL getString() override
Definition: unorefmk.cxx:1078
virtual OUString SAL_CALL getImplementationName() override
Definition: unorefmk.cxx:1263
SvtBroadcaster & GetNotifier()
Definition: calbck.hxx:101
void AttachImpl(const css::uno::Reference< css::text::XTextRange > &xTextRange, const sal_uInt16 nWhich)
Definition: unorefmk.cxx:929
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unorefmk.cxx:1269
::cppu::ImplInheritanceHelper< SwXMeta, css::beans::XPropertySet, css::text::XTextField > SwXMetaField_Base
Definition: unometa.hxx:191
uno::Reference< text::XTextContent > GetNestedTextContent(SwTextNode const &rTextNode, sal_Int32 const nIndex, bool const bParent)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual void SAL_CALL setString(const OUString &rString) override
Definition: unorefmk.cxx:1085
the Meta has a cached list of text portions for its contents this list is created by SwXTextPortionEn...
Definition: unorefmk.cxx:606
css::uno::WeakReference< css::text::XTextContent > const & GetXRefMark() const
Definition: fmtrfmrk.hxx:64
#define SAL_WARN_IF(condition, area, stream)
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unorefmk.cxx:1364
bool m_bIsDescriptor
Definition: unorefmk.cxx:615
#define SAL_INFO(area, stream)
sal_Int32 GetIndex() const
Definition: index.hxx:91
const SwPosition * End() const
Definition: pam.hxx:218
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rIdentifier) override
Definition: unorefmk.cxx:156
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unorefmk.cxx:840
const sal_Int32 * End() const
Definition: txatbase.hxx:156
Reference< XComponentContext > getProcessComponentContext()
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:87
exports com.sun.star.report. meta
std::unique_ptr< const TextRangeList_t > m_pTextPortions
Definition: unorefmk.cxx:612
rtl::Reference< SwXMetaText > m_xText
Definition: unorefmk.cxx:617
const ::sw::MetaField * GetMetaField() const
Definition: unorefmk.cxx:1239
std::vector< SwTextAttr * > GetTextAttrsAt(sal_Int32 const nIndex, sal_uInt16 const nWhich) const
get the innermost text attributes covering position nIndex.
Definition: ndtxt.cxx:1737
#define PROPERTY_MAP_PARAGRAPH_EXTENSIONS
Definition: unomap.hxx:51
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_EventListeners
Definition: unorefmk.cxx:68
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unorefmk.cxx:1392
#define SAL_WARN(area, stream)
void getPrefixAndSuffix(const uno::Reference< frame::XModel > &xModel, const uno::Reference< rdf::XMetadatable > &xMetaField, OUString *const o_pPrefix, OUString *const o_pSuffix, OUString *const o_pShadingColor)
Definition: unorefmk.cxx:1474
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: unorefmk.cxx:1182
SwDoc & GetDoc() const
Definition: pam.hxx:244
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unorefmk.cxx:449
virtual void SAL_CALL setParent(css::uno::Reference< css::uno::XInterface > const &xParent) override
Definition: unorefmk.cxx:1162
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
static css::uno::Reference< css::text::XTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1214
static SwNode * GetStartNode(SwOutlineNodes const *pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type *nOutl)
Definition: docglbl.cxx:89
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
OUString getString(const Any &_rAny)
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: unorefmk.cxx:1064
virtual bool DeleteAndJoin(SwPaM &)=0
complete delete of a given PaM
virtual css::uno::Reference< css::frame::XModel > GetModel() override
Definition: unorefmk.cxx:1224
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unorefmk.cxx:1416
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:1293
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unorefmk.cxx:442
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unorefmark.hxx:50
uno::Reference< text::XText > CreateParentXText(SwDoc &rDoc, const SwPosition &rPos)
Definition: unoobj2.cxx:1235
sal_uInt16 Which() const
bool SetContentRange(SwTextNode *&rpNode, sal_Int32 &rStart, sal_Int32 &rEnd) const
init params with position of the attribute content (w/out CH_TXTATR)
Definition: unorefmk.cxx:757
virtual void SAL_CALL dispose() override
Definition: unorefmk.cxx:1300
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unorefmk.cxx:149
void SetNumberFormat(sal_uInt32 nNumberFormat)
Definition: fmtatr2.cxx:769
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:864
bool m_bDetectedRangeSegmentation false