android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / filter / basflt / fltini.cxx
blob9a5b6f0e2c4fdc5d48f1b5a4c40063772023ba6e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <hintids.hxx>
21 #include <i18nlangtag/lang.h>
22 #include <i18nlangtag/languagetag.hxx>
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>
42 using namespace utl;
43 using namespace com::sun::star::uno;
44 using namespace com::sun::star;
46 Reader *ReadAscii = nullptr, *ReadHTML = nullptr, *ReadXML = nullptr;
48 static Reader* GetRTFReader();
49 static Reader* GetWW8Reader();
50 static Reader* GetDOCXReader();
52 // Note: if editing, please don't forget to modify also the enum
53 // ReaderWriterEnum and aFilterDetect in iodetect.hxx & iodetect.cxx
54 static SwReaderWriterEntry aReaderWriter[] =
56 SwReaderWriterEntry( &::GetRTFReader, &::GetRTFWriter, true ),
57 SwReaderWriterEntry( nullptr, &::GetASCWriter, false ),
58 SwReaderWriterEntry( &::GetWW8Reader, nullptr, true ),
59 SwReaderWriterEntry( &::GetWW8Reader, &::GetWW8Writer, true ),
60 SwReaderWriterEntry( &::GetRTFReader, &::GetRTFWriter, 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 )
69 Reader* SwReaderWriterEntry::GetReader()
71 if ( pReader )
72 return pReader;
73 else if ( fnGetReader )
75 pReader = (*fnGetReader)();
76 return pReader;
78 return nullptr;
81 void SwReaderWriterEntry::GetWriter( std::u16string_view rNm, const OUString& rBaseURL, WriterRef& xWrt ) const
83 if ( fnGetWriter )
84 (*fnGetWriter)( rNm, rBaseURL, xWrt );
85 else
86 xWrt = WriterRef(nullptr);
89 Reader* SwGetReaderXML() // SW_DLLPUBLIC
91 return ReadXML;
94 static void SetFltPtr( sal_uInt16 rPos, Reader* pReader )
96 aReaderWriter[ rPos ].pReader = pReader;
99 namespace sw {
101 Filters::Filters()
103 ReadAscii = new AsciiReader;
104 ReadHTML = new HTMLReader;
105 ReadXML = new XMLReader;
106 SetFltPtr( READER_WRITER_BAS, ReadAscii );
107 SetFltPtr( READER_WRITER_HTML, ReadHTML );
108 SetFltPtr( READER_WRITER_XML, ReadXML );
109 SetFltPtr( READER_WRITER_TEXT_DLG, ReadAscii );
110 SetFltPtr( READER_WRITER_TEXT, ReadAscii );
113 Filters::~Filters()
115 // kill Readers
116 for(SwReaderWriterEntry & rEntry : aReaderWriter)
118 if( rEntry.bDelReader && rEntry.pReader )
120 delete rEntry.pReader;
121 rEntry.pReader = nullptr;
124 msword_.release();
127 #ifndef DISABLE_DYNLOADING
129 oslGenericFunction Filters::GetMswordLibSymbol( const char *pSymbol )
131 if (!msword_.is())
133 OUString url("$LO_LIB_DIR/" SVLIBRARY("msword"));
134 rtl::Bootstrap::expandMacros(url);
135 bool ok = msword_.load( url, SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY );
136 SAL_WARN_IF(!ok, "sw", "failed to load msword library");
138 if (msword_.is())
139 return msword_.getFunctionSymbol( OUString::createFromAscii( pSymbol ) );
140 return nullptr;
143 #endif
147 namespace SwReaderWriter {
149 Reader* GetRtfReader()
151 return aReaderWriter[READER_WRITER_RTF].GetReader();
154 Reader* GetDOCXReader()
156 return aReaderWriter[READER_WRITER_DOCX].GetReader();
159 void GetWriter( std::u16string_view rFltName, const OUString& rBaseURL, WriterRef& xRet )
161 for( int n = 0; n < MAXFILTER; ++n )
162 if ( aFilterDetect[n].IsFilter( rFltName ) )
164 aReaderWriter[n].GetWriter( rFltName, rBaseURL, xRet );
165 break;
169 Reader* GetReader( const OUString& rFltName )
171 Reader* pRead = nullptr;
172 for( int n = 0; n < MAXFILTER; ++n )
174 if ( aFilterDetect[n].IsFilter( rFltName ) )
176 pRead = aReaderWriter[n].GetReader();
177 // add special treatment for some readers
178 if ( pRead )
179 pRead->SetFltName( rFltName );
180 break;
183 return pRead;
186 } // namespace SwReaderWriter
188 bool Writer::IsStgWriter() const { return false; }
190 bool StgWriter::IsStgWriter() const { return true; }
192 // Read Filter Flags; used by WW8 / W4W / EXCEL / LOTUS
195 <FilterFlags>
196 <WinWord>
197 <WW1F cfg:type="long">0</WW1F>
198 <WW cfg:type="long">0</WW>
199 <WW8 cfg:type="long">0</WW8>
200 <WWF cfg:type="long">0</WWF>
201 <WWFA0 cfg:type="long">0</WWFA0>
202 <WWFA1 cfg:type="long">0</WWFA1>
203 <WWFA2 cfg:type="long">0</WWFA2>
204 <WWFB0 cfg:type="long">0</WWFB0>
205 <WWFB1 cfg:type="long">0</WWFB1>
206 <WWFB2 cfg:type="long">0</WWFB2>
207 <WWFLX cfg:type="long">0</WWFLX>
208 <WWFLY cfg:type="long">0</WWFLY>
209 <WWFT cfg:type="long">0</WWFT>
210 <WWWR cfg:type="long">0</WWWR>
211 </WinWord>
212 </FilterFlags>
215 SwFilterOptions::SwFilterOptions( sal_uInt16 nCnt, const char** ppNames,
216 sal_uInt64* pValues )
217 : ConfigItem( "Office.Writer/FilterFlags" )
219 GetValues( nCnt, ppNames, pValues );
222 void SwFilterOptions::GetValues( sal_uInt16 nCnt, const char** ppNames,
223 sal_uInt64* pValues )
225 Sequence<OUString> aNames( nCnt );
226 OUString* pNames = aNames.getArray();
227 sal_uInt16 n;
229 for( n = 0; n < nCnt; ++n )
230 pNames[ n ] = OUString::createFromAscii( ppNames[ n ] );
231 Sequence<Any> aValues = GetProperties( aNames );
233 if( nCnt == aValues.getLength() )
235 const Any* pAnyValues = aValues.getConstArray();
236 for( n = 0; n < nCnt; ++n )
237 pValues[ n ] = pAnyValues[ n ].hasValue()
238 ? *o3tl::doAccess<sal_uInt64>(pAnyValues[ n ])
239 : 0;
241 else
243 for( n = 0; n < nCnt; ++n )
244 pValues[ n ] = 0;
248 void SwFilterOptions::ImplCommit() {}
249 void SwFilterOptions::Notify( const css::uno::Sequence< OUString >& ) {}
251 void StgReader::SetFltName( const OUString& rFltNm )
253 if( SwReaderType::Storage & GetReaderType() )
254 m_aFltName = rFltNm;
257 void CalculateFlySize(SfxItemSet& rFlySet, const SwNode& rAnchor,
258 SwTwips nPageWidth)
260 const SwFormatFrameSize* pFrameSizeItem = rFlySet.GetItemIfSet( RES_FRM_SIZE );
261 if( !pFrameSizeItem || MINFLY > pFrameSizeItem->GetWidth() )
263 std::unique_ptr<SwFormatFrameSize> aSz(rFlySet.Get(RES_FRM_SIZE).Clone());
264 if (pFrameSizeItem)
265 aSz.reset(pFrameSizeItem->Clone());
267 SwTwips nWidth;
268 // determine the width; if there is a table use the width of the table;
269 // otherwise use the width of the page
270 const SwTableNode* pTableNd = rAnchor.FindTableNode();
271 if( pTableNd )
272 nWidth = pTableNd->GetTable().GetFrameFormat()->GetFrameSize().GetWidth();
273 else
274 nWidth = nPageWidth;
276 const SwNodeIndex* pSttNd = rFlySet.Get( RES_CNTNT ).GetContentIdx();
277 if( pSttNd )
279 bool bOnlyOneNode = true;
280 sal_uLong nMinFrame = 0;
281 sal_uLong nMaxFrame = 0;
282 SwTextNode* pFirstTextNd = nullptr;
283 SwNodeIndex aIdx( *pSttNd, 1 );
284 SwNodeIndex aEnd( *pSttNd->GetNode().EndOfSectionNode() );
285 while( aIdx < aEnd )
287 SwTextNode *pTextNd = aIdx.GetNode().GetTextNode();
288 if( pTextNd )
290 if( !pFirstTextNd )
291 pFirstTextNd = pTextNd;
292 else if( pFirstTextNd != pTextNd )
294 // forget it
295 bOnlyOneNode = false;
296 break;
299 sal_uLong nAbsMinCnts;
300 pTextNd->GetMinMaxSize( aIdx.GetIndex(), nMinFrame, nMaxFrame, nAbsMinCnts );
302 ++aIdx;
305 if( bOnlyOneNode )
307 if( nMinFrame < MINLAY && pFirstTextNd )
309 // if the first node don't contained any content, then
310 // insert one char in it calc again and delete once again
311 SwContentIndex aNdIdx( pFirstTextNd );
312 pFirstTextNd->InsertText("MM", aNdIdx);
313 sal_uLong nAbsMinCnts;
314 pFirstTextNd->GetMinMaxSize( pFirstTextNd->GetIndex(),
315 nMinFrame, nMaxFrame, nAbsMinCnts );
316 aNdIdx -= 2;
317 pFirstTextNd->EraseText( aNdIdx, 2 );
320 // consider border and distance to content
321 const SvxBoxItem& rBoxItem = rFlySet.Get( RES_BOX );
322 SvxBoxItemLine nLine = SvxBoxItemLine::LEFT;
323 for( int i = 0; i < 2; ++i )
325 const editeng::SvxBorderLine* pLn = rBoxItem.GetLine( nLine );
326 if( pLn )
328 sal_uInt16 nWidthTmp = pLn->GetOutWidth() + pLn->GetInWidth();
329 nWidthTmp = nWidthTmp + rBoxItem.GetDistance( nLine );
330 nMinFrame += nWidthTmp;
331 nMaxFrame += nWidthTmp;
333 nLine = SvxBoxItemLine::RIGHT;
336 // enforce minimum width for contents
337 if( nMinFrame < MINLAY )
338 nMinFrame = MINLAY;
339 if( nMaxFrame < MINLAY )
340 nMaxFrame = MINLAY;
342 if( nWidth > o3tl::narrowing<sal_uInt16>(nMaxFrame) )
343 nWidth = nMaxFrame;
344 else if( nWidth > o3tl::narrowing<sal_uInt16>(nMinFrame) )
345 nWidth = nMinFrame;
349 if( MINFLY > nWidth )
350 nWidth = MINFLY;
352 aSz->SetWidth( nWidth );
353 if( MINFLY > aSz->GetHeight() )
354 aSz->SetHeight( MINFLY );
355 rFlySet.Put( std::move(aSz) );
357 else if( MINFLY > pFrameSizeItem->GetHeight() )
359 std::unique_ptr<SwFormatFrameSize> aSz(pFrameSizeItem->Clone());
360 aSz->SetHeight( MINFLY );
361 rFlySet.Put( std::move(aSz) );
365 namespace
368 struct CharSetNameMap
370 rtl_TextEncoding eCode;
371 const char* pName;
374 const CharSetNameMap *GetCharSetNameMap()
376 static const CharSetNameMap aMapArr[] =
378 # define IMPLENTRY(X) { RTL_TEXTENCODING_##X, #X }
379 IMPLENTRY(DONTKNOW),
380 IMPLENTRY(MS_1252),
381 IMPLENTRY(APPLE_ROMAN),
382 IMPLENTRY(IBM_437),
383 IMPLENTRY(IBM_850),
384 IMPLENTRY(IBM_860),
385 IMPLENTRY(IBM_861),
386 IMPLENTRY(IBM_863),
387 IMPLENTRY(IBM_865),
388 IMPLENTRY(SYMBOL),
389 IMPLENTRY(ASCII_US),
390 IMPLENTRY(ISO_8859_1),
391 IMPLENTRY(ISO_8859_2),
392 IMPLENTRY(ISO_8859_3),
393 IMPLENTRY(ISO_8859_4),
394 IMPLENTRY(ISO_8859_5),
395 IMPLENTRY(ISO_8859_6),
396 IMPLENTRY(ISO_8859_7),
397 IMPLENTRY(ISO_8859_8),
398 IMPLENTRY(ISO_8859_9),
399 IMPLENTRY(ISO_8859_14),
400 IMPLENTRY(ISO_8859_15),
401 IMPLENTRY(IBM_737),
402 IMPLENTRY(IBM_775),
403 IMPLENTRY(IBM_852),
404 IMPLENTRY(IBM_855),
405 IMPLENTRY(IBM_857),
406 IMPLENTRY(IBM_862),
407 IMPLENTRY(IBM_864),
408 IMPLENTRY(IBM_866),
409 IMPLENTRY(IBM_869),
410 IMPLENTRY(MS_874),
411 IMPLENTRY(MS_1250),
412 IMPLENTRY(MS_1251),
413 IMPLENTRY(MS_1253),
414 IMPLENTRY(MS_1254),
415 IMPLENTRY(MS_1255),
416 IMPLENTRY(MS_1256),
417 IMPLENTRY(MS_1257),
418 IMPLENTRY(MS_1258),
419 IMPLENTRY(APPLE_ARABIC),
420 IMPLENTRY(APPLE_CENTEURO),
421 IMPLENTRY(APPLE_CROATIAN),
422 IMPLENTRY(APPLE_CYRILLIC),
423 IMPLENTRY(APPLE_DEVANAGARI),
424 IMPLENTRY(APPLE_FARSI),
425 IMPLENTRY(APPLE_GREEK),
426 IMPLENTRY(APPLE_GUJARATI),
427 IMPLENTRY(APPLE_GURMUKHI),
428 IMPLENTRY(APPLE_HEBREW),
429 IMPLENTRY(APPLE_ICELAND),
430 IMPLENTRY(APPLE_ROMANIAN),
431 IMPLENTRY(APPLE_THAI),
432 IMPLENTRY(APPLE_TURKISH),
433 IMPLENTRY(APPLE_UKRAINIAN),
434 IMPLENTRY(APPLE_CHINSIMP),
435 IMPLENTRY(APPLE_CHINTRAD),
436 IMPLENTRY(APPLE_JAPANESE),
437 IMPLENTRY(APPLE_KOREAN),
438 IMPLENTRY(MS_932),
439 IMPLENTRY(MS_936),
440 IMPLENTRY(MS_949),
441 IMPLENTRY(MS_950),
442 IMPLENTRY(SHIFT_JIS),
443 IMPLENTRY(GB_2312),
444 IMPLENTRY(GBT_12345),
445 IMPLENTRY(GBK),
446 IMPLENTRY(BIG5),
447 IMPLENTRY(EUC_JP),
448 IMPLENTRY(EUC_CN),
449 IMPLENTRY(EUC_TW),
450 IMPLENTRY(ISO_2022_JP),
451 IMPLENTRY(ISO_2022_CN),
452 IMPLENTRY(KOI8_R),
453 IMPLENTRY(KOI8_U),
454 IMPLENTRY(UTF7),
455 IMPLENTRY(UTF8),
456 IMPLENTRY(ISO_8859_10),
457 IMPLENTRY(ISO_8859_13),
458 IMPLENTRY(EUC_KR),
459 IMPLENTRY(ISO_2022_KR),
460 IMPLENTRY(JIS_X_0201),
461 IMPLENTRY(JIS_X_0208),
462 IMPLENTRY(JIS_X_0212),
463 IMPLENTRY(MS_1361),
464 IMPLENTRY(GB_18030),
465 IMPLENTRY(BIG5_HKSCS),
466 IMPLENTRY(TIS_620),
467 IMPLENTRY(PT154),
468 IMPLENTRY(UCS4),
469 IMPLENTRY(UCS2),
470 IMPLENTRY(UNICODE),
471 {0,nullptr} //Last
473 return &aMapArr[0];
477 Get a rtl_TextEncoding from its name
479 rtl_TextEncoding CharSetFromName(std::u16string_view rChrSetStr)
481 const CharSetNameMap *pStart = GetCharSetNameMap();
482 rtl_TextEncoding nRet = pStart->eCode;
484 for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
486 if(o3tl::equalsIgnoreAsciiCase(rChrSetStr, pMap->pName))
488 nRet = pMap->eCode;
489 break;
493 OSL_ENSURE(nRet != pStart->eCode, "TXT: That was an unknown language!");
495 return nRet;
499 Get the String name of an rtl_TextEncoding
501 OUString NameFromCharSet(rtl_TextEncoding nChrSet)
503 const CharSetNameMap *pStart = GetCharSetNameMap();
504 const char *pRet = pStart->pName;
506 for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
508 if (nChrSet == pMap->eCode)
510 pRet = pMap->pName;
511 break;
515 OSL_ENSURE(pRet != pStart->pName, "TXT: That was an unknown language!");
517 return OUString::createFromAscii(pRet);
522 // for the automatic conversion (mail/news/...)
523 // The user data contains the options for the ascii import/export filter.
524 // The format is:
525 // 1. CharSet - as ascii chars
526 // 2. LineEnd - as CR/LF/CRLF
527 // 3. Fontname
528 // 4. Language
529 // 5. Whether to include byte-order-mark - as true/false
530 // 6. Whether to include hidden paragraphs and text - as true/false
531 // the delimiter character is ","
533 void SwAsciiOptions::ReadUserData( std::u16string_view rStr )
535 sal_Int32 nToken = 0;
536 std::u16string_view sToken = o3tl::getToken(rStr, 0, ',', nToken); // 1. Charset name
537 if (!sToken.empty())
538 m_eCharSet = CharSetFromName(sToken);
539 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 2. Line ending type
541 if (o3tl::equalsIgnoreAsciiCase(sToken, u"CRLF"))
542 m_eCRLF_Flag = LINEEND_CRLF;
543 else if (o3tl::equalsIgnoreAsciiCase(sToken, u"LF"))
544 m_eCRLF_Flag = LINEEND_LF;
545 else
546 m_eCRLF_Flag = LINEEND_CR;
548 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 3. Font name
549 m_sFont = sToken;
550 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 4. Language tag
551 m_nLanguage = LanguageTag::convertToLanguageTypeWithFallback(OUString(sToken));
552 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty()) // 5. Include BOM?
553 m_bIncludeBOM = !(o3tl::equalsIgnoreAsciiCase(sToken, u"FALSE"));
554 // 6. Include hidden text
555 if (nToken >= 0 && !(sToken = o3tl::getToken(rStr, 0, ',', nToken)).empty())
556 m_bIncludeHidden = !(o3tl::equalsIgnoreAsciiCase(sToken, u"FALSE"));
559 void SwAsciiOptions::WriteUserData(OUString& rStr) const
561 // 1. charset
562 rStr = NameFromCharSet(m_eCharSet) + ",";
564 // 2. LineEnd
565 switch(m_eCRLF_Flag)
567 case LINEEND_CRLF:
568 rStr += "CRLF";
569 break;
570 case LINEEND_CR:
571 rStr += "CR";
572 break;
573 case LINEEND_LF:
574 rStr += "LF";
575 break;
577 rStr += ",";
579 // 3. Fontname
580 rStr += m_sFont + ",";
582 // 4. Language
583 if (m_nLanguage)
585 rStr += LanguageTag::convertToBcp47(m_nLanguage);
587 rStr += ",";
589 // 5. Whether to include byte-order-mark
590 if(m_bIncludeBOM)
592 rStr += "true";
594 else
596 rStr += "false";
598 rStr += ",";
600 // 6. Whether to include hidden paragraphs and text
601 if(m_bIncludeHidden)
603 rStr += "true";
605 else
607 rStr += "false";
609 rStr += ",";
612 #ifdef DISABLE_DYNLOADING
614 extern "C" {
615 Reader *ImportRTF();
616 void ExportRTF( std::u16string_view, const OUString& rBaseURL, WriterRef& );
617 Reader *ImportDOC();
618 void ExportDOC( std::u16string_view, const OUString& rBaseURL, WriterRef& );
619 Reader *ImportDOCX();
620 sal_uInt32 SaveOrDelMSVBAStorage_ww8( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& );
621 sal_uInt32 GetSaveWarningOfMSVBAStorage_ww8( SfxObjectShell& );
624 #endif
626 Reader* GetRTFReader()
628 #ifndef DISABLE_DYNLOADING
630 FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportRTF" ) );
632 if ( pFunction )
633 return (*pFunction)();
635 return nullptr;
636 #else
637 return ImportRTF();
638 #endif
642 void GetRTFWriter( std::u16string_view rFltName, const OUString& rBaseURL, WriterRef& xRet )
644 #ifndef DISABLE_DYNLOADING
645 FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportRTF" ) );
647 if ( pFunction )
648 (*pFunction)( rFltName, rBaseURL, xRet );
649 else
650 xRet = WriterRef(nullptr);
651 #else
652 ExportRTF( rFltName, rBaseURL, xRet );
653 #endif
656 Reader* GetWW8Reader()
658 #ifndef DISABLE_DYNLOADING
659 FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOC" ) );
661 if ( pFunction )
662 return (*pFunction)();
664 return nullptr;
665 #else
666 return ImportDOC();
667 #endif
670 void GetWW8Writer( std::u16string_view rFltName, const OUString& rBaseURL, WriterRef& xRet )
672 #ifndef DISABLE_DYNLOADING
673 FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportDOC" ) );
675 if ( pFunction )
676 (*pFunction)( rFltName, rBaseURL, xRet );
677 else
678 xRet = WriterRef(nullptr);
679 #else
680 ExportDOC( rFltName, rBaseURL, xRet );
681 #endif
684 Reader* GetDOCXReader()
686 #ifndef DISABLE_DYNLOADING
687 FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOCX" ) );
689 if ( pFunction )
690 return (*pFunction)();
692 return nullptr;
693 #else
694 return ImportDOCX();
695 #endif
698 typedef sal_uInt32 ( *SaveOrDel )( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& );
699 typedef sal_uInt32 ( *GetSaveWarning )( SfxObjectShell& );
701 ErrCode SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, bool bSaveInto, const OUString& rStorageName )
703 #ifndef DISABLE_DYNLOADING
704 SaveOrDel pFunction = reinterpret_cast<SaveOrDel>( SwGlobals::getFilters().GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) );
705 if( pFunction )
706 return ErrCode(pFunction( rDoc, rStor, bSaveInto, rStorageName ));
707 return ERRCODE_NONE;
708 #else
709 return ErrCode(SaveOrDelMSVBAStorage_ww8( rDoc, rStor, bSaveInto, rStorageName ));
710 #endif
713 ErrCode GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS )
715 #ifndef DISABLE_DYNLOADING
716 GetSaveWarning pFunction = reinterpret_cast<GetSaveWarning>( SwGlobals::getFilters().GetMswordLibSymbol( "GetSaveWarningOfMSVBAStorage_ww8" ) );
717 if( pFunction )
718 return ErrCode(pFunction( rDocS ));
719 return ERRCODE_NONE;
720 #else
721 return ErrCode(GetSaveWarningOfMSVBAStorage_ww8( rDocS ));
722 #endif
725 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */