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