xref: /aoo42x/main/sw/inc/shellio.hxx (revision e1c33130)
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 declerations
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 //beyond following number  ASCII/W4W-reader is used. Must be greater then 200
69 #define MAX_ASCII_PARA 10000
70 
71 
72 class SW_DLLPUBLIC SwAsciiOptions
73 {
74 	String sFont;
75 	rtl_TextEncoding eCharSet;
76 	sal_uInt16 nLanguage;
77 	LineEnd eCRLF_Flag;
78 
79 public:
80 
81 	const String& GetFontName() const { return sFont; }
82 	void SetFontName( const String& rFont ) { sFont = rFont; }
83 
84 	rtl_TextEncoding GetCharSet() const { return eCharSet; }
85 	void SetCharSet( rtl_TextEncoding nVal ) { eCharSet = nVal; }
86 
87 	sal_uInt16 GetLanguage() const { return nLanguage; }
88 	void SetLanguage( sal_uInt16 nVal ) { nLanguage = nVal; }
89 
90 	LineEnd GetParaFlags() const { return eCRLF_Flag; }
91 	void SetParaFlags( LineEnd eVal ) { eCRLF_Flag = eVal; }
92 
93 	void Reset()
94 	{
95 		sFont.Erase();
96 		eCRLF_Flag = GetSystemLineEnd();
97 		eCharSet = ::gsl_getSystemTextEncoding();
98 		nLanguage = 0;
99 	}
100 	// for the automatic conversion (mail/news/...)
101 	void ReadUserData( const String& );
102 	void WriteUserData( String& );
103 
104 	SwAsciiOptions() { Reset(); }
105 };
106 
107 /**************** SwReader/Reader ************************/
108 // base class for different specialized readers
109 class Reader;
110 //  calls a document with its options, document, cursor etc.
111 class SwReader;
112 // SwRead is a pointer on the read options of the base class
113 typedef Reader *SwRead;
114 
115 class SwgReaderOption
116 {
117 	SwAsciiOptions aASCIIOpts;
118 	union
119 	{
120 		sal_Bool bFmtsOnly;
121 		struct
122 		{
123 			sal_Bool bFrmFmts: 1;
124 			sal_Bool bPageDescs: 1;
125 			sal_Bool bTxtFmts: 1;
126 			sal_Bool bNumRules: 1;
127 			sal_Bool bMerge:1;
128 		}  Fmts;
129 	} What;
130 
131 public:
132 	void ResetAllFmtsOnly() { What.bFmtsOnly = 0; }
133     sal_Bool IsFmtsOnly() const { return What.bFmtsOnly; }
134 
135 	sal_Bool IsFrmFmts() const { return What.Fmts.bFrmFmts; }
136 	void SetFrmFmts( const sal_Bool bNew) { What.Fmts.bFrmFmts = bNew; }
137 
138 	sal_Bool IsPageDescs() const { return What.Fmts.bPageDescs; }
139 	void SetPageDescs( const sal_Bool bNew) { What.Fmts.bPageDescs = bNew; }
140 
141 	sal_Bool IsTxtFmts() const { return What.Fmts.bTxtFmts; }
142 	void SetTxtFmts( const sal_Bool bNew) { What.Fmts.bTxtFmts = bNew; }
143 
144 	sal_Bool IsNumRules() const { return What.Fmts.bNumRules; }
145 	void SetNumRules( const sal_Bool bNew) { What.Fmts.bNumRules = bNew; }
146 
147 	sal_Bool IsMerge() const { return What.Fmts.bMerge; }
148 	void SetMerge( const sal_Bool bNew ) { What.Fmts.bMerge = bNew; }
149 
150 	const SwAsciiOptions& GetASCIIOpts() const { return aASCIIOpts; }
151 	void SetASCIIOpts( const SwAsciiOptions& rOpts ) { aASCIIOpts = rOpts; }
152 	void ResetASCIIOpts() { aASCIIOpts.Reset(); }
153 
154 	SwgReaderOption()
155 	{	ResetAllFmtsOnly(); aASCIIOpts.Reset(); }
156 };
157 
158 class SwReader: public SwDocFac
159 {
160 	SvStream* pStrm;
161     SotStorageRef pStg;
162     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
163 	SfxMedium* pMedium;		// describes file or storage (W4W)
164 
165 	SwPaM* pCrsr;
166 	String aFileName;
167     String sBaseURL;
168 
169 public:
170 	/*
171 	 * Initial read. document is created when function Read(...) os called
172 	 * JP 25.04.95: or if it has been passed in that one.
173 	 *				special case if loaded with Sw3Reader
174 	 */
175     //SwReader( SotStorage&, const String& rFilename, SwDoc *pDoc = 0 );
176     //SwReader( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFilename, SwDoc *pDoc = 0 );
177     SwReader( SfxMedium&, const String& rFilename, SwDoc *pDoc = 0 );
178 	/*
179 	 * read into an nexisting document. Document and
180 	 * position within the document are taken from SwPaM.
181 	 */
182     SwReader( SvStream&, const String& rFilename, const String& rBaseURL, SwPaM& );
183     //SwReader( SotStorage&, const String& rFilename, SwPaM& );
184 	SwReader( SfxMedium&, const String& rFilename, SwPaM& );
185     SwReader( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFilename, SwPaM& );
186 
187 	/*
188  	* only SwReader::Read(...) is the Export-Interface!!!
189  	*/
190 	sal_Bool NeedsPasswd( const Reader& );
191 	sal_Bool CheckPasswd( const String&, const Reader& );
192 	sal_uLong Read( const Reader& );
193 
194 	// ask for glossaries
195 	sal_Bool HasGlossaries( const Reader& );
196 	sal_Bool ReadGlossaries( const Reader&, SwTextBlocks&, sal_Bool bSaveRelFiles );
197 
198     const String&       GetBaseURL() const { return sBaseURL;}
199 
200 protected:
201     void                SetBaseURL( const String& rURL ) { sBaseURL = rURL; }
202 };
203 
204 
205 
206 /* */
207 /****************  SPECIALE Readers ************************/
208 
209 // special - Reader can be both!! (Excel, W4W, .. )
210 #define SW_STREAM_READER	1
211 #define SW_STORAGE_READER	2
212 
213 class SW_DLLPUBLIC Reader
214 {
215 	friend class SwReader;
216 	SwDoc* pTemplate;
217 	String aTemplateNm;
218     //String sBaseURL;
219 
220     Date aDStamp;
221 	Time aTStamp;
222 	DateTime aChkDateTime;
223 
224 protected:
225 	SvStream* pStrm;
226     SotStorageRef pStg;
227     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
228 	SfxMedium* pMedium;		// describes file or storage  (W4W)
229 
230 	SwgReaderOption aOpt;
231 	sal_Bool bInsertMode : 1;
232 	sal_Bool bTmplBrowseMode : 1;
233 	sal_Bool bReadUTF8: 1;		// interpred stream as UTF-8
234 	sal_Bool bBlockMode: 1;
235 	sal_Bool bOrganizerMode : 1;
236 	sal_Bool bHasAskTemplateName : 1;
237     sal_Bool bIgnoreHTMLComments : 1;
238 
239 	virtual String GetTemplateName() const;
240 
241 public:
242 	Reader();
243 	virtual ~Reader();
244 
245 	virtual int GetReaderType();
246 	SwgReaderOption& GetReaderOpt() { return aOpt; }
247 
248 	virtual void SetFltName( const String& rFltNm );
249 	static void SetNoOutlineNum( SwDoc& rDoc );
250 
251 	// fit the item-set of a Frm-Formats to the old Format
252 	static void ResetFrmFmtAttrs( SfxItemSet &rFrmSet );
253 
254 	// convert frame /grafic-/OLE-Templates to old Format (without frame etc.)
255 	static void ResetFrmFmts( SwDoc& rDoc );
256 
257 	// load filter template, position and free again
258 	SwDoc* GetTemplateDoc();
259 	sal_Bool SetTemplate( SwDoc& rDoc );
260 	void ClearTemplate();
261 	void SetTemplateName( const String& rDir );
262 	void MakeHTMLDummyTemplateDoc();
263 
264     sal_Bool IsReadUTF8() const { return bReadUTF8; }
265 	void SetReadUTF8( sal_Bool bSet ) { bReadUTF8 = bSet; }
266 
267     sal_Bool IsBlockMode() const { return bBlockMode; }
268 	void SetBlockMode( sal_Bool bSet ) { bBlockMode = bSet; }
269 
270     sal_Bool IsOrganizerMode() const { return bOrganizerMode; }
271 	void SetOrganizerMode( sal_Bool bSet ) { bOrganizerMode = bSet; }
272 
273     void SetIgnoreHTMLComments( sal_Bool bSet ) { bIgnoreHTMLComments = bSet; }
274 
275 	virtual sal_Bool HasGlossaries() const;
276 	virtual sal_Bool ReadGlossaries( SwTextBlocks&, sal_Bool bSaveRelFiles ) const;
277 
278 	// read the sections of the document, which is equal to the medium.
279 	// returns the count of it
280 	virtual sal_uInt16 GetSectionList( SfxMedium& rMedium,
281 									SvStrings& rStrings ) const;
282 
283 	SotStorageRef getSotStorageRef() { return pStg; };
284     void setSotStorageRef(SotStorageRef pStgRef) { pStg = pStgRef; };
285 
286 private:
287     virtual sal_uLong Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &)=0;
288 
289 	// every object which does not need streams / object must overload following
290 	// (W4W!!)
291 	virtual int SetStrmStgPtr();
292 };
293 
294 class AsciiReader: public Reader
295 {
296 	friend class SwReader;
297     virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &);
298 public:
299 	AsciiReader(): Reader() {}
300 };
301 
302 /*class SwgReader: public Reader
303 {
304     virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &);
305 };
306 */
307 class SW_DLLPUBLIC StgReader : public Reader
308 {
309 	String aFltName;
310 
311 protected:
312     sal_uLong OpenMainStream( SotStorageStreamRef& rRef, sal_uInt16& rBuffSize );
313 
314 public:
315 	virtual int GetReaderType();
316     const String& GetFltName() { return aFltName; }
317 	virtual void SetFltName( const String& r );
318 };
319 
320 
321 /*class Sw3Reader : public StgReader
322 {
323 	Sw3Io* pIO;
324     virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &);
325 public:
326 	Sw3Reader() : pIO( 0 ) {}
327 
328     void   SetSw3Io( Sw3Io* pIo )     { pIO = pIo; }
329 
330 	// read the sections of the document, which is equal to the medium.
331 	// returns the count of it
332 	virtual sal_uInt16 GetSectionList( SfxMedium& rMedium,
333 								SvStrings& rStrings ) const;
334 };*/
335 
336 /* */
337 ////////////////////////////////////////////////////////////////////////////
338 // The passed stream has to be dynamic created and before deletion of the
339 // instance per Stream() requested and deleted
340 
341 class SwImpBlocks;
342 
343 class SW_DLLPUBLIC SwTextBlocks
344 {
345 //  friend class Sw2TextBlocks;
346 //  friend class Sw3IoImp;
347 	SwImpBlocks* pImp;
348 	sal_uLong 		 nErr;
349 
350 public:
351 	SwTextBlocks( const String& );
352 	~SwTextBlocks();
353 
354     void Flush(){}
355 
356 	SwDoc* GetDoc();
357 	void   ClearDoc();					// delete doc content
358 	const  String& GetName();
359 	void   SetName( const String& );
360 	sal_uLong GetError() const { return nErr; }
361 
362     String GetBaseURL() const;
363     void   SetBaseURL( const String& rURL );
364 
365 	sal_Bool   IsOld() const;
366 	sal_uLong  ConvertToNew();				// convert AutoText entries (ger: Textbausteine)
367 
368 	sal_uInt16 GetCount() const;						// return amount of AutoText entries
369 	sal_uInt16 GetIndex( const String& ) const;			// return Index of shortnames
370 	sal_uInt16 GetLongIndex( const String& ) const;		//Index fuer Langnamen ermitteln
371 	const  String& GetShortName( sal_uInt16 ) const; 	// return a shortname of an index
372 	const  String& GetLongName( sal_uInt16 ) const;  	// return longname of an index
373 
374 	sal_Bool   Delete( sal_uInt16 );			// delete
375 	sal_uInt16 Rename( sal_uInt16, const String*, const String* ); // rename
376 	sal_uLong  CopyBlock( SwTextBlocks& rSource, String& rSrcShort,
377 									const String& rLong ); // copy block
378 
379 	sal_Bool   BeginGetDoc( sal_uInt16 );			// read AutoText entry
380 	void   EndGetDoc();						// release AutoText entry
381 
382 	sal_Bool   BeginPutDoc( const String&, const String& ); // start save
383 	sal_uInt16 PutDoc(); 								// End save
384 
385 	sal_uInt16 PutText( const String&, const String&, const String& ); // save (short., Text)
386 
387 	sal_Bool IsOnlyTextBlock( sal_uInt16 ) const;
388 	sal_Bool IsOnlyTextBlock( const String& rShort ) const;
389 
390 	const String& GetFileName() const;		// filename of pImp
391 	sal_Bool IsReadOnly() const;  				// ReadOnly-Flag of pImp
392 
393 	sal_Bool GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTbl );
394 	sal_Bool SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTbl );
395 
396     sal_Bool StartPutMuchBlockEntries();
397 	void EndPutMuchBlockEntries();
398 };
399 
400 // BEGIN source/filter/basflt/fltini.cxx
401 
402 extern void _InitFilter();
403 extern void _FinitFilter();
404 
405 extern SwRead ReadAscii, /*ReadSwg, ReadSw3, */ReadHTML, ReadXML;
406 
407 //SW_DLLPUBLIC SwRead SwGetReaderSw3();
408 SW_DLLPUBLIC SwRead SwGetReaderXML();
409 
410 // END source/filter/basflt/fltini.cxx
411 
412 
413 extern sal_Bool SetHTMLTemplate( SwDoc &rDoc ); // HTML templates (pre?)load shellio.cxx
414 
415 
416 /* */
417 /////////////////////////////////////////////////////////////////////////////
418 
419 /*
420  * write, Writer
421  */
422 
423 
424 /* base class of all Writer */
425 
426 class IDocumentSettingAccess;
427 class IDocumentStylePoolAccess;
428 
429 class SW_DLLPUBLIC Writer
430     : public SvRefBase
431     , private ::boost::noncopyable
432 {
433 	SwAsciiOptions aAscOpts;
434     String          sBaseURL;
435 
436 	void _AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont );
437 	void _AddFontItems( SfxItemPool& rPool, sal_uInt16 nWhichId );
438 
439     ::std::auto_ptr<Writer_Impl> m_pImpl;
440 
441 protected:
442 
443 	SwPaM* pOrigPam;			// last Pam to work on
444 	const String* pOrigFileName;
445 
446 	void ResetWriter();
447 	sal_Bool CopyNextPam( SwPaM ** );
448 
449 	void PutNumFmtFontsInAttrPool();
450 	void PutEditEngFontsInAttrPool( sal_Bool bIncl_CJK_CTL = sal_True );
451 	void PutCJKandCTLFontsInAttrPool();
452 
453 	virtual sal_uLong WriteStream() = 0;
454     void                SetBaseURL( const String& rURL ) { sBaseURL = rURL; }
455 
456     IDocumentSettingAccess* getIDocumentSettingAccess();
457     const IDocumentSettingAccess* getIDocumentSettingAccess() const;
458 
459 	IDocumentStylePoolAccess* getIDocumentStylePoolAccess();
460 	const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const;
461 
462 public:
463 	SwDoc* pDoc;
464 	SwPaM* pCurPam;
465 	sal_Bool bWriteAll : 1;
466 	sal_Bool bShowProgress : 1;
467 	sal_Bool bWriteClipboardDoc : 1;
468 	sal_Bool bWriteOnlyFirstTable : 1;
469 	sal_Bool bASCII_ParaAsCR : 1;
470 	sal_Bool bASCII_ParaAsBlanc : 1;
471 	sal_Bool bASCII_NoLastLineEnd : 1;
472 	sal_Bool bUCS2_WithStartChar : 1;
473 	sal_Bool bExportPargraphNumbering : 1;
474 
475 	sal_Bool bBlock : 1;
476 	sal_Bool bOrganizerMode : 1;
477 
478     Writer();
479 	virtual ~Writer();
480 
481 	virtual sal_uLong Write( SwPaM&, SfxMedium&, const String* = 0 );
482 			sal_uLong Write( SwPaM&, SvStream&,  const String* = 0 );
483     virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String* = 0, SfxMedium* = 0 );
484     virtual sal_uLong Write( SwPaM&, SotStorage&, const String* = 0 );
485 
486 	virtual void SetPasswd( const String& );
487 	virtual void SetVersion( const String&, long );
488 	virtual sal_Bool IsStgWriter() const;
489 //  virtual sal_Bool IsSw3Writer() const;
490 
491     void SetShowProgress( sal_Bool bFlag = sal_False )  { bShowProgress = bFlag; }
492 
493 	const String* GetOrigFileName() const 		{ return pOrigFileName; }
494 
495 	const SwAsciiOptions& GetAsciiOptions() const { return aAscOpts; }
496 	void SetAsciiOptions( const SwAsciiOptions& rOpt ) { aAscOpts = rOpt; }
497 
498     const String&       GetBaseURL() const { return sBaseURL;}
499 
500     // search next bookmark position from the bookmark table
501 	sal_Int32 FindPos_Bkmk( const SwPosition& rPos ) const;
502 	// build a bookmark table, which is sort by the node position. The
503 	// OtherPos of the bookmarks also inserted.
504 	void CreateBookmarkTbl();
505 	// search all bookmarks in the range and return it in the Array
506 	sal_uInt16 GetBookmarks( const SwCntntNode& rNd,
507 						xub_StrLen nStt, xub_StrLen nEnd,
508 						SvPtrarr& rArr );
509 
510 	// create a new PaM at the position
511     static SwPaM * NewSwPaM(SwDoc & rDoc,
512                             sal_uLong const nStartIdx, sal_uLong const nEndIdx);
513 
514 	// upload a local file to the internet / cloud
515 	sal_Bool CopyLocalFileToINet( String& rFileNm );
516 
517 	// Stream-specific routines, DO NOT USE IN Storage-Writer!
518 
519 	// Optimize of the output stream
520 	SvStream& OutLong( SvStream& rStrm, long nVal );
521 	SvStream& OutULong( SvStream& rStrm, sal_uLong nVal );
522 
523 	// print Hex-Zahl, default is 2. digit number
524 	SvStream& OutHex( SvStream& rStrm, sal_uLong nHex, sal_uInt8 nLen = 2 );
525 	// print 4-digit Hex number
526 	inline SvStream& OutHex4( SvStream& rStrm, sal_uInt16 nHex )
527 		{   return OutHex( rStrm, nHex, 4 ); }
528 
529 	inline SvStream& OutHex( sal_uInt16 nHex, sal_uInt8 nLen = 2 )      { return OutHex( Strm(), nHex, nLen ); }
530 	inline SvStream& OutHex4( sal_uInt16 nHex )     { return OutHex( Strm(), nHex, 4 ); }
531     inline SvStream& OutLong( long nVal )       { return OutLong( Strm(), nVal ); }
532 	inline SvStream& OutULong( sal_uLong nVal )		{ return OutULong( Strm(), nVal ); }
533 
534     void SetStream(SvStream *const pStream);
535 	SvStream& Strm();
536 
537     void SetOrganizerMode( sal_Bool bSet ) { bOrganizerMode = bSet; }
538 };
539 
540 #ifndef SW_DECL_WRITER_DEFINED
541 #define SW_DECL_WRITER_DEFINED
542 SV_DECL_REF(Writer)
543 #endif
544 SV_IMPL_REF(Writer)
545 
546 // baseclass of all Storage-Writer
547 class SW_DLLPUBLIC StgWriter : public Writer
548 {
549 protected:
550 	String aFltName;
551     SotStorageRef pStg;
552     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
553 
554 	// create error at call
555 	virtual sal_uLong WriteStream();
556 	virtual sal_uLong WriteStorage() = 0;
557 	virtual sal_uLong WriteMedium( SfxMedium& ) = 0;
558 
559     using Writer::Write;
560 
561 public:
562     StgWriter() : Writer() {}
563 
564 	virtual sal_Bool IsStgWriter() const;
565 
566     virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String* = 0, SfxMedium* = 0 );
567     virtual sal_uLong Write( SwPaM&, SotStorage&, const String* = 0 );
568 
569     SotStorage& GetStorage() const       { return *pStg; }
570 };
571 
572 /*class Sw3Writer : public StgWriter
573 {
574 	Sw3Io* pIO;
575 	sal_Bool bSaveAs : 1;
576 
577 	virtual sal_uLong WriteStorage();
578 	virtual sal_uLong WriteMedium( SfxMedium& );
579 
580 public:
581 	Sw3Writer() : pIO( 0 ), bSaveAs( sal_False ) {}
582 
583     virtual sal_Bool IsSw3Writer() const;
584 };
585 
586 */
587 
588 // Schnittstellenklasse fuer den allgemeinen Zugriff auf die
589 // speziellen 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