LibreOffice Module sw (master)  1
authfld.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 <memory>
21 #include <hintids.hxx>
22 #include <comphelper/string.hxx>
23 #include <editeng/unolingu.hxx>
24 #include <editeng/langitem.hxx>
26 #include <o3tl/any.hxx>
27 #include <swtypes.hxx>
28 #include <strings.hrc>
29 #include <authfld.hxx>
30 #include <expfld.hxx>
31 #include <pam.hxx>
32 #include <cntfrm.hxx>
33 #include <rootfrm.hxx>
34 #include <tox.hxx>
35 #include <txmsrt.hxx>
36 #include <doctxm.hxx>
37 #include <fmtfld.hxx>
38 #include <txtfld.hxx>
39 #include <ndtxt.hxx>
40 #include <doc.hxx>
43 #include <unofldmid.h>
44 #include <unoprnms.hxx>
45 #include <calbck.hxx>
46 #include <unomid.h>
47 
48 #include <com/sun/star/beans/PropertyValues.hpp>
49 
50 using namespace ::com::sun::star::uno;
51 using namespace ::com::sun::star::beans;
52 using namespace ::com::sun::star::lang;
53 
55  : SimpleReferenceObject()
56 {
57  for(int i = 0; i < AUTH_FIELD_END; ++i)
58  aAuthFields[i] = rCopy.aAuthFields[i];
59 }
60 
62 {
63  for(int i = 0; i < AUTH_FIELD_END; ++i)
64  if(aAuthFields[i] != rComp.aAuthFields[i])
65  return false;
66  return true;
67 }
68 
71  m_pDoc(pDoc),
72  m_cPrefix('['),
73  m_cSuffix(']'),
74  m_bIsSequence(false),
75  m_bSortByDocument(true),
76  m_eLanguage(::GetAppLanguage())
77 {
78 }
79 
81 {
82 }
83 
84 std::unique_ptr<SwFieldType> SwAuthorityFieldType::Copy() const
85 {
86  return std::make_unique<SwAuthorityFieldType>(m_pDoc);
87 }
88 
90 {
91  for(SwAuthDataArr::size_type j = 0; j < m_DataArr.size(); ++j)
92  {
93  if(m_DataArr[j].get() == nHandle)
94  {
95  m_DataArr.erase(m_DataArr.begin() + j);
96  //re-generate positions of the fields
98  return;
99  }
100  }
101  OSL_FAIL("Field unknown" );
102 }
103 
104 SwAuthEntry* SwAuthorityFieldType::AddField(const OUString& rFieldContents)
105 {
107  sal_Int32 nIdx{ 0 };
108  for( sal_Int32 i = 0; i < AUTH_FIELD_END; ++i )
109  pEntry->SetAuthorField( static_cast<ToxAuthorityField>(i),
110  rFieldContents.getToken( 0, TOX_STYLE_DELIMITER, nIdx ));
111 
112  for (auto &rpTemp : m_DataArr)
113  {
114  if (*rpTemp == *pEntry)
115  {
116  return rpTemp.get();
117  }
118  }
119 
120  //if it is a new Entry - insert
121  m_DataArr.push_back(std::move(pEntry));
122  //re-generate positions of the fields
124  return m_DataArr.back().get();
125 }
126 
128  std::vector<OUString>& rToFill )const
129 {
130  for (const auto & rpTemp : m_DataArr)
131  {
132  rToFill.push_back(rpTemp->GetAuthorField(AUTH_FIELD_IDENTIFIER));
133  }
134 }
135 
137  const OUString& rIdentifier)const
138 {
139  for (const auto &rpTemp : m_DataArr)
140  {
141  if (rIdentifier == rpTemp->GetAuthorField(AUTH_FIELD_IDENTIFIER))
142  {
143  return rpTemp.get();
144  }
145  }
146  return nullptr;
147 }
148 
150 {
151  for (auto &rpTemp : m_DataArr)
152  {
153  if (rpTemp->GetAuthorField(AUTH_FIELD_IDENTIFIER) ==
155  {
156  for(int i = 0; i < AUTH_FIELD_END; ++i)
157  {
158  rpTemp->SetAuthorField(static_cast<ToxAuthorityField>(i),
159  pNewEntry->GetAuthorField(static_cast<ToxAuthorityField>(i)));
160  }
161  return true;
162  }
163  }
164  return false;
165 }
166 
168 sal_uInt16 SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert )
169 {
170  for( SwAuthDataArr::size_type nRet = 0; nRet < m_DataArr.size(); ++nRet )
171  {
172  if( *m_DataArr[ nRet ] == rInsert )
173  return nRet;
174  }
175 
176  //if it is a new Entry - insert
177  m_DataArr.push_back(new SwAuthEntry(rInsert));
178  return m_DataArr.size()-1;
179 }
180 
182  SwRootFrame const*const pLayout)
183 {
184  //find the field in a sorted array of handles,
185 #if OSL_DEBUG_LEVEL > 0
186  bool bCurrentFieldWithoutTextNode = false;
187 #endif
188  if(!m_SequArr.empty() && m_SequArr.size() != m_DataArr.size())
190  if(m_SequArr.empty())
191  {
193  // sw_redlinehide: need 2 arrays because the sorting may be different,
194  // if multiple fields refer to the same entry and first one is deleted
195  std::vector<std::unique_ptr<SwTOXSortTabBase>> aSortArr;
196  std::vector<std::unique_ptr<SwTOXSortTabBase>> aSortArrRLHidden;
198 
200 
201  for( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() )
202  {
203  const SwTextField* pTextField = pFormatField->GetTextField();
204  if(!pTextField || !pTextField->GetpTextNode())
205  {
206 #if OSL_DEBUG_LEVEL > 0
207  if(pAuthEntry == static_cast<SwAuthorityField*>(pFormatField->GetField())->GetAuthEntry())
208  bCurrentFieldWithoutTextNode = true;
209 #endif
210  continue;
211  }
212  const SwTextNode& rFieldTextNode = pTextField->GetTextNode();
213  SwPosition aFieldPos(rFieldTextNode);
214  SwDoc& rDoc = *const_cast<SwDoc*>(rFieldTextNode.GetDoc());
215  SwContentFrame *pFrame = rFieldTextNode.getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() );
216  const SwTextNode* pTextNode = nullptr;
217  if(pFrame && !pFrame->IsInDocBody())
218  pTextNode = GetBodyTextNode( rDoc, aFieldPos, *pFrame );
219  //if no text node could be found or the field is in the document
220  //body the directly available text node will be used
221  if(!pTextNode)
222  pTextNode = &rFieldTextNode;
223  if (pTextNode->GetText().isEmpty()
225  || !pTextNode->GetNodes().IsDocNodes())
226  {
227  continue;
228  }
229  auto const InsertImpl = [&aIntl, pTextNode, pFormatField]
230  (std::vector<std::unique_ptr<SwTOXSortTabBase>> & rSortArr)
231  {
232  std::unique_ptr<SwTOXAuthority> pNew(
233  new SwTOXAuthority(*pTextNode, *pFormatField, aIntl));
234 
235  for (size_t i = 0; i < rSortArr.size(); ++i)
236  {
237  SwTOXSortTabBase* pOld = rSortArr[i].get();
238  if (pOld->equivalent(*pNew))
239  {
240  //only the first occurrence in the document
241  //has to be in the array
242  if (pOld->sort_lt(*pNew))
243  pNew.reset();
244  else // remove the old content
245  rSortArr.erase(rSortArr.begin() + i);
246  break;
247  }
248  }
249  //if it still exists - insert at the correct position
250  if (pNew)
251  {
252  size_t j {0};
253 
254  while (j < rSortArr.size())
255  {
256  SwTOXSortTabBase* pOld = rSortArr[j].get();
257  if (pNew->sort_lt(*pOld))
258  break;
259  ++j;
260  }
261  rSortArr.insert(rSortArr.begin() + j, std::move(pNew));
262  }
263  };
264  InsertImpl(aSortArr);
265  if (!sw::IsFieldDeletedInModel(rIDRA, *pTextField))
266  {
267  InsertImpl(aSortArrRLHidden);
268  }
269  }
270 
271  for(auto & pBase : aSortArr)
272  {
273  SwFormatField& rFormatField = static_cast<SwTOXAuthority&>(*pBase).GetFieldFormat();
274  SwAuthorityField* pAField = static_cast<SwAuthorityField*>(rFormatField.GetField());
275  m_SequArr.push_back(pAField->GetAuthEntry());
276  }
277  for (auto & pBase : aSortArrRLHidden)
278  {
279  SwFormatField& rFormatField = static_cast<SwTOXAuthority&>(*pBase).GetFieldFormat();
280  SwAuthorityField* pAField = static_cast<SwAuthorityField*>(rFormatField.GetField());
281  m_SequArrRLHidden.push_back(pAField->GetAuthEntry());
282  }
283  }
284  //find nHandle
285  auto const& rSequArr(pLayout && pLayout->IsHideRedlines() ? m_SequArrRLHidden : m_SequArr);
286  for (std::vector<sal_IntPtr>::size_type i = 0; i < rSequArr.size(); ++i)
287  {
288  if (rSequArr[i] == pAuthEntry)
289  {
290  return i + 1;
291  }
292  }
293 #if OSL_DEBUG_LEVEL > 0
294  OSL_ENSURE(bCurrentFieldWithoutTextNode, "Handle not found");
295 #endif
296  return 0;
297 }
298 
299 void SwAuthorityFieldType::QueryValue( Any& rVal, sal_uInt16 nWhichId ) const
300 {
301  switch( nWhichId )
302  {
303  case FIELD_PROP_PAR1:
304  case FIELD_PROP_PAR2:
305  {
306  OUString sVal;
307  sal_Unicode uRet = FIELD_PROP_PAR1 == nWhichId ? m_cPrefix : m_cSuffix;
308  if(uRet)
309  sVal = OUString(uRet);
310  rVal <<= sVal;
311  }
312  break;
313  case FIELD_PROP_PAR3:
314  rVal <<= GetSortAlgorithm();
315  break;
316 
317  case FIELD_PROP_BOOL1:
318  rVal <<= m_bIsSequence;
319  break;
320 
321  case FIELD_PROP_BOOL2:
322  rVal <<= m_bSortByDocument;
323  break;
324 
325  case FIELD_PROP_LOCALE:
326  rVal <<= LanguageTag(GetLanguage()).getLocale();
327  break;
328 
329  case FIELD_PROP_PROP_SEQ:
330  {
331  Sequence<PropertyValues> aRet(m_SortKeyArr.size());
332  PropertyValues* pValues = aRet.getArray();
333  for(SortKeyArr::size_type i = 0; i < m_SortKeyArr.size(); ++i)
334  {
335  const SwTOXSortKey* pKey = &m_SortKeyArr[i];
336  pValues[i].realloc(2);
337  PropertyValue* pValue = pValues[i].getArray();
338  pValue[0].Name = UNO_NAME_SORT_KEY;
339  pValue[0].Value <<= sal_Int16(pKey->eField);
340  pValue[1].Name = UNO_NAME_IS_SORT_ASCENDING;
341  pValue[1].Value <<= pKey->bSortAscending;
342  }
343  rVal <<= aRet;
344  }
345  break;
346  default:
347  assert(false);
348  }
349 }
350 
351 void SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId )
352 {
353  bool bRet = true;
354  switch( nWhichId )
355  {
356  case FIELD_PROP_PAR1:
357  case FIELD_PROP_PAR2:
358  {
359  OUString sTmp;
360  rAny >>= sTmp;
361  const sal_Unicode uSet = !sTmp.isEmpty() ? sTmp[0] : 0;
362  if( FIELD_PROP_PAR1 == nWhichId )
363  m_cPrefix = uSet;
364  else
365  m_cSuffix = uSet;
366  }
367  break;
368  case FIELD_PROP_PAR3:
369  {
370  OUString sTmp;
371  rAny >>= sTmp;
372  SetSortAlgorithm(sTmp);
373  break;
374  }
375  case FIELD_PROP_BOOL1:
376  m_bIsSequence = *o3tl::doAccess<bool>(rAny);
377  break;
378  case FIELD_PROP_BOOL2:
379  m_bSortByDocument = *o3tl::doAccess<bool>(rAny);
380  break;
381 
382  case FIELD_PROP_LOCALE:
383  {
384  css::lang::Locale aLocale;
385  bRet = rAny >>= aLocale;
386  if( bRet )
388  }
389  break;
390 
391  case FIELD_PROP_PROP_SEQ:
392  {
393  Sequence<PropertyValues> aSeq;
394  bRet = rAny >>= aSeq;
395  if( bRet )
396  {
397  m_SortKeyArr.clear();
398  const PropertyValues* pValues = aSeq.getConstArray();
399  //TODO: Limiting to the first SAL_MAX_UINT16 elements of aSeq so that size of
400  // m_SortKeyArr remains in range of sal_uInt16, as GetSortKeyCount and GetSortKey
401  // still expect m_SortKeyArr to be indexed by sal_uInt16:
402  auto nSize = std::min<sal_Int32>(aSeq.getLength(), SAL_MAX_UINT16);
403  for(sal_Int32 i = 0; i < nSize; i++)
404  {
405  SwTOXSortKey aSortKey;
406  for(const PropertyValue& rValue : pValues[i])
407  {
408  if(rValue.Name == UNO_NAME_SORT_KEY)
409  {
410  sal_Int16 nVal = -1; rValue.Value >>= nVal;
411  if(nVal >= 0 && nVal < AUTH_FIELD_END)
412  aSortKey.eField = static_cast<ToxAuthorityField>(nVal);
413  else
414  bRet = false;
415  }
416  else if(rValue.Name == UNO_NAME_IS_SORT_ASCENDING)
417  {
418  aSortKey.bSortAscending = *o3tl::doAccess<bool>(rValue.Value);
419  }
420  }
421  m_SortKeyArr.push_back(aSortKey);
422  }
423  }
424  }
425  break;
426  default:
427  assert(false);
428  }
429 }
430 
431 void SwAuthorityFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
432 {
433  //re-generate positions of the fields
435  NotifyClients( pOld, pNew );
436 }
437 
439 {
440  return m_SortKeyArr.size();
441 }
442 
443 const SwTOXSortKey* SwAuthorityFieldType::GetSortKey(sal_uInt16 nIdx) const
444 {
445  if(m_SortKeyArr.size() > nIdx)
446  return &m_SortKeyArr[nIdx];
447  OSL_FAIL("Sort key not found");
448  return nullptr;
449 }
450 
451 void SwAuthorityFieldType::SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey const aKeys[])
452 {
453  m_SortKeyArr.clear();
454  for(sal_uInt16 i = 0; i < nKeyCount; i++)
455  if(aKeys[i].eField < AUTH_FIELD_END)
456  m_SortKeyArr.push_back(aKeys[i]);
457 }
458 
460  const OUString& rFieldContents )
461  : SwField(pInitType)
462  , m_nTempSequencePos( -1 )
463  , m_nTempSequencePosRLHidden( -1 )
464 {
465  m_xAuthEntry = pInitType->AddField( rFieldContents );
466 }
467 
469  SwAuthEntry* pAuthEntry )
470  : SwField( pInitType )
471  , m_xAuthEntry( pAuthEntry )
472  , m_nTempSequencePos( -1 )
473  , m_nTempSequencePosRLHidden( -1 )
474 {
475 }
476 
478 {
479  static_cast<SwAuthorityFieldType* >(GetTyp())->RemoveField(m_xAuthEntry.get());
480 }
481 
482 OUString SwAuthorityField::ExpandImpl(SwRootFrame const*const pLayout) const
483 {
484  return ConditionalExpandAuthIdentifier(pLayout);
485 }
486 
488  SwRootFrame const*const pLayout) const
489 {
490  SwAuthorityFieldType* pAuthType = static_cast<SwAuthorityFieldType*>(GetTyp());
491  OUString sRet;
492  if(pAuthType->GetPrefix())
493  sRet = OUString(pAuthType->GetPrefix());
494 
495  if( pAuthType->IsSequence() )
496  {
497  sal_IntPtr & rnTempSequencePos(pLayout && pLayout->IsHideRedlines()
499  if(!pAuthType->GetDoc()->getIDocumentFieldsAccess().IsExpFieldsLocked())
500  rnTempSequencePos = pAuthType->GetSequencePos(m_xAuthEntry.get(), pLayout);
501  if (0 <= rnTempSequencePos)
502  sRet += OUString::number(rnTempSequencePos);
503  }
504  else
505  {
506  //TODO: Expand to: identifier, number sequence, ...
507  if(m_xAuthEntry)
508  sRet += m_xAuthEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER);
509  }
510  if(pAuthType->GetSuffix())
511  sRet += OUStringLiteral1(pAuthType->GetSuffix());
512  return sRet;
513 }
514 
516  SwRootFrame const*const pLayout) const
517 {
518  SwAuthorityFieldType* pAuthType = static_cast<SwAuthorityFieldType*>(GetTyp());
519  OUString sRet;
520 
521  if( pAuthType->IsSequence() )
522  {
523  sal_IntPtr & rnTempSequencePos(pLayout && pLayout->IsHideRedlines()
525  if(!pAuthType->GetDoc()->getIDocumentFieldsAccess().IsExpFieldsLocked())
526  rnTempSequencePos = pAuthType->GetSequencePos(m_xAuthEntry.get(), pLayout);
527  if (0 <= rnTempSequencePos)
528  sRet += OUString::number(rnTempSequencePos);
529  }
530  else
531  {
532  //TODO: Expand to: identifier, number sequence, ...
533  if(m_xAuthEntry)
534  sRet += m_xAuthEntry->GetAuthorField(eField);
535  }
536  return sRet;
537 }
538 
539 std::unique_ptr<SwField> SwAuthorityField::Copy() const
540 {
541  SwAuthorityFieldType* pAuthType = static_cast<SwAuthorityFieldType*>(GetTyp());
542  return std::make_unique<SwAuthorityField>(pAuthType, m_xAuthEntry.get());
543 }
544 
546 {
547  return m_xAuthEntry->GetAuthorField( eField );
548 }
549 
550 void SwAuthorityField::SetPar1(const OUString& rStr)
551 {
552  SwAuthorityFieldType* pInitType = static_cast<SwAuthorityFieldType* >(GetTyp());
553  pInitType->RemoveField(m_xAuthEntry.get());
554  m_xAuthEntry = pInitType->AddField(rStr);
555 }
556 
558 {
559  return SwResId(STR_AUTHORITY_ENTRY);
560 }
561 
562 const char* const aFieldNames[] =
563 {
564  "Identifier",
565  "BibiliographicType",
566  "Address",
567  "Annote",
568  "Author",
569  "Booktitle",
570  "Chapter",
571  "Edition",
572  "Editor",
573  "Howpublished",
574  "Institution",
575  "Journal",
576  "Month",
577  "Note",
578  "Number",
579  "Organizations",
580  "Pages",
581  "Publisher",
582  "School",
583  "Series",
584  "Title",
585  "Report_Type",
586  "Volume",
587  "Year",
588  "URL",
589  "Custom1",
590  "Custom2",
591  "Custom3",
592  "Custom4",
593  "Custom5",
594  "ISBN"
595 };
596 
597 bool SwAuthorityField::QueryValue( Any& rAny, sal_uInt16 /*nWhichId*/ ) const
598 {
599  if(!GetTyp())
600  return false;
601  if(!m_xAuthEntry)
602  return false;
604  PropertyValue* pValues = aRet.getArray();
605  for(int i = 0; i < AUTH_FIELD_END; ++i)
606  {
607  pValues[i].Name = OUString::createFromAscii(aFieldNames[i]);
608  const OUString& sField = m_xAuthEntry->GetAuthorField(static_cast<ToxAuthorityField>(i));
610  pValues[i].Value <<= sal_Int16(sField.toInt32());
611  else
612  pValues[i].Value <<= sField;
613  }
614  rAny <<= aRet;
615  /* FIXME: it is weird that we always return false here */
616  return false;
617 }
618 
619 static sal_Int32 lcl_Find(const OUString& rFieldName)
620 {
621  for(sal_Int32 i = 0; i < AUTH_FIELD_END; ++i)
622  if(rFieldName.equalsAscii(aFieldNames[i]))
623  return i;
624  return -1;
625 }
626 
627 bool SwAuthorityField::PutValue( const Any& rAny, sal_uInt16 /*nWhichId*/ )
628 {
629  if(!GetTyp() || !m_xAuthEntry)
630  return false;
631 
633  if(!(rAny >>= aParam))
634  return false;
635 
636  OUStringBuffer sBuf;
638  OUString sToSet(sBuf.makeStringAndClear());
639  for(const PropertyValue& rParam : std::as_const(aParam))
640  {
641  const sal_Int32 nFound = lcl_Find(rParam.Name);
642  if(nFound >= 0)
643  {
644  OUString sContent;
645  if(AUTH_FIELD_AUTHORITY_TYPE == nFound)
646  {
647  sal_Int16 nVal = 0;
648  rParam.Value >>= nVal;
649  sContent = OUString::number(nVal);
650  }
651  else
652  rParam.Value >>= sContent;
653  sToSet = comphelper::string::setToken(sToSet, nFound, TOX_STYLE_DELIMITER, sContent);
654  }
655  }
656 
657  static_cast<SwAuthorityFieldType*>(GetTyp())->RemoveField(m_xAuthEntry.get());
658  m_xAuthEntry = static_cast<SwAuthorityFieldType*>(GetTyp())->AddField(sToSet);
659 
660  /* FIXME: it is weird that we always return false here */
661  return false;
662 }
663 
665 {
666  SwAuthorityFieldType* pSrcTyp = static_cast<SwAuthorityFieldType*>(GetTyp()),
667  * pDstTyp = static_cast<SwAuthorityFieldType*>(pFieldTyp);
668  if( pSrcTyp != pDstTyp )
669  {
670  const SwAuthEntry* pSrcEntry = m_xAuthEntry.get();
671  pDstTyp->AppendField( *pSrcEntry );
672  pSrcTyp->RemoveField( pSrcEntry );
673  SwField::ChgTyp( pFieldTyp );
674  }
675  return pSrcTyp;
676 }
677 
678 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:233
bool operator==(const SwAuthEntry &rComp)
Definition: authfld.cxx:61
OUString const & GetAuthorField(ToxAuthorityField ePos) const
Definition: authfld.hxx:181
OUString ConditionalExpandAuthIdentifier(SwRootFrame const *pLayout) const
For internal use only, in general continue using ExpandField() instead.
Definition: authfld.cxx:487
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: authfld.cxx:482
Marks a position in the document model.
Definition: pam.hxx:35
const SwField * GetField() const
Definition: fmtfld.hxx:71
bool IsInDocBody() const
Definition: frame.hxx:919
#define UNO_NAME_SORT_KEY
Definition: unoprnms.hxx:530
const OUString & GetText() const
Definition: ndtxt.hxx:211
virtual const SwRootFrame * GetCurrentLayout() const =0
SwAuthDataArr m_DataArr
Definition: authfld.hxx:60
void DelSequenceArray()
Definition: authfld.hxx:87
virtual ~SwAuthorityFieldType() override
Definition: authfld.cxx:80
virtual void SetPar1(const OUString &rStr) override
Definition: authfld.cxx:550
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
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 SetSortAlgorithm(const OUString &rSet)
Definition: authfld.hxx:136
Base class of all fields.
Definition: fldbas.hxx:279
#define TOX_STYLE_DELIMITER
Definition: tox.hxx:386
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1148
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const override
Definition: authfld.cxx:597
Definition: doc.hxx:185
TElementType * Next()
Definition: calbck.hxx:376
virtual std::unique_ptr< SwField > Copy() const override
Definition: authfld.cxx:539
sal_Unicode m_cPrefix
Definition: authfld.hxx:64
std::map< sal_Int32, std::shared_ptr< SetItemPropertyStorage > > PropertyValues
virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override
Definition: authfld.cxx:431
SwTextNode * GetpTextNode() const
Definition: txtfld.hxx:49
sal_Unicode m_cSuffix
Definition: authfld.hxx:65
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
sal_uInt16 AppendField(const SwAuthEntry &rInsert)
appends a new entry (if new) and returns the array position
Definition: authfld.cxx:168
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
SwAuthEntry * GetEntryByIdentifier(const OUString &rIdentifier) const
Definition: authfld.cxx:136
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:389
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId) override
Definition: authfld.cxx:627
sal_uInt16 sal_Unicode
const SwTOXSortKey * GetSortKey(sal_uInt16 nIdx) const
Definition: authfld.cxx:443
sal_Unicode GetPrefix() const
Definition: authfld.hxx:114
invariant for SwAuthorityField is that it is always registered at its SwAuthorityFieldType via AddFie...
Definition: authfld.hxx:148
#define SAL_MAX_UINT16
virtual bool equivalent(const SwTOXSortTabBase &)
Definition: txmsrt.cxx:203
eField
Definition: fields.hxx:26
virtual bool IsExpFieldsLocked() const =0
virtual ~SwAuthorityField() override
Definition: authfld.cxx:477
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: authfld.cxx:84
LanguageType m_eLanguage
Definition: authfld.hxx:68
sal_IntPtr m_nTempSequencePos
Definition: authfld.hxx:151
SwAuthEntry * GetAuthEntry() const
Definition: authfld.hxx:176
SwAuthEntry()=default
virtual SwFieldType * ChgTyp(SwFieldType *)
Set new type (used for copying among documents).
Definition: fldbas.cxx:338
rtl::Reference< SwAuthEntry > m_xAuthEntry
Definition: authfld.hxx:150
virtual void QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const override
Definition: authfld.cxx:299
SwDoc * GetDoc()
Definition: authfld.hxx:84
#define FIELD_PROP_BOOL2
Definition: unofldmid.h:29
TElementType * First()
Definition: calbck.hxx:345
int i
sal_uInt16 GetSequencePos(const SwAuthEntry *pAuthEntry, SwRootFrame const *pLayout)
Definition: authfld.cxx:181
#define FIELD_PROP_LOCALE
Definition: unofldmid.h:40
SwFieldIds
Definition: fldbas.hxx:38
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, sal_Char cFill= '\0')
SwDoc * GetDoc()
Definition: node.hxx:702
sal_Unicode GetSuffix() const
Definition: authfld.hxx:115
LanguageType GetLanguage() const
Definition: authfld.hxx:132
bool IsSequence() const
Definition: authfld.hxx:102
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:693
OUString SwResId(const char *pId)
Definition: swmodule.cxx:191
#define UNO_NAME_IS_SORT_ASCENDING
Definition: unoprnms.hxx:529
bool bSortAscending
Definition: authfld.hxx:48
void SetLanguage(LanguageType nLang)
Definition: authfld.hxx:133
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:437
#define FIELD_PROP_PAR3
Definition: unofldmid.h:25
SwFieldType * GetTyp() const
Definition: fldbas.hxx:382
void GetAllEntryIdentifiers(std::vector< OUString > &rToFill) const
Definition: authfld.cxx:127
virtual SwFieldType * ChgTyp(SwFieldType *) override
Set new type (used for copying among documents).
Definition: authfld.cxx:664
void NotifyClients(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
Definition: calbck.cxx:167
ToxAuthorityField
Definition: toxe.hxx:82
#define FIELD_PROP_BOOL1
Definition: unofldmid.h:28
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
std::vector< SwAuthEntry * > m_SequArrRLHidden
hidden redlines
Definition: authfld.hxx:62
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:367
SwAuthEntry * AddField(const OUString &rFieldContents)
Definition: authfld.cxx:104
SwAuthorityFieldType(SwDoc *pDoc)
Definition: authfld.cxx:69
ToxAuthorityField eField
Definition: authfld.hxx:47
bool ChangeEntryContent(const SwAuthEntry *pNewEntry)
Definition: authfld.cxx:149
#define FIELD_PROP_PAR1
Definition: unofldmid.h:23
#define FIELD_PROP_PAR2
Definition: unofldmid.h:24
bool IsFieldDeletedInModel(IDocumentRedlineAccess const &rIDRA, SwTextField const &rTextField)
SwFormatField & GetFieldFormat()
Definition: txmsrt.hxx:292
sal_IntPtr m_nTempSequencePosRLHidden
hidden redlines
Definition: authfld.hxx:152
#define FIELD_PROP_PROP_SEQ
Definition: unofldmid.h:39
SortKeyArr m_SortKeyArr
Definition: authfld.hxx:63
OUString aAuthFields[AUTH_FIELD_END]
Definition: authfld.hxx:34
LanguageType GetAppLanguage()
Definition: init.cxx:765
virtual void PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId) override
Definition: authfld.cxx:351
const OUString & GetSortAlgorithm() const
Definition: authfld.hxx:135
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding)...
Definition: rootfrm.hxx:416
void RemoveField(const SwAuthEntry *nHandle)
Definition: authfld.cxx:89
std::vector< SwAuthEntry * > m_SequArr
Definition: authfld.hxx:61
static sal_Int32 lcl_Find(const OUString &rFieldName)
Definition: authfld.cxx:619
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2336
SwAuthorityField(SwAuthorityFieldType *pType, const OUString &rFieldContents)
Definition: authfld.cxx:459
const char *const aFieldNames[]
Definition: authfld.cxx:562
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
OUString setToken(const OUString &rIn, sal_Int32 nToken, sal_Unicode cTok, const OUString &rNewToken)
virtual bool sort_lt(const SwTOXSortTabBase &)
Definition: txmsrt.cxx:229
SW_DLLPUBLIC OUString ExpandCitation(ToxAuthorityField eField, SwRootFrame const *pLayout) const
Definition: authfld.cxx:515
Class for sorting directories.
Definition: txmsrt.hxx:120
const OUString & GetFieldText(ToxAuthorityField eField) const
Definition: authfld.cxx:545
virtual OUString GetDescription() const override
Definition: authfld.cxx:557
sal_uInt16 GetSortKeyCount() const
Definition: authfld.cxx:438
void SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey const nKeys[])
Definition: authfld.cxx:451
OUString m_sSortAlgorithm
Definition: authfld.hxx:69