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