LibreOffice Module sw (master)  1
fltini.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 <string.h>
21 #include <hintids.hxx>
22 #include <i18nlangtag/lang.h>
24 #include <o3tl/any.hxx>
25 #include <tools/svlibrary.h>
26 #include <svtools/parhtml.hxx>
27 #include <sot/storage.hxx>
28 #include <comphelper/classids.hxx>
29 #include <sfx2/app.hxx>
30 #include <sfx2/docfilt.hxx>
31 #include <sfx2/fcontnr.hxx>
32 #include <sfx2/docfile.hxx>
33 #include <editeng/lrspitem.hxx>
34 #include <editeng/tstpitem.hxx>
35 #include <doc.hxx>
36 #include <docary.hxx>
37 #include <pam.hxx>
38 #include <shellio.hxx>
39 #include <docsh.hxx>
40 #include <wdocsh.hxx>
41 #include <fltini.hxx>
42 #include <hints.hxx>
43 #include <init.hxx>
44 #include <frmatr.hxx>
45 #include <fmtfsize.hxx>
46 #include <swtable.hxx>
47 #include <fmtcntnt.hxx>
48 #include <editeng/boxitem.hxx>
49 #include <frmfmt.hxx>
50 #include <numrule.hxx>
51 #include <ndtxt.hxx>
52 #include <swfltopt.hxx>
53 #include <swerror.h>
54 #include <swdll.hxx>
55 #include <iodetect.hxx>
56 #include <osl/module.hxx>
57 #include <rtl/bootstrap.hxx>
58 #include <sal/log.hxx>
59 #include <osl/diagnose.h>
60 
61 using namespace utl;
62 using namespace com::sun::star::uno;
63 using namespace com::sun::star;
64 
65 Reader *ReadAscii = nullptr, *ReadHTML = nullptr, *ReadXML = nullptr;
66 
67 static Reader* GetRTFReader();
68 static Reader* GetWW8Reader();
69 static Reader* GetDOCXReader();
70 
71 // Note: if editing, please don't forget to modify also the enum
72 // ReaderWriterEnum and aFilterDetect in iodetect.hxx & iodetect.cxx
74 {
76  SwReaderWriterEntry( nullptr, &::GetASCWriter, false ),
77  SwReaderWriterEntry( &::GetWW8Reader, nullptr, true ),
80  SwReaderWriterEntry( nullptr, &::GetHTMLWriter, true ),
81  SwReaderWriterEntry( &::GetWW8Reader, nullptr, true ),
82  SwReaderWriterEntry( nullptr, &::GetXMLWriter, true ),
83  SwReaderWriterEntry( nullptr, &::GetASCWriter, false ),
84  SwReaderWriterEntry( nullptr, &::GetASCWriter, true ),
85  SwReaderWriterEntry( &::GetDOCXReader, nullptr, true )
86 };
87 
89 {
90  if ( pReader )
91  return pReader;
92  else if ( fnGetReader )
93  {
94  pReader = (*fnGetReader)();
95  return pReader;
96  }
97  return nullptr;
98 }
99 
100 void SwReaderWriterEntry::GetWriter( const OUString& rNm, const OUString& rBaseURL, WriterRef& xWrt ) const
101 {
102  if ( fnGetWriter )
103  (*fnGetWriter)( rNm, rBaseURL, xWrt );
104  else
105  xWrt = WriterRef(nullptr);
106 }
107 
108 Reader* SwGetReaderXML() // SW_DLLPUBLIC
109 {
110  return ReadXML;
111 }
112 
113 static void SetFltPtr( sal_uInt16 rPos, Reader* pReader )
114 {
115  aReaderWriter[ rPos ].pReader = pReader;
116 }
117 
118 namespace sw {
119 
120 Filters::Filters()
121 {
122  ReadAscii = new AsciiReader;
123  ReadHTML = new HTMLReader;
124  ReadXML = new XMLReader;
125  SetFltPtr( READER_WRITER_BAS, ReadAscii );
128  SetFltPtr( READER_WRITER_TEXT_DLG, ReadAscii );
129  SetFltPtr( READER_WRITER_TEXT, ReadAscii );
130 }
131 
132 Filters::~Filters()
133 {
134  // kill Readers
135  for(SwReaderWriterEntry & rEntry : aReaderWriter)
136  {
137  if( rEntry.bDelReader && rEntry.pReader )
138  {
139  delete rEntry.pReader;
140  rEntry.pReader = nullptr;
141  }
142  }
143 }
144 
145 #ifndef DISABLE_DYNLOADING
146 
147 oslGenericFunction Filters::GetMswordLibSymbol( const char *pSymbol )
148 {
149  if (!msword_.is())
150  {
151  OUString url("$LO_LIB_DIR/" SVLIBRARY("msword"));
152  rtl::Bootstrap::expandMacros(url);
153  bool ok = msword_.load( url, SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY );
154  SAL_WARN_IF(!ok, "sw", "failed to load msword library");
155  }
156  if (msword_.is())
157  return msword_.getFunctionSymbol( OUString::createFromAscii( pSymbol ) );
158  return nullptr;
159 }
160 
161 #endif
162 
163 }
164 
165 namespace SwReaderWriter {
166 
168 {
169  return aReaderWriter[READER_WRITER_RTF].GetReader();
170 }
171 
173 {
174  return aReaderWriter[READER_WRITER_DOCX].GetReader();
175 }
176 
177 void GetWriter( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet )
178 {
179  for( int n = 0; n < MAXFILTER; ++n )
180  if ( aFilterDetect[n].IsFilter( rFltName ) )
181  {
182  aReaderWriter[n].GetWriter( rFltName, rBaseURL, xRet );
183  break;
184  }
185 }
186 
187 Reader* GetReader( const OUString& rFltName )
188 {
189  Reader* pRead = nullptr;
190  for( int n = 0; n < MAXFILTER; ++n )
191  {
192  if ( aFilterDetect[n].IsFilter( rFltName ) )
193  {
194  pRead = aReaderWriter[n].GetReader();
195  // add special treatment for some readers
196  if ( pRead )
197  pRead->SetFltName( rFltName );
198  break;
199  }
200  }
201  return pRead;
202 }
203 
204 } // namespace SwReaderWriter
205 
206 bool Writer::IsStgWriter() const { return false; }
207 
208 bool StgWriter::IsStgWriter() const { return true; }
209 
210 // Read Filter Flags; used by WW8 / W4W / EXCEL / LOTUS
211 
212 /*
213 <FilterFlags>
214  <Excel_Lotus>
215  <MinRow cfg:type="long">0</MinRow>
216  <MaxRow cfg:type="long">0</MaxRow>
217  <MinCol cfg:type="long">0</MinCol>
218  <MaxCol cfg:type="long">0</MaxCol>
219  </Excel_Lotus>
220  <W4W>
221  <W4WHD cfg:type="long">0</W4WHD>
222  <W4WFT cfg:type="long">0</W4WFT>
223  <W4W000 cfg:type="long">0</W4W000>
224  </W4W>
225  <WinWord>
226  <WW1F cfg:type="long">0</WW1F>
227  <WW cfg:type="long">0</WW>
228  <WW8 cfg:type="long">0</WW8>
229  <WWF cfg:type="long">0</WWF>
230  <WWFA0 cfg:type="long">0</WWFA0>
231  <WWFA1 cfg:type="long">0</WWFA1>
232  <WWFA2 cfg:type="long">0</WWFA2>
233  <WWFB0 cfg:type="long">0</WWFB0>
234  <WWFB1 cfg:type="long">0</WWFB1>
235  <WWFB2 cfg:type="long">0</WWFB2>
236  <WWFLX cfg:type="long">0</WWFLX>
237  <WWFLY cfg:type="long">0</WWFLY>
238  <WWFT cfg:type="long">0</WWFT>
239  <WWWR cfg:type="long">0</WWWR>
240  </WinWord>
241  <Writer>
242  <SW3Imp cfg:type="long">0</SW3Imp>
243  </Writer>
244 </FilterFlags>
245 */
246 
247 SwFilterOptions::SwFilterOptions( sal_uInt16 nCnt, const sal_Char** ppNames,
248  sal_uInt64* pValues )
249  : ConfigItem( "Office.Writer/FilterFlags" )
250 {
251  GetValues( nCnt, ppNames, pValues );
252 }
253 
254 void SwFilterOptions::GetValues( sal_uInt16 nCnt, const sal_Char** ppNames,
255  sal_uInt64* pValues )
256 {
257  Sequence<OUString> aNames( nCnt );
258  OUString* pNames = aNames.getArray();
259  sal_uInt16 n;
260 
261  for( n = 0; n < nCnt; ++n )
262  pNames[ n ] = OUString::createFromAscii( ppNames[ n ] );
263  Sequence<Any> aValues = GetProperties( aNames );
264 
265  if( nCnt == aValues.getLength() )
266  {
267  const Any* pAnyValues = aValues.getConstArray();
268  for( n = 0; n < nCnt; ++n )
269  pValues[ n ] = pAnyValues[ n ].hasValue()
270  ? *o3tl::doAccess<sal_uInt64>(pAnyValues[ n ])
271  : 0;
272  }
273  else
274  {
275  for( n = 0; n < nCnt; ++n )
276  pValues[ n ] = 0;
277  }
278 }
279 
281 void SwFilterOptions::Notify( const css::uno::Sequence< OUString >& ) {}
282 
283 void StgReader::SetFltName( const OUString& rFltNm )
284 {
286  aFltName = rFltNm;
287 }
288 
290 {
291  pNumRuleTable.reset(new SwNumRuleTable);
292  pNumRuleTable->reserve(8);
293  if( !bNDoc )
294  pNumRuleTable->insert( pNumRuleTable->begin(),
295  rDoc.GetNumRuleTable().begin(), rDoc.GetNumRuleTable().end() );
296 }
297 
299 {
300  if( pNumRuleTable )
301  pNumRuleTable->clear();
302 }
303 
304 void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor,
305  SwTwips nPageWidth)
306 {
307  const SfxPoolItem* pItem = nullptr;
308  if( SfxItemState::SET != rFlySet.GetItemState( RES_FRM_SIZE, true, &pItem ) ||
309  MINFLY > static_cast<const SwFormatFrameSize*>(pItem)->GetWidth() )
310  {
311  std::shared_ptr<SwFormatFrameSize> aSz(static_cast<SwFormatFrameSize*>(rFlySet.Get(RES_FRM_SIZE).Clone()));
312  if (pItem)
313  aSz.reset(static_cast<SwFormatFrameSize*>(pItem->Clone()));
314 
315  SwTwips nWidth;
316  // determine the width; if there is a table use the width of the table;
317  // otherwise use the width of the page
318  const SwTableNode* pTableNd = rAnchor.GetNode().FindTableNode();
319  if( pTableNd )
320  nWidth = pTableNd->GetTable().GetFrameFormat()->GetFrameSize().GetWidth();
321  else
322  nWidth = nPageWidth;
323 
324  const SwNodeIndex* pSttNd = rFlySet.Get( RES_CNTNT ).GetContentIdx();
325  if( pSttNd )
326  {
327  bool bOnlyOneNode = true;
328  sal_uLong nMinFrame = 0;
329  sal_uLong nMaxFrame = 0;
330  SwTextNode* pFirstTextNd = nullptr;
331  SwNodeIndex aIdx( *pSttNd, 1 );
332  SwNodeIndex aEnd( *pSttNd->GetNode().EndOfSectionNode() );
333  while( aIdx < aEnd )
334  {
335  SwTextNode *pTextNd = aIdx.GetNode().GetTextNode();
336  if( pTextNd )
337  {
338  if( !pFirstTextNd )
339  pFirstTextNd = pTextNd;
340  else if( pFirstTextNd != pTextNd )
341  {
342  // forget it
343  bOnlyOneNode = false;
344  break;
345  }
346 
347  sal_uLong nAbsMinCnts;
348  pTextNd->GetMinMaxSize( aIdx.GetIndex(), nMinFrame, nMaxFrame, nAbsMinCnts );
349  }
350  ++aIdx;
351  }
352 
353  if( bOnlyOneNode )
354  {
355  if( nMinFrame < MINLAY && pFirstTextNd )
356  {
357  // if the first node don't contained any content, then
358  // insert one char in it calc again and delete once again
359  SwIndex aNdIdx( pFirstTextNd );
360  pFirstTextNd->InsertText("MM", aNdIdx);
361  sal_uLong nAbsMinCnts;
362  pFirstTextNd->GetMinMaxSize( pFirstTextNd->GetIndex(),
363  nMinFrame, nMaxFrame, nAbsMinCnts );
364  aNdIdx -= 2;
365  pFirstTextNd->EraseText( aNdIdx, 2 );
366  }
367 
368  // consider border and distance to content
369  const SvxBoxItem& rBoxItem = rFlySet.Get( RES_BOX );
370  SvxBoxItemLine nLine = SvxBoxItemLine::LEFT;
371  for( int i = 0; i < 2; ++i )
372  {
373  const editeng::SvxBorderLine* pLn = rBoxItem.GetLine( nLine );
374  if( pLn )
375  {
376  sal_uInt16 nWidthTmp = pLn->GetOutWidth() + pLn->GetInWidth();
377  nWidthTmp = nWidthTmp + rBoxItem.GetDistance( nLine );
378  nMinFrame += nWidthTmp;
379  nMaxFrame += nWidthTmp;
380  }
381  nLine = SvxBoxItemLine::RIGHT;
382  }
383 
384  // enforce minimum width for contents
385  if( nMinFrame < MINLAY )
386  nMinFrame = MINLAY;
387  if( nMaxFrame < MINLAY )
388  nMaxFrame = MINLAY;
389 
390  if( nWidth > static_cast<sal_uInt16>(nMaxFrame) )
391  nWidth = nMaxFrame;
392  else if( nWidth > static_cast<sal_uInt16>(nMinFrame) )
393  nWidth = nMinFrame;
394  }
395  }
396 
397  if( MINFLY > nWidth )
398  nWidth = MINFLY;
399 
400  aSz->SetWidth( nWidth );
401  if( MINFLY > aSz->GetHeight() )
402  aSz->SetHeight( MINFLY );
403  rFlySet.Put( *aSz );
404  }
405  else if( MINFLY > static_cast<const SwFormatFrameSize*>(pItem)->GetHeight() )
406  {
407  std::unique_ptr<SwFormatFrameSize> aSz(static_cast<SwFormatFrameSize*>(pItem->Clone()));
408  aSz->SetHeight( MINFLY );
409  rFlySet.Put( std::move(aSz) );
410  }
411 }
412 
413 namespace
414 {
415 
416 struct CharSetNameMap
417 {
418  rtl_TextEncoding const eCode;
419  const sal_Char* pName;
420 };
421 
422 const CharSetNameMap *GetCharSetNameMap()
423 {
424  static const CharSetNameMap aMapArr[] =
425  {
426 # define IMPLENTRY(X) { RTL_TEXTENCODING_##X, #X }
427  IMPLENTRY(DONTKNOW),
428  IMPLENTRY(MS_1252),
429  IMPLENTRY(APPLE_ROMAN),
430  IMPLENTRY(IBM_437),
431  IMPLENTRY(IBM_850),
432  IMPLENTRY(IBM_860),
433  IMPLENTRY(IBM_861),
434  IMPLENTRY(IBM_863),
435  IMPLENTRY(IBM_865),
436  IMPLENTRY(SYMBOL),
437  IMPLENTRY(ASCII_US),
438  IMPLENTRY(ISO_8859_1),
439  IMPLENTRY(ISO_8859_2),
440  IMPLENTRY(ISO_8859_3),
441  IMPLENTRY(ISO_8859_4),
442  IMPLENTRY(ISO_8859_5),
443  IMPLENTRY(ISO_8859_6),
444  IMPLENTRY(ISO_8859_7),
445  IMPLENTRY(ISO_8859_8),
446  IMPLENTRY(ISO_8859_9),
447  IMPLENTRY(ISO_8859_14),
448  IMPLENTRY(ISO_8859_15),
449  IMPLENTRY(IBM_737),
450  IMPLENTRY(IBM_775),
451  IMPLENTRY(IBM_852),
452  IMPLENTRY(IBM_855),
453  IMPLENTRY(IBM_857),
454  IMPLENTRY(IBM_862),
455  IMPLENTRY(IBM_864),
456  IMPLENTRY(IBM_866),
457  IMPLENTRY(IBM_869),
458  IMPLENTRY(MS_874),
459  IMPLENTRY(MS_1250),
460  IMPLENTRY(MS_1251),
461  IMPLENTRY(MS_1253),
462  IMPLENTRY(MS_1254),
463  IMPLENTRY(MS_1255),
464  IMPLENTRY(MS_1256),
465  IMPLENTRY(MS_1257),
466  IMPLENTRY(MS_1258),
467  IMPLENTRY(APPLE_ARABIC),
468  IMPLENTRY(APPLE_CENTEURO),
469  IMPLENTRY(APPLE_CROATIAN),
470  IMPLENTRY(APPLE_CYRILLIC),
471  IMPLENTRY(APPLE_DEVANAGARI),
472  IMPLENTRY(APPLE_FARSI),
473  IMPLENTRY(APPLE_GREEK),
474  IMPLENTRY(APPLE_GUJARATI),
475  IMPLENTRY(APPLE_GURMUKHI),
476  IMPLENTRY(APPLE_HEBREW),
477  IMPLENTRY(APPLE_ICELAND),
478  IMPLENTRY(APPLE_ROMANIAN),
479  IMPLENTRY(APPLE_THAI),
480  IMPLENTRY(APPLE_TURKISH),
481  IMPLENTRY(APPLE_UKRAINIAN),
482  IMPLENTRY(APPLE_CHINSIMP),
483  IMPLENTRY(APPLE_CHINTRAD),
484  IMPLENTRY(APPLE_JAPANESE),
485  IMPLENTRY(APPLE_KOREAN),
486  IMPLENTRY(MS_932),
487  IMPLENTRY(MS_936),
488  IMPLENTRY(MS_949),
489  IMPLENTRY(MS_950),
490  IMPLENTRY(SHIFT_JIS),
491  IMPLENTRY(GB_2312),
492  IMPLENTRY(GBT_12345),
493  IMPLENTRY(GBK),
494  IMPLENTRY(BIG5),
495  IMPLENTRY(EUC_JP),
496  IMPLENTRY(EUC_CN),
497  IMPLENTRY(EUC_TW),
498  IMPLENTRY(ISO_2022_JP),
499  IMPLENTRY(ISO_2022_CN),
500  IMPLENTRY(KOI8_R),
501  IMPLENTRY(KOI8_U),
502  IMPLENTRY(UTF7),
503  IMPLENTRY(UTF8),
504  IMPLENTRY(ISO_8859_10),
505  IMPLENTRY(ISO_8859_13),
506  IMPLENTRY(EUC_KR),
507  IMPLENTRY(ISO_2022_KR),
508  IMPLENTRY(JIS_X_0201),
509  IMPLENTRY(JIS_X_0208),
510  IMPLENTRY(JIS_X_0212),
511  IMPLENTRY(MS_1361),
512  IMPLENTRY(GB_18030),
513  IMPLENTRY(BIG5_HKSCS),
514  IMPLENTRY(TIS_620),
515  IMPLENTRY(PT154),
516  IMPLENTRY(UCS4),
517  IMPLENTRY(UCS2),
518  IMPLENTRY(UNICODE),
519  {0,nullptr} //Last
520  };
521  return &aMapArr[0];
522 }
523 
524 /*
525  Get a rtl_TextEncoding from its name
526  */
527 rtl_TextEncoding CharSetFromName(const OUString& rChrSetStr)
528 {
529  const CharSetNameMap *pStart = GetCharSetNameMap();
530  rtl_TextEncoding nRet = pStart->eCode;
531 
532  for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
533  {
534  if(rChrSetStr.equalsIgnoreAsciiCaseAscii(pMap->pName))
535  {
536  nRet = pMap->eCode;
537  break;
538  }
539  }
540 
541  OSL_ENSURE(nRet != pStart->eCode, "TXT: That was an unknown language!");
542 
543  return nRet;
544 }
545 
546 /*
547  Get the String name of an rtl_TextEncoding
548  */
549 OUString NameFromCharSet(rtl_TextEncoding nChrSet)
550 {
551  const CharSetNameMap *pStart = GetCharSetNameMap();
552  const char *pRet = pStart->pName;
553 
554  for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
555  {
556  if (nChrSet == pMap->eCode)
557  {
558  pRet = pMap->pName;
559  break;
560  }
561  }
562 
563  OSL_ENSURE(pRet != pStart->pName, "TXT: That was an unknown language!");
564 
565  return OUString::createFromAscii(pRet);
566 }
567 
568 }
569 
570 // for the automatic conversion (mail/news/...)
571 // The user data contains the options for the ascii import/export filter.
572 // The format is:
573 // 1. CharSet - as ascii chars
574 // 2. LineEnd - as CR/LF/CRLF
575 // 3. Fontname
576 // 4. Language
577 // 5. Whether to include byte-order-mark - as true/false
578 // the delimiter character is ","
579 
580 void SwAsciiOptions::ReadUserData( const OUString& rStr )
581 {
582  sal_Int32 nToken = 0;
583  OUString sToken = rStr.getToken(0, ',', nToken); // 1. Charset name
584  if (!sToken.isEmpty())
585  eCharSet = CharSetFromName(sToken);
586  if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 2. Line ending type
587  {
588  if (sToken.equalsIgnoreAsciiCase("CRLF"))
590  else if (sToken.equalsIgnoreAsciiCase("LF"))
592  else
594  }
595  if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 3. Font name
596  sFont = sToken;
597  if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 4. Language tag
599  if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 5. Include BOM?
600  bIncludeBOM = !(sToken.equalsIgnoreAsciiCase("FALSE"));
601 }
602 
603 void SwAsciiOptions::WriteUserData(OUString& rStr)
604 {
605  // 1. charset
606  rStr = NameFromCharSet(eCharSet) + ",";
607 
608  // 2. LineEnd
609  switch(eCRLF_Flag)
610  {
611  case LINEEND_CRLF:
612  rStr += "CRLF";
613  break;
614  case LINEEND_CR:
615  rStr += "CR";
616  break;
617  case LINEEND_LF:
618  rStr += "LF";
619  break;
620  }
621  rStr += ",";
622 
623  // 3. Fontname
624  rStr += sFont + ",";
625 
626  // 4. Language
627  if (nLanguage)
628  {
630  }
631  rStr += ",";
632 
633  // 5. Whether to include byte-order-mark
634  if( bIncludeBOM )
635  {
636  rStr += "true";
637  }
638  else
639  {
640  rStr += "false";
641  }
642  rStr += ",";
643 }
644 
645 #ifdef DISABLE_DYNLOADING
646 
647 extern "C" {
648  Reader *ImportRTF();
649  void ExportRTF( const OUString&, const OUString& rBaseURL, WriterRef& );
650  Reader *ImportDOC();
651  void ExportDOC( const OUString&, const OUString& rBaseURL, WriterRef& );
652  Reader *ImportDOCX();
653  sal_uInt32 SaveOrDelMSVBAStorage_ww8( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& );
655 }
656 
657 #endif
658 
660 {
661 #ifndef DISABLE_DYNLOADING
662 
663  FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportRTF" ) );
664 
665  if ( pFunction )
666  return (*pFunction)();
667 
668  return nullptr;
669 #else
670  return ImportRTF();
671 #endif
672 
673 }
674 
675 void GetRTFWriter( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet )
676 {
677 #ifndef DISABLE_DYNLOADING
678  FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportRTF" ) );
679 
680  if ( pFunction )
681  (*pFunction)( rFltName, rBaseURL, xRet );
682  else
683  xRet = WriterRef(nullptr);
684 #else
685  ExportRTF( rFltName, rBaseURL, xRet );
686 #endif
687 }
688 
690 {
691 #ifndef DISABLE_DYNLOADING
692  FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOC" ) );
693 
694  if ( pFunction )
695  return (*pFunction)();
696 
697  return nullptr;
698 #else
699  return ImportDOC();
700 #endif
701 }
702 
703 void GetWW8Writer( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet )
704 {
705 #ifndef DISABLE_DYNLOADING
706  FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportDOC" ) );
707 
708  if ( pFunction )
709  (*pFunction)( rFltName, rBaseURL, xRet );
710  else
711  xRet = WriterRef(nullptr);
712 #else
713  ExportDOC( rFltName, rBaseURL, xRet );
714 #endif
715 }
716 
718 {
719 #ifndef DISABLE_DYNLOADING
720  FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOCX" ) );
721 
722  if ( pFunction )
723  return (*pFunction)();
724 
725  return nullptr;
726 #else
727  return ImportDOCX();
728 #endif
729 }
730 
731 typedef sal_uInt32 ( *SaveOrDel )( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& );
732 typedef sal_uInt32 ( *GetSaveWarning )( SfxObjectShell& );
733 
734 ErrCode SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, bool bSaveInto, const OUString& rStorageName )
735 {
736 #ifndef DISABLE_DYNLOADING
737  SaveOrDel pFunction = reinterpret_cast<SaveOrDel>( SwGlobals::getFilters().GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) );
738  if( pFunction )
739  return ErrCode(pFunction( rDoc, rStor, bSaveInto, rStorageName ));
740  return ERRCODE_NONE;
741 #else
742  return ErrCode(SaveOrDelMSVBAStorage_ww8( rDoc, rStor, bSaveInto, rStorageName ));
743 #endif
744 }
745 
746 ErrCode GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS )
747 {
748 #ifndef DISABLE_DYNLOADING
749  GetSaveWarning pFunction = reinterpret_cast<GetSaveWarning>( SwGlobals::getFilters().GetMswordLibSymbol( "GetSaveWarningOfMSVBAStorage_ww8" ) );
750  if( pFunction )
751  return ErrCode(pFunction( rDocS ));
752  return ERRCODE_NONE;
753 #else
754  return ErrCode(GetSaveWarningOfMSVBAStorage_ww8( rDocS ));
755 #endif
756 }
757 
758 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:682
void GetXMLWriter(const OUString &, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrtxml.cxx:569
void GetValues(sal_uInt16 nCnt, const sal_Char **ppNames, sal_uInt64 *pValues)
Definition: fltini.cxx:254
SwFilterOptions(sal_uInt16 nCnt, const sal_Char **ppNames, sal_uInt64 *pValues)
Definition: fltini.cxx:247
sal_uLong GetIndex() const
Definition: node.hxx:282
#define RES_FRM_SIZE
Definition: hintids.hxx:194
oslGenericFunction GetMswordLibSymbol(const char *pSymbol)
Definition: fltini.cxx:147
ErrCode SaveOrDelMSVBAStorage(SfxObjectShell &rDoc, SotStorage &rStor, bool bSaveInto, const OUString &rStorageName)
Definition: fltini.cxx:734
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
SAL_DLLPUBLIC_EXPORT sal_uInt32 SaveOrDelMSVBAStorage_ww8(SfxObjectShell &rDoc, SotStorage &rStor, sal_Bool bSaveInto, const OUString &rStorageName)
Definition: wrtww8.cxx:3705
long GetWidth() const
static OUString convertToBcp47(LanguageType nLangID)
#define MINFLY
Definition: swtypes.hxx:65
sal_uIntPtr sal_uLong
#define MINLAY
Definition: swtypes.hxx:66
void(* FnGetWriter)(const OUString &, const OUString &rBaseURL, WriterRef &)
Definition: shellio.hxx:524
Definition: doc.hxx:185
#define IMPLENTRY(X)
tools::SvRef< Writer > WriterRef
Definition: shellio.hxx:469
virtual SwReaderType GetReaderType() override
Definition: shellio.cxx:695
sal_uInt16 GetDistance(SvxBoxItemLine nLine) const
void GetASCWriter(const OUString &rFltNm, const OUString &, WriterRef &xRet)
Definition: wrtasc.cxx:207
SwNode & GetNode() const
Definition: ndindex.hxx:118
long SwTwips
Definition: swtypes.hxx:49
Dialog to specify the properties of date form field.
Definition: accfrmobj.cxx:40
SAL_DLLPUBLIC_EXPORT Reader * ImportRTF()
Definition: swparrtf.cxx:165
LINEEND_CR
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: fltini.cxx:281
#define RES_CNTNT
Definition: hintids.hxx:200
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:201
static Reader * GetWW8Reader()
Definition: fltini.cxx:689
Reader * ReadXML
Definition: fltini.cxx:65
static LanguageType convertToLanguageTypeWithFallback(const OUString &rBcp47)
sw::Filters & getFilters()
Definition: swdll.cxx:74
SwRelNumRuleSpaces(SwDoc const &rDoc, bool bNewDoc)
Definition: fltini.cxx:289
sal_uInt16 GetOutWidth() const
Reader * GetReader(const OUString &rFltName)
Return reader based on the name.
Definition: fltini.cxx:187
char sal_Char
sal_uLong GetIndex() const
Definition: ndindex.hxx:151
SAL_DLLPUBLIC_EXPORT void ExportDOC(const OUString &rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrtww8.cxx:3711
Reader * ReadHTML
Definition: fltini.cxx:65
std::unique_ptr< SwNumRuleTable > pNumRuleTable
Definition: fltini.hxx:72
static void SetFltPtr(sal_uInt16 rPos, Reader *pReader)
Definition: fltini.cxx:113
const SwTable & GetTable() const
Definition: node.hxx:497
const editeng::SvxBorderLine * GetLine(SvxBoxItemLine nLine) const
SAL_DLLPUBLIC_EXPORT void ExportRTF(const OUString &rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: rtfexport.cxx:1469
void GetHTMLWriter(const OUString &, const OUString &rBaseURL, WriterRef &xRet)
Definition: wrthtml.cxx:1550
void GetWriter(const OUString &rNm, const OUString &rBaseURL, WriterRef &xWrt) const
Get access to the writer.
Definition: fltini.cxx:100
OUString sFont
Definition: shellio.hxx:65
ErrCode GetSaveWarningOfMSVBAStorage(SfxObjectShell &rDocS)
Definition: fltini.cxx:746
Reader *(* FnGetReader)()
Definition: shellio.hxx:523
static SwReaderWriterEntry aReaderWriter[]
Definition: fltini.cxx:73
LINEEND_LF
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
static Reader * GetDOCXReader()
Definition: fltini.cxx:717
void ReadUserData(const OUString &)
Definition: fltini.cxx:580
iterator begin()
Definition: docary.hxx:92
static Reader * GetRTFReader()
Definition: fltini.cxx:659
int i
void GetWW8Writer(const OUString &rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: fltini.cxx:703
Marks a character position inside a document model node.
Definition: index.hxx:37
unsigned char sal_Bool
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames)
OUString aFltName
Definition: shellio.hxx:290
virtual bool IsStgWriter() const override
Definition: fltini.cxx:208
Reader * GetReader()
Get access to the reader.
Definition: fltini.cxx:88
SwIoDetect aFilterDetect[]
Definition: iodetect.cxx:40
Marks a node in the document model.
Definition: ndindex.hxx:31
sal_uInt16 sal_Char * pName
SAL_DLLPUBLIC_EXPORT sal_uInt32 GetSaveWarningOfMSVBAStorage_ww8(SfxObjectShell &rDocS)
Definition: wrtww8.cxx:3716
LineEnd eCRLF_Flag
Definition: shellio.hxx:68
rtl_TextEncoding eCharSet
Definition: shellio.hxx:66
Reader * SwGetReaderXML()
Definition: fltini.cxx:108
iterator end()
Definition: docary.hxx:94
virtual void SetFltName(const OUString &r) override
Definition: fltini.cxx:283
Reader * ReadAscii
Definition: fltini.cxx:65
void WriteUserData(OUString &)
Definition: fltini.cxx:603
void EraseText(const SwIndex &rIdx, const sal_Int32 nCount=SAL_MAX_INT32, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
delete text content ATTENTION: must not be called with a range that overlaps the start of an attribut...
Definition: ndtxt.cxx:2667
OUString InsertText(const OUString &rStr, const SwIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2282
void GetRTFWriter(const OUString &rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: fltini.cxx:675
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void CalculateFlySize(SfxItemSet &rFlySet, const SwNodeIndex &rAnchor, SwTwips nPageWidth)
Definition: fltini.cxx:304
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual void SetFltName(const OUString &rFltNm)
Definition: shellio.cxx:621
void GetMinMaxSize(sal_uLong nIndex, sal_uLong &rMin, sal_uLong &rMax, sal_uLong &rAbs) const
Is in itratr.
Definition: itratr.cxx:987
bool bIncludeBOM
Definition: shellio.hxx:69
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define SAL_WARN_IF(condition, area, stream)
#define ERRCODE_NONE
virtual void ImplCommit() override
Definition: fltini.cxx:280
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1055
SvxBoxItemLine
SAL_DLLPUBLIC_EXPORT Reader * ImportDOC()
Definition: ww8par.cxx:6205
LanguageType nLanguage
Definition: shellio.hxx:67
SvxBoxItem & rBoxItem
LINEEND_CRLF
sal_uInt32(* SaveOrDel)(SfxObjectShell &, SotStorage &, sal_Bool, const OUString &)
Definition: fltini.cxx:731
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
Reader * GetRtfReader()
Definition: fltini.cxx:167
#define SVLIBRARY(Base)
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:351
#define RES_BOX
Definition: hintids.hxx:211
void GetWriter(const OUString &rFltName, const OUString &rBaseURL, WriterRef &xRet)
Return writer based on the name.
Definition: fltini.cxx:177
SAL_DLLPUBLIC_EXPORT Reader * ImportDOCX()
sal_uInt32(* GetSaveWarning)(SfxObjectShell &)
Definition: fltini.cxx:732
sal_uInt16 GetInWidth() const
DefTokenId const nToken
virtual bool IsStgWriter() const
Definition: fltini.cxx:206
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:843