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(Fieldmark const * const pField,
147  const sal_Unicode aStartMark,
148  const sal_Unicode aEndMark)
149  {
150  if (aEndMark != CH_TXT_ATR_FORMELEMENT)
151  {
152  SwPosition const& rStart(pField->GetMarkStart());
153  assert(rStart.nNode.GetNode().GetTextNode()->GetText()[rStart.nContent.GetIndex()] == aStartMark); (void) rStart; (void) aStartMark;
154  SwPosition const sepPos(sw::mark::FindFieldSep(*pField));
155  assert(sepPos.nNode.GetNode().GetTextNode()->GetText()[sepPos.nContent.GetIndex()] == CH_TXT_ATR_FIELDSEP); (void) sepPos;
156  }
157  SwPosition const& rEnd(pField->GetMarkEnd());
158  assert(rEnd.nNode.GetNode().GetTextNode()->GetText()[rEnd.nContent.GetIndex() - 1] == aEndMark); (void) rEnd;
159  }
160 
161  void lcl_SetFieldMarks(Fieldmark* const pField,
162  SwDoc* const io_pDoc,
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  && pField->GetMarkStart() == pField->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 = pField->GetMarkStart();
178  if (aEndMark != CH_TXT_ATR_FORMELEMENT)
179  {
180  SwPaM aStartPaM(start);
181  io_pDoc->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  pField->SetMarkStartPos( start );
186  SwPosition& rEnd = pField->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_pDoc->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 = pField->GetMarkEnd();
206  if (aEndMark && startChar.getLength() == 1)
207  {
208  SwPaM aEndPaM(rEnd);
209  io_pDoc->getIDocumentContentOperations().InsertString(aEndPaM, OUString(aEndMark));
210  ++rEnd.nContent;
211  }
212  lcl_AssertFieldMarksSet(pField, aStartMark, aEndMark);
213 
215  };
216 
217  void lcl_RemoveFieldMarks(Fieldmark const * const pField,
218  SwDoc* const io_pDoc,
219  const sal_Unicode aStartMark,
220  const sal_Unicode aEndMark)
221  {
223 
224  const SwPosition& rStart = pField->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(*pField));
232  io_pDoc->GetDocumentContentOperationsManager().DeleteDummyChar(rStart, aStartMark);
234  }
235 
236  const SwPosition& rEnd = pField->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_pDoc->GetDocumentContentOperationsManager().DeleteDummyChar(aEnd, aEndMark);
245 
247  };
248 
249  auto InvalidatePosition(SwPosition const& rPos) -> void
250  {
251  SwUpdateAttr const hint(rPos.nContent.GetIndex(), rPos.nContent.GetIndex(), 0);
252  rPos.nNode.GetNode().GetTextNode()->NotifyClients(nullptr, &hint);
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::Modify( const SfxPoolItem *pOld, const SfxPoolItem *pNew )
344  {
345  NotifyClients(pOld, pNew);
346  if (pOld && (RES_REMOVE_UNO_OBJECT == pOld->Which()))
347  { // invalidate cached uno object
348  SetXBookmark(uno::Reference<text::XTextContent>(nullptr));
349  }
350  }
351 
353  {
354  }
355 
357  : MarkBase(rPaM, MarkBase::GenerateNewName("__NavigatorReminder__"))
358  { }
359 
360  UnoMark::UnoMark(const SwPaM& aPaM)
361  : MarkBase(aPaM, MarkBase::GenerateNewName("__UnoMark__"))
362  { }
363 
365  : MarkBase(aPaM, MarkBase::GenerateNewName("__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* const io_pDoc,
404  sw::mark::InsertMode const, SwPosition const*const)
405  {
406  if (io_pDoc->GetIDocumentUndoRedo().DoesUndo())
407  {
408  io_pDoc->GetIDocumentUndoRedo().AppendUndo(
409  std::make_unique<SwUndoInsBookmark>(*this));
410  }
411  io_pDoc->getIDocumentState().SetModified();
413  }
414 
415  void Bookmark::DeregisterFromDoc(SwDoc* const io_pDoc)
416  {
418 
419  if (io_pDoc->GetIDocumentUndoRedo().DoesUndo())
420  {
421  io_pDoc->GetIDocumentUndoRedo().AppendUndo(
422  std::make_unique<SwUndoDeleteBookmark>(*this));
423  }
424  io_pDoc->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 *const pDoc( GetMarkPos().GetDoc() );
459  assert(pDoc);
460  return pDoc->GetXmlIdRegistry();
461  }
462 
464  {
465  SwDoc *const pDoc( GetMarkPos().GetDoc() );
466  assert(pDoc);
467  return pDoc->IsClipBoard();
468  }
469 
470  bool Bookmark::IsInUndo() const
471  {
472  return false;
473  }
474 
476  {
477  SwDoc *const pDoc( GetMarkPos().GetDoc() );
478  assert(pDoc);
479  return !pDoc->IsInHeaderFooter( GetMarkPos().nNode );
480  }
481 
482  uno::Reference< rdf::XMetadatable > Bookmark::MakeUnoObject()
483  {
484  SwDoc *const pDoc( GetMarkPos().GetDoc() );
485  assert(pDoc);
486  const uno::Reference< rdf::XMetadatable> xMeta(
487  SwXBookmark::CreateXBookmark(*pDoc, this), uno::UNO_QUERY);
488  return xMeta;
489  }
490 
492  : MarkBase(rPaM, MarkBase::GenerateNewName("__Fieldmark__"))
493  {
494  if(!IsExpanded())
496  }
497 
498  void Fieldmark::SetMarkStartPos( const SwPosition& rNewStartPos )
499  {
500  if ( GetMarkPos( ) <= GetOtherMarkPos( ) )
501  return SetMarkPos( rNewStartPos );
502  else
503  return SetOtherMarkPos( rNewStartPos );
504  }
505 
506  void Fieldmark::SetMarkEndPos( const SwPosition& rNewEndPos )
507  {
508  if ( GetMarkPos( ) <= GetOtherMarkPos( ) )
509  return SetOtherMarkPos( rNewEndPos );
510  else
511  return SetMarkPos( rNewEndPos );
512  }
513 
514  OUString Fieldmark::ToString( ) const
515  {
516  return "Fieldmark: ( Name, Type, [ Nd1, Id1 ], [ Nd2, Id2 ] ): ( " + m_aName + ", "
517  + m_aFieldname + ", [ " + OUString::number( GetMarkPos().nNode.GetIndex( ) )
518  + ", " + OUString::number( GetMarkPos( ).nContent.GetIndex( ) ) + " ], ["
519  + OUString::number( GetOtherMarkPos().nNode.GetIndex( ) ) + ", "
520  + OUString::number( GetOtherMarkPos( ).nContent.GetIndex( ) ) + " ] ) ";
521  }
522 
524  {
525  // TODO: Does exist a better solution to trigger a format of the
526  // fieldmark portion? If yes, please use it.
527  SwPaM aPaM( GetMarkPos(), GetOtherMarkPos() );
528  aPaM.InvalidatePaM();
529  }
530 
532  {
533  xmlTextWriterStartElement(pWriter, BAD_CAST("Fieldmark"));
534  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("fieldname"), BAD_CAST(m_aFieldname.toUtf8().getStr()));
535  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("fieldHelptext"), BAD_CAST(m_aFieldHelptext.toUtf8().getStr()));
536  MarkBase::dumpAsXml(pWriter);
537  xmlTextWriterStartElement(pWriter, BAD_CAST("parameters"));
538  for (auto& rParam : m_vParams)
539  {
540  xmlTextWriterStartElement(pWriter, BAD_CAST("parameter"));
541  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(rParam.first.toUtf8().getStr()));
542  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(comphelper::anyToString(rParam.second).toUtf8().getStr()));
543  xmlTextWriterEndElement(pWriter);
544  }
545  xmlTextWriterEndElement(pWriter);
546  xmlTextWriterEndElement(pWriter);
547  }
548 
549  TextFieldmark::TextFieldmark(const SwPaM& rPaM, const OUString& rName)
550  : Fieldmark(rPaM)
551  {
552  if ( !rName.isEmpty() )
553  m_aName = rName;
554  }
555 
556  void TextFieldmark::InitDoc(SwDoc* const io_pDoc,
557  sw::mark::InsertMode const eMode, SwPosition const*const pSepPos)
558  {
559  if (eMode == sw::mark::InsertMode::New)
560  {
561  lcl_SetFieldMarks(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND, pSepPos);
562  // no need to invalidate text frames here, the insertion of the
563  // CH_TXT_ATR already invalidates
564  }
565  else
566  {
567  lcl_AssertFieldMarksSet(this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
568  }
569  }
570 
572  {
573  IDocumentUndoRedo & rIDUR(pDoc->GetIDocumentUndoRedo());
574  if (rIDUR.DoesUndo())
575  {
576  rIDUR.AppendUndo(std::make_unique<SwUndoDelTextFieldmark>(*this));
577  }
578  ::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
579  lcl_RemoveFieldMarks(this, pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
580  }
581 
583  : Fieldmark(rPaM)
584  { }
585 
586  void NonTextFieldmark::InitDoc(SwDoc* const io_pDoc,
587  sw::mark::InsertMode const eMode, SwPosition const*const pSepPos)
588  {
589  assert(pSepPos == nullptr);
590  if (eMode == sw::mark::InsertMode::New)
591  {
592  lcl_SetFieldMarks(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT, pSepPos);
593 
594  // For some reason the end mark is moved from 1 by the Insert:
595  // we don't want this for checkboxes
596  SwPosition aNewEndPos = GetMarkEnd();
597  aNewEndPos.nContent--;
598  SetMarkEndPos( aNewEndPos );
599  }
600  else
601  {
602  lcl_AssertFieldMarksSet(this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT);
603  }
604  }
605 
607  {
608  IDocumentUndoRedo & rIDUR(pDoc->GetIDocumentUndoRedo());
609  if (rIDUR.DoesUndo())
610  {
611  rIDUR.AppendUndo(std::make_unique<SwUndoDelNoTextFieldmark>(*this));
612  }
613  ::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
614  lcl_RemoveFieldMarks(this, pDoc,
616  }
617 
618 
620  : NonTextFieldmark(rPaM)
621  { }
622 
623  void CheckboxFieldmark::SetChecked(bool checked)
624  {
625  if ( IsChecked() != checked )
626  {
627  (*GetParameters())[OUString(ODF_FORMCHECKBOX_RESULT)] <<= checked;
628  // mark document as modified
629  SwDoc *const pDoc( GetMarkPos().GetDoc() );
630  if ( pDoc )
631  pDoc->getIDocumentState().SetModified();
632  }
633  }
634 
636  {
637  bool bResult = false;
638  parameter_map_t::const_iterator pResult = GetParameters()->find(OUString(ODF_FORMCHECKBOX_RESULT));
639  if(pResult != GetParameters()->end())
640  pResult->second >>= bResult;
641  return bResult;
642  }
643 
645  : NonTextFieldmark(rPaM)
646  , m_pButton(nullptr)
647  {
648  }
649 
651  {
653  }
654 
656  {
657  if(m_pButton)
658  m_pButton->Show(false);
659  }
660 
662  {
663  if(m_pButton)
665  }
666 
669  {
670  }
671 
673  {
674  SendLOKMessage("hide");
675  }
676 
678  {
679  if(pEditWin)
680  {
681  if(!m_pButton)
684  m_pButton->Show();
685  SendLOKMessage("show");
686  }
687  }
688 
690  {
691  SendLOKMessage("hide");
693  }
694 
696  {
697  SendLOKMessage("hide");
699  }
700 
701  void DropDownFieldmark::SetPortionPaintArea(const SwRect& rPortionPaintArea)
702  {
703  m_aPortionPaintArea = rPortionPaintArea;
704  if(m_pButton)
705  {
706  m_pButton->Show();
708  SendLOKMessage("show");
709  }
710  }
711 
712  void DropDownFieldmark::SendLOKMessage(const OString& sAction)
713  {
714  const SfxViewShell* pViewShell = SfxViewShell::Current();
715  if (pViewShell && pViewShell->isLOKMobilePhone())
716  {
717  return;
718  }
719 
721  return;
722 
723  if (!m_pButton)
724  return;
725 
726  SwEditWin* pEditWin = dynamic_cast<SwEditWin*>(m_pButton->GetParent());
727  if (!pEditWin)
728  return;
729 
730  OStringBuffer sPayload;
731  if (sAction == "show")
732  {
734  return;
735 
736  sPayload = OStringLiteral("{\"action\": \"show\","
737  " \"type\": \"drop-down\", \"textArea\": \"") +
738  m_aPortionPaintArea.SVRect().toString() + "\",";
739  // Add field params to the message
740  sPayload.append(" \"params\": { \"items\": [");
741 
742  // List items
743  auto pParameters = this->GetParameters();
744  auto pListEntriesIter = pParameters->find(ODF_FORMDROPDOWN_LISTENTRY);
745  css::uno::Sequence<OUString> vListEntries;
746  if (pListEntriesIter != pParameters->end())
747  {
748  pListEntriesIter->second >>= vListEntries;
749  for (const OUString& sItem : std::as_const(vListEntries))
750  sPayload.append("\"" + OUStringToOString(sItem, RTL_TEXTENCODING_UTF8) + "\", ");
751  sPayload.setLength(sPayload.getLength() - 2);
752  }
753  sPayload.append("], ");
754 
755  // Selected item
756  auto pSelectedItemIter = pParameters->find(ODF_FORMDROPDOWN_RESULT);
757  sal_Int32 nSelection = -1;
758  if (pSelectedItemIter != pParameters->end())
759  {
760  pSelectedItemIter->second >>= nSelection;
761  }
762  sPayload.append("\"selected\": \"" + OString::number(nSelection) + "\", ");
763 
764  // Placeholder text
765  sPayload.append("\"placeholderText\": \"" + OUStringToOString(SwResId(STR_DROP_DOWN_EMPTY_LIST), RTL_TEXTENCODING_UTF8) + "\"}}");
766  }
767  else
768  {
769  sPayload = "{\"action\": \"hide\", \"type\": \"drop-down\"}";
770  }
771  if (sPayload.toString() != m_sLastSentLOKMsg) {
772  m_sLastSentLOKMsg = sPayload.toString();
773  pEditWin->GetView().GetWrtShell().GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_FORM_FIELD_BUTTON, m_sLastSentLOKMsg.getStr());
774  }
775  }
776 
779  , m_pNumberFormatter(nullptr)
780  , m_pDocumentContentOperationsManager(nullptr)
781  {
782  }
783 
785  {
786  }
787 
788  void DateFieldmark::InitDoc(SwDoc* const io_pDoc,
789  sw::mark::InsertMode eMode, SwPosition const*const pSepPos)
790  {
793  if (eMode == sw::mark::InsertMode::New)
794  {
795  lcl_SetFieldMarks(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND, pSepPos);
796  }
797  else
798  {
799  lcl_AssertFieldMarksSet(this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
800  }
801  }
802 
804  {
805  IDocumentUndoRedo & rIDUR(pDoc->GetIDocumentUndoRedo());
806  if (rIDUR.DoesUndo())
807  {
808  // TODO does this need a 3rd Undo class?
809  rIDUR.AppendUndo(std::make_unique<SwUndoDelTextFieldmark>(*this));
810  }
811  ::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
812  lcl_RemoveFieldMarks(this, pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
813  }
814 
816  {
817  if(pEditWin)
818  {
819  if(!m_pButton)
822  m_pButton->CalcPosAndSize(aPaintArea);
823  m_pButton->Show();
824  }
825  }
826 
827  void DateFieldmark::SetPortionPaintAreaStart(const SwRect& rPortionPaintArea)
828  {
829  if (rPortionPaintArea.IsEmpty())
830  return;
831 
832  m_aPaintAreaStart = rPortionPaintArea;
834  }
835 
836  void DateFieldmark::SetPortionPaintAreaEnd(const SwRect& rPortionPaintArea)
837  {
838  if (rPortionPaintArea.IsEmpty())
839  return;
840 
841  if(m_aPaintAreaEnd == rPortionPaintArea &&
843  return;
844 
845  m_aPaintAreaEnd = rPortionPaintArea;
846  if(m_pButton)
847  {
848  m_pButton->Show();
850  m_pButton->CalcPosAndSize(aPaintArea);
852  }
854  }
855 
856  OUString DateFieldmark::GetContent() const
857  {
858  const SwTextNode* const pTextNode = GetMarkEnd().nNode.GetNode().GetTextNode();
859  SwPosition const sepPos(sw::mark::FindFieldSep(*this));
860  const sal_Int32 nStart(sepPos.nContent.GetIndex());
861  const sal_Int32 nEnd (GetMarkEnd().nContent.GetIndex());
862 
863  OUString sContent;
864  if(nStart + 1 < pTextNode->GetText().getLength() && nEnd <= pTextNode->GetText().getLength() &&
865  nEnd > nStart + 2)
866  sContent = pTextNode->GetText().copy(nStart + 1, nEnd - nStart - 2);
867  return sContent;
868  }
869 
870  void DateFieldmark::ReplaceContent(const OUString& sNewContent)
871  {
873  return;
874 
875  const SwTextNode* const pTextNode = GetMarkEnd().nNode.GetNode().GetTextNode();
876  SwPosition const sepPos(sw::mark::FindFieldSep(*this));
877  const sal_Int32 nStart(sepPos.nContent.GetIndex());
878  const sal_Int32 nEnd (GetMarkEnd().nContent.GetIndex());
879 
880  if(nStart + 1 < pTextNode->GetText().getLength() && nEnd <= pTextNode->GetText().getLength() &&
881  nEnd > nStart + 2)
882  {
883  SwPaM aFieldPam(GetMarkStart().nNode, nStart + 1,
884  GetMarkStart().nNode, nEnd - 1);
885  m_pDocumentContentOperationsManager->ReplaceRange(aFieldPam, sNewContent, false);
886  }
887  else
888  {
889  SwPaM aFieldStartPam(GetMarkStart().nNode, nStart + 1);
890  m_pDocumentContentOperationsManager->InsertString(aFieldStartPam, sNewContent);
891  }
892 
893  }
894 
895  std::pair<bool, double> DateFieldmark::GetCurrentDate() const
896  {
897  // Check current date param first
898  std::pair<bool, double> aResult = ParseCurrentDateParam();
899  if(aResult.first)
900  return aResult;
901 
903  bool bFoundValidDate = false;
904  double dCurrentDate = 0;
905  OUString sDateFormat;
906  auto pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT);
907  if (pResult != pParameters->end())
908  {
909  pResult->second >>= sDateFormat;
910  }
911 
912  OUString sLang;
913  pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT_LANGUAGE);
914  if (pResult != pParameters->end())
915  {
916  pResult->second >>= sLang;
917  }
918 
919  // Get current content of the field
920  OUString sContent = GetContent();
921 
922  sal_uInt32 nFormat = m_pNumberFormatter->GetEntryKey(sDateFormat, LanguageTag(sLang).getLanguageType());
923  if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
924  {
925  sal_Int32 nCheckPos = 0;
927  m_pNumberFormatter->PutEntry(sDateFormat,
928  nCheckPos,
929  nType,
930  nFormat,
931  LanguageTag(sLang).getLanguageType());
932  }
933 
934  if (nFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
935  {
936  bFoundValidDate = m_pNumberFormatter->IsNumberFormat(sContent, nFormat, dCurrentDate);
937  }
938  return std::pair<bool, double>(bFoundValidDate, dCurrentDate);
939  }
940 
941  void DateFieldmark::SetCurrentDate(double fDate)
942  {
943  // Replace current content with the selected date
945 
946  // Also save the current date in a standard format
948  (*pParameters)[ODF_FORMDATE_CURRENTDATE] <<= GetDateInStandardDateFormat(fDate);
949  }
950 
951  OUString DateFieldmark::GetDateInStandardDateFormat(double fDate) const
952  {
953  OUString sCurrentDate;
955  if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
956  {
957  sal_Int32 nCheckPos = 0;
959  OUString sFormat = ODF_FORMDATE_CURRENTDATE_FORMAT;
960  m_pNumberFormatter->PutEntry(sFormat,
961  nCheckPos,
962  nType,
963  nFormat,
965  }
966 
967  if (nFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
968  {
969  const Color* pCol = nullptr;
970  m_pNumberFormatter->GetOutputString(fDate, nFormat, sCurrentDate, &pCol, false);
971  }
972  return sCurrentDate;
973  }
974 
975  std::pair<bool, double> DateFieldmark::ParseCurrentDateParam() const
976  {
977  bool bFoundValidDate = false;
978  double dCurrentDate = 0;
979 
981  auto pResult = pParameters->find(ODF_FORMDATE_CURRENTDATE);
982  OUString sCurrentDate;
983  if (pResult != pParameters->end())
984  {
985  pResult->second >>= sCurrentDate;
986  }
987  if(!sCurrentDate.isEmpty())
988  {
990  if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
991  {
992  sal_Int32 nCheckPos = 0;
994  OUString sFormat = ODF_FORMDATE_CURRENTDATE_FORMAT;
995  m_pNumberFormatter->PutEntry(sFormat,
996  nCheckPos,
997  nType,
998  nFormat,
1000  }
1001 
1002  if(nFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
1003  {
1004  bFoundValidDate = m_pNumberFormatter->IsNumberFormat(sCurrentDate, nFormat, dCurrentDate);
1005  }
1006  }
1007  return std::pair<bool, double>(bFoundValidDate, dCurrentDate);
1008  }
1009 
1010 
1011  OUString DateFieldmark::GetDateInCurrentDateFormat(double fDate) const
1012  {
1013  // Get current date format and language
1014  OUString sDateFormat;
1016  auto pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT);
1017  if (pResult != pParameters->end())
1018  {
1019  pResult->second >>= sDateFormat;
1020  }
1021 
1022  OUString sLang;
1023  pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT_LANGUAGE);
1024  if (pResult != pParameters->end())
1025  {
1026  pResult->second >>= sLang;
1027  }
1028 
1029  // Fill the content with the specified format
1030  OUString sCurrentContent;
1031  sal_uInt32 nFormat = m_pNumberFormatter->GetEntryKey(sDateFormat, LanguageTag(sLang).getLanguageType());
1032  if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
1033  {
1034  sal_Int32 nCheckPos = 0;
1036  OUString sFormat = sDateFormat;
1037  m_pNumberFormatter->PutEntry(sFormat,
1038  nCheckPos,
1039  nType,
1040  nFormat,
1041  LanguageTag(sLang).getLanguageType());
1042  }
1043 
1044  if (nFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
1045  {
1046  const Color* pCol = nullptr;
1047  m_pNumberFormatter->GetOutputString(fDate, nFormat, sCurrentContent, &pCol, false);
1048  }
1049  return sCurrentContent;
1050  }
1051 
1053  {
1054  std::pair<bool, double> aResult = ParseCurrentDateParam();
1055  if(!aResult.first)
1056  return;
1057 
1058  // Current date became invalid
1059  if(GetDateInCurrentDateFormat(aResult.second) != GetContent())
1060  {
1062  (*pParameters)[ODF_FORMDATE_CURRENTDATE] <<= OUString();
1063  }
1064  }
1065 }
1066 
1067 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetMarkStartPos(const SwPosition &rNewStartPos)
Definition: bookmrk.cxx:498
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:438
virtual std::pair< bool, double > GetCurrentDate() const override
Definition: bookmrk.cxx:895
bool is() const
DateFieldmark(const SwPaM &rPaM)
Definition: bookmrk.cxx:777
virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override
Definition: bookmrk.cxx:343
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:635
sal_uLong StartOfSectionIndex() const
Definition: node.hxx:673
OUString m_aName
virtual void ShowButton(SwEditWin *pEditWin) override
Definition: bookmrk.cxx:677
const OUString & GetText() const
Definition: ndtxt.hxx:211
virtual bool IsInUndo() const override
Definition: bookmrk.cxx:470
virtual void ReplaceContent(const OUString &sNewContent) override
Definition: bookmrk.cxx:870
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1407
SwNodeIndex nNode
Definition: pam.hxx:37
const SwView & GetView() const
Definition: edtwin.hxx:243
virtual void ReleaseDoc(SwDoc *const pDoc) override
Definition: bookmrk.cxx:606
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:531
Definition: doc.hxx:184
#define ODF_FORMDATE_DATEFORMAT_LANGUAGE
virtual SwPosition & GetMarkStart() const override
Definition: bookmrk.hxx:56
virtual void InitDoc(SwDoc *const io_pDoc, sw::mark::InsertMode eMode, SwPosition const *pSepPos) override
Definition: bookmrk.cxx:788
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:260
sw::DocumentContentOperationsManager * m_pDocumentContentOperationsManager
Definition: bookmrk.hxx:333
virtual auto InvalidateFrames() -> void override
Definition: bookmrk.cxx:429
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:623
virtual OUString ToString() const override
Definition: bookmrk.cxx:292
SwNode & GetNode() const
Definition: ndindex.hxx:119
virtual void ReleaseDoc(SwDoc *const pDoc) override
Definition: bookmrk.cxx:571
UnoMark(const SwPaM &rPaM)
Definition: bookmrk.cxx:360
virtual ::sfx2::IXmlIdRegistry & GetRegistry() override
Definition: bookmrk.cxx:456
virtual void ReleaseDoc(SwDoc *const pDoc) override
Definition: bookmrk.cxx:803
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
SfxViewShell * GetSfxViewShell() const
Definition: viewsh.hxx:441
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
void SetPortionPaintAreaEnd(const SwRect &rPortionPaintArea)
Definition: bookmrk.cxx:836
virtual bool IsCoveringPosition(const SwPosition &rPos) const override
Definition: bookmrk.cxx:275
#define CH_TXT_ATR_FORMELEMENT
Definition: hintids.hxx:177
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:549
#define ODF_FORMCHECKBOX_RESULT
bool IsInHeaderFooter(const SwNodeIndex &rIdx) const
Definition: doclay.cxx:1550
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
SwWrtShell & GetWrtShell() const
Definition: view.hxx:398
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
#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:672
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:975
::sfx2::IXmlIdRegistry & GetXmlIdRegistry()
Definition: docnew.cxx:809
OUString GetDateInCurrentDateFormat(double fDate) const
Definition: bookmrk.cxx:1011
void InvalidateCurrentDateParam()
Definition: bookmrk.cxx:1052
virtual parameter_map_t * GetParameters()=0
#define ODF_FORMDATE_CURRENTDATE_FORMAT
void DeleteDummyChar(SwPosition const &rPos, sal_Unicode cDummy)
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:815
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:155
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 SwPosition * GetPoint() const
Definition: pam.hxx:207
void SetMarkEndPos(const SwPosition &rNewEndPos)
Definition: bookmrk.cxx:506
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
::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const
Definition: doc.cxx:325
void CalcPosAndSize(const SwRect &rPortionPaintArea)
virtual void InitDoc(SwDoc *const io_Doc, sw::mark::InsertMode eMode, SwPosition const *pSepPos) override
Definition: bookmrk.cxx:403
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:352
virtual ~MarkBase() override
Definition: bookmrk.cxx:315
#define CH_TXT_ATR_FIELDSTART
Definition: hintids.hxx:179
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:689
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:482
bool IsNoTextNode() const
Definition: node.hxx:648
SvNumFormatType
bool IsEndNode() const
Definition: node.hxx:632
void SetPortionPaintAreaStart(const SwRect &rPortionPaintArea)
Definition: bookmrk.cxx:827
#define ODF_FORMDATE_DATEFORMAT
OUString SwResId(const char *pId)
Definition: swmodule.cxx:165
DropDownFieldmark(const SwPaM &rPaM)
Definition: bookmrk.cxx:667
vcl::Window * GetParent() const
void SendLOKMessage(const OString &sAction)
Definition: bookmrk.cxx:712
CheckboxFieldmark(const SwPaM &rPaM)
Definition: bookmrk.cxx:619
enumrange< T >::Iterator end(enumrange< T >)
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(179)
virtual OUString ToString() const override
Definition: bookmrk.cxx:514
virtual void DeregisterFromDoc(SwDoc *const io_pDoc) override
Definition: bookmrk.cxx:415
void NotifyClients(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
Definition: calbck.cxx:167
bool HasDataLinks() const
NavigatorReminder(const SwPaM &rPaM)
Definition: bookmrk.cxx:356
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
NonTextFieldmark(const SwPaM &rPaM)
Definition: bookmrk.cxx:582
virtual void InitDoc(SwDoc *const io_pDoc, sw::mark::InsertMode eMode, SwPosition const *pSepPos) override
Definition: bookmrk.cxx:556
virtual SwPosition & GetOtherMarkPos() const override
Definition: bookmrk.hxx:51
FieldmarkWithDropDownButton(const SwPaM &rPaM)
Definition: bookmrk.cxx:644
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:475
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:695
sal_Int32 GetIndex() const
Definition: index.hxx:91
virtual void InitDoc(SwDoc *const io_pDoc, sw::mark::InsertMode eMode, SwPosition const *pSepPos) override
Definition: bookmrk.cxx:586
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
void * p
QPRO_FUNC_TYPE nType
void SetPortionPaintArea(const SwRect &rPortionPaintArea)
Definition: bookmrk.cxx:701
IFieldmark::parameter_map_t m_vParams
Definition: bookmrk.hxx:232
virtual const SwPosition & GetMarkEnd() const =0
virtual ~DateFieldmark() override
Definition: bookmrk.cxx:784
#define CH_TXT_ATR_FIELDEND
Definition: hintids.hxx:181
virtual void SetCurrentDate(double fDate) override
Definition: bookmrk.cxx:941
sal_uInt32 GetEntryKey(const OUString &sStr, LanguageType eLnge=LANGUAGE_DONTKNOW)
virtual OUString GetContent() const override
Definition: bookmrk.cxx:856
Fieldmark(const SwPaM &rPaM)
Definition: bookmrk.cxx:491
virtual sfx2::LinkManager & GetLinkManager()=0
virtual void SetHideCondition(const OUString &rHideCondition) override
Definition: bookmrk.cxx:447
virtual void DeregisterFromDoc(SwDoc *const pDoc)
Definition: bookmrk.cxx:373
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:650
rtl::OString toString() const
#define CH_TXT_ATR_FIELDSEP
Definition: hintids.hxx:180
bool IsTextNode() const
Definition: node.hxx:636
void GetOutputString(const double &fOutNumber, sal_uInt32 nFIndex, OUString &sOutString, const Color **ppColor, bool bUseStarFormat=false)
sal_uInt16 Which() const
virtual void Invalidate() override
Definition: bookmrk.cxx:523
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:844
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:951