LibreOffice Module sw (master)  1
docufld.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <config_features.h>
21 
22 #include <textapi.hxx>
23 
24 #include <hintids.hxx>
25 #include <com/sun/star/frame/XModel.hpp>
26 #include <com/sun/star/text/XText.hpp>
27 #include <com/sun/star/script/Converter.hpp>
28 #include <com/sun/star/text/PlaceholderType.hpp>
29 #include <com/sun/star/text/TemplateDisplayFormat.hpp>
30 #include <com/sun/star/text/PageNumberType.hpp>
31 #include <com/sun/star/text/FilenameDisplayFormat.hpp>
32 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
33 #include <com/sun/star/document/XDocumentProperties.hpp>
34 #include <com/sun/star/util/Date.hpp>
35 #include <com/sun/star/util/Duration.hpp>
36 #include <o3tl/any.hxx>
39 #include <comphelper/string.hxx>
40 #include <tools/urlobj.hxx>
41 #include <svl/urihelper.hxx>
42 #include <unotools/useroptions.hxx>
43 #include <unotools/syslocale.hxx>
44 #include <svl/zforlist.hxx>
45 #include <libxml/xmlstring.h>
46 #include <libxml/xmlwriter.h>
47 
48 #include <tools/time.hxx>
49 #include <tools/datetime.hxx>
50 
51 #include <com/sun/star/util/DateTime.hpp>
52 
53 #include <swmodule.hxx>
54 #include <sfx2/docfile.hxx>
55 #include <sfx2/doctempl.hxx>
56 #include <fmtfld.hxx>
57 #include <txtfld.hxx>
58 #include <charfmt.hxx>
59 #include <docstat.hxx>
60 #include <pagedesc.hxx>
61 #include <fmtpdsc.hxx>
62 #include <doc.hxx>
64 #include <IDocumentStatistics.hxx>
67 #include <rootfrm.hxx>
68 #include <pagefrm.hxx>
69 #include <cntfrm.hxx>
70 #include <pam.hxx>
71 #include <viewsh.hxx>
72 #include <dbmgr.hxx>
73 #include <shellres.hxx>
74 #include <docufld.hxx>
75 #include <flddat.hxx>
76 #include <docfld.hxx>
77 #include <ndtxt.hxx>
78 #include <expfld.hxx>
79 #include <poolfmt.hxx>
80 #include <docsh.hxx>
81 #include <unofldmid.h>
82 #include <swunohelper.hxx>
83 #include <strings.hrc>
84 
85 #include <editeng/outlobj.hxx>
86 #include <calbck.hxx>
87 #include <hints.hxx>
88 
89 #define URL_DECODE INetURLObject::DecodeMechanism::Unambiguous
90 
91 using namespace ::com::sun::star;
92 using namespace ::com::sun::star::uno;
93 using namespace nsSwDocInfoSubType;
94 
97  m_nNumberingType( SVX_NUM_ARABIC ),
98  m_bVirtual( false )
99 {
100 }
101 
102 OUString SwPageNumberFieldType::Expand( SvxNumType nFormat, short nOff,
103  sal_uInt16 const nPageNumber, sal_uInt16 const nMaxPage,
104  const OUString& rUserStr, LanguageType nLang ) const
105 {
106  SvxNumType nTmpFormat = (SVX_NUM_PAGEDESC == nFormat) ? m_nNumberingType : nFormat;
107  int const nTmp = nPageNumber + nOff;
108 
109  if (0 > nTmp || SVX_NUM_NUMBER_NONE == nTmpFormat || (!m_bVirtual && nTmp > nMaxPage))
110  return OUString();
111 
112  if( SVX_NUM_CHAR_SPECIAL == nTmpFormat )
113  return rUserStr;
114 
115  return FormatNumber( nTmp, nTmpFormat, nLang );
116 }
117 
118 std::unique_ptr<SwFieldType> SwPageNumberFieldType::Copy() const
119 {
120  std::unique_ptr<SwPageNumberFieldType> pTmp(new SwPageNumberFieldType());
121 
122  pTmp->m_nNumberingType = m_nNumberingType;
123  pTmp->m_bVirtual = m_bVirtual;
124 
125  return pTmp;
126 }
127 
129  bool bVirt,
130  const SvxNumType* pNumFormat )
131 {
132  if( pNumFormat )
133  m_nNumberingType = *pNumFormat;
134 
135  m_bVirtual = false;
136  if (bVirt && pDoc)
137  {
138  // check the flag since the layout NEVER sets it back
139  const SfxItemPool &rPool = pDoc->GetAttrPool();
140  for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(RES_PAGEDESC))
141  {
142  auto pDesc = dynamic_cast<const SwFormatPageDesc*>(pItem);
143  if( pDesc && pDesc->GetNumOffset() && pDesc->GetDefinedIn() )
144  {
145  const SwContentNode* pNd = dynamic_cast<const SwContentNode*>( pDesc->GetDefinedIn() );
146  if( pNd )
147  {
149  // sw_redlinehide: not sure if this should happen only if
150  // it's the first node, because that's where RES_PAGEDESC
151  // is effective?
152  m_bVirtual = true;
153  }
154  else if( dynamic_cast< const SwFormat* >(pDesc->GetDefinedIn()) != nullptr)
155  {
156  SwAutoFormatGetDocNode aGetHt( &pDoc->GetNodes() );
157  m_bVirtual = !pDesc->GetDefinedIn()->GetInfo( aGetHt );
158  break;
159  }
160  }
161  }
162  }
163 }
164 
166  sal_uInt16 nSub, sal_uInt32 nFormat, short nOff,
167  sal_uInt16 const nPageNumber, sal_uInt16 const nMaxPage)
168  : SwField(pTyp, nFormat), m_nSubType(nSub), m_nOffset(nOff)
169  , m_nPageNumber(nPageNumber)
170  , m_nMaxPage(nMaxPage)
171 {
172 }
173 
174 void SwPageNumberField::ChangeExpansion(sal_uInt16 const nPageNumber,
175  sal_uInt16 const nMaxPage)
176 {
177  m_nPageNumber = nPageNumber;
178  m_nMaxPage = nMaxPage;
179 }
180 
181 OUString SwPageNumberField::ExpandImpl(SwRootFrame const*const) const
182 {
183  OUString sRet;
184  SwPageNumberFieldType* pFieldType = static_cast<SwPageNumberFieldType*>(GetTyp());
185 
186  if( PG_NEXT == m_nSubType && 1 != m_nOffset )
187  {
188  sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), 1, m_nPageNumber, m_nMaxPage, m_sUserStr, GetLanguage());
189  if (!sRet.isEmpty())
190  {
191  sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), m_nOffset, m_nPageNumber, m_nMaxPage, m_sUserStr, GetLanguage());
192  }
193  }
194  else if( PG_PREV == m_nSubType && -1 != m_nOffset )
195  {
196  sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), -1, m_nPageNumber, m_nMaxPage, m_sUserStr, GetLanguage());
197  if (!sRet.isEmpty())
198  {
199  sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), m_nOffset, m_nPageNumber, m_nMaxPage, m_sUserStr, GetLanguage());
200  }
201  }
202  else
203  sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), m_nOffset, m_nPageNumber, m_nMaxPage, m_sUserStr, GetLanguage());
204  return sRet;
205 }
206 
207 std::unique_ptr<SwField> SwPageNumberField::Copy() const
208 {
209  std::unique_ptr<SwPageNumberField> pTmp(new SwPageNumberField(
210  static_cast<SwPageNumberFieldType*>(GetTyp()), m_nSubType,
212  pTmp->SetLanguage( GetLanguage() );
213  pTmp->SetUserString( m_sUserStr );
214  return std::unique_ptr<SwField>(pTmp.release());
215 }
216 
218 {
219  return OUString::number(m_nOffset);
220 }
221 
222 void SwPageNumberField::SetPar2(const OUString& rStr)
223 {
224  m_nOffset = static_cast<short>(rStr.toInt32());
225 }
226 
228 {
229  return m_nSubType;
230 }
231 
232 bool SwPageNumberField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
233 {
234  switch( nWhichId )
235  {
236  case FIELD_PROP_FORMAT:
237  rAny <<= static_cast<sal_Int16>(GetFormat());
238  break;
239  case FIELD_PROP_USHORT1:
240  rAny <<= m_nOffset;
241  break;
242  case FIELD_PROP_SUBTYPE:
243  {
244  text::PageNumberType eType;
245  eType = text::PageNumberType_CURRENT;
246  if(m_nSubType == PG_PREV)
247  eType = text::PageNumberType_PREV;
248  else if(m_nSubType == PG_NEXT)
249  eType = text::PageNumberType_NEXT;
250  rAny <<= eType;
251  }
252  break;
253  case FIELD_PROP_PAR1:
254  rAny <<= m_sUserStr;
255  break;
256 
257  default:
258  assert(false);
259  }
260  return true;
261 }
262 
263 bool SwPageNumberField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
264 {
265  bool bRet = true;
266  sal_Int16 nSet = 0;
267  switch( nWhichId )
268  {
269  case FIELD_PROP_FORMAT:
270  rAny >>= nSet;
271 
272  // TODO: where do the defines come from?
273  if(nSet <= SVX_NUM_PAGEDESC )
274  SetFormat(nSet);
275  break;
276  case FIELD_PROP_USHORT1:
277  rAny >>= nSet;
278  m_nOffset = nSet;
279  break;
280  case FIELD_PROP_SUBTYPE:
281  switch( static_cast<text::PageNumberType>(SWUnoHelper::GetEnumAsInt32( rAny )) )
282  {
283  case text::PageNumberType_CURRENT:
285  break;
286  case text::PageNumberType_PREV:
288  break;
289  case text::PageNumberType_NEXT:
291  break;
292  default:
293  bRet = false;
294  }
295  break;
296  case FIELD_PROP_PAR1:
297  rAny >>= m_sUserStr;
298  break;
299 
300  default:
301  assert(false);
302  }
303  return bRet;
304 }
305 
308 {
309 }
310 
312 {
313  SvtUserOptions& rOpt = SW_MOD()->GetUserOptions();
314  if((nFormat & 0xff) == AF_NAME)
315  return rOpt.GetFullName();
316 
317  return rOpt.GetID();
318 }
319 
320 std::unique_ptr<SwFieldType> SwAuthorFieldType::Copy() const
321 {
322  return std::make_unique<SwAuthorFieldType>();
323 }
324 
326  : SwField(pTyp, nFormat)
327 {
329 }
330 
331 OUString SwAuthorField::ExpandImpl(SwRootFrame const*const) const
332 {
333  if (!IsFixed())
334  const_cast<SwAuthorField*>(this)->m_aContent =
336 
337  return m_aContent;
338 }
339 
340 std::unique_ptr<SwField> SwAuthorField::Copy() const
341 {
342  std::unique_ptr<SwAuthorField> pTmp(new SwAuthorField( static_cast<SwAuthorFieldType*>(GetTyp()),
343  GetFormat()));
344  pTmp->SetExpansion(m_aContent);
345  return std::unique_ptr<SwField>(pTmp.release());
346 }
347 
348 bool SwAuthorField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
349 {
350  switch( nWhichId )
351  {
352  case FIELD_PROP_BOOL1:
353  rAny <<= (GetFormat() & 0xff) == AF_NAME;
354  break;
355 
356  case FIELD_PROP_BOOL2:
357  rAny <<= IsFixed();
358  break;
359 
360  case FIELD_PROP_PAR1:
361  rAny <<= m_aContent;
362  break;
363 
364  default:
365  assert(false);
366  }
367  return true;
368 }
369 
370 bool SwAuthorField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
371 {
372  switch( nWhichId )
373  {
374  case FIELD_PROP_BOOL1:
375  SetFormat( *o3tl::doAccess<bool>(rAny) ? AF_NAME : AF_SHORTCUT );
376  break;
377 
378  case FIELD_PROP_BOOL2:
379  if( *o3tl::doAccess<bool>(rAny) )
381  else
383  break;
384 
385  case FIELD_PROP_PAR1:
386  rAny >>= m_aContent;
387  break;
388 
389  default:
390  assert(false);
391  }
392  return true;
393 }
394 
397 {
398  m_pDoc = pDocument;
399 }
400 
401 OUString SwFileNameFieldType::Expand(sal_uLong nFormat) const
402 {
403  OUString aRet;
404  const SwDocShell* pDShell = m_pDoc->GetDocShell();
405  if( pDShell && pDShell->HasName() )
406  {
407  const INetURLObject& rURLObj = pDShell->GetMedium()->GetURLObject();
408  switch( nFormat & ~FF_FIXED )
409  {
410  case FF_PATH:
411  {
412  if( INetProtocol::File == rURLObj.GetProtocol() )
413  {
414  INetURLObject aTemp(rURLObj);
415  aTemp.removeSegment();
416  // last slash should belong to the pathname
417  aRet = aTemp.PathToFileName();
418  }
419  else
420  {
424  const sal_Int32 nPos = aRet.indexOf(rURLObj.GetLastName( URL_DECODE ));
425  if (nPos>=0)
426  {
427  aRet = aRet.copy(0, nPos);
428  }
429  }
430  }
431  break;
432 
433  case FF_NAME:
435  break;
436 
437  case FF_NAME_NOEXT:
438  aRet = rURLObj.GetBase();
439  break;
440 
441  default:
442  if( INetProtocol::File == rURLObj.GetProtocol() )
443  aRet = rURLObj.GetFull();
444  else
448  }
449  }
450  return aRet;
451 }
452 
453 std::unique_ptr<SwFieldType> SwFileNameFieldType::Copy() const
454 {
455  return std::make_unique<SwFileNameFieldType>(m_pDoc);
456 }
457 
459  : SwField(pTyp, nFormat)
460 {
461  m_aContent = static_cast<SwFileNameFieldType*>(GetTyp())->Expand(GetFormat());
462 }
463 
464 OUString SwFileNameField::ExpandImpl(SwRootFrame const*const) const
465 {
466  if (!IsFixed())
467  const_cast<SwFileNameField*>(this)->m_aContent = static_cast<SwFileNameFieldType*>(GetTyp())->Expand(GetFormat());
468 
469  return m_aContent;
470 }
471 
472 std::unique_ptr<SwField> SwFileNameField::Copy() const
473 {
474  std::unique_ptr<SwFileNameField> pTmp(
475  new SwFileNameField(static_cast<SwFileNameFieldType*>(GetTyp()), GetFormat()));
476  pTmp->SetExpansion(m_aContent);
477 
478  return std::unique_ptr<SwField>(pTmp.release());
479 }
480 
481 bool SwFileNameField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
482 {
483  switch( nWhichId )
484  {
485  case FIELD_PROP_FORMAT:
486  {
487  sal_Int16 nRet;
488  switch( GetFormat() &(~FF_FIXED) )
489  {
490  case FF_PATH:
491  nRet = text::FilenameDisplayFormat::PATH;
492  break;
493  case FF_NAME_NOEXT:
495  break;
496  case FF_NAME:
497  nRet = text::FilenameDisplayFormat::NAME_AND_EXT;
498  break;
499  default: nRet = text::FilenameDisplayFormat::FULL;
500  }
501  rAny <<= nRet;
502  }
503  break;
504 
505  case FIELD_PROP_BOOL2:
506  rAny <<= IsFixed();
507  break;
508 
509  case FIELD_PROP_PAR3:
510  rAny <<= m_aContent;
511  break;
512 
513  default:
514  assert(false);
515  }
516  return true;
517 }
518 
519 bool SwFileNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
520 {
521  switch( nWhichId )
522  {
523  case FIELD_PROP_FORMAT:
524  {
525  //JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
526  // called with a int32 value! But normally we need
527  // here only a int16
528  sal_Int32 nType = 0;
529  rAny >>= nType;
530  bool bFixed = IsFixed();
531  switch( nType )
532  {
533  case text::FilenameDisplayFormat::PATH:
534  nType = FF_PATH;
535  break;
537  nType = FF_NAME_NOEXT;
538  break;
539  case text::FilenameDisplayFormat::NAME_AND_EXT:
540  nType = FF_NAME;
541  break;
542  default: nType = FF_PATHNAME;
543  }
544  if(bFixed)
545  nType |= FF_FIXED;
546  SetFormat(nType);
547  }
548  break;
549 
550  case FIELD_PROP_BOOL2:
551  if( *o3tl::doAccess<bool>(rAny) )
553  else
555  break;
556 
557  case FIELD_PROP_PAR3:
558  rAny >>= m_aContent;
559  break;
560 
561  default:
562  assert(false);
563  }
564  return true;
565 }
566 
569 {
570  m_pDoc = pDocument;
571 }
572 
574 {
575  OSL_ENSURE( nFormat < FF_END, "Expand: no valid Format!" );
576 
577  OUString aRet;
578  SwDocShell *pDocShell(m_pDoc->GetDocShell());
579  OSL_ENSURE(pDocShell, "no SwDocShell");
580  if (pDocShell) {
581  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
582  pDocShell->GetModel(), uno::UNO_QUERY_THROW);
583  uno::Reference<document::XDocumentProperties> xDocProps(
584  xDPS->getDocumentProperties());
585  OSL_ENSURE(xDocProps.is(), "Doc has no DocumentProperties");
586 
587  if( FF_UI_NAME == nFormat )
588  aRet = xDocProps->getTemplateName();
589  else if( !xDocProps->getTemplateURL().isEmpty() )
590  {
591  if( FF_UI_RANGE == nFormat )
592  {
593  // for getting region names!
595  OUString sTmp;
596  OUString sRegion;
597  aFac.GetLogicNames( xDocProps->getTemplateURL(), sRegion, sTmp );
598  aRet = sRegion;
599  }
600  else
601  {
602  INetURLObject aPathName( xDocProps->getTemplateURL() );
603  if( FF_NAME == nFormat )
604  aRet = aPathName.GetLastName(URL_DECODE);
605  else if( FF_NAME_NOEXT == nFormat )
606  aRet = aPathName.GetBase();
607  else
608  {
609  if( FF_PATH == nFormat )
610  {
611  aPathName.removeSegment();
612  aRet = aPathName.GetFull();
613  }
614  else
615  aRet = aPathName.GetFull();
616  }
617  }
618  }
619  }
620  return aRet;
621 }
622 
623 std::unique_ptr<SwFieldType> SwTemplNameFieldType::Copy() const
624 {
625  return std::make_unique<SwTemplNameFieldType>(m_pDoc);
626 }
627 
629  : SwField(pTyp, nFormat)
630 {}
631 
632 OUString SwTemplNameField::ExpandImpl(SwRootFrame const*const) const
633 {
634  return static_cast<SwTemplNameFieldType*>(GetTyp())->Expand(GetFormat());
635 }
636 
637 std::unique_ptr<SwField> SwTemplNameField::Copy() const
638 {
639  return std::make_unique<SwTemplNameField>(static_cast<SwTemplNameFieldType*>(GetTyp()), GetFormat());
640 }
641 
642 bool SwTemplNameField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
643 {
644  switch ( nWhichId )
645  {
646  case FIELD_PROP_FORMAT:
647  {
648  sal_Int16 nRet;
649  switch( GetFormat() )
650  {
651  case FF_PATH: nRet = text::FilenameDisplayFormat::PATH; break;
653  case FF_NAME: nRet = text::FilenameDisplayFormat::NAME_AND_EXT; break;
654  case FF_UI_RANGE: nRet = text::TemplateDisplayFormat::AREA; break;
655  case FF_UI_NAME: nRet = text::TemplateDisplayFormat::TITLE; break;
656  default: nRet = text::FilenameDisplayFormat::FULL;
657 
658  }
659  rAny <<= nRet;
660  }
661  break;
662 
663  default:
664  assert(false);
665  }
666  return true;
667 }
668 
669 bool SwTemplNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
670 {
671  switch ( nWhichId )
672  {
673  case FIELD_PROP_FORMAT:
674  {
675  //JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
676  // called with a int32 value! But normally we need
677  // here only a int16
678  sal_Int32 nType = 0;
679  rAny >>= nType;
680  switch( nType )
681  {
682  case text::FilenameDisplayFormat::PATH:
684  break;
687  break;
688  case text::FilenameDisplayFormat::NAME_AND_EXT:
690  break;
691  case text::TemplateDisplayFormat::AREA :
693  break;
694  case text::TemplateDisplayFormat::TITLE :
696  break;
697  default: SetFormat(FF_PATHNAME);
698  }
699  }
700  break;
701 
702  default:
703  assert(false);
704  }
705  return true;
706 }
707 
709  : SwFieldType( SwFieldIds::DocStat ), m_nNumberingType( SVX_NUM_ARABIC )
710 {
711  m_pDoc = pDocument;
712 }
713 
714 OUString SwDocStatFieldType::Expand(sal_uInt16 nSubType, SvxNumType nFormat) const
715 {
716  sal_uInt32 nVal = 0;
717  const SwDocStat& rDStat = m_pDoc->getIDocumentStatistics().GetDocStat();
718  switch( nSubType )
719  {
720  case DS_TBL: nVal = rDStat.nTable; break;
721  case DS_GRF: nVal = rDStat.nGrf; break;
722  case DS_OLE: nVal = rDStat.nOLE; break;
723  case DS_PARA: nVal = rDStat.nPara; break;
724  case DS_WORD: nVal = rDStat.nWord; break;
725  case DS_CHAR: nVal = rDStat.nChar; break;
726  case DS_PAGE:
728  const_cast<SwDocStat &>(rDStat).nPage = m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetPageNum();
729  nVal = rDStat.nPage;
730  if( SVX_NUM_PAGEDESC == nFormat )
731  nFormat = m_nNumberingType;
732  break;
733  default:
734  OSL_FAIL( "SwDocStatFieldType::Expand: unknown SubType" );
735  }
736 
737  if( nVal <= SHRT_MAX )
738  return FormatNumber( nVal, nFormat );
739 
740  return OUString::number( nVal );
741 }
742 
743 std::unique_ptr<SwFieldType> SwDocStatFieldType::Copy() const
744 {
745  return std::make_unique<SwDocStatFieldType>(m_pDoc);
746 }
747 
753 SwDocStatField::SwDocStatField(SwDocStatFieldType* pTyp, sal_uInt16 nSub, sal_uInt32 nFormat)
754  : SwField(pTyp, nFormat),
755  m_nSubType(nSub)
756 {}
757 
758 OUString SwDocStatField::ExpandImpl(SwRootFrame const*const) const
759 {
760  return static_cast<SwDocStatFieldType*>(GetTyp())->Expand(m_nSubType, static_cast<SvxNumType>(GetFormat()));
761 }
762 
763 std::unique_ptr<SwField> SwDocStatField::Copy() const
764 {
765  return std::make_unique<SwDocStatField>(
766  static_cast<SwDocStatFieldType*>(GetTyp()), m_nSubType, GetFormat() );
767 }
768 
769 sal_uInt16 SwDocStatField::GetSubType() const
770 {
771  return m_nSubType;
772 }
773 
774 void SwDocStatField::SetSubType(sal_uInt16 nSub)
775 {
776  m_nSubType = nSub;
777 }
778 
780 {
782  static_cast<SwDocStatFieldType*>(GetTyp())->SetNumFormat(
784 }
785 
786 bool SwDocStatField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
787 {
788  switch ( nWhichId )
789  {
790  case FIELD_PROP_USHORT2:
791  rAny <<= static_cast<sal_Int16>(GetFormat());
792  break;
793 
794  default:
795  assert(false);
796  }
797  return true;
798 }
799 
800 bool SwDocStatField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
801 {
802  bool bRet = false;
803  switch ( nWhichId )
804  {
805  case FIELD_PROP_USHORT2:
806  {
807  sal_Int16 nSet = 0;
808  rAny >>= nSet;
809  if(nSet <= SVX_NUM_CHARS_LOWER_LETTER_N &&
810  nSet != SVX_NUM_CHAR_SPECIAL &&
811  nSet != SVX_NUM_BITMAP)
812  {
813  SetFormat(nSet);
814  bRet = true;
815  }
816  }
817  break;
818 
819  default:
820  assert(false);
821  }
822  return bRet;
823 }
824 
825 // Document info field type
826 
829 {
830 }
831 
832 std::unique_ptr<SwFieldType> SwDocInfoFieldType::Copy() const
833 {
834  return std::make_unique<SwDocInfoFieldType>(GetDoc());
835 }
836 
838  const LocaleDataWrapper **ppAppLocalData,
839  const LocaleDataWrapper **ppLocalData )
840 {
841  SvtSysLocale aLocale;
842  *ppAppLocalData = &aLocale.GetLocaleData();
843  *ppLocalData = *ppAppLocalData;
844  if( nLang != (*ppLocalData)->getLanguageTag().getLanguageType() )
845  *ppLocalData = new LocaleDataWrapper(LanguageTag( nLang ));
846 }
847 
848 OUString SwDocInfoFieldType::Expand( sal_uInt16 nSub, sal_uInt32 nFormat,
849  LanguageType nLang, const OUString& rName ) const
850 {
851  const LocaleDataWrapper *pAppLocalData = nullptr, *pLocalData = nullptr;
852  SwDocShell *pDocShell(GetDoc()->GetDocShell());
853  OSL_ENSURE(pDocShell, "no SwDocShell");
854  if (!pDocShell) { return OUString(); }
855 
856  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
857  pDocShell->GetModel(), uno::UNO_QUERY_THROW);
858  uno::Reference<document::XDocumentProperties> xDocProps(
859  xDPS->getDocumentProperties());
860  OSL_ENSURE(xDocProps.is(), "Doc has no DocumentProperties");
861 
862  sal_uInt16 nExtSub = nSub & 0xff00;
863  nSub &= 0xff; // do not consider extended SubTypes
864 
865  OUString aStr;
866  switch(nSub)
867  {
868  case DI_TITLE: aStr = xDocProps->getTitle(); break;
869  case DI_SUBJECT:aStr = xDocProps->getSubject(); break;
870  case DI_KEYS: aStr = ::comphelper::string::convertCommaSeparated(
871  xDocProps->getKeywords());
872  break;
873  case DI_COMMENT:aStr = xDocProps->getDescription(); break;
874  case DI_DOCNO: aStr = OUString::number(
875  xDocProps->getEditingCycles() );
876  break;
877  case DI_EDIT:
878  if ( !nFormat )
879  {
880  lcl_GetLocalDataWrapper( nLang, &pAppLocalData, &pLocalData );
881  sal_Int32 dur = xDocProps->getEditingDuration();
882  // If Seconds > 0 then bSec should be TRUE otherwise Seconds
883  // information will be lost if file has EditTime in Seconds format.
884  aStr = pLocalData->getTime( tools::Time(dur/3600, (dur%3600)/60, dur%60),
885  dur%60 > 0);
886  }
887  else
888  {
889  sal_Int32 dur = xDocProps->getEditingDuration();
890  double fVal = tools::Time(dur/3600, (dur%3600)/60, dur%60).GetTimeInDays();
891  aStr = ExpandValue(fVal, nFormat, nLang);
892  }
893  break;
894  case DI_CUSTOM:
895  {
896  OUString sVal;
897  try
898  {
899  uno::Any aAny;
900  uno::Reference < beans::XPropertySet > xSet(
901  xDocProps->getUserDefinedProperties(),
902  uno::UNO_QUERY_THROW);
903  aAny = xSet->getPropertyValue( rName );
904 
905  uno::Reference < script::XTypeConverter > xConverter( script::Converter::create(comphelper::getProcessComponentContext()) );
906  uno::Any aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING );
907  aNew >>= sVal;
908  }
909  catch (uno::Exception&) {}
910  return sVal;
911  }
912 
913  default:
914  {
915  OUString aName( xDocProps->getAuthor() );
916  util::DateTime uDT( xDocProps->getCreationDate() );
917  DateTime aDate(uDT);
918  if( nSub == DI_CREATE )
919  ; // that's it !!
920  else if( nSub == DI_CHANGE )
921  {
922  aName = xDocProps->getModifiedBy();
923  uDT = xDocProps->getModificationDate();
924  aDate = DateTime(uDT);
925  }
926  else if( nSub == DI_PRINT )
927  {
928  aName = xDocProps->getPrintedBy();
929  uDT = xDocProps->getPrintDate();
930  aDate = DateTime(uDT);
931  }
932  else
933  break;
934 
935  if (aDate.IsValidAndGregorian())
936  {
937  switch (nExtSub & ~DI_SUB_FIXED)
938  {
939  case DI_SUB_AUTHOR:
940  aStr = aName;
941  break;
942 
943  case DI_SUB_TIME:
944  if (!nFormat)
945  {
946  lcl_GetLocalDataWrapper( nLang, &pAppLocalData,
947  &pLocalData );
948  aStr = pLocalData->getTime( aDate,
949  false);
950  }
951  else
952  {
953  // start the number formatter
954  double fVal = SwDateTimeField::GetDateTime( GetDoc(),
955  aDate);
956  aStr = ExpandValue(fVal, nFormat, nLang);
957  }
958  break;
959 
960  case DI_SUB_DATE:
961  if (!nFormat)
962  {
963  lcl_GetLocalDataWrapper( nLang, &pAppLocalData,
964  &pLocalData );
965  aStr = pLocalData->getDate( aDate );
966  }
967  else
968  {
969  // start the number formatter
970  double fVal = SwDateTimeField::GetDateTime( GetDoc(),
971  aDate);
972  aStr = ExpandValue(fVal, nFormat, nLang);
973  }
974  break;
975  }
976  }
977  }
978  break;
979  }
980 
981  if( pAppLocalData != pLocalData )
982  delete pLocalData;
983 
984  return aStr;
985 }
986 
987 // document info field
988 
989 SwDocInfoField::SwDocInfoField(SwDocInfoFieldType* pTyp, sal_uInt16 nSub, const OUString& rName, sal_uInt32 nFormat) :
990  SwValueField(pTyp, nFormat), m_nSubType(nSub)
991 {
992  m_aName = rName;
993  m_aContent = static_cast<SwDocInfoFieldType*>(GetTyp())->Expand(m_nSubType, nFormat, GetLanguage(), m_aName);
994 }
995 
996 SwDocInfoField::SwDocInfoField(SwDocInfoFieldType* pTyp, sal_uInt16 nSub, const OUString& rName, const OUString& rValue, sal_uInt32 nFormat) :
997  SwValueField(pTyp, nFormat), m_nSubType(nSub)
998 {
999  m_aName = rName;
1000  m_aContent = rValue;
1001 }
1002 
1003 template<class T>
1004 static double lcl_TimeToDouble( const T& rTime )
1005 {
1006  const double fNanoSecondsPerDay = 86400000000000.0;
1007  return ( (rTime.Hours * SAL_CONST_INT64(3600000000000))
1008  + (rTime.Minutes * SAL_CONST_INT64( 60000000000))
1009  + (rTime.Seconds * SAL_CONST_INT64( 1000000000))
1010  + (rTime.NanoSeconds))
1011  / fNanoSecondsPerDay;
1012 }
1013 
1014 template<class D>
1015 static double lcl_DateToDouble( const D& rDate, const Date& rNullDate )
1016 {
1017  long nDate = Date::DateToDays( rDate.Day, rDate.Month, rDate.Year );
1018  long nNullDate = Date::DateToDays( rNullDate.GetDay(), rNullDate.GetMonth(), rNullDate.GetYear() );
1019  return double( nDate - nNullDate );
1020 }
1021 
1022 OUString SwDocInfoField::ExpandImpl(SwRootFrame const*const) const
1023 {
1024  if ( ( m_nSubType & 0xFF ) == DI_CUSTOM )
1025  {
1026  // custom properties currently need special treatment
1027  // We don't have a secure way to detect "real" custom properties in Word import of text
1028  // fields, so we treat *every* unknown property as a custom property, even the "built-in"
1029  // section in Word's document summary information stream as these properties have not been
1030  // inserted when the document summary information was imported, we do it here.
1031  // This approach is still a lot better than the old one to import such fields as
1032  // "user fields" and simple text
1033  SwDocShell* pDocShell = GetDoc()->GetDocShell();
1034  if( !pDocShell )
1035  return m_aContent;
1036  try
1037  {
1038  uno::Reference<document::XDocumentPropertiesSupplier> xDPS( pDocShell->GetModel(), uno::UNO_QUERY_THROW);
1039  uno::Reference<document::XDocumentProperties> xDocProps( xDPS->getDocumentProperties());
1040  uno::Reference < beans::XPropertySet > xSet( xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
1041  uno::Reference < beans::XPropertySetInfo > xSetInfo = xSet->getPropertySetInfo();
1042 
1043  uno::Any aAny;
1044  if( xSetInfo->hasPropertyByName( m_aName ) )
1045  aAny = xSet->getPropertyValue( m_aName );
1046  if ( aAny.getValueType() != cppu::UnoType<void>::get() )
1047  {
1048  // "void" type means that the property has not been inserted until now
1049  if ( !IsFixed() )
1050  {
1051  // if the field is "fixed" we don't update it from the property
1052  OUString sVal;
1053  uno::Reference < script::XTypeConverter > xConverter( script::Converter::create(comphelper::getProcessComponentContext()) );
1054  util::Date aDate;
1055  util::DateTime aDateTime;
1056  util::Duration aDuration;
1057  if( aAny >>= aDate)
1058  {
1059  SvNumberFormatter* pFormatter = pDocShell->GetDoc()->GetNumberFormatter();
1060  const Date& rNullDate = pFormatter->GetNullDate();
1061  sVal = ExpandValue( lcl_DateToDouble<util::Date>( aDate, rNullDate ), GetFormat(), GetLanguage());
1062  }
1063  else if( aAny >>= aDateTime )
1064  {
1065  double fDateTime = lcl_TimeToDouble<util::DateTime>( aDateTime );
1066  SvNumberFormatter* pFormatter = pDocShell->GetDoc()->GetNumberFormatter();
1067  const Date& rNullDate = pFormatter->GetNullDate();
1068  fDateTime += lcl_DateToDouble<util::DateTime>( aDateTime, rNullDate );
1069  sVal = ExpandValue( fDateTime, GetFormat(), GetLanguage());
1070  }
1071  else if( aAny >>= aDuration )
1072  {
1073  sVal = OUStringChar(aDuration.Negative ? '-' : '+')
1075  sVal = sVal.replaceFirst("%1", OUString::number( aDuration.Years ) );
1076  sVal = sVal.replaceFirst("%2", OUString::number( aDuration.Months ) );
1077  sVal = sVal.replaceFirst("%3", OUString::number( aDuration.Days ) );
1078  sVal = sVal.replaceFirst("%4", OUString::number( aDuration.Hours ) );
1079  sVal = sVal.replaceFirst("%5", OUString::number( aDuration.Minutes) );
1080  sVal = sVal.replaceFirst("%6", OUString::number( aDuration.Seconds) );
1081  }
1082  else
1083  {
1084  uno::Any aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING );
1085  aNew >>= sVal;
1086  }
1087  const_cast<SwDocInfoField*>(this)->m_aContent = sVal;
1088  }
1089  }
1090  }
1091  catch (uno::Exception&) {}
1092  }
1093  else if ( !IsFixed() )
1094  const_cast<SwDocInfoField*>(this)->m_aContent = static_cast<SwDocInfoFieldType*>(GetTyp())->Expand(m_nSubType, GetFormat(), GetLanguage(), m_aName);
1095 
1096  return m_aContent;
1097 }
1098 
1100 {
1101  OUString aStr(SwFieldType::GetTypeStr(GetTypeId()) + ":");
1102 
1103  sal_uInt16 const nSub = m_nSubType & 0xff;
1104 
1105  switch (nSub)
1106  {
1107  case DI_CUSTOM:
1108  aStr += m_aName;
1109  break;
1110 
1111  default:
1112  aStr += SwViewShell::GetShellRes()
1113  ->aDocInfoLst[ nSub - DI_SUBTYPE_BEGIN ];
1114  break;
1115  }
1116  if (IsFixed())
1117  {
1118  aStr += " " + SwViewShell::GetShellRes()->aFixedStr;
1119  }
1120  return aStr;
1121 }
1122 
1123 std::unique_ptr<SwField> SwDocInfoField::Copy() const
1124 {
1125  std::unique_ptr<SwDocInfoField> pField(new SwDocInfoField(static_cast<SwDocInfoFieldType*>(GetTyp()), m_nSubType, m_aName, GetFormat()));
1126  pField->SetAutomaticLanguage(IsAutomaticLanguage());
1127  pField->m_aContent = m_aContent;
1128 
1129  return std::unique_ptr<SwField>(pField.release());
1130 }
1131 
1132 sal_uInt16 SwDocInfoField::GetSubType() const
1133 {
1134  return m_nSubType;
1135 }
1136 
1137 void SwDocInfoField::SetSubType(sal_uInt16 nSub)
1138 {
1139  m_nSubType = nSub;
1140 }
1141 
1143 {
1144  if (!GetFormat())
1145  SwField::SetLanguage(nLng);
1146  else
1148 }
1149 
1150 bool SwDocInfoField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
1151 {
1152  switch( nWhichId )
1153  {
1154  case FIELD_PROP_PAR1:
1155  rAny <<= m_aContent;
1156  break;
1157 
1158  case FIELD_PROP_PAR4:
1159  rAny <<= m_aName;
1160  break;
1161 
1162  case FIELD_PROP_USHORT1:
1163  rAny <<= static_cast<sal_Int16>(m_aContent.toInt32());
1164  break;
1165 
1166  case FIELD_PROP_BOOL1:
1167  rAny <<= 0 != (m_nSubType & DI_SUB_FIXED);
1168  break;
1169 
1170  case FIELD_PROP_FORMAT:
1171  rAny <<= static_cast<sal_Int32>(GetFormat());
1172  break;
1173 
1174  case FIELD_PROP_DOUBLE:
1175  {
1176  double fVal = GetValue();
1177  rAny <<= fVal;
1178  }
1179  break;
1180  case FIELD_PROP_PAR3:
1181  rAny <<= ExpandImpl(nullptr);
1182  break;
1183  case FIELD_PROP_BOOL2:
1184  {
1185  sal_uInt16 nExtSub = (m_nSubType & 0xff00) & ~DI_SUB_FIXED;
1186  rAny <<= nExtSub == DI_SUB_DATE;
1187  }
1188  break;
1189  default:
1190  return SwField::QueryValue(rAny, nWhichId);
1191  }
1192  return true;
1193 }
1194 
1195 bool SwDocInfoField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
1196 {
1197  sal_Int32 nValue = 0;
1198  switch( nWhichId )
1199  {
1200  case FIELD_PROP_PAR1:
1201  if( m_nSubType & DI_SUB_FIXED )
1202  rAny >>= m_aContent;
1203  break;
1204 
1205  case FIELD_PROP_USHORT1:
1206  if( m_nSubType & DI_SUB_FIXED )
1207  {
1208  rAny >>= nValue;
1209  m_aContent = OUString::number(nValue);
1210  }
1211  break;
1212 
1213  case FIELD_PROP_BOOL1:
1214  if(*o3tl::doAccess<bool>(rAny))
1216  else
1217  m_nSubType &= ~DI_SUB_FIXED;
1218  break;
1219  case FIELD_PROP_FORMAT:
1220  {
1221  rAny >>= nValue;
1222  if( nValue >= 0)
1223  SetFormat(nValue);
1224  }
1225  break;
1226 
1227  case FIELD_PROP_PAR3:
1228  rAny >>= m_aContent;
1229  break;
1230  case FIELD_PROP_BOOL2:
1231  m_nSubType &= 0xf0ff;
1232  if(*o3tl::doAccess<bool>(rAny))
1234  else
1236  break;
1237  default:
1238  return SwField::PutValue(rAny, nWhichId);
1239  }
1240  return true;
1241 }
1242 
1244  : SwFieldType( SwFieldIds::HiddenText ), m_bHidden( bSetHidden )
1245 {
1246 }
1247 
1248 std::unique_ptr<SwFieldType> SwHiddenTextFieldType::Copy() const
1249 {
1250  return std::make_unique<SwHiddenTextFieldType>( m_bHidden );
1251 }
1252 
1254 {
1255  if( m_bHidden != bSetHidden )
1256  {
1257  m_bHidden = bSetHidden;
1258  UpdateFields(); // notify all HiddenTexts
1259  }
1260 }
1261 
1263  bool bConditional,
1264  const OUString& rCond,
1265  const OUString& rStr,
1266  bool bHidden,
1267  SwFieldTypesEnum nSub) :
1268  SwField( pFieldType ), m_aCond(rCond), m_nSubType(nSub),
1269  m_bCanToggle(bConditional), m_bIsHidden(bHidden), m_bValid(false)
1270 {
1272  {
1273  sal_Int32 nPos = 0;
1274  m_aTRUEText = rStr.getToken(0, '|', nPos);
1275 
1276  if(nPos != -1)
1277  {
1278  m_aFALSEText = rStr.getToken(0, '|', nPos);
1279  if(nPos != -1)
1280  {
1281  m_aContent = rStr.getToken(0, '|', nPos);
1282  m_bValid = true;
1283  }
1284  }
1285  }
1286  else
1287  m_aTRUEText = rStr;
1288 }
1289 
1291  const OUString& rCond,
1292  const OUString& rTrue,
1293  const OUString& rFalse,
1294  SwFieldTypesEnum nSub)
1295  : SwField( pFieldType ), m_aTRUEText(rTrue), m_aFALSEText(rFalse), m_aCond(rCond), m_nSubType(nSub),
1296  m_bIsHidden(true), m_bValid(false)
1297 {
1298  m_bCanToggle = !m_aCond.isEmpty();
1299 }
1300 
1301 OUString SwHiddenTextField::ExpandImpl(SwRootFrame const*const) const
1302 {
1303  // Type: !Hidden -> show always
1304  // Hide -> evaluate condition
1305 
1307  {
1308  if( m_bValid )
1309  return m_aContent;
1310 
1311  if( m_bCanToggle && !m_bIsHidden )
1312  return m_aTRUEText;
1313  }
1314  else if( !static_cast<SwHiddenTextFieldType*>(GetTyp())->GetHiddenFlag() ||
1315  ( m_bCanToggle && m_bIsHidden ))
1316  return m_aTRUEText;
1317 
1318  return m_aFALSEText;
1319 }
1320 
1323 {
1324  OSL_ENSURE(pDoc, "got no document");
1325 
1327  {
1328 #if !HAVE_FEATURE_DBCONNECTIVITY
1329  (void) pDoc;
1330 #else
1331  SwDBManager* pMgr = pDoc->GetDBManager();
1332 #endif
1333  m_bValid = false;
1334  OUString sTmpName = (m_bCanToggle && !m_bIsHidden) ? m_aTRUEText : m_aFALSEText;
1335 
1336  // Database expressions need to be different from normal text. Therefore, normal text is set
1337  // in quotes. If the latter exist they will be removed. If not, check if potential DB name.
1338  // Only if there are two or more dots and no quotes, we assume a database.
1339  if (sTmpName.getLength()>1 &&
1340  sTmpName.startsWith("\"") &&
1341  sTmpName.endsWith("\""))
1342  {
1343  m_aContent = sTmpName.copy(1, sTmpName.getLength() - 2);
1344  m_bValid = true;
1345  }
1346  else if(sTmpName.indexOf('\"')<0 &&
1347  comphelper::string::getTokenCount(sTmpName, '.') > 2)
1348  {
1349  sTmpName = ::ReplacePoint(sTmpName);
1350  if(sTmpName.startsWith("[") && sTmpName.endsWith("]"))
1351  { // remove brackets
1352  sTmpName = sTmpName.copy(1, sTmpName.getLength() - 2);
1353  }
1354 #if HAVE_FEATURE_DBCONNECTIVITY
1355  if( pMgr)
1356  {
1357  sal_Int32 nIdx{ 0 };
1358  OUString sDBName( GetDBName( sTmpName, pDoc ));
1359  OUString sDataSource(sDBName.getToken(0, DB_DELIM, nIdx));
1360  OUString sDataTableOrQuery(sDBName.getToken(0, DB_DELIM, nIdx));
1361  if( pMgr->IsInMerge() && !sDBName.isEmpty() &&
1362  pMgr->IsDataSourceOpen( sDataSource,
1363  sDataTableOrQuery, false))
1364  {
1365  double fNumber;
1366  pMgr->GetMergeColumnCnt(GetColumnName( sTmpName ),
1367  GetLanguage(), m_aContent, &fNumber );
1368  m_bValid = true;
1369  }
1370  else if( !sDBName.isEmpty() && !sDataSource.isEmpty() &&
1371  !sDataTableOrQuery.isEmpty() )
1372  m_bValid = true;
1373  }
1374 #endif
1375  }
1376  }
1377 }
1378 
1380 {
1382  " " + m_aCond + " " + m_aTRUEText;
1383 
1385  {
1386  aStr += " : " + m_aFALSEText;
1387  }
1388  return aStr;
1389 }
1390 
1391 std::unique_ptr<SwField> SwHiddenTextField::Copy() const
1392 {
1393  std::unique_ptr<SwHiddenTextField> pField(
1394  new SwHiddenTextField(static_cast<SwHiddenTextFieldType*>(GetTyp()), m_aCond,
1396  pField->m_bIsHidden = m_bIsHidden;
1397  pField->m_bValid = m_bValid;
1398  pField->m_aContent = m_aContent;
1399  pField->SetFormat(GetFormat());
1400  pField->m_nSubType = m_nSubType;
1401  return std::unique_ptr<SwField>(pField.release());
1402 }
1403 
1405 void SwHiddenTextField::SetPar1(const OUString& rStr)
1406 {
1407  m_aCond = rStr;
1408  m_bCanToggle = !m_aCond.isEmpty();
1409 }
1410 
1412 {
1413  return m_aCond;
1414 }
1415 
1417 void SwHiddenTextField::SetPar2(const OUString& rStr)
1418 {
1420  {
1421  sal_Int32 nPos = rStr.indexOf('|');
1422  if (nPos == -1)
1423  m_aTRUEText = rStr;
1424  else
1425  {
1426  m_aTRUEText = rStr.copy(0, nPos);
1427  m_aFALSEText = rStr.copy(nPos + 1);
1428  }
1429  }
1430  else
1431  m_aTRUEText = rStr;
1432 }
1433 
1436 {
1438  {
1439  return m_aTRUEText;
1440  }
1441  return m_aTRUEText + "|" + m_aFALSEText;
1442 }
1443 
1445 {
1446  return static_cast<sal_uInt16>(m_nSubType);
1447 }
1448 
1449 bool SwHiddenTextField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
1450 {
1451  switch( nWhichId )
1452  {
1453  case FIELD_PROP_PAR1:
1454  rAny <<= m_aCond;
1455  break;
1456  case FIELD_PROP_PAR2:
1457  rAny <<= m_aTRUEText;
1458  break;
1459  case FIELD_PROP_PAR3:
1460  rAny <<= m_aFALSEText;
1461  break;
1462  case FIELD_PROP_PAR4 :
1463  rAny <<= m_aContent;
1464  break;
1465  case FIELD_PROP_BOOL1:
1466  rAny <<= m_bIsHidden;
1467  break;
1468  default:
1469  assert(false);
1470  }
1471  return true;
1472 }
1473 
1474 bool SwHiddenTextField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
1475 {
1476  switch( nWhichId )
1477  {
1478  case FIELD_PROP_PAR1:
1479  {
1480  OUString sVal;
1481  rAny >>= sVal;
1482  SetPar1(sVal);
1483  }
1484  break;
1485  case FIELD_PROP_PAR2:
1486  rAny >>= m_aTRUEText;
1487  break;
1488  case FIELD_PROP_PAR3:
1489  rAny >>= m_aFALSEText;
1490  break;
1491  case FIELD_PROP_BOOL1:
1492  m_bIsHidden = *o3tl::doAccess<bool>(rAny);
1493  break;
1494  case FIELD_PROP_PAR4:
1495  rAny >>= m_aContent;
1496  m_bValid = true;
1497  break;
1498  default:
1499  assert(false);
1500  }
1501  return true;
1502 }
1503 
1504 OUString SwHiddenTextField::GetColumnName(const OUString& rName)
1505 {
1506  sal_Int32 nPos = rName.indexOf(DB_DELIM);
1507  if( nPos>=0 )
1508  {
1509  nPos = rName.indexOf(DB_DELIM, nPos + 1);
1510 
1511  if( nPos>=0 )
1512  return rName.copy(nPos + 1);
1513  }
1514  return rName;
1515 }
1516 
1517 OUString SwHiddenTextField::GetDBName(const OUString& rName, SwDoc *pDoc)
1518 {
1519  sal_Int32 nPos = rName.indexOf(DB_DELIM);
1520  if( nPos>=0 )
1521  {
1522  nPos = rName.indexOf(DB_DELIM, nPos + 1);
1523 
1524  if( nPos>=0 )
1525  return rName.copy(0, nPos);
1526  }
1527 
1528  SwDBData aData = pDoc->GetDBData();
1529  return aData.sDataSource + OUStringChar(DB_DELIM) + aData.sCommand;
1530 }
1531 
1532 // [aFieldDefinition] value sample : " IF A == B \"TrueText\" \"FalseText\""
1533 void SwHiddenTextField::ParseIfFieldDefinition(const OUString& aFieldDefinition,
1534  OUString& rCondition,
1535  OUString& rTrue,
1536  OUString& rFalse)
1537 {
1538  // get all positions inside the input string where words are started
1539  //
1540  // In: " IF A == B \"TrueText\" \"FalseText\""
1541  // 0 1 2 3
1542  // 01234567890 123456789 01 2345678901 2
1543  //
1544  // result:
1545  // [1, 4, 6, 9, 11, 22]
1546  std::vector<sal_Int32> wordPosition;
1547  {
1548  bool quoted = false;
1549  bool insideWord = false;
1550  for (sal_Int32 i = 0; i < aFieldDefinition.getLength(); i++)
1551  {
1552  if (quoted)
1553  {
1554  if (aFieldDefinition[i] == '\"')
1555  {
1556  quoted = false;
1557  insideWord = false;
1558  }
1559  }
1560  else
1561  {
1562  if (aFieldDefinition[i] == ' ')
1563  {
1564  // word delimiter
1565  insideWord = false;
1566  }
1567  else
1568  {
1569  if (insideWord)
1570  {
1571  quoted = (aFieldDefinition[i] == '\"');
1572  }
1573  else
1574  {
1575  insideWord = true;
1576  wordPosition.push_back(i);
1577  quoted = (aFieldDefinition[i] == '\"');
1578  }
1579  }
1580  }
1581  }
1582  }
1583 
1584  // first word is always "IF"
1585  // last two words are: true-case and false-case,
1586  // everything before is treated as condition expression
1587  // => we need at least 4 words to be inside the input string
1588  if (wordPosition.size() < 4)
1589  {
1590  return;
1591  }
1592 
1593 
1594  const sal_Int32 conditionBegin = wordPosition[1];
1595  const sal_Int32 trueBegin = wordPosition[wordPosition.size() - 2];
1596  const sal_Int32 falseBegin = wordPosition[wordPosition.size() - 1];
1597 
1598  const sal_Int32 conditionLength = trueBegin - conditionBegin;
1599  const sal_Int32 trueLength = falseBegin - trueBegin;
1600 
1601  // Syntax
1602  // OUString::copy( sal_Int32 beginIndex, sal_Int32 count )
1603  rCondition = aFieldDefinition.copy(conditionBegin, conditionLength);
1604  rTrue = aFieldDefinition.copy(trueBegin, trueLength);
1605  rFalse = aFieldDefinition.copy(falseBegin);
1606 
1607  // trim
1608  rCondition = rCondition.trim();
1609  rTrue = rTrue.trim();
1610  rFalse = rFalse.trim();
1611 
1612  // remove quotes
1613  if (rCondition.getLength() >= 2)
1614  {
1615  if (rCondition[0] == '\"' && rCondition[rCondition.getLength() - 1] == '\"')
1616  rCondition = rCondition.copy(1, rCondition.getLength() - 2);
1617  }
1618  if (rTrue.getLength() >= 2)
1619  {
1620  if (rTrue[0] == '\"' && rTrue[rTrue.getLength() - 1] == '\"')
1621  rTrue = rTrue.copy(1, rTrue.getLength() - 2);
1622  }
1623  if (rFalse.getLength() >= 2)
1624  {
1625  if (rFalse[0] == '\"' && rFalse[rFalse.getLength() - 1] == '\"')
1626  rFalse = rFalse.copy(1, rFalse.getLength() - 2);
1627  }
1628 
1629  // Note: do not make trim once again, while this is a user defined data
1630 }
1631 
1632 // field type for line height 0
1633 
1636 {
1637 }
1638 
1639 std::unique_ptr<SwFieldType> SwHiddenParaFieldType::Copy() const
1640 {
1641  return std::make_unique<SwHiddenParaFieldType>();
1642 }
1643 
1644 // field for line height 0
1645 
1647  : SwField(pTyp), m_aCond(rStr)
1648 {
1649  m_bIsHidden = false;
1650 }
1651 
1652 OUString SwHiddenParaField::ExpandImpl(SwRootFrame const*const) const
1653 {
1654  return OUString();
1655 }
1656 
1657 std::unique_ptr<SwField> SwHiddenParaField::Copy() const
1658 {
1659  std::unique_ptr<SwHiddenParaField> pField(new SwHiddenParaField(static_cast<SwHiddenParaFieldType*>(GetTyp()), m_aCond));
1660  pField->m_bIsHidden = m_bIsHidden;
1661  return std::unique_ptr<SwField>(pField.release());
1662 }
1663 
1664 bool SwHiddenParaField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
1665 {
1666  switch ( nWhichId )
1667  {
1668  case FIELD_PROP_PAR1:
1669  rAny <<= m_aCond;
1670  break;
1671  case FIELD_PROP_BOOL1:
1672  rAny <<= m_bIsHidden;
1673  break;
1674 
1675  default:
1676  assert(false);
1677  }
1678  return true;
1679 }
1680 
1681 bool SwHiddenParaField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
1682 {
1683  switch ( nWhichId )
1684  {
1685  case FIELD_PROP_PAR1:
1686  rAny >>= m_aCond;
1687  break;
1688  case FIELD_PROP_BOOL1:
1689  m_bIsHidden = *o3tl::doAccess<bool>(rAny);
1690  break;
1691 
1692  default:
1693  assert(false);
1694  }
1695  return true;
1696 }
1697 
1699 void SwHiddenParaField::SetPar1(const OUString& rStr)
1700 {
1701  m_aCond = rStr;
1702 }
1703 
1705 {
1706  return m_aCond;
1707 }
1708 
1709 // PostIt field type
1710 
1713  , mpDoc(pDoc)
1714 {}
1715 
1716 std::unique_ptr<SwFieldType> SwPostItFieldType::Copy() const
1717 {
1718  return std::make_unique<SwPostItFieldType>(mpDoc);
1719 }
1720 
1721 // PostIt field
1722 
1723 sal_uInt32 SwPostItField::m_nLastPostItId = 1;
1724 
1726  const OUString& rAuthor,
1727  const OUString& rText,
1728  const OUString& rInitials,
1729  const OUString& rName,
1730  const DateTime& rDateTime,
1731  const bool bResolved,
1732  const sal_uInt32 nPostItId
1733 )
1734  : SwField( pT )
1735  , m_sText( rText )
1736  , m_sAuthor( rAuthor )
1737  , m_sInitials( rInitials )
1738  , m_sName( rName )
1739  , m_aDateTime( rDateTime )
1740  , m_bResolved( bResolved )
1741 {
1742  m_nPostItId = nPostItId == 0 ? m_nLastPostItId++ : nPostItId;
1743 }
1744 
1746 {
1747  if ( m_xTextObject.is() )
1748  {
1749  m_xTextObject->DisposeEditSource();
1750  }
1751 
1752  mpText.reset();
1753 }
1754 
1755 OUString SwPostItField::ExpandImpl(SwRootFrame const*const) const
1756 {
1757  return OUString();
1758 }
1759 
1761 {
1762  return SwResId(STR_NOTE);
1763 }
1764 
1765 void SwPostItField::SetResolved(bool bNewState)
1766 {
1767  m_bResolved = bNewState;
1768 }
1769 
1771 {
1773 }
1774 
1776 {
1777  return m_bResolved;
1778 }
1779 
1780 std::unique_ptr<SwField> SwPostItField::Copy() const
1781 {
1782  std::unique_ptr<SwPostItField> pRet(new SwPostItField( static_cast<SwPostItFieldType*>(GetTyp()), m_sAuthor, m_sText, m_sInitials, m_sName,
1784  if (mpText)
1785  pRet->SetTextObject( std::make_unique<OutlinerParaObject>(*mpText) );
1786 
1787  // Note: member <m_xTextObject> not copied.
1788 
1789  return std::unique_ptr<SwField>(pRet.release());
1790 }
1791 
1793 void SwPostItField::SetPar1(const OUString& rStr)
1794 {
1795  m_sAuthor = rStr;
1796 }
1797 
1799 OUString SwPostItField::GetPar1() const
1800 {
1801  return m_sAuthor;
1802 }
1803 
1805 void SwPostItField::SetPar2(const OUString& rStr)
1806 {
1807  m_sText = rStr;
1808 }
1809 
1811 OUString SwPostItField::GetPar2() const
1812 {
1813  return m_sText;
1814 }
1815 
1816 
1817 void SwPostItField::SetName(const OUString& rName)
1818 {
1819  m_sName = rName;
1820 }
1821 
1822 
1823 void SwPostItField::SetTextObject( std::unique_ptr<OutlinerParaObject> pText )
1824 {
1825  mpText = std::move(pText);
1826 }
1827 
1829 {
1830  return mpText ? mpText->Count() : 1;
1831 }
1832 
1833 bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
1834 {
1835  switch( nWhichId )
1836  {
1837  case FIELD_PROP_PAR1:
1838  rAny <<= m_sAuthor;
1839  break;
1840  case FIELD_PROP_PAR2:
1841  {
1842  rAny <<= m_sText;
1843  break;
1844  }
1845  case FIELD_PROP_PAR3:
1846  rAny <<= m_sInitials;
1847  break;
1848  case FIELD_PROP_PAR4:
1849  rAny <<= m_sName;
1850  break;
1851  case FIELD_PROP_BOOL1:
1852  rAny <<= m_bResolved;
1853  break;
1854  case FIELD_PROP_TEXT:
1855  {
1856  if ( !m_xTextObject.is() )
1857  {
1858  SwPostItFieldType* pGetType = static_cast<SwPostItFieldType*>(GetTyp());
1859  SwDoc* pDoc = pGetType->GetDoc();
1860  auto pObj = std::make_unique<SwTextAPIEditSource>( pDoc );
1861  const_cast <SwPostItField*> (this)->m_xTextObject = new SwTextAPIObject( std::move(pObj) );
1862  }
1863 
1864  if ( mpText )
1865  m_xTextObject->SetText( *mpText );
1866  else
1867  m_xTextObject->SetString( m_sText );
1868 
1869  uno::Reference < text::XText > xText( m_xTextObject.get() );
1870  rAny <<= xText;
1871  break;
1872  }
1873  case FIELD_PROP_DATE:
1874  {
1875  rAny <<= m_aDateTime.GetUNODate();
1876  }
1877  break;
1878  case FIELD_PROP_DATE_TIME:
1879  {
1880  rAny <<= m_aDateTime.GetUNODateTime();
1881  }
1882  break;
1883  default:
1884  assert(false);
1885  }
1886  return true;
1887 }
1888 
1889 bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
1890 {
1891  switch( nWhichId )
1892  {
1893  case FIELD_PROP_PAR1:
1894  rAny >>= m_sAuthor;
1895  break;
1896  case FIELD_PROP_PAR2:
1897  rAny >>= m_sText;
1898  //#i100374# new string via api, delete complex text object so SwPostItNote picks up the new string
1899  mpText.reset();
1900  break;
1901  case FIELD_PROP_PAR3:
1902  rAny >>= m_sInitials;
1903  break;
1904  case FIELD_PROP_PAR4:
1905  rAny >>= m_sName;
1906  break;
1907  case FIELD_PROP_BOOL1:
1908  rAny >>= m_bResolved;
1909  break;
1910  case FIELD_PROP_TEXT:
1911  OSL_FAIL("Not implemented!");
1912  break;
1913  case FIELD_PROP_DATE:
1914  if( auto aSetDate = o3tl::tryAccess<util::Date>(rAny) )
1915  {
1916  m_aDateTime = Date(aSetDate->Day, aSetDate->Month, aSetDate->Year);
1917  }
1918  break;
1919  case FIELD_PROP_DATE_TIME:
1920  {
1921  util::DateTime aDateTimeValue;
1922  if(!(rAny >>= aDateTimeValue))
1923  return false;
1924  m_aDateTime = DateTime(aDateTimeValue);
1925  }
1926  break;
1927  default:
1928  assert(false);
1929  }
1930  return true;
1931 }
1932 
1934 {
1935  xmlTextWriterStartElement(pWriter, BAD_CAST("SwPostItField"));
1936  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toUtf8().getStr()));
1937 
1938  SwField::dumpAsXml(pWriter);
1939 
1940  xmlTextWriterStartElement(pWriter, BAD_CAST("mpText"));
1941  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", mpText.get());
1942  if (mpText)
1943  mpText->dumpAsXml(pWriter);
1944  xmlTextWriterEndElement(pWriter);
1945 
1946  xmlTextWriterEndElement(pWriter);
1947 }
1948 
1949 // extended user information field type
1950 
1953 {
1954 }
1955 
1956 std::unique_ptr<SwFieldType> SwExtUserFieldType::Copy() const
1957 {
1958  return std::make_unique<SwExtUserFieldType>();
1959 }
1960 
1961 OUString SwExtUserFieldType::Expand(sal_uInt16 nSub )
1962 {
1963  UserOptToken nRet = static_cast<UserOptToken>(USHRT_MAX);
1964  switch(nSub)
1965  {
1966  case EU_FIRSTNAME: nRet = UserOptToken::FirstName; break;
1967  case EU_NAME: nRet = UserOptToken::LastName; break;
1968  case EU_SHORTCUT: nRet = UserOptToken::ID; break;
1969 
1970  case EU_COMPANY: nRet = UserOptToken::Company; break;
1971  case EU_STREET: nRet = UserOptToken::Street; break;
1972  case EU_TITLE: nRet = UserOptToken::Title; break;
1973  case EU_POSITION: nRet = UserOptToken::Position; break;
1974  case EU_PHONE_PRIVATE: nRet = UserOptToken::TelephoneHome; break;
1975  case EU_PHONE_COMPANY: nRet = UserOptToken::TelephoneWork; break;
1976  case EU_FAX: nRet = UserOptToken::Fax; break;
1977  case EU_EMAIL: nRet = UserOptToken::Email; break;
1978  case EU_COUNTRY: nRet = UserOptToken::Country; break;
1979  case EU_ZIP: nRet = UserOptToken::Zip; break;
1980  case EU_CITY: nRet = UserOptToken::City; break;
1981  case EU_STATE: nRet = UserOptToken::State; break;
1982  case EU_FATHERSNAME: nRet = UserOptToken::FathersName; break;
1983  case EU_APARTMENT: nRet = UserOptToken::Apartment; break;
1984  default: OSL_ENSURE( false, "Field unknown");
1985  }
1986  if( static_cast<UserOptToken>(USHRT_MAX) != nRet )
1987  {
1988  SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions();
1989  return rUserOpt.GetToken( nRet );
1990  }
1991  return OUString();
1992 }
1993 
1994 // extended user information field
1995 
1996 SwExtUserField::SwExtUserField(SwExtUserFieldType* pTyp, sal_uInt16 nSubTyp, sal_uInt32 nFormat) :
1997  SwField(pTyp, nFormat), m_nType(nSubTyp)
1998 {
2000 }
2001 
2002 OUString SwExtUserField::ExpandImpl(SwRootFrame const*const) const
2003 {
2004  if (!IsFixed())
2006 
2007  return m_aContent;
2008 }
2009 
2010 std::unique_ptr<SwField> SwExtUserField::Copy() const
2011 {
2012  std::unique_ptr<SwExtUserField> pField(new SwExtUserField(static_cast<SwExtUserFieldType*>(GetTyp()), m_nType, GetFormat()));
2013  pField->SetExpansion(m_aContent);
2014 
2015  return std::unique_ptr<SwField>(pField.release());
2016 }
2017 
2018 sal_uInt16 SwExtUserField::GetSubType() const
2019 {
2020  return m_nType;
2021 }
2022 
2023 void SwExtUserField::SetSubType(sal_uInt16 nSub)
2024 {
2025  m_nType = nSub;
2026 }
2027 
2028 bool SwExtUserField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
2029 {
2030  switch( nWhichId )
2031  {
2032  case FIELD_PROP_PAR1:
2033  rAny <<= m_aContent;
2034  break;
2035 
2036  case FIELD_PROP_USHORT1:
2037  {
2038  sal_Int16 nTmp = m_nType;
2039  rAny <<= nTmp;
2040  }
2041  break;
2042  case FIELD_PROP_BOOL1:
2043  rAny <<= IsFixed();
2044  break;
2045  default:
2046  assert(false);
2047  }
2048  return true;
2049 }
2050 
2051 bool SwExtUserField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
2052 {
2053  switch( nWhichId )
2054  {
2055  case FIELD_PROP_PAR1:
2056  rAny >>= m_aContent;
2057  break;
2058 
2059  case FIELD_PROP_USHORT1:
2060  {
2061  sal_Int16 nTmp = 0;
2062  rAny >>= nTmp;
2063  m_nType = nTmp;
2064  }
2065  break;
2066  case FIELD_PROP_BOOL1:
2067  if( *o3tl::doAccess<bool>(rAny) )
2069  else
2071  break;
2072  default:
2073  assert(false);
2074  }
2075  return true;
2076 }
2077 
2078 // field type for relative page numbers
2079 
2082 {
2083 }
2084 
2085 std::unique_ptr<SwFieldType> SwRefPageSetFieldType::Copy() const
2086 {
2087  return std::make_unique<SwRefPageSetFieldType>();
2088 }
2089 
2090 // overridden since there is nothing to update
2092 {
2093 }
2094 
2095 // field for relative page numbers
2096 
2098  short nOff, bool bFlag )
2099  : SwField( pTyp ), m_nOffset( nOff ), m_bOn( bFlag )
2100 {
2101 }
2102 
2103 OUString SwRefPageSetField::ExpandImpl(SwRootFrame const*const) const
2104 {
2105  return OUString();
2106 }
2107 
2108 std::unique_ptr<SwField> SwRefPageSetField::Copy() const
2109 {
2110  return std::make_unique<SwRefPageSetField>( static_cast<SwRefPageSetFieldType*>(GetTyp()), m_nOffset, m_bOn );
2111 }
2112 
2114 {
2115  return OUString::number(GetOffset());
2116 }
2117 
2118 void SwRefPageSetField::SetPar2(const OUString& rStr)
2119 {
2120  SetOffset( static_cast<short>(rStr.toInt32()) );
2121 }
2122 
2123 bool SwRefPageSetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
2124 {
2125  switch( nWhichId )
2126  {
2127  case FIELD_PROP_BOOL1:
2128  rAny <<= m_bOn;
2129  break;
2130  case FIELD_PROP_USHORT1:
2131  rAny <<= static_cast<sal_Int16>(m_nOffset);
2132  break;
2133  default:
2134  assert(false);
2135  }
2136  return true;
2137 }
2138 
2139 bool SwRefPageSetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
2140 {
2141  switch( nWhichId )
2142  {
2143  case FIELD_PROP_BOOL1:
2144  m_bOn = *o3tl::doAccess<bool>(rAny);
2145  break;
2146  case FIELD_PROP_USHORT1:
2147  rAny >>=m_nOffset;
2148  break;
2149  default:
2150  assert(false);
2151  }
2152  return true;
2153 }
2154 
2155 // relative page numbers - query field
2156 
2158  : SwFieldType( SwFieldIds::RefPageGet ), m_pDoc( pDc ), m_nNumberingType( SVX_NUM_ARABIC )
2159 {
2160 }
2161 
2162 std::unique_ptr<SwFieldType> SwRefPageGetFieldType::Copy() const
2163 {
2164  std::unique_ptr<SwRefPageGetFieldType> pNew(new SwRefPageGetFieldType( m_pDoc ));
2165  pNew->m_nNumberingType = m_nNumberingType;
2166  return pNew;
2167 }
2168 
2170 {
2171  auto const ModifyImpl = [this](SwRootFrame const*const pLayout)
2172  {
2173  // first collect all SetPageRefFields
2174  SetGetExpFields aTmpLst;
2175  if (MakeSetList(aTmpLst, pLayout))
2176  {
2177  std::vector<SwFormatField*> vFields;
2178  GatherFields(vFields);
2179  for(auto pFormatField: vFields)
2180  UpdateField(pFormatField->GetTextField(), aTmpLst, pLayout);
2181  }
2182  };
2183 
2184  // update all GetReference fields
2185  if( !pNew && !pOld && HasWriterListeners() )
2186  {
2187  SwRootFrame const* pLayout(nullptr);
2188  SwRootFrame const* pLayoutRLHidden(nullptr);
2189  for (SwRootFrame const*const pLay : m_pDoc->GetAllLayouts())
2190  {
2191  if (pLay->IsHideRedlines())
2192  {
2193  pLayoutRLHidden = pLay;
2194  }
2195  else
2196  {
2197  pLayout = pLay;
2198  }
2199  }
2200  ModifyImpl(pLayout);
2201  if (pLayoutRLHidden)
2202  {
2203  ModifyImpl(pLayoutRLHidden);
2204  }
2205  }
2206 
2207  // forward to text fields, they "expand" the text
2208  NotifyClients( pOld, pNew );
2209 }
2210 
2212  SwRootFrame const*const pLayout)
2213 {
2215  std::vector<SwFormatField*> vFields;
2216  GatherFields(vFields);
2217  for(auto pFormatField: vFields)
2218  {
2219  // update only the GetRef fields
2220  const SwTextField* pTField = pFormatField->GetTextField();
2221  if (!pLayout || !pLayout->IsHideRedlines() || !sw::IsFieldDeletedInModel(rIDRA, *pTField))
2222  {
2223  const SwTextNode& rTextNd = pTField->GetTextNode();
2224 
2225  // Always the first! (in Tab-Headline, header/footer )
2226  Point aPt;
2227  std::pair<Point, bool> const tmp(aPt, false);
2228  const SwContentFrame *const pFrame = rTextNd.getLayoutFrame(
2229  pLayout, nullptr, &tmp);
2230 
2231  std::unique_ptr<SetGetExpField> pNew;
2232 
2233  if( !pFrame ||
2234  pFrame->IsInDocBody() ||
2235  // #i31868#
2236  // Check if pFrame is not yet connected to the layout.
2237  !pFrame->FindPageFrame() )
2238  {
2239  // create index for determination of the TextNode
2240  SwNodeIndex aIdx( rTextNd );
2241  pNew.reset( new SetGetExpField( aIdx, pTField ) );
2242  }
2243  else
2244  {
2245  // create index for determination of the TextNode
2247  bool const bResult = GetBodyTextNode( *m_pDoc, aPos, *pFrame );
2248  OSL_ENSURE(bResult, "where is the Field?");
2249  pNew.reset( new SetGetExpField( aPos.nNode, pTField,
2250  &aPos.nContent ) );
2251  }
2252 
2253  rTmpLst.insert( std::move(pNew) );
2254  }
2255  }
2256  return !rTmpLst.empty();
2257 }
2258 
2260  SetGetExpFields const & rSetList,
2261  SwRootFrame const*const pLayout)
2262 {
2263  SwRefPageGetField* pGetField = const_cast<SwRefPageGetField*>(static_cast<const SwRefPageGetField*>(pTextField->GetFormatField().GetField()));
2264  pGetField->SetText( OUString(), pLayout );
2265 
2266  // then search the correct RefPageSet field
2267  SwTextNode* pTextNode = &pTextField->GetTextNode();
2268  if( pTextNode->StartOfSectionIndex() >
2270  {
2271  SwNodeIndex aIdx( *pTextNode );
2272  SetGetExpField aEndField( aIdx, pTextField );
2273 
2274  SetGetExpFields::const_iterator itLast = rSetList.lower_bound( &aEndField );
2275 
2276  if( itLast != rSetList.begin() )
2277  {
2278  --itLast;
2279  const SwTextField* pRefTextField = (*itLast)->GetTextField();
2280  const SwRefPageSetField* pSetField =
2281  static_cast<const SwRefPageSetField*>(pRefTextField->GetFormatField().GetField());
2282  if( pSetField->IsOn() )
2283  {
2284  // determine the correct offset
2285  Point aPt;
2286  std::pair<Point, bool> const tmp(aPt, false);
2287  const SwContentFrame *const pFrame = pTextNode->getLayoutFrame(
2288  pLayout, nullptr, &tmp);
2289  const SwContentFrame *const pRefFrame = pRefTextField->GetTextNode().getLayoutFrame(
2290  pLayout, nullptr, &tmp);
2291  const SwPageFrame* pPgFrame = nullptr;
2292  short nDiff = 1;
2293  if ( pFrame && pRefFrame )
2294  {
2295  pPgFrame = pFrame->FindPageFrame();
2296  nDiff = pPgFrame->GetPhyPageNum() -
2297  pRefFrame->FindPageFrame()->GetPhyPageNum() + 1;
2298  }
2299 
2300  SvxNumType nTmpFormat = SVX_NUM_PAGEDESC == static_cast<SvxNumType>(pGetField->GetFormat())
2301  ? ( !pPgFrame
2302  ? SVX_NUM_ARABIC
2303  : pPgFrame->GetPageDesc()->GetNumType().GetNumberingType() )
2304  : static_cast<SvxNumType>(pGetField->GetFormat());
2305  const short nPageNum = std::max<short>(0, pSetField->GetOffset() + nDiff);
2306  pGetField->SetText(FormatNumber(nPageNum, nTmpFormat), pLayout);
2307  }
2308  }
2309  }
2310  // start formatting
2311  const_cast<SwFormatField&>(pTextField->GetFormatField()).ModifyNotification( nullptr, nullptr );
2312 }
2313 
2314 // queries for relative page numbering
2315 
2317  sal_uInt32 nFormat )
2318  : SwField( pTyp, nFormat )
2319 {
2320 }
2321 
2322 void SwRefPageGetField::SetText(const OUString& rText,
2323  SwRootFrame const*const pLayout)
2324 {
2325  if (!pLayout || !pLayout->IsHideRedlines())
2326  {
2327  m_sText = rText;
2328  }
2329  if (!pLayout || pLayout->IsHideRedlines())
2330  {
2331  m_sTextRLHidden = rText;
2332  }
2333 }
2334 
2335 OUString SwRefPageGetField::ExpandImpl(SwRootFrame const*const pLayout) const
2336 {
2337  return pLayout && pLayout->IsHideRedlines() ? m_sTextRLHidden : m_sText;
2338 }
2339 
2340 std::unique_ptr<SwField> SwRefPageGetField::Copy() const
2341 {
2342  std::unique_ptr<SwRefPageGetField> pCpy(new SwRefPageGetField(
2343  static_cast<SwRefPageGetFieldType*>(GetTyp()), GetFormat() ));
2344  pCpy->m_sText = m_sText;
2345  pCpy->m_sTextRLHidden = m_sTextRLHidden;
2346  return std::unique_ptr<SwField>(pCpy.release());
2347 }
2348 
2350  const SwTextField* pField )
2351 {
2352  // only fields in Footer, Header, FootNote, Flys
2353  SwRefPageGetFieldType* pGetType = static_cast<SwRefPageGetFieldType*>(GetTyp());
2354  SwDoc* pDoc = pGetType->GetDoc();
2355  if( pField->GetTextNode().StartOfSectionIndex() >
2356  pDoc->GetNodes().GetEndOfExtras().GetIndex() )
2357  return;
2358 
2359  SwRootFrame const& rLayout(*rFrame.getRootFrame());
2360  OUString & rText(rLayout.IsHideRedlines() ? m_sTextRLHidden : m_sText);
2361  rText.clear();
2362 
2363  OSL_ENSURE(!rFrame.IsInDocBody(), "Flag incorrect, frame is in DocBody");
2364 
2365  // collect all SetPageRefFields
2366  SetGetExpFields aTmpLst;
2367  if (!pGetType->MakeSetList(aTmpLst, &rLayout))
2368  return ;
2369 
2370  // create index for determination of the TextNode
2371  SwPosition aPos( SwNodeIndex( pDoc->GetNodes() ) );
2372  SwTextNode* pTextNode = const_cast<SwTextNode*>(GetBodyTextNode(*pDoc, aPos, rFrame));
2373 
2374  // If no layout exists, ChangeExpansion is called for header and
2375  // footer lines via layout formatting without existing TextNode.
2376  if(!pTextNode)
2377  return;
2378 
2379  SetGetExpField aEndField( aPos.nNode, pField, &aPos.nContent );
2380 
2381  SetGetExpFields::const_iterator itLast = aTmpLst.lower_bound( &aEndField );
2382 
2383  if( itLast == aTmpLst.begin() )
2384  return; // there is no corresponding set-field in front
2385  --itLast;
2386 
2387  const SwTextField* pRefTextField = (*itLast)->GetTextField();
2388  const SwRefPageSetField* pSetField =
2389  static_cast<const SwRefPageSetField*>(pRefTextField->GetFormatField().GetField());
2390  Point aPt;
2391  std::pair<Point, bool> const tmp(aPt, false);
2392  const SwContentFrame *const pRefFrame = pRefTextField->GetTextNode().getLayoutFrame(
2393  &rLayout, nullptr, &tmp);
2394  if( pSetField->IsOn() && pRefFrame )
2395  {
2396  // determine the correct offset
2397  const SwPageFrame* pPgFrame = rFrame.FindPageFrame();
2398  const short nDiff = pPgFrame->GetPhyPageNum() -
2399  pRefFrame->FindPageFrame()->GetPhyPageNum() + 1;
2400 
2401  SwRefPageGetField* pGetField = const_cast<SwRefPageGetField*>(static_cast<const SwRefPageGetField*>(pField->GetFormatField().GetField()));
2402  SvxNumType nTmpFormat = SVX_NUM_PAGEDESC == pGetField->GetFormat()
2403  ? pPgFrame->GetPageDesc()->GetNumType().GetNumberingType()
2404  : static_cast<SvxNumType>(pGetField->GetFormat());
2405  const short nPageNum = std::max<short>(0, pSetField->GetOffset() + nDiff);
2406  pGetField->SetText(FormatNumber(nPageNum, nTmpFormat), &rLayout);
2407  }
2408 }
2409 
2410 bool SwRefPageGetField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
2411 {
2412  switch( nWhichId )
2413  {
2414  case FIELD_PROP_USHORT1:
2415  rAny <<= static_cast<sal_Int16>(GetFormat());
2416  break;
2417  case FIELD_PROP_PAR1:
2418  rAny <<= m_sText;
2419  break;
2420  default:
2421  assert(false);
2422  }
2423  return true;
2424 }
2425 
2426 bool SwRefPageGetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
2427 {
2428  switch( nWhichId )
2429  {
2430  case FIELD_PROP_USHORT1:
2431  {
2432  sal_Int16 nSet = 0;
2433  rAny >>= nSet;
2434  if(nSet <= SVX_NUM_PAGEDESC )
2435  SetFormat(nSet);
2436  }
2437  break;
2438  case FIELD_PROP_PAR1:
2439  rAny >>= m_sText;
2441  break;
2442  default:
2443  assert(false);
2444  }
2445  return true;
2446 }
2447 
2448 // field type to jump to and edit
2449 
2451  : SwFieldType( SwFieldIds::JumpEdit ), m_pDoc( pD ), m_aDep( *this )
2452 {
2453 }
2454 
2455 std::unique_ptr<SwFieldType> SwJumpEditFieldType::Copy() const
2456 {
2457  return std::make_unique<SwJumpEditFieldType>( m_pDoc );
2458 }
2459 
2461 {
2463  m_aDep.StartListening(pFormat);
2464  return pFormat;
2465 }
2466 
2468  const OUString& rText, const OUString& rHelp )
2469  : SwField( pTyp, nForm ), m_sText( rText ), m_sHelp( rHelp )
2470 {
2471 }
2472 
2473 OUString SwJumpEditField::ExpandImpl(SwRootFrame const*const) const
2474 {
2475  return "<" + m_sText + ">";
2476 }
2477 
2478 std::unique_ptr<SwField> SwJumpEditField::Copy() const
2479 {
2480  return std::make_unique<SwJumpEditField>( static_cast<SwJumpEditFieldType*>(GetTyp()), GetFormat(),
2481  m_sText, m_sHelp );
2482 }
2483 
2486 {
2487  return m_sText;
2488 }
2489 
2491 void SwJumpEditField::SetPar1(const OUString& rStr)
2492 {
2493  m_sText = rStr;
2494 }
2495 
2498 {
2499  return m_sHelp;
2500 }
2501 
2503 void SwJumpEditField::SetPar2(const OUString& rStr)
2504 {
2505  m_sHelp = rStr;
2506 }
2507 
2508 bool SwJumpEditField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
2509 {
2510  switch( nWhichId )
2511  {
2512  case FIELD_PROP_USHORT1:
2513  {
2514  sal_Int16 nRet;
2515  switch( GetFormat() )
2516  {
2517  case JE_FMT_TABLE: nRet = text::PlaceholderType::TABLE; break;
2518  case JE_FMT_FRAME: nRet = text::PlaceholderType::TEXTFRAME; break;
2519  case JE_FMT_GRAPHIC:nRet = text::PlaceholderType::GRAPHIC; break;
2520  case JE_FMT_OLE: nRet = text::PlaceholderType::OBJECT; break;
2521  default:
2522  nRet = text::PlaceholderType::TEXT; break;
2523  }
2524  rAny <<= nRet;
2525  }
2526  break;
2527  case FIELD_PROP_PAR1 :
2528  rAny <<= m_sHelp;
2529  break;
2530  case FIELD_PROP_PAR2 :
2531  rAny <<= m_sText;
2532  break;
2533  default:
2534  assert(false);
2535  }
2536  return true;
2537 }
2538 
2539 bool SwJumpEditField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
2540 {
2541  switch( nWhichId )
2542  {
2543  case FIELD_PROP_USHORT1:
2544  {
2545  //JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
2546  // called with a int32 value! But normally we need
2547  // here only a int16
2548  sal_Int32 nSet = 0;
2549  rAny >>= nSet;
2550  switch( nSet )
2551  {
2552  case text::PlaceholderType::TEXT : SetFormat(JE_FMT_TEXT); break;
2553  case text::PlaceholderType::TABLE : SetFormat(JE_FMT_TABLE); break;
2554  case text::PlaceholderType::TEXTFRAME: SetFormat(JE_FMT_FRAME); break;
2555  case text::PlaceholderType::GRAPHIC : SetFormat(JE_FMT_GRAPHIC); break;
2556  case text::PlaceholderType::OBJECT : SetFormat(JE_FMT_OLE); break;
2557  }
2558  }
2559  break;
2560  case FIELD_PROP_PAR1 :
2561  rAny >>= m_sHelp;
2562  break;
2563  case FIELD_PROP_PAR2 :
2564  rAny >>= m_sText;
2565  break;
2566  default:
2567  assert(false);
2568  }
2569  return true;
2570 }
2571 
2572 // combined character field type
2573 
2576 {
2577 }
2578 
2579 std::unique_ptr<SwFieldType> SwCombinedCharFieldType::Copy() const
2580 {
2581  return std::make_unique<SwCombinedCharFieldType>();
2582 }
2583 
2584 // combined character field
2585 
2587  const OUString& rChars )
2588  : SwField( pFTyp, 0 ),
2589  m_sCharacters( rChars.copy( 0, std::min<sal_Int32>(rChars.getLength(), MAX_COMBINED_CHARACTERS) ))
2590 {
2591 }
2592 
2594 {
2595  return m_sCharacters;
2596 }
2597 
2598 std::unique_ptr<SwField> SwCombinedCharField::Copy() const
2599 {
2600  return std::make_unique<SwCombinedCharField>( static_cast<SwCombinedCharFieldType*>(GetTyp()),
2601  m_sCharacters );
2602 }
2603 
2605 {
2606  return m_sCharacters;
2607 }
2608 
2609 void SwCombinedCharField::SetPar1(const OUString& rStr)
2610 {
2611  m_sCharacters = rStr.copy(0, std::min<sal_Int32>(rStr.getLength(), MAX_COMBINED_CHARACTERS));
2612 }
2613 
2615  sal_uInt16 nWhichId ) const
2616 {
2617  switch( nWhichId )
2618  {
2619  case FIELD_PROP_PAR1:
2620  rAny <<= m_sCharacters;
2621  break;
2622  default:
2623  assert(false);
2624  }
2625  return true;
2626 }
2627 
2629  sal_uInt16 nWhichId )
2630 {
2631  switch( nWhichId )
2632  {
2633  case FIELD_PROP_PAR1:
2634  {
2635  OUString sTmp;
2636  rAny >>= sTmp;
2637  SetPar1(sTmp);
2638  }
2639  break;
2640  default:
2641  assert(false);
2642  }
2643  return true;
2644 }
2645 
2646 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
SwPostItFieldType(SwDoc *pDoc)
Definition: docufld.cxx:1711
Reference< XTypeConverter > xConverter
virtual void SetPar1(const OUString &rStr) override
set place holder text
Definition: docufld.cxx:2491
SvxNumType GetNumberingType() const
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:240
const SwDocInfoSubType DI_SUB_TIME
Definition: docufld.hxx:79
Base class of the Writer layout elements.
Definition: frame.hxx:297
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
const_iterator lower_bound(const Value &x) const
sal_uLong GetIndex() const
Definition: node.hxx:282
IDocumentStatistics const & getIDocumentStatistics() const
Definition: doc.cxx:372
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:1022
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: fldbas.cxx:813
SwPostItField(SwPostItFieldType *, const OUString &rAuthor, const OUString &rText, const OUString &rInitials, const OUString &rName, const DateTime &rDate, const bool bResolved=false, const sal_uInt32 nPostItId=0)
Definition: docufld.cxx:1725
static double lcl_TimeToDouble(const T &rTime)
Definition: docufld.cxx:1004
OUString GetToken(UserOptToken nToken) const
sal_Int32 GetNumberOfParagraphs() const
Definition: docufld.cxx:1828
#define FIELD_PROP_DATE_TIME
Definition: unofldmid.h:38
Marks a position in the document model.
Definition: pam.hxx:35
virtual void SetPar1(const OUString &rStr) override
Definition: docufld.cxx:2609
virtual void SetPar2(const OUString &rStr) override
True/False - String.
Definition: docufld.cxx:1417
const SwField * GetField() const
Definition: fmtfld.hxx:111
bool IsInDocBody() const
Definition: frame.hxx:921
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:1150
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
LanguageType GetLanguage() const
Language at field position.
Definition: fldbas.hxx:406
sal_uInt16 m_nPageNumber
Definition: docufld.hxx:148
sal_uLong StartOfSectionIndex() const
Definition: node.hxx:673
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:2455
sal_uLong nPara
paragraphs for document statistic: non-empty and non-hidden ones
Definition: docstat.hxx:32
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:2628
const char aData[]
Definition: ww8scan.hxx:47
virtual const SwRootFrame * GetCurrentLayout() const =0
static ShellResource * GetShellRes()
Definition: viewsh.cxx:2485
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:2139
DateTime m_aDateTime
Definition: docufld.hxx:447
OUString sDurationFormat
Definition: shellres.hxx:49
SwDocShell * GetDocShell()
Definition: doc.hxx:1348
sal_uInt32 GetFormat() const
Query parameters for dialog and for BASIC.
Definition: fldbas.hxx:401
virtual sal_uInt16 GetSubType() const override
Definition: docufld.cxx:2018
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1407
SwDocStatField(SwDocStatFieldType *, sal_uInt16 nSubType, sal_uInt32 nFormat)
Definition: docufld.cxx:753
SwDoc * GetDoc() const
Definition: docufld.hxx:435
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:632
virtual OUString GetPar2() const override
Definition: docufld.cxx:2113
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:320
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:232
SwNodeIndex nNode
Definition: pam.hxx:37
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: docufld.cxx:1933
sal_uInt16 char char * pDesc
SwRefPageGetFieldType(SwDoc *pDoc)
Definition: docufld.cxx:2157
void ChangeExpansion(const SwFrame &rFrame, const SwTextField *pField)
Definition: docufld.cxx:2349
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
bool GetLogicNames(const OUString &rPath, OUString &rRegion, OUString &rName) const
SVX_NUM_NUMBER_NONE
OUString m_sUserStr
Definition: docufld.hxx:144
sal_uIntPtr sal_uLong
OUString sDataSource
Definition: swdbdata.hxx:30
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:2010
bool IsFixed() const
Definition: fldbas.cxx:411
Base class of all fields.
Definition: fldbas.hxx:293
OUString Expand(sal_uLong) const
Definition: docufld.cxx:573
virtual void SetPar2(const OUString &rStr) override
set the PostIt's text
Definition: docufld.cxx:1805
#define FIELD_PROP_USHORT1
Definition: unofldmid.h:31
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:1664
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1190
Definition: doc.hxx:184
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:2579
SVL_DLLPUBLIC OUString removePassword(OUString const &rURI, INetURLObject::EncodeMechanism eEncodeMechanism, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
virtual OUString GetPar2() const override
Definition: docufld.cxx:217
sal_uLong nChar
Definition: docstat.hxx:37
sal_uInt16 nTable
Definition: docstat.hxx:27
virtual OUString GetPar1() const override
Author.
Definition: docufld.cxx:1799
OUString m_aTRUEText
Text if condition true.
Definition: docufld.hxx:293
const SwDocInfoSubType DI_COMMENT
Definition: docufld.hxx:69
SwJumpEditFieldType(SwDoc *pDoc)
Definition: docufld.cxx:2450
sal_Int16 m_nNumberingType
Definition: docufld.hxx:608
void SetTextObject(std::unique_ptr< OutlinerParaObject > pText)
Definition: docufld.cxx:1823
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:800
#define URL_DECODE
Definition: docufld.cxx:89
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:481
OUString m_aCond
Condition.
Definition: docufld.hxx:297
void ToggleResolved()
Definition: docufld.cxx:1770
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
SwRefPageGetField(SwRefPageGetFieldType *, sal_uInt32 nFormat)
Definition: docufld.cxx:2316
SwNode & GetEndOfPostIts() const
A still empty section.
Definition: ndarr.hxx:152
static sal_Int32 DateToDays(sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear)
css::uno::Reference< css::frame::XModel > GetModel() const
bool IsInMerge() const
Definition: dbmgr.hxx:340
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:758
SwFileNameField(SwFileNameFieldType *, sal_uInt32 nFormat)
Definition: docufld.cxx:458
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:2478
SwDoc * GetDoc() const
Definition: fldbas.hxx:457
SwJumpEditField(SwJumpEditFieldType *, sal_uInt32 nFormat, const OUString &sText, const OUString &sHelp)
Definition: docufld.cxx:2467
OUString m_aContent
Definition: docufld.hxx:185
void SetResolved(bool bNewState)
Definition: docufld.cxx:1765
bool HasWriterListeners() const
Definition: calbck.hxx:208
SwTemplNameField(SwTemplNameFieldType *, sal_uInt32 nFormat)
Definition: docufld.cxx:628
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:2028
const SwDocInfoSubType DI_EDIT
Definition: docufld.hxx:74
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:340
#define FIELD_PROP_SUBTYPE
Definition: unofldmid.h:27
virtual void Modify(const SfxPoolItem *, const SfxPoolItem *) override
Overlay, because there is nothing to update!
Definition: docufld.cxx:2091
sal_Int32 getTokenCount(const OString &rIn, char cTok)
static void ParseIfFieldDefinition(const OUString &aFieldDefinition, OUString &rCondition, OUString &rTrue, OUString &rFalse)
Definition: docufld.cxx:1533
SvxNumType
static LanguageType nLang
Definition: srtdlg.cxx:51
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
Definition: fldbas.cxx:193
#define FIELD_PROP_FORMAT
Definition: unofldmid.h:26
OUString PathToFileName() const
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:191
void UpdateFields() const
Definition: fldbas.hxx:285
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:2108
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:832
SwDoc * m_pDoc
Definition: docbm.cxx:1190
OUString GetBase() const
css::util::Date GetUNODate() const
rtl::Reference< SwTextAPIObject > m_xTextObject
Definition: docufld.hxx:450
static double GetDateTime(SwDoc *pDoc, const DateTime &rDT)
Definition: flddat.cxx:121
const LocaleDataWrapper & GetLocaleData() const
OUString m_sName
OUString ReplacePoint(const OUString &rTmpName, bool bWithCommandType)
Definition: expfld.cxx:104
OUString m_sCharacters
combine these characters
Definition: docufld.hxx:732
#define min(a, b)
SwDoc * GetDoc() const
Definition: docufld.hxx:619
virtual OUString GetFieldName() const override
get name or content
Definition: docufld.cxx:1099
SwIndex nContent
Definition: pam.hxx:38
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void ChangeExpansion(SwDoc *pDoc, bool bVirtPageNum, const SvxNumType *pNumFormat)
Definition: docufld.cxx:128
sal_uInt16 GetMonth() const
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:425
OUString m_aContent
Definition: docufld.hxx:550
bool m_bResolved
Definition: docufld.hxx:448
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId)
Definition: fldbas.cxx:345
virtual sal_uInt16 GetSubType() const override
Definition: docufld.cxx:1132
#define MAX_COMBINED_CHARACTERS
Definition: docufld.hxx:728
virtual void SetPar1(const OUString &rStr) override
Condition.
Definition: docufld.cxx:1405
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:2162
SVX_NUM_ARABIC
const SwDocInfoSubType DI_SUBJECT
Definition: docufld.hxx:67
virtual void SetPar2(const OUString &rStr) override
set hint text
Definition: docufld.cxx:2503
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:763
virtual void SetLanguage(LanguageType nLng) override
set language of the format
Definition: fldbas.cxx:664
OUString FormatNumber(sal_uInt32 nNum, SvxNumType nFormat, LanguageType nLang)
expand numbering
Definition: fldbas.cxx:475
void SetHiddenFlag(bool bSetHidden)
Definition: docufld.cxx:1253
double GetTimeInDays() const
virtual OUString GetPar1() const override
Placeholder-Text.
Definition: docufld.cxx:2485
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:181
OUString m_sText
Definition: docufld.hxx:625
const SwFormatField & GetFormatField() const
Definition: txatbase.hxx:191
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1670
virtual OUString GetPar1() const override
Characters.
Definition: docufld.cxx:2604
OUString Expand(sal_uInt16 nSubType, sal_uInt32 nFormat, LanguageType nLang, const OUString &rName) const
Definition: docufld.cxx:848
SwHiddenParaField(SwHiddenParaFieldType *, const OUString &rCond)
Direct input, delete old value.
Definition: docufld.cxx:1646
sal_uInt16 nOLE
Definition: docstat.hxx:29
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:2085
virtual void SetSubType(sal_uInt16 nSub) override
Definition: docufld.cxx:774
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:1681
virtual void SetSubType(sal_uInt16) override
Definition: docufld.cxx:1137
SwHiddenTextField(SwHiddenTextFieldType *, bool bConditional, const OUString &rCond, const OUString &rText, bool bHidden, SwFieldTypesEnum nSubType=SwFieldTypesEnum::HiddenText)
Definition: docufld.cxx:1262
#define FIELD_PROP_DOUBLE
Definition: unofldmid.h:34
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:2051
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:519
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const
Definition: fldbas.cxx:332
void Evaluate(SwDoc *)
get current field value and cache it
Definition: docufld.cxx:1322
virtual void ModifyNotification(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
Definition: calbck.hxx:154
virtual OUString GetPar1() const override
Query, set condition.
Definition: docufld.cxx:1704
OUString m_sText
Definition: docufld.hxx:443
const SwDocInfoSubType DI_CUSTOM
Definition: docufld.hxx:75
DocumentType eType
css::util::DateTime GetUNODateTime() const
sal_Int16 GetYear() const
SVX_NUM_BITMAP
SVX_NUM_CHAR_SPECIAL
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:623
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:203
OUString m_aName
Definition: docufld.hxx:518
struct _xmlTextWriter * xmlTextWriterPtr
static double lcl_DateToDouble(const D &rDate, const Date &rNullDate)
Definition: docufld.cxx:1015
const SwDocInfoSubType DI_PRINT
Definition: docufld.hxx:72
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:1833
OUString m_aCond
Definition: docufld.hxx:359
static OUString GetTypeStr(SwFieldTypesEnum nTypeId)
Definition: fldbas.cxx:120
SwAuthorField(SwAuthorFieldType *, sal_uInt32 nFormat)
Definition: docufld.cxx:325
#define SW_MOD()
Definition: swmodule.hxx:255
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:1780
SwDBData const & GetDBData()
Definition: docfld.cxx:343
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:2410
OUString m_sAuthor
Definition: docufld.hxx:444
int i
void SetName(const OUString &rStr)
Definition: docufld.cxx:1817
virtual OUString GetFieldName() const override
get name or content
Definition: docufld.cxx:1379
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:453
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:207
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:1716
SwCharFormat * GetCharFormat()
Definition: docufld.cxx:2460
const SwDocInfoSubType DI_KEYS
Definition: docufld.hxx:68
bool GetMergeColumnCnt(const OUString &rColumnName, LanguageType nLanguage, OUString &rResult, double *pNumber)
Definition: dbmgr.cxx:2163
SwPageFrame * FindPageFrame()
Definition: frame.hxx:660
void ChangeExpansion(const SwFrame *pFrame)
Definition: docufld.cxx:779
#define FIELD_PROP_TEXT
Definition: unofldmid.h:48
#define FIELD_PROP_BOOL2
Definition: unofldmid.h:29
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:2002
sal_uInt16 m_nSubType
Definition: docufld.hxx:262
sal_uInt16 m_nSubType
Definition: docufld.hxx:516
static OUString GetDBName(const OUString &rName, SwDoc *pDoc)
Definition: docufld.cxx:1517
TElementType * First()
Definition: calbck.hxx:343
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:130
#define FIELD_PROP_USHORT2
Definition: unofldmid.h:32
virtual sal_uInt16 GetSubType() const override
Definition: docufld.cxx:227
OUString m_aFALSEText
If condition false.
Definition: docufld.hxx:294
const SwDocInfoSubType DI_CREATE
Definition: docufld.hxx:70
SwFieldTypesEnum
List of FieldTypes at UI.
Definition: fldbas.hxx:93
SwFieldIds
Definition: fldbas.hxx:44
virtual OUString GetPar2() const override
Hint-Text.
Definition: docufld.cxx:2497
sw::WriterMultiListener m_aDep
Definition: docufld.hxx:645
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:2593
std::vector< OUString > aDocInfoLst
Definition: shellres.hxx:61
static void lcl_GetLocalDataWrapper(LanguageType nLang, const LocaleDataWrapper **ppAppLocalData, const LocaleDataWrapper **ppLocalData)
Definition: docufld.cxx:837
OUString m_aContent
Definition: docufld.hxx:211
static OUString GetColumnName(const OUString &rName)
Definition: docufld.cxx:1504
void SetFormat(sal_uInt32 const nSet)
Definition: fldbas.hxx:307
bool IsOn() const
Definition: docufld.hxx:596
sal_uInt16 m_nMaxPage
Definition: docufld.hxx:149
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:2335
sal_uInt16 GetDay() const
virtual OUString GetPar2() const override
get True/False text
Definition: docufld.cxx:1435
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:743
virtual void SetPar1(const OUString &rStr) override
set author
Definition: docufld.cxx:1793
const SwDocInfoSubType DI_SUB_DATE
Definition: docufld.hxx:80
Marks a node in the document model.
Definition: ndindex.hxx:31
bool HasName() const
css::uno::Type const & get()
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:1449
sal_uInt16 m_nSubType
Definition: docufld.hxx:145
std::unique_ptr< OutlinerParaObject > mpText
Definition: docufld.hxx:449
OUString SwResId(const char *pId)
Definition: swmodule.cxx:178
OUString GetID() const
bool empty() const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:2123
SwDoc * GetDoc() const
Definition: fldbas.hxx:423
sal_uInt64 m_nOffset
bool IsAutomaticLanguage() const
Definition: fldbas.hxx:383
static sal_uInt32 m_nLastPostItId
Definition: docufld.hxx:454
SvxNumType m_nNumberingType
Definition: docufld.hxx:250
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:1391
A page of the document layout.
Definition: pagefrm.hxx:41
SVX_NUM_CHARS_LOWER_LETTER_N
#define DB_DELIM
Definition: swtypes.hxx:137
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:404
#define FIELD_PROP_PAR3
Definition: unofldmid.h:25
const OUString & GetName() const
Definition: docufld.hxx:488
short GetOffset() const
Definition: docufld.hxx:598
sal_uLong nPage
Definition: docstat.hxx:30
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:1889
SwFieldType * GetTyp() const
Definition: fldbas.hxx:396
void SetText(const OUString &rText, SwRootFrame const *pLayout)
Definition: docufld.cxx:2322
virtual ~SwPostItField() override
Definition: docufld.cxx:1745
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:263
void ChangeExpansion(sal_uInt16 const nPageNumber, sal_uInt16 const nMaxPage)
Definition: docufld.cxx:174
const_iterator begin() const
void NotifyClients(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
Definition: calbck.cxx:167
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:464
const SwDocInfoSubType DI_SUB_AUTHOR
Definition: docufld.hxx:78
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
#define FIELD_PROP_BOOL1
Definition: unofldmid.h:28
Fields containing values that have to be formatted via number formatter.
Definition: fldbas.hxx:412
void StartListening(SwModify *pDepend)
Definition: calbck.cxx:335
SwHiddenTextFieldType(bool bSetHidden=true)
Definition: docufld.cxx:1243
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:348
OUString m_sHelp
Definition: docufld.hxx:657
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:1657
SwFieldTypesEnum GetTypeId() const
Definition: fldbas.cxx:238
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:1123
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:1956
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:1301
SVX_NUM_PAGEDESC
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:637
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:334
sal_uInt16 nGrf
Definition: docstat.hxx:28
virtual void Modify(const SfxPoolItem *, const SfxPoolItem *) override
overwritten to update all RefPageGet fields
Definition: docufld.cxx:2169
SwDocInfoField(SwDocInfoFieldType *, sal_uInt16 nSub, const OUString &rName, sal_uInt32 nFormat=0)
Definition: docufld.cxx:989
SwDocStatFieldType(SwDoc *)
Definition: docufld.cxx:708
OUString m_aContent
Definition: docufld.hxx:517
virtual void SetLanguage(LanguageType nLng)
Definition: fldbas.cxx:401
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:642
#define FIELD_PROP_PAR1
Definition: unofldmid.h:23
OUString m_sInitials
Initials of the author.
Definition: docufld.hxx:445
OUString ExpandValue(const double &rVal, sal_uInt32 nFormat, LanguageType nLng) const
return value formatted as string
Definition: fldbas.cxx:506
const SwDocInfoSubType DI_SUBTYPE_BEGIN
NB: these must denote consecutive integers! NB2: these are extended by 4 DI_INFO values for backward ...
Definition: docufld.hxx:65
OUString Expand(sal_uInt16 nSubType, SvxNumType nFormat) const
Definition: docufld.cxx:714
UserOptToken
#define FIELD_PROP_PAR2
Definition: unofldmid.h:24
bool IsFieldDeletedInModel(IDocumentRedlineAccess const &rIDRA, SwTextField const &rTextField)
const SwDocInfoSubType DI_DOCNO
Definition: docufld.hxx:73
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:1639
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:2103
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:2340
static OUString Expand(sal_uInt16 nSubType)
Definition: docufld.cxx:1961
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:472
sal_uInt32 m_nPostItId
Definition: docufld.hxx:451
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:253
SwPageNumberField(SwPageNumberFieldType *, sal_uInt16 nSub, sal_uInt32 nFormat, short nOff=0, sal_uInt16 const nPageNumber=0, sal_uInt16 const nMaxPage=0)
Definition: docufld.cxx:165
SwRefPageSetField(SwRefPageSetFieldType *, short nOff, bool bOn)
Definition: docufld.cxx:2097
OUString Expand(sal_uLong) const
Definition: docufld.cxx:401
virtual const SwDocStat & GetDocStat() const =0
Document - Statistics.
OUString aName
static OUString Expand(sal_uLong)
Definition: docufld.cxx:311
INetProtocol GetProtocol() const
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:118
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:2508
SwNodes & GetNodes()
Definition: doc.hxx:403
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:2539
void copy(const fs::path &src, const fs::path &dest)
SwDocInfoFieldType(SwDoc *pDc)
Definition: docufld.cxx:827
const INetURLObject & GetURLObject() const
Reference< XComponentContext > getProcessComponentContext()
QPRO_FUNC_TYPE nType
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:1755
double getLength(const B2DPolygon &rCandidate)
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding)...
Definition: rootfrm.hxx:416
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:1474
virtual sal_uInt16 GetSubType() const override
Definition: docufld.cxx:769
sal_uInt16 m_nType
Definition: docufld.hxx:551
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:2426
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:331
OUString m_sTextRLHidden
hidden redlines
Definition: docufld.hxx:626
void SetOffset(short nOff)
Definition: docufld.hxx:599
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:669
OUString m_sName
Name of the comment.
Definition: docufld.hxx:446
bool IsDataSourceOpen(const OUString &rDataSource, const OUString &rTableOrQuery, bool bMergeShell)
check if a data source is open
Definition: dbmgr.cxx:2079
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:370
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
Definition: docufld.cxx:1195
virtual OUString GetPar2() const override
Text.
Definition: docufld.cxx:1811
virtual OUString GetDescription() const override
Definition: docufld.cxx:1760
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:2614
OUString GetFullName() const
OUString aFixedStr
Definition: shellres.hxx:47
#define FIELD_PROP_DATE
Definition: unofldmid.h:30
SwTemplNameFieldType(SwDoc *)
Definition: docufld.cxx:567
#define FIELD_PROP_PAR4
Definition: unofldmid.h:36
SwFieldTypesEnum m_nSubType
Definition: docufld.hxx:298
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:1652
OUString m_aContent
Evaluated DB-text.
Definition: docufld.hxx:295
const SwDocInfoSubType DI_SUB_FIXED
Definition: docufld.hxx:81
const SwDocInfoSubType DI_CHANGE
Definition: docufld.hxx:71
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
Definition: docufld.cxx:786
virtual std::unique_ptr< SwFieldType > Copy() const override
Definition: docufld.cxx:1248
sal_uLong nWord
Definition: docstat.hxx:35
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
std::pair< const_iterator, bool > insert(Value &&x)
SvxNumType m_nNumberingType
Definition: docufld.hxx:128
bool m_bIsHidden
Is it not visible?
Definition: docufld.hxx:301
const SwDocInfoSubType DI_TITLE
Definition: docufld.hxx:66
bool MakeSetList(SetGetExpFields &rTmpLst, SwRootFrame const *pLayout)
Definition: docufld.cxx:2211
const Date & GetNullDate() const
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:161
virtual void SetPar2(const OUString &rStr) override
Definition: docufld.cxx:222
virtual void SetSubType(sal_uInt16 nSub) override
Definition: docufld.cxx:2023
OUString ExpandValue(const double &rVal, sal_uInt32 nFormat, LanguageType nLng) const
Definition: fldbas.hxx:464
virtual std::unique_ptr< SwField > Copy() const override
Definition: docufld.cxx:2598
bool m_bCanToggle
Can field be toggled alone?
Definition: docufld.hxx:300
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
Definition: docufld.cxx:2473
OUString Expand(SvxNumType nFormat, short nOff, sal_uInt16 const nPageNumber, sal_uInt16 const nMaxPage, const OUString &, LanguageType=LANGUAGE_NONE) const
Definition: docufld.cxx:102
virtual double GetValue() const
Definition: fldbas.cxx:706
OUString sCommand
Definition: swdbdata.hxx:31
virtual sal_uInt16 GetSubType() const override
Definition: docufld.cxx:1444
aStr
sal_uInt16 GetPageNum() const
Definition: rootfrm.hxx:307
void UpdateField(SwTextField const *pTextField, SetGetExpFields const &rSetList, SwRootFrame const *pLayout)
Definition: docufld.cxx:2259
SwRootFrame * getRootFrame()
Definition: frame.hxx:659
sal_Int32 GetEnumAsInt32(const css::uno::Any &rVal)
Definition: swunohelper.cxx:49
SwExtUserField(SwExtUserFieldType *, sal_uInt16 nSub, sal_uInt32 nFormat)
Definition: docufld.cxx:1996
SwFileNameFieldType(SwDoc *)
Definition: docufld.cxx:395
OUString GetFull() const
virtual void SetPar2(const OUString &rStr) override
Definition: docufld.cxx:2118
SwDBManager * GetDBManager() const
Definition: doc.hxx:664
bool GetResolved() const
Definition: docufld.cxx:1775
sal_uInt16 nPos
std::vector< std::unique_ptr< SetGetExpField > >::const_iterator const_iterator
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1315
virtual void SetLanguage(LanguageType nLng) override
set language of the format
Definition: docufld.cxx:1142
sal_Int16 nValue
OUString m_sText
Definition: docufld.hxx:656
virtual OUString GetPar1() const override
Definition: docufld.cxx:1411
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
SwCombinedCharField(SwCombinedCharFieldType *, const OUString &rChars)
Definition: docufld.cxx:2586
Placeholder.
Definition: poolfmt.hxx:123
bool m_bValid
Is DB-field evaluated?
Definition: docufld.hxx:302
virtual void SetPar1(const OUString &rStr) override
set condition
Definition: docufld.cxx:1699
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
SfxMedium * GetMedium() const
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:193