Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/inc/shellio.hxx
Line
Count
Source
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
#ifndef INCLUDED_SW_INC_SHELLIO_HXX
20
#define INCLUDED_SW_INC_SHELLIO_HXX
21
22
#include <memory>
23
24
#include <com/sun/star/uno/Reference.h>
25
#include <sot/storage.hxx>
26
#include <tools/date.hxx>
27
#include <tools/time.hxx>
28
#include <tools/datetime.hxx>
29
#include <tools/ref.hxx>
30
#include <rtl/ref.hxx>
31
#include <osl/thread.h>
32
#include <o3tl/deleter.hxx>
33
#include <o3tl/typed_flags_set.hxx>
34
#include "swdllapi.h"
35
#include "docfac.hxx"
36
#include "unocrsr.hxx"
37
#include "unotextrange.hxx"
38
39
class SfxItemPool;
40
class SfxItemSet;
41
class SfxMedium;
42
class SvStream;
43
class SvxFontItem;
44
class SvxMacroTableDtor;
45
class SwContentNode;
46
class SwCursorShell;
47
class SwDoc;
48
class SwPaM;
49
class SwTextBlocks;
50
struct SwPosition;
51
struct Writer_Impl;
52
namespace sw::mark { class MarkBase; }
53
namespace com::sun::star::embed { class XStorage; }
54
55
// Defines the count of chars at which a paragraph read via ASCII/W4W-Reader
56
// is forced to wrap. It has to be always greater than 200!!!
57
// Note: since version 4.3, maximum character count changed to 4 GiB from 64 KiB
58
// in a paragraph, but because of the other limitations, we set a lower wrap value
59
// to get a working text editor e.g. without freezing and crash during loading of
60
// a 50 MB text line, or unusably slow editing of a 5 MB text line.
61
0
#define MAX_ASCII_PARA 250000
62
63
class SW_DLLPUBLIC SwAsciiOptions
64
{
65
    OUString m_sFont;
66
    rtl_TextEncoding m_eCharSet;
67
    LanguageType m_nLanguage;
68
    LineEnd m_eCRLF_Flag;
69
    bool m_bIncludeBOM;   // Whether to include a byte-order-mark in the output.
70
    bool m_bIncludeHidden; // Whether to include hidden paragraphs and text.
71
72
public:
73
74
0
    const OUString& GetFontName() const { return m_sFont; }
75
0
    void SetFontName( const OUString& rFont ) { m_sFont = rFont; }
76
77
75.0k
    rtl_TextEncoding GetCharSet() const { return m_eCharSet; }
78
31.7k
    void SetCharSet( rtl_TextEncoding nVal ) { m_eCharSet = nVal; }
79
80
0
    LanguageType GetLanguage() const { return m_nLanguage; }
81
0
    void SetLanguage( LanguageType nVal ) { m_nLanguage = nVal; }
82
83
31.7k
    LineEnd GetParaFlags() const { return m_eCRLF_Flag; }
84
0
    void SetParaFlags( LineEnd eVal ) { m_eCRLF_Flag = eVal; }
85
86
31.7k
    bool GetIncludeBOM() const { return m_bIncludeBOM; }
87
0
    void SetIncludeBOM( bool bVal ) { m_bIncludeBOM = bVal; }
88
89
31.7k
    bool GetIncludeHidden() const { return m_bIncludeHidden; }
90
91
    void Reset();
92
93
    // for the automatic conversion (mail/news/...)
94
    void ReadUserData( std::u16string_view );
95
    void WriteUserData( OUString& ) const;
96
97
98.2k
    SwAsciiOptions() { Reset(); }
98
};
99
100
// Base class of possible options for a special reader.
101
class Reader;
102
103
class SwgReaderOption
104
{
105
    SwAsciiOptions m_aASCIIOpts;
106
    bool m_bFrameFormats;
107
    bool m_bPageDescs;
108
    bool m_bTextFormats;
109
    bool m_bNumRules;
110
    bool m_bMerge;
111
    css::uno::Reference<css::io::XInputStream> m_xInputStream;
112
public:
113
34.7k
    void ResetAllFormatsOnly() { m_bFrameFormats = m_bPageDescs = m_bTextFormats = m_bNumRules = m_bMerge = false; }
114
0
    bool IsFormatsOnly() const { return m_bFrameFormats || m_bPageDescs || m_bTextFormats || m_bNumRules || m_bMerge; }
115
116
0
    bool IsFrameFormats() const { return m_bFrameFormats; }
117
0
    void SetFrameFormats( const bool bNew) { m_bFrameFormats = bNew; }
118
119
0
    bool IsPageDescs() const { return m_bPageDescs; }
120
0
    void SetPageDescs( const bool bNew) { m_bPageDescs = bNew; }
121
122
0
    bool IsTextFormats() const { return m_bTextFormats; }
123
0
    void SetTextFormats( const bool bNew) { m_bTextFormats = bNew; }
124
125
0
    bool IsNumRules() const { return m_bNumRules; }
126
0
    void SetNumRules( const bool bNew) { m_bNumRules = bNew; }
127
128
0
    bool IsMerge() const { return m_bMerge; }
129
0
    void SetMerge( const bool bNew ) { m_bMerge = bNew; }
130
131
0
    const SwAsciiOptions& GetASCIIOpts() const { return m_aASCIIOpts; }
132
0
    void SetASCIIOpts( const SwAsciiOptions& rOpts ) { m_aASCIIOpts = rOpts; }
133
0
    void ResetASCIIOpts() { m_aASCIIOpts.Reset(); }
134
135
0
    css::uno::Reference<css::io::XInputStream>& GetInputStream() { return m_xInputStream; }
136
    void SetInputStream(const css::uno::Reference<css::io::XInputStream>& xInputStream)
137
0
    {
138
0
        m_xInputStream = xInputStream;
139
0
    }
140
141
    SwgReaderOption()
142
34.7k
        { ResetAllFormatsOnly(); m_aASCIIOpts.Reset(); }
143
};
144
145
// Calls reader with its options, document, cursor etc.
146
class SW_DLLPUBLIC SwReader: public SwDocFac
147
{
148
    SvStream* mpStrm;
149
    rtl::Reference<SotStorage> mpStg;
150
    css::uno::Reference < css::embed::XStorage > mxStg;
151
    SfxMedium* mpMedium;     // Who wants to obtain a Medium (W4W).
152
153
    SwPaM* mpCursor;
154
    OUString maFileName;
155
    OUString msBaseURL;
156
    bool mbSkipImages;
157
    bool mbSkipInvalidateNumRules = false;
158
    bool mbIsInPaste = false;
159
160
public:
161
162
    // Initial reading. Document is created only at Read(...)
163
    // or in case it is given, into that.
164
    // Special case for Load with Sw3Reader.
165
    SwReader( SfxMedium&, OUString aFilename, SwDoc *pDoc = nullptr );
166
167
    // Read into existing document.
168
    // Document and position in document are taken from SwPaM.
169
    SwReader( SvStream&, OUString aFilename, const OUString& rBaseURL, SwPaM& );
170
    SwReader( SfxMedium&, OUString aFilename, SwPaM& );
171
    SwReader( css::uno::Reference < css::embed::XStorage > , OUString aFilename, SwPaM& );
172
173
    // The only export interface is SwReader::Read(...)!!!
174
    ErrCodeMsg Read( const Reader& );
175
176
    // Ask for glossaries.
177
    bool HasGlossaries( const Reader& );
178
    bool ReadGlossaries( const Reader&, SwTextBlocks&, bool bSaveRelFiles );
179
180
    void SetSkipInvalidateNumRules(bool bSkipInvalidateNumRules)
181
0
    {
182
0
        mbSkipInvalidateNumRules = bSkipInvalidateNumRules;
183
0
    }
184
0
    void SetInPaste(bool val) { mbIsInPaste = val; }
185
0
    bool IsInPaste() const { return mbIsInPaste; }
186
187
protected:
188
0
    void                SetBaseURL( const OUString& rURL ) { msBaseURL = rURL; }
189
0
    void                SetSkipImages( bool bSkipImages ) { mbSkipImages = bSkipImages; }
190
};
191
192
typedef std::unique_ptr<SwReader, o3tl::default_delete<SwReader>> SwReaderPtr;
193
194
// Special Readers can be both!! (Excel, W4W, .. ).
195
enum class SwReaderType {
196
    NONE = 0x00,
197
    Stream = 0x01,
198
    Storage = 0x02
199
};
200
namespace o3tl {
201
    template<> struct typed_flags<SwReaderType> : is_typed_flags<SwReaderType, 0x03> {};
202
};
203
204
extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportDOC(SvStream &rStream, const OUString &rFltName);
205
extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportDOCX(SvStream &rStream);
206
extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportRTF(SvStream &rStream);
207
extern "C" SAL_DLLPUBLIC_EXPORT bool TestPDFExportRTF(SvStream &rStream);
208
extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportHTML(SvStream &rStream);
209
210
/// Stores information about an import into an existing, non-empty document model.
211
struct SW_DLLPUBLIC SwPasteInfo
212
{
213
    SwDoc& m_rDoc;
214
    SwPaM& m_rPam;
215
    rtl::Reference<SwXTextRange> m_xInsertPosition;
216
    std::shared_ptr<SwNodeIndex> m_pSttNdIdx;
217
    std::shared_ptr<SwNodeIndex> m_pSttNdIdx2;
218
    /// If the insert position is at the paragraph end.
219
    bool m_bStartAtEndOfPara = false;
220
221
    SwPasteInfo(SwDoc& rDoc, SwPaM& rPam);
222
};
223
224
class SW_DLLPUBLIC Reader
225
{
226
    friend class SwReader;
227
    friend bool TestImportDOC(SvStream &rStream, const OUString &rFltName);
228
    friend bool TestImportHTML(SvStream &rStream);
229
    rtl::Reference<SwDoc> mxTemplate;
230
    OUString m_aTemplateName;
231
232
    Date m_aDateStamp;
233
    tools::Time m_aTimeStamp;
234
    DateTime m_aCheckDateTime;
235
236
protected:
237
    SvStream* m_pStream;
238
    rtl::Reference<SotStorage> m_pStorage;
239
    css::uno::Reference < css::embed::XStorage > m_xStorage;
240
    SfxMedium* m_pMedium;     // Who wants to obtain a Medium (W4W).
241
242
    SwgReaderOption m_aOption;
243
    bool m_bInsertMode : 1;
244
    bool m_bTemplateBrowseMode : 1;
245
    bool m_bReadUTF8: 1;      // Interpret stream as UTF-8.
246
    bool m_bBlockMode: 1;
247
    bool m_bOrganizerMode : 1;
248
    bool m_bHasAskTemplateName : 1;
249
    bool m_bIgnoreHTMLComments : 1;
250
    bool m_bSkipImages : 1;
251
    bool m_bIsInPaste : 1 = false;
252
253
    virtual OUString GetTemplateName(SwDoc& rDoc) const;
254
255
public:
256
    Reader();
257
    virtual ~Reader();
258
259
    virtual SwReaderType GetReaderType();
260
0
    SwgReaderOption& GetReaderOpt() { return m_aOption; }
261
262
    virtual void SetFltName( const OUString& rFltNm );
263
264
    // Adapt item-set of a Frame-Format to the old format.
265
    static void ResetFrameFormatAttrs( SfxItemSet &rFrameSet );
266
267
    // Adapt Frame-/Graphics-/OLE- styles to the old format
268
    // (without borders etc.).
269
    static void ResetFrameFormats( SwDoc& rDoc );
270
271
    // Load filter template, set it and release it again.
272
    SwDoc* GetTemplateDoc(SwDoc& rDoc);
273
    bool SetTemplate( SwDoc& rDoc );
274
    void ClearTemplate();
275
    void SetTemplateName( const OUString& rDir );
276
    void MakeHTMLDummyTemplateDoc();
277
278
15.3k
    bool IsReadUTF8() const { return m_bReadUTF8; }
279
0
    void SetReadUTF8( bool bSet ) { m_bReadUTF8 = bSet; }
280
281
0
    bool IsBlockMode() const { return m_bBlockMode; }
282
0
    void SetBlockMode( bool bSet ) { m_bBlockMode = bSet; }
283
284
0
    bool IsOrganizerMode() const { return m_bOrganizerMode; }
285
0
    void SetOrganizerMode( bool bSet ) { m_bOrganizerMode = bSet; }
286
287
0
    void SetIgnoreHTMLComments( bool bSet ) { m_bIgnoreHTMLComments = bSet; }
288
289
0
    bool IsInPaste() const { return m_bIsInPaste; }
290
0
    void SetInPaste(bool bSet) { m_bIsInPaste = bSet; }
291
292
    virtual bool HasGlossaries() const;
293
    virtual bool ReadGlossaries( SwTextBlocks&, bool bSaveRelFiles ) const;
294
295
    // Read the sections of the document, which is equal to the medium.
296
    // Returns the count of it
297
    virtual size_t GetSectionList( SfxMedium& rMedium,
298
                                   std::vector<OUString>& rStrings) const;
299
300
0
    const rtl::Reference<SotStorage>& getSotStorageRef() const { return m_pStorage; };
301
0
    void setSotStorageRef(const rtl::Reference<SotStorage>& pStgRef) { m_pStorage = pStgRef; };
302
303
    static void StartPaste(SwPasteInfo& rPasteInfo);
304
    static void EndPaste(SwPasteInfo& rPasteInfo);
305
306
private:
307
    virtual ErrCodeMsg Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &)=0;
