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