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