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  m_aFltName = rFltNm;
270 }
271 
272 void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor,
273  SwTwips nPageWidth)
274 {
275  const SfxPoolItem* pItem = nullptr;
276  if( SfxItemState::SET != rFlySet.GetItemState( RES_FRM_SIZE, true, &pItem ) ||
277  MINFLY > static_cast<const SwFormatFrameSize*>(pItem)->GetWidth() )
278  {
279  std::unique_ptr<SwFormatFrameSize> aSz(rFlySet.Get(RES_FRM_SIZE).Clone());
280  if (pItem)
281  aSz.reset(static_cast<SwFormatFrameSize*>(pItem->Clone()));
282 
283  SwTwips nWidth;
284  // determine the width; if there is a table use the width of the table;
285  // otherwise use the width of the page
286  const SwTableNode* pTableNd = rAnchor.GetNode().FindTableNode();
287  if( pTableNd )
288  nWidth = pTableNd->GetTable().GetFrameFormat()->GetFrameSize().GetWidth();
289  else
290  nWidth = nPageWidth;
291 
292  const SwNodeIndex* pSttNd = rFlySet.Get( RES_CNTNT ).GetContentIdx();
293  if( pSttNd )
294  {
295  bool bOnlyOneNode = true;
296  sal_uLong nMinFrame = 0;
297  sal_uLong nMaxFrame = 0;
298  SwTextNode* pFirstTextNd = nullptr;
299  SwNodeIndex aIdx( *pSttNd, 1 );
300  SwNodeIndex aEnd( *pSttNd->GetNode().EndOfSectionNode() );
301  while( aIdx < aEnd )
302  {
303  SwTextNode *pTextNd = aIdx.GetNode().GetTextNode();
304  if( pTextNd )
305  {
306  if( !pFirstTextNd )
307  pFirstTextNd = pTextNd;
308  else if( pFirstTextNd != pTextNd )
309  {
310  // forget it
311  bOnlyOneNode = false;
312  break;
313  }
314 
315  sal_uLong nAbsMinCnts;
316  pTextNd->GetMinMaxSize( aIdx.GetIndex(), nMinFrame, nMaxFrame, nAbsMinCnts );
317  }
318  ++aIdx;
319  }
320 
321  if( bOnlyOneNode )
322  {
323  if( nMinFrame < MINLAY && pFirstTextNd )
324  {
325  // if the first node don't contained any content, then
326  // insert one char in it calc again and delete once again
327  SwIndex aNdIdx( pFirstTextNd );
328  pFirstTextNd->InsertText("MM", aNdIdx);
329  sal_uLong nAbsMinCnts;
330  pFirstTextNd->GetMinMaxSize( pFirstTextNd->GetIndex(),
331  nMinFrame, nMaxFrame, nAbsMinCnts );
332  aNdIdx -= 2;
333  pFirstTextNd->EraseText( aNdIdx, 2 );
334  }
335 
336  // consider border and distance to content
337  const SvxBoxItem& rBoxItem = rFlySet.Get( RES_BOX );
338  SvxBoxItemLine nLine = SvxBoxItemLine::LEFT;
339  for( int i = 0; i < 2; ++i )
340  {
341  const editeng::SvxBorderLine* pLn = rBoxItem.GetLine( nLine );
342  if( pLn )
343  {
344  sal_uInt16 nWidthTmp = pLn->GetOutWidth() + pLn->GetInWidth();
345  nWidthTmp = nWidthTmp + rBoxItem.GetDistance( nLine );
346  nMinFrame += nWidthTmp;
347  nMaxFrame += nWidthTmp;
348  }
349  nLine = SvxBoxItemLine::RIGHT;
350  }
351 
352  // enforce minimum width for contents
353  if( nMinFrame < MINLAY )
354  nMinFrame = MINLAY;
355  if( nMaxFrame < MINLAY )
356  nMaxFrame = MINLAY;
357 
358  if( nWidth > static_cast<sal_uInt16>(nMaxFrame) )
359  nWidth = nMaxFrame;
360  else if( nWidth > static_cast<sal_uInt16>(nMinFrame) )
361  nWidth = nMinFrame;
362  }
363  }
364 
365  if( MINFLY > nWidth )
366  nWidth = MINFLY;
367 
368  aSz->SetWidth( nWidth );
369  if( MINFLY > aSz->GetHeight() )
370  aSz->SetHeight( MINFLY );
371  rFlySet.Put( *aSz );
372  }
373  else if( MINFLY > static_cast<const SwFormatFrameSize*>(pItem)->GetHeight() )
374  {
375  std::unique_ptr<SwFormatFrameSize> aSz(static_cast<SwFormatFrameSize*>(pItem->Clone()));
376  aSz->SetHeight( MINFLY );
377  rFlySet.Put( std::move(aSz) );
378  }
379 }
380 
381 namespace
382 {
383 
384 struct CharSetNameMap
385 {
386  rtl_TextEncoding eCode;
387  const char* pName;
388 };
389 
390 const CharSetNameMap *GetCharSetNameMap()
391 {
392  static const CharSetNameMap aMapArr[] =
393  {
394 # define IMPLENTRY(X) { RTL_TEXTENCODING_##X, #X }
395  IMPLENTRY(DONTKNOW),
396  IMPLENTRY(MS_1252),
397  IMPLENTRY(APPLE_ROMAN),
398  IMPLENTRY(IBM_437),
399  IMPLENTRY(IBM_850),
400  IMPLENTRY(IBM_860),
401  IMPLENTRY(IBM_861),
402  IMPLENTRY(IBM_863),
403  IMPLENTRY(IBM_865),
404  IMPLENTRY(SYMBOL),
405  IMPLENTRY(ASCII_US),
406  IMPLENTRY(ISO_8859_1),
407  IMPLENTRY(ISO_8859_2),
408  IMPLENTRY(ISO_8859_3),
409  IMPLENTRY(ISO_8859_4),
410  IMPLENTRY(ISO_8859_5),
411  IMPLENTRY(ISO_8859_6),
412  IMPLENTRY(ISO_8859_7),
413  IMPLENTRY(ISO_8859_8),
414  IMPLENTRY(ISO_8859_9),
415  IMPLENTRY(ISO_8859_14),
416  IMPLENTRY(ISO_8859_15),
417  IMPLENTRY(IBM_737),
418  IMPLENTRY(IBM_775),
419  IMPLENTRY(IBM_852),
420  IMPLENTRY(IBM_855),
421  IMPLENTRY(IBM_857),
422  IMPLENTRY(IBM_862),
423  IMPLENTRY(IBM_864),
424  IMPLENTRY(IBM_866),
425  IMPLENTRY(IBM_869),
426  IMPLENTRY(MS_874),
427  IMPLENTRY(MS_1250),
428  IMPLENTRY(MS_1251),
429  IMPLENTRY(MS_1253),
430  IMPLENTRY(MS_1254),
431  IMPLENTRY(MS_1255),
432  IMPLENTRY(MS_1256),
433  IMPLENTRY(MS_1257),
434  IMPLENTRY(MS_1258),
435  IMPLENTRY(APPLE_ARABIC),
436  IMPLENTRY(APPLE_CENTEURO),
437  IMPLENTRY(APPLE_CROATIAN),
438  IMPLENTRY(APPLE_CYRILLIC),
439  IMPLENTRY(APPLE_DEVANAGARI),
440  IMPLENTRY(APPLE_FARSI),
441  IMPLENTRY(APPLE_GREEK),
442  IMPLENTRY(APPLE_GUJARATI),
443  IMPLENTRY(APPLE_GURMUKHI),
444  IMPLENTRY(APPLE_HEBREW),
445  IMPLENTRY(APPLE_ICELAND),
446  IMPLENTRY(APPLE_ROMANIAN),
447  IMPLENTRY(APPLE_THAI),
448  IMPLENTRY(APPLE_TURKISH),
449  IMPLENTRY(APPLE_UKRAINIAN),
450  IMPLENTRY(APPLE_CHINSIMP),
451  IMPLENTRY(APPLE_CHINTRAD),
452  IMPLENTRY(APPLE_JAPANESE),
453  IMPLENTRY(APPLE_KOREAN),
454  IMPLENTRY(MS_932),
455  IMPLENTRY(MS_936),
456  IMPLENTRY(MS_949),
457  IMPLENTRY(MS_950),
458  IMPLENTRY(SHIFT_JIS),
459  IMPLENTRY(GB_2312),
460  IMPLENTRY(GBT_12345),
461  IMPLENTRY(GBK),
462  IMPLENTRY(BIG5),
463  IMPLENTRY(EUC_JP),
464  IMPLENTRY(EUC_CN),
465  IMPLENTRY(EUC_TW),
466  IMPLENTRY(ISO_2022_JP),
467  IMPLENTRY(ISO_2022_CN),
468  IMPLENTRY(KOI8_R),
469  IMPLENTRY(KOI8_U),
470  IMPLENTRY(UTF7),
471  IMPLENTRY(UTF8),
472  IMPLENTRY(ISO_8859_10),
473  IMPLENTRY(ISO_8859_13),
474  IMPLENTRY(EUC_KR),
475  IMPLENTRY(ISO_2022_KR),
476  IMPLENTRY(JIS_X_0201),
477  IMPLENTRY(JIS_X_0208),
478  IMPLENTRY(JIS_X_0212),
479  IMPLENTRY(MS_1361),
480  IMPLENTRY(GB_18030),
481  IMPLENTRY(BIG5_HKSCS),
482  IMPLENTRY(TIS_620),
483  IMPLENTRY(PT154),
484  IMPLENTRY(UCS4),
485  IMPLENTRY(UCS2),
486  IMPLENTRY(UNICODE),
487  {0,nullptr} //Last
488  };
489  return &aMapArr[0];
490 }
491 
492 /*
493  Get a rtl_TextEncoding from its name
494  */
495 rtl_TextEncoding CharSetFromName(const OUString& rChrSetStr)
496 {
497  const CharSetNameMap *pStart = GetCharSetNameMap();
498  rtl_TextEncoding nRet = pStart->eCode;
499 
500  for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
501  {
502  if(rChrSetStr.equalsIgnoreAsciiCaseAscii(pMap->pName))
503  {
504  nRet = pMap->eCode;
505  break;
506  }
507  }
508 
509  OSL_ENSURE(nRet != pStart->eCode, "TXT: That was an unknown language!");
510 
511  return nRet;
512 }
513 
514 /*
515  Get the String name of an rtl_TextEncoding
516  */
517 OUString NameFromCharSet(rtl_TextEncoding nChrSet)
518 {
519  const CharSetNameMap *pStart = GetCharSetNameMap();
520  const char *pRet = pStart->pName;
521 
522  for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
523  {
524  if (nChrSet == pMap->eCode)
525  {
526  pRet = pMap->pName;
527  break;
528  }
529  }
530 
531  OSL_ENSURE(pRet != pStart->pName, "TXT: That was an unknown language!");
532 
533  return OUString::createFromAscii(pRet);
534 }
535 
536 }
537 
538 // for the automatic conversion (mail/news/...)
539 // The user data contains the options for the ascii import/export filter.
540 // The format is:
541 // 1. CharSet - as ascii chars
542 // 2. LineEnd - as CR/LF/CRLF
543 // 3. Fontname
544 // 4. Language
545 // 5. Whether to include byte-order-mark - as true/false
546 // the delimiter character is ","
547 
548 void SwAsciiOptions::ReadUserData( const OUString& rStr )
549 {
550  sal_Int32 nToken = 0;
551  OUString sToken = rStr.getToken(0, ',', nToken); // 1. Charset name
552  if (!sToken.isEmpty())
553  m_eCharSet = CharSetFromName(sToken);
554  if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 2. Line ending type
555  {
556  if (sToken.equalsIgnoreAsciiCase("CRLF"))
558  else if (sToken.equalsIgnoreAsciiCase("LF"))
560  else
562  }
563  if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 3. Font name
564  m_sFont = sToken;
565  if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 4. Language tag
567  if (nToken >= 0 && !(sToken = rStr.getToken(0, ',', nToken)).isEmpty()) // 5. Include BOM?
568  m_bIncludeBOM = !(sToken.equalsIgnoreAsciiCase("FALSE"));
569 }
570 
571 void SwAsciiOptions::WriteUserData(OUString& rStr)
572 {
573  // 1. charset
574  rStr = NameFromCharSet(m_eCharSet) + ",";
575 
576  // 2. LineEnd
577  switch(m_eCRLF_Flag)
578  {
579  case LINEEND_CRLF:
580  rStr += "CRLF";
581  break;
582  case LINEEND_CR:
583  rStr += "CR";
584  break;
585  case LINEEND_LF:
586  rStr += "LF";
587  break;
588  }
589  rStr += ",";
590 
591  // 3. Fontname
592  rStr += m_sFont + ",";
593 
594  // 4. Language
595  if (m_nLanguage)
596  {
598  }
599  rStr += ",";
600 
601  // 5. Whether to include byte-order-mark
602  if( m_bIncludeBOM )
603  {
604  rStr += "true";
605  }
606  else
607  {
608  rStr += "false";
609  }
610  rStr += ",";
611 }
612 
613 #ifdef DISABLE_DYNLOADING
614 
615 extern "C" {
616  Reader *ImportRTF();
617  void ExportRTF( const OUString&, const OUString& rBaseURL, WriterRef& );
618  Reader *ImportDOC();
619  void ExportDOC( const OUString&, const OUString& rBaseURL, WriterRef& );
620  Reader *ImportDOCX();
621  sal_uInt32 SaveOrDelMSVBAStorage_ww8( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& );
623 }
624 
625 #endif
626 
628 {
629 #ifndef DISABLE_DYNLOADING
630 
631  FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportRTF" ) );
632 
633  if ( pFunction )
634  return (*pFunction)();
635 
636  return nullptr;
637 #else
638  return ImportRTF();
639 #endif
640 
641 }
642 
643 void GetRTFWriter( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet )
644 {
645 #ifndef DISABLE_DYNLOADING
646  FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportRTF" ) );
647 
648  if ( pFunction )
649  (*pFunction)( rFltName, rBaseURL, xRet );
650  else
651  xRet = WriterRef(nullptr);
652 #else
653  ExportRTF( rFltName, rBaseURL, xRet );
654 #endif
655 }
656 
658 {
659 #ifndef DISABLE_DYNLOADING
660  FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOC" ) );
661 
662  if ( pFunction )
663  return (*pFunction)();
664 
665  return nullptr;
666 #else
667  return ImportDOC();
668 #endif
669 }
670 
671 void GetWW8Writer( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet )
672 {
673 #ifndef DISABLE_DYNLOADING
674  FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportDOC" ) );
675 
676  if ( pFunction )
677  (*pFunction)( rFltName, rBaseURL, xRet );
678  else
679  xRet = WriterRef(nullptr);
680 #else
681  ExportDOC( rFltName, rBaseURL, xRet );
682 #endif
683 }
684 
686 {
687 #ifndef DISABLE_DYNLOADING
688  FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOCX" ) );
689 
690  if ( pFunction )
691  return (*pFunction)();
692 
693  return nullptr;
694 #else
695  return ImportDOCX();
696 #endif
697 }
698 
699 typedef sal_uInt32 ( *SaveOrDel )( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& );
700 typedef sal_uInt32 ( *GetSaveWarning )( SfxObjectShell& );
701 
702 ErrCode SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, bool bSaveInto, const OUString& rStorageName )
703 {
704 #ifndef DISABLE_DYNLOADING
705  SaveOrDel pFunction = reinterpret_cast<SaveOrDel>( SwGlobals::getFilters().GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) );
706  if( pFunction )
707  return ErrCode(pFunction( rDoc, rStor, bSaveInto, rStorageName ));
708  return ERRCODE_NONE;
709 #else
710  return ErrCode(SaveOrDelMSVBAStorage_ww8( rDoc, rStor, bSaveInto, rStorageName ));
711 #endif
712 }
713 
714 ErrCode GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS )
715 {
716 #ifndef DISABLE_DYNLOADING
717  GetSaveWarning pFunction = reinterpret_cast<GetSaveWarning>( SwGlobals::getFilters().GetMswordLibSymbol( "GetSaveWarningOfMSVBAStorage_ww8" ) );
718  if( pFunction )
719  return ErrCode(pFunction( rDocS ));
720  return ERRCODE_NONE;
721 #else
722  return ErrCode(GetSaveWarningOfMSVBAStorage_ww8( rDocS ));
723 #endif
724 }
725 
726 /* 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:562
sal_uLong GetIndex() const
Definition: node.hxx:282
bool m_bIncludeBOM
Definition: shellio.hxx:70
rtl_TextEncoding m_eCharSet
Definition: shellio.hxx:67
oslGenericFunction GetMswordLibSymbol(const char *pSymbol)
Definition: fltini.cxx:130
ErrCode SaveOrDelMSVBAStorage(SfxObjectShell &rDoc, SotStorage &rStor, bool bSaveInto, const OUString &rStorageName)
Definition: fltini.cxx:702
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:3933
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
#define IMPLENTRY(X)
tools::SvRef< Writer > WriterRef
Definition: shellio.hxx:476
virtual SwReaderType GetReaderType() override
Definition: shellio.cxx:682
sal_uInt16 GetDistance(SvxBoxItemLine nLine) const
OUString m_aFltName
Definition: shellio.hxx:299
void GetASCWriter(const OUString &rFltNm, const OUString &, WriterRef &xRet)
Definition: wrtasc.cxx:206
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:169
LINEEND_CR
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: fltini.cxx:264
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:201
OUString m_sFont
Definition: shellio.hxx:66
static Reader * GetWW8Reader()
Definition: fltini.cxx:657
Reader * ReadXML
Definition: fltini.cxx:48
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: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:3939
Reader * ReadHTML
Definition: fltini.cxx:48
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:1469
void GetWriter(const OUString &rNm, const OUString &rBaseURL, WriterRef &xWrt) const
Get access to the writer.
Definition: fltini.cxx:83
ErrCode GetSaveWarningOfMSVBAStorage(SfxObjectShell &rDocS)
Definition: fltini.cxx:714
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
int i
static Reader * GetDOCXReader()
Definition: fltini.cxx:685
void ReadUserData(const OUString &)
Definition: fltini.cxx:548
static Reader * GetRTFReader()
Definition: fltini.cxx:627
void GetWW8Writer(const OUString &rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: fltini.cxx:671
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)
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:1570
SAL_DLLPUBLIC_EXPORT sal_uInt32 GetSaveWarningOfMSVBAStorage_ww8(SfxObjectShell &rDocS)
Definition: wrtww8.cxx:3944
Reader * SwGetReaderXML()
Definition: fltini.cxx:91
virtual void SetFltName(const OUString &r) override
Definition: fltini.cxx:266
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
Reader * ReadAscii
Definition: fltini.cxx:48
void WriteUserData(OUString &)
Definition: fltini.cxx:571
LineEnd m_eCRLF_Flag
Definition: shellio.hxx:69
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:2660
OUString InsertText(const OUString &rStr, const SwIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2277
void GetRTFWriter(const OUString &rFltName, const OUString &rBaseURL, WriterRef &xRet)
Definition: fltini.cxx:643
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void CalculateFlySize(SfxItemSet &rFlySet, const SwNodeIndex &rAnchor, SwTwips nPageWidth)
Definition: fltini.cxx:272
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:263
SvxBoxItemLine
SAL_DLLPUBLIC_EXPORT Reader * ImportDOC()
Definition: ww8par.cxx:6245
SvxBoxItem & rBoxItem
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
LINEEND_CRLF
sal_uInt32(* SaveOrDel)(SfxObjectShell &, SotStorage &, sal_Bool, const OUString &)
Definition: fltini.cxx:699
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:352
LanguageType m_nLanguage
Definition: shellio.hxx:68
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:700
sal_uInt16 GetInWidth() const
virtual bool IsStgWriter() const
Definition: fltini.cxx:189
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:836