308
309
    // Everyone who does not need the streams / storages open
310
    // has to override the method (W4W!!).
311
    virtual bool SetStrmStgPtr();
312
};
313
314
class AsciiReader final : public Reader
315
{
316
    friend class SwReader;
317
    virtual ErrCodeMsg Read( SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override;
318
public:
319
9
    AsciiReader(): Reader() {}
320
};
321
322
class MarkdownReader final : public Reader
323
{
324
    friend class SwReader;
325
    virtual ErrCodeMsg Read( SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override;
326
327
    /// Parse FilterOptions passed to the importer.
328
    void SetupFilterOptions(SwDoc& rDoc);
329
330
public:
331
9
    MarkdownReader(): Reader() {}
332
};
333
334
class SW_DLLPUBLIC StgReader : public Reader
335
{
336
    OUString m_aFltName;
337
338
public:
339
    virtual SwReaderType GetReaderType() override;
340
17.9k
    const OUString& GetFltName() const { return m_aFltName; }
341
    virtual void SetFltName( const OUString& r ) override;
342
};
343
344
// The given stream has to be created dynamically and must
345
// be requested via Stream() before the instance is deleted!
346
347
class SwImpBlocks;
348
349
/// Used for autotext handling. The list of autotexts get imported to a temporary document, and then
350
/// this class provides the actual glossary document which is the final target for autotext.
351
class SW_DLLPUBLIC SwTextBlocks
352
{
353
    std::unique_ptr<SwImpBlocks> m_pImp;
354
    ErrCode        m_nErr;
355
356
public:
357
    SwTextBlocks( const OUString& );
358
    ~SwTextBlocks();
359
360
    SwDoc* GetDoc();
361
    void   ClearDoc();                  // Delete Doc-contents.
362
    OUString GetName() const;
363
    void   SetName( const OUString& );
364
0
    ErrCode const & GetError() const { return m_nErr; }
365
366
    const OUString & GetBaseURL() const;
367
    void   SetBaseURL( const OUString& rURL );
368
369
    sal_uInt16 GetCount() const;                        // Get count text modules.
370
    sal_uInt16 GetIndex( const OUString& ) const;       // Get index of short names.
371
    sal_uInt16 GetLongIndex( std::u16string_view ) const;   // Get index of long names.
372
    const OUString & GetShortName( sal_uInt16 ) const;          // Get short name for index.
373
    const OUString & GetLongName( sal_uInt16 ) const;           // Get long name for index.
374
375
    bool   Delete( sal_uInt16 );
376
    void   Rename( sal_uInt16, const OUString*, const OUString* );
377
    ErrCode const & CopyBlock( SwTextBlocks const & rSource, OUString& rSrcShort,
378
                                    const OUString& rLong );
379
380
    bool   BeginGetDoc( sal_uInt16 );   // Read text modules.
381
    void   EndGetDoc();                     // Release text modules.
382
383
    bool   BeginPutDoc( const OUString&, const OUString& ); // Begin save.
384
    sal_uInt16 PutDoc();                                    // End save.
385
386
    sal_uInt16 PutText( const OUString&, const OUString&, const OUString& ); // Save (short name, text).
387
388
    bool IsOnlyTextBlock( sal_uInt16 ) const;
389
    bool IsOnlyTextBlock( const OUString& rShort ) const;
390
391
    OUString const & GetFileName() const;           // Filename of pImp.
392
    bool IsReadOnly() const;            // ReadOnly-flag of pImp.
393
394
    bool GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTable );
395
    bool SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTable );
396
397
    bool StartPutMuchBlockEntries();
398
    void EndPutMuchBlockEntries();
399
};
400
401
// BEGIN source/filter/basflt/fltini.cxx
402
403
extern Reader *ReadAscii, *ReadHTML, *ReadXML, *ReadMarkdown;
404
405
SW_DLLPUBLIC Reader* SwGetReaderXML();
406
407
// END source/filter/basflt/fltini.cxx
408
409
extern bool SetHTMLTemplate( SwDoc &rDoc ); //For templates from HTML before loading shellio.cxx.
410
411
// Base-class of all writers.
412
413
class IDocumentSettingAccess;
414
class IDocumentStylePoolAccess;
415
416
class SW_DLLPUBLIC Writer
417
    : public SvRefBase
