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