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