418
{
419
    SwAsciiOptions m_aAsciiOptions;
420
    OUString       m_sBaseURL;
421
422
    void AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont );
423
    void AddFontItems_( SfxItemPool& rPool, TypedWhichId<SvxFontItem> nWhichId );
424
425
    std::unique_ptr<Writer_Impl> m_pImpl;
426
427
    Writer(Writer const&) = delete;
428
    Writer& operator=(Writer const&) = delete;
429
430
protected:
431
432
    const OUString* m_pOrigFileName;
433
434
    void ResetWriter();
435
    bool CopyNextPam( SwPaM ** );
436
437
    void PutNumFormatFontsInAttrPool();
438
    void PutEditEngFontsInAttrPool();
439
440
    virtual ErrCode WriteStream() = 0;
441
0
    void                SetBaseURL( const OUString& rURL ) { m_sBaseURL = rURL; }
442
443
    IDocumentSettingAccess& getIDocumentSettingAccess();
444
    const IDocumentSettingAccess& getIDocumentSettingAccess() const;
445
446
    IDocumentStylePoolAccess& getIDocumentStylePoolAccess();
447
    const IDocumentStylePoolAccess& getIDocumentStylePoolAccess() const;
448
449
public:
450
    SwDoc* m_pDoc;
451
    SwPaM* m_pOrigPam;            // Last Pam that has to be processed.
