LibreOffice Module sw (master)  1
atrfld.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 <fmtfld.hxx>
21 
22 #include <libxml/xmlwriter.h>
23 
24 #include <fldbas.hxx>
25 #include <txtfld.hxx>
26 #include <txtannotationfld.hxx>
27 #include <docfld.hxx>
28 #include <docufld.hxx>
29 #include <doc.hxx>
30 
31 #include <pam.hxx>
32 #include <reffld.hxx>
33 #include <ddefld.hxx>
34 #include <usrfld.hxx>
35 #include <expfld.hxx>
36 #include <swfont.hxx>
37 #include <ndtxt.hxx>
38 #include <calc.hxx>
39 #include <hints.hxx>
41 #include <IDocumentMarkAccess.hxx>
43 #include <fieldhint.hxx>
44 #include <sal/log.hxx>
45 
46 
47 // constructor for default item in attribute-pool
48 SwFormatField::SwFormatField( sal_uInt16 nWhich )
49  : SfxPoolItem( nWhich )
50  , SfxBroadcaster()
51  , mpTextField( nullptr )
52 {
53 }
54 
57  , SfxBroadcaster()
58  , mpField( rField.CopyField() )
59  , mpTextField( nullptr )
60 {
61  rField.GetTyp()->Add(this);
62  if ( mpField->GetTyp()->Which() == SwFieldIds::Input )
63  {
64  // input field in-place editing
66  static_cast<SwInputField*>(mpField.get())->SetFormatField( *this );
67  }
68  else if (mpField->GetTyp()->Which() == SwFieldIds::SetExp)
69  {
70  // see SwWrtShell::StartInputFieldDlg
71  SwSetExpField *const pSetField(static_cast<SwSetExpField *>(mpField.get()));
72  if (pSetField->GetInputFlag()
73  // only for string fields for now - inline editing of number fields
74  // tends to produce error messages...
75  && (static_cast<SwSetExpFieldType*>(pSetField->GetTyp())->GetType()
77  {
79  }
80  pSetField->SetFormatField(*this);
81  }
82  else if ( mpField->GetTyp()->Which() == SwFieldIds::Postit )
83  {
84  // text annotation field
86  }
87 }
88 
89 // #i24434#
90 // Since Items are used in ItemPool and in default constructed ItemSets with
91 // full pool range, all items need to be clonable. Thus, this one needed to be
92 // corrected
94  : SfxPoolItem( rAttr )
95  , SfxBroadcaster()
96  , mpTextField( nullptr )
97 {
98  if ( rAttr.mpField )
99  {
100  rAttr.mpField->GetTyp()->Add(this);
101  mpField = rAttr.mpField->CopyField();
102  if ( mpField->GetTyp()->Which() == SwFieldIds::Input )
103  {
104  // input field in-place editing
106  SwInputField *pField = dynamic_cast<SwInputField*>(mpField.get());
107  assert(pField);
108  if (pField)
109  pField->SetFormatField( *this );
110  }
111  else if (mpField->GetTyp()->Which() == SwFieldIds::SetExp)
112  {
113  SwSetExpField *const pSetField(static_cast<SwSetExpField *>(mpField.get()));
114  if (pSetField->GetInputFlag()
115  && (static_cast<SwSetExpFieldType*>(pSetField->GetTyp())->GetType()
117  {
119  }
120  // see SwWrtShell::StartInputFieldDlg
121  pSetField->SetFormatField(*this);
122  }
123  else if ( mpField->GetTyp()->Which() == SwFieldIds::Postit )
124  {
125  // text annotation field
127  }
128  }
129 }
130 
132 {
133  SwFieldType* pType = mpField ? mpField->GetTyp() : nullptr;
134 
135  if (pType && pType->Which() == SwFieldIds::Database)
136  pType = nullptr; // DB field types destroy themselves
137 
139  mpField.reset();
140 
141  // some fields need to delete their field type
142  if( pType && pType->HasOnlyOneListener() )
143  {
144  bool bDel = false;
145  switch( pType->Which() )
146  {
147  case SwFieldIds::User:
148  bDel = static_cast<SwUserFieldType*>(pType)->IsDeleted();
149  break;
150 
151  case SwFieldIds::SetExp:
152  bDel = static_cast<SwSetExpFieldType*>(pType)->IsDeleted();
153  break;
154 
155  case SwFieldIds::Dde:
156  bDel = static_cast<SwDDEFieldType*>(pType)->IsDeleted();
157  break;
158  default: break;
159  }
160 
161  if( bDel )
162  {
163  // unregister before deleting
164  pType->Remove( this );
165  delete pType;
166  }
167  }
168 }
169 
171 {
172  rType.Add(this);
173 }
174 
175 void SwFormatField::SetField(std::unique_ptr<SwField> _pField)
176 {
177  mpField = std::move(_pField);
178  if ( mpField->GetTyp()->Which() == SwFieldIds::Input )
179  {
180  static_cast<SwInputField* >(mpField.get())->SetFormatField( *this );
181  }
182  else if (mpField->GetTyp()->Which() == SwFieldIds::SetExp)
183  {
184  // see SwWrtShell::StartInputFieldDlg
185  static_cast<SwSetExpField *>(mpField.get())->SetFormatField(*this);
186  }
188 }
189 
191 {
192  mpTextField = &rTextField;
193 }
194 
196 {
197  mpTextField = nullptr;
198 }
199 
200 bool SwFormatField::operator==( const SfxPoolItem& rAttr ) const
201 {
202  assert(SfxPoolItem::operator==(rAttr));
203  return ( mpField
204  && static_cast<const SwFormatField&>(rAttr).mpField
205  && mpField->GetTyp() == static_cast<const SwFormatField&>(rAttr).mpField->GetTyp()
206  && mpField->GetFormat() == static_cast<const SwFormatField&>(rAttr).mpField->GetFormat() )
207  ||
208  ( !mpField && !static_cast<const SwFormatField&>(rAttr).mpField );
209 }
210 
212 {
213  return new SwFormatField( *this );
214 }
215 
217 {
219  &static_cast<SwModify&>(*this)); // cast to base class (void*)
220  NotifyClients(&item, &item);
221 }
222 
223 void SwFormatField::SwClientNotify( const SwModify& rModify, const SfxHint& rHint )
224 {
225  SwClient::SwClientNotify(rModify, rHint);
226  if( !mpTextField )
227  return;
228 
229  const SwFieldHint* pHint = dynamic_cast<const SwFieldHint*>( &rHint );
230  if ( pHint )
231  {
232  // replace field content by text
233  SwPaM* pPaM = pHint->m_pPaM;
234  SwDoc* pDoc = pPaM->GetDoc();
235  const SwTextNode& rTextNode = mpTextField->GetTextNode();
236  pPaM->GetPoint()->nNode = rTextNode;
237  pPaM->GetPoint()->nContent.Assign( const_cast<SwTextNode*>(&rTextNode), mpTextField->GetStart() );
238 
239  OUString const aEntry(mpField->ExpandField(pDoc->IsClipBoard(), pHint->m_pLayout));
240  pPaM->SetMark();
241  pPaM->Move( fnMoveForward );
243  pDoc->getIDocumentContentOperations().InsertString( *pPaM, aEntry );
244  }
245 }
246 
247 void SwFormatField::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
248 {
249  if (pOld && (RES_REMOVE_UNO_OBJECT == pOld->Which()))
250  { // invalidate cached UNO object
251  m_wXTextField = nullptr;
252  // ??? why does this Modify method not already do this?
253  NotifyClients(pOld, pNew);
254  return;
255  }
256 
257  if( !mpTextField )
258  return;
259 
260  // don't do anything, especially not expand!
261  if( pNew && pNew->Which() == RES_OBJECTDYING )
262  return;
263 
264  SwTextNode* pTextNd = &mpTextField->GetTextNode();
265  OSL_ENSURE( pTextNd, "Where is my Node?" );
266  if( pNew )
267  {
268  switch( pNew->Which() )
269  {
271  // update GetRef fields
272  if( SwFieldIds::GetRef == mpField->GetTyp()->Which() )
273  {
274  // #i81002#
275  static_cast<SwGetRefField*>(mpField.get())->UpdateField( mpTextField );
276  }
277  break;
278  case RES_DOCPOS_UPDATE:
279  // handled in SwTextFrame::Modify()
280  pTextNd->ModifyNotification( pNew, this );
281  return;
282 
283  case RES_ATTRSET_CHG:
284  case RES_FMT_CHG:
285  pTextNd->ModifyNotification( pOld, pNew );
286  return;
287  default:
288  break;
289  }
290  }
291 
292  switch (mpField->GetTyp()->Which())
293  {
295  if( !pOld || RES_HIDDENPARA_PRINT != pOld->Which() )
296  break;
297  [[fallthrough]];
302  pTextNd->ModifyNotification( nullptr, pNew);
303  return;
304  default: break;
305  }
306 
307  if( SwFieldIds::User == mpField->GetTyp()->Which() )
308  {
309  SwUserFieldType* pType = static_cast<SwUserFieldType*>(mpField->GetTyp());
310  if(!pType->IsValid())
311  {
312  SwCalc aCalc( *pTextNd->GetDoc() );
313  pType->GetValue( aCalc );
314  }
315  }
316 
317  const bool bForceNotify = (pOld == nullptr) && (pNew == nullptr);
318  mpTextField->ExpandTextField( bForceNotify );
319 }
320 
322 {
323  const SwTextNode* pTextNd;
324  return RES_AUTOFMT_DOCNODE != rInfo.Which() ||
325  !mpTextField || nullptr == ( pTextNd = mpTextField->GetpTextNode() ) ||
326  &pTextNd->GetNodes() != static_cast<SwAutoFormatGetDocNode&>(rInfo).pNodes;
327 }
328 
330 {
331  return mpTextField != nullptr
333 }
334 
336 {
337  return mpTextField != nullptr
338  && mpTextField->GetpTextNode() != nullptr
340 }
341 
343 {
344  xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatField"));
345  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
346  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("mpTextField"), "%p", mpTextField);
347 
348  SfxPoolItem::dumpAsXml(pWriter);
349  mpField->dumpAsXml(pWriter);
350 
351  xmlTextWriterEndElement(pWriter);
352 }
353 
354 // class SwTextField ////////////////////////////////////////////////////
355 
357  SwFormatField & rAttr,
358  sal_Int32 const nStartPos,
359  bool const bInClipboard)
360  : SwTextAttr( rAttr, nStartPos )
361 // fdo#39694 the ExpandField here may not give the correct result in all cases,
362 // but is better than nothing
363  , m_aExpand( rAttr.GetField()->ExpandField(bInClipboard, nullptr) )
364  , m_pTextNode( nullptr )
365 {
366  rAttr.SetTextField( *this );
367  SetHasDummyChar(true);
368 }
369 
371 {
372  SwFormatField & rFormatField( static_cast<SwFormatField &>(GetAttr()) );
373  if ( this == rFormatField.GetTextField() )
374  {
375  rFormatField.ClearTextField();
376  }
377 }
378 
380 {
381  return GetpTextNode() != nullptr
382  && GetpTextNode()->GetNodes().IsDocNodes();
383 }
384 
385 void SwTextField::ExpandTextField(const bool bForceNotify) const
386 {
387  OSL_ENSURE( m_pTextNode, "SwTextField: where is my TextNode?" );
388 
389  const SwField* pField = GetFormatField().GetField();
390  const OUString aNewExpand( pField->ExpandField(m_pTextNode->GetDoc()->IsClipBoard(),
391  // can't do any better than this here...
393 
394  const SwFieldIds nWhich = pField->GetTyp()->Which();
395  const bool bSameExpandSimpleNotification
396  = SwFieldIds::Chapter != nWhich && SwFieldIds::PageNumber != nWhich
397  && SwFieldIds::RefPageGet != nWhich
398  // Page count fields to not use aExpand during formatting,
399  // therefore an invalidation of the text frame has to be triggered even if aNewExpand == aExpand:
400  && (SwFieldIds::DocStat != nWhich
401  || DS_PAGE != static_cast<const SwDocStatField*>(pField)->GetSubType())
402  && (SwFieldIds::GetExp != nWhich
403  || static_cast<const SwGetExpField*>(pField)->IsInBodyText());
404 
405  bool bHiddenParaChanged = false;
406  if (aNewExpand != m_aExpand || bSameExpandSimpleNotification)
407  bHiddenParaChanged = m_pTextNode->CalcHiddenParaField();
408 
409  if (aNewExpand == m_aExpand)
410  {
411  if ( bSameExpandSimpleNotification )
412  {
413  if( bHiddenParaChanged )
414  {
415  m_pTextNode->ModifyNotification( nullptr, nullptr );
416  }
417  if ( !bForceNotify )
418  {
419  // done, if no further notification forced.
420  return;
421  }
422  }
423  }
424  else
425  m_aExpand = aNewExpand;
426 
427  const_cast<SwTextField*>(this)->NotifyContentChange( const_cast<SwFormatField&>(GetFormatField()) );
428 }
429 
431 {
432  OSL_ENSURE( m_pTextNode, "SwTextField: where is my TextNode?" );
433  OSL_ENSURE( pDest->m_pTextNode, "SwTextField: where is pDest's TextNode?" );
434 
437 
438  SwFormatField& rDestFormatField = const_cast<SwFormatField&>(pDest->GetFormatField());
439  const SwFieldIds nFieldWhich = rDestFormatField.GetField()->GetTyp()->Which();
440 
441  if( pIDFA != pDestIDFA )
442  {
443  // different documents, e.g. clipboard:
444  // register field type in target document
445  SwFieldType* pFieldType;
446  if( nFieldWhich != SwFieldIds::Database
447  && nFieldWhich != SwFieldIds::User
448  && nFieldWhich != SwFieldIds::SetExp
449  && nFieldWhich != SwFieldIds::Dde
450  && SwFieldIds::TableOfAuthorities != nFieldWhich )
451  {
452  pFieldType = pDestIDFA->GetSysFieldType( nFieldWhich );
453  }
454  else
455  {
456  pFieldType = pDestIDFA->InsertFieldType( *rDestFormatField.GetField()->GetTyp() );
457  }
458 
459  // DDE fields need special treatment
460  if( SwFieldIds::Dde == nFieldWhich )
461  {
462  if( rDestFormatField.GetTextField() )
463  {
464  static_cast<SwDDEFieldType*>(rDestFormatField.GetField()->GetTyp())->DecRefCnt();
465  }
466  static_cast<SwDDEFieldType*>(pFieldType)->IncRefCnt();
467  }
468 
469  OSL_ENSURE( pFieldType, "unknown FieldType" );
470  pFieldType->Add( &rDestFormatField ); // register at the field type
471  rDestFormatField.GetField()->ChgTyp( pFieldType );
472  }
473 
474  // update expression fields
475  if( nFieldWhich == SwFieldIds::SetExp
476  || nFieldWhich == SwFieldIds::GetExp
477  || nFieldWhich == SwFieldIds::HiddenText )
478  {
479  SwTextField* pField = const_cast<SwTextField*>(this);
480  pDestIDFA->UpdateExpFields( pField, true );
481  }
482  // table fields: external display
483  else if( SwFieldIds::Table == nFieldWhich
484  && static_cast<SwTableField*>(rDestFormatField.GetField())->IsIntrnlName() )
485  {
486  // convert internal (core) to external (UI) formula
487  const SwTableNode* pTableNd = m_pTextNode->FindTableNode();
488  if( pTableNd ) // in a table?
489  static_cast<SwTableField*>(rDestFormatField.GetField())->PtrToBoxNm( &pTableNd->GetTable() );
490  }
491 }
492 
494 {
495  //if not in undo section notify the change
497  {
498  m_pTextNode->ModifyNotification(nullptr, &rFormatField);
499  }
500 }
501 
502 /*static*/
504  const SwTextField& rTextField,
505  std::shared_ptr< SwPaM >& rPamForTextField )
506 {
507  if (rTextField.GetpTextNode() == nullptr)
508  {
509  SAL_WARN("sw.core", "<SwTextField::GetPamForField> - missing <SwTextNode>");
510  return;
511  }
512 
513  const SwTextNode& rTextNode = rTextField.GetTextNode();
514 
515  rPamForTextField.reset( new SwPaM( rTextNode,
516  (rTextField.End() != nullptr) ? *(rTextField.End()) : ( rTextField.GetStart() + 1 ),
517  rTextNode,
518  rTextField.GetStart() ) );
519 
520 }
521 
522 /*static*/
523 void SwTextField::DeleteTextField( const SwTextField& rTextField )
524 {
525  if (rTextField.GetpTextNode() != nullptr)
526  {
527  std::shared_ptr< SwPaM > pPamForTextField;
528  GetPamForTextField(rTextField, pPamForTextField);
529  if (pPamForTextField != nullptr)
530  {
531  rTextField.GetTextNode().GetDoc()->getIDocumentContentOperations().DeleteAndJoin(*pPamForTextField);
532  }
533  }
534 }
535 
536 // class SwTextInputField ///////////////////////////////////////////////
537 
538 // input field in-place editing
540  SwFormatField & rAttr,
541  sal_Int32 const nStart,
542  sal_Int32 const nEnd,
543  bool const bInClipboard )
544 
545  : SwTextAttr( rAttr, nStart )
546  , SwTextAttrNesting( rAttr, nStart, nEnd )
547  , SwTextField( rAttr, nStart, bInClipboard )
548  , m_bLockNotifyContentChange( false )
549 {
550  SetHasDummyChar( false );
551  SetHasContent( true );
552 }
553 
555 {
556 }
557 
559 {
561  {
562  return false;
563  }
565  return true;
566 }
567 
569 {
571 }
572 
574 {
576  {
578 
579  SwTextField::NotifyContentChange( rFormatField );
581 
583  }
584 }
585 
587 {
588  return GetFormatField().GetField()->ExpandField(false, nullptr/*ignored anyway*/);
589 }
590 
592 {
593  if ( IsFieldInDoc()
594  && GetStart() != (*End()) )
595  {
596  assert( (*End()) - GetStart() >= 2 &&
597  "<SwTextInputField::UpdateFieldContent()> - Are CH_TXT_ATR_INPUTFIELDSTART and/or CH_TXT_ATR_INPUTFIELDEND missing?" );
598  // skip CH_TXT_ATR_INPUTFIELDSTART character
599  const sal_Int32 nIdx = GetStart() + 1;
600  // skip CH_TXT_ATR_INPUTFIELDEND character
601  const sal_Int32 nLen = static_cast<sal_Int32>(std::max<sal_Int32>( 0, ( (*End()) - 1 - nIdx ) ));
602  const OUString aNewFieldContent = GetTextNode().GetExpandText(nullptr, nIdx, nLen);
603 
604  const SwField* pField = GetFormatField().GetField();
605  const SwInputField* pInputField = dynamic_cast<const SwInputField*>(pField);
606  if (pInputField)
607  const_cast<SwInputField*>(pInputField)->applyFieldContent( aNewFieldContent );
608 
609  const SwSetExpField* pExpField = dynamic_cast<const SwSetExpField*>(pField);
610  if (pExpField)
611  {
612  assert(pExpField->GetInputFlag());
613  const_cast<SwSetExpField*>(pExpField)->SetPar2(aNewFieldContent);
614  }
615  assert(pInputField || pExpField);
616 
617  // trigger update of fields for scenarios in which the Input Field's content is part of e.g. a table formula
619  }
620 }
621 
622 void SwTextInputField::UpdateTextNodeContent( const OUString& rNewContent )
623 {
624  assert(IsFieldInDoc() &&
625  "<SwTextInputField::UpdateTextNodeContent(..)> - misusage as Input Field is not in document content.");
626 
627  assert( (*End()) - GetStart() >= 2 &&
628  "<SwTextInputField::UpdateTextNodeContent(..)> - Are CH_TXT_ATR_INPUTFIELDSTART and/or CH_TXT_ATR_INPUTFIELDEND missing?" );
629  // skip CH_TXT_ATR_INPUTFIELDSTART character
630  const sal_Int32 nIdx = GetStart() + 1;
631  // skip CH_TXT_ATR_INPUTFIELDEND character
632  const sal_Int32 nDelLen = std::max<sal_Int32>( 0, ( (*End()) - 1 - nIdx ) );
633  SwIndex aIdx( &GetTextNode(), nIdx );
634  GetTextNode().ReplaceText( aIdx, nDelLen, rNewContent );
635 }
636 
637 // class SwTextAnnotationField //////////////////////////////////////////
638 
639 // text annotation field
641  SwFormatField & rAttr,
642  sal_Int32 const nStart,
643  bool const bInClipboard )
644  : SwTextAttr( rAttr, nStart )
645  , SwTextField( rAttr, nStart, bInClipboard )
646 {
647 }
648 
650 {
651 }
652 
654 {
655  auto pPostItField = dynamic_cast<const SwPostItField*>(GetFormatField().GetField());
656  assert(pPostItField);
657 
658  SwDoc* pDoc = static_cast<const SwPostItFieldType*>(pPostItField->GetTyp())->GetDoc();
659  assert(pDoc != nullptr);
660 
661  IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess();
662  IDocumentMarkAccess::const_iterator_t pMark = pMarksAccess->findAnnotationMark( pPostItField->GetName() );
663  return pMark != pMarksAccess->getAnnotationMarksEnd()
664  ? *pMark
665  : nullptr;
666 }
667 
668 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:234
virtual bool operator==(const SfxPoolItem &) const override
"Pure virtual methods" of SfxPoolItem.
Definition: atrfld.cxx:200
Definition: calc.hxx:184
SwTextField * mpTextField
Definition: fmtfld.hxx:48
void Add(SwClient *pDepend)
Definition: calbck.cxx:217
OUString m_aExpand
Definition: txtfld.hxx:33
The shared part of a user field.
Definition: usrfld.hxx:35
const SwField * GetField() const
Definition: fmtfld.hxx:71
void SetTextField(SwTextField &rTextField)
Definition: atrfld.cxx:190
virtual void ModifyNotification(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override
Definition: node.hxx:475
virtual const_iterator_t getAnnotationMarksEnd() const =0
#define RES_AUTOFMT_DOCNODE
Definition: hintids.hxx:296
#define RES_ATTRSET_CHG
Definition: hintids.hxx:286
virtual const SwRootFrame * GetCurrentLayout() const =0
bool IsProtect() const
Definition: atrfld.cxx:335
void SetHasDummyChar(const bool bFlag)
Definition: txatbase.hxx:72
SwNodeIndex nNode
Definition: pam.hxx:37
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
Base class of all fields.
Definition: fldbas.hxx:280
Provides access to the marks of a document.
Definition: doc.hxx:185
SwTextNode * m_pTextNode
Definition: txtfld.hxx:34
virtual void DeleteRange(SwPaM &)=0
Delete a range SwFlyFrameFormat.
SwTextNode * GetpTextNode() const
Definition: txtfld.hxx:49
virtual ~SwTextInputField() override
Definition: atrfld.cxx:554
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1552
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: calbck.cxx:108
virtual bool DeleteAndJoin(SwPaM &, const bool bForceJoinNext=false)=0
complete delete of a given PaM
SwPaM *const m_pPaM
Definition: fieldhint.hxx:31
SwClient * Remove(SwClient *pDepend)
Definition: calbck.cxx:259
void InvalidateField()
Definition: atrfld.cxx:216
#define RES_REMOVE_UNO_OBJECT
Definition: hintids.hxx:304
virtual bool GetInfo(SfxPoolItem &rInfo) const override
Definition: atrfld.cxx:321
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:347
#define RES_DOCPOS_UPDATE
Definition: hintids.hxx:292
For old documents the Field-Which IDs must be preserved !!!
virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override
Definition: atrfld.cxx:247
virtual void UpdateExpFields(SwTextField *pField, bool bUpdateRefFields)=0
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:389
SwIndex nContent
Definition: pam.hxx:38
const SwTextField * GetTextField() const
Definition: fmtfld.hxx:89
bool CalcHiddenParaField()
Hidden Paragraph Field:
Definition: ndtxt.hxx:702
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
virtual void NotifyContentChange(SwFormatField &rFormatField) override
Definition: atrfld.cxx:573
void SetField(std::unique_ptr< SwField > pField)
Sets current field.
Definition: atrfld.cxx:175
const SwTable & GetTable() const
Definition: node.hxx:497
void CopyTextField(SwTextField *pDest) const
Definition: atrfld.cxx:430
const SwFormatField & GetFormatField() const
Definition: txatbase.hxx:191
virtual const_iterator_t findAnnotationMark(const OUString &rName) const =0
const IDocumentFieldsAccess & getIDocumentFieldsAccess() const
Provides access to the document fields administration interface.
Definition: node.cxx:2062
void ExpandTextField(const bool bForceNotify=false) const
Definition: atrfld.cxx:385
virtual void SwClientNotify(const SwModify &rModify, const SfxHint &rHint) override
Definition: atrfld.cxx:223
virtual ~SwTextField() override
Definition: atrfld.cxx:370
virtual SwFieldType * ChgTyp(SwFieldType *)
Set new type (used for copying among documents).
Definition: fldbas.cxx:338
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
SwTextField(SwFormatField &rAttr, sal_Int32 const nStart, bool const bInClipboard)
Definition: atrfld.cxx:356
struct _xmlTextWriter * xmlTextWriterPtr
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:481
OUString GetFieldContent() const
Definition: atrfld.cxx:586
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
::sw::mark::IMark * GetAnnotationMark() const
Definition: atrfld.cxx:653
const SwPosition * GetPoint() const
Definition: pam.hxx:207
bool IsFieldInDoc() const
Definition: atrfld.cxx:379
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:198
Document fields related interfaces.
SwFormatField(sal_uInt16 nWhich)
Definition: atrfld.cxx:48
SwFieldIds
Definition: fldbas.hxx:38
SwDoc * GetDoc()
Definition: node.hxx:702
std::unique_ptr< SwField > mpField
Definition: fmtfld.hxx:47
bool HasOnlyOneListener()
Definition: calbck.hxx:226
SwDoc * GetDoc() const
Definition: pam.hxx:243
Marks a character position inside a document model node.
Definition: index.hxx:37
double GetValue(SwCalc &rCalc)
Definition: usrfld.cxx:237
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:693
#define RES_HIDDENPARA_PRINT
Definition: hintids.hxx:301
bool IsProtect() const
Is node in something that is protected (range, frame, table cells ...
Definition: node.cxx:420
#define RES_FMT_CHG
Definition: hintids.hxx:285
void RegisterToFieldType(SwFieldType &)
Definition: atrfld.cxx:170
bool m_bLockNotifyContentChange
Definition: txtfld.hxx:101
#define RES_REFMARKFLD_UPDATE
Definition: hintids.hxx:291
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:437
void ClearTextField()
Definition: atrfld.cxx:195
void SetHasContent(const bool bFlag)
Definition: txatbase.hxx:73
SwFieldType * GetTyp() const
Definition: fldbas.hxx:383
bool GetInputFlag() const
Definition: expfld.hxx:265
void NotifyClients(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
Definition: calbck.cxx:167
void SetFormatField(SwFormatField &rFormatField)
Definition: expfld.cxx:836
bool IsFieldInDoc() const
Definition: atrfld.cxx:329
bool IsValid() const
Definition: usrfld.hxx:77
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
void Broadcast(const SfxHint &rHint)
virtual ~SwFormatField() override
Definition: atrfld.cxx:131
OUString ExpandField(bool bCached, SwRootFrame const *pLayout) const
expand the field.
Definition: fldbas.cxx:412
#define RES_TXTATR_FIELD
Definition: hintids.hxx:150
SwTextAnnotationField(SwFormatField &rAttr, sal_Int32 const nStart, bool const bInClipboard)
Definition: atrfld.cxx:640
OUString GetExpandText(SwRootFrame const *pLayout, const sal_Int32 nIdx=0, const sal_Int32 nLen=-1, const bool bWithNum=false, const bool bAddSpaceAfterListLabelStr=false, const bool bWithSpacesForLevel=false, const ExpandMode eAdditionalMode=ExpandMode::ExpandFootnote) const
add 4th optional parameter indicating, when that a spa...
Definition: ndtxt.cxx:3383
void SetFieldsDirty(bool b)
Definition: docfld.hxx:164
void ReplaceText(const SwIndex &rStart, const sal_Int32 nDelLen, const OUString &rText)
replace nDelLen characters at rStart with rText in case the replacement does not fit, it is partially inserted up to the capacity of the node
Definition: ndtxt.cxx:3683
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:59
virtual void NotifyContentChange(SwFormatField &rFormatField)
Definition: atrfld.cxx:493
#define RES_TXTATR_ANNOTATION
Definition: hintids.hxx:153
void SetWhich(sal_uInt16 nId)
bool IsClipBoard() const
Definition: doc.hxx:955
virtual SwDocUpdateField & GetUpdateFields() const =0
css::uno::WeakReference< css::text::XTextField > m_wXTextField
Definition: fmtfld.hxx:45
bool LockNotifyContentChange()
Definition: atrfld.cxx:558
const sal_Int32 * End() const
Definition: txatbase.hxx:148
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:351
const SfxPoolItem & GetAttr() const
Definition: txatbase.hxx:159
void UnlockNotifyContentChange()
Definition: atrfld.cxx:568
#define RES_OBJECTDYING
Definition: hintids.hxx:284
#define SAL_WARN(area, stream)
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2336
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfld.cxx:211
const SwGetSetExpType GSE_STRING
String.
Definition: fldbas.hxx:196
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
void UpdateTextNodeContent(const OUString &rNewContent)
Definition: atrfld.cxx:622
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:455
SwRootFrame const *const m_pLayout
Definition: fieldhint.hxx:32
virtual ~SwTextAnnotationField() override
Definition: atrfld.cxx:649
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: atrfld.cxx:342
SwTextInputField(SwFormatField &rAttr, sal_Int32 const nStart, sal_Int32 const nEnd, bool const bInClipboard)
Definition: atrfld.cxx:539
#define RES_TXTATR_INPUTFIELD
Definition: hintids.hxx:145
SwFieldIds Which() const
Definition: fldbas.hxx:266
static void GetPamForTextField(const SwTextField &rTextField, std::shared_ptr< SwPaM > &rPamForTextField)
Definition: atrfld.cxx:503
void SetFormatField(SwFormatField &rFormatField)
Definition: expfld.cxx:1245
sal_uInt16 Which() const
void UpdateFieldContent()
Definition: atrfld.cxx:591
static void DeleteTextField(const SwTextField &rTextField)
Definition: atrfld.cxx:523
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const