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  m_aAuthFields[i] = rCopy.m_aAuthFields[i];
54 }
55 
56 bool SwAuthEntry::operator==(const SwAuthEntry& rComp) const
57 {
58  for(int i = 0; i < AUTH_FIELD_END; ++i)
59  if(m_aAuthFields[i] != rComp.m_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(!m_SequArr.empty() && m_SequArr.size() != m_DataArr.size())
186  if(m_SequArr.empty())
187  {
190  // sw_redlinehide: need 2 arrays because the sorting may be different,
191  // if multiple fields refer to the same entry and first one is deleted
192  std::vector<std::unique_ptr<SwTOXSortTabBase>> aSortArr;
193  std::vector<std::unique_ptr<SwTOXSortTabBase>> aSortArrRLHidden;
194  std::vector<SwFormatField*> vFields;
195  GatherFields(vFields);
196  for(SwFormatField* pFormatField : vFields)
197  {
198  const SwTextField* pTextField = pFormatField->GetTextField();
199  if(!pTextField || !pTextField->GetpTextNode())
200  {
201  continue;
202  }
203  const SwTextNode& rFieldTextNode = pTextField->GetTextNode();
204  SwPosition aFieldPos(rFieldTextNode);
205  SwDoc& rDoc = *const_cast<SwDoc*>(rFieldTextNode.GetDoc());
206  SwContentFrame *pFrame = rFieldTextNode.getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() );
207  const SwTextNode* pTextNode = nullptr;
208  if(pFrame && !pFrame->IsInDocBody())
209  pTextNode = GetBodyTextNode( rDoc, aFieldPos, *pFrame );
210  //if no text node could be found or the field is in the document
211  //body the directly available text node will be used
212  if(!pTextNode)
213  pTextNode = &rFieldTextNode;
214  if (pTextNode->GetText().isEmpty()
216  || !pTextNode->GetNodes().IsDocNodes())
217  {
218  continue;
219  }
220  auto const InsertImpl = [&aIntl, pTextNode, pFormatField]
221  (std::vector<std::unique_ptr<SwTOXSortTabBase>> & rSortArr)
222  {
223  std::unique_ptr<SwTOXAuthority> pNew(
224  new SwTOXAuthority(*pTextNode, *pFormatField, aIntl));
225 
226  for (size_t i = 0; i < rSortArr.size(); ++i)
227  {
228  SwTOXSortTabBase* pOld = rSortArr[i].get();
229  if (pOld->equivalent(*pNew))
230  {
231  //only the first occurrence in the document
232  //has to be in the array
233  if (pOld->sort_lt(*pNew))
234  pNew.reset();
235  else // remove the old content
236  rSortArr.erase(rSortArr.begin() + i);
237  break;
238  }
239  }
240  //if it still exists - insert at the correct position
241  if (pNew)
242  {
243  size_t j {0};
244 
245  while (j < rSortArr.size())
246  {
247  SwTOXSortTabBase* pOld = rSortArr[j].get();
248  if (pNew->sort_lt(*pOld))
249  break;
250  ++j;
251  }
252  rSortArr.insert(rSortArr.begin() + j, std::move(pNew));
253  }
254  };
255  InsertImpl(aSortArr);
256  if (!sw::IsFieldDeletedInModel(rIDRA, *pTextField))
257  {
258  InsertImpl(aSortArrRLHidden);
259  }
260  }
261 
262  for(auto & pBase : aSortArr)
263  {
264  SwFormatField& rFormatField = static_cast<SwTOXAuthority&>(*pBase).GetFieldFormat();
265  SwAuthorityField* pAField = static_cast<SwAuthorityField*>(rFormatField.GetField());
266  m_SequArr.push_back(pAField->GetAuthEntry());
267  }
268  for (auto & pBase : aSortArrRLHidden)
269  {
270  SwFormatField& rFormatField = static_cast<SwTOXAuthority&>(*pBase).GetFieldFormat();
271  SwAuthorityField* pAField = static_cast<SwAuthorityField*>(rFormatField.GetField());
272  m_SequArrRLHidden.push_back(pAField->GetAuthEntry());
273  }
274  }
275  //find nHandle
276  auto const& rSequArr(pLayout && pLayout->IsHideRedlines() ? m_SequArrRLHidden : m_SequArr);
277  for (std::vector<sal_IntPtr>::size_type i = 0; i < rSequArr.size(); ++i)
278  {
279  if (rSequArr[i] == pAuthEntry)
280  {
281  return i + 1;
282  }
283  }
284  return 0;
285 }
286 
287 void SwAuthorityFieldType::QueryValue( Any& rVal, sal_uInt16 nWhichId ) const
288 {
289  switch( nWhichId )
290  {
291  case FIELD_PROP_PAR1:
292  case FIELD_PROP_PAR2:
293  {
294  OUString sVal;
295  sal_Unicode uRet = FIELD_PROP_PAR1 == nWhichId ? m_cPrefix : m_cSuffix;
296  if(uRet)
297  sVal = OUString(uRet);
298  rVal <<= sVal;
299  }
300  break;
301  case FIELD_PROP_PAR3:
302  rVal <<= GetSortAlgorithm();
303  break;
304 
305  case FIELD_PROP_BOOL1:
306  rVal <<= m_bIsSequence;
307  break;
308 
309  case FIELD_PROP_BOOL2:
310  rVal <<= m_bSortByDocument;
311  break;
312 
313  case FIELD_PROP_LOCALE:
314  rVal <<= LanguageTag(GetLanguage()).getLocale();
315  break;
316 
317  case FIELD_PROP_PROP_SEQ:
318  {
319  Sequence<PropertyValues> aRet(m_SortKeyArr.size());
320  PropertyValues* pValues = aRet.getArray();
321  for(SortKeyArr::size_type i = 0; i < m_SortKeyArr.size(); ++i)
322  {
323  const SwTOXSortKey* pKey = &m_SortKeyArr[i];
324  pValues[i].realloc(2);
325  PropertyValue* pValue = pValues[i].getArray();
326  pValue[0].Name = UNO_NAME_SORT_KEY;
327  pValue[0].Value <<= sal_Int16(pKey->eField);
328  pValue[1].Name = UNO_NAME_IS_SORT_ASCENDING;
329  pValue[1].Value <<= pKey->bSortAscending;
330  }
331  rVal <<= aRet;
332  }
333  break;
334  default:
335  assert(false);
336  }
337 }
338 
339 void SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId )
340 {
341  switch( nWhichId )
342  {
343  case FIELD_PROP_PAR1:
344  case FIELD_PROP_PAR2:
345  {
346  OUString sTmp;
347  rAny >>= sTmp;
348  const sal_Unicode uSet = !sTmp.isEmpty() ? sTmp[0] : 0;
349  if( FIELD_PROP_PAR1 == nWhichId )
350  m_cPrefix = uSet;
351  else
352  m_cSuffix = uSet;
353  }
354  break;
355  case FIELD_PROP_PAR3:
356  {
357  OUString sTmp;
358  rAny >>= sTmp;
359  SetSortAlgorithm(sTmp);
360  break;
361  }
362  case FIELD_PROP_BOOL1:
363  m_bIsSequence = *o3tl::doAccess<bool>(rAny);
364  break;
365  case FIELD_PROP_BOOL2:
366  m_bSortByDocument = *o3tl::doAccess<bool>(rAny);
367  break;
368 
369  case FIELD_PROP_LOCALE:
370  {
371  css::lang::Locale aLocale;
372  if( rAny >>= aLocale )
374  }
375  break;
376 
377  case FIELD_PROP_PROP_SEQ:
378  {
379  Sequence<PropertyValues> aSeq;
380  if( rAny >>= aSeq )
381  {
382  m_SortKeyArr.clear();
383  const PropertyValues* pValues = aSeq.getConstArray();
384  //TODO: Limiting to the first SAL_MAX_UINT16 elements of aSeq so that size of
385  // m_SortKeyArr remains in range of sal_uInt16, as GetSortKeyCount and GetSortKey
386  // still expect m_SortKeyArr to be indexed by sal_uInt16:
387  auto nSize = std::min<sal_Int32>(aSeq.getLength(), SAL_MAX_UINT16);
388  for(sal_Int32 i = 0; i < nSize; i++)
389  {
390  SwTOXSortKey aSortKey;
391  for(const PropertyValue& rValue : pValues[i])
392  {
393  if(rValue.Name == UNO_NAME_SORT_KEY)
394  {
395  sal_Int16 nVal = -1; rValue.Value >>= nVal;
396  if(nVal >= 0 && nVal < AUTH_FIELD_END)
397  aSortKey.eField = static_cast<ToxAuthorityField>(nVal);
398  }
399  else if(rValue.Name == UNO_NAME_IS_SORT_ASCENDING)
400  {
401  aSortKey.bSortAscending = *o3tl::doAccess<bool>(rValue.Value);
402  }
403  }
404  m_SortKeyArr.push_back(aSortKey);
405  }
406  }
407  }
408  break;
409  default:
410  assert(false);
411  }
412 }
413 
414 void SwAuthorityFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
415 {
416  //re-generate positions of the fields
418  NotifyClients( pOld, pNew );
419 }
420 
422 {
423  return m_SortKeyArr.size();
424 }
425 
426 const SwTOXSortKey* SwAuthorityFieldType::GetSortKey(sal_uInt16 nIdx) const
427 {
428  if(m_SortKeyArr.size() > nIdx)
429  return &m_SortKeyArr[nIdx];
430  OSL_FAIL("Sort key not found");
431  return nullptr;
432 }
433 
434 void SwAuthorityFieldType::SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey const aKeys[])
435 {
436  m_SortKeyArr.clear();
437  for(sal_uInt16 i = 0; i < nKeyCount; i++)
438  if(aKeys[i].eField < AUTH_FIELD_END)
439  m_SortKeyArr.push_back(aKeys[i]);
440 }
441 
443  const OUString& rFieldContents )
444  : SwField(pInitType)
445  , m_nTempSequencePos( -1 )
446  , m_nTempSequencePosRLHidden( -1 )
447 {
448  m_xAuthEntry = pInitType->AddField( rFieldContents );
449 }
450 
452  SwAuthEntry* pAuthEntry )
453  : SwField( pInitType )
454  , m_xAuthEntry( pAuthEntry )
455  , m_nTempSequencePos( -1 )
456  , m_nTempSequencePosRLHidden( -1 )
457 {
458 }
459 
461 {
462  static_cast<SwAuthorityFieldType* >(GetTyp())->RemoveField(m_xAuthEntry.get());
463 }
464 
465 OUString SwAuthorityField::ExpandImpl(SwRootFrame const*const pLayout) const
466 {
467  return ConditionalExpandAuthIdentifier(pLayout);
468 }
469 
471  SwRootFrame const*const pLayout) const
472 {
473  SwAuthorityFieldType* pAuthType = static_cast<SwAuthorityFieldType*>(GetTyp());
474  OUString sRet;
475  if(pAuthType->GetPrefix())
476  sRet = OUString(pAuthType->GetPrefix());
477 
478  if( pAuthType->IsSequence() )
479  {
480  sal_IntPtr & rnTempSequencePos(pLayout && pLayout->IsHideRedlines()
482  if(!pAuthType->GetDoc()->getIDocumentFieldsAccess().IsExpFieldsLocked())
483  rnTempSequencePos = pAuthType->GetSequencePos(m_xAuthEntry.get(), pLayout);
484  if (0 <= rnTempSequencePos)
485  sRet += OUString::number(rnTempSequencePos);
486  }
487  else
488  {
489  //TODO: Expand to: identifier, number sequence, ...
490  if(m_xAuthEntry)
491  {
492  OUString sIdentifier(m_xAuthEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER));
493  // tdf#107784 Use title if it's a ooxml citation
494  if (sIdentifier.trim().startsWith("CITATION"))
495  return m_xAuthEntry->GetAuthorField(AUTH_FIELD_TITLE);
496  else
497  sRet += sIdentifier;
498  }
499  }
500  if(pAuthType->GetSuffix())
501  sRet += OUStringChar(pAuthType->GetSuffix());
502  return sRet;
503 }
504 
506  SwRootFrame const*const pLayout) const
507 {
508  SwAuthorityFieldType* pAuthType = static_cast<SwAuthorityFieldType*>(GetTyp());
509  OUString sRet;
510 
511  if( pAuthType->IsSequence() )
512  {
513  sal_IntPtr & rnTempSequencePos(pLayout && pLayout->IsHideRedlines()
515  if(!pAuthType->GetDoc()->getIDocumentFieldsAccess().IsExpFieldsLocked())
516  rnTempSequencePos = pAuthType->GetSequencePos(m_xAuthEntry.get(), pLayout);
517  if (0 <= rnTempSequencePos)
518  sRet += OUString::number(rnTempSequencePos);
519  }
520  else
521  {
522  //TODO: Expand to: identifier, number sequence, ...
523  if(m_xAuthEntry)
524  sRet += m_xAuthEntry->GetAuthorField(eField);
525  }
526  return sRet;
527 }
528 
529 std::unique_ptr<SwField> SwAuthorityField::Copy() const
530 {
531  SwAuthorityFieldType* pAuthType = static_cast<SwAuthorityFieldType*>(GetTyp());
532  return std::make_unique<SwAuthorityField>(pAuthType, m_xAuthEntry.get());
533 }
534 
536 {
537  return m_xAuthEntry->GetAuthorField( eField );
538 }
539 
540 void SwAuthorityField::SetPar1(const OUString& rStr)
541 {
542  SwAuthorityFieldType* pInitType = static_cast<SwAuthorityFieldType* >(GetTyp());
543  pInitType->RemoveField(m_xAuthEntry.get());
544  m_xAuthEntry = pInitType->AddField(rStr);
545 }
546 
548 {
549  return SwResId(STR_AUTHORITY_ENTRY);
550 }
551 
552 const char* const aFieldNames[] =
553 {
554  "Identifier",
555  "BibiliographicType",
556  "Address",
557  "Annote",
558  "Author",
559  "Booktitle",
560  "Chapter",
561  "Edition",
562  "Editor",
563  "Howpublished",
564  "Institution",
565  "Journal",
566  "Month",
567  "Note",
568  "Number",
569  "Organizations",
570  "Pages",
571  "Publisher",
572  "School",
573  "Series",
574  "Title",
575  "Report_Type",
576  "Volume",
577  "Year",
578  "URL",
579  "Custom1",
580  "Custom2",
581  "Custom3",
582  "Custom4",
583  "Custom5",
584  "ISBN"
585 };
586 
587 bool SwAuthorityField::QueryValue( Any& rAny, sal_uInt16 /*nWhichId*/ ) const
588 {
589  if(!GetTyp())
590  return false;
591  if(!m_xAuthEntry)
592  return false;
593  Sequence <PropertyValue> aRet(AUTH_FIELD_END);
594  PropertyValue* pValues = aRet.getArray();
595  for(int i = 0; i < AUTH_FIELD_END; ++i)
596  {
597  pValues[i].Name = OUString::createFromAscii(aFieldNames[i]);
598  const OUString& sField = m_xAuthEntry->GetAuthorField(static_cast<ToxAuthorityField>(i));
600  pValues[i].Value <<= sal_Int16(sField.toInt32());
601  else
602  pValues[i].Value <<= sField;
603  }
604  rAny <<= aRet;
605  /* FIXME: it is weird that we always return false here */
606  return false;
607 }
608 
609 static sal_Int32 lcl_Find(const OUString& rFieldName)
610 {
611  for(sal_Int32 i = 0; i < AUTH_FIELD_END; ++i)
612  if(rFieldName.equalsAscii(aFieldNames[i]))
613  return i;
614  return -1;
615 }
616 
617 bool SwAuthorityField::PutValue( const Any& rAny, sal_uInt16 /*nWhichId*/ )
618 {
619  if(!GetTyp() || !m_xAuthEntry)
620  return false;
621 
622  Sequence <PropertyValue> aParam;
623  if(!(rAny >>= aParam))
624  return false;
625 
626  OUStringBuffer sBuf;
628  OUString sToSet(sBuf.makeStringAndClear());
629  for(const PropertyValue& rParam : std::as_const(aParam))
630  {
631  const sal_Int32 nFound = lcl_Find(rParam.Name);
632  if(nFound >= 0)
633  {
634  OUString sContent;
635  if(AUTH_FIELD_AUTHORITY_TYPE == nFound)
636  {
637  sal_Int16 nVal = 0;
638  rParam.Value >>= nVal;
639  sContent = OUString::number(nVal);
640  }
641  else
642  rParam.Value >>= sContent;
643  sToSet = comphelper::string::setToken(sToSet, nFound, TOX_STYLE_DELIMITER, sContent);
644  }
645  }
646 
647  static_cast<SwAuthorityFieldType*>(GetTyp())->RemoveField(m_xAuthEntry.get());
648  m_xAuthEntry = static_cast<SwAuthorityFieldType*>(GetTyp())->AddField(sToSet);
649 
650  /* FIXME: it is weird that we always return false here */
651  return false;
652 }
653 
655 {
656  SwAuthorityFieldType* pSrcTyp = static_cast<SwAuthorityFieldType*>(GetTyp()),
657  * pDstTyp = static_cast<SwAuthorityFieldType*>(pFieldTyp);
658  if( pSrcTyp != pDstTyp )
659  {
660  const SwAuthEntry* pSrcEntry = m_xAuthEntry.get();
661  pDstTyp->AppendField( *pSrcEntry );
662  pSrcTyp->RemoveField( pSrcEntry );
663  SwField::ChgTyp( pFieldTyp );
664  }
665  return pSrcTyp;
666 }
667 
668 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:240
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:470
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: authfld.cxx:465
Marks a position in the document model.
Definition: pam.hxx:35
const SwField * GetField() const
Definition: fmtfld.hxx:111
bool IsInDocBody() const
Definition: frame.hxx:921
#define UNO_NAME_SORT_KEY
Definition: unoprnms.hxx:523
const OUString & GetText() const
Definition: ndtxt.hxx:211
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:540
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:293
#define TOX_STYLE_DELIMITER
Definition: tox.hxx:391
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1190
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const override
Definition: authfld.cxx:587
Definition: doc.hxx:184
virtual std::unique_ptr< SwField > Copy() const override
Definition: authfld.cxx:529
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:414
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
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
Definition: fldbas.cxx:193
OUString m_aAuthFields[AUTH_FIELD_END]
Definition: authfld.hxx:35
SwDoc * m_pDoc
Definition: docbm.cxx:1190
SwAuthEntry * GetEntryByIdentifier(const OUString &rIdentifier) const
Definition: authfld.cxx:135
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:356
css::uno::Any const & rValue
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId) override
Definition: authfld.cxx:617
sal_uInt16 sal_Unicode
const SwTOXSortKey * GetSortKey(sal_uInt16 nIdx) const
Definition: authfld.cxx:426
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
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
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:460
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:369
rtl::Reference< SwAuthEntry > m_xAuthEntry
Definition: authfld.hxx:150
virtual void QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const override
Definition: authfld.cxx:287
int i
SwDoc * GetDoc()
Definition: authfld.hxx:84
#define FIELD_PROP_BOOL2
Definition: unofldmid.h:29
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:44
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:522
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:396
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:654
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:80
std::vector< SwAuthEntry * > m_SequArrRLHidden
hidden redlines
Definition: authfld.hxx:63
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:334
bool operator==(const SwAuthEntry &rComp) const
Definition: authfld.cxx:56
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
LanguageType GetAppLanguage()
Definition: init.cxx:729
virtual void PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId) override
Definition: authfld.cxx:339
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:609
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2317
SwAuthorityField(SwAuthorityFieldType *pType, const OUString &rFieldContents)
Definition: authfld.cxx:442
const char *const aFieldNames[]
Definition: authfld.cxx:552
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:505
Class for sorting directories.
Definition: txmsrt.hxx:120
const OUString & GetFieldText(ToxAuthorityField eField) const
Definition: authfld.cxx:535
virtual OUString GetDescription() const override
Definition: authfld.cxx:547
sal_uInt16 GetSortKeyCount() const
Definition: authfld.cxx:421
void SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey const nKeys[])
Definition: authfld.cxx:434
OUString m_sSortAlgorithm
Definition: authfld.hxx:70
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, char cFill= '\0')