LibreOffice Module sw (master)  1
unobkm.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 <unobookmark.hxx>
21 
23 #include <comphelper/sequence.hxx>
26 #include <osl/mutex.hxx>
27 #include <svl/itemprop.hxx>
28 #include <svl/listener.hxx>
29 #include <vcl/svapp.hxx>
30 #include <xmloff/odffields.hxx>
31 
32 #include <TextCursorHelper.hxx>
33 #include <unotextrange.hxx>
34 #include <unomap.hxx>
35 #include <unoprnms.hxx>
36 #include <IMark.hxx>
37 #include <crossrefbookmark.hxx>
38 #include <doc.hxx>
39 #include <docsh.hxx>
40 
41 using namespace ::sw::mark;
42 using namespace ::com::sun::star;
43 
45  : public SvtListener
46 {
47 private:
48  ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
49 
50 public:
51  uno::WeakReference<uno::XInterface> m_wThis;
55  OUString m_sMarkName;
56  bool m_bHidden;
57  OUString m_HideCondition;
58 
59  Impl( SwDoc *const pDoc )
60  : m_EventListeners(m_Mutex)
61  , m_pDoc(pDoc)
62  , m_pRegisteredBookmark(nullptr)
63  , m_bHidden(false)
64  {
65  // DO NOT registerInMark here! (because SetXBookmark would delete rThis)
66  }
67 
68  void registerInMark(SwXBookmark & rThis, ::sw::mark::IMark *const pBkmk);
69 protected:
70  virtual void Notify(const SfxHint&) override;
71 
72 };
73 
75 {
76  if(rHint.GetId() == SfxHintId::Dying)
77  {
78  m_pRegisteredBookmark = nullptr;
79  m_pDoc = nullptr;
80  uno::Reference<uno::XInterface> const xThis(m_wThis);
81  if (!xThis.is())
82  { // fdo#72695: if UNO object is already dead, don't revive it with event
83  return;
84  }
85  lang::EventObject const ev(xThis);
87  }
88 }
89 
91  ::sw::mark::IMark* const pBkmk)
92 {
93  const uno::Reference<text::XTextContent> xBookmark(&rThis);
94  if (pBkmk)
95  {
96  EndListeningAll();
97  StartListening(pBkmk->GetNotifier());
98  ::sw::mark::MarkBase *const pMarkBase(dynamic_cast< ::sw::mark::MarkBase * >(pBkmk));
99  OSL_ENSURE(pMarkBase, "registerInMark: no MarkBase?");
100  if (pMarkBase)
101  {
102  pMarkBase->SetXBookmark(xBookmark);
103  }
104  assert(m_pDoc == nullptr || m_pDoc == pBkmk->GetMarkPos().GetDoc());
105  m_pDoc = pBkmk->GetMarkPos().GetDoc();
106  }
107  else if (m_pRegisteredBookmark)
108  {
109  m_sMarkName = m_pRegisteredBookmark->GetName();
110 
111  // the following applies only to bookmarks (not to fieldmarks)
112  IBookmark* pBookmark = dynamic_cast<IBookmark*>(m_pRegisteredBookmark);
113  if (pBookmark)
114  {
115  m_bHidden = pBookmark->IsHidden();
116  m_HideCondition = pBookmark->GetHideCondition();
117  }
118  EndListeningAll();
119  }
120  m_pRegisteredBookmark = pBkmk;
121  // need a permanent Reference to initialize m_wThis
122  m_wThis = xBookmark;
123 }
124 
126  ::sw::mark::IMark *const pBkmk)
127 {
128  m_pImpl->registerInMark( rThis, pBkmk );
129 }
130 
132 {
133  return m_pImpl->m_pRegisteredBookmark;
134 }
135 
137 {
138  return m_pImpl->m_pDoc->getIDocumentMarkAccess();
139 }
140 
142  : m_pImpl( new SwXBookmark::Impl(pDoc) )
143 {
144 }
145 
147  : m_pImpl( new SwXBookmark::Impl(nullptr) )
148 {
149 }
150 
152 {
153 }
154 
155 uno::Reference<text::XTextContent> SwXBookmark::CreateXBookmark(
156  SwDoc & rDoc,
157  ::sw::mark::IMark *const pBookmark)
158 {
159  // #i105557#: do not iterate over the registered clients: race condition
160  ::sw::mark::MarkBase *const pMarkBase(dynamic_cast< ::sw::mark::MarkBase * >(pBookmark));
161  OSL_ENSURE(!pBookmark || pMarkBase, "CreateXBookmark: no MarkBase?");
162  uno::Reference<text::XTextContent> xBookmark;
163  if (pMarkBase)
164  {
165  xBookmark = pMarkBase->GetXBookmark();
166  }
167  if (!xBookmark.is())
168  {
169  OSL_ENSURE(!pBookmark ||
170  dynamic_cast< ::sw::mark::IBookmark* >(pBookmark) ||
172  "<SwXBookmark::GetObject(..)>"
173  "SwXBookmark requested for non-bookmark mark and non-annotation mark.");
174  SwXBookmark *const pXBookmark =
175  pBookmark ? new SwXBookmark(&rDoc) : new SwXBookmark;
176  xBookmark.set(pXBookmark);
177  pXBookmark->m_pImpl->registerInMark(*pXBookmark, pMarkBase);
178  }
179  return xBookmark;
180 }
181 
183  const uno::Reference< lang::XUnoTunnel> & xUT)
184 {
185  SwXBookmark *const pXBkm(
186  ::sw::UnoTunnelGetImplementation<SwXBookmark>(xUT));
187  if (pXBkm && (pDoc == pXBkm->m_pImpl->m_pDoc))
188  {
189  return pXBkm->m_pImpl->m_pRegisteredBookmark;
190  }
191  return nullptr;
192 }
193 
194 namespace
195 {
196  class theSwXBookmarkUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXBookmarkUnoTunnelId > {};
197 }
198 
199 const uno::Sequence< sal_Int8 > & SwXBookmark::getUnoTunnelId()
200 {
201  return theSwXBookmarkUnoTunnelId::get().getSeq();
202 }
203 
204 sal_Int64 SAL_CALL SwXBookmark::getSomething( const uno::Sequence< sal_Int8 >& rId )
205 {
206  return ::sw::UnoTunnelImpl<SwXBookmark>(rId, this);
207 }
208 
210  const uno::Reference< text::XTextRange > & xTextRange,
212 {
213  if (m_pImpl->m_pRegisteredBookmark)
214  {
215  throw uno::RuntimeException();
216  }
217 
218  const uno::Reference<lang::XUnoTunnel> xRangeTunnel(
219  xTextRange, uno::UNO_QUERY);
220  SwXTextRange* pRange = nullptr;
221  OTextCursorHelper* pCursor = nullptr;
222  if(xRangeTunnel.is())
223  {
224  pRange = ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
225  pCursor =
226  ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
227  }
228 
229  SwDoc *const pDoc =
230  pRange ? &pRange->GetDoc() : (pCursor ? pCursor->GetDoc() : nullptr);
231  if (!pDoc)
232  {
233  throw lang::IllegalArgumentException();
234  }
235 
236  m_pImpl->m_pDoc = pDoc;
237  SwUnoInternalPaM aPam(*m_pImpl->m_pDoc);
238  ::sw::XTextRangeToSwPaM(aPam, xTextRange);
239  UnoActionContext aCont(m_pImpl->m_pDoc);
240  if (m_pImpl->m_sMarkName.isEmpty())
241  {
242  m_pImpl->m_sMarkName = "Bookmark";
243  }
246  {
248  }
249  else if ((eType == IDocumentMarkAccess::MarkType::BOOKMARK) &&
252  {
254  }
255  m_pImpl->registerInMark(*this,
256  m_pImpl->m_pDoc->getIDocumentMarkAccess()->makeMark(
257  aPam, m_pImpl->m_sMarkName, eType, ::sw::mark::InsertMode::New));
258  // #i81002#
259  // Check, if bookmark has been created.
260  // E.g., the creation of a cross-reference bookmark is suppress,
261  // if the PaM isn't a valid one for cross-reference bookmarks.
262  if (!m_pImpl->m_pRegisteredBookmark)
263  {
264  OSL_FAIL("<SwXBookmark::attachToRange(..)>"
265  " - could not create Mark.");
266  throw lang::IllegalArgumentException();
267  }
268 }
269 
270 void SwXBookmark::attachToRange( const uno::Reference< text::XTextRange > & xTextRange )
271 {
273 }
274 
275 void SAL_CALL SwXBookmark::attach( const uno::Reference< text::XTextRange > & xTextRange )
276 {
277  SolarMutexGuard aGuard;
278  attachToRange( xTextRange );
279 }
280 
281 uno::Reference< text::XTextRange > SAL_CALL SwXBookmark::getAnchor()
282 {
283  SolarMutexGuard aGuard;
284 
285  if (!m_pImpl->m_pRegisteredBookmark)
286  {
287  throw uno::RuntimeException();
288  }
290  *m_pImpl->m_pDoc,
291  m_pImpl->m_pRegisteredBookmark->GetMarkPos(),
292  (m_pImpl->m_pRegisteredBookmark->IsExpanded())
293  ? &m_pImpl->m_pRegisteredBookmark->GetOtherMarkPos() : nullptr);
294 }
295 
296 void SAL_CALL SwXBookmark::dispose()
297 {
298  SolarMutexGuard aGuard;
299  if (m_pImpl->m_pRegisteredBookmark)
300  {
301  m_pImpl->m_pDoc->getIDocumentMarkAccess()->deleteMark( m_pImpl->m_pRegisteredBookmark );
302  }
303 }
304 
306  const uno::Reference< lang::XEventListener > & xListener)
307 {
308  // no need to lock here as m_pImpl is const and container threadsafe
309  m_pImpl->m_EventListeners.addInterface(xListener);
310 }
311 
313  const uno::Reference< lang::XEventListener > & xListener)
314 {
315  // no need to lock here as m_pImpl is const and container threadsafe
316  m_pImpl->m_EventListeners.removeInterface(xListener);
317 }
318 
319 OUString SAL_CALL SwXBookmark::getName()
320 {
321  SolarMutexGuard aGuard;
322 
323  return (m_pImpl->m_pRegisteredBookmark)
324  ? m_pImpl->m_pRegisteredBookmark->GetName()
325  : m_pImpl->m_sMarkName;
326 }
327 
328 void SAL_CALL SwXBookmark::setName(const OUString& rName)
329 {
330  SolarMutexGuard aGuard;
331 
332  if (!m_pImpl->m_pRegisteredBookmark)
333  {
334  m_pImpl->m_sMarkName = rName;
335  }
336  if (!m_pImpl->m_pRegisteredBookmark || (getName() == rName))
337  {
338  return;
339  }
340  IDocumentMarkAccess *const pMarkAccess =
341  m_pImpl->m_pDoc->getIDocumentMarkAccess();
342  if(pMarkAccess->findMark(rName) != pMarkAccess->getAllMarksEnd())
343  {
344  throw uno::RuntimeException("setName(): name already in use",
345  static_cast<::cppu::OWeakObject*>(this));
346  }
347 
348  SwPaM aPam(m_pImpl->m_pRegisteredBookmark->GetMarkPos());
349  if (m_pImpl->m_pRegisteredBookmark->IsExpanded())
350  {
351  aPam.SetMark();
352  *aPam.GetMark() = m_pImpl->m_pRegisteredBookmark->GetOtherMarkPos();
353  }
354 
355  pMarkAccess->renameMark(m_pImpl->m_pRegisteredBookmark, rName);
356 }
357 
358 OUString SAL_CALL
360 {
361  return "SwXBookmark";
362 }
363 
364 sal_Bool SAL_CALL SwXBookmark::supportsService(const OUString& rServiceName)
365 {
366  return cppu::supportsService(this, rServiceName);
367 }
368 
369 uno::Sequence< OUString > SAL_CALL
371 {
372  return {
373  "com.sun.star.text.TextContent",
374  "com.sun.star.text.Bookmark",
375  "com.sun.star.document.LinkTarget"
376  };
377 }
378 
379 // MetadatableMixin
381 {
382  return dynamic_cast< ::sfx2::Metadatable* >(m_pImpl->m_pRegisteredBookmark);
383 }
384 
385 uno::Reference<frame::XModel> SwXBookmark::GetModel()
386 {
387  if (m_pImpl->m_pDoc)
388  {
389  SwDocShell const * const pShell( m_pImpl->m_pDoc->GetDocShell() );
390  return pShell ? pShell->GetModel() : nullptr;
391  }
392  return nullptr;
393 }
394 
395 uno::Reference< beans::XPropertySetInfo > SAL_CALL
397 {
398  SolarMutexGuard g;
399 
400  static uno::Reference< beans::XPropertySetInfo > xRef(
402  ->getPropertySetInfo() );
403  return xRef;
404 }
405 
406 void SAL_CALL
407 SwXBookmark::setPropertyValue(const OUString& PropertyName,
408  const uno::Any& rValue)
409 {
410  if (PropertyName == UNO_NAME_BOOKMARK_HIDDEN)
411  {
412  bool bNewValue = false;
413  if (!(rValue >>= bNewValue))
414  throw lang::IllegalArgumentException("Property BookmarkHidden requires value of type boolean", nullptr, 0);
415 
416  IBookmark* pBookmark = dynamic_cast<IBookmark*>(m_pImpl->m_pRegisteredBookmark);
417  if (pBookmark)
418  {
419  pBookmark->Hide(bNewValue);
420  }
421  else
422  {
423  m_pImpl->m_bHidden = bNewValue;
424  }
425  return;
426  }
427  else if (PropertyName == UNO_NAME_BOOKMARK_CONDITION)
428  {
429  OUString newValue;
430  if (!(rValue >>= newValue))
431  throw lang::IllegalArgumentException("Property BookmarkCondition requires value of type string", nullptr, 0);
432 
433  IBookmark* pBookmark = dynamic_cast<IBookmark*>(m_pImpl->m_pRegisteredBookmark);
434  if (pBookmark)
435  {
436  pBookmark->SetHideCondition(newValue);
437  }
438  else
439  {
440  m_pImpl->m_HideCondition = newValue;
441  }
442  return;
443  }
444 
445  // nothing to set here
446  throw lang::IllegalArgumentException("Property is read-only: "
447  + PropertyName, static_cast< cppu::OWeakObject * >(this), 0 );
448 }
449 
450 uno::Any SAL_CALL SwXBookmark::getPropertyValue(const OUString& rPropertyName)
451 {
452  SolarMutexGuard g;
453 
454  uno::Any aRet;
455  if (! ::sw::GetDefaultTextContentValue(aRet, rPropertyName))
456  {
457  if(rPropertyName == UNO_LINK_DISPLAY_NAME)
458  {
459  aRet <<= getName();
460  }
461  else if (rPropertyName == UNO_NAME_BOOKMARK_HIDDEN)
462  {
463  IBookmark* pBookmark = dynamic_cast<IBookmark*>(m_pImpl->m_pRegisteredBookmark);
464  if (pBookmark)
465  {
466  aRet <<= pBookmark->IsHidden();
467  }
468  else
469  {
470  aRet <<= m_pImpl->m_bHidden;
471  }
472  }
473  else if (rPropertyName == UNO_NAME_BOOKMARK_CONDITION)
474  {
475  IBookmark* pBookmark = dynamic_cast<IBookmark*>(m_pImpl->m_pRegisteredBookmark);
476  if (pBookmark)
477  {
478  aRet <<= pBookmark->GetHideCondition();
479  }
480  else
481  {
482  aRet <<= m_pImpl->m_HideCondition;
483  }
484  }
485  }
486  return aRet;
487 }
488 
489 void SAL_CALL
491  const OUString& /*rPropertyName*/,
492  const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
493 {
494  OSL_FAIL("SwXBookmark::addPropertyChangeListener(): not implemented");
495 }
496 
497 void SAL_CALL
499  const OUString& /*rPropertyName*/,
500  const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
501 {
502  OSL_FAIL("SwXBookmark::removePropertyChangeListener(): not implemented");
503 }
504 
505 void SAL_CALL
507  const OUString& /*rPropertyName*/,
508  const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
509 {
510  OSL_FAIL("SwXBookmark::addVetoableChangeListener(): not implemented");
511 }
512 
513 void SAL_CALL
515  const OUString& /*rPropertyName*/,
516  const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
517 {
518  OSL_FAIL("SwXBookmark::removeVetoableChangeListener(): not implemented");
519 }
520 
521 SwXFieldmark::SwXFieldmark(bool _isReplacementObject, SwDoc* pDc)
522  : SwXFieldmark_Base(pDc)
523  , m_bReplacementObject(_isReplacementObject)
524 { }
525 
526 void SwXFieldmarkParameters::insertByName(const OUString& aName, const uno::Any& aElement)
527 {
528  SolarMutexGuard aGuard;
529  IFieldmark::parameter_map_t* pParameters = getCoreParameters();
530  if(pParameters->find(aName) != pParameters->end())
531  throw container::ElementExistException();
532  (*pParameters)[aName] = aElement;
533 }
534 
535 void SwXFieldmarkParameters::removeByName(const OUString& aName)
536 {
537  SolarMutexGuard aGuard;
538  if(!getCoreParameters()->erase(aName))
539  throw container::NoSuchElementException();
540 }
541 
542 void SwXFieldmarkParameters::replaceByName(const OUString& aName, const uno::Any& aElement)
543 {
544  SolarMutexGuard aGuard;
545  IFieldmark::parameter_map_t* pParameters = getCoreParameters();
546  IFieldmark::parameter_map_t::iterator pEntry = pParameters->find(aName);
547  if(pEntry == pParameters->end())
548  throw container::NoSuchElementException();
549  pEntry->second = aElement;
550 }
551 
553 {
554  SolarMutexGuard aGuard;
555  IFieldmark::parameter_map_t* pParameters = getCoreParameters();
556  IFieldmark::parameter_map_t::iterator pEntry = pParameters->find(aName);
557  if(pEntry == pParameters->end())
558  throw container::NoSuchElementException();
559  return pEntry->second;
560 }
561 
563 {
564  SolarMutexGuard aGuard;
565  IFieldmark::parameter_map_t* pParameters = getCoreParameters();
566  return comphelper::mapKeysToSequence(*pParameters);
567 }
568 
570 {
571  SolarMutexGuard aGuard;
572  IFieldmark::parameter_map_t* pParameters = getCoreParameters();
573  return (pParameters->find(aName) != pParameters->end());
574 }
575 
577 {
579 }
580 
582 {
583  SolarMutexGuard aGuard;
584  return !getCoreParameters()->empty();
585 }
586 
588 {
589  if(rHint.GetId() == SfxHintId::Dying)
590  m_pFieldmark = nullptr;
591 }
592 
593 IFieldmark::parameter_map_t* SwXFieldmarkParameters::getCoreParameters()
594 {
595  if(!m_pFieldmark)
596  throw uno::RuntimeException();
597  return m_pFieldmark->GetParameters();
598 }
599 
600 void SwXFieldmark::attachToRange( const uno::Reference < text::XTextRange >& xTextRange )
601 {
602 
603  attachToRangeEx( xTextRange,
605 }
606 
608 {
609  SolarMutexGuard aGuard;
610  const IFieldmark *pBkm = dynamic_cast<const IFieldmark*>(GetBookmark());
611  if(!pBkm)
612  throw uno::RuntimeException();
613  return pBkm->GetFieldname();
614 }
615 
616 void SwXFieldmark::setFieldType(const OUString & fieldType)
617 {
618  SolarMutexGuard aGuard;
619  IFieldmark *pBkm = dynamic_cast<IFieldmark*>(GetBookmark());
620  if(!pBkm)
621  throw uno::RuntimeException();
622  if(fieldType != getFieldType())
623  {
624  if(fieldType == ODF_FORMDROPDOWN || fieldType == ODF_FORMCHECKBOX || fieldType == ODF_FORMDATE)
625  {
626  ::sw::mark::IFieldmark* pNewFieldmark = GetIDocumentMarkAccess()->changeFormFieldmarkType(pBkm, fieldType);
627  if (pNewFieldmark)
628  {
629  registerInMark(*this, pNewFieldmark);
630  return;
631  }
632  }
633 
634  // We did not generate a new fieldmark, so set the type ID
635  pBkm->SetFieldname(fieldType);
636  }
637 }
638 
639 uno::Reference<container::XNameContainer> SwXFieldmark::getParameters()
640 {
641  SolarMutexGuard aGuard;
642  IFieldmark *pBkm = dynamic_cast<IFieldmark*>(GetBookmark());
643  if(!pBkm)
644  throw uno::RuntimeException();
645  return uno::Reference<container::XNameContainer>(new SwXFieldmarkParameters(pBkm));
646 }
647 
648 uno::Reference<text::XTextContent>
650  bool const isReplacementObject)
651 {
652  // #i105557#: do not iterate over the registered clients: race condition
653  ::sw::mark::MarkBase *const pMarkBase(
654  dynamic_cast< ::sw::mark::MarkBase * >(pMark));
655  assert(!pMark || pMarkBase);
656  uno::Reference<text::XTextContent> xMark;
657  if (pMarkBase)
658  {
659  xMark = pMarkBase->GetXBookmark();
660  }
661  if (!xMark.is())
662  {
663  // FIXME: These belong in XTextFieldsSupplier
664  SwXFieldmark* pXBkmk = nullptr;
665  if (dynamic_cast< ::sw::mark::TextFieldmark* >(pMark))
666  pXBkmk = new SwXFieldmark(false, &rDoc);
667  else if (dynamic_cast< ::sw::mark::CheckboxFieldmark* >(pMark))
668  pXBkmk = new SwXFieldmark(true, &rDoc);
669  else if (dynamic_cast< ::sw::mark::DropDownFieldmark* >(pMark))
670  pXBkmk = new SwXFieldmark(true, &rDoc);
671  else if (dynamic_cast< ::sw::mark::DateFieldmark* >(pMark))
672  pXBkmk = new SwXFieldmark(false, &rDoc);
673  else
674  pXBkmk = new SwXFieldmark(isReplacementObject, &rDoc);
675 
676  xMark.set(pXBkmk);
677  pXBkmk->registerInMark(*pXBkmk, pMarkBase);
678  }
679  return xMark;
680 }
681 
684 {
685  ::sw::mark::ICheckboxFieldmark* pCheckboxFm = nullptr;
686  if ( getFieldType() == ODF_FORMCHECKBOX )
687  {
688  pCheckboxFm = dynamic_cast< ::sw::mark::ICheckboxFieldmark* >( GetBookmark());
689  assert( GetBookmark() == nullptr || pCheckboxFm != nullptr );
690  // unclear to me whether GetBookmark() can be null here
691  }
692  return pCheckboxFm;
693 
694 }
695 
696 // support 'hidden' "Checked" property ( note: this property is just for convenience to support
697 // docx import filter thus not published via PropertySet info )
698 
699 void SAL_CALL
700 SwXFieldmark::setPropertyValue(const OUString& PropertyName,
701  const uno::Any& rValue)
702 {
703  SolarMutexGuard g;
704  if ( PropertyName == "Checked" )
705  {
707  bool bChecked( false );
708  if ( !(pCheckboxFm && ( rValue >>= bChecked )) )
709  throw uno::RuntimeException();
710 
711  pCheckboxFm->SetChecked( bChecked );
712  }
713  else
714  SwXFieldmark_Base::setPropertyValue( PropertyName, rValue );
715 }
716 
717 // support 'hidden' "Checked" property ( note: this property is just for convenience to support
718 // docx import filter thus not published via PropertySet info )
719 
720 uno::Any SAL_CALL SwXFieldmark::getPropertyValue(const OUString& rPropertyName)
721 {
722  SolarMutexGuard g;
723  if ( rPropertyName == "Checked" )
724  {
726  if ( !pCheckboxFm )
727  throw uno::RuntimeException();
728 
729  return uno::makeAny( pCheckboxFm->IsChecked() );
730  }
731  return SwXFieldmark_Base::getPropertyValue( rPropertyName );
732 }
733 
734 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
::comphelper::OInterfaceContainerHelper2 m_EventListeners
Definition: unobkm.cxx:52
::osl::Mutex m_Mutex
Definition: unobkm.cxx:48
virtual const SwDoc * GetDoc() const =0
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unobkm.cxx:199
SwDoc * m_pDoc
Definition: unobkm.cxx:53
SwXFieldmark(bool isReplacementObject, SwDoc *pDoc)
Definition: unobkm.cxx:521
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unobkm.cxx:576
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
Definition: docbm.cxx:474
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unobkm.cxx:450
IDocumentMarkAccess * GetIDocumentMarkAccess()
Definition: unobkm.cxx:136
Provides access to the marks of a document.
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
Definition: unomap1.cxx:1059
Definition: doc.hxx:185
#define ODF_FORMCHECKBOX
#define PROPERTY_MAP_BOOKMARK
Definition: unomap.hxx:50
::sw::mark::IMark * m_pRegisteredBookmark
Definition: unobkm.cxx:54
virtual const SwPosition & GetMarkPos() const =0
void disposeAndClear(const css::lang::EventObject &rEvt)
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unobkm.cxx:506
virtual css::uno::Reference< css::frame::XModel > GetModel() override
Definition: unobkm.cxx:385
css::uno::Reference< css::frame::XModel > GetModel() const
OUString m_sMarkName
Definition: unobkm.cxx:55
virtual ::sfx2::Metadatable * GetCoreObject() override
Definition: unobkm.cxx:380
::sw::mark::IFieldmark::parameter_map_t * getCoreParameters()
Definition: unobkm.cxx:593
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
static bool IsLegalName(const OUString &rName)
SfxHintId GetId() const
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unobkm.cxx:281
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unobkm.cxx:562
SwDoc * m_pDoc
Definition: docbm.cxx:1134
void registerInMark(SwXBookmark &rThis,::sw::mark::IMark *const pBkmk)
Definition: unobkm.cxx:90
const SwDoc & GetDoc() const
Definition: unoobj2.cxx:732
static SW_DLLPUBLIC bool IsLegalPaMForCrossRefHeadingBookmark(const SwPaM &rPaM)
Definition: docbm.cxx:513
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
bool GetDefaultTextContentValue(css::uno::Any &rAny, const OUString &rPropertyName, sal_uInt16 nWID=0)
virtual void SAL_CALL removeByName(const OUString &Name) override
Definition: unobkm.cxx:535
SwDoc * GetDoc() const
Returns the document this position is in.
Definition: pam.cxx:176
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
static css::uno::Reference< css::text::XTextContent > CreateXFieldmark(SwDoc &rDoc,::sw::mark::IMark *pMark, bool isReplacementObject=false)
Definition: unobkm.cxx:649
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unobkm.cxx:498
virtual parameter_map_t * GetParameters()=0
#define UNO_NAME_BOOKMARK_HIDDEN
Definition: unoprnms.hxx:341
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unobkm.cxx:720
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: unobkm.cxx:569
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange)
Definition: unoobj2.cxx:951
SwXBookmark()
descriptor
Definition: unobkm.cxx:146
cppu::ImplInheritanceHelper< SwXBookmark, css::text::XFormField > SwXFieldmark_Base
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unobkm.cxx:275
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
static css::uno::Reference< css::text::XTextContent > CreateXBookmark(SwDoc &rDoc,::sw::mark::IMark *pBookmark)
Definition: unobkm.cxx:155
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unobkm.cxx:370
virtual bool IsChecked() const =0
virtual const_iterator_t getAllMarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of marks.
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unobkm.cxx:490
unsigned char sal_Bool
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unobkm.cxx:312
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unobkm.cxx:305
virtual void SAL_CALL setFieldType(const OUString &description) override
Definition: unobkm.cxx:616
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: unobkm.cxx:542
::sw::mark::IMark * GetBookmark() const
Definition: unobkm.cxx:131
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unobkm.cxx:700
uno::WeakReference< uno::XInterface > m_wThis
Definition: unobkm.cxx:51
SvtBroadcaster & GetNotifier()
Definition: calbck.hxx:93
virtual void Notify(const SfxHint &rHint) override
Definition: unobkm.cxx:587
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: unobkm.cxx:526
Impl(SwDoc *const pDoc)
Definition: unobkm.cxx:59
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unobkm.cxx:514
virtual sal_Bool SAL_CALL hasElements() override
Definition: unobkm.cxx:581
void registerInMark(SwXBookmark &rXMark,::sw::mark::IMark *const pMarkBase)
Definition: unobkm.cxx:125
virtual OUString SAL_CALL getFieldType() override
Definition: unobkm.cxx:607
virtual void SAL_CALL setName(const OUString &rName) override
Definition: unobkm.cxx:328
virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getParameters() override
Definition: unobkm.cxx:639
virtual ~SwXBookmark() override
Definition: unobkm.cxx:151
::sw::mark::ICheckboxFieldmark * getCheckboxFieldmark()
Definition: unobkm.cxx:683
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:89
::sw::mark::IMark const * GetBookmarkInDoc(SwDoc const *const pDoc, const css::uno::Reference< css::lang::XUnoTunnel > &xUT)
Definition: unobkm.cxx:182
#define UNO_LINK_DISPLAY_NAME
Definition: unoprnms.hxx:453
virtual OUString SAL_CALL getImplementationName() override
Definition: unobkm.cxx:359
#define UNO_NAME_BOOKMARK_CONDITION
Definition: unoprnms.hxx:342
virtual void attachToRange(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unobkm.cxx:600
void attachToRangeEx(const css::uno::Reference< css::text::XTextRange > &xTextRange, IDocumentMarkAccess::MarkType eType)
Definition: unobkm.cxx:209
#define ODF_FORMDATE
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rIdentifier) override
Definition: unobkm.cxx:204
virtual bool renameMark(::sw::mark::IMark *io_pMark, const OUString &rNewName)=0
Renames an existing Mark, if possible.
bool const m_bReplacementObject
virtual OUString SAL_CALL getName() override
Definition: unobkm.cxx:319
virtual void attachToRange(const css::uno::Reference< css::text::XTextRange > &xTextRange)
Definition: unobkm.cxx:270
OUString m_HideCondition
Definition: unobkm.cxx:57
const css::uno::WeakReference< css::text::XTextContent > & GetXBookmark() const
Definition: bookmrk.hxx:108
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:469
static bool IsLegalName(const OUString &rName)
static css::uno::Reference< css::text::XTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1053
virtual void SAL_CALL dispose() override
Definition: unobkm.cxx:296
virtual void SetChecked(bool checked)=0
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: unobkm.cxx:552
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unobookmark.hxx:55
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unobkm.cxx:396
::sw::mark::IFieldmark * m_pFieldmark
virtual void Notify(const SfxHint &) override
Definition: unobkm.cxx:74
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unobkm.cxx:407
css::uno::Sequence< typename M::key_type > mapKeysToSequence(M const &map)
#define ODF_FORMDROPDOWN
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unobkm.cxx:364