LibreOffice Module sw (master)  1
bookmrk.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 <bookmrk.hxx>
22 #include <IDocumentUndoRedo.hxx>
24 #include <IDocumentState.hxx>
25 #include <doc.hxx>
26 #include <ndtxt.hxx>
27 #include <pam.hxx>
28 #include <swserv.hxx>
29 #include <sfx2/linkmgr.hxx>
30 #include <UndoBookmark.hxx>
31 #include <unobookmark.hxx>
32 #include <xmloff/odffields.hxx>
33 #include <libxml/xmlwriter.h>
34 #include <comphelper/random.hxx>
36 #include <sal/log.hxx>
37 #include <svl/zforlist.hxx>
38 #include <edtwin.hxx>
39 #include <DateFormFieldButton.hxx>
42 #include <comphelper/lok.hxx>
43 #include <view.hxx>
44 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
45 #include <wrtsh.hxx>
46 #include <rtl/strbuf.hxx>
47 #include <sfx2/lokhelper.hxx>
48 #include <strings.hrc>
49 
50 using namespace ::sw::mark;
51 using namespace ::com::sun::star;
52 using namespace ::com::sun::star::uno;
53 
54 namespace sw::mark
55 {
56 
58  {
59  SwPosition const& rStartPos(rMark.GetMarkStart());
60  SwPosition const& rEndPos(rMark.GetMarkEnd());
61  SwNodes const& rNodes(rStartPos.nNode.GetNodes());
62  sal_uLong const nStartNode(rStartPos.nNode.GetIndex());
63  sal_uLong const nEndNode(rEndPos.nNode.GetIndex());
64  int nFields(0);
65  std::optional<SwPosition> ret;
66  for (sal_uLong n = nEndNode; nStartNode <= n; --n)
67  {
68  SwNode *const pNode(rNodes[n]);
69  if (pNode->IsTextNode())
70  {
71  SwTextNode & rTextNode(*pNode->GetTextNode());
72  sal_Int32 const nStart(n == nStartNode
73  ? rStartPos.nContent.GetIndex() + 1
74  : 0);
75  sal_Int32 const nEnd(n == nEndNode
76  // subtract 1 to ignore the end char
77  ? rEndPos.nContent.GetIndex() - 1
78  : rTextNode.Len());
79  for (sal_Int32 i = nEnd; nStart < i; --i)
80  {
81  const sal_Unicode c(rTextNode.GetText()[i - 1]);
82  switch (c)
83  {
85  --nFields;
86  assert(0 <= nFields);
87  break;
89  ++nFields;
90  // fields in field result could happen by manual
91  // editing, although the field update deletes them
92  break;
94  if (nFields == 0)
95  {
96  assert(!ret); // one per field
97  ret = SwPosition(rTextNode, i - 1);
98 #ifndef DBG_UTIL
99  return *ret;
100 #endif
101  }
102  break;
103  }
104  }
105  }
106  else if (pNode->IsEndNode())
107  {
108  assert(nStartNode <= pNode->StartOfSectionIndex());
109  // fieldmark cannot overlap node section
110  n = pNode->StartOfSectionIndex();
111  }
112  else
113  {
114  assert(pNode->IsNoTextNode());
115  }
116  }
117  assert(ret); // must have found it
118  return *ret;
119  }
120 } // namespace sw::mark
121 
122 namespace
123 {
124  void lcl_FixPosition(SwPosition& rPos)
125  {
126  // make sure the position has 1) the proper node, and 2) a proper index
127  SwTextNode* pTextNode = rPos.nNode.GetNode().GetTextNode();
128  if(pTextNode == nullptr && rPos.nContent.GetIndex() > 0)
129  {
130  SAL_INFO(
131  "sw.core",
132  "illegal position: " << rPos.nContent.GetIndex()
133  << " without proper TextNode");
134  rPos.nContent.Assign(nullptr, 0);
135  }
136  else if(pTextNode != nullptr && rPos.nContent.GetIndex() > pTextNode->Len())
137  {
138  SAL_INFO(
139  "sw.core",
140  "illegal position: " << rPos.nContent.GetIndex()
141  << " is beyond " << pTextNode->Len());
142  rPos.nContent.Assign(pTextNode, pTextNode->Len());
143  }
144  }
145 
146  void lcl_AssertFieldMarksSet(const Fieldmark& rField,
147  const sal_Unicode aStartMark,
148  const sal_Unicode aEndMark)
149  {
150  if (aEndMark != CH_TXT_ATR_FORMELEMENT)
151  {
152  SwPosition const& rStart(rField.GetMarkStart());
153  assert(rStart.nNode.GetNode().GetTextNode()->GetText()[rStart.nContent.GetIndex()] == aStartMark); (void) rStart; (void) aStartMark;
154  SwPosition const sepPos(sw::mark::FindFieldSep(rField));
155  assert(sepPos.nNode.GetNode().GetTextNode()->GetText()[sepPos.nContent.GetIndex()] == CH_TXT_ATR_FIELDSEP); (void) sepPos;
156  }
157  SwPosition const& rEnd(rField.GetMarkEnd());
158  assert(rEnd.nNode.GetNode().GetTextNode()->GetText()[rEnd.nContent.GetIndex() - 1] == aEndMark); (void) rEnd;
159  }
160 
161  void lcl_SetFieldMarks(Fieldmark& rField,
162  SwDoc& io_rDoc,
163  const sal_Unicode aStartMark,
164  const sal_Unicode aEndMark,
165  SwPosition const*const pSepPos)
166  {
168  OUString startChar(aStartMark);
169  if (aEndMark != CH_TXT_ATR_FORMELEMENT
170  && rField.GetMarkStart() == rField.GetMarkEnd())
171  {
172  // do only 1 InsertString call - to expand existing bookmarks at the
173  // position over the whole field instead of just aStartMark
174  startChar += OUStringChar(CH_TXT_ATR_FIELDSEP) + OUStringChar(aEndMark);
175  }
176 
177  SwPosition start = rField.GetMarkStart();
178  if (aEndMark != CH_TXT_ATR_FORMELEMENT)
179  {
180  SwPaM aStartPaM(start);
181  io_rDoc.getIDocumentContentOperations().InsertString(aStartPaM, startChar);
182  start.nContent -= startChar.getLength(); // restore, it was moved by InsertString
183  // do not manipulate via reference directly but call SetMarkStartPos
184  // which works even if start and end pos were the same
185  rField.SetMarkStartPos( start );
186  SwPosition& rEnd = rField.GetMarkEnd(); // note: retrieve after
187  // setting start, because if start==end it can go stale, see SetMarkPos()
188  assert(pSepPos == nullptr || (start < *pSepPos && *pSepPos <= rEnd));
189  if (startChar.getLength() == 1)
190  {
191  *aStartPaM.GetPoint() = pSepPos ? *pSepPos : rEnd;
192  io_rDoc.getIDocumentContentOperations().InsertString(aStartPaM, OUString(CH_TXT_ATR_FIELDSEP));
193  if (!pSepPos || rEnd < *pSepPos)
194  { // rEnd is not moved automatically if it's same as insert pos
195  ++rEnd.nContent;
196  }
197  }
198  assert(pSepPos == nullptr || (start < *pSepPos && *pSepPos <= rEnd));
199  }
200  else
201  {
202  assert(pSepPos == nullptr);
203  }
204 
205  SwPosition& rEnd = rField.GetMarkEnd();
206  if (aEndMark && startChar.getLength() == 1)
207  {
208  SwPaM aEndPaM(rEnd);
209  io_rDoc.getIDocumentContentOperations().InsertString(aEndPaM, OUString(aEndMark));
210  ++rEnd.nContent;
211  }
212  lcl_AssertFieldMarksSet(rField, aStartMark, aEndMark);
213 
215  }
216 
217  void lcl_RemoveFieldMarks(const Fieldmark& rField,
218  SwDoc& io_rDoc,
219  const sal_Unicode aStartMark,
220  const sal_Unicode aEndMark)
221  {
223 
224  const SwPosition& rStart = rField.GetMarkStart();
225  SwTextNode const*const pStartTextNode = rStart.nNode.GetNode().GetTextNode();
226  assert(pStartTextNode);
227  if (aEndMark != CH_TXT_ATR_FORMELEMENT)
228  {
229  (void) pStartTextNode;
230  // check this before start / end because of the +1 / -1 ...
231  SwPosition const sepPos(sw::mark::FindFieldSep(rField));
232  io_rDoc.GetDocumentContentOperationsManager().DeleteDummyChar(rStart, aStartMark);
234  }
235 
236  const SwPosition& rEnd = rField.GetMarkEnd();
237  SwTextNode *const pEndTextNode = rEnd.nNode.GetNode().GetTextNode();
238  assert(pEndTextNode);
239  const sal_Int32 nEndPos = (rEnd == rStart)
240  ? rEnd.nContent.GetIndex()
241  : rEnd.nContent.GetIndex() - 1;
242  assert(pEndTextNode->GetText()[nEndPos] == aEndMark);
243  SwPosition const aEnd(*pEndTextNode, nEndPos);
244  io_rDoc.GetDocumentContentOperationsManager().DeleteDummyChar(aEnd, aEndMark);
245 
247  }
248 
249  auto InvalidatePosition(SwPosition const& rPos) -> void
250  {
251  SwUpdateAttr const aHint(rPos.nContent.GetIndex(), rPos.nContent.GetIndex(), 0);
253  }
254 }
255 
256 namespace sw::mark
257 {
259  const OUString& rName)
260  : m_pPos1(new SwPosition(*(aPaM.GetPoint())))
261  , m_aName(rName)
262  {
263  m_pPos1->nContent.SetMark(this);
264  lcl_FixPosition(*m_pPos1);
265  if (aPaM.HasMark() && (*aPaM.GetMark() != *aPaM.GetPoint()))
266  {
268  lcl_FixPosition(*m_pPos2);
269  }
270  }
271 
272  // For fieldmarks, the CH_TXT_ATR_FIELDSTART and CH_TXT_ATR_FIELDEND
273  // themselves are part of the covered range. This is guaranteed by
274  // TextFieldmark::InitDoc/lcl_AssureFieldMarksSet.
275  bool MarkBase::IsCoveringPosition(const SwPosition& rPos) const
276  {
277  return GetMarkStart() <= rPos && rPos < GetMarkEnd();
278  }
279 
280  void MarkBase::SetMarkPos(const SwPosition& rNewPos)
281  {
282  std::make_unique<SwPosition>(rNewPos).swap(m_pPos1);
283  m_pPos1->nContent.SetMark(this);
284  }
285 
287  {
288  std::make_unique<SwPosition>(rNewPos).swap(m_pPos2);
289  m_pPos2->nContent.SetMark(this);
290  }
291 
292  OUString MarkBase::ToString( ) const
293  {
294  return "Mark: ( Name, [ Node1, Index1 ] ): ( " + m_aName + ", [ "
295  + OUString::number( GetMarkPos().nNode.GetIndex( ) ) + ", "
296  + OUString::number( GetMarkPos().nContent.GetIndex( ) ) + " ] )";
297  }
298 
300  {
301  xmlTextWriterStartElement(pWriter, BAD_CAST("MarkBase"));
302  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(m_aName.toUtf8().getStr()));
303  xmlTextWriterStartElement(pWriter, BAD_CAST("markPos"));
304  GetMarkPos().dumpAsXml(pWriter);
305  xmlTextWriterEndElement(pWriter);
306  if (IsExpanded())
307  {
308  xmlTextWriterStartElement(pWriter, BAD_CAST("otherMarkPos"));
309  GetOtherMarkPos().dumpAsXml(pWriter);
310  xmlTextWriterEndElement(pWriter);
311  }
312  xmlTextWriterEndElement(pWriter);
313  }
314 
316  { }
317 
318  OUString MarkBase::GenerateNewName(const OUString& rPrefix)
319  {
320  static bool bHack = (getenv("LIBO_ONEWAY_STABLE_ODF_EXPORT") != nullptr);
321 
322  if (bHack)
323  {
324  static sal_Int64 nIdCounter = SAL_CONST_INT64(6000000000);
325  return rPrefix + OUString::number(nIdCounter++);
326  }
327  else
328  {
329  static OUString sUniquePostfix;
330  static sal_Int32 nCount = SAL_MAX_INT32;
331  if(nCount == SAL_MAX_INT32)
332  {
333  unsigned int const n(comphelper::rng::uniform_uint_distribution(0,
334  std::numeric_limits<unsigned int>::max()));
335  sUniquePostfix = "_" + OUString::number(n);
336  nCount = 0;
337  }
338  // putting the counter in front of the random parts will speed up string comparisons
339  return rPrefix + OUString::number(nCount++) + sUniquePostfix;
340  }
341  }
342 
343  void MarkBase::SwClientNotify(const SwModify&, const SfxHint& rHint)
344  {
345  CallSwClientNotify(rHint);
346  auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
347  if(pLegacy && RES_REMOVE_UNO_OBJECT == pLegacy->GetWhich())
348  { // invalidate cached uno object
349  SetXBookmark(uno::Reference<text::XTextContent>(nullptr));
350  }
351  }
352 
354  {
355  }
356 
358  : MarkBase(rPaM, MarkBase::GenerateNewName("__NavigatorReminder__"))
359  { }
360 
361  UnoMark::UnoMark(const SwPaM& aPaM)
362  : MarkBase(aPaM, MarkBase::GenerateNewName("__UnoMark__"))
363  { }
364 
366  : MarkBase(aPaM, MarkBase::GenerateNewName("__DdeLink__"))
367  { }
368 
370  {
371  m_aRefObj = pObj;
372  }
373 
375  {
376  if(m_aRefObj.is())
378  }
379 
381  {
382  if( m_aRefObj.is() )
383  {
384  if(m_aRefObj->HasDataLinks())
385  {
387  p->SendDataChanged();
388  }
390  }
391  }
392 
394  const vcl::KeyCode& rCode,
395  const OUString& rName)
396  : DdeBookmark(aPaM)
397  , ::sfx2::Metadatable()
398  , m_aCode(rCode)
399  , m_bHidden(false)
400  {
401  m_aName = rName;
402  }
403 
404  void Bookmark::InitDoc(SwDoc& io_rDoc,
405  sw::mark::InsertMode const, SwPosition const*const)
406  {
407  if (io_rDoc.GetIDocumentUndoRedo().DoesUndo())
408  {
410  std::make_unique<SwUndoInsBookmark>(*this));
411  }
412  io_rDoc.getIDocumentState().SetModified();
414  }
415 
417  {
419 
420  if (io_rDoc.GetIDocumentUndoRedo().DoesUndo())
421  {
423  std::make_unique<SwUndoDeleteBookmark>(*this));
424  }
425  io_rDoc.getIDocumentState().SetModified();
427  }
428 
429  // invalidate text frames in case it's hidden or Formatting Marks enabled
431  {
432  InvalidatePosition(GetMarkPos());
433  if (IsExpanded())
434  {
435  InvalidatePosition(GetOtherMarkPos());
436  }
437  }
438 
439  void Bookmark::Hide(bool const isHide)
440  {
441  if (isHide != m_bHidden)
442  {
443  m_bHidden = isHide;
445  }
446  }
447 
448  void Bookmark::SetHideCondition(OUString const& rHideCondition)
449  {
450  if (m_sHideCondition != rHideCondition)
451  {
452  m_sHideCondition = rHideCondition;
454  }
455  }
456 
458  {
459  SwDoc& rDoc( GetMarkPos().GetDoc() );
460  return rDoc.GetXmlIdRegistry();
461  }
462 
464  {
465  SwDoc& rDoc( GetMarkPos().GetDoc() );
466  return rDoc.IsClipBoard();
467  }
468 
469  bool Bookmark::IsInUndo() const
470  {
471  return false;
472  }
473 
475  {
476  SwDoc& rDoc( GetMarkPos().GetDoc() );
477  return !rDoc.IsInHeaderFooter( GetMarkPos().nNode );
478  }
479 
480  uno::Reference< rdf::XMetadatable > Bookmark::MakeUnoObject()
481  {
482  SwDoc& rDoc( GetMarkPos().GetDoc() );
483  const uno::Reference< rdf::XMetadatable> xMeta(
484  SwXBookmark::CreateXBookmark(rDoc, this), uno::UNO_QUERY);
485  return xMeta;
486  }
487 
489  : MarkBase(rPaM, MarkBase::GenerateNewName("__Fieldmark__"))
490  {
491  if(!IsExpanded())
493  }
494 
495  void Fieldmark::SetMarkStartPos( const SwPosition& rNewStartPos )
496  {
497  if ( GetMarkPos( ) <= GetOtherMarkPos( ) )
498  return SetMarkPos( rNewStartPos );
499  else
500  return SetOtherMarkPos( rNewStartPos );
501  }
502 
503  void Fieldmark::SetMarkEndPos( const SwPosition& rNewEndPos )
504  {
505  if ( GetMarkPos( ) <= GetOtherMarkPos( ) )
506  return SetOtherMarkPos( rNewEndPos );
507  else
508  return SetMarkPos( rNewEndPos );
509  }
510 
511  OUString Fieldmark::ToString( ) const
512  {
513  return "Fieldmark: ( Name, Type, [ Nd1, Id1 ], [ Nd2, Id2 ] ): ( " + m_aName + ", "
514  + m_aFieldname + ", [ " + OUString::number( GetMarkPos().nNode.GetIndex( ) )
515  + ", " + OUString::number( GetMarkPos( ).nContent.GetIndex( ) ) + " ], ["
516  + OUString::number( GetOtherMarkPos().nNode.GetIndex( ) ) + ", "
517  + OUString::number( GetOtherMarkPos( ).nContent.GetIndex( ) ) + " ] ) ";
518  }
519 
521  {
522  // TODO: Does exist a better solution to trigger a format of the
523  // fieldmark portion? If yes, please use it.
524  SwPaM aPaM( GetMarkPos(), GetOtherMarkPos() );
525  aPaM.InvalidatePaM();
526  }
527 
529  {
530  xmlTextWriterStartElement(pWriter, BAD_CAST("Fieldmark"));
531  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("fieldname"), BAD_CAST(m_aFieldname.toUtf8().getStr()));
532  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("fieldHelptext"), BAD_CAST(m_aFieldHelptext.toUtf8().getStr()));
533  MarkBase::dumpAsXml(pWriter);
534  xmlTextWriterStartElement(pWriter, BAD_CAST("parameters"));
535  for (auto& rParam : m_vParams)
536  {
537  xmlTextWriterStartElement(pWriter, BAD_CAST("parameter"));
538  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(rParam.first.toUtf8().getStr()));
539  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(comphelper::anyToString(rParam.second).toUtf8().getStr()));
540  xmlTextWriterEndElement(pWriter);
541  }
542  xmlTextWriterEndElement(pWriter);
543  xmlTextWriterEndElement(pWriter);
544  }
545 
546  TextFieldmark::TextFieldmark(const SwPaM& rPaM, const OUString& rName)
547  : Fieldmark(rPaM)
548  {
549  if ( !rName.isEmpty() )
550  m_aName = rName;
551  }
552 
554  sw::mark::InsertMode const eMode, SwPosition const*const pSepPos)
555  {
556  if (eMode == sw::mark::InsertMode::New)
557  {
558  lcl_SetFieldMarks(*this, io_rDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND, pSepPos);
559  // no need to invalidate text frames here, the insertion of the
560  // CH_TXT_ATR already invalidates
561  }
562  else
563  {
564  lcl_AssertFieldMarksSet(*this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
565  }
566  }
567 
569  {
570  IDocumentUndoRedo & rIDUR(rDoc.GetIDocumentUndoRedo());
571  if (rIDUR.DoesUndo())
572  {
573  rIDUR.AppendUndo(std::make_unique<SwUndoDelTextFieldmark>(*this));
574  }
575  ::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
576  lcl_RemoveFieldMarks(*this, rDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
577  }
578 
580  : Fieldmark(rPaM)
581  { }
582 
584  sw::mark::InsertMode const eMode, SwPosition const*const pSepPos)
585  {
586  assert(pSepPos == nullptr);
587  if (eMode == sw::mark::InsertMode::New)
588  {
589  lcl_SetFieldMarks(*this, io_rDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT, pSepPos);
590 
591  // For some reason the end mark is moved from 1 by the Insert:
592  // we don't want this for checkboxes
593  SwPosition aNewEndPos = GetMarkEnd();
594  aNewEndPos.nContent--;
595  SetMarkEndPos( aNewEndPos );
596  }
597  else
598  {
599  lcl_AssertFieldMarksSet(*this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT);
600  }
601  }
602 
604  {
605  IDocumentUndoRedo & rIDUR(rDoc.GetIDocumentUndoRedo());
606  if (rIDUR.DoesUndo())
607  {
608  rIDUR.AppendUndo(std::make_unique<SwUndoDelNoTextFieldmark>(*this));
609  }
610  ::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
611  lcl_RemoveFieldMarks(*this, rDoc,
613  }
614 
615 
617  : NonTextFieldmark(rPaM)
618  { }
619 
620  void CheckboxFieldmark::SetChecked(bool checked)
621  {
622  if ( IsChecked() != checked )
623  {
624  (*GetParameters())[OUString(ODF_FORMCHECKBOX_RESULT)] <<= checked;
625  // mark document as modified
626  SwDoc& rDoc( GetMarkPos().GetDoc() );
628  }
629  }
630 
632  {
633  bool bResult = false;
634  parameter_map_t::const_iterator pResult = GetParameters()->find(OUString(ODF_FORMCHECKBOX_RESULT));
635  if(pResult != GetParameters()->end())
636  pResult->second >>= bResult;
637  return bResult;
638  }
639 
641  : NonTextFieldmark(rPaM)
642  , m_pButton(nullptr)
643  {
644  }
645 
647  {
649  }
650 
652  {
653  if(m_pButton)
654  m_pButton->Show(false);
655  }
656 
658  {
659  if(m_pButton)
661  }
662 
665  {
666  }
667 
669  {
670  SendLOKMessage("hide");
671  }
672 
674  {
675  if(pEditWin)
676  {
677  if(!m_pButton)
680  m_pButton->Show();
681  SendLOKMessage("show");
682  }
683  }
684 
686  {
687  SendLOKMessage("hide");
689  }
690 
692  {
693  SendLOKMessage("hide");
695  }
696 
697  void DropDownFieldmark::SetPortionPaintArea(const SwRect& rPortionPaintArea)
698  {
699  m_aPortionPaintArea = rPortionPaintArea;
700  if(m_pButton)
701  {
702  m_pButton->Show();
704  SendLOKMessage("show");
705  }
706  }
707 
708  void DropDownFieldmark::SendLOKMessage(const OString& sAction)
709  {
710  const SfxViewShell* pViewShell = SfxViewShell::Current();
711  if (!pViewShell || pViewShell->isLOKMobilePhone())
712  {
713  return;
714  }
715 
717  return;
718 
719  if (!m_pButton)
720  return;
721 
722  SwEditWin* pEditWin = dynamic_cast<SwEditWin*>(m_pButton->GetParent());
723  if (!pEditWin)
724  return;
725 
726  OStringBuffer sPayload;
727  if (sAction == "show")
728  {
730  return;
731 
732  sPayload = OStringLiteral("{\"action\": \"show\","
733  " \"type\": \"drop-down\", \"textArea\": \"") +
734  m_aPortionPaintArea.SVRect().toString() + "\",";
735  // Add field params to the message
736  sPayload.append(" \"params\": { \"items\": [");
737 
738  // List items
739  auto pParameters = this->GetParameters();
740  auto pListEntriesIter = pParameters->find(ODF_FORMDROPDOWN_LISTENTRY);
741  css::uno::Sequence<OUString> vListEntries;
742  if (pListEntriesIter != pParameters->end())
743  {
744  pListEntriesIter->second >>= vListEntries;
745  for (const OUString& sItem : std::as_const(vListEntries))
746  sPayload.append("\"" + OUStringToOString(sItem, RTL_TEXTENCODING_UTF8) + "\", ");
747  sPayload.setLength(sPayload.getLength() - 2);
748  }
749  sPayload.append("], ");
750 
751  // Selected item
752  auto pSelectedItemIter = pParameters->find(ODF_FORMDROPDOWN_RESULT);
753  sal_Int32 nSelection = -1;
754  if (pSelectedItemIter != pParameters->end())
755  {
756  pSelectedItemIter->second >>= nSelection;
757  }
758  sPayload.append("\"selected\": \"" + OString::number(nSelection) + "\", ");
759 
760  // Placeholder text
761  sPayload.append("\"placeholderText\": \"" + OUStringToOString(SwResId(STR_DROP_DOWN_EMPTY_LIST), RTL_TEXTENCODING_UTF8) + "\"}}");
762  }
763  else
764  {
765  sPayload = "{\"action\": \"hide\", \"type\": \"drop-down\"}";
766  }
767  if (sPayload.toString() != m_sLastSentLOKMsg) {
768  m_sLastSentLOKMsg = sPayload.toString();
769  pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_FORM_FIELD_BUTTON, m_sLastSentLOKMsg.getStr());
770  }
771  }
772 
775  , m_pNumberFormatter(nullptr)
776  , m_pDocumentContentOperationsManager(nullptr)
777  {
778  }
779 
781  {
782  }
783 
785  sw::mark::InsertMode eMode, SwPosition const*const pSepPos)
786  {
789  if (eMode == sw::mark::InsertMode::New)
790  {
791  lcl_SetFieldMarks(*this, io_rDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND, pSepPos);
792  }
793  else
794  {
795  lcl_AssertFieldMarksSet(*this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
796  }
797  }
798 
800  {
801  IDocumentUndoRedo & rIDUR(rDoc.GetIDocumentUndoRedo());
802  if (rIDUR.DoesUndo())
803  {
804  // TODO does this need a 3rd Undo class?
805  rIDUR.AppendUndo(std::make_unique<SwUndoDelTextFieldmark>(*this));
806  }
807  ::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
808  lcl_RemoveFieldMarks(*this, rDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
809  }
810 
812  {
813  if(pEditWin)
814  {
815  if(!m_pButton)
818  m_pButton->CalcPosAndSize(aPaintArea);
819  m_pButton->Show();
820  }
821  }
822 
823  void DateFieldmark::SetPortionPaintAreaStart(const SwRect& rPortionPaintArea)
824  {
825  if (rPortionPaintArea.IsEmpty())
826  return;
827 
828  m_aPaintAreaStart = rPortionPaintArea;
830  }
831 
832  void DateFieldmark::SetPortionPaintAreaEnd(const SwRect& rPortionPaintArea)
833  {
834  if (rPortionPaintArea.IsEmpty())
835  return;
836 
837  if(m_aPaintAreaEnd == rPortionPaintArea &&
839  return;
840 
841  m_aPaintAreaEnd = rPortionPaintArea;
842  if(m_pButton)
843  {
844  m_pButton->Show();
846  m_pButton->CalcPosAndSize(aPaintArea);
848  }
850  }
851 
852  OUString DateFieldmark::GetContent() const
853  {
854  const SwTextNode* const pTextNode = GetMarkEnd().nNode.GetNode().GetTextNode();
855  SwPosition const sepPos(sw::mark::FindFieldSep(*this));
856  const sal_Int32 nStart(sepPos.nContent.GetIndex());
857  const sal_Int32 nEnd (GetMarkEnd().nContent.GetIndex());
858 
859  OUString sContent;
860  if(nStart + 1 < pTextNode->GetText().getLength() && nEnd <= pTextNode->GetText().getLength() &&
861  nEnd > nStart + 2)
862  sContent = pTextNode->GetText().copy(nStart + 1, nEnd - nStart - 2);
863  return sContent;
864  }
865 
866  void DateFieldmark::ReplaceContent(const OUString& sNewContent)
867  {
869  return;
870 
871  const SwTextNode* const pTextNode = GetMarkEnd().nNode.GetNode().GetTextNode();
872  SwPosition const sepPos(sw::mark::FindFieldSep(*this));
873  const sal_Int32 nStart(sepPos.nContent.GetIndex());
874  const sal_Int32 nEnd (GetMarkEnd().nContent.GetIndex());
875 
876  if(nStart + 1 < pTextNode->GetText().getLength() && nEnd <= pTextNode->GetText().getLength() &&
877  nEnd > nStart + 2)
878  {
879  SwPaM aFieldPam(GetMarkStart().nNode, nStart + 1,
880  GetMarkStart().nNode, nEnd - 1);
881  m_pDocumentContentOperationsManager->ReplaceRange(aFieldPam, sNewContent, false);
882  }
883  else
884  {
885  SwPaM aFieldStartPam(GetMarkStart().nNode, nStart + 1);
886  m_pDocumentContentOperationsManager->InsertString(aFieldStartPam, sNewContent);
887  }
888 
889  }
890 
891  std::pair<bool, double> DateFieldmark::GetCurrentDate() const
892  {
893  // Check current date param first
894  std::pair<bool, double> aResult = ParseCurrentDateParam();
895  if(aResult.first)
896  return aResult;
897 
899  bool bFoundValidDate = false;
900  double dCurrentDate = 0;
901  OUString sDateFormat;
902  auto pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT);
903  if (pResult != pParameters->end())
904  {
905  pResult->second >>= sDateFormat;
906  }
907 
908  OUString sLang;
909  pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT_LANGUAGE);
910  if (pResult != pParameters->end())
911  {
912  pResult->second >>= sLang;
913  }
914 
915  // Get current content of the field
916  OUString sContent = GetContent();
917 
918  sal_uInt32 nFormat = m_pNumberFormatter->GetEntryKey(sDateFormat, LanguageTag(sLang).getLanguageType());
919  if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
920  {
921  sal_Int32 nCheckPos = 0;
923  m_pNumberFormatter->PutEntry(sDateFormat,
924  nCheckPos,
925  nType,
926  nFormat,
927  LanguageTag(sLang).getLanguageType());
928  }
929 
930  if (nFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
931  {
932  bFoundValidDate = m_pNumberFormatter->IsNumberFormat(sContent, nFormat, dCurrentDate);
933  }
934  return std::pair<bool, double>(bFoundValidDate, dCurrentDate);
935  }
936 
937  void DateFieldmark::SetCurrentDate(double fDate)
938  {
939  // Replace current content with the selected date
941 
942  // Also save the current date in a standard format
944  (*pParameters)[ODF_FORMDATE_CURRENTDATE] <<= GetDateInStandardDateFormat(fDate);
945  }
946 
947  OUString DateFieldmark::GetDateInStandardDateFormat(double fDate) const
948  {
949  OUString sCurrentDate;
951  if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
952  {
953  sal_Int32 nCheckPos = 0;
955  OUString sFormat = ODF_FORMDATE_CURRENTDATE_FORMAT;
956  m_pNumberFormatter->PutEntry(sFormat,
957  nCheckPos,
958  nType,
959  nFormat,
961  }
962 
963  if (nFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
964  {
965  const Color* pCol = nullptr;
966  m_pNumberFormatter->GetOutputString(fDate, nFormat, sCurrentDate, &pCol, false);
967  }
968  return sCurrentDate;
969  }
970 
971  std::pair<bool, double> DateFieldmark::ParseCurrentDateParam() const
972  {
973  bool bFoundValidDate = false;
974  double dCurrentDate = 0;
975 
977  auto pResult = pParameters->find(ODF_FORMDATE_CURRENTDATE);
978  OUString sCurrentDate;
979  if (pResult != pParameters->end())
980  {
981  pResult->second >>= sCurrentDate;
982  }
983  if(!sCurrentDate.isEmpty())
984  {
986  if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
987  {
988  sal_Int32 nCheckPos = 0;
990  OUString sFormat = ODF_FORMDATE_CURRENTDATE_FORMAT;
991  m_pNumberFormatter->PutEntry(sFormat,
992  nCheckPos,
993  nType,
994  nFormat,
996  }
997 
998  if(nFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
999  {
1000  bFoundValidDate = m_pNumberFormatter->IsNumberFormat(sCurrentDate, nFormat, dCurrentDate);
1001  }
1002  }
1003  return std::pair<bool, double>(bFoundValidDate, dCurrentDate);
1004  }
1005 
1006 
1007  OUString DateFieldmark::GetDateInCurrentDateFormat(double fDate) const
1008  {
1009  // Get current date format and language
1010  OUString sDateFormat;
1012  auto pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT);
1013  if (pResult != pParameters->end())
1014  {
1015  pResult->second >>= sDateFormat;
1016  }
1017 
1018  OUString sLang;
1019  pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT_LANGUAGE);
1020  if (pResult != pParameters->end())
1021  {
1022  pResult->second >>= sLang;
1023  }
1024 
1025  // Fill the content with the specified format
1026  OUString sCurrentContent;
1027  sal_uInt32 nFormat = m_pNumberFormatter->GetEntryKey(sDateFormat, LanguageTag(sLang).getLanguageType());
1028  if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
1029  {
1030  sal_Int32 nCheckPos = 0;
1032  OUString sFormat = sDateFormat;
1033  m_pNumberFormatter->PutEntry(sFormat,
1034  nCheckPos,
1035  nType,
1036  nFormat,
1037  LanguageTag(sLang).getLanguageType());
1038  }
1039 
1040  if (nFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
1041  {
1042  const Color* pCol = nullptr;
1043  m_pNumberFormatter->GetOutputString(fDate, nFormat, sCurrentContent, &pCol, false);
1044  }
1045  return sCurrentContent;
1046  }
1047 
1049  {
1050  std::pair<bool, double> aResult = ParseCurrentDateParam();
1051  if(!aResult.first)
1052  return;
1053 
1054  // Current date became invalid
1055  if(GetDateInCurrentDateFormat(aResult.second) != GetContent())
1056  {
1058  (*pParameters)[ODF_FORMDATE_CURRENTDATE] <<= OUString();
1059  }
1060  }
1061 }
1062 
1063 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetMarkStartPos(const SwPosition &rNewStartPos)
Definition: bookmrk.cxx:495
OUString m_aName
Definition: bookmrk.hxx:113
static OUString GenerateNewName(const OUString &rPrefix)
Definition: bookmrk.cxx:318
virtual void Hide(bool rHide) override
Definition: bookmrk.cxx:439
virtual std::pair< bool, double > GetCurrentDate() const override
Definition: bookmrk.cxx:891
bool is() const
virtual void InitDoc(SwDoc &io_rDoc, sw::mark::InsertMode eMode, SwPosition const *pSepPos) override
Definition: bookmrk.cxx:583
DateFieldmark(const SwPaM &rPaM)
Definition: bookmrk.cxx:773
std::map< OUString, css::uno::Any > parameter_map_t
Definition: IMark.hxx:94
Marks a position in the document model.
Definition: pam.hxx:35
OUString m_aFieldHelptext
Definition: bookmrk.hxx:231
bool isLOKMobilePhone() const
bool IsChecked() const override
Definition: bookmrk.cxx:631
sal_uLong StartOfSectionIndex() const
Definition: node.hxx:676
OUString m_aName
virtual void ShowButton(SwEditWin *pEditWin) override
Definition: bookmrk.cxx:673
const OUString & GetText() const
Definition: ndtxt.hxx:212
virtual bool IsInUndo() const override
Definition: bookmrk.cxx:469
virtual void ReplaceContent(const OUString &sNewContent) override
Definition: bookmrk.cxx:866
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1407
SwNodeIndex nNode
Definition: pam.hxx:37
OUString m_sHideCondition
Definition: bookmrk.hxx:194
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:275
virtual void SetModified()=0
Must be called manually at changes of format.
sal_uIntPtr sal_uLong
void disposeAndClear()
const SwPosition * GetMark() const
Definition: pam.hxx:209
sal_Int64 n
#define ODF_FORMDATE_CURRENTDATE
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: bookmrk.cxx:528
virtual void InitDoc(SwDoc &io_rDoc, sw::mark::InsertMode eMode, SwPosition const *pSepPos) override
Definition: bookmrk.cxx:553
Definition: doc.hxx:184
#define ODF_FORMDATE_DATEFORMAT_LANGUAGE
virtual SwPosition & GetMarkStart() const override
Definition: bookmrk.hxx:56
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:260
sw::DocumentContentOperationsManager * m_pDocumentContentOperationsManager
Definition: bookmrk.hxx:333
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: bookmrk.cxx:343
virtual auto InvalidateFrames() -> void override
Definition: bookmrk.cxx:430
OUString m_aFieldname
Definition: bookmrk.hxx:230
SwPosition FindFieldSep(IFieldmark const &rMark)
return position of the CH_TXT_ATR_FIELDSEP for rMark
Definition: bookmrk.cxx:57
void SetChecked(bool checked) override
Definition: bookmrk.cxx:620
virtual OUString ToString() const override
Definition: bookmrk.cxx:292
SwNode & GetNode() const
Definition: ndindex.hxx:119
UnoMark(const SwPaM &rPaM)
Definition: bookmrk.cxx:361
virtual ::sfx2::IXmlIdRegistry & GetRegistry() override
Definition: bookmrk.cxx:457
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
void SetPortionPaintAreaEnd(const SwRect &rPortionPaintArea)
Definition: bookmrk.cxx:832
virtual bool IsCoveringPosition(const SwPosition &rPos) const override
Definition: bookmrk.cxx:275
#define CH_TXT_ATR_FORMELEMENT
Definition: hintids.hxx:176
virtual ~DdeBookmark() override
Definition: bookmrk.cxx:380
bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND) override
Insert string into existing text node at position rRg.Point().
#define ODF_FORMDROPDOWN_RESULT
TextFieldmark(const SwPaM &rPaM, const OUString &rName)
Definition: bookmrk.cxx:546
#define ODF_FORMCHECKBOX_RESULT
bool IsInHeaderFooter(const SwNodeIndex &rIdx) const
Definition: doclay.cxx:1551
Fieldmark with a drop down button (e.g. this button opens the date picker for a date field) ...
Definition: bookmrk.hxx:266
unsigned int uniform_uint_distribution(unsigned int a, unsigned int b)
void InvalidatePaM()
Definition: pam.cxx:1122
std::unique_ptr< SwPosition > m_pPos1
Definition: bookmrk.hxx:111
virtual bool IsExpanded() const override
Definition: bookmrk.hxx:74
Point TopLeft() const
Definition: swrect.cxx:174
virtual void InitDoc(SwDoc &io_Doc, sw::mark::InsertMode eMode, SwPosition const *pSepPos) override
Definition: bookmrk.cxx:404
#define ODF_FORMDATE_CURRENTDATE_LANGUAGE
virtual SwPosition & GetMarkEnd() const override
Definition: bookmrk.hxx:64
sal_uInt16 sal_Unicode
SwIndex nContent
Definition: pam.hxx:38
std::unique_ptr< SwPosition > m_pPos2
Definition: bookmrk.hxx:112
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND
virtual ~DropDownFieldmark() override
Definition: bookmrk.cxx:668
int nCount
void RemoveServer(SvLinkSource *rObj)
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
static SfxViewShell * Current()
void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
std::pair< bool, double > ParseCurrentDateParam() const
Definition: bookmrk.cxx:971
::sfx2::IXmlIdRegistry & GetXmlIdRegistry()
Definition: docnew.cxx:809
OUString GetDateInCurrentDateFormat(double fDate) const
Definition: bookmrk.cxx:1007
void InvalidateCurrentDateParam()
Definition: bookmrk.cxx:1048
virtual parameter_map_t * GetParameters()=0
#define ODF_FORMDATE_CURRENTDATE_FORMAT
void DeleteDummyChar(SwPosition const &rPos, sal_Unicode cDummy)
virtual void DeregisterFromDoc(SwDoc &rDoc)
Definition: bookmrk.cxx:374
bool IsEmpty() const
Definition: swrect.hxx:292
virtual bool DoesUndo() const =0
Is Undo enabled?
bool PutEntry(OUString &rString, sal_Int32 &nCheckPos, SvNumFormatType &nType, sal_uInt32 &nKey, LanguageType eLnge=LANGUAGE_DONTKNOW)
Bookmark(const SwPaM &rPaM, const vcl::KeyCode &rCode, const OUString &rName)
Definition: bookmrk.cxx:393
virtual void ShowButton(SwEditWin *pEditWin) override
Definition: bookmrk.cxx:811
void SetRefObject(SwServerObject *pObj)
Definition: bookmrk.cxx:369
Point BottomRight() const
Definition: swrect.cxx:177
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
void swap(cow_wrapper< T, P > &a, cow_wrapper< T, P > &b)
struct _xmlTextWriter * xmlTextWriterPtr
static css::uno::Reference< css::text::XTextContent > CreateXBookmark(SwDoc &rDoc,::sw::mark::IMark *pBookmark)
Definition: unobkm.cxx:160
T * get() const
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
#define SAL_MAX_INT32
int i
virtual void ReleaseDoc(SwDoc &rDoc) override
Definition: bookmrk.cxx:568
const SwPosition * GetPoint() const
Definition: pam.hxx:207
void SetMarkEndPos(const SwPosition &rNewEndPos)
Definition: bookmrk.cxx:503
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:58
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: bookmrk.cxx:299
virtual void DeregisterFromDoc(SwDoc &io_rDoc) override
Definition: bookmrk.cxx:416
::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const
Definition: doc.cxx:325
virtual void ReleaseDoc(SwDoc &rDoc) override
Definition: bookmrk.cxx:603
void CalcPosAndSize(const SwRect &rPortionPaintArea)
virtual void ReleaseDoc(SwDoc &rDoc) override
Definition: bookmrk.cxx:799
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
void SetNoServer()
Definition: swserv.cxx:249
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:205
virtual auto InvalidateFrames() -> void
Definition: bookmrk.cxx:353
virtual ~MarkBase() override
Definition: bookmrk.cxx:315
#define CH_TXT_ATR_FIELDSTART
Definition: hintids.hxx:178
SvNumberFormatter * m_pNumberFormatter
Definition: bookmrk.hxx:332
bool IsNumberFormat(const OUString &sString, sal_uInt32 &F_Index, double &fOutNumber, SvNumInputOptions eInputOptions=SvNumInputOptions::NONE)
virtual void HideButton() override
Definition: bookmrk.cxx:685
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
DdeBookmark(const SwPaM &rPaM)
Definition: bookmrk.cxx:365
virtual css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() override
Definition: bookmrk.cxx:480
bool IsNoTextNode() const
Definition: node.hxx:651
SvNumFormatType
bool IsEndNode() const
Definition: node.hxx:635
void SetPortionPaintAreaStart(const SwRect &rPortionPaintArea)
Definition: bookmrk.cxx:823
#define ODF_FORMDATE_DATEFORMAT
OUString SwResId(const char *pId)
Definition: swmodule.cxx:165
DropDownFieldmark(const SwPaM &rPaM)
Definition: bookmrk.cxx:663
vcl::Window * GetParent() const
void SendLOKMessage(const OString &sAction)
Definition: bookmrk.cxx:708
CheckboxFieldmark(const SwPaM &rPaM)
Definition: bookmrk.cxx:616
enumrange< T >::Iterator end(enumrange< T >)
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(179)
virtual OUString ToString() const override
Definition: bookmrk.cxx:511
bool HasDataLinks() const
NavigatorReminder(const SwPaM &rPaM)
Definition: bookmrk.cxx:357
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
NonTextFieldmark(const SwPaM &rPaM)
Definition: bookmrk.cxx:579
virtual SwPosition & GetOtherMarkPos() const override
Definition: bookmrk.hxx:51
FieldmarkWithDropDownButton(const SwPaM &rPaM)
Definition: bookmrk.cxx:640
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
MarkBase(const SwPaM &rPaM, const OUString &rName)
Definition: bookmrk.cxx:258
tools::Rectangle SVRect() const
Definition: swrect.hxx:280
void SetXBookmark(css::uno::Reference< css::text::XTextContent > const &xBkmk)
Definition: bookmrk.hxx:103
virtual bool IsInContent() const override
Definition: bookmrk.cxx:474
bool IsVisible() const
virtual bool IsInClipboard() const override
Definition: bookmrk.cxx:463
#define SAL_INFO(area, stream)
#define ODF_FORMDROPDOWN_LISTENTRY
virtual void RemoveButton() override
Definition: bookmrk.cxx:691
sal_Int32 GetIndex() const
Definition: index.hxx:91
bool IsClipBoard() const
Definition: doc.hxx:960
virtual SwPosition & GetMarkPos() const override
Definition: bookmrk.hxx:47
static VclPtr< reference_type > Create(Arg &&...arg)
virtual void SetMarkPos(const SwPosition &rNewPos)
Definition: bookmrk.cxx:280
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: pam.cxx:183
virtual void InitDoc(SwDoc &io_rDoc, sw::mark::InsertMode eMode, SwPosition const *pSepPos) override
Definition: bookmrk.cxx:784
void * p
QPRO_FUNC_TYPE nType
void SetPortionPaintArea(const SwRect &rPortionPaintArea)
Definition: bookmrk.cxx:697
IFieldmark::parameter_map_t m_vParams
Definition: bookmrk.hxx:232
virtual const SwPosition & GetMarkEnd() const =0
virtual ~DateFieldmark() override
Definition: bookmrk.cxx:780
#define CH_TXT_ATR_FIELDEND
Definition: hintids.hxx:180
virtual void SetCurrentDate(double fDate) override
Definition: bookmrk.cxx:937
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:370
sal_uInt32 GetEntryKey(const OUString &sStr, LanguageType eLnge=LANGUAGE_DONTKNOW)
virtual OUString GetContent() const override
Definition: bookmrk.cxx:852
Fieldmark(const SwPaM &rPaM)
Definition: bookmrk.cxx:488
virtual sfx2::LinkManager & GetLinkManager()=0
virtual void SetHideCondition(const OUString &rHideCondition) override
Definition: bookmrk.cxx:448
tools::SvRef< SwServerObject > m_aRefObj
Definition: bookmrk.hxx:150
virtual const SwPosition & GetMarkStart() const =0
bool ReplaceRange(SwPaM &rPam, const OUString &rNewStr, const bool bRegExReplace) override
Replace selected range in a TextNode with string.
InsertMode
Definition: IMark.hxx:31
virtual void SetOtherMarkPos(const SwPosition &rNewPos)
Definition: bookmrk.cxx:286
virtual ~FieldmarkWithDropDownButton() override
Definition: bookmrk.cxx:646
rtl::OString toString() const
#define CH_TXT_ATR_FIELDSEP
Definition: hintids.hxx:179
bool IsTextNode() const
Definition: node.hxx:639
void GetOutputString(const double &fOutNumber, sal_uInt32 nFIndex, OUString &sOutString, const Color **ppColor, bool bUseStarFormat=false)
virtual void Invalidate() override
Definition: bookmrk.cxx:520
VclPtr< FormFieldButton > m_pButton
Definition: bookmrk.hxx:278
virtual IFieldmark::parameter_map_t * GetParameters() override
Definition: bookmrk.hxx:209
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:845
OUString anyToString(uno::Any const &value)
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Base class of the Writer document model elements.
Definition: node.hxx:79
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
virtual OUString GetDateInStandardDateFormat(double fDate) const override
Definition: bookmrk.cxx:947