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 #if HAVE_FEATURE_DBCONNECTIVITY
347  if(maDBData.sDataSource.isEmpty())
348  {
349  // Similar to: SwEditShell::IsAnyDatabaseFieldInDoc
350  for (const auto& pFieldType : *getIDocumentFieldsAccess().GetFieldTypes())
351  {
352  if (IsUsed(*pFieldType))
353  {
354  SwFieldIds nWhich = pFieldType->Which();
355  switch(nWhich)
356  {
361  {
362  std::vector<SwFormatField*> vFields;
363  pFieldType->GatherFields(vFields);
364  if(vFields.size())
365  {
366  if(SwFieldIds::Database == nWhich)
367  maDBData = static_cast<SwDBFieldType*>(vFields.front()->GetField()->GetTyp())->GetDBData();
368  else
369  maDBData = static_cast<SwDBNameInfField*> (vFields.front()->GetField())->GetRealDBData();
370  }
371  }
372  break;
373  default: break;
374  }
375  }
376  }
377  }
378  if(maDBData.sDataSource.isEmpty())
380 #endif
381  return maDBData;
382 }
383 
385 {
386 #if !HAVE_FEATURE_DBCONNECTIVITY
387  (void) b;
388 #else
390 #endif
391 }
392 
393 #if HAVE_FEATURE_DBCONNECTIVITY
394 
396 static OUString lcl_DBDataToString(const SwDBData& rData)
397 {
398  return rData.sDataSource + OUStringChar(DB_DELIM)
399  + rData.sCommand + OUStringChar(DB_DELIM)
400  + OUString::number(rData.nCommandType);
401 }
402 
403 #endif
404 
405 void SwDoc::GetAllUsedDB( std::vector<OUString>& rDBNameList,
406  const std::vector<OUString>* pAllDBNames )
407 {
408 #if !HAVE_FEATURE_DBCONNECTIVITY
409  (void) rDBNameList;
410  (void) pAllDBNames;
411 #else
412  std::vector<OUString> aUsedDBNames;
413  std::vector<OUString> aAllDBNames;
414 
415  if( !pAllDBNames )
416  {
417  GetAllDBNames( aAllDBNames );
418  pAllDBNames = &aAllDBNames;
419  }
420 
421  SwSectionFormats& rArr = GetSections();
422  for (auto n = rArr.size(); n; )
423  {
424  SwSection* pSect = rArr[ --n ]->GetSection();
425 
426  if( pSect )
427  {
428  AddUsedDBToList( rDBNameList, FindUsedDBs( *pAllDBNames,
429  pSect->GetCondition(), aUsedDBNames ) );
430  aUsedDBNames.clear();
431  }
432  }
433 
434  for (sal_uInt16 const nWhichHint : { RES_TXTATR_FIELD, RES_TXTATR_INPUTFIELD })
435  {
436  for (const SfxPoolItem* pItem : GetAttrPool().GetItemSurrogates(nWhichHint))
437  {
438  const SwFormatField* pFormatField = static_cast<const SwFormatField*>(pItem);
439  const SwTextField* pTextField = pFormatField->GetTextField();
440  if (!pTextField || !pTextField->GetTextNode().GetNodes().IsDocNodes())
441  continue;
442 
443  const SwField* pField = pFormatField->GetField();
444  switch (pField->GetTyp()->Which())
445  {
447  AddUsedDBToList( rDBNameList,
448  lcl_DBDataToString(static_cast<const SwDBField*>(pField)->GetDBData() ));
449  break;
450 
453  AddUsedDBToList( rDBNameList,
454  lcl_DBDataToString(static_cast<const SwDBNameInfField*>(pField)->GetRealDBData() ));
455  break;
456 
459  AddUsedDBToList( rDBNameList,
460  lcl_DBDataToString(static_cast<const SwDBNameInfField*>(pField)->GetRealDBData() ));
461  [[fallthrough]]; // JP: is that right like that?
462 
465  AddUsedDBToList(rDBNameList, FindUsedDBs( *pAllDBNames,
466  pField->GetPar1(), aUsedDBNames ));
467  aUsedDBNames.clear();
468  break;
469 
470  case SwFieldIds::SetExp:
471  case SwFieldIds::GetExp:
472  case SwFieldIds::Table:
473  AddUsedDBToList(rDBNameList, FindUsedDBs( *pAllDBNames,
474  pField->GetFormula(), aUsedDBNames ));
475  aUsedDBNames.clear();
476  break;
477  default: break;
478  }
479  }
480  }
481 #endif
482 }
483 
484 void SwDoc::GetAllDBNames( std::vector<OUString>& rAllDBNames )
485 {
486 #if !HAVE_FEATURE_DBCONNECTIVITY
487  (void) rAllDBNames;
488 #else
489  SwDBManager* pMgr = GetDBManager();
490 
491  const SwDSParams_t& rArr = pMgr->GetDSParamArray();
492  for (const auto& pParam : rArr)
493  {
494  rAllDBNames.emplace_back(pParam->sDataSource + OUStringChar(DB_DELIM) + pParam->sCommand);
495  }
496 #endif
497 }
498 
499 std::vector<OUString>& SwDoc::FindUsedDBs( const std::vector<OUString>& rAllDBNames,
500  const OUString& rFormula,
501  std::vector<OUString>& rUsedDBNames )
502 {
503  const CharClass& rCC = GetAppCharClass();
504 #ifndef UNX
505  const OUString sFormula(rCC.uppercase( rFormula ));
506 #else
507  const OUString sFormula(rFormula);
508 #endif
509 
510  for (const auto &sItem : rAllDBNames)
511  {
512  sal_Int32 nPos = sFormula.indexOf( sItem );
513  if( nPos>=0 &&
514  sFormula[ nPos + sItem.getLength() ] == '.' &&
515  (!nPos || !rCC.isLetterNumeric( sFormula, nPos - 1 )))
516  {
517  // Look up table name
518  nPos += sItem.getLength() + 1;
519  const sal_Int32 nEndPos = sFormula.indexOf('.', nPos);
520  if( nEndPos>=0 )
521  {
522  rUsedDBNames.emplace_back(sItem + OUStringChar(DB_DELIM) + sFormula.subView( nPos, nEndPos - nPos ));
523  }
524  }
525  }
526  return rUsedDBNames;
527 }
528 
529 void SwDoc::AddUsedDBToList( std::vector<OUString>& rDBNameList,
530  const std::vector<OUString>& rUsedDBNames )
531 {
532  for ( const auto &sName : rUsedDBNames )
533  AddUsedDBToList( rDBNameList, sName );
534 }
535 
536 void SwDoc::AddUsedDBToList( std::vector<OUString>& rDBNameList, const OUString& rDBName)
537 {
538 #if !HAVE_FEATURE_DBCONNECTIVITY
539  (void) rDBNameList;
540  (void) rDBName;
541 #else
542  if( rDBName.isEmpty() )
543  return;
544 
545 #ifdef UNX
546  for( const auto &sName : rDBNameList )
547  if( rDBName == sName.getToken(0, ';') )
548  return;
549 #else
550  const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
551  for( const auto &sName : rDBNameList )
552  if( rSCmp.isEqual( rDBName, sName.getToken(0, ';') ) )
553  return;
554 #endif
555 
556  SwDBData aData;
557  sal_Int32 nIdx{ 0 };
558  aData.sDataSource = rDBName.getToken(0, DB_DELIM, nIdx);
559  aData.sCommand = rDBName.getToken(0, DB_DELIM, nIdx);
560  aData.nCommandType = -1;
561  GetDBManager()->CreateDSData(aData);
562  rDBNameList.push_back(rDBName);
563 #endif
564 }
565 
566 void SwDoc::ChangeDBFields( const std::vector<OUString>& rOldNames,
567  const OUString& rNewName )
568 {
569 #if !HAVE_FEATURE_DBCONNECTIVITY
570  (void) rOldNames;
571  (void) rNewName;
572 #else
573  SwDBData aNewDBData;
574  sal_Int32 nIdx{ 0 };
575  aNewDBData.sDataSource = rNewName.getToken(0, DB_DELIM, nIdx);
576  aNewDBData.sCommand = rNewName.getToken(0, DB_DELIM, nIdx);
577  aNewDBData.nCommandType = static_cast<short>(rNewName.getToken(0, DB_DELIM, nIdx).toInt32());
578 
579  SwSectionFormats& rArr = GetSections();
580  for (auto n = rArr.size(); n; )
581  {
582  SwSection* pSect = rArr[ --n ]->GetSection();
583 
584  if( pSect )
585  {
586  pSect->SetCondition(ReplaceUsedDBs(rOldNames, rNewName, pSect->GetCondition()));
587  }
588  }
589 
590  for (sal_uInt16 const nWhichHint : { RES_TXTATR_FIELD, RES_TXTATR_INPUTFIELD })
591  {
592  for (const SfxPoolItem* pItem : GetAttrPool().GetItemSurrogates(nWhichHint))
593  {
594  SwFormatField* pFormatField = const_cast<SwFormatField*>(static_cast<const SwFormatField*>(pItem));
595  SwTextField* pTextField = pFormatField->GetTextField();
596  if (!pTextField || !pTextField->GetTextNode().GetNodes().IsDocNodes())
597  continue;
598 
599  SwField* pField = pFormatField->GetField();
600  bool bExpand = false;
601 
602  switch( pField->GetTyp()->Which() )
603  {
605 #if HAVE_FEATURE_DBCONNECTIVITY
606  if (IsNameInArray(rOldNames, lcl_DBDataToString(static_cast<SwDBField*>(pField)->GetDBData())))
607  {
608  SwDBFieldType* pOldTyp = static_cast<SwDBFieldType*>(pField->GetTyp());
609 
611  SwDBFieldType(this, pOldTyp->GetColumnName(), aNewDBData)));
612 
613  pFormatField->RegisterToFieldType( *pTyp );
614  pField->ChgTyp(pTyp);
615 
616  static_cast<SwDBField*>(pField)->ClearInitialized();
617  static_cast<SwDBField*>(pField)->InitContent();
618 
619  bExpand = true;
620  }
621 #endif
622  break;
623 
626  if (IsNameInArray(rOldNames,
627  lcl_DBDataToString(static_cast<SwDBNameInfField*>(pField)->GetRealDBData())))
628  {
629  static_cast<SwDBNameInfField*>(pField)->SetDBData(aNewDBData);
630  bExpand = true;
631  }
632  break;
633 
636  if (IsNameInArray(rOldNames,
637  lcl_DBDataToString(static_cast<SwDBNameInfField*>(pField)->GetRealDBData())))
638  {
639  static_cast<SwDBNameInfField*>(pField)->SetDBData(aNewDBData);
640  }
641  [[fallthrough]];
644  pField->SetPar1( ReplaceUsedDBs(rOldNames, rNewName, pField->GetPar1()) );
645  bExpand = true;
646  break;
647 
648  case SwFieldIds::SetExp:
649  case SwFieldIds::GetExp:
650  case SwFieldIds::Table:
651  pField->SetPar2( ReplaceUsedDBs(rOldNames, rNewName, pField->GetFormula()) );
652  bExpand = true;
653  break;
654  default: break;
655  }
656 
657  if (bExpand)
658  pTextField->ExpandTextField( true );
659  }
660  }
662 #endif
663 }
664 
665 namespace
666 {
667 
668 OUString lcl_CutOffDBCommandType(const OUString& rName)
669 {
670  return rName.replaceFirst(OUStringChar(DB_DELIM), ".").getToken(0, DB_DELIM);
671 }
672 
673 }
674 
675 OUString SwDoc::ReplaceUsedDBs( const std::vector<OUString>& rUsedDBNames,
676  const OUString& rNewName, const OUString& rFormula )
677 {
678  const CharClass& rCC = GetAppCharClass();
679  const OUString sNewName( lcl_CutOffDBCommandType(rNewName) );
680  OUString sFormula(rFormula);
681 
682  for(const auto & rUsedDBName : rUsedDBNames)
683  {
684  const OUString sDBName( lcl_CutOffDBCommandType(rUsedDBName) );
685 
686  if (sDBName!=sNewName)
687  {
688  sal_Int32 nPos = 0;
689  for (;;)
690  {
691  nPos = sFormula.indexOf(sDBName, nPos);
692  if (nPos<0)
693  {
694  break;
695  }
696 
697  if( sFormula[nPos + sDBName.getLength()] == '.' &&
698  (!nPos || !rCC.isLetterNumeric( sFormula, nPos - 1 )))
699  {
700  sFormula = sFormula.replaceAt(nPos, sDBName.getLength(), sNewName);
701  //prevent re-searching - this is useless and provokes
702  //endless loops when names containing each other and numbers are exchanged
703  //e.g.: old ?12345.12345 new: i12345.12345
704  nPos += sNewName.getLength();
705  }
706  }
707  }
708  }
709  return sFormula;
710 }
711 
712 bool SwDoc::IsNameInArray( const std::vector<OUString>& rArr, const OUString& rName )
713 {
714 #ifdef UNX
715  for( const auto &sName : rArr )
716  if( rName == sName )
717  return true;
718 #else
719  const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
720  for( const auto &sName : rArr )
721  if( rSCmp.isEqual( rName, sName ))
722  return true;
723 #endif
724  return false;
725 }
726 
728 {
729  const SwFieldTypes::size_type nSize = getIDocumentFieldsAccess().GetFieldTypes()->size();
730 
731  for( SwFieldTypes::size_type i = INIT_FLDTYPES; i < nSize; ++i )
732  {
733  SwFieldType* pFieldType = (*getIDocumentFieldsAccess().GetFieldTypes())[i].get();
734  if( SwFieldIds::TableOfAuthorities == pFieldType->Which() )
735  {
736  SwAuthorityFieldType* pAuthType = static_cast<SwAuthorityFieldType*>(pFieldType);
737  pAuthType->ChangeEntryContent(pNewData);
738  break;
739  }
740  }
741 
742 }
743 
744 void SwDocUpdateField::InsDelFieldInFieldLst( bool bIns, const SwTextField& rField )
745 {
746  const SwFieldIds nWhich = rField.GetFormatField().GetField()->GetTyp()->Which();
747  switch( nWhich )
748  {
750  case SwFieldIds::SetExp:
756  case SwFieldIds::GetExp:
757  break; // these have to be added/removed!
758 
759  default:
760  return;
761  }
762 
763  SetFieldsDirty( true );
764  if (!m_pFieldSortList)
765  {
766  if( !bIns ) // if list is present and deleted
767  return; // don't do a thing
769  }
770 
771  if( bIns ) // insert anew:
772  GetBodyNode( rField, nWhich );
773  else
774  {
775  // look up via the pTextField pointer. It is a sorted list, but it's sorted by node
776  // position. Until this is found, the search for the pointer is already done.
777  for (SetGetExpFields::size_type n = 0; n < m_pFieldSortList->size(); ++n)
778  {
779  if (&rField == (*m_pFieldSortList)[n]->GetPointer())
780  {
781  m_pFieldSortList->erase_at(n);
782  n--; // one field can occur multiple times
783  }
784  }
785  }
786 }
787 
788 void SwDocUpdateField::MakeFieldList( SwDoc& rDoc, bool bAll, int eGetMode )
789 {
790  if (!m_pFieldSortList || bAll
791  || ((eGetMode & m_nFieldListGetMode) != eGetMode)
792  || rDoc.GetNodes().Count() != m_nNodes)
793  {
794  MakeFieldList_( rDoc, eGetMode );
795  }
796 }
797 
798 void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode )
799 {
800  // new version: walk all fields of the attribute pool
802 
803  // consider and unhide sections
804  // with hide condition, only in mode GETFLD_ALL (<eGetMode == GETFLD_ALL>)
805  // notes by OD:
806  // eGetMode == GETFLD_CALC in call from methods SwDoc::FieldsToCalc
807  // eGetMode == GETFLD_EXPAND in call from method SwDoc::FieldsToExpand
808  // eGetMode == GETFLD_ALL in call from method SwDoc::UpdateExpFields
809  // I figured out that hidden section only have to be shown,
810  // if fields have updated (call by SwDoc::UpdateExpFields) and thus
811  // the hide conditions of section have to be updated.
812  // For correct updating the hide condition of a section, its position
813  // have to be known in order to insert the hide condition as a new
814  // expression field into the sorted field list (<m_pFieldSortList>).
815  if ( eGetMode == GETFLD_ALL )
816  // Collect the sections first. Supply sections that are hidden by condition
817  // with frames so that the contained fields are sorted properly.
818  {
819  // In order for the frames to be created the right way, they have to be expanded
820  // from top to bottom
821  std::vector<sal_uLong> aTmpArr;
822  std::vector<sal_uLong>::size_type nArrStt = 0;
823  SwSectionFormats& rArr = rDoc.GetSections();
824  SwSectionNode* pSectNd = nullptr;
825  sal_uLong nSttContent = rDoc.GetNodes().GetEndOfExtras().GetIndex();
826 
827  for (SwSectionFormats::size_type n = rArr.size(); n; )
828  {
829  SwSection* pSect = rArr[ --n ]->GetSection();
830  if( !pSect || !pSect->IsHidden() || pSect->GetCondition().isEmpty() )
831  continue;
832  pSectNd = pSect->GetFormat()->GetSectionNode();
833  if( pSectNd )
834  {
835  sal_uLong nIdx = pSectNd->GetIndex();
836  aTmpArr.push_back( nIdx );
837  if( nIdx < nSttContent )
838  ++nArrStt;
839  }
840  }
841  std::sort(aTmpArr.begin(), aTmpArr.end());
842 
843  // Display all first so that we have frames. The BodyAnchor is defined by that.
844  // First the ContentArea, then the special areas!
845  for (std::vector<sal_uLong>::size_type n = nArrStt; n < aTmpArr.size(); ++n)
846  {
847  pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode();
848  OSL_ENSURE( pSectNd, "Where is my SectionNode" );
849  pSectNd->GetSection().SetCondHidden( false );
850  }
851  for (std::vector<sal_uLong>::size_type n = 0; n < nArrStt; ++n)
852  {
853  pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode();
854  OSL_ENSURE( pSectNd, "Where is my SectionNode" );
855  pSectNd->GetSection().SetCondHidden( false );
856  }
857 
858  // add all to the list so that they are sorted
859  for (const auto &nId : aTmpArr)
860  {
861  GetBodyNode( *rDoc.GetNodes()[ nId ]->GetSectionNode() );
862  }
863  }
864 
865  static const OUStringLiteral sTrue(u"TRUE");
866  static const OUStringLiteral sFalse(u"FALSE");
867 
868 #if HAVE_FEATURE_DBCONNECTIVITY
869  bool bIsDBManager = nullptr != rDoc.GetDBManager();
870 #endif
871 
872  for (sal_uInt16 const nWhichHint : { RES_TXTATR_FIELD, RES_TXTATR_INPUTFIELD })
873  {
874  for (const SfxPoolItem* pItem : rDoc.GetAttrPool().GetItemSurrogates(nWhichHint))
875  {
876  const SwFormatField* pFormatField = static_cast<const SwFormatField*>(pItem);
877  const SwTextField* pTextField = pFormatField->GetTextField();
878  if (!pTextField || !pTextField->GetTextNode().GetNodes().IsDocNodes())
879  continue;
880 
881  OUString sFormula;
882  const SwField* pField = pFormatField->GetField();
883  const SwFieldIds nWhich = pField->GetTyp()->Which();
884  switch (nWhich)
885  {
887  case SwFieldIds::GetExp:
888  if (GETFLD_ALL == eGetMode)
889  sFormula = sTrue;
890  break;
891 
893  if (GETFLD_EXPAND & eGetMode)
894  sFormula = sTrue;
895  break;
896 
897  case SwFieldIds::SetExp:
898  if ((eGetMode != GETFLD_EXPAND) ||
900  {
901  sFormula = sTrue;
902  }
903  break;
904 
906  if (GETFLD_ALL == eGetMode)
907  {
908  sFormula = pField->GetPar1();
909  if (sFormula.isEmpty() || sFormula==sFalse)
910  const_cast<SwHiddenParaField*>(static_cast<const SwHiddenParaField*>(pField))->SetHidden( false );
911  else if (sFormula==sTrue)
912  const_cast<SwHiddenParaField*>(static_cast<const SwHiddenParaField*>(pField))->SetHidden( true );
913  else
914  break;
915 
916  sFormula.clear();
917  // trigger formatting
918  const_cast<SwFormatField*>(pFormatField)->UpdateTextNode( nullptr, nullptr );
919  }
920  break;
921 
923  if (GETFLD_ALL == eGetMode)
924  {
925  sFormula = pField->GetPar1();
926  if (sFormula.isEmpty() || sFormula==sFalse)
927  const_cast<SwHiddenTextField*>(static_cast<const SwHiddenTextField*>(pField))->SetValue( true );
928  else if (sFormula==sTrue)
929  const_cast<SwHiddenTextField*>(static_cast<const SwHiddenTextField*>(pField))->SetValue( false );
930  else
931  break;
932 
933  sFormula.clear();
934 
935  // evaluate field
936  const_cast<SwHiddenTextField*>(static_cast<const SwHiddenTextField*>(pField))->Evaluate(rDoc);
937  // trigger formatting
938  const_cast<SwFormatField*>(pFormatField)->UpdateTextNode(nullptr, nullptr);
939  }
940  break;
941 
942 #if HAVE_FEATURE_DBCONNECTIVITY
944  {
945  SwDBData aDBData(const_cast<SwDBNumSetField*>(static_cast<const SwDBNumSetField*>(pField))->GetDBData(&rDoc));
946 
947  if ( (bIsDBManager && rDoc.GetDBManager()->OpenDataSource(aDBData.sDataSource, aDBData.sCommand))
948  && (GETFLD_ALL == eGetMode
949  || (GETFLD_CALC & eGetMode
950  && static_cast<const SwDBNumSetField*>(pField)->IsCondValid()))
951  )
952  {
953  sFormula = pField->GetPar1();
954  }
955  }
956  break;
958  {
959  SwDBData aDBData(const_cast<SwDBNextSetField*>(static_cast<const SwDBNextSetField*>(pField))->GetDBData(&rDoc));
960 
961  if ( (bIsDBManager && rDoc.GetDBManager()->OpenDataSource(aDBData.sDataSource, aDBData.sCommand))
962  && (GETFLD_ALL == eGetMode
963  || (GETFLD_CALC & eGetMode
964  && static_cast<const SwDBNextSetField*>(pField)->IsCondValid()))
965  )
966  {
967  sFormula = pField->GetPar1();
968  }
969  }
970  break;
971 #endif
972  default: break;
973  }
974 
975  if (!sFormula.isEmpty())
976  {
977  GetBodyNode( *pTextField, nWhich );
978  }
979  }
980  }
981  m_nFieldListGetMode = eGetMode;
982  m_nNodes = rDoc.GetNodes().Count();
983 }
984 
985 void SwDocUpdateField::GetBodyNode( const SwTextField& rTField, SwFieldIds nFieldWhich )
986 {
987  const SwTextNode& rTextNd = rTField.GetTextNode();
988  const SwDoc& rDoc = rTextNd.GetDoc();
989 
990  // always the first! (in tab headline, header-/footer)
991  Point aPt;
992  std::pair<Point, bool> const tmp(aPt, false);
993  const SwContentFrame* pFrame = rTextNd.getLayoutFrame(
994  rDoc.getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp);
995 
996  std::unique_ptr<SetGetExpField> pNew;
997  bool bIsInBody = false;
998 
999  if( !pFrame || pFrame->IsInDocBody() )
1000  {
1001  // create index to determine the TextNode
1002  SwNodeIndex aIdx( rTextNd );
1003  bIsInBody = rDoc.GetNodes().GetEndOfExtras().GetIndex() < aIdx.GetIndex();
1004 
1005  // We don't want to update fields in redlines, or those
1006  // in frames whose anchor is in redline. However, we do want to update
1007  // fields in hidden sections. So: In order to be updated, a field 1)
1008  // must have a frame, or 2) it must be in the document body.
1009  if( (pFrame != nullptr) || bIsInBody )
1010  pNew.reset(new SetGetExpField( aIdx, &rTField ));
1011  }
1012  else
1013  {
1014  // create index to determine the TextNode
1015  SwPosition aPos( rDoc.GetNodes().GetEndOfPostIts() );
1016  bool const bResult = GetBodyTextNode( rDoc, aPos, *pFrame );
1017  OSL_ENSURE(bResult, "where is the Field");
1018  pNew.reset(new SetGetExpField( aPos.nNode, &rTField, &aPos.nContent ));
1019  }
1020 
1021  // always set the BodyTextFlag in GetExp or DB fields
1022  if( SwFieldIds::GetExp == nFieldWhich )
1023  {
1024  SwGetExpField* pGetField = const_cast<SwGetExpField*>(static_cast<const SwGetExpField*>(rTField.GetFormatField().GetField()));
1025  pGetField->ChgBodyTextFlag( bIsInBody );
1026  }
1027 #if HAVE_FEATURE_DBCONNECTIVITY
1028  else if( SwFieldIds::Database == nFieldWhich )
1029  {
1030  SwDBField* pDBField = const_cast<SwDBField*>(static_cast<const SwDBField*>(rTField.GetFormatField().GetField()));
1031  pDBField->ChgBodyTextFlag( bIsInBody );
1032  }
1033 #endif
1034  if( pNew != nullptr )
1035  m_pFieldSortList->insert( std::move(pNew) );
1036 }
1037 
1039 {
1040  const SwDoc& rDoc = rSectNd.GetDoc();
1041  std::unique_ptr<SetGetExpField> pNew;
1042 
1043  if( rSectNd.GetIndex() < rDoc.GetNodes().GetEndOfExtras().GetIndex() )
1044  {
1045  do { // middle check loop
1046 
1047  // we need to get the anchor first
1048  // create index to determine the TextNode
1049  SwPosition aPos( rSectNd );
1050  SwContentNode* pCNd = rDoc.GetNodes().GoNext( &aPos.nNode ); // to the next ContentNode
1051 
1052  if( !pCNd || !pCNd->IsTextNode() )
1053  break;
1054 
1055  // always the first! (in tab headline, header-/footer)
1056  Point aPt;
1057  std::pair<Point, bool> const tmp(aPt, false);
1058  const SwContentFrame* pFrame = pCNd->getLayoutFrame(
1060  nullptr, &tmp);
1061  if( !pFrame )
1062  break;
1063 
1064  bool const bResult = GetBodyTextNode( rDoc, aPos, *pFrame );
1065  OSL_ENSURE(bResult, "where is the Field");
1066  pNew.reset(new SetGetExpField( rSectNd, &aPos ));
1067 
1068  } while( false );
1069  }
1070 
1071  if( !pNew )
1072  pNew.reset(new SetGetExpField( rSectNd ));
1073 
1074  m_pFieldSortList->insert( std::move(pNew) );
1075 }
1076 
1078 {
1079  OUString sFieldName;
1080  switch( rType.Which() )
1081  {
1082  case SwFieldIds::User :
1083  sFieldName = static_cast<const SwUserFieldType&>(rType).GetName();
1084  break;
1085  case SwFieldIds::SetExp:
1086  sFieldName = static_cast<const SwSetExpFieldType&>(rType).GetName();
1087  break;
1088  default:
1089  OSL_ENSURE( false, "No valid field type" );
1090  }
1091 
1092  if( sFieldName.isEmpty() )
1093  return;
1094 
1095  SetFieldsDirty( true );
1096  // look up and remove from the hash table
1097  sFieldName = GetAppCharClass().lowercase( sFieldName );
1098  sal_uInt16 n;
1099 
1100  SwCalcFieldType* pFnd = GetFieldTypeTable().Find( sFieldName, &n );
1101 
1102  if( !pFnd )
1103  {
1104  SwCalcFieldType* pNew = new SwCalcFieldType( sFieldName, &rType );
1105  pNew->pNext.reset( m_FieldTypeTable[n].release() );
1106  m_FieldTypeTable[n].reset(pNew);
1107  }
1108 }
1109 
1111 {
1112  OUString sFieldName;
1113  switch( rType.Which() )
1114  {
1115  case SwFieldIds::User :
1116  sFieldName = static_cast<const SwUserFieldType&>(rType).GetName();
1117  break;
1118  case SwFieldIds::SetExp:
1119  sFieldName = static_cast<const SwSetExpFieldType&>(rType).GetName();
1120  break;
1121  default: break;
1122  }
1123 
1124  if( sFieldName.isEmpty() )
1125  return;
1126 
1127  SetFieldsDirty( true );
1128  // look up and remove from the hash table
1129  sFieldName = GetAppCharClass().lowercase( sFieldName );
1130  sal_uInt16 n;
1131 
1132  SwCalcFieldType* pFnd = GetFieldTypeTable().Find( sFieldName, &n );
1133  if( !pFnd )
1134  return;
1135 
1136  if (m_FieldTypeTable[n].get() == pFnd)
1137  {
1138  m_FieldTypeTable[n].reset(static_cast<SwCalcFieldType*>(pFnd->pNext.release()));
1139  }
1140  else
1141  {
1142  SwHash* pPrev = m_FieldTypeTable[n].get();
1143  while( pPrev->pNext.get() != pFnd )
1144  pPrev = pPrev->pNext.get();
1145  pPrev->pNext = std::move(pFnd->pNext);
1146  // no need to explicitly delete here, the embedded linked list uses unique_ptr
1147  }
1148 }
1149 
1151  : m_FieldTypeTable(TBLSZ)
1152  , m_nNodes(0)
1153  , m_nFieldListGetMode(0)
1154  , m_rDoc(rDoc)
1155  , m_bInUpdateFields(false)
1156  , m_bFieldsDirty(false)
1157 {
1158 }
1159 
1161 {
1162 }
1163 
1164 /* 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:157
const ::utl::TransliterationWrapper & GetAppCmpStrIgnore()
Definition: init.cxx:795
Definition: calc.hxx:131
sal_uLong GetIndex() const
Definition: node.hxx:291
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:499
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:2505
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:675
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:484
bool OpenDataSource(const OUString &rDataSource, const OUString &rTableOrQuery)
open the source while fields are updated - for the calculator only!
Definition: dbmgr.cxx:2285
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:1212
sal_Int64 n
Definition: doc.hxx:187
sal_Int16 nId
SwDocUpdateField(SwDoc &rDocument)
Definition: docfld.cxx:1150
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
const SwNode * GetNodeFromContent() const
Definition: docfld.cxx:259
Array of Undo-history.
Definition: docary.hxx:197
const SwSection & GetSection() const
Definition: node.hxx:545
virtual OUString GetPar1() const
Definition: fldbas.cxx:314
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
SwDoc & m_rDoc
Definition: docbm.cxx:1208
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:86
void SetInitDBFields(bool b)
Definition: docfld.cxx:384
sal_uLong m_nNode
Definition: docfld.hxx:46
const SwFormatField & GetFormatField() const
Definition: txatbase.hxx:195
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:203
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:985
void RemoveFieldType(const SwFieldType &rType)
Definition: docfld.cxx:1110
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:132
SwDoc & GetDoc()
Definition: node.hxx:212
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:405
SwContentNode * GetContentNode()
Definition: node.hxx:619
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
float u
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:697
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:135
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:79
SwHashTable< SwCalcFieldType > const & GetFieldTypeTable() const
Definition: docfld.hxx:174
void MakeFieldList_(SwDoc &pDoc, int eGetMode)
Definition: docfld.cxx:798
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:152
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:566
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:408
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:712
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:357
const SwStartNode * FindFlyStartNode() const
Definition: node.hxx:199
void AddUsedDBToList(std::vector< OUString > &rDBNameList, const std::vector< OUString > &rUsedDBNames)
Definition: docfld.cxx:529
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2329
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:788
void InsertFieldType(const SwFieldType &rType)
Definition: docfld.cxx:1077
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:727
bool operator==(const SetGetExpField &rField) const
Definition: docfld.cxx:192
const SwDSParams_t & GetDSParamArray() const
Definition: dbmgr.hxx:366
SwSectionFormats & GetSections()
Definition: doc.hxx:1339
CharClass & GetAppCharClass()
Definition: init.cxx:712
bool IsTextNode() const
Definition: node.hxx:640
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:1293
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:669
sal_uInt16 nPos
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1320
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:845
void SetCondition(OUString const &rNew)
Definition: section.hxx:199
union SetGetExpField::@4 m_CNTNT
void InsDelFieldInFieldLst(bool bIns, const SwTextField &rField)
Definition: docfld.cxx:744
Base class of the Writer document model elements.
Definition: node.hxx:80
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo