LibreOffice Module sw (master)  1
ww8par5.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 <sal/types.h>
23 #include <tools/solar.h>
25 #include <comphelper/string.hxx>
27 #include <sot/storinfo.hxx>
28 #include <com/sun/star/embed/XStorage.hpp>
29 #include <com/sun/star/embed/ElementModes.hpp>
30 #include <com/sun/star/embed/XTransactedObject.hpp>
31 #include <com/sun/star/task/InteractionHandler.hpp>
32 
33 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
34 #include <svl/lngmisc.hxx>
35 #include <svl/urihelper.hxx>
36 #include <svl/zforlist.hxx>
37 #include <svl/zformat.hxx>
38 #include <sfx2/linkmgr.hxx>
39 #include <rtl/character.hxx>
40 #include <unotools/charclass.hxx>
41 
42 #include <ucbhelper/content.hxx>
44 
45 #include <com/sun/star/i18n/ScriptType.hpp>
46 #include <com/sun/star/i18n/XBreakIterator.hpp>
47 #include <hintids.hxx>
48 #include <editeng/fontitem.hxx>
49 #include <editeng/fhgtitem.hxx>
50 #include <editeng/langitem.hxx>
51 #include <fmtfld.hxx>
52 #include <fmtanchr.hxx>
53 #include <pam.hxx>
54 #include <doc.hxx>
56 #include <IDocumentMarkAccess.hxx>
57 #include <IDocumentState.hxx>
58 #include <charatr.hxx>
59 #include <flddat.hxx>
60 #include <docufld.hxx>
61 #include <reffld.hxx>
62 #include <IMark.hxx>
63 #include <expfld.hxx>
64 #include <dbfld.hxx>
65 #include <usrfld.hxx>
66 #include <tox.hxx>
67 #include <section.hxx>
68 #include <ndtxt.hxx>
69 #include <fmtinfmt.hxx>
70 #include <chpfld.hxx>
71 #include <ftnidx.hxx>
72 #include <txtftn.hxx>
73 #include <viewsh.hxx>
74 #include <shellres.hxx>
75 #include <fmtruby.hxx>
76 #include <charfmt.hxx>
77 #include <txtatr.hxx>
78 #include <breakit.hxx>
79 #include <fmtclds.hxx>
80 #include <pagedesc.hxx>
81 #include <poolfmt.hxx>
82 #include <SwStyleNameMapper.hxx>
83 
84 #include "ww8scan.hxx"
85 #include "ww8par.hxx"
86 #include "ww8par2.hxx"
87 #include "writerhelper.hxx"
88 #include "fields.hxx"
89 #include <o3tl/safeint.hxx>
90 #include <unotools/fltrcfg.hxx>
91 #include <xmloff/odffields.hxx>
92 
93 #include <algorithm>
94 
95 #define MAX_FIELDLEN 64000
96 
97 #define WW8_TOX_LEVEL_DELIM ':'
98 
99 using namespace ::com::sun::star;
100 using namespace msfilter::util;
101 using namespace sw::util;
102 using namespace sw::mark;
103 using namespace std; // #i24377#
104 using namespace nsSwDocInfoSubType;
105 
106 // Bookmarks
107 namespace
108 {
109  // #120879# - helper method to identify a bookmark name to match the internal TOC bookmark naming convention
110  bool IsTOCBookmarkName(const OUString& rName)
111  {
112  return rName.startsWith("_Toc") || rName.startsWith(IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()+"_Toc");
113  }
114 
115  OUString EnsureTOCBookmarkName(const OUString& rName)
116  {
117  OUString sTmp = rName;
118  if ( IsTOCBookmarkName ( rName ) )
119  {
122  }
123  return sTmp;
124  }
125 }
126 
128 {
129  // should also work via pRes.nCo2OrIdx
130  WW8PLCFx_Book* pB = m_xPlcxMan->GetBook();
131  if( !pB )
132  {
133  OSL_ENSURE( pB, "WW8PLCFx_Book - Pointer does not exist" );
134  return 0;
135  }
136 
137  eBookStatus eB = pB->GetStatus();
138  if (eB & BOOK_IGNORE)
139  return 0; // ignore bookmark
140 
141  if (pB->GetIsEnd())
142  {
143  m_xReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_BOOKMARK, true,
144  pB->GetHandle(), (eB & BOOK_FIELD)!=0);
145  return 0;
146  }
147 
148  // "_Hlt*" are unnecessary
149  const OUString* pName = pB->GetName();
150  // Now, as we read the TOC field completely, we also need the hyperlinks inside keep available.
151  // So the hidden bookmarks inside for hyperlink jumping also should be kept.
152  if ( !pName ||
153  pName->startsWithIgnoreAsciiCase( "_Hlt" ) )
154  {
155  return 0;
156  }
157 
158  // do NOT call ToUpper as the bookmark name can also be a hyperlink target!
159 
160  OUString aVal;
161  if( SwFltGetFlag( m_nFieldFlags, SwFltControlStack::BOOK_TO_VAR_REF ) )
162  {
163  // set variable for translation bookmark
164  long nLen = pB->GetLen();
165  if( nLen > MAX_FIELDLEN )
166  nLen = MAX_FIELDLEN;
167 
168  long nOldPos = m_pStrm->Tell();
169  m_xSBase->WW8ReadString( *m_pStrm, aVal, pB->GetStartPos(), nLen,
170  m_eStructCharSet );
171  m_pStrm->Seek( nOldPos );
172 
173  // now here the implementation of the old "QuoteString" and
174  // I hope with a better performance as before. It's also only
175  // needed if the filterflags say we will convert bookmarks
176  // to SetExpFields! And this the exception!
177 
178  bool bSetAsHex;
179  bool bAllowCr = SwFltGetFlag(m_nFieldFlags,
181 
182  for( sal_Int32 nI = 0;
183  nI < aVal.getLength() && aVal.getLength() < (MAX_FIELDLEN - 4);
184  ++nI )
185  {
186  const sal_Unicode cChar = aVal[nI];
187  switch( cChar )
188  {
189  case 0x0b:
190  case 0x0c:
191  case 0x0d:
192  if( bAllowCr )
193  {
194  aVal = aVal.replaceAt( nI, 1, "\n" );
195  bSetAsHex = false;
196  }
197  else
198  bSetAsHex = true;
199  break;
200 
201  case 0xFE:
202  case 0xFF:
203  bSetAsHex = true;
204  break;
205 
206  default:
207  bSetAsHex = 0x20 > cChar;
208  break;
209  }
210 
211  if( bSetAsHex )
212  {
213  //all Hex-Numbers with \x before
214  OUString sTmp( "\\x" );
215  if( cChar < 0x10 )
216  sTmp += "0";
217  sTmp += OUString::number( cChar, 16 );
218  aVal = aVal.replaceAt( nI, 1 , sTmp );
219  nI += sTmp.getLength() - 1;
220  }
221  }
222 
223  if ( aVal.getLength() > (MAX_FIELDLEN - 4))
224  aVal = aVal.copy( 0, MAX_FIELDLEN - 4 );
225  }
226 
227  //e.g. inserting bookmark around field result, so we need to put
228  //it around the entire writer field, as we don't have the separation
229  //of field and field result of word, see #i16941#
230  SwPosition aStart(*m_pPaM->GetPoint());
231  if (!m_aFieldStack.empty())
232  {
233  const WW8FieldEntry &rTest = m_aFieldStack.back();
234  aStart = rTest.maStartPos;
235  }
236 
237  const OUString sOrigName = BookmarkToWriter(*pName);
238  m_xReffedStck->NewAttr( aStart,
239  SwFltBookmark( EnsureTOCBookmarkName( sOrigName ), aVal, pB->GetHandle(), IsTOCBookmarkName( sOrigName ) ));
240  return 0;
241 }
242 
244 {
245  if (WW8PLCFx_AtnBook* pAtnBook = m_xPlcxMan->GetAtnBook())
246  {
247  if (pAtnBook->getIsEnd())
248  m_xReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_ANNOTATIONMARK, true, pAtnBook->getHandle());
249  else
250  m_xReffedStck->NewAttr(*m_pPaM->GetPoint(), CntUInt16Item(RES_FLTR_ANNOTATIONMARK, pAtnBook->getHandle()));
251  }
252  return 0;
253 }
254 
256 {
257  if (WW8PLCFx_FactoidBook* pFactoidBook = m_xPlcxMan->GetFactoidBook())
258  {
259  if (pFactoidBook->getIsEnd())
260  m_xReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_RDFMARK, true, pFactoidBook->getHandle());
261  else
262  {
263  SwFltRDFMark aMark;
264  aMark.SetHandle(pFactoidBook->getHandle());
265  GetSmartTagInfo(aMark);
266  m_xReffedStck->NewAttr(*m_pPaM->GetPoint(), aMark);
267  }
268  }
269  return 0;
270 }
271 
272 // general help methods to separate parameters
273 
276 OUString SwWW8ImplReader::ConvertFFileName(const OUString& rOrg)
277 {
278  OUString aName = rOrg.replaceAll("\\\\", "\\");
279  aName = aName.replaceAll("%20", " ");
280 
281  // remove attached quotation marks
282  if (aName.endsWith("\""))
283  aName = aName.copy(0, aName.getLength()-1);
284 
285  // Need the more sophisticated url converter.
286  if (!aName.isEmpty())
287  aName = URIHelper::SmartRel2Abs(
288  INetURLObject(m_sBaseURL), aName, Link<OUString *, bool>(), false);
289 
290  return aName;
291 }
292 
293 namespace
294 {
297  void ConvertUFName( OUString& rName )
298  {
299  rName = GetAppCharClass().uppercase( rName );
300  }
301 }
302 
303 static void lcl_ConvertSequenceName(OUString& rSequenceName)
304 {
305  ConvertUFName(rSequenceName);
306  if ('0' <= rSequenceName[0] && '9' >= rSequenceName[0])
307  rSequenceName = "_" + rSequenceName;
308 }
309 
310 // FindParaStart() finds 1st Parameter that follows '\' and cToken
311 // and returns start of this parameter or -1
312 static sal_Int32 FindParaStart( const OUString& rStr, sal_Unicode cToken, sal_Unicode cToken2 )
313 {
314  bool bStr = false; // ignore inside a string
315 
316  for( sal_Int32 nBuf = 0; nBuf+1 < rStr.getLength(); nBuf++ )
317  {
318  if( rStr[ nBuf ] == '"' )
319  bStr = !bStr;
320 
321  if( !bStr
322  && rStr[ nBuf ] == '\\'
323  && ( rStr[ nBuf + 1 ] == cToken
324  || rStr[ nBuf + 1 ] == cToken2 ) )
325  {
326  nBuf += 2;
327  // skip spaces between cToken and its parameters
328  while( nBuf < rStr.getLength()
329  && rStr[ nBuf ] == ' ' )
330  nBuf++;
331  // return start of parameters
332  return nBuf < rStr.getLength() ? nBuf : -1;
333  }
334  }
335  return -1;
336 }
337 
338 // FindPara() finds the first parameter including '\' and cToken.
339 // A new String will be allocated (has to be deallocated by the caller)
340 // and everything that is part of the parameter will be returned.
341 static OUString FindPara( const OUString& rStr, sal_Unicode cToken, sal_Unicode cToken2 )
342 {
343  sal_Int32 n2; // end
344  sal_Int32 n = FindParaStart( rStr, cToken, cToken2 ); // start
345  if( n == -1)
346  return OUString();
347 
348  if( rStr[ n ] == '"'
349  || rStr[ n ] == 132 )
350  { // Quotationmark in front of parameter
351  n++; // Skip quotationmark
352  n2 = n; // search for the end starting from here
353  while( n2 < rStr.getLength()
354  && rStr[ n2 ] != 147
355  && rStr[ n2 ] != '"' )
356  n2++; // search end of parameter
357  }
358  else
359  { // no quotationmarks
360  n2 = n; // search for the end starting from here
361  while( n2 < rStr.getLength()
362  && rStr[ n2 ] != ' ' )
363  n2++; // search end of parameter
364  }
365  return rStr.copy( n, n2-n );
366 }
367 
368 static SvxNumType GetNumTypeFromName(const OUString& rStr,
369  bool bAllowPageDesc = false)
370 {
371  SvxNumType eTyp = bAllowPageDesc ? SVX_NUM_PAGEDESC : SVX_NUM_ARABIC;
372  if( rStr.startsWithIgnoreAsciiCase( "Arabi" ) ) // Arabisch, Arabic
373  eTyp = SVX_NUM_ARABIC;
374  else if( rStr.startsWith( "misch" ) ) // r"omisch
375  eTyp = SVX_NUM_ROMAN_LOWER;
376  else if( rStr.startsWith( "MISCH" ) ) // R"OMISCH
377  eTyp = SVX_NUM_ROMAN_UPPER;
378  else if( rStr.startsWithIgnoreAsciiCase( "alphabeti" ) )// alphabetisch, alphabetic
379  eTyp = ( rStr[0] == 'A' )
382  else if( rStr.startsWithIgnoreAsciiCase( "roman" ) ) // us
383  eTyp = ( rStr[0] == 'R' )
386  return eTyp;
387 }
388 
389 static SvxNumType GetNumberPara(const OUString& rStr, bool bAllowPageDesc = false)
390 {
391  OUString s( FindPara( rStr, '*', '*' ) ); // Type of number
392  SvxNumType aType = GetNumTypeFromName( s, bAllowPageDesc );
393  return aType;
394 }
395 
397 {
398  bool bRet(false);
399 
400  const SvxLanguageItem *pLang =
401  static_cast<const SvxLanguageItem*>(GetFormatAttr(RES_CHRATR_LANGUAGE));
402  OSL_ENSURE(pLang, "impossible");
403  LanguageType nDefault = pLang ? pLang->GetValue() : LANGUAGE_ENGLISH_US;
404 
405  if (nLang != nDefault)
406  {
407  rField.SetAutomaticLanguage(false);
408  rField.SetLanguage(nLang);
409  bRet = true;
410  }
411 
412  return bRet;
413 }
414 
416 {
417  //Get the system date in the correct final language layout, convert to
418  //a known language and modify the 2 digit year part to be 4 digit, and
419  //convert back to the correct language layout.
420  const sal_uInt32 nIndex = pFormatter->GetFormatIndex(NF_DATE_SYSTEM_SHORT, nLang);
421 
422  SvNumberformat aFormat = *(pFormatter->GetEntry(nIndex));
423  aFormat.ConvertLanguage(*pFormatter, nLang, LANGUAGE_ENGLISH_US);
424 
425  OUString sParams(aFormat.GetFormatstring());
426  // #i36594#
427  // Fix provided by mloiseleur@openoffice.org.
428  // A default date can have already 4 year digits, in some case
429  const sal_Int32 pos = sParams.indexOf("YYYY");
430  if ( pos == -1 )
431  {
432  sParams = sParams.replaceFirst("YY", "YYYY");
433  }
434  return sParams;
435 }
436 
437 SvNumFormatType SwWW8ImplReader::GetTimeDatePara(OUString const & rStr, sal_uInt32& rFormat,
438  LanguageType &rLang, int nWhichDefault, bool bHijri)
439 {
440  bool bRTL = false;
441  if (m_xPlcxMan && !m_bVer67)
442  {
443  SprmResult aResult = m_xPlcxMan->HasCharSprm(0x85A);
444  if (aResult.pSprm && aResult.nRemainingData >= 1 && *aResult.pSprm)
445  bRTL = true;
446  }
447  sal_uInt16 eLang = bRTL ? RES_CHRATR_CTL_LANGUAGE : RES_CHRATR_LANGUAGE;
448  const SvxLanguageItem *pLang = static_cast<const SvxLanguageItem*>(GetFormatAttr(eLang));
449  OSL_ENSURE(pLang, "impossible");
450  rLang = pLang ? pLang->GetValue() : LANGUAGE_ENGLISH_US;
451 
452  SvNumberFormatter* pFormatter = m_rDoc.GetNumberFormatter();
453  OUString sParams( FindPara( rStr, '@', '@' ) );// Date/Time
454  if (sParams.isEmpty())
455  {
456  bool bHasTime = false;
457  switch (nWhichDefault)
458  {
459  case ww::ePRINTDATE:
460  case ww::eSAVEDATE:
461  sParams = GetWordDefaultDateStringAsUS(pFormatter, rLang);
462  sParams += " HH:MM:SS AM/PM";
463  bHasTime = true;
464  break;
465  case ww::eCREATEDATE:
466  sParams += "DD/MM/YYYY HH:MM:SS";
467  bHasTime = true;
468  break;
469  default:
470  case ww::eDATE:
471  sParams = GetWordDefaultDateStringAsUS(pFormatter, rLang);
472  break;
473  }
474 
475  if (bHijri)
476  sParams = "[~hijri]" + sParams;
477 
478  sal_Int32 nCheckPos = 0;
479  SvNumFormatType nType = SvNumFormatType::DEFINED;
480  rFormat = 0;
481 
482  OUString sTemp(sParams);
483  pFormatter->PutandConvertEntry(sTemp, nCheckPos, nType, rFormat,
484  LANGUAGE_ENGLISH_US, rLang, false);
485  sParams = sTemp;
486 
487  return bHasTime ? SvNumFormatType::DATETIME : SvNumFormatType::DATE;
488  }
489 
490  sal_uLong nFormatIdx =
491  sw::ms::MSDateTimeFormatToSwFormat(sParams, pFormatter, rLang, bHijri,
492  GetFib().m_lid);
493  SvNumFormatType nNumFormatType = SvNumFormatType::UNDEFINED;
494  if (nFormatIdx)
495  nNumFormatType = pFormatter->GetType(nFormatIdx);
496  rFormat = nFormatIdx;
497 
498  return nNumFormatType;
499 }
500 
501 // Fields
502 
503 // Update respective fields after loading (currently references)
505 {
506  m_rDoc.getIDocumentState().SetUpdateExpFieldStat(true);
507  m_rDoc.SetInitDBFields(true); // Also update fields in the database
508 }
509 
511 {
512  sal_uInt16 nRet = 0;
513  WW8PLCFx_FLD* pF = m_xPlcxMan->GetField();
514  OSL_ENSURE(pF, "WW8PLCFx_FLD - Pointer not available");
515  WW8_CP nCP = 0;
516  if (!pF || !pF->EndPosIsFieldEnd(nCP))
517  return nRet;
518 
519  const SvtFilterOptions &rOpt = SvtFilterOptions::Get();
520  bool bUseEnhFields = rOpt.IsUseEnhancedFields();
521 
522  OSL_ENSURE(!m_aFieldStack.empty(), "Empty field stack");
523  if (!m_aFieldStack.empty())
524  {
525  /*
526  only hyperlinks currently need to be handled like this, for the other
527  cases we have inserted a field not an attribute with an unknown end
528  point
529  */
530  nRet = m_aFieldStack.back().mnFieldId;
531  switch (nRet)
532  {
533  case ww::eFORMTEXT:
534  if (bUseEnhFields && m_pPaM!=nullptr && m_pPaM->GetPoint()!=nullptr) {
535  SwPosition aEndPos = *m_pPaM->GetPoint();
536  if (!::CheckNodesRange(m_aFieldStack.back().GetPtNode(),
537  aEndPos.nNode, true))
538  { // example ofz7322-1.doc
539  SAL_INFO("sw.ww8", "skipping field with invalid node range");
540  break;
541  }
542  SwPaM aFieldPam( m_aFieldStack.back().GetPtNode(), m_aFieldStack.back().GetPtContent(), aEndPos.nNode, aEndPos.nContent.GetIndex());
543  IDocumentMarkAccess* pMarksAccess = m_rDoc.getIDocumentMarkAccess( );
544  IFieldmark *pFieldmark = pMarksAccess->makeFieldBookmark(
545  aFieldPam, m_aFieldStack.back().GetBookmarkName(), ODF_FORMTEXT,
546  aFieldPam.Start() /*same pos as start!*/ );
547  OSL_ENSURE(pFieldmark!=nullptr, "hmmm; why was the bookmark not created?");
548  if (pFieldmark!=nullptr) {
549  // adapt redline positions to inserted field mark start
550  // dummy char (assume not necessary for end dummy char)
551  m_xRedlineStack->MoveAttrs(*aFieldPam.Start());
552  const IFieldmark::parameter_map_t& rParametersToAdd = m_aFieldStack.back().getParameters();
553  pFieldmark->GetParameters()->insert(rParametersToAdd.begin(), rParametersToAdd.end());
554  }
555  }
556  break;
557  // Doing corresponding status management for TOX field, index field, hyperlink field and page reference field
558  case ww::eTOC://TOX
559  case ww::eINDEX://index
560  if (m_bLoadingTOXCache)
561  {
562  if (m_nEmbeddedTOXLevel > 0)
563  {
564  JoinNode(*m_pPaM);
565  --m_nEmbeddedTOXLevel;
566  }
567  else
568  {
569  m_aTOXEndCps.insert(nCP);
570  m_bLoadingTOXCache = false;
571  if ( m_pPaM->End() &&
572  m_pPaM->End()->nNode.GetNode().GetTextNode() &&
573  m_pPaM->End()->nNode.GetNode().GetTextNode()->Len() == 0 )
574  {
575  JoinNode(*m_pPaM);
576  }
577  else
578  {
579  m_bCareLastParaEndInToc = true;
580  }
581 
582  if (m_pPosAfterTOC)
583  {
584  *m_pPaM = *m_pPosAfterTOC;
585  m_pPosAfterTOC.reset();
586  }
587  }
588  }
589  break;
590  case ww::ePAGEREF: //REF
591  if (m_bLoadingTOXCache && !m_bLoadingTOXHyperlink)
592  {
593  m_xCtrlStck->SetAttr(*m_pPaM->GetPoint(),RES_TXTATR_INETFMT);
594  }
595  break;
596  case ww::eHYPERLINK:
597  if (m_bLoadingTOXHyperlink)
598  m_bLoadingTOXHyperlink = false;
599  m_xCtrlStck->SetAttr(*m_pPaM->GetPoint(), RES_TXTATR_INETFMT);
600  break;
601  case ww::eMERGEINC:
602  case ww::eINCLUDETEXT:
603  //Move outside the section associated with this type of field
604  *m_pPaM->GetPoint() = m_aFieldStack.back().maStartPos;
605  break;
606  case ww::eIF: // IF-field
607  {
608  // conditional field parameters
609  const OUString& fieldDefinition = m_aFieldStack.back().GetBookmarkCode();
610 
611  OUString paramCondition;
612  OUString paramTrue;
613  OUString paramFalse;
614 
615  SwHiddenTextField::ParseIfFieldDefinition(fieldDefinition, paramCondition, paramTrue, paramFalse);
616 
617  // create new field
618  SwFieldType* pFieldType = m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::HiddenText);
619  SwHiddenTextField aHTField(
620  static_cast<SwHiddenTextFieldType*>(pFieldType),
621  paramCondition,
622  paramTrue,
623  paramFalse,
625 
626  // insert new field into document
627  m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aHTField));
628  break;
629  }
630  default:
631  OUString aCode = m_aFieldStack.back().GetBookmarkCode();
632  if ( !aCode.isEmpty() )
633  {
634  // Unhandled field with stored code
635  SwPosition aEndPos = *m_pPaM->GetPoint();
636  SwPaM aFieldPam(
637  m_aFieldStack.back().GetPtNode(), m_aFieldStack.back().GetPtContent(),
638  aEndPos.nNode, aEndPos.nContent.GetIndex());
639 
640  IDocumentMarkAccess* pMarksAccess = m_rDoc.getIDocumentMarkAccess( );
641 
642  IFieldmark* pFieldmark = pMarksAccess->makeFieldBookmark(
643  aFieldPam,
644  m_aFieldStack.back().GetBookmarkName(),
646  aFieldPam.Start() /*same pos as start!*/ );
647  if ( pFieldmark )
648  {
649  // adapt redline positions to inserted field mark start
650  // dummy char (assume not necessary for end dummy char)
651  m_xRedlineStack->MoveAttrs(*aFieldPam.Start());
652  const IFieldmark::parameter_map_t& rParametersToAdd = m_aFieldStack.back().getParameters();
653  pFieldmark->GetParameters()->insert(rParametersToAdd.begin(), rParametersToAdd.end());
654  OUString sFieldId = OUString::number( m_aFieldStack.back().mnFieldId );
655  pFieldmark->GetParameters()->insert(
656  std::pair< OUString, uno::Any > (
657  ODF_ID_PARAM,
658  uno::makeAny( sFieldId ) ) );
659  pFieldmark->GetParameters()->insert(
660  std::pair< OUString, uno::Any > (
662  uno::makeAny( aCode ) ) );
663 
664  if ( m_aFieldStack.back().mnObjLocFc > 0 )
665  {
666  // Store the OLE object as an internal link
667  OUString sOleId = "_" +
668  OUString::number( m_aFieldStack.back().mnObjLocFc );
669 
671  tools::SvRef<SotStorage> xSrc1 = xSrc0->OpenSotStorage( sOleId, StreamMode::READ );
672 
673  // Store it now!
674  uno::Reference< embed::XStorage > xDocStg = GetDoc().GetDocStorage();
675  if (xDocStg.is())
676  {
677  uno::Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
678  "OLELinks", embed::ElementModes::WRITE );
679  tools::SvRef<SotStorage> xObjDst = SotStorage::OpenOLEStorage( xOleStg, sOleId );
680 
681  if ( xObjDst.is() )
682  {
683  xSrc1->CopyTo( xObjDst.get() );
684 
685  if ( !xObjDst->GetError() )
686  xObjDst->Commit();
687  }
688 
689  uno::Reference< embed::XTransactedObject > xTransact( xOleStg, uno::UNO_QUERY );
690  if ( xTransact.is() )
691  xTransact->commit();
692  }
693 
694  // Store the OLE Id as a parameter
695  pFieldmark->GetParameters()->insert(
696  std::pair< OUString, uno::Any >(
697  ODF_OLE_PARAM, uno::makeAny( sOleId ) ) );
698  }
699  }
700  }
701 
702  break;
703  }
704  m_aFieldStack.pop_back();
705  }
706  return nRet;
707 }
708 
709 static bool AcceptableNestedField(sal_uInt16 nFieldCode)
710 {
711  switch (nFieldCode)
712  {
713  case ww::eINDEX: // allow recursive field in TOC...
714  case ww::eTOC: // allow recursive field in TOC...
715  case ww::eMERGEINC:
716  case ww::eINCLUDETEXT:
717  case ww::eAUTOTEXT:
718  case ww::eHYPERLINK:
719  // Accept AutoTextList field as nested field.
720  // Thus, the field result is imported as plain text.
721  case ww::eAUTOTEXTLIST:
722  return true;
723  default:
724  return false;
725  }
726 }
727 
728 WW8FieldEntry::WW8FieldEntry(SwPosition const &rPos, sal_uInt16 nFieldId) throw()
729  : maStartPos(rPos), mnFieldId(nFieldId), mnObjLocFc(0)
730 {
731 }
732 
734  : maStartPos(rOther.maStartPos), mnFieldId(rOther.mnFieldId), mnObjLocFc(rOther.mnObjLocFc)
735 {
736 }
737 
738 void WW8FieldEntry::Swap(WW8FieldEntry &rOther) throw()
739 {
740  std::swap(maStartPos, rOther.maStartPos);
741  std::swap(mnFieldId, rOther.mnFieldId);
742 }
743 
745 {
746  WW8FieldEntry aTemp(rOther);
747  Swap(aTemp);
748  return *this;
749 }
750 
751 
752 void WW8FieldEntry::SetBookmarkName(const OUString& bookmarkName)
753 {
754  msBookmarkName=bookmarkName;
755 }
756 
757 void WW8FieldEntry::SetBookmarkType(const OUString& bookmarkType)
758 {
759  msMarkType=bookmarkType;
760 }
761 
762 void WW8FieldEntry::SetBookmarkCode(const OUString& bookmarkCode)
763 {
764  msMarkCode = bookmarkCode;
765 }
766 
767 
768 // Read_Field reads a field or returns 0 if the field cannot be read,
769 // so that the calling function reads the field in text format.
770 // Returnvalue: Total length of field
772 {
773  typedef eF_ResT (SwWW8ImplReader:: *FNReadField)( WW8FieldDesc*, OUString& );
774  enum Limits {eMax = 96};
775  static const FNReadField aWW8FieldTab[eMax+1] =
776  {
777  nullptr,
779  nullptr,
781  nullptr,
782  nullptr,
784  nullptr,
786  nullptr,
788  nullptr,
811  nullptr,
812  nullptr,
817  nullptr,
819  nullptr,
820  nullptr,
822  nullptr,
823  nullptr,
824  nullptr,
825  nullptr,
827  nullptr,
832  nullptr,
833 
834  nullptr, // 56
835 
839  nullptr,
840  nullptr,
841  nullptr,
842  nullptr,
843  &SwWW8ImplReader::Read_F_DocInfo, // 64 - DOCVARIABLE
844  nullptr,
845  nullptr,
848  nullptr,
852  nullptr, /*&SwWW8ImplReader::Read_F_Tox*/
853  nullptr,
854  nullptr,
855  nullptr,
856  nullptr,
857  nullptr,
858  nullptr,
859  nullptr,
860  nullptr,
861  nullptr,
863  nullptr, // 84
865  nullptr, // 86
868  nullptr, // 89
869  nullptr, // 90
871  nullptr, // 92
872  nullptr, // 93
873  nullptr, // 94
875  nullptr // eMax - Dummy empty method
876  };
877  OSL_ENSURE( SAL_N_ELEMENTS( aWW8FieldTab ) == eMax+1, "FieldFunc table not right" );
878 
879  WW8PLCFx_FLD* pF = m_xPlcxMan->GetField();
880  OSL_ENSURE(pF, "WW8PLCFx_FLD - Pointer not available");
881 
882  if (!pF || !pF->StartPosIsFieldStart())
883  return 0;
884 
885  bool bNested = false;
886  if (!m_aFieldStack.empty())
887  {
888  bNested = std::any_of(m_aFieldStack.cbegin(), m_aFieldStack.cend(),
889  [](const WW8FieldEntry& aField) { return !AcceptableNestedField(aField.mnFieldId); });
890  }
891 
892  WW8FieldDesc aF;
893  bool bOk = pF->GetPara(pRes->nCp2OrIdx, aF);
894 
895  OSL_ENSURE(bOk, "WW8: Bad Field!");
896  if (aF.nId == 33) aF.bCodeNest=false; // do not recurse into nested page fields
897  bool bCodeNest = aF.bCodeNest;
898  if ( aF.nId == 6 ) bCodeNest = false; // We can handle them and lose the inner data
899  if (aF.nId == 70) bCodeNest = false; // need to import 0x01 in FORMTEXT
900 
901  m_aFieldStack.emplace_back(*m_pPaM->GetPoint(), aF.nId);
902 
903  if (bNested)
904  return 0;
905 
906  sal_uInt16 n = (aF.nId <= eMax) ? aF.nId : static_cast<sal_uInt16>(eMax);
907  sal_uInt16 nI = n / 32; // # of sal_uInt32
908  sal_uInt32 nMask = 1 << ( n % 32 ); // Mask for bits
909 
910  if (SAL_N_ELEMENTS(m_nFieldTagAlways) <= nI)
911  { // if indexes larger than 95 are needed, then a new configuration
912  // item has to be added, and nFieldTagAlways/nFieldTagBad expanded!
913  return aF.nLen;
914  }
915 
916  if( m_nFieldTagAlways[nI] & nMask ) // Flag: Tag it
917  return Read_F_Tag( &aF ); // Result not as text
918 
919  if( !bOk || !aF.nId ) // Field corrupted
920  return aF.nLen; // -> ignore
921 
922  if( aF.nId > eMax - 1) // WW: Nested Field
923  {
924  if( m_nFieldTagBad[nI] & nMask ) // Flag: Tag it when bad
925  return Read_F_Tag( &aF ); // Result not as text
926  else
927  return aF.nLen;
928  }
929 
930  //Only one type of field (hyperlink) in drawing textboxes exists
931  if (aF.nId != 88 && m_xPlcxMan->GetDoingDrawTextBox())
932  return aF.nLen;
933 
934  bool bHasHandler = aWW8FieldTab[aF.nId] != nullptr;
935  if (aF.nId == 10) // STYLEREF
936  {
937  // STYLEREF, by default these are not handled.
938  bHasHandler = false;
939  sal_uInt64 nOldPos = m_pStrm->Tell();
940  OUString aStr;
941  aF.nLCode = m_xSBase->WW8ReadString(*m_pStrm, aStr, m_xPlcxMan->GetCpOfs() + aF.nSCode, aF.nLCode, m_eTextCharSet);
942  m_pStrm->Seek(nOldPos);
943 
944  WW8ReadFieldParams aReadParam(aStr);
945  sal_Int32 nRet = aReadParam.SkipToNextToken();
946  if (nRet == -2 && !aReadParam.GetResult().isEmpty())
947  // Single numeric argument: this can be handled by SwChapterField.
948  bHasHandler = rtl::isAsciiDigit(aReadParam.GetResult()[0]);
949 
950  if (bHasHandler)
951  {
952  nRet = aReadParam.SkipToNextToken();
953  // Handle using SwChapterField only in case there is no \[a-z]
954  // switch after the field argument.
955  bHasHandler = nRet < 0 || nRet == '*';
956  }
957  }
958 
959  // no routine available
960  if (!bHasHandler || bCodeNest)
961  {
962  if( m_nFieldTagBad[nI] & nMask ) // Flag: Tag it when bad
963  return Read_F_Tag( &aF ); // Result not as text
964  // only read result
965  if (aF.bResNest && !AcceptableNestedField(aF.nId))
966  return aF.nLen; // Result nested -> unusable
967 
968  long nOldPos = m_pStrm->Tell();
969  OUString aStr;
970  aF.nLCode = m_xSBase->WW8ReadString( *m_pStrm, aStr, m_xPlcxMan->GetCpOfs()+
971  aF.nSCode, aF.nLCode, m_eTextCharSet );
972  m_pStrm->Seek( nOldPos );
973 
974  // field codes which contain '/' or '.' are not displayed in WinWord
975  // skip if it is formula field or found space before. see #i119446, #i119585.
976  const sal_Int32 nDotPos = aStr.indexOf('.');
977  const sal_Int32 nSlashPos = aStr.indexOf('/');
978  sal_Int32 nSpacePos = aStr.indexOf( ' ', 1 );
979  if ( nSpacePos<0 )
980  nSpacePos = aStr.getLength();
981 
982  if ( !( aStr.getLength()>1 && aStr[1]=='=') &&
983  (( nDotPos>=0 && nDotPos < nSpacePos ) ||
984  ( nSlashPos>=0 && nSlashPos < nSpacePos )))
985  return aF.nLen;
986  else
987  {
988  // Link fields aren't supported, but they are bound to an OLE object
989  // that needs to be roundtripped
990  if ( aF.nId == 56 )
991  m_bEmbeddObj = true;
992  // Field not supported: store the field code for later use
993  m_aFieldStack.back().SetBookmarkCode( aStr );
994  return aF.nLen - aF.nLRes - 1; // skipped too many, the resulted field will be read like main text
995  }
996  }
997  else
998  { // read field
999  auto nOldPos = m_pStrm->Tell();
1000  OUString aStr;
1001  if ( aF.nId == 6 && aF.bCodeNest )
1002  {
1003  // TODO Extract the whole code string using the nested codes
1004  aF.nLCode = m_xSBase->WW8ReadString( *m_pStrm, aStr, m_xPlcxMan->GetCpOfs() +
1005  aF.nSCode, aF.nSRes - aF.nSCode - 1, m_eTextCharSet );
1006  }
1007  else
1008  {
1009  aF.nLCode = m_xSBase->WW8ReadString( *m_pStrm, aStr, m_xPlcxMan->GetCpOfs()+
1010  aF.nSCode, aF.nLCode, m_eTextCharSet );
1011  }
1012 
1013  // #i51312# - graphics inside field code not supported by Writer.
1014  // Thus, delete character 0x01, which stands for such a graphic.
1015  if (aF.nId==51) //#i56768# only do it for the MACROBUTTON field, since DropListFields need the 0x01.
1016  {
1017  aStr = aStr.replaceAll("\x01", "");
1018  }
1019 
1020  eF_ResT eRes = (this->*aWW8FieldTab[aF.nId])( &aF, aStr );
1021  m_pStrm->Seek(nOldPos);
1022 
1023  switch ( eRes )
1024  {
1025  case eF_ResT::OK:
1026  return aF.nLen;
1027  case eF_ResT::TEXT:
1028  // skipped too many, the resulted field will be read like main text
1029  // attributes can start at char 0x14 so skip one
1030  // char more back == "-2"
1031  if (aF.nLRes)
1032  return aF.nLen - aF.nLRes - 2;
1033  else
1034  return aF.nLen;
1035  case eF_ResT::TAGIGN:
1036  if ( m_nFieldTagBad[nI] & nMask ) // Flag: Tag bad
1037  return Read_F_Tag( &aF ); // Tag it
1038  return aF.nLen; // or ignore
1039  case eF_ResT::READ_FSPA:
1040  return aF.nLen - aF.nLRes - 2; // position on char 1
1041  default:
1042  return aF.nLen; // ignore
1043  }
1044  }
1045 }
1046 
1047 // Tag fields
1048 
1049 // MakeTagString() returns the position of the first CR / end of line / page break
1050 // in pText and converts only up to this point.
1051 // If none of these special characters is found, the function returns 0.
1052 void SwWW8ImplReader::MakeTagString( OUString& rStr, const OUString& rOrg )
1053 {
1054  bool bAllowCr = SwFltGetFlag( m_nFieldFlags, SwFltControlStack::TAGS_IN_TEXT )
1055  || SwFltGetFlag( m_nFieldFlags, SwFltControlStack::ALLOW_FLD_CR );
1056  sal_Unicode cChar;
1057  rStr = rOrg;
1058 
1059  for( sal_Int32 nI = 0;
1060  nI < rStr.getLength() && rStr.getLength() < (MAX_FIELDLEN - 4); ++nI )
1061  {
1062  bool bSetAsHex = false;
1063  cChar = rStr[ nI ];
1064  switch( cChar )
1065  {
1066  case 132: // Exchange typographical quotation marks for normal ones
1067  case 148:
1068  case 147:
1069  rStr = rStr.replaceAt( nI, 1, "\"" );
1070  break;
1071  case 19:
1072  rStr = rStr.replaceAt( nI, 1, "{" );
1073  break; // 19..21 to {|}
1074  case 20:
1075  rStr = rStr.replaceAt( nI, 1, "|" );
1076  break;
1077  case 21:
1078  rStr = rStr.replaceAt( nI, 1, "}" );
1079  break;
1080  case '\\': // Tag \{|} with \ ...
1081  case '{':
1082  case '|':
1083  case '}':
1084  rStr = rStr.replaceAt( nI, 0, "\\" );
1085  ++nI;
1086  break;
1087  case 0x0b:
1088  case 0x0c:
1089  case 0x0d:
1090  if( bAllowCr )
1091  rStr = rStr.replaceAt( nI, 1, "\n" );
1092  else
1093  bSetAsHex = true;
1094  break;
1095  case 0xFE:
1096  case 0xFF:
1097  bSetAsHex = true;
1098  break;
1099  default:
1100  bSetAsHex = 0x20 > cChar;
1101  break;
1102  }
1103 
1104  if( bSetAsHex )
1105  {
1106  //all Hex-Numbers with \x before
1107  OUString sTmp( "\\x" );
1108  if( cChar < 0x10 )
1109  sTmp += "0";
1110  sTmp += OUString::number( cChar, 16 );
1111  rStr = rStr.replaceAt( nI, 1 , sTmp );
1112  nI += sTmp.getLength() - 1;
1113  }
1114  }
1115 
1116  if( rStr.getLength() > (MAX_FIELDLEN - 4))
1117  rStr = rStr.copy( 0, MAX_FIELDLEN - 4 );
1118 }
1119 
1120 void SwWW8ImplReader::InsertTagField( const sal_uInt16 nId, const OUString& rTagText )
1121 {
1122  OUString aName("WwFieldTag");
1123  if( SwFltGetFlag( m_nFieldFlags, SwFltControlStack::TAGS_DO_ID ) ) // Number?
1124  aName += OUString::number( nId ); // return it?
1125 
1126  if( SwFltGetFlag(m_nFieldFlags, SwFltControlStack::TAGS_IN_TEXT))
1127  {
1128  aName += rTagText; // tag as text
1129  m_rDoc.getIDocumentContentOperations().InsertString(*m_pPaM, aName,
1131  }
1132  else
1133  { // tag normally
1134 
1135  SwFieldType* pFT = m_rDoc.getIDocumentFieldsAccess().InsertFieldType(
1136  SwSetExpFieldType( &m_rDoc, aName, nsSwGetSetExpType::GSE_STRING ) );
1137  SwSetExpField aField( static_cast<SwSetExpFieldType*>(pFT), rTagText ); // SUB_INVISIBLE
1138  sal_uInt16 nSubType = ( SwFltGetFlag( m_nFieldFlags, SwFltControlStack::TAGS_VISIBLE ) ) ? 0 : nsSwExtendedSubType::SUB_INVISIBLE;
1139  aField.SetSubType(nSubType | nsSwGetSetExpType::GSE_STRING);
1140 
1141  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
1142  }
1143 }
1144 
1146 {
1147  long nOldPos = m_pStrm->Tell();
1148 
1149  WW8_CP nStart = pF->nSCode - 1; // starting with 0x19
1150  WW8_CP nL = pF->nLen; // Total length with result and nest
1151  if( nL > MAX_FIELDLEN )
1152  nL = MAX_FIELDLEN; // MaxLength, by quoting
1153  // max. 4 times as big
1154  OUString sFText;
1155  m_xSBase->WW8ReadString( *m_pStrm, sFText,
1156  m_xPlcxMan->GetCpOfs() + nStart, nL, m_eStructCharSet);
1157 
1158  OUString aTagText;
1159  MakeTagString( aTagText, sFText );
1160  InsertTagField( pF->nId, aTagText );
1161 
1162  m_pStrm->Seek( nOldPos );
1163  return pF->nLen;
1164 }
1165 
1166 // normal fields
1167 
1169 {
1170  OUString aDef;
1171  OUString aQ;
1172  WW8ReadFieldParams aReadParam( rStr );
1173  for (;;)
1174  {
1175  const sal_Int32 nRet = aReadParam.SkipToNextToken();
1176  if ( nRet==-1 )
1177  break;
1178  switch( nRet )
1179  {
1180  case -2:
1181  if( aQ.isEmpty() )
1182  aQ = aReadParam.GetResult();
1183  break;
1184  case 'd':
1185  case 'D':
1186  if ( aReadParam.GoToTokenParam() )
1187  aDef = aReadParam.GetResult();
1188  break;
1189  }
1190  }
1191  if( aDef.isEmpty() )
1192  aDef = GetFieldResult( pF );
1193 
1194  if ( pF->nId != 0x01 ) // 0x01 fields have no result
1195  {
1196  SwInputField aField( static_cast<SwInputFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Input )),
1197  aDef, aQ, INP_TXT, 0, false );
1198  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
1199  }
1200 
1201  return eF_ResT::OK;
1202 }
1203 
1204 // GetFieldResult allocates a string and reads the resulted field
1206 {
1207  long nOldPos = m_pStrm->Tell();
1208 
1209  WW8_CP nStart = pF->nSRes; // result start
1210  WW8_CP nL = pF->nLRes; // result length
1211  if( !nL )
1212  return OUString(); // no result
1213 
1214  if( nL > MAX_FIELDLEN )
1215  nL = MAX_FIELDLEN; // MaxLength, by quoting
1216  // max. 4 times as big
1217 
1218  OUString sRes;
1219  m_xSBase->WW8ReadString( *m_pStrm, sRes, m_xPlcxMan->GetCpOfs() + nStart,
1220  nL, m_eStructCharSet );
1221 
1222  m_pStrm->Seek( nOldPos );
1223 
1224  //replace both CR 0x0D and VT 0x0B with LF 0x0A
1225  // at least in the cases where the result is added to an SwInputField
1226  // there must not be control characters in it
1227  OUStringBuffer buf(sRes.getLength());
1228  for (sal_Int32 i = 0; i < sRes.getLength(); ++i)
1229  {
1230  sal_Unicode const ch(sRes[i]);
1231  if (!linguistic::IsControlChar(ch))
1232  {
1233  buf.append(ch);
1234  }
1235  else
1236  {
1237  switch (ch)
1238  {
1239  case 0x0B:
1240  case '\r':
1241  buf.append('\n');
1242  break;
1243  case '\n':
1244  case '\t':
1245  buf.append(ch);
1246  break;
1247  default:
1248  SAL_INFO("sw.ww8", "GetFieldResult(): filtering control character");
1249  break;
1250  }
1251  }
1252  }
1253  return buf.makeStringAndClear();
1254 }
1255 
1256 /*
1257 Bookmarks can be set with fields SET and ASK, and they can be referenced with
1258 REF. When set, they behave like variables in writer, otherwise they behave
1259 like normal bookmarks. We can check whether we should use a show variable
1260 instead of a normal bookmark ref by converting to "show variable" at the end
1261 of the document those refs which look for the content of a bookmark but whose
1262 bookmarks were set with SET or ASK. (See SwWW8FltRefStack)
1263 
1264 The other piece of the puzzle is that refs that point to the "location" of the
1265 bookmark will in word actually point to the last location where the bookmark
1266 was set with SET or ASK, not the actual bookmark. This is only noticeable when
1267 a document sets the bookmark more than once. This is because word places the
1268 true bookmark at the location of the last set, but the refs will display the
1269 position of the first set before the ref.
1270 
1271 So what we will do is
1272 
1273 1) keep a list of all bookmarks that were set, any bookmark names mentioned
1274 here that are referred by content will be converted to show variables.
1275 
1276 2) create pseudo bookmarks for every position that a bookmark is set with SET
1277 or ASK but has no existing bookmark. We can then keep a map from the original
1278 bookmark name to the new one. As we parse the document new pseudo names will
1279 replace the older ones, so the map always contains the bookmark of the
1280 location that msword itself would use.
1281 
1282 3) word's bookmarks are case insensitive, writers are not. So we need to
1283 map case different versions together, regardless of whether they are
1284 variables or not.
1285 
1286 4) when a reference is (first) SET or ASK, the bookmark associated with it
1287 is placed around the 0x14 0x15 result part of the field. We will fiddle
1288 the placement to be the writer equivalent of directly before and after
1289 the field, which gives the same effect and meaning, to do so we must
1290 get any bookmarks in the field range, and begin them immediately before
1291 the set/ask field, and end them directly afterwards. MapBookmarkVariables
1292 returns an identifier of the bookmark attribute to close after inserting
1293 the appropriate set/ask field.
1294 */
1296  OUString &rOrigName, const OUString &rData)
1297 {
1298  OSL_ENSURE(m_xPlcxMan.get(), "No pPlcxMan");
1299  long nNo;
1300  /*
1301  If there was no bookmark associated with this set field, then we create a
1302  pseudo one and insert it in the document.
1303  */
1304  sal_uInt16 nIndex;
1305  m_xPlcxMan->GetBook()->MapName(rOrigName);
1306  OUString sName = m_xPlcxMan->GetBook()->GetBookmark(
1307  pF->nSCode, pF->nSCode + pF->nLen, nIndex);
1308  if (!sName.isEmpty())
1309  {
1310  m_xPlcxMan->GetBook()->SetStatus(nIndex, BOOK_IGNORE);
1311  nNo = nIndex;
1312  }
1313  else
1314  {
1315  nNo = m_xReffingStck->aFieldVarNames.size()+1;
1316  sName = "WWSetBkmk" + OUString::number(nNo);
1317  nNo += m_xPlcxMan->GetBook()->GetIMax();
1318  }
1319  m_xReffedStck->NewAttr(*m_pPaM->GetPoint(),
1320  SwFltBookmark( BookmarkToWriter(sName), rData, nNo ));
1321  m_xReffingStck->aFieldVarNames[rOrigName] = sName;
1322  return nNo;
1323 }
1324 
1325 /*
1326 Word can set a bookmark with set or with ask, such a bookmark is equivalent to
1327 our variables, but until the end of a document we cannot be sure if a bookmark
1328 is a variable or not, at the end we will have a list of reference names which
1329 were set or asked, all bookmarks using the content of those bookmarks are
1330 converted to show variables, those that reference the position of the field
1331 can be left as references, because a bookmark is also inserted at the position
1332 of a set or ask field, either by word, or in some special cases by the import
1333 filter itself.
1334 */
1336  SwFltStackEntry &rEntry)
1337 {
1338  SwFltStackEntry *pRet=nullptr;
1339  if (pField && SwFieldIds::GetRef == pField->Which())
1340  {
1341  //Get the name of the ref field, and see if actually a variable
1342  const OUString sName = pField->GetPar1();
1343  std::map<OUString, OUString, SwWW8::ltstr>::const_iterator
1344  aResult = aFieldVarNames.find(sName);
1345 
1346  if (aResult != aFieldVarNames.end())
1347  {
1348  SwGetExpField aField( static_cast<SwGetExpFieldType*>(
1349  pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::GetExp)), sName, nsSwGetSetExpType::GSE_STRING, 0);
1350  SwFormatField aTmp(aField);
1351  rEntry.pAttr.reset( aTmp.Clone() );
1352  pRet = &rEntry;
1353  }
1354  }
1355  return pRet;
1356 }
1357 
1358 OUString SwWW8ImplReader::GetMappedBookmark(const OUString &rOrigName)
1359 {
1360  OUString sName(BookmarkToWriter(rOrigName));
1361  OSL_ENSURE(m_xPlcxMan.get(), "no pPlcxMan");
1362  m_xPlcxMan->GetBook()->MapName(sName);
1363 
1364  //See if there has been a variable set with this name, if so get
1365  //the pseudo bookmark name that was set with it.
1366  std::map<OUString, OUString, SwWW8::ltstr>::const_iterator aResult =
1367  m_xReffingStck->aFieldVarNames.find(sName);
1368 
1369  return (aResult == m_xReffingStck->aFieldVarNames.end())
1370  ? sName : (*aResult).second;
1371 }
1372 
1373 // "ASK"
1375 {
1376  OUString sOrigName, aQ;
1377  OUString aDef;
1378  WW8ReadFieldParams aReadParam( rStr );
1379  for (;;)
1380  {
1381  const sal_Int32 nRet = aReadParam.SkipToNextToken();
1382  if ( nRet==-1 )
1383  break;
1384  switch( nRet )
1385  {
1386  case -2:
1387  if (sOrigName.isEmpty())
1388  sOrigName = aReadParam.GetResult();
1389  else if (aQ.isEmpty())
1390  aQ = aReadParam.GetResult();
1391  break;
1392  case 'd':
1393  case 'D':
1394  if ( aReadParam.GoToTokenParam() )
1395  aDef = aReadParam.GetResult();
1396  break;
1397  }
1398  }
1399 
1400  if (sOrigName.isEmpty())
1401  return eF_ResT::TAGIGN; // does not make sense without textmark
1402 
1403  const OUString aResult(GetFieldResult(pF));
1404 
1405  //#i24377#, munge Default Text into title as we have only one slot
1406  //available for aResult and aDef otherwise
1407  if (!aDef.isEmpty())
1408  {
1409  if (!aQ.isEmpty())
1410  aQ += " - ";
1411  aQ += aDef;
1412  }
1413 
1414  const long nNo = MapBookmarkVariables(pF, sOrigName, aResult);
1415 
1416  SwSetExpFieldType* pFT = static_cast<SwSetExpFieldType*>(m_rDoc.getIDocumentFieldsAccess().InsertFieldType(
1417  SwSetExpFieldType(&m_rDoc, sOrigName, nsSwGetSetExpType::GSE_STRING)));
1418  SwSetExpField aField(pFT, aResult);
1420  aField.SetInputFlag(true);
1421  aField.SetPromptText( aQ );
1422 
1423  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
1424 
1425  m_xReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_BOOKMARK, true, nNo);
1426  return eF_ResT::OK;
1427 }
1428 
1429 // "AUTONR"
1431 {
1432  if( !m_pNumFieldType ){ // 1st time
1433  SwSetExpFieldType aT( &m_rDoc, "AutoNr", nsSwGetSetExpType::GSE_SEQ );
1434  m_pNumFieldType = m_rDoc.getIDocumentFieldsAccess().InsertFieldType( aT );
1435  }
1436  SwSetExpField aField( static_cast<SwSetExpFieldType*>(m_pNumFieldType), OUString(),
1437  GetNumberPara( rStr ) );
1438  aField.SetValue( ++m_nFieldNum, nullptr );
1439  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
1440  return eF_ResT::OK;
1441 }
1442 
1443 // "SEQ"
1445 {
1446  OUString aSequenceName;
1447  OUString aBook;
1448  bool bHidden = false;
1449  bool bFormat = false;
1450  bool bCountOn = true;
1451  OUString sStart;
1452  SvxNumType eNumFormat = SVX_NUM_ARABIC;
1453  WW8ReadFieldParams aReadParam( rStr );
1454  for (;;)
1455  {
1456  const sal_Int32 nRet = aReadParam.SkipToNextToken();
1457  if ( nRet==-1 )
1458  break;
1459  switch( nRet )
1460  {
1461  case -2:
1462  if( aSequenceName.isEmpty() )
1463  aSequenceName = aReadParam.GetResult();
1464  else if( aBook.isEmpty() )
1465  aBook = aReadParam.GetResult();
1466  break;
1467 
1468  case 'h':
1469  if( !bFormat )
1470  bHidden = true; // activate hidden flag
1471  break;
1472 
1473  case '*':
1474  bFormat = true; // activate format flag
1475  if ( aReadParam.SkipToNextToken()!=-2 )
1476  break;
1477  if ( aReadParam.GetResult()!="MERGEFORMAT" && aReadParam.GetResult()!="CHARFORMAT" )
1478  eNumFormat = GetNumTypeFromName( aReadParam.GetResult() );
1479  break;
1480 
1481  case 'r':
1482  bCountOn = false;
1483  if ( aReadParam.SkipToNextToken()==-2 )
1484  sStart = aReadParam.GetResult();
1485  break;
1486 
1487  case 'c':
1488  bCountOn = false;
1489  break;
1490 
1491  case 'n':
1492  bCountOn = true; // Increase value by one (default)
1493  break;
1494 
1495  case 's': // Outline Level
1496  //#i19682, what I have to do with this value?
1497  break;
1498  }
1499  }
1500  if (aSequenceName.isEmpty() && aBook.isEmpty())
1501  return eF_ResT::TAGIGN;
1502 
1503  SwSetExpFieldType* pFT = static_cast<SwSetExpFieldType*>(m_rDoc.getIDocumentFieldsAccess().InsertFieldType(
1504  SwSetExpFieldType( &m_rDoc, aSequenceName, nsSwGetSetExpType::GSE_SEQ ) ) );
1505  SwSetExpField aField( pFT, OUString(), eNumFormat );
1506 
1507  //#i120654# Add bHidden for /h flag (/h: Hide the field result.)
1508  if (bHidden)
1510 
1511  if (!sStart.isEmpty())
1512  aField.SetFormula( aSequenceName + "=" + sStart );
1513  else if (!bCountOn)
1514  aField.SetFormula(aSequenceName);
1515 
1516  m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField));
1517  return eF_ResT::OK;
1518 }
1519 
1521 {
1522  WW8ReadFieldParams aReadParam(rString);
1523  sal_Int32 nRet = aReadParam.SkipToNextToken();
1524  if (nRet != -2)
1525  // \param was found, not normal text.
1526  return eF_ResT::TAGIGN;
1527 
1528  OUString aResult = aReadParam.GetResult();
1529  sal_Int32 nResult = aResult.toInt32();
1530  if (nResult < 1)
1531  return eF_ResT::TAGIGN;
1532 
1533  SwFieldType* pFieldType = m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Chapter);
1534  SwChapterField aField(static_cast<SwChapterFieldType*>(pFieldType), CF_TITLE);
1535  aField.SetLevel(nResult - 1);
1536  m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField));
1537 
1538  return eF_ResT::OK;
1539 }
1540 
1542 {
1543  sal_uInt16 nSub=0;
1544  // RegInfoFormat, DefaultFormat for DocInfoFields
1545  sal_uInt16 nReg = DI_SUB_AUTHOR;
1546  bool bDateTime = false;
1547 
1548  if( 85 == pF->nId )
1549  {
1550  OUString aDocProperty;
1551  WW8ReadFieldParams aReadParam( rStr );
1552  for (;;)
1553  {
1554  const sal_Int32 nRet = aReadParam.SkipToNextToken();
1555  if ( nRet==-1 )
1556  break;
1557  switch( nRet )
1558  {
1559  case -2:
1560  if( aDocProperty.isEmpty() )
1561  aDocProperty = aReadParam.GetResult();
1562  break;
1563  case '*':
1564  //Skip over MERGEFORMAT
1565  (void)aReadParam.SkipToNextToken();
1566  break;
1567  }
1568  }
1569 
1570  aDocProperty = aDocProperty.replaceAll("\"", "");
1571 
1572  /*
1573  There are up to 26 fields that may be meant by 'DocumentProperty'.
1574  Which of them is to be inserted here ?
1575  This Problem can only be solved by implementing a name matching
1576  method that compares the given Parameter String with the four
1577  possible name sets (english, german, french, spanish)
1578  */
1579 
1580  static const sal_Char* aName10 = "\x0F"; // SW field code
1581  static const sal_Char* aName11 // German
1582  = "TITEL";
1583  static const sal_Char* aName12 // French
1584  = "TITRE";
1585  static const sal_Char* aName13 // English
1586  = "TITLE";
1587  static const sal_Char* aName14 // Spanish
1588  = "TITRO";
1589  static const sal_Char* aName20 = "\x15"; // SW field code
1590  static const sal_Char* aName21 // German
1591  = "ERSTELLDATUM";
1592  static const sal_Char* aName22 // French
1593  = "CR\xC9\xC9";
1594  static const sal_Char* aName23 // English
1595  = "CREATED";
1596  static const sal_Char* aName24 // Spanish
1597  = "CREADO";
1598  static const sal_Char* aName30 = "\x16"; // SW field code
1599  static const sal_Char* aName31 // German
1600  = "ZULETZTGESPEICHERTZEIT";
1601  static const sal_Char* aName32 // French
1602  = "DERNIERENREGISTREMENT";
1603  static const sal_Char* aName33 // English
1604  = "SAVED";
1605  static const sal_Char* aName34 // Spanish
1606  = "MODIFICADO";
1607  static const sal_Char* aName40 = "\x17"; // SW field code
1608  static const sal_Char* aName41 // German
1609  = "ZULETZTGEDRUCKT";
1610  static const sal_Char* aName42 // French
1611  = "DERNI\xC8" "REIMPRESSION";
1612  static const sal_Char* aName43 // English
1613  = "LASTPRINTED";
1614  static const sal_Char* aName44 // Spanish
1615  = "HUPS PUPS";
1616  static const sal_Char* aName50 = "\x18"; // SW field code
1617  static const sal_Char* aName51 // German
1618  = "\xDC" "BERARBEITUNGSNUMMER";
1619  static const sal_Char* aName52 // French
1620  = "NUM\xC9" "RODEREVISION";
1621  static const sal_Char* aName53 // English
1622  = "REVISIONNUMBER";
1623  static const sal_Char* aName54 // Spanish
1624  = "SNUBBEL BUBBEL";
1625  static const sal_uInt16 nFieldCnt = 5;
1626 
1627  // additional fields are to be coded soon!
1628 
1629  static const sal_uInt16 nLangCnt = 4;
1630  static const sal_Char *aNameSet_26[nFieldCnt][nLangCnt+1] =
1631  {
1632  {aName10, aName11, aName12, aName13, aName14},
1633  {aName20, aName21, aName22, aName23, aName24},
1634  {aName30, aName31, aName32, aName33, aName34},
1635  {aName40, aName41, aName42, aName43, aName44},
1636  {aName50, aName51, aName52, aName53, aName54}
1637  };
1638 
1639  bool bFieldFound= false;
1640  sal_uInt16 nFIdx;
1641  for(sal_uInt16 nLIdx=1; !bFieldFound && (nLangCnt > nLIdx); ++nLIdx)
1642  {
1643  for(nFIdx = 0; !bFieldFound && (nFieldCnt > nFIdx); ++nFIdx)
1644  {
1645  if( aDocProperty == OUString( aNameSet_26[nFIdx][nLIdx], strlen(aNameSet_26[nFIdx][nLIdx]),
1646  RTL_TEXTENCODING_MS_1252 ) )
1647  {
1648  bFieldFound = true;
1649  pF->nId = aNameSet_26[nFIdx][0][0];
1650  }
1651  }
1652  }
1653 
1654  if( !bFieldFound )
1655  {
1656  SwDocInfoField aField( static_cast<SwDocInfoFieldType*>(
1657  m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::DocInfo )), DI_CUSTOM|nReg, aDocProperty, GetFieldResult( pF ) );
1658  m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField));
1659 
1660  return eF_ResT::OK;
1661  }
1662  }
1663 
1664  switch( pF->nId )
1665  {
1666  case 14:
1667  /* supports all INFO variables! */
1668  nSub = DI_KEYS;
1669  break;
1670  case 15:
1671  nSub = DI_TITLE;
1672  break;
1673  case 16:
1674  nSub = DI_THEMA;
1675  break;
1676  case 18:
1677  nSub = DI_KEYS;
1678  break;
1679  case 19:
1680  nSub = DI_COMMENT;
1681  break;
1682  case 20:
1683  nSub = DI_CHANGE;
1684  nReg = DI_SUB_AUTHOR;
1685  break;
1686  case 21:
1687  nSub = DI_CREATE;
1688  nReg = DI_SUB_DATE;
1689  bDateTime = true;
1690  break;
1691  case 23:
1692  nSub = DI_PRINT;
1693  nReg = DI_SUB_DATE;
1694  bDateTime = true;
1695  break;
1696  case 24:
1697  nSub = DI_DOCNO;
1698  break;
1699  case 22:
1700  nSub = DI_CHANGE;
1701  nReg = DI_SUB_DATE;
1702  bDateTime = true;
1703  break;
1704  case 25:
1705  nSub = DI_CHANGE;
1706  nReg = DI_SUB_TIME;
1707  bDateTime = true;
1708  break;
1709  case 64: // DOCVARIABLE
1710  nSub = DI_CUSTOM;
1711  break;
1712  }
1713 
1714  sal_uInt32 nFormat = 0;
1715 
1717  if (bDateTime)
1718  {
1719  SvNumFormatType nDT = GetTimeDatePara(rStr, nFormat, nLang, pF->nId);
1720  switch (nDT)
1721  {
1722  case SvNumFormatType::DATE:
1723  nReg = DI_SUB_DATE;
1724  break;
1725  case SvNumFormatType::TIME:
1726  nReg = DI_SUB_TIME;
1727  break;
1728  case SvNumFormatType::DATETIME:
1729  nReg = DI_SUB_DATE;
1730  break;
1731  default:
1732  nReg = DI_SUB_DATE;
1733  break;
1734  }
1735  }
1736 
1737  OUString aData;
1738  // Extract DOCVARIABLE varname
1739  if ( 64 == pF->nId )
1740  {
1741  WW8ReadFieldParams aReadParam( rStr );
1742  for (;;)
1743  {
1744  const sal_Int32 nRet = aReadParam.SkipToNextToken();
1745  if ( nRet==-1)
1746  break;
1747  switch( nRet )
1748  {
1749  case -2:
1750  if( aData.isEmpty() )
1751  aData = aReadParam.GetResult();
1752  break;
1753  case '*':
1754  //Skip over MERGEFORMAT
1755  (void)aReadParam.SkipToNextToken();
1756  break;
1757  }
1758  }
1759 
1760  aData = aData.replaceAll("\"", "");
1761  }
1762 
1763  SwDocInfoField aField( static_cast<SwDocInfoFieldType*>(
1764  m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::DocInfo )), nSub|nReg, aData, nFormat );
1765  if (bDateTime)
1766  ForceFieldLanguage(aField, nLang);
1767  m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField));
1768 
1769  return eF_ResT::OK;
1770 }
1771 
1773 {
1774  // SH: The SwAuthorField refers not to the original author but to the current user, better use DocInfo
1775  SwDocInfoField aField( static_cast<SwDocInfoFieldType*>(
1776  m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::DocInfo )),
1777  DI_CREATE|DI_SUB_AUTHOR, OUString() );
1778  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
1779  return eF_ResT::OK;
1780 }
1781 
1783 {
1784  SwTemplNameField aField( static_cast<SwTemplNameFieldType*>(
1785  m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::TemplateName )), FF_NAME );
1786  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
1787  return eF_ResT::OK;
1788 }
1789 
1790 // Both the date and the time fields can be used for showing a date a time or both.
1792 {
1793  bool bHijri = false;
1794  WW8ReadFieldParams aReadParam(rStr);
1795  for (;;)
1796  {
1797  const sal_Int32 nTok = aReadParam.SkipToNextToken();
1798  if ( nTok==-1 )
1799  break;
1800  switch (nTok)
1801  {
1802  default:
1803  case 'l':
1804  case -2:
1805  break;
1806  case 'h':
1807  bHijri = true;
1808  break;
1809  case 's':
1810  //Saka Calendar, should we do something with this ?
1811  break;
1812  }
1813  }
1814 
1815  sal_uInt32 nFormat = 0;
1816 
1818  SvNumFormatType nDT = GetTimeDatePara(rStr, nFormat, nLang, ww::eDATE, bHijri);
1819 
1820  if( SvNumFormatType::UNDEFINED == nDT ) // no D/T-Formatstring
1821  {
1822  if (32 == pF->nId)
1823  {
1824  nDT = SvNumFormatType::TIME;
1825  nFormat = m_rDoc.GetNumberFormatter()->GetFormatIndex(
1827  }
1828  else
1829  {
1830  nDT = SvNumFormatType::DATE;
1831  nFormat = m_rDoc.GetNumberFormatter()->GetFormatIndex(
1833  }
1834  }
1835 
1836  if (nDT & SvNumFormatType::DATE)
1837  {
1838  SwDateTimeField aField(static_cast<SwDateTimeFieldType*>(
1839  m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DateTime )), DATEFLD, nFormat);
1840  ForceFieldLanguage(aField, nLang);
1841  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
1842  }
1843  else if (nDT == SvNumFormatType::TIME)
1844  {
1845  SwDateTimeField aField(static_cast<SwDateTimeFieldType*>(
1846  m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DateTime)), TIMEFLD, nFormat);
1847  ForceFieldLanguage(aField, nLang);
1848  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
1849  }
1850 
1851  return eF_ResT::OK;
1852 }
1853 
1855 {
1857  WW8ReadFieldParams aReadParam(rStr);
1858  for (;;)
1859  {
1860  const sal_Int32 nRet = aReadParam.SkipToNextToken();
1861  if ( nRet==-1 )
1862  break;
1863  switch (nRet)
1864  {
1865  case 'p':
1866  eType = FF_PATHNAME;
1867  break;
1868  case '*':
1869  //Skip over MERGEFORMAT
1870  (void)aReadParam.SkipToNextToken();
1871  break;
1872  default:
1873  OSL_ENSURE(false, "unknown option in FileName field");
1874  break;
1875  }
1876  }
1877 
1878  SwFileNameField aField(
1879  static_cast<SwFileNameFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Filename)), eType);
1880  m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField));
1881  return eF_ResT::OK;
1882 }
1883 
1885 {
1886  sal_uInt16 nSub = DS_PAGE; // page number
1887  switch ( pF->nId ){
1888  case 27: nSub = DS_WORD; break; // number of words
1889  case 28: nSub = DS_CHAR; break; // number of characters
1890  }
1891  SwDocStatField aField( static_cast<SwDocStatFieldType*>(
1892  m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::DocStat )), nSub,
1893  GetNumberPara( rStr ) );
1894  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
1895  return eF_ResT::OK;
1896 }
1897 
1899 {
1900  // page number
1901  SwPageNumberField aField( static_cast<SwPageNumberFieldType*>(
1902  m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::PageNumber )), PG_RANDOM,
1903  GetNumberPara(rStr, true));
1904 
1905  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
1906  return eF_ResT::OK;
1907 }
1908 
1910 {
1911  //e.g. #i20118#
1912  OUString aQ;
1913  OUString aName;
1914  sal_Int32 nSize = 0;
1915  WW8ReadFieldParams aReadParam( rStr );
1916  for (;;)
1917  {
1918  const sal_Int32 nRet = aReadParam.SkipToNextToken();
1919  if ( nRet==-1 )
1920  break;
1921  switch( nRet )
1922  {
1923  case -2:
1924  if( aQ.isEmpty() )
1925  aQ = aReadParam.GetResult();
1926  break;
1927  case 'f':
1928  case 'F':
1929  if ( aReadParam.GoToTokenParam() )
1930  aName = aReadParam.GetResult();
1931  break;
1932  case 's':
1933  case 'S':
1934  if ( aReadParam.GoToTokenParam() )
1935  {
1936  const OUString aSiz = aReadParam.GetResult();
1937  if (!aSiz.isEmpty())
1938  {
1939  bool bFail = o3tl::checked_multiply<sal_Int32>(aSiz.toInt32(), 20, nSize); // pT -> twip
1940  if (bFail)
1941  nSize = -1;
1942  }
1943  }
1944  break;
1945  }
1946  }
1947  if( aQ.isEmpty() )
1948  return eF_ResT::TAGIGN; // -> no 0-char in text
1949 
1950  if (sal_Unicode cChar = static_cast<sal_Unicode>(aQ.toInt32()))
1951  {
1952  if (!aName.isEmpty()) // Font Name set ?
1953  {
1954  SvxFontItem aFont(FAMILY_DONTKNOW, aName, OUString(),
1955  PITCH_DONTKNOW, RTL_TEXTENCODING_SYMBOL, RES_CHRATR_FONT);
1956  NewAttr(aFont); // new Font
1957  }
1958 
1959  if (nSize > 0) //#i20118#
1960  {
1961  SvxFontHeightItem aSz(nSize, 100, RES_CHRATR_FONTSIZE);
1962  NewAttr(aSz);
1963  }
1964 
1965  m_rDoc.getIDocumentContentOperations().InsertString(*m_pPaM, OUString(cChar));
1966 
1967  if (nSize > 0)
1968  m_xCtrlStck->SetAttr(*m_pPaM->GetPoint(), RES_CHRATR_FONTSIZE);
1969  if (!aName.isEmpty())
1970  m_xCtrlStck->SetAttr(*m_pPaM->GetPoint(), RES_CHRATR_FONT);
1971  }
1972  else
1973  {
1974  m_rDoc.getIDocumentContentOperations().InsertString(*m_pPaM, "###");
1975  }
1976 
1977  return eF_ResT::OK;
1978 }
1979 
1980 // "EMBED"
1982 {
1983  WW8ReadFieldParams aReadParam( rStr );
1984  for (;;)
1985  {
1986  const sal_Int32 nRet = aReadParam.SkipToNextToken();
1987  if ( nRet==-1 )
1988  break;
1989  switch( nRet )
1990  {
1991  case -2:
1992  // sHost
1993  break;
1994 
1995  case 's':
1996  // use ObjectSize
1997  break;
1998  }
1999  }
2000 
2001  if( m_bObj && m_nPicLocFc )
2002  m_nObjLocFc = m_nPicLocFc;
2003  m_bEmbeddObj = true;
2004  return eF_ResT::TEXT;
2005 }
2006 
2007 // "SET"
2009 {
2010  OUString sOrigName;
2011  OUString sVal;
2012  WW8ReadFieldParams aReadParam( rStr );
2013  for (;;)
2014  {
2015  const sal_Int32 nRet = aReadParam.SkipToNextToken();
2016  if ( nRet==-1 )
2017  break;
2018  switch( nRet )
2019  {
2020  case -2:
2021  if (sOrigName.isEmpty())
2022  sOrigName = aReadParam.GetResult();
2023  else if (sVal.isEmpty())
2024  sVal = aReadParam.GetResult();
2025  break;
2026  }
2027  }
2028 
2029  const long nNo = MapBookmarkVariables(pF, sOrigName, sVal);
2030 
2031  SwFieldType* pFT = m_rDoc.getIDocumentFieldsAccess().InsertFieldType( SwSetExpFieldType( &m_rDoc, sOrigName,
2033  SwSetExpField aField( static_cast<SwSetExpFieldType*>(pFT), sVal, ULONG_MAX );
2035 
2036  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
2037 
2038  m_xReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_BOOKMARK, true, nNo);
2039 
2040  return eF_ResT::OK;
2041 }
2042 
2043 // "REF"
2045 { // Reference - Field
2046  OUString sOrigBkmName;
2047  REFERENCEMARK eFormat = REF_CONTENT;
2048 
2049  WW8ReadFieldParams aReadParam( rStr );
2050  for (;;)
2051  {
2052  const sal_Int32 nRet = aReadParam.SkipToNextToken();
2053  if ( nRet==-1 )
2054  break;
2055  switch( nRet )
2056  {
2057  case -2:
2058  if( sOrigBkmName.isEmpty() ) // get name of bookmark
2059  sOrigBkmName = aReadParam.GetResult();
2060  break;
2061 
2062  /* References to numbers in Word could be either to a numbered
2063  paragraph or to a chapter number. However Word does not seem to
2064  have the capability we do, of referring to the chapter number some
2065  other bookmark is in. As a result, cross-references to chapter
2066  numbers in a word document will be cross-references to a numbered
2067  paragraph, being the chapter heading paragraph. As it happens, our
2068  cross-references to numbered paragraphs will do the right thing
2069  when the target is a numbered chapter heading, so there is no need
2070  for us to use the REF_CHAPTER bookmark format on import.
2071  */
2072  case 'n':
2073  eFormat = REF_NUMBER_NO_CONTEXT;
2074  break;
2075  case 'r':
2076  eFormat = REF_NUMBER;
2077  break;
2078  case 'w':
2079  eFormat = REF_NUMBER_FULL_CONTEXT;
2080  break;
2081 
2082  case 'p':
2083  eFormat = REF_UPDOWN;
2084  break;
2085  case 'h':
2086  break;
2087  default:
2088  // unimplemented switch: just do 'nix nought nothing' :-)
2089  break;
2090  }
2091  }
2092 
2093  OUString sBkmName(GetMappedBookmark(sOrigBkmName));
2094 
2095  // #i120879# add cross reference bookmark name prefix, if it
2096  // matches internal TOC bookmark naming convention
2097  if ( IsTOCBookmarkName( sBkmName ) )
2098  {
2099  sBkmName = EnsureTOCBookmarkName(sBkmName);
2100  // track <sBookmarkName> as referenced TOC bookmark.
2101  m_xReffedStck->aReferencedTOCBookmarks.insert( sBkmName );
2102  }
2103 
2104  SwGetRefField aField(
2105  static_cast<SwGetRefFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )),
2106  sBkmName,"",REF_BOOKMARK,0,eFormat);
2107 
2108  if (eFormat == REF_CONTENT)
2109  {
2110  /*
2111  If we are just inserting the contents of the bookmark, then it
2112  is possible that the bookmark is actually a variable, so we
2113  must store it until the end of the document to see if it was,
2114  in which case we'll turn it into a show variable
2115  */
2116  m_xReffingStck->NewAttr( *m_pPaM->GetPoint(), SwFormatField(aField) );
2117  m_xReffingStck->SetAttr( *m_pPaM->GetPoint(), RES_TXTATR_FIELD);
2118  }
2119  else
2120  {
2121  m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField));
2122  }
2123  return eF_ResT::OK;
2124 }
2125 
2126 // Note Reference - Field
2128 {
2129  OUString aBkmName;
2130  bool bAboveBelow = false;
2131 
2132  WW8ReadFieldParams aReadParam( rStr );
2133  for (;;)
2134  {
2135  const sal_Int32 nRet = aReadParam.SkipToNextToken();
2136  if ( nRet==-1 )
2137  break;
2138  switch( nRet )
2139  {
2140  case -2:
2141  if( aBkmName.isEmpty() ) // get name of foot/endnote
2142  aBkmName = aReadParam.GetResult();
2143  break;
2144  case 'r':
2145  // activate flag 'Chapter Number'
2146  break;
2147  case 'p':
2148  bAboveBelow = true;
2149  break;
2150  case 'h':
2151  break;
2152  default:
2153  // unimplemented switch: just do 'nix nought nothing' :-)
2154  break;
2155  }
2156  }
2157 
2158  // set Sequence No of corresponding Foot-/Endnote to Zero
2159  // (will be corrected in
2160  SwGetRefField aField( static_cast<SwGetRefFieldType*>(
2161  m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )), aBkmName, "", REF_FOOTNOTE, 0,
2162  REF_ONLYNUMBER );
2163  m_xReffingStck->NewAttr(*m_pPaM->GetPoint(), SwFormatField(aField));
2164  m_xReffingStck->SetAttr(*m_pPaM->GetPoint(), RES_TXTATR_FIELD);
2165  if (bAboveBelow)
2166  {
2167  SwGetRefField aField2( static_cast<SwGetRefFieldType*>(
2168  m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )),aBkmName, "", REF_FOOTNOTE, 0,
2169  REF_UPDOWN );
2170  m_xReffingStck->NewAttr(*m_pPaM->GetPoint(), SwFormatField(aField2));
2171  m_xReffingStck->SetAttr(*m_pPaM->GetPoint(), RES_TXTATR_FIELD);
2172  }
2173  return eF_ResT::OK;
2174 }
2175 
2176 // "PAGEREF"
2178 {
2179  OUString sOrigName;
2180  WW8ReadFieldParams aReadParam( rStr );
2181  for (;;)
2182  {
2183  const sal_Int32 nRet = aReadParam.SkipToNextToken();
2184  if ( nRet==-1 )
2185  break;
2186  else if ( nRet == -2 && sOrigName.isEmpty() )
2187  {
2188  sOrigName = aReadParam.GetResult();
2189  }
2190  }
2191 
2192  const OUString sName(GetMappedBookmark(sOrigName));
2193 
2194  // loading page reference field in TOX
2195  if (m_bLoadingTOXCache)
2196  {
2197  // insert page ref representation as plain text --> return FLD_TEXT
2198  // if there is no hyperlink settings for current toc and referenced bookmark is available,
2199  // assign link to current ref area
2200  if (!m_bLoadingTOXHyperlink && !sName.isEmpty())
2201  {
2202  // #i120879# add cross reference bookmark name prefix, if it
2203  // matches internal TOC bookmark naming convention
2204  OUString sBookmarkName;
2205  if ( IsTOCBookmarkName( sName ) )
2206  {
2207  sBookmarkName = EnsureTOCBookmarkName(sName);
2208  // track <sBookmarkName> as referenced TOC bookmark.
2209  m_xReffedStck->aReferencedTOCBookmarks.insert( sBookmarkName );
2210  }
2211  else
2212  {
2213  sBookmarkName = sName;
2214  }
2215  OUString sURL = "#" + sBookmarkName;
2216  const OUString sTarget;
2217  SwFormatINetFormat aURL( sURL, sTarget );
2218  const OUString sLinkStyle("Index Link");
2219  const sal_uInt16 nPoolId =
2221  aURL.SetVisitedFormatAndId( sLinkStyle, nPoolId);
2222  aURL.SetINetFormatAndId( sLinkStyle, nPoolId );
2223  m_xCtrlStck->NewAttr( *m_pPaM->GetPoint(), aURL );
2224  }
2225  return eF_ResT::TEXT;
2226  }
2227 
2228  // #i120879# add cross reference bookmark name prefix, if it matches
2229  // internal TOC bookmark naming convention
2230  OUString sPageRefBookmarkName;
2231  if ( IsTOCBookmarkName( sName ) )
2232  {
2233  sPageRefBookmarkName = EnsureTOCBookmarkName(sName);
2234  // track <sPageRefBookmarkName> as referenced TOC bookmark.
2235  m_xReffedStck->aReferencedTOCBookmarks.insert( sPageRefBookmarkName );
2236  }
2237  else
2238  {
2239  sPageRefBookmarkName = sName;
2240  }
2241  SwGetRefField aField( static_cast<SwGetRefFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )),
2242  sPageRefBookmarkName, "", REF_BOOKMARK, 0, REF_PAGE );
2243  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
2244 
2245  return eF_ResT::OK;
2246 }
2247 
2248 //helper function
2249 //For MS MacroButton field, the symbol in plain text is always "(" (0x28),
2250 //which should be mapped according to the macro type
2251 static bool ConvertMacroSymbol( const OUString& rName, OUString& rReference )
2252 {
2253  bool bConverted = false;
2254  if( rReference == "(" )
2255  {
2256  bConverted = true;
2257  sal_Unicode cSymbol = sal_Unicode(); // silence false warning
2258  if (rName == "CheckIt")
2259  cSymbol = 0xF06F;
2260  else if (rName == "UncheckIt")
2261  cSymbol = 0xF0FE;
2262  else if (rName == "ShowExample")
2263  cSymbol = 0xF02A;
2264  //else if... : todo
2265  else
2266  bConverted = false;
2267 
2268  if( bConverted )
2269  rReference = OUString(cSymbol);
2270  }
2271  return bConverted;
2272 }
2273 
2274 // "MACROBUTTON"
2276 {
2277  OUString aName;
2278  OUString aVText;
2279  bool bNewVText = true;
2280  bool bBracket = false;
2281  WW8ReadFieldParams aReadParam( rStr );
2282 
2283  sal_Int32 nOffset = 0;
2284 
2285  for (;;)
2286  {
2287  const sal_Int32 nRet = aReadParam.SkipToNextToken();
2288  if ( nRet==-1 )
2289  break;
2290  switch( nRet )
2291  {
2292  case -2:
2293  if( aName.isEmpty() )
2294  aName = aReadParam.GetResult();
2295  else if( aVText.isEmpty() || bBracket )
2296  {
2297  nOffset = aReadParam.GetTokenSttPtr() + 1;
2298 
2299  if( bBracket )
2300  aVText += " ";
2301  aVText += aReadParam.GetResult();
2302  if (bNewVText)
2303  {
2304  bBracket = (aVText[0] == '[');
2305  bNewVText = false;
2306  }
2307  else if( aVText.endsWith("]") )
2308  bBracket = false;
2309  }
2310  break;
2311  }
2312  }
2313  if( aName.isEmpty() )
2314  return eF_ResT::TAGIGN; // makes no sense without Macro-Name
2315 
2316  NotifyMacroEventRead();
2317 
2318  //try converting macro symbol according to macro name
2319  bool bApplyWingdings = ConvertMacroSymbol( aName, aVText );
2320  aName = "StarOffice.Standard.Modul1." + aName;
2321 
2322  SwMacroField aField( static_cast<SwMacroFieldType*>(
2323  m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Macro )), aName, aVText );
2324 
2325  if( !bApplyWingdings )
2326  {
2327 
2328  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
2329  WW8_CP nOldCp = m_xPlcxMan->Where();
2330  WW8_CP nCp = nOldCp + nOffset;
2331 
2332  SwPaM aPaM(*m_pPaM, m_pPaM);
2333  aPaM.SetMark();
2334  aPaM.Move(fnMoveBackward);
2335  aPaM.Exchange();
2336 
2337  m_pPostProcessAttrsInfo.reset(new WW8PostProcessAttrsInfo(nCp, nCp, aPaM));
2338  }
2339  else
2340  {
2341  //set Wingdings font
2342  sal_uInt16 i = 0;
2343  for ( ; i < m_xFonts->GetMax(); i++ )
2344  {
2345  FontFamily eFamily;
2346  OUString aFontName;
2347  FontPitch ePitch;
2348  rtl_TextEncoding eSrcCharSet;
2349  if( GetFontParams( i, eFamily, aFontName, ePitch, eSrcCharSet )
2350  && aFontName=="Wingdings" )
2351  {
2352  break;
2353  }
2354  }
2355 
2356  if ( i < m_xFonts->GetMax() )
2357  {
2358 
2359  SetNewFontAttr( i, true, RES_CHRATR_FONT );
2360  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
2361  m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_FONT );
2362  ResetCharSetVars();
2363  }
2364  }
2365 
2366  return eF_ResT::OK;
2367 }
2368 
2370  SwPaM & rPaM)
2371  : mbCopy(false)
2372  , mnCpStart(nCpStart)
2373  , mnCpEnd(nCpEnd)
2374  , mPaM(*rPaM.GetMark(), *rPaM.GetPoint())
2375  , mItemSet(rPaM.GetDoc()->GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_PARATR_END - 1>{})
2376 {
2377 }
2378 
2379 bool CanUseRemoteLink(const OUString &rGrfName)
2380 {
2381  bool bUseRemote = false;
2382  try
2383  {
2384  // Related: tdf#102499, add a default css::ucb::XCommandEnvironment
2385  // in order to have https protocol manage certificates correctly
2386  uno::Reference< task::XInteractionHandler > xIH(
2387  task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), nullptr));
2388 
2389  uno::Reference< ucb::XProgressHandler > xProgress;
2390  ::ucbhelper::CommandEnvironment* pCommandEnv =
2391  new ::ucbhelper::CommandEnvironment(new comphelper::SimpleFileAccessInteraction( xIH ), xProgress);
2392 
2393  ::ucbhelper::Content aCnt(rGrfName,
2394  static_cast< ucb::XCommandEnvironment* >(pCommandEnv),
2396 
2397  if ( !INetURLObject( rGrfName ).isAnyKnownWebDAVScheme() )
2398  {
2399  OUString aTitle;
2400  aCnt.getPropertyValue("Title") >>= aTitle;
2401  bUseRemote = !aTitle.isEmpty();
2402  }
2403  else
2404  {
2405  // is a link to a WebDAV resource
2406  // need to use MediaType to check for link usability
2407  OUString aMediaType;
2408  aCnt.getPropertyValue("MediaType") >>= aMediaType;
2409  bUseRemote = !aMediaType.isEmpty();
2410  }
2411  }
2412  catch ( ... )
2413  {
2414  // this file did not exist, so we will not set this as graphiclink
2415  bUseRemote = false;
2416  }
2417  return bUseRemote;
2418 }
2419 
2420 // "INCLUDEPICTURE"
2422 {
2423  OUString aGrfName;
2424  bool bEmbedded = true;
2425 
2426  WW8ReadFieldParams aReadParam( rStr );
2427  for (;;)
2428  {
2429  const sal_Int32 nRet = aReadParam.SkipToNextToken();
2430  if ( nRet==-1 )
2431  break;
2432  switch( nRet )
2433  {
2434  case -2:
2435  if (aGrfName.isEmpty())
2436  aGrfName = ConvertFFileName(aReadParam.GetResult());
2437  break;
2438 
2439  case 'd':
2440  bEmbedded = false;
2441  break;
2442 
2443  case 'c':// skip the converter name
2444  aReadParam.FindNextStringPiece();
2445  break;
2446  }
2447  }
2448 
2449  if (!bEmbedded)
2450  bEmbedded = !CanUseRemoteLink(aGrfName);
2451 
2452  if (!bEmbedded)
2453  {
2454  /*
2455  Special case:
2456 
2457  Now we write the Link into the Doc and remember the SwFlyFrameFormat.
2458  Since we end on return FLD_READ_FSPA below, the skip value will be set
2459  so that Char-1 will still be read.
2460  When we then call SwWW8ImplReader::ImportGraf() it will then recognize
2461  that we have inserted a graphic link and the suiting SwAttrSet will be
2462  inserted into the frame format.
2463  */
2465  RES_FRMATR_END-1>{} );
2466  aFlySet.Put( SwFormatAnchor( RndStdIds::FLY_AS_CHAR ) );
2467  aFlySet.Put( SwFormatVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
2470  aGrfName,
2471  OUString(),
2472  nullptr, // Graphic*
2473  &aFlySet,
2474  nullptr, nullptr); // SwFrameFormat*
2476  INetURLObject(aGrfName).GetBase());
2477  }
2478  return eF_ResT::READ_FSPA;
2479 }
2480 
2482 {
2483  const OUString aName(msFileLinkSeed + OUString::number(++mnFileSectionNo));
2484  return mrDoc.GetUniqueSectionName(&aName);
2485 }
2486 
2487 // "INCLUDETEXT"
2489 {
2490  OUString aPara;
2491  OUString aBook;
2492  WW8ReadFieldParams aReadParam( rStr );
2493  for (;;)
2494  {
2495  const sal_Int32 nRet = aReadParam.SkipToNextToken();
2496  if ( nRet==-1 )
2497  break;
2498  switch( nRet )
2499  {
2500  case -2:
2501  if( aPara.isEmpty() )
2502  aPara = aReadParam.GetResult();
2503  else if( aBook.isEmpty() )
2504  aBook = aReadParam.GetResult();
2505  break;
2506  case '*':
2507  //Skip over MERGEFORMAT
2508  (void)aReadParam.SkipToNextToken();
2509  break;
2510  }
2511  }
2512  aPara = ConvertFFileName(aPara);
2513 
2514  if (!aBook.isEmpty() && aBook[ 0 ] != '\\')
2515  {
2516  // Section from Source (no switch)?
2517  ConvertUFName(aBook);
2518  aPara += OUStringChar(sfx2::cTokenSeparator)
2519  + OUStringChar(sfx2::cTokenSeparator) + aBook;
2520  }
2521 
2522  /*
2523  ##509##
2524  What we will do is insert a section to be linked to a file, but just in
2525  case the file is not available we will fill in the section with the stored
2526  content of this winword field as a fallback.
2527  */
2528  SwPosition aTmpPos(*m_pPaM->GetPoint());
2529 
2532  aSection.SetLinkFileName( aPara );
2533  aSection.SetProtectFlag(true);
2534 
2535  SwSection *const pSection =
2536  m_rDoc.InsertSwSection(*m_pPaM, aSection, nullptr, nullptr, false);
2537  OSL_ENSURE(pSection, "no section inserted");
2538  if (!pSection)
2539  return eF_ResT::TEXT;
2540  const SwSectionNode* pSectionNode = pSection->GetFormat()->GetSectionNode();
2541  OSL_ENSURE(pSectionNode, "no section node!");
2542  if (!pSectionNode)
2543  return eF_ResT::TEXT;
2544 
2545  m_pPaM->GetPoint()->nNode = pSectionNode->GetIndex()+1;
2547 
2548  //we have inserted a section before this point, so adjust pos
2549  //for future page/section segment insertion
2551 
2552  return eF_ResT::TEXT;
2553 }
2554 
2555 // "SERIALPRINT"
2557 {
2558 #if !HAVE_FEATURE_DBCONNECTIVITY
2559  (void) pF;
2560  (void) rStr;
2561 #else
2562  OUString aName;
2563  WW8ReadFieldParams aReadParam( rStr );
2564  for (;;)
2565  {
2566  const sal_Int32 nRet = aReadParam.SkipToNextToken();
2567  if ( nRet==-1 )
2568  break;
2569  switch( nRet )
2570  {
2571  case -2:
2572  if( aName.isEmpty() )
2573  aName = aReadParam.GetResult();
2574  break;
2575  }
2576  }
2577  SwDBFieldType aD( &m_rDoc, aName, SwDBData() ); // Database: nothing
2578 
2580  SwDBField aField( static_cast<SwDBFieldType*>(pFT) );
2581  aField.SetFieldCode( rStr );
2582 
2583  OUString aResult;
2584  m_xSBase->WW8ReadString( *m_pStrm, aResult, m_xPlcxMan->GetCpOfs()+
2585  pF->nSRes, pF->nLRes, m_eTextCharSet );
2586 
2587  aResult = aResult.replace( '\xb', '\n' );
2588 
2589  aField.InitContent(aResult);
2590 
2592 #endif
2593  return eF_ResT::OK;
2594 }
2595 
2596 // "NEXT"
2598 {
2599 #if HAVE_FEATURE_DBCONNECTIVITY
2602  SwDBNextSetField aField( static_cast<SwDBNextSetFieldType*>(pFT), OUString(),
2603  SwDBData() ); // Database: nothing
2605 #endif
2606  return eF_ResT::OK;
2607 }
2608 
2609 // "DATASET"
2611 {
2612 #if HAVE_FEATURE_DBCONNECTIVITY
2615  SwDBSetNumberField aField( static_cast<SwDBSetNumberFieldType*>(pFT),
2616  SwDBData() ); // Datenbase: nothing
2618 #endif
2619  return eF_ResT::OK;
2620 }
2621 
2622 /*
2623  EQ , only the usage for
2624  a. Combined Characters supported, must be exactly in the form that word
2625  only accepts as combined characters, i.e.
2626  eq \o(\s\up Y(XXX),\s\do Y(XXX))
2627  b. Ruby Text supported, must be in the form that word recognizes as being
2628  ruby text
2629  ...
2630 */
2632 {
2633  WW8ReadFieldParams aReadParam( rStr );
2634  const sal_Int32 cChar = aReadParam.SkipToNextToken();
2635  if ('o' == cChar || 'O' == cChar)
2636  {
2637  EquationResult aResult(ParseCombinedChars(rStr));
2638 
2639  if (aResult.sType == "Input")
2640  {
2641  SwInputField aField( static_cast<SwInputFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Input )),
2642  aResult.sResult, aResult.sResult, INP_TXT, 0 );
2643  m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) ); // insert input field
2644  }
2645  else if (aResult.sType == "CombinedCharacters")
2646  {
2647  SwCombinedCharField aField(static_cast<SwCombinedCharFieldType*>(
2650  }
2651  }
2652  else if ('*' == cChar)
2653  Read_SubF_Ruby(aReadParam);
2654 
2655  return eF_ResT::OK;
2656 }
2657 
2659 {
2660  sal_uInt16 nJustificationCode=0;
2661  OUString sFontName;
2662  sal_uInt32 nFontSize=0;
2663  OUString sRuby;
2664  OUString sText;
2665  for (;;)
2666  {
2667  const sal_Int32 nRet = rReadParam.SkipToNextToken();
2668  if ( nRet==-1 )
2669  break;
2670  switch( nRet )
2671  {
2672  case -2:
2673  {
2674  OUString sTemp = rReadParam.GetResult();
2675  if( sTemp.startsWithIgnoreAsciiCase( "jc" ) )
2676  {
2677  sTemp = sTemp.copy(2);
2678  nJustificationCode = static_cast<sal_uInt16>(sTemp.toInt32());
2679  }
2680  else if( sTemp.startsWithIgnoreAsciiCase( "hps" ) )
2681  {
2682  sTemp = sTemp.copy(3);
2683  nFontSize= static_cast<sal_uInt32>(sTemp.toInt32());
2684  }
2685  else if( sTemp.startsWithIgnoreAsciiCase( "Font:" ) )
2686  {
2687  sTemp = sTemp.copy(5);
2688  sFontName = sTemp;
2689  }
2690  }
2691  break;
2692  case '*':
2693  break;
2694  case 'o':
2695  for (;;)
2696  {
2697  const sal_Int32 nRes = rReadParam.SkipToNextToken();
2698  if ( nRes==-1 )
2699  break;
2700  if ('u' == nRes)
2701  {
2702  if (-2 == rReadParam.SkipToNextToken() &&
2703  rReadParam.GetResult().startsWithIgnoreAsciiCase("p"))
2704  {
2705  if (-2 == rReadParam.SkipToNextToken())
2706  {
2707  OUString sPart = rReadParam.GetResult();
2708  sal_Int32 nBegin = sPart.indexOf('(');
2709 
2710  //Word disallows brackets in this field,
2711  sal_Int32 nEnd = sPart.indexOf(')');
2712 
2713  if ((nBegin != -1) &&
2714  (nEnd != -1) && (nBegin < nEnd))
2715  {
2716  sRuby = sPart.copy(nBegin+1,nEnd-nBegin-1);
2717  }
2718  if (-1 != nEnd)
2719  {
2720  if (-1 ==
2721  (nBegin = sPart.indexOf(',',nEnd)))
2722  {
2723  nBegin = sPart.indexOf(';',nEnd);
2724  }
2725  nEnd = sPart.lastIndexOf(')');
2726  }
2727  if ((nBegin != -1) && (nEnd != -1) && (nBegin < nEnd))
2728  {
2729  sText = sPart.copy(nBegin+1,nEnd-nBegin-1);
2730  }
2731  }
2732  }
2733  }
2734 
2735  }
2736  break;
2737  }
2738  }
2739 
2740  //Translate and apply
2741  if (sRuby.isEmpty() || sText.isEmpty() || sFontName.isEmpty() || !nFontSize)
2742  return;
2743 
2744  css::text::RubyAdjust eRubyAdjust;
2745  switch (nJustificationCode)
2746  {
2747  case 0:
2748  eRubyAdjust = css::text::RubyAdjust_CENTER;
2749  break;
2750  case 1:
2751  eRubyAdjust = css::text::RubyAdjust_BLOCK;
2752  break;
2753  case 2:
2754  eRubyAdjust = css::text::RubyAdjust_INDENT_BLOCK;
2755  break;
2756  default:
2757  case 3:
2758  eRubyAdjust = css::text::RubyAdjust_LEFT;
2759  break;
2760  case 4:
2761  eRubyAdjust = css::text::RubyAdjust_RIGHT;
2762  break;
2763  }
2764 
2765  SwFormatRuby aRuby(sRuby);
2766  const SwCharFormat *pCharFormat=nullptr;
2767  //Make a guess at which of asian of western we should be setting
2768  assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
2769  sal_uInt16 nScript = g_pBreakIt->GetBreakIter()->getScriptType(sRuby, 0);
2770 
2771  //Check to see if we already have a ruby charstyle that this fits
2772  for(const auto& rpCharFormat : m_aRubyCharFormats)
2773  {
2774  const SvxFontHeightItem &rFH =
2775  ItemGet<SvxFontHeightItem>(*rpCharFormat,
2777  if (rFH.GetHeight() == nFontSize*10)
2778  {
2779  const SvxFontItem &rF = ItemGet<SvxFontItem>(*rpCharFormat,
2781  if (rF.GetFamilyName() == sFontName)
2782  {
2783  pCharFormat = rpCharFormat;
2784  break;
2785  }
2786  }
2787  }
2788 
2789  //Create a new char style if necessary
2790  if (!pCharFormat)
2791  {
2792  OUString aNm;
2793  //Take this as the base name
2795  aNm+=OUString::number(m_aRubyCharFormats.size()+1);
2797  SvxFontHeightItem aHeightItem(nFontSize*10, 100, RES_CHRATR_FONTSIZE);
2798  SvxFontItem aFontItem(FAMILY_DONTKNOW,sFontName,
2799  OUString(), PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT);
2800  aHeightItem.SetWhich(GetWhichOfScript(RES_CHRATR_FONTSIZE,nScript));
2801  aFontItem.SetWhich(GetWhichOfScript(RES_CHRATR_FONT,nScript));
2802  pFormat->SetFormatAttr(aHeightItem);
2803  pFormat->SetFormatAttr(aFontItem);
2804  m_aRubyCharFormats.push_back(pFormat);
2805  pCharFormat = pFormat;
2806  }
2807 
2808  //Set the charstyle and justification
2809  aRuby.SetCharFormatName(pCharFormat->GetName());
2810  aRuby.SetCharFormatId(pCharFormat->GetPoolFormatId());
2811  aRuby.SetAdjustment(eRubyAdjust);
2812 
2813  NewAttr(aRuby);
2816 
2817 }
2818 
2819 // "table of ..." fields
2820 
2821 static void lcl_toxMatchACSwitch(SwDoc const & rDoc,
2822  SwTOXBase& rBase,
2823  WW8ReadFieldParams& rParam,
2824  SwCaptionDisplay eCaptionType)
2825 {
2826  if ( rParam.GoToTokenParam() )
2827  {
2828  SwTOXType* pType = const_cast<SwTOXType*>(rDoc.GetTOXType( TOX_ILLUSTRATIONS, 0));
2829  rBase.RegisterToTOXType( *pType );
2830  rBase.SetCaptionDisplay( eCaptionType );
2831  // Read Sequence Name and store in TOXBase
2832  OUString sSeqName( rParam.GetResult() );
2833  lcl_ConvertSequenceName( sSeqName );
2834  rBase.SetSequenceName( sSeqName );
2835  }
2836 }
2837 
2839 {
2840  //If the TOC contains Template entries at levels > the evaluation level
2841  //that was initially taken from the max normal outline level of the word TOC
2842  //then we cannot use that for the evaluation level because writer cuts off
2843  //all styles above that level, while word just cuts off the "standard"
2844  //outline styles, we have no option but to expand to the highest level
2845  //Word included.
2846  if ((rBase.GetLevel() != MAXLEVEL) && (SwTOXElement::Template & rBase.GetCreateType()))
2847  {
2848  for (sal_uInt16 nI = MAXLEVEL; nI > 0; --nI)
2849  {
2850  if (!rBase.GetStyleNames(nI-1).isEmpty())
2851  {
2852  rBase.SetLevel(nI);
2853  break;
2854  }
2855  }
2856  }
2857 }
2858 
2859 static void lcl_toxMatchTSwitch(SwWW8ImplReader const & rReader, SwTOXBase& rBase,
2860  WW8ReadFieldParams& rParam)
2861 {
2862  if ( rParam.GoToTokenParam() )
2863  {
2864  OUString sParams( rParam.GetResult() );
2865  if( !sParams.isEmpty() )
2866  {
2867  sal_Int32 nIndex = 0;
2868 
2869  // Delimiters between styles and style levels appears to allow both ; and ,
2870 
2871  OUString sTemplate( sParams.getToken(0, ';', nIndex) );
2872  if( -1 == nIndex )
2873  {
2874  nIndex=0;
2875  sTemplate = sParams.getToken(0, ',', nIndex);
2876  }
2877  if( -1 == nIndex )
2878  {
2879  const SwFormat* pStyle = rReader.GetStyleWithOrgWWName(sTemplate);
2880  if( pStyle )
2881  sTemplate = pStyle->GetName();
2882  // Store Style for Level 0 into TOXBase
2883  rBase.SetStyleNames( sTemplate, 0 );
2884  }
2885  else while( -1 != nIndex )
2886  {
2887  sal_Int32 nOldIndex=nIndex;
2888  sal_uInt16 nLevel = static_cast<sal_uInt16>(
2889  sParams.getToken(0, ';', nIndex).toInt32());
2890  if( -1 == nIndex )
2891  {
2892  nIndex = nOldIndex;
2893  nLevel = static_cast<sal_uInt16>(
2894  sParams.getToken(0, ',', nIndex).toInt32());
2895  }
2896 
2897  if( (0 < nLevel) && (MAXLEVEL >= nLevel) )
2898  {
2899  nLevel--;
2900  // Store Style and Level into TOXBase
2901  const SwFormat* pStyle
2902  = rReader.GetStyleWithOrgWWName( sTemplate );
2903 
2904  if( pStyle )
2905  sTemplate = pStyle->GetName();
2906 
2907  OUString sStyles( rBase.GetStyleNames( nLevel ) );
2908  if( !sStyles.isEmpty() )
2909  sStyles += OUStringChar(TOX_STYLE_DELIMITER);
2910  sStyles += sTemplate;
2911  rBase.SetStyleNames( sStyles, nLevel );
2912  }
2913  // read next style name...
2914  nOldIndex = nIndex;
2915  sTemplate = sParams.getToken(0, ';', nIndex);
2916  if( -1 == nIndex )
2917  {
2918  nIndex=nOldIndex;
2919  sTemplate = sParams.getToken(0, ',', nIndex);
2920  }
2921  }
2922  }
2923  }
2924 }
2925 
2927 {
2928  sal_uInt16 nIndexCols = 1;
2929  if (!maSegments.empty())
2930  nIndexCols = maSegments.back().maSep.ccolM1 + 1;
2931  return nIndexCols;
2932 }
2933 
2934 //Will there be a new pagebreak at this position (don't know what type
2935 //until later)
2937 {
2938  bool bRet = false;
2939  if (!maSegments.empty())
2940  {
2941  if (!maSegments.back().IsContinuous() &&
2942  maSegments.back().maStart == rIdx)
2943  {
2944  bRet = true;
2945  }
2946  }
2947  return bRet;
2948 }
2949 
2950 static sal_uInt16 lcl_GetMaxValidWordTOCLevel(const SwForm &rForm)
2951 {
2952  // GetFormMax() returns level + 1, hence the -1
2953  sal_uInt16 nRet = rForm.GetFormMax()-1;
2954 
2955  // If the max of this type of TOC is greater than the max of a word
2956  // possible toc, then clip to the word max
2957  if (nRet > WW8ListManager::nMaxLevel)
2959 
2960  return nRet;
2961 }
2962 
2964 {
2965  if (!m_bLoadingTOXCache)
2966  {
2967  m_bLoadingTOXCache = true;
2968  }
2969  else
2970  {
2971  // Embedded TOX --> continue reading its content, but no further TOX
2972  // field
2974  return eF_ResT::TEXT;
2975  }
2976 
2977  if (pF->nLRes < 3)
2978  return eF_ResT::TEXT; // ignore (#i25440#)
2979 
2980  TOXTypes eTox; // create a ToxBase
2981  switch( pF->nId )
2982  {
2983  case 8:
2984  eTox = TOX_INDEX;
2985  break;
2986  case 13:
2987  eTox = TOX_CONTENT;
2988  break;
2989  default:
2990  eTox = TOX_USER;
2991  break;
2992  }
2993 
2995 
2996  sal_uInt16 nIndexCols = 1;
2997 
2998  const SwTOXType* pType = m_rDoc.GetTOXType( eTox, 0 );
2999  SwForm aOrigForm(eTox);
3000  SwTOXBase* pBase = new SwTOXBase( pType, aOrigForm, nCreateOf, OUString() );
3002  switch( eTox ){
3003  case TOX_INDEX:
3004  {
3006 
3007  // We set SwTOXElement::OutlineLevel only if
3008  // the parameter \o is within 1 to 9
3009  // or the parameter \f exists
3010  // or NO switch parameter are given at all.
3011  WW8ReadFieldParams aReadParam( rStr );
3012  for (;;)
3013  {
3014  const sal_Int32 nRet = aReadParam.SkipToNextToken();
3015  if ( nRet==-1 )
3016  break;
3017  switch( nRet )
3018  {
3019  case 'c':
3020  if ( aReadParam.GoToTokenParam() )
3021  {
3022  const OUString sParams( aReadParam.GetResult() );
3023  // if NO OUString just ignore the \c
3024  if( !sParams.isEmpty() )
3025  {
3026  nIndexCols = static_cast<sal_uInt16>(sParams.toInt32());
3027  }
3028  }
3029  break;
3030  case 'e':
3031  {
3032  if ( aReadParam.GoToTokenParam() ) // if NO String just ignore the \e
3033  {
3034  OUString sDelimiter( aReadParam.GetResult() );
3035  SwForm aForm( pBase->GetTOXForm() );
3036 
3037  // Attention: if TOX_CONTENT brave
3038  // GetFormMax() returns MAXLEVEL + 1 !!
3039  sal_uInt16 nEnd = aForm.GetFormMax()-1;
3040 
3041  for(sal_uInt16 nLevel = 1;
3042  nLevel <= nEnd;
3043  ++nLevel)
3044  {
3045  // Levels count from 1
3046  // Level 0 is reserved for CAPTION
3047 
3048  // Insert delimiter instead of tab in front of the page number if there is one:
3049  FormTokenType ePrevType = TOKEN_END;
3051  // -> #i21237#
3052  SwFormTokens aPattern =
3053  aForm.GetPattern(nLevel);
3054  SwFormTokens::iterator aIt = aPattern.begin();
3055  do
3056  {
3057  eType = ++aIt == aPattern.end() ? TOKEN_END : aIt->eTokenType;
3058 
3059  if (eType == TOKEN_PAGE_NUMS)
3060  {
3061  if (TOKEN_TAB_STOP == ePrevType)
3062  {
3063  --aIt;
3064 
3065  if(0x09 == sDelimiter[0])
3066  aIt->eTabAlign = SvxTabAdjust::End;
3067  else
3068  {
3069  SwFormToken aToken(TOKEN_TEXT);
3070  aToken.sText = sDelimiter;
3071  *aIt = aToken;
3072  }
3073  aForm.SetPattern(nLevel, aPattern);
3074  }
3075 
3076  eType = TOKEN_END;
3077  }
3078 
3079  ePrevType = eType;
3080  }
3081  while (TOKEN_END != eType);
3082  // <- #i21237#
3083  }
3084  pBase->SetTOXForm( aForm );
3085  }
3086  }
3087  break;
3088  case 'h':
3089  {
3090  eOptions |= SwTOIOptions::AlphaDelimiter;
3091  }
3092  break;
3093  }
3094  }
3095  pBase->SetOptions( eOptions );
3096  }
3097  break;
3098 
3099  case TOX_CONTENT:
3100  {
3101  bool bIsHyperlink = false;
3102  // We set SwTOXElement::OutlineLevel only if
3103  // the parameter \o is within 1 to 9
3104  // or the parameter \f exists
3105  // or NO switch parameter are given at all.
3106  SwTOXElement eCreateFrom = SwTOXElement::NONE;
3107  sal_Int32 nMaxLevel = 0;
3108  WW8ReadFieldParams aReadParam( rStr );
3109  for (;;)
3110  {
3111  const sal_Int32 nRet = aReadParam.SkipToNextToken();
3112  if ( nRet==-1 )
3113  break;
3114  switch( nRet )
3115  {
3116  case 'h':
3117  bIsHyperlink = true;
3118  break;
3119  case 'a':
3120  case 'c':
3121  lcl_toxMatchACSwitch(m_rDoc, *pBase, aReadParam,
3122  ('c' == nRet)
3124  : CAPTION_TEXT );
3125  break;
3126  case 'o':
3127  {
3128  sal_Int32 nVal;
3129  if( !aReadParam.GetTokenSttFromTo(nullptr, &nVal, WW8ListManager::nMaxLevel) )
3130  nVal = lcl_GetMaxValidWordTOCLevel(aOrigForm);
3131  if( nMaxLevel < nVal )
3132  nMaxLevel = nVal;
3133  eCreateFrom |= SwTOXElement::OutlineLevel;
3134  }
3135  break;
3136  case 'f':
3137  eCreateFrom |= SwTOXElement::Mark;
3138  break;
3139  case 'l':
3140  {
3141  sal_Int32 nVal;
3142  if( aReadParam.GetTokenSttFromTo(nullptr, &nVal, WW8ListManager::nMaxLevel) )
3143  {
3144  if( nMaxLevel < nVal )
3145  nMaxLevel = nVal;
3146  eCreateFrom |= SwTOXElement::Mark;
3147  }
3148  }
3149  break;
3150  case 't': // paragraphs using special styles shall
3151  // provide the TOX's content
3152  lcl_toxMatchTSwitch(*this, *pBase, aReadParam);
3153  eCreateFrom |= SwTOXElement::Template;
3154  break;
3155  case 'p':
3156  {
3157  if ( aReadParam.GoToTokenParam() ) // if NO String just ignore the \p
3158  {
3159  OUString sDelimiter( aReadParam.GetResult() );
3160  SwForm aForm( pBase->GetTOXForm() );
3161 
3162  // Attention: if TOX_CONTENT brave
3163  // GetFormMax() returns MAXLEVEL + 1 !!
3164  sal_uInt16 nEnd = aForm.GetFormMax()-1;
3165 
3166  for(sal_uInt16 nLevel = 1;
3167  nLevel <= nEnd;
3168  ++nLevel)
3169  {
3170  // Levels count from 1
3171  // Level 0 is reserved for CAPTION
3172 
3173  // Insert delimiter instead of tab in front of the pagenumber if there is one:
3174  FormTokenType ePrevType = TOKEN_END;
3176 
3177  // -> #i21237#
3178  SwFormTokens aPattern = aForm.GetPattern(nLevel);
3179  SwFormTokens::iterator aIt = aPattern.begin();
3180  do
3181  {
3182  eType = ++aIt == aPattern.end() ? TOKEN_END : aIt->eTokenType;
3183 
3184  if (eType == TOKEN_PAGE_NUMS)
3185  {
3186  if (TOKEN_TAB_STOP == ePrevType)
3187  {
3188  --aIt;
3189 
3190  SwFormToken aToken(TOKEN_TEXT);
3191  aToken.sText = sDelimiter;
3192 
3193  *aIt = aToken;
3194  aForm.SetPattern(nLevel,
3195  aPattern);
3196  }
3197  eType = TOKEN_END;
3198  }
3199  ePrevType = eType;
3200  }
3201  while( TOKEN_END != eType );
3202  // <- #i21237#
3203  }
3204  pBase->SetTOXForm( aForm );
3205  }
3206  }
3207  break;
3208  case 'n': // don't print page numbers
3209  {
3210  // read START and END param
3211  sal_Int32 nStart(0);
3212  sal_Int32 nEnd(0);
3213  if( !aReadParam.GetTokenSttFromTo( &nStart, &nEnd,
3215  {
3216  nStart = 1;
3217  nEnd = aOrigForm.GetFormMax()-1;
3218  }
3219  // remove page numbers from this levels
3220  SwForm aForm( pBase->GetTOXForm() );
3221  if (aForm.GetFormMax() <= nEnd)
3222  nEnd = aForm.GetFormMax()-1;
3223  for ( sal_Int32 nLevel = nStart; nLevel<=nEnd; ++nLevel )
3224  {
3225  // Levels count from 1
3226  // Level 0 is reserved for CAPTION
3227 
3228  // Remove pagenumber and if necessary the tab in front of it:
3230  // -> #i21237#
3231  SwFormTokens aPattern = aForm.GetPattern(nLevel);
3232  SwFormTokens::iterator aIt = aPattern.begin();
3233  do
3234  {
3235  eType = ++aIt == aPattern.end() ? TOKEN_END : aIt->eTokenType;
3236 
3237  if (eType == TOKEN_PAGE_NUMS)
3238  {
3239  aIt = aPattern.erase(aIt);
3240  --aIt;
3241  if (
3242  TOKEN_TAB_STOP ==
3243  aIt->eTokenType
3244  )
3245  {
3246  aPattern.erase(aIt);
3247  aForm.SetPattern(nLevel, aPattern);
3248  }
3249  eType = TOKEN_END;
3250  }
3251  }
3252  while (TOKEN_END != eType);
3253  // <- #i21237#
3254  }
3255  pBase->SetTOXForm( aForm );
3256  }
3257  break;
3258 
3259  /*
3260  // the following switches are not (yet) supported
3261  // by good old StarWriter:
3262  case 'b':
3263  case 's':
3264  case 'd':
3265  break;
3266  */
3267  }
3268  }
3269 
3270  // For loading the expression of TOC field, we need to mapping its parameters to TOX entries tokens
3271  // also include the hyperlinks and page references
3272  SwFormToken aLinkStart(TOKEN_LINK_START);
3273  SwFormToken aLinkEnd(TOKEN_LINK_END);
3274  aLinkStart.sCharStyleName = "Index Link";
3275  aLinkEnd.sCharStyleName = "Index Link";
3276  SwForm aForm(pBase->GetTOXForm());
3277  sal_uInt16 nEnd = aForm.GetFormMax()-1;
3278 
3279  for(sal_uInt16 nLevel = 1; nLevel <= nEnd; ++nLevel)
3280  {
3281  SwFormTokens aPattern = aForm.GetPattern(nLevel);
3282  if ( bIsHyperlink )
3283  {
3284  aPattern.insert(aPattern.begin(), aLinkStart);
3285  }
3286  else
3287  {
3288  auto aItr = std::find_if(aPattern.begin(), aPattern.end(),
3289  [](const SwFormToken& rToken) { return rToken.eTokenType == TOKEN_PAGE_NUMS; });
3290  if (aItr != aPattern.end())
3291  aPattern.insert(aItr, aLinkStart);
3292  }
3293  aPattern.push_back(aLinkEnd);
3294  aForm.SetPattern(nLevel, aPattern);
3295  }
3296  pBase->SetTOXForm(aForm);
3297 
3298  if (!nMaxLevel)
3299  nMaxLevel = WW8ListManager::nMaxLevel;
3300  pBase->SetLevel(nMaxLevel);
3301 
3302  const TOXTypes eType = pBase->GetTOXType()->GetType();
3303  switch( eType )
3304  {
3305  case TOX_CONTENT:
3306  {
3307  //If we would be created from outlines, either explicitly or by default
3308  //then see if we need extra styles added to the outlines
3309  SwTOXElement eEffectivelyFrom = eCreateFrom != SwTOXElement::NONE ? eCreateFrom : SwTOXElement::OutlineLevel;
3310  if (eEffectivelyFrom & SwTOXElement::OutlineLevel)
3311  {
3312  // #i19683# Insert a text token " " between the number and entry token.
3313  // In an ideal world we could handle the tab stop between the number and
3314  // the entry correctly, but I currently have no clue how to obtain
3315  // the tab stop position. It is _not_ set at the paragraph style.
3316  std::unique_ptr<SwForm> pForm;
3317  for (const SwWW8StyInf & rSI : m_vColl)
3318  {
3319  if (rSI.IsOutlineNumbered())
3320  {
3321  sal_uInt16 nStyleLevel = rSI.mnWW8OutlineLevel;
3322  const SwNumFormat& rFormat = rSI.GetOutlineNumrule()->Get( nStyleLevel );
3323  if ( SVX_NUM_NUMBER_NONE != rFormat.GetNumberingType() )
3324  {
3325  ++nStyleLevel;
3326 
3327  if ( !pForm )
3328  pForm.reset(new SwForm( pBase->GetTOXForm() ));
3329 
3330  SwFormTokens aPattern = pForm->GetPattern(nStyleLevel);
3331  SwFormTokens::iterator aIt =
3332  find_if(aPattern.begin(), aPattern.end(),
3334 
3335  if ( aIt != aPattern.end() )
3336  {
3337  SwFormToken aNumberEntrySeparator( TOKEN_TEXT );
3338  aNumberEntrySeparator.sText = " ";
3339  aPattern.insert( ++aIt, aNumberEntrySeparator );
3340  pForm->SetPattern( nStyleLevel, aPattern );
3341  }
3342  }
3343  }
3344  }
3345  if ( pForm )
3346  {
3347  pBase->SetTOXForm( *pForm );
3348  }
3349  }
3350 
3351  if (eCreateFrom != SwTOXElement::NONE)
3352  pBase->SetCreate(eCreateFrom);
3354  }
3355  break;
3356  case TOX_ILLUSTRATIONS:
3357  {
3358  if( eCreateFrom == SwTOXElement::NONE )
3359  eCreateFrom = SwTOXElement::Sequence;
3360  pBase->SetCreate( eCreateFrom );
3361 
3362  /*
3363  We don't know until here if we are an illustration
3364  or not, and so have being used a TOX_CONTENT so far
3365  which has 10 levels, while TOX has only two, this
3366  level is set only in the constructor of SwForm, so
3367  create a new one and copy over anything that could
3368  be set in the old one, and remove entries from the
3369  pattern which do not apply to illustration indices
3370  */
3371  SwForm aOldForm( pBase->GetTOXForm() );
3372  SwForm aNewForm( eType );
3373  sal_uInt16 nNewEnd = aNewForm.GetFormMax()-1;
3374 
3375  // #i21237#
3376  for(sal_uInt16 nLevel = 1; nLevel <= nNewEnd; ++nLevel)
3377  {
3378  SwFormTokens aPattern = aOldForm.GetPattern(nLevel);
3379  SwFormTokens::iterator new_end =
3380  remove_if(aPattern.begin(), aPattern.end(), SwFormTokenEqualToFormTokenType(TOKEN_ENTRY_NO));
3381  aPattern.erase(new_end, aPattern.end() ); // table index imported with wrong page number format
3382  aForm.SetPattern( nLevel, aPattern );
3383  aForm.SetTemplate( nLevel, aOldForm.GetTemplate(nLevel) );
3384  }
3385 
3386  pBase->SetTOXForm( aNewForm );
3387  }
3388  break;
3389  default:
3390  OSL_ENSURE(false, "Unhandled toc options!");
3391  break;
3392  }
3393  }
3394  break;
3395  case TOX_USER:
3396  break;
3397  default:
3398  OSL_ENSURE(false, "Unhandled toc options!");
3399  break;
3400  } // ToxBase fertig
3401 
3402  // #i21237# - propagate tab stops from paragraph styles used in TOX to patterns of the TOX
3403  pBase->AdjustTabStops( m_rDoc );
3404 
3405  //#i10028# inserting a toc implicitly acts like a parabreak in word and writer
3406  if ( m_pPaM->End() &&
3407  m_pPaM->End()->nNode.GetNode().GetTextNode() &&
3408  m_pPaM->End()->nNode.GetNode().GetTextNode()->Len() != 0 )
3409  {
3410  m_bCareFirstParaEndInToc = true;
3411  }
3412 
3413  if (m_pPaM->GetPoint()->nContent.GetIndex())
3415 
3416  const SwPosition* pPos = m_pPaM->GetPoint();
3417 
3418  SwFltTOX aFltTOX( pBase );
3419 
3420  // test if there is already a break item on this node
3421  if(SwContentNode* pNd = pPos->nNode.GetNode().GetContentNode())
3422  {
3423  const SfxItemSet* pSet = pNd->GetpSwAttrSet();
3424  if( pSet )
3425  {
3426  if (SfxItemState::SET == pSet->GetItemState(RES_BREAK, false))
3427  aFltTOX.SetHadBreakItem(true);
3428  if (SfxItemState::SET == pSet->GetItemState(RES_PAGEDESC, false))
3429  aFltTOX.SetHadPageDescItem(true);
3430  }
3431  }
3432 
3433  //Will there be a new pagebreak at this position (don't know what type
3434  //until later)
3436  aFltTOX.SetHadPageDescItem(true);
3437 
3438  // Set start in stack
3439  m_xReffedStck->NewAttr( *pPos, aFltTOX );
3440 
3441  m_rDoc.InsertTableOf(*m_pPaM->GetPoint(), aFltTOX.GetBase());
3442 
3443  //The TOC field representation contents should be inserted into TOC section, but not after TOC section.
3444  //So we need update the document position when loading TOC representation and after loading TOC;
3445  m_pPosAfterTOC.reset(new SwPaM(*m_pPaM, m_pPaM));
3446  (*m_pPaM).Move(fnMoveBackward);
3447  SwPaM aRegion(*m_pPaM, m_pPaM);
3448 
3449  OSL_ENSURE(SwDoc::GetCurTOX(*aRegion.GetPoint()), "Misunderstood how toc works");
3450  if (SwTOXBase* pBase2 = SwDoc::GetCurTOX(*aRegion.GetPoint()))
3451  {
3452  pBase2->SetMSTOCExpression(rStr);
3453 
3454  if ( nIndexCols > 1 )
3455  {
3456  // Set the column number for index
3458  SwFormatCol aCol;
3459  aCol.Init( nIndexCols, 708, USHRT_MAX );
3460  aSet.Put( aCol );
3461  pBase2->SetAttrSet( aSet );
3462  }
3463 
3464  // inserting a toc inserts a section before this point, so adjust pos
3465  // for future page/section segment insertion
3466  m_aSectionManager.PrependedInlineNode( *m_pPosAfterTOC->GetPoint(), aRegion.GetNode() );
3467  }
3468 
3469  // Set end in stack
3470  m_xReffedStck->SetAttr( *pPos, RES_FLTR_TOX );
3471 
3472  if (!m_aApos.back()) //a para end in apo doesn't count
3473  m_bWasParaEnd = true;
3474 
3475  //Return FLD_TEXT, instead of FLD_OK
3476  //FLD_TEXT means the following content, commonly indicate the field representation content should be parsed
3477  //FLD_OK means the current field loading is finished. The rest part should be ignored.
3478  return eF_ResT::TEXT;
3479 }
3480 
3482 {
3483  /*
3484  #i3958# 0x8 followed by 0x1 where the shape is the 0x8 and its anchoring
3485  to be ignored followed by a 0x1 with an empty drawing. Detect in inserting
3486  the drawing that we are in the Shape field and respond accordingly
3487  */
3488  return eF_ResT::TEXT;
3489  }
3490 
3492 {
3493  OUString sURL, sTarget, sMark;
3494 
3495  //HYPERLINK "filename" [switches]
3496  rStr = comphelper::string::stripEnd(rStr, 1);
3497 
3498  bool bOptions = false;
3499  WW8ReadFieldParams aReadParam( rStr );
3500  for (;;)
3501  {
3502  const sal_Int32 nRet = aReadParam.SkipToNextToken();
3503  if ( nRet==-1 )
3504  break;
3505  switch( nRet )
3506  {
3507  case -2:
3508  if (sURL.isEmpty() && !bOptions)
3509  sURL = ConvertFFileName(aReadParam.GetResult());
3510  break;
3511 
3512  case 'n':
3513  sTarget = "_blank";
3514  bOptions = true;
3515  break;
3516 
3517  case 'l':
3518  bOptions = true;
3519  if ( aReadParam.SkipToNextToken()==-2 )
3520  {
3521  sMark = aReadParam.GetResult();
3522  if( sMark.endsWith("\""))
3523  {
3524  sMark = sMark.copy( 0, sMark.getLength() - 1 );
3525  }
3526  // #120879# add cross reference bookmark name prefix, if it matches internal TOC bookmark naming convention
3527  if ( IsTOCBookmarkName( sMark ) )
3528  {
3529  sMark = EnsureTOCBookmarkName(sMark);
3530  // track <sMark> as referenced TOC bookmark.
3531  m_xReffedStck->aReferencedTOCBookmarks.insert( sMark );
3532  }
3533 
3534  if (m_bLoadingTOXCache)
3535  {
3536  m_bLoadingTOXHyperlink = true; //on loading a TOC field nested hyperlink field
3537  }
3538  }
3539  break;
3540  case 't':
3541  bOptions = true;
3542  if ( aReadParam.SkipToNextToken()==-2 )
3543  sTarget = aReadParam.GetResult();
3544  break;
3545  case 'h':
3546  case 'm':
3547  OSL_ENSURE( false, "Analysis still missing - unknown data" );
3548  [[fallthrough]];
3549  case 's': //worthless fake anchor option
3550  bOptions = true;
3551  break;
3552  }
3553  }
3554 
3555  // use the result
3556  OSL_ENSURE(!sURL.isEmpty() || !sMark.isEmpty(), "WW8: Empty URL");
3557 
3558  if( !sMark.isEmpty() )
3559  sURL += "#" + sMark;
3560 
3561  SwFormatINetFormat aURL(sURL, sTarget);
3562  // If on loading TOC field, change the default style into the "index link"
3563  if (m_bLoadingTOXCache)
3564  {
3565  OUString sLinkStyle("Index Link");
3566  sal_uInt16 nPoolId =
3568  aURL.SetVisitedFormatAndId( sLinkStyle, nPoolId );
3569  aURL.SetINetFormatAndId( sLinkStyle, nPoolId );
3570  }
3571 
3572  //As an attribute this needs to be closed, and that'll happen from
3573  //EndExtSprm in conjunction with the maFieldStack. If there are flyfrms
3574  //between the start and begin, their hyperlinks will be set at that time
3575  //as well.
3576  m_xCtrlStck->NewAttr( *m_pPaM->GetPoint(), aURL );
3577  return eF_ResT::TEXT;
3578 }
3579 
3580 static void lcl_ImportTox(SwDoc &rDoc, SwPaM const &rPaM, const OUString &rStr, bool bIdx)
3581 {
3582  TOXTypes eTox = ( !bIdx ) ? TOX_CONTENT : TOX_INDEX; // Default
3583 
3584  sal_uInt16 nLevel = 1;
3585 
3586  OUString sFieldText;
3587  WW8ReadFieldParams aReadParam(rStr);
3588  for (;;)
3589  {
3590  const sal_Int32 nRet = aReadParam.SkipToNextToken();
3591  if ( nRet==-1 )
3592  break;
3593  switch( nRet )
3594  {
3595  case -2:
3596  if( sFieldText.isEmpty() )
3597  {
3598  // PrimaryKey without ":", 2nd after
3599  sFieldText = aReadParam.GetResult();
3600  }
3601  break;
3602 
3603  case 'f':
3604  if ( aReadParam.GoToTokenParam() )
3605  {
3606  const OUString sParams( aReadParam.GetResult() );
3607  if( sParams[0]!='C' && sParams[0]!='c' )
3608  eTox = TOX_USER;
3609  }
3610  break;
3611 
3612  case 'l':
3613  if ( aReadParam.GoToTokenParam() )
3614  {
3615  const OUString sParams( aReadParam.GetResult() );
3616  // if NO String just ignore the \l
3617  if( !sParams.isEmpty() && sParams[0]>'0' && sParams[0]<='9' )
3618  {
3619  nLevel = static_cast<sal_uInt16>(sParams.toInt32());
3620  }
3621  }
3622  break;
3623  }
3624  }
3625 
3626  OSL_ENSURE( rDoc.GetTOXTypeCount( eTox ), "Doc.GetTOXTypeCount() == 0 :-(" );
3627 
3628  const SwTOXType* pT = rDoc.GetTOXType( eTox, 0 );
3629  SwTOXMark aM( pT );
3630 
3631  if( eTox != TOX_INDEX )
3632  aM.SetLevel( nLevel );
3633  else
3634  {
3635  sal_Int32 nFnd = sFieldText.indexOf( WW8_TOX_LEVEL_DELIM );
3636  if( -1 != nFnd ) // it exist levels
3637  {
3638  aM.SetPrimaryKey( sFieldText.copy( 0, nFnd ) );
3639  sal_Int32 nScndFnd = sFieldText.indexOf( WW8_TOX_LEVEL_DELIM, nFnd+1 );
3640  if( -1 != nScndFnd )
3641  {
3642  aM.SetSecondaryKey( sFieldText.copy( nFnd+1, nScndFnd - nFnd - 1 ));
3643  nFnd = nScndFnd;
3644  }
3645  sFieldText = sFieldText.copy( nFnd+1 );
3646  }
3647  }
3648 
3649  if (!sFieldText.isEmpty())
3650  {
3651  aM.SetAlternativeText( sFieldText );
3652  rDoc.getIDocumentContentOperations().InsertPoolItem( rPaM, aM );
3653  }
3654 }
3655 
3656 void SwWW8ImplReader::ImportTox( int nFieldId, const OUString& aStr )
3657 {
3658  bool bIdx = (nFieldId != 9);
3659  lcl_ImportTox(m_rDoc, *m_pPaM, aStr, bIdx);
3660 }
3661 
3662 void SwWW8ImplReader::Read_FieldVanish( sal_uInt16, const sal_uInt8*, short nLen )
3663 {
3664  //Meaningless in a style
3665  if (m_pCurrentColl || !m_xPlcxMan)
3666  return;
3667 
3668  const int nChunk = 64; //number of characters to read at one time
3669 
3670  // Careful: MEMICMP doesn't work with fieldnames including umlauts!
3671  const static sal_Char *aFieldNames[] = { "\x06""INHALT", "\x02""XE", // dt.
3672  "\x02""TC" }; // us
3673  const static sal_uInt8 aFieldId[] = { 9, 4, 9 };
3674 
3675  if( nLen < 0 )
3676  {
3677  m_bIgnoreText = false;
3678  return;
3679  }
3680 
3681  // our method was called from
3682  // ''Skip attributes of field contents'' loop within ReadTextAttr()
3683  if( m_bIgnoreText )
3684  return;
3685 
3686  m_bIgnoreText = true;
3687  long nOldPos = m_pStrm->Tell();
3688 
3689  WW8_CP nStartCp = m_xPlcxMan->Where() + m_xPlcxMan->GetCpOfs();
3690 
3691  OUString sFieldName;
3692  sal_Int32 nFieldLen = m_xSBase->WW8ReadString( *m_pStrm, sFieldName, nStartCp,
3693  nChunk, m_eStructCharSet );
3694  nStartCp+=nFieldLen;
3695 
3696  sal_Int32 nC = 0;
3697  //If the first chunk did not start with a field start then
3698  //reset the stream position and give up
3699  if( !nFieldLen || sFieldName[nC]!=0x13 ) // Field Start Mark
3700  {
3701  // If Field End Mark found
3702  if( nFieldLen && sFieldName[nC]==0x15 )
3703  m_bIgnoreText = false;
3704  m_pStrm->Seek( nOldPos );
3705  return; // no field found
3706  }
3707 
3708  sal_Int32 nFnd;
3709  //If this chunk does not contain a field end, keep reading chunks
3710  //until we find one, or we run out of text,
3711  for (;;)
3712  {
3713  nFnd = sFieldName.indexOf(0x15);
3714  //found field end, we can stop now
3715  if (nFnd != -1)
3716  break;
3717  OUString sTemp;
3718  nFieldLen = m_xSBase->WW8ReadString( *m_pStrm, sTemp,
3719  nStartCp, nChunk, m_eStructCharSet );
3720  sFieldName+=sTemp;
3721  nStartCp+=nFieldLen;
3722  if (!nFieldLen)
3723  break;
3724  }
3725 
3726  m_pStrm->Seek( nOldPos );
3727 
3728  //if we have no 0x15 give up, otherwise erase everything from the 0x15
3729  //onwards
3730  if (nFnd<0)
3731  return;
3732 
3733  sFieldName = sFieldName.copy(0, nFnd);
3734 
3735  nC++;
3736  while ( sFieldName[nC]==' ' )
3737  nC++;
3738 
3739  for( int i = 0; i < 3; i++ )
3740  {
3741  const sal_Char* pName = aFieldNames[i];
3742  const sal_Int32 nNameLen = static_cast<sal_Int32>(*pName++);
3743  if( sFieldName.matchIgnoreAsciiCaseAsciiL( pName, nNameLen, nC ) )
3744  {
3745  ImportTox( aFieldId[i], sFieldName.copy( nC + nNameLen ) );
3746  break; // no duplicates allowed
3747  }
3748  }
3749  m_bIgnoreText = true;
3750  m_pStrm->Seek( nOldPos );
3751 }
3752 
3753 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
eF_ResT Read_F_Set(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:2008
virtual void SetSubType(sal_uInt16 nType) override
Definition: expfld.cxx:894
SvxNumType GetNumberingType() const
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:234
void InsertTagField(const sal_uInt16 nId, const OUString &rTagText)
Definition: ww8par5.cxx:1120
bool is() const
const SwDocInfoSubType DI_SUB_TIME
Definition: docufld.hxx:79
std::vector< SwFormToken > SwFormTokens
Vector of tokens.
Definition: tox.hxx:249
TOXTypes
Definition: toxe.hxx:39
Iterator for Booknotes.
Definition: ww8scan.hxx:743
std::unique_ptr< SwWW8FltControlStack > m_xCtrlStck
Definition: ww8par.hxx:1096
SVX_NUM_CHARS_UPPER_LETTER_N
bool bCodeNest
instruction used recursively
Definition: ww8scan.hxx:197
sal_uLong GetIndex() const
Definition: node.hxx:282
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
SwTOIOptions
Definition: tox.hxx:350
OString stripEnd(const OString &rIn, sal_Char c)
Handles the import of PlcfAtnBkf and PlcfAtnBkl: start / end position of annotation marks...
Definition: ww8scan.hxx:782
std::map< OUString, css::uno::Any > parameter_map_t
Definition: IMark.hxx:94
Marks a position in the document model.
Definition: pam.hxx:35
rtl_TextEncoding m_eStructCharSet
Definition: ww8par.hxx:1283
void Read_FieldVanish(sal_uInt16 nId, const sal_uInt8 *pData, short nLen)
Definition: ww8par5.cxx:3662
bool m_bLoadingTOXCache
Definition: ww8par.hxx:1360
SwTOXElement GetCreateType() const
Definition: tox.hxx:671
Size & Swap(Size &rSize)
eF_ResT Read_F_DateTime(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:1791
static bool AcceptableNestedField(sal_uInt16 nFieldCode)
Definition: ww8par5.cxx:709
SwFlyFrameFormat * m_pFlyFormatOfJustInsertedGraphic
Definition: ww8par.hxx:1197
const SwTOXBase & GetBase() const
Definition: fltshell.hxx:286
#define ODF_OLE_PARAM
long Read_Book(WW8PLCFManResult *)
Definition: ww8par5.cxx:127
#define RES_CHRATR_FONTSIZE
Definition: hintids.hxx:77
"Page"
Definition: reffld.hxx:48
eF_ResT Read_F_Num(WW8FieldDesc *pF, OUString &)
Definition: ww8par5.cxx:1884
sal_uInt16 End_Field()
Definition: ww8par5.cxx:510
void SetLinkFileName(OUString const &rNew)
Definition: section.hxx:118
#define RES_CHRATR_LANGUAGE
Definition: hintids.hxx:79
#define RES_TXTATR_CJK_RUBY
Definition: hintids.hxx:144
#define LANGUAGE_ENGLISH_US
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:835
WW8_CP nSCode
start of instructions code
Definition: ww8scan.hxx:191
virtual SwFlyFrameFormat * InsertGraphic(const SwPaM &rRg, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet, SwFrameFormat *)=0
Insert graphic or formula.
const SwExtendedSubType SUB_INVISIBLE
Invisible.
Definition: fldbas.hxx:206
sal_uLong MSDateTimeFormatToSwFormat(OUString &rParams, SvNumberFormatter *pFormatter, LanguageType &rLang, bool bHijri, LanguageType nDocLang)
Convert from Word Date/Time field str to Writer's Date Time str.
void SetBookmarkType(const OUString &bookmarkType)
Definition: ww8par5.cxx:757
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
void SetLevel(sal_uInt16 nLevel)
Definition: tox.hxx:562
sal_uInt32 GetFormatIndex(NfIndexTableOffset, LanguageType eLnge=LANGUAGE_DONTKNOW)
static SwTOXBase * GetCurTOX(const SwPosition &rPos)
Get current table of contents.
Definition: doctxm.cxx:442
Definition: tox.hxx:276
SwNodeIndex nNode
Definition: pam.hxx:37
bool EndPosIsFieldEnd(WW8_CP &)
Definition: ww8scan.cxx:4033
void SetPromptText(const OUString &rStr)
Definition: expfld.hxx:255
eF_ResT Read_F_InputVar(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:1374
eF_ResT Read_F_Author(WW8FieldDesc *, OUString &)
Definition: ww8par5.cxx:1772
#define WW8_TOX_LEVEL_DELIM
Definition: ww8par5.cxx:97
SVX_NUM_NUMBER_NONE
ErrCode GetError() const
void SetAdjustment(css::text::RubyAdjust nNew)
Definition: fmtruby.hxx:74
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:284
sal_uIntPtr sal_uLong
FAMILY_DONTKNOW
css::uno::Any getPropertyValue(const OUString &rPropertyName)
wwFrameNamer m_aGrfNameGenerator
Definition: ww8par.hxx:1176
const sal_Unicode cTokenSeparator
Base class of all fields.
Definition: fldbas.hxx:280
void MakeTagString(OUString &rStr, const OUString &rOrg)
Definition: ww8par5.cxx:1052
#define TOX_STYLE_DELIMITER
Definition: tox.hxx:386
#define RES_FRMATR_END
Definition: hintids.hxx:238
#define RES_FLTR_BOOKMARK
Definition: hintids.hxx:322
long MapBookmarkVariables(const WW8FieldDesc *pF, OUString &rOrigName, const OUString &rData)
Definition: ww8par5.cxx:1295
Provides access to the marks of a document.
Definition: doc.hxx:185
eBookStatus
Definition: ww8scan.hxx:740
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
Definition: ndsect.cxx:1351
SvNumFormatType GetType(sal_uInt32 nFIndex) const
static SotStorage * OpenOLEStorage(css::uno::Reference< css::embed::XStorage > const &xStorage, OUString const &rEleName, StreamMode=StreamMode::STD_READWRITE)
#define ODF_CODE_PARAM
sal_uInt64 Seek(sal_uInt64 nPos)
#define RES_CHRATR_FONT
Definition: hintids.hxx:76
void ConvertLanguage(SvNumberFormatter &rConverter, LanguageType eConvertFrom, LanguageType eConvertTo)
const SwDocInfoSubType DI_COMMENT
Definition: docufld.hxx:69
SwNode & GetNode() const
Definition: ndindex.hxx:119
std::unique_ptr< SwPaM > m_pPosAfterTOC
Definition: ww8par.hxx:1365
long Read_AtnBook(WW8PLCFManResult *)
Definition: ww8par5.cxx:243
WW8_CP nLen
total length (to skip over text)
Definition: ww8scan.hxx:190
static void EnsureMaxLevelForTemplates(SwTOXBase &rBase)
Definition: ww8par5.cxx:2838
static OUString FindPara(const OUString &rStr, sal_Unicode cToken, sal_Unicode cToken2)
Definition: ww8par5.cxx:341
SwSectionFormat * GetFormat()
Definition: section.hxx:336
REFERENCEMARK
Definition: reffld.hxx:45
long GetLen() const
Definition: ww8scan.cxx:4377
sal_uInt16 GetFormMax() const
Definition: tox.hxx:653
void SetLevel(sal_uInt8)
Definition: chpfld.cxx:80
bool StartPosIsFieldStart()
Definition: ww8scan.cxx:4026
virtual sal_uInt16 GetSubType() const override
Definition: expfld.cxx:902
eF_ResT Read_F_Macro(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:2275
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:314
void SetOptions(SwTOIOptions nOpt)
Definition: tox.hxx:716
const OUString & GetFormatstring() const
eF_ResT Read_F_Shape(WW8FieldDesc *pF, OUString &rStr)
Definition: ww8par5.cxx:3481
bool Commit()
static void ParseIfFieldDefinition(const OUString &aFieldDefinition, OUString &rCondition, OUString &rTrue, OUString &rFalse)
Definition: docufld.cxx:1539
eF_ResT Read_F_Seq(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:1444
#define MAX_FIELDLEN
Definition: ww8par5.cxx:95
SvxNumType
static LanguageType nLang
Definition: srtdlg.cxx:60
#define RES_FLTR_ANNOTATIONMARK
Definition: hintids.hxx:327
SwContentNode * GetContentNode(bool bPoint=true) const
Definition: pam.hxx:229
void SetCharFormatName(const OUString &rNm)
Definition: fmtruby.hxx:65
virtual OUString GetPar1() const
Definition: fldbas.cxx:271
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:356
void SetCreate(SwTOXElement)
Definition: tox.hxx:689
sal_uInt16 sal_Unicode
Stores RDF statements on a paragraph (key-value pairs where the subject is the paragraph).
Definition: fltshell.hxx:259
static SW_DLLPUBLIC OUString GetCrossRefHeadingBookmarkNamePrefix()
Definition: docbm.cxx:508
const SwTOXType * GetTOXType() const
Definition: tox.hxx:668
const SwCharFormat * GetDfltCharFormat() const
Definition: doc.hxx:746
SwTOXBaseSection * InsertTableOf(const SwPosition &rPos, const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr, bool bExpand=false, SwRootFrame const *pLayout=nullptr)
Definition: doctxm.cxx:340
void AdjustTabStops(SwDoc const &rDoc)
Definition: tox.hxx:522
SotStorage * OpenSotStorage(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool transacted=true)
SwIndex nContent
Definition: pam.hxx:38
void RegisterToTOXType(SwTOXType &rMark)
Definition: tox.cxx:537
Handles the import of PlcfBkfFactoid and PlcfBklFactoid: start / end position of factoids.
Definition: ww8scan.hxx:812
std::unique_ptr< SwWW8ReferencedFltEndStack > m_xReffedStck
Definition: ww8par.hxx:1110
std::vector< SwWW8StyInf > m_vColl
Definition: ww8par.hxx:1233
SwSectionNode * GetSectionNode()
Definition: section.cxx:1000
"Number (full context)"
Definition: reffld.hxx:60
char sal_Char
void SetFieldCode(const OUString &rStr)
access to the command string
Definition: dbfld.hxx:102
OUString sText
Definition: tox.hxx:208
const OUString & GetName() const
Definition: format.hxx:111
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:33
eF_ResT Read_F_DBNum(WW8FieldDesc *, OUString &)
Definition: ww8par5.cxx:2610
SvStream * m_pStrm
Definition: ww8par.hxx:1087
SVX_NUM_ARABIC
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
bool CopyTo(SotStorage *pDestStg)
SVX_NUM_ROMAN_UPPER
virtual void SetValue(const double &rVal) override
Definition: expfld.cxx:907
bool CheckNodesRange(const SwNodeIndex &rStt, const SwNodeIndex &rEnd, bool bChkSection)
Definition: pam.cxx:236
SwSection * InsertSwSection(SwPaM const &rRange, SwSectionData &, std::pair< SwTOXBase const *, sw::RedlineMode > const *pTOXBase, SfxItemSet const *const pAttr, bool const bUpdate=true)
Definition: ndsect.cxx:151
sal_uInt16 GetTOXTypeCount(TOXTypes eTyp) const
Manage table of content types.
Definition: doctxm.cxx:605
SVX_NUM_ROMAN_LOWER
virtual parameter_map_t * GetParameters()=0
"Category and Number"
Definition: reffld.hxx:53
void SetAutomaticLanguage(bool const bSet)
Definition: fldbas.hxx:373
void SetBookmarkCode(const OUString &bookmarkCode)
Definition: ww8par5.cxx:762
eF_ResT Read_F_IncludeText(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:2488
const SwDoc & mrDoc
Definition: ww8par.hxx:948
Iterator for fields.
Definition: ww8scan.hxx:718
eF_ResT
Definition: ww8par.hxx:622
void SetUniqueGraphName(SwFrameFormat *pFrameFormat, const OUString &rFixedPart)
Definition: ww8graf.cxx:181
void SetAlternativeText(const OUString &rAlt)
Definition: tox.hxx:548
bool m_bLoadingTOXHyperlink
Definition: ww8par.hxx:1363
#define RES_FLTR_TOX
Definition: hintids.hxx:325
void SetHadPageDescItem(bool bVal)
Definition: fltshell.hxx:288
if(nullptr==pCandidateA||nullptr==pCandidateB)
SwFltStackEntry * RefToVar(const SwField *pField, SwFltStackEntry &rEntry)
Definition: ww8par5.cxx:1335
eF_ResT Read_F_PgRef(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:2177
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:143
void Swap(WW8FieldEntry &rOther)
Definition: ww8par5.cxx:738
Base class for various Writer styles.
Definition: format.hxx:43
#define SAL_N_ELEMENTS(arr)
const SwDocInfoSubType DI_CUSTOM
Definition: docufld.hxx:75
WW8_CP nLCode
length
Definition: ww8scan.hxx:192
void SetHadBreakItem(bool bVal)
Definition: fltshell.hxx:287
WW8_CP Read_F_Tag(WW8FieldDesc *pF)
Definition: ww8par5.cxx:1145
void SetVisitedFormatAndId(const OUString &rNm, const sal_uInt16 nId)
Definition: fmtinfmt.hxx:112
void SetFormula(const OUString &rStr)
Definition: fldbas.cxx:701
void Read_SubF_Ruby(msfilter::util::WW8ReadFieldParams &rReadParam)
Definition: ww8par5.cxx:2658
long Read_FactoidBook(WW8PLCFManResult *)
Definition: ww8par5.cxx:255
eF_ResT Read_F_FormCheckBox(WW8FieldDesc *pF, OUString &rStr)
Definition: ww8par3.cxx:183
eF_ResT Read_F_DBField(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:2556
const char aObjectPool[]
Definition: ww8scan.hxx:44
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
void PrependedInlineNode(const SwPosition &rPos, const SwNode &rNode)
Definition: ww8par2.cxx:2375
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:481
const SwDocInfoSubType DI_PRINT
Definition: docufld.hxx:72
eF_ResT Read_F_TemplName(WW8FieldDesc *, OUString &)
Definition: ww8par5.cxx:1782
bool CurrentSectionIsProtected() const
Definition: ww8par2.cxx:140
T * get() const
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
bool bResNest
instruction inserted into result
Definition: ww8scan.hxx:198
eF_ResT Read_F_Symbol(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:1909
static SvtFilterOptions & Get()
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
wwSectionManager m_aSectionManager
Definition: ww8par.hxx:1148
SwFileNameFormat
Definition: fldbas.hxx:146
SwDoc & m_rDoc
Definition: ww8par.hxx:1092
NF_TIME_START
void SetPrimaryKey(const OUString &rStr)
Definition: tox.hxx:568
bool PutandConvertEntry(OUString &rString, sal_Int32 &nCheckPos, SvNumFormatType &nType, sal_uInt32 &nKey, LanguageType eLnge, LanguageType eNewLnge, bool bConvertDateOrder)
SwTOXElement
Definition: tox.hxx:328
const SwPosition * GetPoint() const
Definition: pam.hxx:207
std::unique_ptr< WW8ScannerBase > m_xSBase
Definition: ww8par.hxx:1221
EquationResult ParseCombinedChars(const OUString &rStr)
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:198
eF_ResT Read_F_FileName(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:1854
OUString sCharStyleName
Definition: tox.hxx:209
#define LANGUAGE_SYSTEM
const SwDocInfoSubType DI_KEYS
Definition: docufld.hxx:68
OUString sName
bool SwFltGetFlag(sal_uLong nFieldFlags, int no)
Definition: fltshell.hxx:43
void Exchange()
Definition: pam.cxx:469
int i
QPRO_FUNC_TYPE const nType
SwContentNode * GetContentNode()
Definition: node.hxx:615
const SwDocInfoSubType DI_CREATE
Definition: docufld.hxx:70
void SetSequenceName(const OUString &rSet)
Definition: tox.hxx:506
FlyAnchors.
Definition: fmtanchr.hxx:34
rtl_TextEncoding m_eTextCharSet
Definition: ww8par.hxx:1282
void SetCaptionDisplay(SwCaptionDisplay eSet)
Definition: tox.hxx:509
void NewAttr(const SfxPoolItem &rAttr, const bool bFirstLineOfStSet=false, const bool bLeftIndentSet=false)
Definition: ww8par6.cxx:2750
void AppendTextNode(SwPosition &rPos)
Definition: ww8par.cxx:2403
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
bool ForceFieldLanguage(SwField &rField, LanguageType nLang)
Definition: ww8par5.cxx:396
#define RES_CHRATR_BEGIN
Definition: hintids.hxx:69
WW8_CP GetStartPos() const
Definition: ww8scan.hxx:769
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
Definition: hints.cxx:195
new reference format types for referencing bookmarks and set references
Definition: reffld.hxx:58
eF_ResT Read_F_Embedd(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:1981
eF_ResT Read_F_Ref(WW8FieldDesc *pF, OUString &)
Definition: ww8par5.cxx:2044
static sal_Int32 FindParaStart(const OUString &rStr, sal_Unicode cToken, sal_Unicode cToken2)
Definition: ww8par5.cxx:312
#define RES_FLTR_RDFMARK
Definition: hintids.hxx:328
eF_ResT Read_F_FormTextBox(WW8FieldDesc *pF, OUString &rStr)
Definition: ww8par3.cxx:90
PITCH_DONTKNOW
void ImportTox(int nFieldId, const OUString &aStr)
Definition: ww8par5.cxx:3656
SvNumFormatType
const sal_uInt8 * pSprm
Definition: ww8scan.hxx:95
eF_ResT Read_F_Tox(WW8FieldDesc *pF, OUString &rStr)
Definition: ww8par5.cxx:2963
const SwDocInfoSubType DI_SUB_DATE
Definition: docufld.hxx:80
void UpdateFields()
Definition: ww8par5.cxx:504
Marks a node in the document model.
Definition: ndindex.hxx:31
sal_uInt16 sal_Char * pName
GUIDCNamePair const aData
void SetBookmarkName(const OUString &bookmarkName)
Definition: ww8par5.cxx:752
FontPitch
DocumentType const eType
sal_uInt16 GetLevel() const
Definition: tox.hxx:704
eF_ResT Read_F_FormListBox(WW8FieldDesc *pF, OUString &rStr)
Definition: ww8par3.cxx:242
void InitContent()
Evaluation for header and footer.
Definition: dbfld.cxx:190
#define RES_TXTATR_INETFMT
Definition: hintids.hxx:142
SVX_NUM_CHARS_LOWER_LETTER_N
std::deque< bool > m_aApos
Definition: ww8par.hxx:1203
const OUString * GetName() const
Definition: ww8scan.cxx:4501
WW8PostProcessAttrsInfo(WW8_CP nCpStart, WW8_CP nCpEnd, SwPaM &rPaM)
Definition: ww8par5.cxx:2369
sal_Int32 WW8_CP
Definition: ww8struc.hxx:153
eBookStatus GetStatus() const
Definition: ww8scan.cxx:4405
int m_nEmbeddedTOXLevel
Definition: ww8par.hxx:1361
void SetTOXForm(const SwForm &rForm)
Definition: tox.hxx:692
WW8_CP nLRes
length ( == 0, if no result )
Definition: ww8scan.hxx:194
bool IsControlChar(sal_Unicode cChar)
static bool ConvertMacroSymbol(const OUString &rName, OUString &rReference)
Definition: ww8par5.cxx:2251
const SwDocInfoSubType DI_SUB_AUTHOR
Definition: docufld.hxx:78
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:62
std::vector< const SwCharFormat * > m_aRubyCharFormats
Definition: ww8par.hxx:1208
bool m_bCareFirstParaEndInToc
Definition: ww8par.hxx:1371
OUString ConvertFFileName(const OUString &rRaw)
translate FieldParameter names into the system character set and at the same time, double backslashes are converted into single ones
Definition: ww8par5.cxx:276
NF_DATE_START
FontFamily
const OUString & GetFamilyName() const
#define ODF_UNHANDLED
std::unique_ptr< SfxPoolItem > pAttr
Definition: fltshell.hxx:89
OUString GetFieldResult(WW8FieldDesc const *pF)
Definition: ww8par5.cxx:1205
const SwFormat * GetStyleWithOrgWWName(OUString const &rName) const
Definition: ww8par2.cxx:3574
long GetHandle() const
Definition: ww8scan.cxx:4413
SVX_NUM_PAGEDESC
"Reference"
Definition: reffld.hxx:50
#define RES_TXTATR_FIELD
Definition: hintids.hxx:151
const SwGetSetExpType GSE_SEQ
Sequence.
Definition: fldbas.hxx:198
OUString UniqueName()
Definition: ww8par5.cxx:2481
sal_uInt32 GetHeight() const
static OUString GetWordDefaultDateStringAsUS(SvNumberFormatter *pFormatter, LanguageType nLang)
Definition: ww8par5.cxx:415
OUString BookmarkToWriter(const OUString &rBookmark)
Definition: wrtw8nds.cxx:1154
SwFieldIds Which() const
ResId.
Definition: fldbas.cxx:200
SvNumFormatType GetTimeDatePara(OUString const &rStr, sal_uInt32 &rFormat, LanguageType &rLang, int nWhichDefault, bool bHijri=false)
Definition: ww8par5.cxx:437
sal_Int32 FindNextStringPiece(sal_Int32 _nStart=-1)
virtual void SetLanguage(LanguageType nLng)
Definition: fldbas.cxx:370
void SetHandle(long nHandle)
Definition: fltshell.cxx:1062
eF_ResT Read_F_DBNext(WW8FieldDesc *, OUString &)
Definition: ww8par5.cxx:2597
#define RES_CHRATR_CTL_LANGUAGE
Definition: hintids.hxx:98
unsigned char sal_uInt8
sal_uInt16 nId
WW-id for fields.
Definition: ww8scan.hxx:195
const SwDocInfoSubType DI_DOCNO
Definition: docufld.hxx:73
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, bool bExpandCharToPara=false, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
"Above/Below"
Definition: reffld.hxx:51
OUString const & GetStyleNames(sal_uInt16 nLevel) const
Definition: tox.hxx:483
bool GetIsEnd() const
Definition: ww8scan.hxx:772
bool GetPara(long nIdx, WW8FieldDesc &rF)
Definition: ww8scan.cxx:4104
static SvxNumType GetNumberPara(const OUString &rStr, bool bAllowPageDesc=false)
Definition: ww8par5.cxx:389
sal_uInt16 CurrentSectionColCount() const
Definition: ww8par5.cxx:2926
bool CanUseRemoteLink(const OUString &rGrfName)
Definition: ww8par5.cxx:2379
#define SAL_INFO(area, stream)
static void lcl_toxMatchACSwitch(SwDoc const &rDoc, SwTOXBase &rBase, WW8ReadFieldParams &rParam, SwCaptionDisplay eCaptionType)
Definition: ww8par5.cxx:2821
sal_Int32 GetIndex() const
Definition: index.hxx:95
void SetStyleNames(const OUString &rSet, sal_uInt16 nLevel)
Definition: tox.hxx:488
eF_ResT Read_F_OCX(WW8FieldDesc *, OUString &)
Definition: ww8par3.cxx:82
#define ODF_FORMTEXT
eF_ResT Read_F_Input(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:1168
eF_ResT Read_F_ANumber(WW8FieldDesc *, OUString &)
Definition: ww8par5.cxx:1430
NF_DATE_SYSTEM_SHORT
sal_Int32 nRemainingData
Definition: ww8scan.hxx:96
long Read_Field(WW8PLCFManResult *pRes)
Definition: ww8par5.cxx:771
void SetInputFlag(bool bInp)
Definition: expfld.hxx:261
const SwPosition * End() const
Definition: pam.hxx:217
bool m_bIgnoreText
Definition: ww8par.hxx:1312
WW8_CP nSRes
start of result
Definition: ww8scan.hxx:193
"Number (no context)"
Definition: reffld.hxx:59
sal_uInt64 Tell() const
Reference< XComponentContext > getProcessComponentContext()
eF_ResT Read_F_DocInfo(WW8FieldDesc *pF, OUString &rStr)
Definition: ww8par5.cxx:1541
static void lcl_ImportTox(SwDoc &rDoc, SwPaM const &rPaM, const OUString &rStr, bool bIdx)
Definition: ww8par5.cxx:3580
eF_ResT Read_F_Styleref(WW8FieldDesc *, OUString &rStr)
Reads a STYLEREF field.
Definition: ww8par5.cxx:1520
void SetSecondaryKey(const OUString &rStr)
Definition: tox.hxx:574
TOXTypes GetType() const
Definition: tox.hxx:663
OUString const msFileLinkSeed
Definition: ww8par.hxx:949
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
eF_ResT Read_F_Hyperlink(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:3491
WW8FieldEntry(SwPosition const &rPos, sal_uInt16 nFieldId)
Definition: ww8par5.cxx:728
void SetProtected(bool bSet)
Definition: tox.hxx:503
OString const aName
static sal_uInt16 lcl_GetMaxValidWordTOCLevel(const SwForm &rForm)
Definition: ww8par5.cxx:2950
std::shared_ptr< WW8PLCFMan > m_xPlcxMan
Definition: ww8par.hxx:1222
static void lcl_ConvertSequenceName(OUString &rSequenceName)
Definition: ww8par5.cxx:303
bool WillHavePageDescHere(const SwNodeIndex &rIdx) const
Definition: ww8par5.cxx:2936
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfld.cxx:211
OUString GetMappedBookmark(const OUString &rOrigName)
Definition: ww8par5.cxx:1358
int mnFileSectionNo
Definition: ww8par.hxx:950
const SwGetSetExpType GSE_STRING
String.
Definition: fldbas.hxx:196
wwSectionNamer m_aSectionNameGenerator
Definition: ww8par.hxx:1166
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
static void lcl_toxMatchTSwitch(SwWW8ImplReader const &rReader, SwTOXBase &rBase, WW8ReadFieldParams &rParam)
Definition: ww8par5.cxx:2859
const SwDocInfoSubType DI_CHANGE
Definition: docufld.hxx:71
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:455
bool m_bWasParaEnd
Definition: ww8par.hxx:1334
const SwTOXType * GetTOXType(TOXTypes eTyp, sal_uInt16 nId) const
Definition: doctxm.cxx:614
sw::hack::Position maStartPos
Definition: ww8par.hxx:566
void SetLevel(sal_uInt16)
Definition: tox.hxx:698
const char *const aFieldNames[]
Definition: authfld.cxx:569
const SwDocInfoSubType DI_THEMA
Definition: docufld.hxx:67
const SwForm & GetTOXForm() const
Definition: tox.hxx:686
SwFormat * m_pCurrentColl
Definition: ww8par.hxx:1229
void Init(sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This function allows to (repeatedly) initialize the columns.
Definition: atrfrm.cxx:947
#define RES_PAGEDESC
Definition: hintids.hxx:200
const SwDocInfoSubType DI_TITLE
Definition: docufld.hxx:66
#define RES_BREAK
Definition: hintids.hxx:201
SwCaptionDisplay
Definition: tox.hxx:366
bool IsUseEnhancedFields() const
static SvxNumType GetNumTypeFromName(const OUString &rStr, bool bAllowPageDesc=false)
Definition: ww8par5.cxx:368
eF_ResT Read_F_CurPage(WW8FieldDesc *, OUString &)
Definition: ww8par5.cxx:1898
eF_ResT Read_F_IncludePicture(WW8FieldDesc *, OUString &rStr)
Definition: ww8par5.cxx:2421
CharClass & GetAppCharClass()
Definition: init.cxx:709
#define RES_FRMATR_BEGIN
Definition: hintids.hxx:194
std::deque< wwSection > maSegments
Definition: ww8par.hxx:826
eF_ResT Read_F_NoteReference(WW8FieldDesc *pF, OUString &rStr)
Definition: ww8par5.cxx:2127
aStr
FormTokenType
Definition: tox.hxx:191
SwPaM * m_pPaM
Definition: ww8par.hxx:1094
void SetINetFormatAndId(const OUString &rNm, const sal_uInt16 nId)
Definition: fmtinfmt.hxx:94
void SetCharFormatId(sal_uInt16 nNew)
Definition: fmtruby.hxx:68
#define ODF_ID_PARAM
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1309
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
bool GetTokenSttFromTo(sal_Int32 *_pFrom, sal_Int32 *_pTo, sal_Int32 _nMax)
eF_ResT Read_F_Equation(WW8FieldDesc *, OUString &)
Definition: ww8par5.cxx:2631
#define RES_PARATR_END
Definition: hintids.hxx:181
only the title
Definition: chpfld.hxx:33
WW8FieldEntry & operator=(const WW8FieldEntry &rOther)
Definition: ww8par5.cxx:744
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
eF_ResT Read_F_HTMLControl(WW8FieldDesc *pF, OUString &rStr)
Definition: ww8par3.cxx:315
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo