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