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