452
    std::shared_ptr<SwUnoCursor> m_pCurrentPam;
453
    bool m_bWriteAll : 1;
454
    bool m_bShowProgress : 1;
455
    bool m_bWriteClipboardDoc : 1;
456
    bool m_bWriteOnlyFirstTable : 1;
457
    bool m_bASCII_ParaAsCR : 1;
458
    bool m_bASCII_ParaAsBlank : 1;
459
    bool m_bASCII_NoLastLineEnd : 1;
460
    bool m_bUCS2_WithStartChar : 1;
461
    bool m_bExportParagraphNumbering : 1;
462
463
    bool m_bBlock : 1;
464
    bool m_bOrganizerMode : 1;
465
    bool m_bHideDeleteRedlines : 1;
466
467
    Writer();
468
    virtual ~Writer() override;
469
470
    virtual ErrCodeMsg Write( SwPaM&, SfxMedium&, const OUString* );
471
            ErrCodeMsg Write( SwPaM&, SvStream&,  const OUString* );
472
    virtual ErrCodeMsg Write( SwPaM&, const css::uno::Reference < css::embed::XStorage >&, const OUString*, SfxMedium* = nullptr );
473
    virtual ErrCodeMsg Write( SwPaM&, SotStorage&, const OUString* );
474
475
    virtual void SetupFilterOptions(SfxMedium& rMedium);
476
477
    virtual bool IsStgWriter() const;
478
479
0
    void SetShowProgress( bool bFlag )  { m_bShowProgress = bFlag; }
480
481
0
    const OUString* GetOrigFileName() const       { return m_pOrigFileName; }
482
483
233k
    const SwAsciiOptions& GetAsciiOptions() const { return m_aAsciiOptions; }
484
63.5k
    void SetAsciiOptions( const SwAsciiOptions& rOpt ) { m_aAsciiOptions = rOpt; }
485
486
0
    const OUString& GetBaseURL() const { return m_sBaseURL;}
487
488
    // Look up next bookmark position from bookmark-table.
489
    sal_Int32 FindPos_Bkmk( const SwPosition& rPos ) const;
490
    // Build a bookmark table, which is sort by the node position. The
491
    // OtherPos of the bookmarks also inserted.
492
    void CreateBookmarkTable();
493
    // Search all Bookmarks in the range and return it in the Array.
494
    bool GetBookmarks( const SwContentNode& rNd,
495
                        sal_Int32 nStt, sal_Int32 nEnd,
496
                        std::vector< const ::sw::mark::MarkBase* >& rArr );
497
498
    // Create new PaM at position.
499
    static std::shared_ptr<SwUnoCursor> NewUnoCursor(SwDoc & rDoc,
500
                            SwNodeOffset const nStartIdx, SwNodeOffset const nEndIdx);
501
502
    // If applicable copy a local file into internet.
503
    bool CopyLocalFileToINet( OUString& rFileNm );
504
505
    // Stream-specific routines. Do not use in storage-writer!
506
507
    void SetStream(SvStream *const pStream);
508
    SvStream& Strm();
509
510
0
    void SetOrganizerMode( bool bSet ) { m_bOrganizerMode = bSet; }
511
};
512
513
typedef tools::SvRef<Writer> WriterRef;
514
515
// Base class for all storage writers.
516
class SW_DLLPUBLIC StgWriter : public Writer
517
{
518
protected:
519
    rtl::Reference<SotStorage> m_pStg;
520
    css::uno::Reference < css::embed::XStorage > m_xStg;
521
522
    // Create error at call.
523
    virtual ErrCode WriteStream() override;
524
    virtual ErrCodeMsg WriteStorage() = 0;
525
    virtual ErrCodeMsg WriteMedium( SfxMedium& ) = 0;
526
527
    using Writer::Write;
528
529
public:
530
0
    StgWriter() : Writer() {}
531
532
    virtual bool IsStgWriter() const override;
533
534
    virtual ErrCodeMsg Write( SwPaM&, const css::uno::Reference < css::embed::XStorage >&, const OUString*, SfxMedium* = nullptr ) override;
535
    virtual ErrCodeMsg Write( SwPaM&, SotStorage&, const OUString* ) override;
536
537
0
    SotStorage& GetStorage() const       { return *m_pStg; }
538
};
539
540
// Interface class for general access on special writers.
541
542
class SW_DLLPUBLIC SwWriter
543
{
544
    SvStream* m_pStrm;
545
    css::uno::Reference < css::embed::XStorage > m_xStg;
546
    SfxMedium* m_pMedium;
547
548
    SwPaM* m_pOutPam;
549
    SwCursorShell *m_pShell;
550
    SwDoc &m_rDoc;
551
552
    bool m_bWriteAll;
553
554
public:
555
    ErrCodeMsg Write( WriterRef const & rxWriter, const OUString* = nullptr);
556
557
    SwWriter( SvStream&, SwCursorShell &, bool bWriteAll = false );
558
    SwWriter( SvStream&, SwDoc & );
559
    SwWriter( SvStream&, SwPaM &, bool bWriteAll = false );
560
561
    SwWriter( css::uno::Reference < css::embed::XStorage > , SwDoc& );
562
563
    SwWriter( SfxMedium&, SwCursorShell &, bool bWriteAll );
564
    SwWriter( SfxMedium&, SwDoc & );
565
};
566
567
typedef Reader* (*FnGetReader)();
568
typedef void (*FnGetWriter)(std::u16string_view, const OUString& rBaseURL, WriterRef&);
569
ErrCode SaveOrDelMSVBAStorage( SfxObjectShell&, SotStorage&, bool, const OUString& );
570
ErrCode GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
571
572
struct SwReaderWriterEntry
573
{
574
    Reader* pReader;
575
    FnGetReader fnGetReader;
576
    FnGetWriter fnGetWriter;
577
    bool bDelReader;
578
579
    SwReaderWriterEntry( const FnGetReader fnReader, const FnGetWriter fnWriter, bool bDel )
580
216
        : pReader( nullptr ), fnGetReader( fnReader ), fnGetWriter( fnWriter ), bDelReader( bDel )
581
216
    {}
582
583
    /// Get access to the reader.
584
    Reader* GetReader();
585
586
    /// Get access to the writer.
587
    void GetWriter( std::u16string_view rNm, const OUString& rBaseURL, WriterRef& xWrt ) const;
588
};
589
590
namespace SwReaderWriter
591
{
592
    SW_DLLPUBLIC Reader* GetRtfReader();
593
    SW_DLLPUBLIC Reader* GetDOCXReader();
594
595
    /// Return reader based on the name.
596
    Reader* GetReader( const OUString& rFltName );
597
598
    /// Return writer based on the name.
599
    SW_DLLPUBLIC void GetWriter( std::u16string_view rFltName, const OUString& rBaseURL, WriterRef& xWrt );
600
}
601
602
void GetRTFWriter( std::u16string_view, const OUString&, WriterRef& );
603
void GetASCWriter( std::u16string_view, const OUString&, WriterRef&);
604
void GetHTMLWriter( std::u16string_view, const OUString&, WriterRef& );
605
void GetXMLWriter( std::u16string_view, const OUString&, WriterRef& );
606
void GetMDWriter(std::u16string_view, const OUString&, WriterRef&);
607
608
#endif
609
610
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */