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