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