LibreOffice Module sw (master)  1
docfld.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 <config_features.h>
21 
22 #include <hintids.hxx>
23 
24 #include <comphelper/string.hxx>
25 #include <osl/diagnose.h>
26 #include <unotools/charclass.hxx>
27 #ifndef UNX
29 #endif
30 #include <doc.hxx>
32 #include <IDocumentState.hxx>
34 #include <cntfrm.hxx>
35 #include <txtfrm.hxx>
36 #include <notxtfrm.hxx>
37 #include <pam.hxx>
38 #include <ndtxt.hxx>
39 #include <swtable.hxx>
40 #include <calc.hxx>
41 #include <txtfld.hxx>
42 #include <fmtfld.hxx>
43 #include <txttxmrk.hxx>
44 #include <docfld.hxx>
45 #include <docufld.hxx>
46 #include <usrfld.hxx>
47 #include <expfld.hxx>
48 #include <dbfld.hxx>
49 #include <reffld.hxx>
50 #include <dbmgr.hxx>
51 #include <section.hxx>
52 #include <docary.hxx>
53 #include <authfld.hxx>
54 #include <txtinet.hxx>
55 #include <fmtcntnt.hxx>
56 
57 using namespace ::com::sun::star::uno;
58 
59 // the StartIndex can be supplied optionally (e.g. if it was queried before - is a virtual
60 // method otherwise!)
62  const SwNodeIndex& rNdIdx,
63  const SwTextField* pField,
64  const SwIndex* pIdx )
65 {
67  m_CNTNT.pTextField = pField;
68  m_nNode = rNdIdx.GetIndex();
69  if( pIdx )
70  m_nContent = pIdx->GetIndex();
71  else if( pField )
72  m_nContent = pField->GetStart();
73  else
74  m_nContent = 0;
75 }
76 
78  const SwTextINetFormat& rINet )
79 {
81  m_CNTNT.pTextINet = &rINet;
82  m_nNode = rNdIdx.GetIndex();
83  m_nContent = rINet.GetStart();
84 }
85 
86 // Extension for Sections:
87 // these always have content position 0xffffffff!
88 // There is never a field on this, only up to COMPLETE_STRING possible
90  const SwPosition* pPos )
91 {
93  m_CNTNT.pSection = &rSectNd.GetSection();
94 
95  if( pPos )
96  {
97  m_nNode = pPos->nNode.GetIndex();
98  m_nContent = pPos->nContent.GetIndex();
99  }
100  else
101  {
102  m_nNode = rSectNd.GetIndex();
103  m_nContent = 0;
104  }
105 }
106 
108 {
110  m_CNTNT.pTBox = &rTBox;
111 
112  m_nNode = 0;
113  m_nContent = 0;
114  if( rTBox.GetSttNd() )
115  {
116  SwNodeIndex aIdx( *rTBox.GetSttNd() );
117  const SwContentNode* pNd = aIdx.GetNode().GetNodes().GoNext( &aIdx );
118  if( pNd )
119  m_nNode = pNd->GetIndex();
120  }
121 }
122 
124  const SwTextTOXMark& rTOX )
125 {
127  m_CNTNT.pTextTOX = &rTOX;
128  m_nNode = rNdIdx.GetIndex();
129  m_nContent = rTOX.GetStart();
130 }
131 
133 {
135  m_CNTNT.pPos = &rPos;
136  m_nNode = rPos.nNode.GetIndex();
137  m_nContent = rPos.nContent.GetIndex();
138 }
139 
141  const SwPosition* pPos )
142 {
144  m_CNTNT.pFlyFormat = &rFlyFormat;
145  if( pPos )
146  {
147  m_nNode = pPos->nNode.GetIndex();
148  m_nContent = pPos->nContent.GetIndex();
149  }
150  else
151  {
152  const SwFormatContent& rContent = rFlyFormat.GetContent();
153  m_nNode = rContent.GetContentIdx()->GetIndex() + 1;
154  m_nContent = 0;
155  }
156 }
157 
159 {
160  const SwNode* pNd = GetNodeFromContent();
161  if( pNd )
162  pNd = pNd->GetContentNode();
163 
164  if( pNd )
165  {
166  rPos.nNode = *pNd;
167  rPos.nContent.Assign( const_cast<SwContentNode*>(static_cast<const SwContentNode*>(pNd)), GetCntPosFromContent() );
168  }
169  else
170  {
171  rPos.nNode = m_nNode;
173  }
174 }
175 
177 {
178  if( !rFrame.IsInDocBody() )
179  {
180  SwNodeIndex aIdx( rFrame.IsTextFrame()
181  ? *static_cast<SwTextFrame const&>(rFrame).GetTextNodeFirst()
182  : *static_cast<SwNoTextFrame const&>(rFrame).GetNode() );
183  SwDoc& rDoc = aIdx.GetNodes().GetDoc();
184  SwPosition aPos( aIdx );
185  bool const bResult = ::GetBodyTextNode( rDoc, aPos, rFrame );
186  OSL_ENSURE(bResult, "Where is the field?");
187  m_nNode = aPos.nNode.GetIndex();
188  m_nContent = aPos.nContent.GetIndex();
189  }
190 }
191 
192 bool SetGetExpField::operator==( const SetGetExpField& rField ) const
193 {
194  return m_nNode == rField.m_nNode
195  && m_nContent == rField.m_nContent
196  && ( !m_CNTNT.pTextField
197  || !rField.m_CNTNT.pTextField
198  || m_CNTNT.pTextField == rField.m_CNTNT.pTextField );
199 }
200 
201 bool SetGetExpField::operator<( const SetGetExpField& rField ) const
202 {
203  if( m_nNode < rField.m_nNode || ( m_nNode == rField.m_nNode && m_nContent < rField.m_nContent ))
204  return true;
205  else if( m_nNode != rField.m_nNode || m_nContent != rField.m_nContent )
206  return false;
207 
208  const SwNode *pFirst = GetNodeFromContent(),
209  *pNext = rField.GetNodeFromContent();
210 
211  // Position is the same: continue only if both field pointers are set!
212  if( !pFirst || !pNext )
213  return false;
214 
215  // same Section?
216  if( pFirst->StartOfSectionNode() != pNext->StartOfSectionNode() )
217  {
218  // is one in the table?
219  const SwNode *pFirstStt, *pNextStt;
220  const SwTableNode* pTableNd = pFirst->FindTableNode();
221  if( pTableNd )
222  pFirstStt = pTableNd->StartOfSectionNode();
223  else
224  pFirstStt = pFirst->StartOfSectionNode();
225 
226  pTableNd = pNext->FindTableNode();
227  if( pTableNd )
228  pNextStt = pTableNd->StartOfSectionNode();
229  else
230  pNextStt = pNext->StartOfSectionNode();
231 
232  if( pFirstStt != pNextStt )
233  {
234  if( pFirst->IsTextNode() && pNext->IsTextNode() &&
235  ( pFirst->FindFlyStartNode() || pNext->FindFlyStartNode() ))
236  {
237  // FIXME: in NewFieldPortion(), SwGetExpField are expanded via
238  // DocumentFieldsManager::FieldsToExpand() calling
239  // std::upper_bound binary search function - the sort order
240  // depends on the fly positions in the layout, but the fly
241  // positions depend on the expansion of the SwGetExpField!
242  // This circular dep will cause trouble, it would be better to
243  // use only model positions (anchor), but then how to compare
244  // at-page anchored flys which don't have a model anchor?
245  return ::IsFrameBehind( *pNext->GetTextNode(), m_nContent, *pFirst->GetTextNode(), m_nContent );
246  }
247  return pFirstStt->GetIndex() < pNextStt->GetIndex();
248  }
249  }
250 
251  // same Section: is the field in the same Node?
252  if( pFirst != pNext )
253  return pFirst->GetIndex() < pNext->GetIndex();
254 
255  // same Node in the Section, check Position in the Node
256  return GetCntPosFromContent() < rField.GetCntPosFromContent();
257 }
258 
260 {
261  const SwNode* pRet = nullptr;
262  if( m_CNTNT.pTextField )
263  switch( m_eSetGetExpFieldType )
264  {
265  case TEXTFIELD:
266  pRet = &m_CNTNT.pTextField->GetTextNode();
267  break;
268 
269  case TEXTINET:
270  pRet = &m_CNTNT.pTextINet->GetTextNode();
271  break;
272 
273  case SECTIONNODE:
274  pRet = m_CNTNT.pSection->GetFormat()->GetSectionNode();
275  break;
276 
277  case CRSRPOS:
278  pRet = &m_CNTNT.pPos->nNode.GetNode();
279  break;
280 
281  case TEXTTOXMARK:
282  pRet = &m_CNTNT.pTextTOX->GetTextNode();
283  break;
284 
285  case TABLEBOX:
286  if( m_CNTNT.pTBox->GetSttNd() )
287  {
288  SwNodeIndex aIdx( *m_CNTNT.pTBox->GetSttNd() );
289  pRet = aIdx.GetNode().GetNodes().GoNext( &aIdx );
290  }
291  break;
292 
293  case FLYFRAME:
294  {
295  SwNodeIndex aIdx( *m_CNTNT.pFlyFormat->GetContent().GetContentIdx() );
296  pRet = aIdx.GetNode().GetNodes().GoNext( &aIdx );
297  }
298  break;
299  }
300  return pRet;
301 }
302 
304 {
305  sal_Int32 nRet = 0;
306  if( m_CNTNT.pTextField )
307  switch( m_eSetGetExpFieldType )
308  {
309  case TEXTFIELD:
310  nRet = m_CNTNT.pTextField->GetStart();
311  break;
312  case TEXTINET:
313  nRet = m_CNTNT.pTextINet->GetStart();
314  break;
315  case TEXTTOXMARK:
316  nRet = m_CNTNT.pTextTOX->GetStart();
317  break;
318  case CRSRPOS:
319  nRet = m_CNTNT.pPos->nContent.GetIndex();
320  break;
321  default:
322  break;
323  }
324  return nRet;
325 }
326 
327 HashStr::HashStr( const OUString& rName, const OUString& rText,
328  HashStr* pNxt )
329  : SwHash( rName ), aSetStr( rText )
330 {
331  pNext.reset( pNxt );
332 }
333 
335 OUString LookString( SwHashTable<HashStr> const & rTable, const OUString& rName )
336 {
337  HashStr* pFnd = rTable.Find( comphelper::string::strip(rName, ' ') );
338  if( pFnd )
339  return pFnd->aSetStr;
340 
341  return OUString();
342 }
343 
345 {
346  return GetDBDesc();
347 }
348 
350 {
351 #if HAVE_FEATURE_DBCONNECTIVITY
352  if(maDBData.sDataSource.isEmpty())
353  {
354  const SwFieldTypes::size_type nSize = getIDocumentFieldsAccess().GetFieldTypes()->size();
355  for(SwFieldTypes::size_type i = 0; i < nSize && maDBData.sDataSource.isEmpty(); ++i)
356  {
357  SwFieldType& rFieldType = *((*getIDocumentFieldsAccess().GetFieldTypes())[i]);
358  SwFieldIds nWhich = rFieldType.Which();
359  if(IsUsed(rFieldType))
360  {
361  switch(nWhich)
362  {
367  {
368  std::vector<SwFormatField*> vFields;
369  rFieldType.GatherFields(vFields);
370  if(vFields.size())
371  {
372  if(SwFieldIds::Database == nWhich)
373  maDBData = static_cast<SwDBFieldType*>(vFields.front()->GetField()->GetTyp())->GetDBData();
374  else
375  maDBData = static_cast<SwDBNameInfField*> (vFields.front()->GetField())->GetRealDBData();
376  }
377  }
378  break;
379  default: break;
380  }
381  }
382  }
383  }
384  if(maDBData.sDataSource.isEmpty())
386 #endif
387  return maDBData;
388 }
389 
391 {
392 #if !HAVE_FEATURE_DBCONNECTIVITY
393  (void) b;
394 #else
396 #endif
397 }
398 
399 #if HAVE_FEATURE_DBCONNECTIVITY
400 
402 static OUString lcl_DBDataToString(const SwDBData& rData)
403 {
404  return rData.sDataSource + OUStringChar(DB_DELIM)
405  + rData.sCommand + OUStringChar(DB_DELIM)
406  + OUString::number(rData.nCommandType);
407 }
408 
409 #endif
410 
411 void SwDoc::GetAllUsedDB( std::vector<OUString>& rDBNameList,
412  const std::vector<OUString>* pAllDBNames )
413 {
414 #if !HAVE_FEATURE_DBCONNECTIVITY
415  (void) rDBNameList;
416  (void) pAllDBNames;
417 #else
418  std::vector<OUString> aUsedDBNames;
419  std::vector<OUString> aAllDBNames;
420 
421  if( !pAllDBNames )
422  {
423  GetAllDBNames( aAllDBNames );
424  pAllDBNames = &aAllDBNames;
425  }
426 
427  SwSectionFormats& rArr = GetSections();
428  for (auto n = rArr.size(); n; )
429  {
430  SwSection* pSect = rArr[ --n ]->GetSection();
431 
432  if( pSect )
433  {
434  AddUsedDBToList( rDBNameList, FindUsedDBs( *pAllDBNames,
435  pSect->GetCondition(), aUsedDBNames ) );
436  aUsedDBNames.clear();
437  }
438  }
439 
440  for (sal_uInt16 const nWhichHint : { RES_TXTATR_FIELD, RES_TXTATR_INPUTFIELD })
441  {
442  for (const SfxPoolItem* pItem : GetAttrPool().GetItemSurrogates(nWhichHint))
443  {
444  const SwFormatField* pFormatField = static_cast<const SwFormatField*>(pItem);
445  const SwTextField* pTextField = pFormatField->GetTextField();
446  if (!pTextField || !pTextField->GetTextNode().GetNodes().IsDocNodes())
447  continue;
448 
449  const SwField* pField = pFormatField->GetField();
450  switch (pField->GetTyp()->Which())
451  {
453  AddUsedDBToList( rDBNameList,
454  lcl_DBDataToString(static_cast<const SwDBField*>(pField)->GetDBData() ));
455  break;
456 
459  AddUsedDBToList( rDBNameList,
460  lcl_DBDataToString(static_cast<const SwDBNameInfField*>(pField)->GetRealDBData() ));
461  break;
462 
465  AddUsedDBToList( rDBNameList,
466  lcl_DBDataToString(static_cast<const SwDBNameInfField*>(pField)->GetRealDBData() ));
467  [[fallthrough]]; // JP: is that right like that?
468 
471  AddUsedDBToList(rDBNameList, FindUsedDBs( *pAllDBNames,
472  pField->GetPar1(), aUsedDBNames ));
473  aUsedDBNames.clear();
474  break;
475 
476  case SwFieldIds::SetExp:
477  case SwFieldIds::GetExp:
478  case SwFieldIds::Table:
479  AddUsedDBToList(rDBNameList, FindUsedDBs( *pAllDBNames,
480  pField->GetFormula(), aUsedDBNames ));
481  aUsedDBNames.clear();
482  break;
483  default: break;
484  }
485  }
486  }
487 #endif
488 }
489 
490 void SwDoc::GetAllDBNames( std::vector<OUString>& rAllDBNames )
491 {
492 #if !HAVE_FEATURE_DBCONNECTIVITY
493  (void) rAllDBNames;
494 #else
495  SwDBManager* pMgr = GetDBManager();
496 
497  const SwDSParams_t& rArr = pMgr->GetDSParamArray();
498  for (const auto& pParam : rArr)
499  {
500  rAllDBNames.emplace_back(pParam->sDataSource + OUStringChar(DB_DELIM) + pParam->sCommand);
501  }
502 #endif
503 }
504 
505 std::vector<OUString>& SwDoc::FindUsedDBs( const std::vector<OUString>& rAllDBNames,
506  const OUString& rFormula,
507  std::vector<OUString>& rUsedDBNames )
508 {
509  const CharClass& rCC = GetAppCharClass();
510 #ifndef UNX
511  const OUString sFormula(rCC.uppercase( rFormula ));
512 #else
513  const OUString sFormula(rFormula);
514 #endif
515 
516  for (const auto &sItem : rAllDBNames)
517  {
518  sal_Int32 nPos = sFormula.indexOf( sItem );
519  if( nPos>=0 &&
520  sFormula[ nPos + sItem.getLength() ] == '.' &&
521  (!nPos || !rCC.isLetterNumeric( sFormula, nPos - 1 )))
522  {
523  // Look up table name
524  nPos += sItem.getLength() + 1;
525  const sal_Int32 nEndPos = sFormula.indexOf('.', nPos);
526  if( nEndPos>=0 )
527  {
528  rUsedDBNames.emplace_back(sItem + OUStringChar(DB_DELIM) + sFormula.subView( nPos, nEndPos - nPos ));
529  }
530  }
531  }
532  return rUsedDBNames;
533 }
534 
535 void SwDoc::AddUsedDBToList( std::vector<OUString>& rDBNameList,
536  const std::vector<OUString>& rUsedDBNames )
537 {
538  for ( const auto &sName : rUsedDBNames )
539  AddUsedDBToList( rDBNameList, sName );
540 }
541 
542 void SwDoc::AddUsedDBToList( std::vector<OUString>& rDBNameList, const OUString& rDBName)
543 {
544 #if !HAVE_FEATURE_DBCONNECTIVITY
545  (void) rDBNameList;
546  (void) rDBName;
547 #else
548  if( rDBName.isEmpty() )
549  return;
550 
551 #ifdef UNX
552  for( const auto &sName : rDBNameList )
553  if( rDBName == sName.getToken(0, ';') )
554  return;
555 #else
556  const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
557  for( const auto &sName : rDBNameList )
558  if( rSCmp.isEqual( rDBName, sName.getToken(0, ';') ) )
559  return;
560 #endif
561 
562  SwDBData aData;
563  sal_Int32 nIdx{ 0 };
564  aData.sDataSource = rDBName.getToken(0, DB_DELIM, nIdx);
565  aData.sCommand = rDBName.getToken(0, DB_DELIM, nIdx);
566  aData.nCommandType = -1;
567  GetDBManager()->CreateDSData(aData);
568  rDBNameList.push_back(rDBName);
569 #endif
570 }
571 
572 void SwDoc::ChangeDBFields( const std::vector<OUString>& rOldNames,
573  const OUString& rNewName )
574 {
575 #if !HAVE_FEATURE_DBCONNECTIVITY
576  (void) rOldNames;
577  (void) rNewName;
578 #else
579  SwDBData aNewDBData;
580  sal_Int32 nIdx{ 0 };
581  aNewDBData.sDataSource = rNewName.getToken(0, DB_DELIM, nIdx);
582  aNewDBData.sCommand = rNewName.getToken(0, DB_DELIM, nIdx);
583  aNewDBData.nCommandType = static_cast<short>(rNewName.getToken(0, DB_DELIM, nIdx).toInt32());
584 
585  SwSectionFormats& rArr = GetSections();
586  for (auto n = rArr.size(); n; )
587  {
588  SwSection* pSect = rArr[ --n ]->GetSection();
589 
590  if( pSect )
591  {
592  pSect->SetCondition(ReplaceUsedDBs(rOldNames, rNewName, pSect->GetCondition()));
593  }
594  }
595 
596  for (sal_uInt16 const nWhichHint : { RES_TXTATR_FIELD, RES_TXTATR_INPUTFIELD })
597  {
598  for (const SfxPoolItem* pItem : GetAttrPool().GetItemSurrogates(nWhichHint))
599  {
600  SwFormatField* pFormatField = const_cast<SwFormatField*>(static_cast<const SwFormatField*>(pItem));
601  SwTextField* pTextField = pFormatField->GetTextField();
602  if (!pTextField || !pTextField->GetTextNode().GetNodes().IsDocNodes())
603  continue;
604 
605  SwField* pField = pFormatField->GetField();
606  bool bExpand = false;
607 
608  switch( pField->GetTyp()->Which() )
609  {
611 #if HAVE_FEATURE_DBCONNECTIVITY
612  if (IsNameInArray(rOldNames, lcl_DBDataToString(static_cast<SwDBField*>(pField)->GetDBData())))
613  {
614  SwDBFieldType* pOldTyp = static_cast<SwDBFieldType*>(pField->GetTyp());
615 
617  SwDBFieldType(this, pOldTyp->GetColumnName(), aNewDBData)));
618 
619  pFormatField->RegisterToFieldType( *pTyp );
620  pField->ChgTyp(pTyp);
621 
622  static_cast<SwDBField*>(pField)->ClearInitialized();
623  static_cast<SwDBField*>(pField)->InitContent();
624 
625  bExpand = true;
626  }
627 #endif
628  break;
629 
632  if (IsNameInArray(rOldNames,
633  lcl_DBDataToString(static_cast<SwDBNameInfField*>(pField)->GetRealDBData())))
634  {
635  static_cast<SwDBNameInfField*>(pField)->SetDBData(aNewDBData);
636  bExpand = true;
637  }
638  break;
639 
642  if (IsNameInArray(rOldNames,
643  lcl_DBDataToString(static_cast<SwDBNameInfField*>(pField)->GetRealDBData())))
644  {
645  static_cast<SwDBNameInfField*>(pField)->SetDBData(aNewDBData);
646  }
647  [[fallthrough]];
650  pField->SetPar1( ReplaceUsedDBs(rOldNames, rNewName, pField->GetPar1()) );
651  bExpand = true;
652  break;
653 
654  case SwFieldIds::SetExp:
655  case SwFieldIds::GetExp:
656  case SwFieldIds::Table:
657  pField->SetPar2( ReplaceUsedDBs(rOldNames, rNewName, pField->GetFormula()) );
658  bExpand = true;
659  break;
660  default: break;
661  }
662 
663  if (bExpand)
664  pTextField->ExpandTextField( true );
665  }
666  }
668 #endif
669 }
670 
671 namespace
672 {
673 
674 OUString lcl_CutOffDBCommandType(const OUString& rName)
675 {
676  return rName.replaceFirst(OUStringChar(DB_DELIM), ".").getToken(0, DB_DELIM);
677 }
678 
679 }
680 
681 OUString SwDoc::ReplaceUsedDBs( const std::vector<OUString>& rUsedDBNames,
682  const OUString& rNewName, const OUString& rFormula )
683 {
684  const CharClass& rCC = GetAppCharClass();
685  const OUString sNewName( lcl_CutOffDBCommandType(rNewName) );
686  OUString sFormula(rFormula);
687 
688  for(const auto & rUsedDBName : rUsedDBNames)
689  {
690  const OUString sDBName( lcl_CutOffDBCommandType(rUsedDBName) );
691 
692  if (sDBName!=sNewName)
693  {
694  sal_Int32 nPos = 0;
695  for (;;)
696  {
697  nPos = sFormula.indexOf(sDBName, nPos);
698  if (nPos<0)
699  {
700  break;
701  }
702 
703  if( sFormula[nPos + sDBName.getLength()] == '.' &&
704  (!nPos || !rCC.isLetterNumeric( sFormula, nPos - 1 )))
705  {
706  sFormula = sFormula.replaceAt(nPos, sDBName.getLength(), sNewName);
707  //prevent re-searching - this is useless and provokes
708  //endless loops when names containing each other and numbers are exchanged
709  //e.g.: old ?12345.12345 new: i12345.12345
710  nPos += sNewName.getLength();
711  }
712  }
713  }
714  }
715  return sFormula;
716 }
717 
718 bool SwDoc::IsNameInArray( const std::vector<OUString>& rArr, const OUString& rName )
719 {
720 #ifdef UNX
721  for( const auto &sName : rArr )
722  if( rName == sName )
723  return true;
724 #else
725  const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
726  for( const auto &sName : rArr )
727  if( rSCmp.isEqual( rName, sName ))
728  return true;
729 #endif
730  return false;
731 }
732 
734 {
735  const SwFieldTypes::size_type nSize = getIDocumentFieldsAccess().GetFieldTypes()->size();
736 
737  for( SwFieldTypes::size_type i = INIT_FLDTYPES; i < nSize; ++i )
738  {
739  SwFieldType* pFieldType = (*getIDocumentFieldsAccess().GetFieldTypes())[i].get();
740  if( SwFieldIds::TableOfAuthorities == pFieldType->Which() )
741  {
742  SwAuthorityFieldType* pAuthType = static_cast<SwAuthorityFieldType*>(pFieldType);
743  pAuthType->ChangeEntryContent(pNewData);
744  break;
745  }
746  }
747 
748 }
749 
750 void SwDocUpdateField::InsDelFieldInFieldLst( bool bIns, const SwTextField& rField )
751 {
752  const SwFieldIds nWhich = rField.GetFormatField().GetField()->GetTyp()->Which();
753  switch( nWhich )
754  {
756  case SwFieldIds::SetExp:
762  case SwFieldIds::GetExp:
763  break; // these have to be added/removed!
764 
765  default:
766  return;
767  }
768 
769  SetFieldsDirty( true );
770  if (!m_pFieldSortList)
771  {
772  if( !bIns ) // if list is present and deleted
773  return; // don't do a thing
775  }
776 
777  if( bIns ) // insert anew:
778  GetBodyNode( rField, nWhich );
779  else
780  {
781  // look up via the pTextField pointer. It is a sorted list, but it's sorted by node
782  // position. Until this is found, the search for the pointer is already done.
783  for (SetGetExpFields::size_type n = 0; n < m_pFieldSortList->size(); ++n)
784  {
785  if (&rField == (*m_pFieldSortList)[n]->GetPointer())
786  {
787  m_pFieldSortList->erase_at(n);
788  n--; // one field can occur multiple times
789  }
790  }
791  }
792 }
793 
794 void SwDocUpdateField::MakeFieldList( SwDoc& rDoc, bool bAll, int eGetMode )
795 {
796  if (!m_pFieldSortList || bAll
797  || ((eGetMode & m_nFieldListGetMode) != eGetMode)
798  || rDoc.GetNodes().Count() != m_nNodes)
799  {
800  MakeFieldList_( rDoc, eGetMode );
801  }
802 }
803 
804 void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode )
805 {
806  // new version: walk all fields of the attribute pool
808 
809  // consider and unhide sections
810  // with hide condition, only in mode GETFLD_ALL (<eGetMode == GETFLD_ALL>)
811  // notes by OD:
812  // eGetMode == GETFLD_CALC in call from methods SwDoc::FieldsToCalc
813  // eGetMode == GETFLD_EXPAND in call from method SwDoc::FieldsToExpand
814  // eGetMode == GETFLD_ALL in call from method SwDoc::UpdateExpFields
815  // I figured out that hidden section only have to be shown,
816  // if fields have updated (call by SwDoc::UpdateExpFields) and thus
817  // the hide conditions of section have to be updated.
818  // For correct updating the hide condition of a section, its position
819  // have to be known in order to insert the hide condition as a new
820  // expression field into the sorted field list (<m_pFieldSortList>).
821  if ( eGetMode == GETFLD_ALL )
822  // Collect the sections first. Supply sections that are hidden by condition
823  // with frames so that the contained fields are sorted properly.
824  {
825  // In order for the frames to be created the right way, they have to be expanded
826  // from top to bottom
827  std::vector<sal_uLong> aTmpArr;
828  std::vector<sal_uLong>::size_type nArrStt = 0;
829  SwSectionFormats& rArr = rDoc.GetSections();
830  SwSectionNode* pSectNd = nullptr;
831  sal_uLong nSttContent = rDoc.GetNodes().GetEndOfExtras().GetIndex();
832 
833  for (SwSectionFormats::size_type n = rArr.size(); n; )
834  {
835  SwSection* pSect = rArr[ --n ]->GetSection();
836  if( !pSect || !pSect->IsHidden() || pSect->GetCondition().isEmpty() )
837  continue;
838  pSectNd = pSect->GetFormat()->GetSectionNode();
839  if( pSectNd )
840  {
841  sal_uLong nIdx = pSectNd->GetIndex();
842  aTmpArr.push_back( nIdx );
843  if( nIdx < nSttContent )
844  ++nArrStt;
845  }
846  }
847  std::sort(aTmpArr.begin(), aTmpArr.end());
848 
849  // Display all first so that we have frames. The BodyAnchor is defined by that.
850  // First the ContentArea, then the special areas!
851  for (std::vector<sal_uLong>::size_type n = nArrStt; n < aTmpArr.size(); ++n)
852  {
853  pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode();
854  OSL_ENSURE( pSectNd, "Where is my SectionNode" );
855  pSectNd->GetSection().SetCondHidden( false );
856  }
857  for (std::vector<sal_uLong>::size_type n = 0; n < nArrStt; ++n)
858  {
859  pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode();
860  OSL_ENSURE( pSectNd, "Where is my SectionNode" );
861  pSectNd->GetSection().SetCondHidden( false );
862  }
863 
864  // add all to the list so that they are sorted
865  for (const auto &nId : aTmpArr)
866  {
867  GetBodyNode( *rDoc.GetNodes()[ nId ]->GetSectionNode() );
868  }
869  }
870 
871  const OUString sTrue("TRUE");
872  const OUString sFalse("FALSE");
873 
874 #if HAVE_FEATURE_DBCONNECTIVITY
875  bool bIsDBManager = nullptr != rDoc.GetDBManager();
876 #endif
877 
878  for (sal_uInt16 const nWhichHint : { RES_TXTATR_FIELD, RES_TXTATR_INPUTFIELD })
879  {
880  for (const SfxPoolItem* pItem : rDoc.GetAttrPool().GetItemSurrogates(nWhichHint))
881  {
882  const SwFormatField* pFormatField = static_cast<const SwFormatField*>(pItem);
883  const SwTextField* pTextField = pFormatField->GetTextField();
884  if (!pTextField || !pTextField->GetTextNode().GetNodes().IsDocNodes())
885  continue;
886 
887  OUString sFormula;
888  const SwField* pField = pFormatField->GetField();
889  const SwFieldIds nWhich = pField->GetTyp()->Which();
890  switch (nWhich)
891  {
893  case SwFieldIds::GetExp:
894  if (GETFLD_ALL == eGetMode)
895  sFormula = sTrue;
896  break;
897 
899  if (GETFLD_EXPAND & eGetMode)
900  sFormula = sTrue;
901  break;
902 
903  case SwFieldIds::SetExp:
904  if ((eGetMode != GETFLD_EXPAND) ||
906  {
907  sFormula = sTrue;
908  }
909  break;
910 
912  if (GETFLD_ALL == eGetMode)
913  {
914  sFormula = pField->GetPar1();
915  if (sFormula.isEmpty() || sFormula==sFalse)
916  const_cast<SwHiddenParaField*>(static_cast<const SwHiddenParaField*>(pField))->SetHidden( false );
917  else if (sFormula==sTrue)
918  const_cast<SwHiddenParaField*>(static_cast<const SwHiddenParaField*>(pField))->SetHidden( true );
919  else
920  break;
921 
922  sFormula.clear();
923  // trigger formatting
924  const_cast<SwFormatField*>(pFormatField)->UpdateTextNode( nullptr, nullptr );
925  }
926  break;
927 
929  if (GETFLD_ALL == eGetMode)
930  {
931  sFormula = pField->GetPar1();
932  if (sFormula.isEmpty() || sFormula==sFalse)
933  const_cast<SwHiddenTextField*>(static_cast<const SwHiddenTextField*>(pField))->SetValue( true );
934  else if (sFormula==sTrue)
935  const_cast<SwHiddenTextField*>(static_cast<const SwHiddenTextField*>(pField))->SetValue( false );
936  else
937  break;
938 
939  sFormula.clear();
940 
941  // evaluate field
942  const_cast<SwHiddenTextField*>(static_cast<const SwHiddenTextField*>(pField))->Evaluate(rDoc);
943  // trigger formatting
944  const_cast<SwFormatField*>(pFormatField)->UpdateTextNode(nullptr, nullptr);
945  }
946  break;
947 
948 #if HAVE_FEATURE_DBCONNECTIVITY
950  {
951  SwDBData aDBData(const_cast<SwDBNumSetField*>(static_cast<const SwDBNumSetField*>(pField))->GetDBData(&rDoc));
952 
953  if ( (bIsDBManager && rDoc.GetDBManager()->OpenDataSource(aDBData.sDataSource, aDBData.sCommand))
954  && (GETFLD_ALL == eGetMode
955  || (GETFLD_CALC & eGetMode
956  && static_cast<const SwDBNumSetField*>(pField)->IsCondValid()))
957  )
958  {
959  sFormula = pField->GetPar1();
960  }
961  }
962  break;
964  {
965  SwDBData aDBData(const_cast<SwDBNextSetField*>(static_cast<const SwDBNextSetField*>(pField))->GetDBData(&rDoc));
966 
967  if ( (bIsDBManager && rDoc.GetDBManager()->OpenDataSource(aDBData.sDataSource, aDBData.sCommand))
968  && (GETFLD_ALL == eGetMode
969  || (GETFLD_CALC & eGetMode
970  && static_cast<const SwDBNextSetField*>(pField)->IsCondValid()))
971  )
972  {
973  sFormula = pField->GetPar1();
974  }
975  }
976  break;
977 #endif
978  default: break;
979  }
980 
981  if (!sFormula.isEmpty())
982  {
983  GetBodyNode( *pTextField, nWhich );
984  }
985  }
986  }
987  m_nFieldListGetMode = eGetMode;
988  m_nNodes = rDoc.GetNodes().Count();
989 }
990 
991 void SwDocUpdateField::GetBodyNode( const SwTextField& rTField, SwFieldIds nFieldWhich )
992 {
993  const SwTextNode& rTextNd = rTField.GetTextNode();
994  const SwDoc& rDoc = rTextNd.GetDoc();
995 
996  // always the first! (in tab headline, header-/footer)
997  Point aPt;
998  std::pair<Point, bool> const tmp(aPt, false);
999  const SwContentFrame* pFrame = rTextNd.getLayoutFrame(
1000  rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp);
1001 
1002  std::unique_ptr<SetGetExpField> pNew;
1003  bool bIsInBody = false;
1004 
1005  if( !pFrame || pFrame->IsInDocBody() )
1006  {
1007  // create index to determine the TextNode
1008  SwNodeIndex aIdx( rTextNd );
1009  bIsInBody = rDoc.GetNodes().GetEndOfExtras().GetIndex() < aIdx.GetIndex();
1010 
1011  // We don't want to update fields in redlines, or those
1012  // in frames whose anchor is in redline. However, we do want to update
1013  // fields in hidden sections. So: In order to be updated, a field 1)
1014  // must have a frame, or 2) it must be in the document body.
1015  if( (pFrame != nullptr) || bIsInBody )
1016  pNew.reset(new SetGetExpField( aIdx, &rTField ));
1017  }
1018  else
1019  {
1020  // create index to determine the TextNode
1021  SwPosition aPos( rDoc.GetNodes().GetEndOfPostIts() );
1022  bool const bResult = GetBodyTextNode( rDoc, aPos, *pFrame );
1023  OSL_ENSURE(bResult, "where is the Field");
1024  pNew.reset(new SetGetExpField( aPos.nNode, &rTField, &aPos.nContent ));
1025  }
1026 
1027  // always set the BodyTextFlag in GetExp or DB fields
1028  if( SwFieldIds::GetExp == nFieldWhich )
1029  {
1030  SwGetExpField* pGetField = const_cast<SwGetExpField*>(static_cast<const SwGetExpField*>(rTField.GetFormatField().GetField()));
1031  pGetField->ChgBodyTextFlag( bIsInBody );
1032  }
1033 #if HAVE_FEATURE_DBCONNECTIVITY
1034  else if( SwFieldIds::Database == nFieldWhich )
1035  {
1036  SwDBField* pDBField = const_cast<SwDBField*>(static_cast<const SwDBField*>(rTField.GetFormatField().GetField()));
1037  pDBField->ChgBodyTextFlag( bIsInBody );
1038  }
1039 #endif
1040  if( pNew != nullptr )
1041  m_pFieldSortList->insert( std::move(pNew) );
1042 }
1043 
1045 {
1046  const SwDoc& rDoc = rSectNd.GetDoc();
1047  std::unique_ptr<SetGetExpField> pNew;
1048 
1049  if( rSectNd.GetIndex() < rDoc.GetNodes().GetEndOfExtras().GetIndex() )
1050  {
1051  do { // middle check loop
1052 
1053  // we need to get the anchor first
1054  // create index to determine the TextNode
1055  SwPosition aPos( rSectNd );
1056  SwContentNode* pCNd = rDoc.GetNodes().GoNext( &aPos.nNode ); // to the next ContentNode
1057 
1058  if( !pCNd || !pCNd->IsTextNode() )
1059  break;
1060 
1061  // always the first! (in tab headline, header-/footer)
1062  Point aPt;
1063  std::pair<Point, bool> const tmp(aPt, false);
1064  const SwContentFrame* pFrame = pCNd->getLayoutFrame(
1066  nullptr, &tmp);
1067  if( !pFrame )
1068  break;
1069 
1070  bool const bResult = GetBodyTextNode( rDoc, aPos, *pFrame );
1071  OSL_ENSURE(bResult, "where is the Field");
1072  pNew.reset(new SetGetExpField( rSectNd, &aPos ));
1073 
1074  } while( false );
1075  }
1076 
1077  if( !pNew )
1078  pNew.reset(new SetGetExpField( rSectNd ));
1079 
1080  m_pFieldSortList->insert( std::move(pNew) );
1081 }
1082 
1084 {
1085  OUString sFieldName;
1086  switch( rType.Which() )
1087  {
1088  case SwFieldIds::User :
1089  sFieldName = static_cast<const SwUserFieldType&>(rType).GetName();
1090  break;
1091  case SwFieldIds::SetExp:
1092  sFieldName = static_cast<const SwSetExpFieldType&>(rType).GetName();
1093  break;
1094  default:
1095  OSL_ENSURE( false, "No valid field type" );
1096  }
1097 
1098  if( sFieldName.isEmpty() )
1099  return;
1100 
1101  SetFieldsDirty( true );
1102  // look up and remove from the hash table
1103  sFieldName = GetAppCharClass().lowercase( sFieldName );
1104  sal_uInt16 n;
1105 
1106  SwCalcFieldType* pFnd = GetFieldTypeTable().Find( sFieldName, &n );
1107 
1108  if( !pFnd )
1109  {
1110  SwCalcFieldType* pNew = new SwCalcFieldType( sFieldName, &rType );
1111  pNew->pNext.reset( m_FieldTypeTable[n].release() );
1112  m_FieldTypeTable[n].reset(pNew);
1113  }
1114 }
1115 
1117 {
1118  OUString sFieldName;
1119  switch( rType.Which() )
1120  {
1121  case SwFieldIds::User :
1122  sFieldName = static_cast<const SwUserFieldType&>(rType).GetName();
1123  break;
1124  case SwFieldIds::SetExp:
1125  sFieldName = static_cast<const SwSetExpFieldType&>(rType).GetName();
1126  break;
1127  default: break;
1128  }
1129 
1130  if( sFieldName.isEmpty() )
1131  return;
1132 
1133  SetFieldsDirty( true );
1134  // look up and remove from the hash table
1135  sFieldName = GetAppCharClass().lowercase( sFieldName );
1136  sal_uInt16 n;
1137 
1138  SwCalcFieldType* pFnd = GetFieldTypeTable().Find( sFieldName, &n );
1139  if( !pFnd )
1140  return;
1141 
1142  if (m_FieldTypeTable[n].get() == pFnd)
1143  {
1144  m_FieldTypeTable[n].reset(static_cast<SwCalcFieldType*>(pFnd->pNext.release()));
1145  }
1146  else
1147  {
1148  SwHash* pPrev = m_FieldTypeTable[n].get();
1149  while( pPrev->pNext.get() != pFnd )
1150  pPrev = pPrev->pNext.get();
1151  pPrev->pNext = std::move(pFnd->pNext);
1152  // no need to explicitly delete here, the embedded linked list uses unique_ptr
1153  }
1154 }
1155 
1157  : m_FieldTypeTable(TBLSZ)
1158  , m_nNodes(0)
1159  , m_nFieldListGetMode(0)
1160  , m_rDoc(rDoc)
1161  , m_bInUpdateFields(false)
1162  , m_bFieldsDirty(false)
1163 {
1164 }
1165 
1167 {
1168 }
1169 
1170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:240
void SetValue(bool bHidden)
Definition: docufld.hxx:329
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:151
const ::utl::TransliterationWrapper & GetAppCmpStrIgnore()
Definition: init.cxx:791
Definition: calc.hxx:131
sal_uLong GetIndex() const
Definition: node.hxx:290
bool IsUsed(const sw::BroadcastingModify &) const
Definition: poolfmt.cxx:86
sal_Int32 nCommandType
Definition: swdbdata.hxx:32
sal_uLong Count() const
Definition: ndarr.hxx:142
The shared part of a user field.
Definition: usrfld.hxx:34
Marks a position in the document model.
Definition: pam.hxx:35
sal_Int32 m_nContent
Definition: docfld.hxx:56
const SwField * GetField() const
Definition: fmtfld.hxx:110
bool IsInDocBody() const
Definition: frame.hxx:924
static std::vector< OUString > & FindUsedDBs(const std::vector< OUString > &rAllDBNames, const OUString &rFormula, std::vector< OUString > &rUsedDBNames)
Definition: docfld.cxx:505
SetGetExpField(const SwNodeIndex &rNdIdx, const SwTextField *pField=nullptr, const SwIndex *pIdx=nullptr)
Definition: docfld.cxx:61
virtual const SwRootFrame * GetCurrentLayout() const =0
#define TBLSZ
Definition: calc.hxx:38
static const SwDBData & GetAddressDBName()
Definition: dbmgr.cxx:2506
SwNodeIndex nNode
Definition: pam.hxx:37
const int GETFLD_ALL
Definition: docfld.hxx:127
static OUString ReplaceUsedDBs(const std::vector< OUString > &rUsedDBNames, const OUString &rNewName, const OUString &rFormula)
Definition: docfld.cxx:681
SwDoc & GetDoc()
Which Doc contains the nodes-array?
Definition: ndarr.hxx:302
const SwTextNode * GetBodyTextNode(const SwDoc &rDoc, SwPosition &rPos, const SwFrame &rFrame)
Forward declaration: get "BodyTextNode" for exp.fld in Fly's headers/footers/footnotes.
Definition: expfld.cxx:163
void GetAllDBNames(std::vector< OUString > &rAllDBNames)
Definition: docfld.cxx:490
bool OpenDataSource(const OUString &rDataSource, const OUString &rTableOrQuery)
open the source while fields are updated - for the calculator only!
Definition: dbmgr.cxx:2286
virtual void SetModified()=0
Must be called manually at changes of format.
sal_uIntPtr sal_uLong
OUString sDataSource
Definition: swdbdata.hxx:30
const OUString & GetColumnName() const
Definition: dbfld.hxx:47
Base class of all fields.
Definition: fldbas.hxx:289
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1208
sal_Int64 n
Definition: doc.hxx:186
sal_Int16 nId
SwDocUpdateField(SwDoc &rDocument)
Definition: docfld.cxx:1156
SwNode & GetNode() const
Definition: ndindex.hxx:119
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
SwSectionFormat * GetFormat()
Definition: section.hxx:336
std::unique_ptr< SwHash > pNext
Definition: calc.hxx:136
SwNode & GetEndOfPostIts() const
A still empty section.
Definition: ndarr.hxx:152
OUString LookString(SwHashTable< HashStr > const &rTable, const OUString &rName)
Look up the Name, if it is present, return its String, otherwise return an empty String.
Definition: docfld.cxx:335
For old documents the Field-Which IDs must be preserved !!!
OUString const & GetCondition() const
Definition: section.hxx:198
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
Definition: fldbas.cxx:205
const SwNode * GetNodeFromContent() const
Definition: docfld.cxx:259
Array of Undo-history.
Definition: docary.hxx:197
const SwSection & GetSection() const
Definition: node.hxx:544
virtual OUString GetPar1() const
Definition: fldbas.cxx:314
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
SwDoc & m_rDoc
Definition: docbm.cxx:1205
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
SwIndex nContent
Definition: pam.hxx:38
virtual void SetPar2(const OUString &rStr)
Definition: fldbas.cxx:332
const SwTextField * GetTextField() const
Definition: fmtfld.hxx:128
SwSectionNode * GetSectionNode()
Definition: section.cxx:957
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
bool IsTextFrame() const
Definition: frame.hxx:1215
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
void SetInitDBFields(bool b)
Definition: docfld.cxx:390
sal_uLong m_nNode
Definition: docfld.hxx:46
const SwFormatField & GetFormatField() const
Definition: txatbase.hxx:191
const SwDBData & GetDBDesc()
Definition: docfld.cxx:349
const char * sName
void SetBodyPos(const SwContentFrame &rFrame)
Definition: docfld.cxx:176
void ExpandTextField(const bool bForceNotify=false) const
Definition: atrfld.cxx:449
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:47
SwDBData maDBData
Definition: doc.hxx:202
virtual SwFieldType * ChgTyp(SwFieldType *)
Set new type (used for copying among documents).
Definition: fldbas.cxx:381
virtual void SetPar1(const OUString &rStr)
Definition: fldbas.cxx:329
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
void GetBodyNode(const SwTextField &, SwFieldIds nFieldWhich)
Definition: docfld.cxx:991
void RemoveFieldType(const SwFieldType &rType)
Definition: docfld.cxx:1116
std::unique_ptr< SetGetExpFields > m_pFieldSortList
current field list for calculation
Definition: docfld.hxx:133
SwDBData const & GetDBData()
Definition: docfld.cxx:344
int i
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
SwDoc & GetDoc()
Definition: node.hxx:211
std::vector< SwSectionFormat * >::size_type size_type
Definition: docary.hxx:63
void SetCondHidden(bool const bFlag)
Definition: section.cxx:537
void ChgBodyTextFlag(bool bIsInBody)
Set by UpdateExpFields where node position is known.
Definition: expfld.hxx:139
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
void Evaluate(SwDoc &rDoc)
get current field value and cache it
Definition: docufld.cxx:1323
bool IsHidden() const
Definition: section.hxx:178
void GetAllUsedDB(std::vector< OUString > &rDBNameList, const std::vector< OUString > *pAllDBNames=nullptr)
Definition: docfld.cxx:411
SwContentNode * GetContentNode()
Definition: node.hxx:618
SwFieldIds
Definition: fldbas.hxx:44
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
Marks a character position inside a document model node.
Definition: index.hxx:33
size_t size() const
Definition: docary.hxx:84
sal_Int32 GetCntPosFromContent() const
Definition: docfld.cxx:303
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:696
T * Find(const OUString &rStr, sal_uInt16 *pPos=nullptr) const
Definition: calc.hxx:159
virtual const SwFieldTypes * GetFieldTypes() const =0
sal_uLong GetNode() const
Definition: docfld.hxx:92
OUString lowercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
#define DB_DELIM
Definition: swtypes.hxx:133
virtual sal_uInt16 GetSubType() const
Definition: fldbas.cxx:335
void RegisterToFieldType(SwFieldType &)
Definition: atrfld.cxx:170
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
SwFieldType * GetTyp() const
Definition: fldbas.hxx:392
sal_uLong m_nNodes
to check if the node count changed
Definition: docfld.hxx:136
bool operator<(const SetGetExpField &rField) const
Definition: docfld.cxx:201
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
const int GETFLD_EXPAND
Definition: docfld.hxx:129
#define INIT_FLDTYPES
Definition: swtypes.hxx:110
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
SwHashTable< SwCalcFieldType > const & GetFieldTypeTable() const
Definition: docfld.hxx:174
void MakeFieldList_(SwDoc &pDoc, int eGetMode)
Definition: docfld.cxx:804
std::vector< std::unique_ptr< SwDSParam > > SwDSParams_t
Definition: dbmgr.hxx:136
int m_nFieldListGetMode
Definition: docfld.hxx:137
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:445
OUString aSetStr
Definition: docfld.hxx:111
bool ChangeEntryContent(const SwAuthEntry *pNewEntry)
Definition: authfld.cxx:148
void SetFieldsDirty(bool b)
Definition: docfld.hxx:164
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
enum SetGetExpField::SetGetExpFieldType m_eSetGetExpFieldType
void ChangeDBFields(const std::vector< OUString > &rOldNames, const OUString &rNewName)
Definition: docfld.cxx:572
sal_Int32 GetIndex() const
Definition: index.hxx:91
void SetInitDBFields(bool b)
Definition: dbmgr.hxx:314
OString strip(const OString &rIn, char c)
SwNodes & GetNodes()
Definition: doc.hxx:407
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:392
static bool IsNameInArray(const std::vector< OUString > &rOldNames, const OUString &rName)
Definition: docfld.cxx:718
HashStr(const OUString &rName, const OUString &rText, HashStr *)
Definition: docfld.cxx:327
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:355
const SwStartNode * FindFlyStartNode() const
Definition: node.hxx:198
void AddUsedDBToList(std::vector< OUString > &rDBNameList, const std::vector< OUString > &rUsedDBNames)
Definition: docfld.cxx:535
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2320
const SwGetSetExpType GSE_STRING
String.
Definition: fldbas.hxx:202
bool IsFrameBehind(const SwTextNode &rMyNd, sal_Int32 nMySttPos, const SwTextNode &rBehindNd, sal_Int32 nSttPos)
Definition: reffld.cxx:99
void GetPosOfContent(SwPosition &rPos) const
Definition: docfld.cxx:158
const SwTextField * pTextField
Definition: docfld.hxx:48
void MakeFieldList(SwDoc &rDoc, bool bAll, int eGetMode)
Definition: docfld.cxx:794
void InsertFieldType(const SwFieldType &rType)
Definition: docfld.cxx:1083
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
virtual OUString GetFormula() const
Definition: fldbas.cxx:324
void ChgBodyTextFlag(bool bIsInBody)
set from UpdateExpFields (the Node-Position is known there)
Definition: dbfld.hxx:117
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:161
void ChangeAuthorityData(const SwAuthEntry *pNewData)
Definition: docfld.cxx:733
bool operator==(const SetGetExpField &rField) const
Definition: docfld.cxx:192
const SwDSParams_t & GetDSParamArray() const
Definition: dbmgr.hxx:366
SwSectionFormats & GetSections()
Definition: doc.hxx:1338
CharClass & GetAppCharClass()
Definition: init.cxx:708
bool IsTextNode() const
Definition: node.hxx:639
void SetHidden(bool bHidden)
Definition: docufld.hxx:372
void CreateDSData(const SwDBData &rData)
Definition: dbmgr.hxx:364
const int GETFLD_CALC
Definition: docfld.hxx:128
SwFieldIds Which() const
Definition: fldbas.hxx:272
OUString sCommand
Definition: swdbdata.hxx:31
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1284
SwHashTable< SwCalcFieldType > m_FieldTypeTable
Definition: docfld.hxx:134
T should be a subclass of SwHash.
Definition: calc.hxx:150
SwDBManager * GetDBManager() const
Definition: doc.hxx:668
sal_uInt16 nPos
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1319
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:846
void SetCondition(OUString const &rNew)
Definition: section.hxx:199
union SetGetExpField::@4 m_CNTNT
void InsDelFieldInFieldLst(bool bIns, const SwTextField &rField)
Definition: docfld.cxx:750
Base class of the Writer document model elements.
Definition: node.hxx:79
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo