xref: /trunk/main/sw/inc/shellio.hxx (revision 78190a370f7d7129fed9a7e70ca122eaae71ce1d)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef SW_SHELLIO_HXX
24 #define SW_SHELLIO_HXX
25 
26 #include <memory>
27 #include <boost/utility.hpp>
28 
29 #include <com/sun/star/uno/Reference.h>
30 #include <com/sun/star/embed/XStorage.hpp>
31 #include <sfx2/docfile.hxx>
32 #include <sfx2/fcontnr.hxx>
33 #include <sot/formats.hxx>
34 #include <sot/storage.hxx>
35 #include <svtools/parhtml.hxx>
36 #include <tools/string.hxx>
37 #include <tools/date.hxx>
38 #include <tools/time.hxx>
39 #include <tools/datetime.hxx>
40 #include <tools/ref.hxx>
41 #include <tools/urlobj.hxx>
42 #include <swdllapi.h>
43 #include <swtypes.hxx>
44 #include <docfac.hxx>   // SwDocFac
45 #include <errhdl.hxx>
46 #include <iodetect.hxx>
47 
48 // some forward declarations
49 class SfxFilterContainer;
50 class SfxFilter;
51 class SfxItemPool;
52 class SfxItemSet;
53 class SfxMedium;
54 class SvPtrarr;
55 class SvStream;
56 class SvStrings;
57 class SvxFontItem;
58 class SvxMacroTableDtor;
59 //class Sw3Io;
60 class SwCntntNode;
61 class SwCrsrShell;
62 class SwDoc;
63 class SwPaM;
64 class SwTextBlocks;
65 struct SwPosition;
66 struct Writer_Impl;
67 
68 //defines the amount of maximal characters in a paragraph.
69 //The force wrap is done by ASCII/W4W-reader. Must be greater than 200
70 #define MAX_ASCII_PARA 10000
71 
72 
73 class SW_DLLPUBLIC SwAsciiOptions
74 {
75     String sFont;
76     rtl_TextEncoding eCharSet;
77     sal_uInt16 nLanguage;
78     LineEnd eCRLF_Flag;
79 
80 public:
81 
82     const String& GetFontName() const { return sFont; }
83     void SetFontName( const String& rFont ) { sFont = rFont; }
84 
85     rtl_TextEncoding GetCharSet() const { return eCharSet; }
86     void SetCharSet( rtl_TextEncoding nVal ) { eCharSet = nVal; }
87 
88     sal_uInt16 GetLanguage() const { return nLanguage; }
89     void SetLanguage( sal_uInt16 nVal ) { nLanguage = nVal; }
90 
91     LineEnd GetParaFlags() const { return eCRLF_Flag; }
92     void SetParaFlags( LineEnd eVal ) { eCRLF_Flag = eVal; }
93 
94     void Reset()
95     {
96         sFont.Erase();
97         eCRLF_Flag = GetSystemLineEnd();
98         eCharSet = ::gsl_getSystemTextEncoding();
99         nLanguage = 0;
100     }
101     // for the automatic conversion (mail/news/...)
102     void ReadUserData( const String& );
103     void WriteUserData( String& );
104 
105     SwAsciiOptions() { Reset(); }
106 };
107 
108 /**************** SwReader/Reader ************************/
109 // base class for different specialized readers
110 class Reader;
111 //  calls the reader with its options, document, cursor etc.
112 class SwReader;
113 // SwRead is a pointer on the read options of the base class
114 typedef Reader *SwRead;
115 
116 class SwgReaderOption
117 {
118     SwAsciiOptions aASCIIOpts;
119     union
120     {
121         sal_Bool bFmtsOnly;
122         struct
123         {
124             sal_Bool bFrmFmts: 1;
125             sal_Bool bPageDescs: 1;
126             sal_Bool bTxtFmts: 1;
127             sal_Bool bNumRules: 1;
128             sal_Bool bMerge:1;
129         }  Fmts;
130     } What;
131 
132 public:
133     void ResetAllFmtsOnly() { What.bFmtsOnly = 0; }
134     sal_Bool IsFmtsOnly() const { return What.bFmtsOnly; }
135 
136     sal_Bool IsFrmFmts() const { return What.Fmts.bFrmFmts; }
137     void SetFrmFmts( const sal_Bool bNew) { What.Fmts.bFrmFmts = bNew; }
138 
139     sal_Bool IsPageDescs() const { return What.Fmts.bPageDescs; }
140     void SetPageDescs( const sal_Bool bNew) { What.Fmts.bPageDescs = bNew; }
141 
142     sal_Bool IsTxtFmts() const { return What.Fmts.bTxtFmts; }
143     void SetTxtFmts( const sal_Bool bNew) { What.Fmts.bTxtFmts = bNew; }
144 
145     sal_Bool IsNumRules() const { return What.Fmts.bNumRules; }
146     void SetNumRules( const sal_Bool bNew) { What.Fmts.bNumRules = bNew; }
147 
148     sal_Bool IsMerge() const { return What.Fmts.bMerge; }
149     void SetMerge( const sal_Bool bNew ) { What.Fmts.bMerge = bNew; }
150 
151     const SwAsciiOptions& GetASCIIOpts() const { return aASCIIOpts; }
152     void SetASCIIOpts( const SwAsciiOptions& rOpts ) { aASCIIOpts = rOpts; }
153     void ResetASCIIOpts() { aASCIIOpts.Reset(); }
154 
155     SwgReaderOption()
156     {   ResetAllFmtsOnly(); aASCIIOpts.Reset(); }
157 };
158 
159 class SwReader: public SwDocFac
160 {
161     SvStream* pStrm;
162     SotStorageRef pStg;
163     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
164     SfxMedium* pMedium;     // describes file or storage (W4W)
165 
166     SwPaM* pCrsr;
167     String aFileName;
168     String sBaseURL;
169 
170 public:
171     /*
172      * Initial read. Document is created when function Read(...) is called
173      * JP 25.04.95: or if it has been passed in that one.
174      *              special case if loaded with Sw3Reader
175      */
176     //SwReader( SotStorage&, const String& rFilename, SwDoc *pDoc = 0 );
177     //SwReader( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFilename, SwDoc *pDoc = 0 );
178     SwReader( SfxMedium&, const String& rFilename, SwDoc *pDoc = 0 );
179     /*
180      * read into an existing document. Document and
181      * position within the document are taken from SwPaM.
182      */
183     SwReader( SvStream&, const String& rFilename, const String& rBaseURL, SwPaM& );
184     //SwReader( SotStorage&, const String& rFilename, SwPaM& );
185     SwReader( SfxMedium&, const String& rFilename, SwPaM& );
186     SwReader( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFilename, SwPaM& );
187 
188     /*
189     * only SwReader::Read(...) is the Export-Interface!!!
190     */
191     sal_Bool NeedsPasswd( const Reader& );
192     sal_Bool CheckPasswd( const String&, const Reader& );
193     sal_uLong Read( const Reader& );
194 
195     // ask for glossaries
196     sal_Bool HasGlossaries( const Reader& );
197     sal_Bool ReadGlossaries( const Reader&, SwTextBlocks&, sal_Bool bSaveRelFiles );
198 
199     const String&       GetBaseURL() const { return sBaseURL;}
200 
201 protected:
202     void                SetBaseURL( const String& rURL ) { sBaseURL = rURL; }
203 };
204 
205 
206 
207 /* */
208 /****************  SPECIAL Readers ************************/
209 
210 // special - Reader can be both!! (Excel, W4W, .. )
211 #define SW_STREAM_READER    1
212 #define SW_STORAGE_READER   2
213 
214 class SW_DLLPUBLIC Reader
215 {
216     friend class SwReader;
217     SwDoc* pTemplate;
218     String aTemplateNm;
219     //String sBaseURL;
220 
221     Date aDStamp;
222     Time aTStamp;
223     DateTime aChkDateTime;
224 
225 protected:
226     SvStream* pStrm;
227     SotStorageRef pStg;
228     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
229     SfxMedium* pMedium;     // describes file or storage  (W4W)
230 
231     SwgReaderOption aOpt;
232     sal_Bool bInsertMode : 1;
233     sal_Bool bTmplBrowseMode : 1;
234     sal_Bool bReadUTF8: 1;      // interpreted stream as UTF-8
235     sal_Bool bBlockMode: 1;
236     sal_Bool bOrganizerMode : 1;
237     sal_Bool bHasAskTemplateName : 1;
238     sal_Bool bIgnoreHTMLComments : 1;
239 
240     virtual String GetTemplateName() const;
241 
242 public:
243     Reader();
244     virtual ~Reader();
245 
246     virtual int GetReaderType();
247     SwgReaderOption& GetReaderOpt() { return aOpt; }
248 
249     virtual void SetFltName( const String& rFltNm );
250     static void SetNoOutlineNum( SwDoc& rDoc );
251 
252     // fit the item-set of a Frm-Formats to the old Format
253     static void ResetFrmFmtAttrs( SfxItemSet &rFrmSet );
254 
255     // convert frame /graphic-/OLE-Templates to old Format (without border etc.)
256     static void ResetFrmFmts( SwDoc& rDoc );
257 
258     // load filter-template, position it and then set it free again
259     SwDoc* GetTemplateDoc();
260     sal_Bool SetTemplate( SwDoc& rDoc );
261     void ClearTemplate();
262     void SetTemplateName( const String& rDir );
263     void MakeHTMLDummyTemplateDoc();
264 
265     sal_Bool IsReadUTF8() const { return bReadUTF8; }
266     void SetReadUTF8( sal_Bool bSet ) { bReadUTF8 = bSet; }
267 
268     sal_Bool IsBlockMode() const { return bBlockMode; }
269     void SetBlockMode( sal_Bool bSet ) { bBlockMode = bSet; }
270 
271     sal_Bool IsOrganizerMode() const { return bOrganizerMode; }
272     void SetOrganizerMode( sal_Bool bSet ) { bOrganizerMode = bSet; }
273 
274     void SetIgnoreHTMLComments( sal_Bool bSet ) { bIgnoreHTMLComments = bSet; }
275 
276     virtual sal_Bool HasGlossaries() const;
277     virtual sal_Bool ReadGlossaries( SwTextBlocks&, sal_Bool bSaveRelFiles ) const;
278 
279     // read the sections of the document, which is equal to the medium.
280     // returns the count of it
281     virtual sal_uInt16 GetSectionList( SfxMedium& rMedium,
282                                     SvStrings& rStrings ) const;
283 
284     SotStorageRef getSotStorageRef() { return pStg; };
285     void setSotStorageRef(SotStorageRef pStgRef) { pStg = pStgRef; };
286 
287 private:
288     virtual sal_uLong Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &)=0;
289 
290     // all streams / storages that do need to open it must overload the method
291     // (W4W!!)
292     virtual int SetStrmStgPtr();
293 };
294 
295 class AsciiReader: public Reader
296 {
297     friend class SwReader;
298     virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &);
299 public:
300     AsciiReader(): Reader() {}
301 };
302 
303 /*class SwgReader: public Reader
304 {
305     virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &);
306 };
307 */
308 class SW_DLLPUBLIC StgReader : public Reader
309 {
310     String aFltName;
311 
312 protected:
313     sal_uLong OpenMainStream( SotStorageStreamRef& rRef, sal_uInt16& rBuffSize );
314 
315 public:
316     virtual int GetReaderType();
317     const String& GetFltName() { return aFltName; }
318     virtual void SetFltName( const String& r );
319 };
320 
321 
322 /*class Sw3Reader : public StgReader
323 {
324     Sw3Io* pIO;
325     virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &);
326 public:
327     Sw3Reader() : pIO( 0 ) {}
328 
329     void   SetSw3Io( Sw3Io* pIo )     { pIO = pIo; }
330 
331     // read the sections of the document, which is equal to the medium.
332     // returns the count of it
333     virtual sal_uInt16 GetSectionList( SfxMedium& rMedium,
334                                 SvStrings& rStrings ) const;
335 };*/
336 
337 /* */
338 ////////////////////////////////////////////////////////////////////////////
339 // The passed stream has to be dynamic created and before deletion of the
340 // instance per Stream() requested and deleted!
341 
342 class SwImpBlocks;
343 
344 class SW_DLLPUBLIC SwTextBlocks
345 {
346 //  friend class Sw2TextBlocks;
347 //  friend class Sw3IoImp;
348     SwImpBlocks* pImp;
349     sal_uLong        nErr;
350 
351 public:
352     SwTextBlocks( const String& );
353     ~SwTextBlocks();
354 
355     void Flush(){}
356 
357     SwDoc* GetDoc();
358     void   ClearDoc();                  // delete doc content
359     const  String& GetName();
360     void   SetName( const String& );
361     sal_uLong GetError() const { return nErr; }
362 
363     String GetBaseURL() const;
364     void   SetBaseURL( const String& rURL );
365 
366     sal_Bool   IsOld() const;
367     sal_uLong  ConvertToNew();              // convert AutoText entries (ger: Textbausteine)
368 
369     sal_uInt16 GetCount() const;                        // return amount of AutoText entries
370     sal_uInt16 GetIndex( const String& ) const;         // return Index-Number of short names
371     sal_uInt16 GetLongIndex( const String& ) const;     //return Index-Number of long names
372     const  String& GetShortName( sal_uInt16 ) const;    // return a short name of an index
373     const  String& GetLongName( sal_uInt16 ) const;     // return long name of an index
374 
375     sal_Bool   Delete( sal_uInt16 );            // delete
376     sal_uInt16 Rename( sal_uInt16, const String*, const String* ); // rename
377     sal_uLong  CopyBlock( SwTextBlocks& rSource, String& rSrcShort,
378                                     const String& rLong ); // copy block
379 
380     sal_Bool   BeginGetDoc( sal_uInt16 );           // read AutoText entry
381     void   EndGetDoc();                     // release AutoText entry
382 
383     sal_Bool   BeginPutDoc( const String&, const String& ); // start save
384     sal_uInt16 PutDoc();                                // End save
385 
386     sal_uInt16 PutText( const String&, const String&, const String& ); // save (shortname, Text)
387 
388     sal_Bool IsOnlyTextBlock( sal_uInt16 ) const;
389     sal_Bool IsOnlyTextBlock( const String& rShort ) const;
390 
391     const String& GetFileName() const;      // filename of pImp
392     sal_Bool IsReadOnly() const;                // ReadOnly-Flag of pImp
393 
394     sal_Bool GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTbl );
395     sal_Bool SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTbl );
396 
397     sal_Bool StartPutMuchBlockEntries();
398     void EndPutMuchBlockEntries();
399 };
400 
401 // BEGIN source/filter/basflt/fltini.cxx
402 
403 extern void _InitFilter();
404 extern void _FinitFilter();
405 
406 extern SwRead ReadAscii, /*ReadSwg, ReadSw3, */ReadHTML, ReadXML;
407 
408 //SW_DLLPUBLIC SwRead SwGetReaderSw3();
409 SW_DLLPUBLIC SwRead SwGetReaderXML();
410 
411 // END source/filter/basflt/fltini.cxx
412 
413 
414 extern sal_Bool SetHTMLTemplate( SwDoc &rDoc ); // load templates from HTML.vor (see shellio.cxx)
415 
416 
417 /* */
418 /////////////////////////////////////////////////////////////////////////////
419 
420 /*
421  * write, Writer
422  */
423 
424 
425 /* base class of all Writer */
426 
427 class IDocumentSettingAccess;
428 class IDocumentStylePoolAccess;
429 
430 class SW_DLLPUBLIC Writer
431     : public SvRefBase
432     , private ::boost::noncopyable
433 {
434     SwAsciiOptions aAscOpts;
435     String          sBaseURL;
436 
437     void _AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont );
438     void _AddFontItems( SfxItemPool& rPool, sal_uInt16 nWhichId );
439 
440     ::std::auto_ptr<Writer_Impl> m_pImpl;
441 
442 protected:
443 
444     SwPaM* pOrigPam;            // last Pam to work on
445     const String* pOrigFileName;
446 
447     void ResetWriter();
448     sal_Bool CopyNextPam( SwPaM ** );
449 
450     void PutNumFmtFontsInAttrPool();
451     void PutEditEngFontsInAttrPool( sal_Bool bIncl_CJK_CTL = sal_True );
452     void PutCJKandCTLFontsInAttrPool();
453 
454     virtual sal_uLong WriteStream() = 0;
455     void                SetBaseURL( const String& rURL ) { sBaseURL = rURL; }
456 
457     IDocumentSettingAccess* getIDocumentSettingAccess();
458     const IDocumentSettingAccess* getIDocumentSettingAccess() const;
459 
460     IDocumentStylePoolAccess* getIDocumentStylePoolAccess();
461     const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const;
462 
463 public:
464     SwDoc* pDoc;
465     SwPaM* pCurPam;
466     sal_Bool bWriteAll : 1;
467     sal_Bool bShowProgress : 1;
468     sal_Bool bWriteClipboardDoc : 1;
469     sal_Bool bWriteOnlyFirstTable : 1;
470     sal_Bool bASCII_ParaAsCR : 1;
471     sal_Bool bASCII_ParaAsBlanc : 1;
472     sal_Bool bASCII_NoLastLineEnd : 1;
473     sal_Bool bUCS2_WithStartChar : 1;
474     sal_Bool bExportPargraphNumbering : 1;
475 
476     sal_Bool bBlock : 1;
477     sal_Bool bOrganizerMode : 1;
478 
479     Writer();
480     virtual ~Writer();
481 
482     virtual sal_uLong Write( SwPaM&, SfxMedium&, const String* = 0 );
483             sal_uLong Write( SwPaM&, SvStream&,  const String* = 0 );
484     virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String* = 0, SfxMedium* = 0 );
485     virtual sal_uLong Write( SwPaM&, SotStorage&, const String* = 0 );
486 
487     virtual void SetPasswd( const String& );
488     virtual void SetVersion( const String&, long );
489     virtual sal_Bool IsStgWriter() const;
490 //  virtual sal_Bool IsSw3Writer() const;
491 
492     void SetShowProgress( sal_Bool bFlag = sal_False )  { bShowProgress = bFlag; }
493 
494     const String* GetOrigFileName() const       { return pOrigFileName; }
495 
496     const SwAsciiOptions& GetAsciiOptions() const { return aAscOpts; }
497     void SetAsciiOptions( const SwAsciiOptions& rOpt ) { aAscOpts = rOpt; }
498 
499     const String&       GetBaseURL() const { return sBaseURL;}
500 
501     // search next bookmark position from the bookmark table
502     sal_Int32 FindPos_Bkmk( const SwPosition& rPos ) const;
503     // build a bookmark table, which is sorted by the node position. The
504     // OtherPos of the bookmarks also inserted.
505     void CreateBookmarkTbl();
506     // search all bookmarks in the range and return it in the Array
507     sal_uInt16 GetBookmarks( const SwCntntNode& rNd,
508                         xub_StrLen nStt, xub_StrLen nEnd,
509                         SvPtrarr& rArr );
510 
511     // create a new PaM at the position
512     static SwPaM * NewSwPaM(SwDoc & rDoc,
513                             sal_uLong const nStartIdx, sal_uLong const nEndIdx);
514 
515     // if applicable, copy a local file into internet / cloud
516     sal_Bool CopyLocalFileToINet( String& rFileNm );
517 
518     // Stream-specific routines, DO NOT USE in Storage-Writer!
519 
520     // Optimizing output on stream
521     SvStream& OutLong( SvStream& rStrm, long nVal );
522     SvStream& OutULong( SvStream& rStrm, sal_uLong nVal );
523 
524     // print hexadecimal number, default is 2-digit number
525     SvStream& OutHex( SvStream& rStrm, sal_uLong nHex, sal_uInt8 nLen = 2 );
526     // print 4-digit hexadecimal number
527     inline SvStream& OutHex4( SvStream& rStrm, sal_uInt16 nHex )
528         {   return OutHex( rStrm, nHex, 4 ); }
529 
530     inline SvStream& OutHex( sal_uInt16 nHex, sal_uInt8 nLen = 2 )      { return OutHex( Strm(), nHex, nLen ); }
531     inline SvStream& OutHex4( sal_uInt16 nHex )     { return OutHex( Strm(), nHex, 4 ); }
532     inline SvStream& OutLong( long nVal )       { return OutLong( Strm(), nVal ); }
533     inline SvStream& OutULong( sal_uLong nVal )     { return OutULong( Strm(), nVal ); }
534 
535     void SetStream(SvStream *const pStream);
536     SvStream& Strm();
537 
538     void SetOrganizerMode( sal_Bool bSet ) { bOrganizerMode = bSet; }
539 };
540 
541 #ifndef SW_DECL_WRITER_DEFINED
542 #define SW_DECL_WRITER_DEFINED
543 SV_DECL_REF(Writer)
544 #endif
545 SV_IMPL_REF(Writer)
546 
547 // baseclass of all Storage-Writer
548 class SW_DLLPUBLIC StgWriter : public Writer
549 {
550 protected:
551     String aFltName;
552     SotStorageRef pStg;
553     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
554 
555     // create error at call
556     virtual sal_uLong WriteStream();
557     virtual sal_uLong WriteStorage() = 0;
558     virtual sal_uLong WriteMedium( SfxMedium& ) = 0;
559 
560     using Writer::Write;
561 
562 public:
563     StgWriter() : Writer() {}
564 
565     virtual sal_Bool IsStgWriter() const;
566 
567     virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String* = 0, SfxMedium* = 0 );
568     virtual sal_uLong Write( SwPaM&, SotStorage&, const String* = 0 );
569 
570     SotStorage& GetStorage() const       { return *pStg; }
571 };
572 
573 /*class Sw3Writer : public StgWriter
574 {
575     Sw3Io* pIO;
576     sal_Bool bSaveAs : 1;
577 
578     virtual sal_uLong WriteStorage();
579     virtual sal_uLong WriteMedium( SfxMedium& );
580 
581 public:
582     Sw3Writer() : pIO( 0 ), bSaveAs( sal_False ) {}
583 
584     virtual sal_Bool IsSw3Writer() const;
585 };
586 
587 */
588 
589 // Interface class for a generic access on special writer
590 
591 class SwWriter
592 {
593     SvStream* pStrm;
594     SotStorageRef pStg;
595     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
596     SfxMedium* pMedium;
597 
598     SwPaM* pOutPam;
599     SwCrsrShell *pShell;
600     SwDoc &rDoc;
601 
602     //String sBaseURL;
603 
604     sal_Bool bWriteAll;
605 
606 public:
607     sal_uLong Write( WriterRef& rxWriter, const String* = 0);
608 
609     SwWriter( SvStream&, SwCrsrShell &,sal_Bool bWriteAll = sal_False );
610     SwWriter( SvStream&, SwDoc & );
611     SwWriter( SvStream&, SwPaM &, sal_Bool bWriteAll = sal_False );
612 
613 //  SwWriter( SotStorage&, SwCrsrShell &,sal_Bool bWriteAll = sal_False );
614     SwWriter( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, SwDoc& );
615 //  SwWriter( SotStorage&, SwPaM&, sal_Bool bWriteAll = sal_False );
616 
617     SwWriter( SfxMedium&, SwCrsrShell &,sal_Bool bWriteAll = sal_False );
618     SwWriter( SfxMedium&, SwDoc & );
619 //  SwWriter( SfxMedium&, SwPaM&, sal_Bool bWriteAll = sal_False );
620 
621     //const String&       GetBaseURL() const { return sBaseURL;}
622 };
623 
624 
625 /* */
626 /////////////////////////////////////////////////////////////////////////////
627 
628 typedef Reader* (*FnGetReader)();
629 typedef void (*FnGetWriter)(const String&, const String& rBaseURL, WriterRef&);
630 sal_uLong SaveOrDelMSVBAStorage( SfxObjectShell&, SotStorage&, sal_Bool, const String& );
631 sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
632 
633 struct SwReaderWriterEntry
634 {
635     Reader* pReader;
636     FnGetReader fnGetReader;
637     FnGetWriter fnGetWriter;
638     sal_Bool bDelReader;
639 
640     SwReaderWriterEntry( const FnGetReader fnReader, const FnGetWriter fnWriter, sal_Bool bDel )
641         : pReader( NULL ), fnGetReader( fnReader ), fnGetWriter( fnWriter ), bDelReader( bDel )
642     {}
643 
644     /// Get access to the reader
645     Reader* GetReader();
646 
647     /// Get access to the writer
648     void GetWriter( const String& rNm, const String& rBaseURL, WriterRef& xWrt ) const;
649 };
650 
651 namespace SwReaderWriter
652 {
653     /// Return reader based on ReaderWriterEnum
654     Reader* GetReader( ReaderWriterEnum eReader );
655 
656     /// Return reader based on the name
657     Reader* GetReader( const String& rFltName );
658 
659     /// Return writer based on the name
660     void GetWriter( const String& rFltName, const String& rBaseURL, WriterRef& xWrt );
661 }
662 
663 void GetRTFWriter( const String&, const String&, WriterRef& );
664 void GetASCWriter( const String&, const String&, WriterRef& );
665 //void GetSw3Writer( const String&, const String&, WriterRef& );
666 void GetHTMLWriter( const String&, const String&, WriterRef& );
667 void GetXMLWriter( const String&, const String&, WriterRef& );
668 void GetWW8Writer( const String&, const String&, WriterRef& );
669 
670 #endif
671