Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef SW_SHELLIO_HXX
29 : : #define SW_SHELLIO_HXX
30 : :
31 : : #include <memory>
32 : : #include <boost/utility.hpp>
33 : :
34 : : #include <com/sun/star/uno/Reference.h>
35 : : #include <com/sun/star/embed/XStorage.hpp>
36 : : #include <sfx2/docfile.hxx>
37 : : #include <sfx2/fcontnr.hxx>
38 : : #include <sot/formats.hxx>
39 : : #include <sot/storage.hxx>
40 : : #include <svtools/parhtml.hxx>
41 : : #include <tools/string.hxx>
42 : : #include <tools/date.hxx>
43 : : #include <tools/time.hxx>
44 : : #include <tools/datetime.hxx>
45 : : #include <tools/ref.hxx>
46 : : #include <swdllapi.h>
47 : : #include <swtypes.hxx>
48 : : #include <docfac.hxx> // SwDocFac
49 : : #include <iodetect.hxx>
50 : : #include <IMark.hxx>
51 : :
52 : : class SfxFilterContainer;
53 : : class SfxFilter;
54 : : class SfxItemPool;
55 : : class SfxItemSet;
56 : : class SfxMedium;
57 : : class SvStream;
58 : : class SvxFontItem;
59 : : class SvxMacroTableDtor;
60 : : class SwCntntNode;
61 : : class SwCrsrShell;
62 : : class SwDoc;
63 : : class SwPaM;
64 : : class SwTextBlocks;
65 : : class vector;
66 : : struct SwPosition;
67 : : struct Writer_Impl;
68 : :
69 : : // Defines the count of chars at which a paragraph read via ASCII/W4W-Reader
70 : : // is forced to wrap. It has to be always greater than 200!!!
71 : : #define MAX_ASCII_PARA 10000
72 : :
73 : :
74 : 73703 : class SW_DLLPUBLIC SwAsciiOptions
75 : : {
76 : : String sFont;
77 : : rtl_TextEncoding eCharSet;
78 : : sal_uInt16 nLanguage;
79 : : LineEnd eCRLF_Flag;
80 : :
81 : : public:
82 : :
83 : 36 : const String& GetFontName() const { return sFont; }
84 : 0 : void SetFontName( const String& rFont ) { sFont = rFont; }
85 : :
86 : 21165 : rtl_TextEncoding GetCharSet() const { return eCharSet; }
87 : 10465 : void SetCharSet( rtl_TextEncoding nVal ) { eCharSet = nVal; }
88 : :
89 : 18 : sal_uInt16 GetLanguage() const { return nLanguage; }
90 : 0 : void SetLanguage( sal_uInt16 nVal ) { nLanguage = nVal; }
91 : :
92 : 11291 : LineEnd GetParaFlags() const { return eCRLF_Flag; }
93 : 0 : void SetParaFlags( LineEnd eVal ) { eCRLF_Flag = eVal; }
94 : :
95 : 21681 : void Reset()
96 : : {
97 : 21681 : sFont.Erase();
98 : 21681 : eCRLF_Flag = GetSystemLineEnd();
99 : 21681 : eCharSet = ::osl_getThreadTextEncoding();
100 : 21681 : nLanguage = 0;
101 : 21681 : }
102 : : // for the automatic conversion (mail/news/...)
103 : : void ReadUserData( const String& );
104 : : void WriteUserData( String& );
105 : :
106 [ + - ]: 21368 : SwAsciiOptions() { Reset(); }
107 : : };
108 : :
109 : : /**************** SwReader/Reader ************************/
110 : : // Base class of possible options for a special reader.
111 : : class Reader;
112 : : // Calls reader with its options, document, cursor etc.
113 : : class SwReader;
114 : : // SwRead is pointer to the read-options base class.
115 : : typedef Reader *SwRead;
116 : :
117 : 304 : class SwgReaderOption
118 : : {
119 : : SwAsciiOptions aASCIIOpts;
120 : : union
121 : : {
122 : : sal_Bool bFmtsOnly;
123 : : struct
124 : : {
125 : : sal_Bool bFrmFmts: 1;
126 : : sal_Bool bPageDescs: 1;
127 : : sal_Bool bTxtFmts: 1;
128 : : sal_Bool bNumRules: 1;
129 : : sal_Bool bMerge:1;
130 : : } Fmts;
131 : : } What;
132 : :
133 : : public:
134 : 367 : void ResetAllFmtsOnly() { What.bFmtsOnly = 0; }
135 : 503 : sal_Bool IsFmtsOnly() const { return What.bFmtsOnly; }
136 : :
137 : 0 : sal_Bool IsFrmFmts() const { return What.Fmts.bFrmFmts; }
138 : 0 : void SetFrmFmts( const sal_Bool bNew) { What.Fmts.bFrmFmts = bNew; }
139 : :
140 : 0 : sal_Bool IsPageDescs() const { return What.Fmts.bPageDescs; }
141 : 0 : void SetPageDescs( const sal_Bool bNew) { What.Fmts.bPageDescs = bNew; }
142 : :
143 : 0 : sal_Bool IsTxtFmts() const { return What.Fmts.bTxtFmts; }
144 : 0 : void SetTxtFmts( const sal_Bool bNew) { What.Fmts.bTxtFmts = bNew; }
145 : :
146 : 0 : sal_Bool IsNumRules() const { return What.Fmts.bNumRules; }
147 : 0 : void SetNumRules( const sal_Bool bNew) { What.Fmts.bNumRules = bNew; }
148 : :
149 : 0 : sal_Bool IsMerge() const { return What.Fmts.bMerge; }
150 : 0 : void SetMerge( const sal_Bool bNew ) { What.Fmts.bMerge = bNew; }
151 : :
152 : 9 : const SwAsciiOptions& GetASCIIOpts() const { return aASCIIOpts; }
153 : 9 : void SetASCIIOpts( const SwAsciiOptions& rOpts ) { aASCIIOpts = rOpts; }
154 : 9 : void ResetASCIIOpts() { aASCIIOpts.Reset(); }
155 : :
156 : 304 : SwgReaderOption()
157 [ + - ]: 304 : { ResetAllFmtsOnly(); aASCIIOpts.Reset(); }
158 : : };
159 : :
160 [ + - ][ + - ]: 188 : class SwReader: public SwDocFac
[ + - ]
161 : : {
162 : : SvStream* pStrm;
163 : : SotStorageRef pStg;
164 : : com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
165 : : SfxMedium* pMedium; // Who wants to obtain a Medium (W4W).
166 : :
167 : : SwPaM* pCrsr;
168 : : String aFileName;
169 : : String sBaseURL;
170 : :
171 : : public:
172 : :
173 : : // Initial reading. Document is created only at Read(...)
174 : : // or in case it is given, into that.
175 : : // Special case for Load with Sw3Reader.
176 : : SwReader( SfxMedium&, const String& rFilename, SwDoc *pDoc = 0 );
177 : :
178 : : // Read into existing document.
179 : : // Document and position in document are taken from SwPaM.
180 : : SwReader( SvStream&, const String& rFilename, const String& rBaseURL, SwPaM& );
181 : : SwReader( SfxMedium&, const String& rFilename, SwPaM& );
182 : : SwReader( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFilename, SwPaM& );
183 : :
184 : : // The only export interface is SwReader::Read(...)!!!
185 : : sal_Bool NeedsPasswd( const Reader& );
186 : : sal_Bool CheckPasswd( const String&, const Reader& );
187 : : sal_uLong Read( const Reader& );
188 : :
189 : : // Ask for glossaries.
190 : : sal_Bool HasGlossaries( const Reader& );
191 : : sal_Bool ReadGlossaries( const Reader&, SwTextBlocks&, sal_Bool bSaveRelFiles );
192 : :
193 : 188 : const String& GetBaseURL() const { return sBaseURL;}
194 : :
195 : : protected:
196 : 188 : void SetBaseURL( const String& rURL ) { sBaseURL = rURL; }
197 : : };
198 : :
199 : :
200 : :
201 : : /**************** Special Readers ************************/
202 : :
203 : : // Special Readers can be both!! (Excel, W4W, .. ).
204 : : #define SW_STREAM_READER 1
205 : : #define SW_STORAGE_READER 2
206 : :
207 : : class SW_DLLPUBLIC Reader
208 : : {
209 : : friend class SwReader;
210 : : SwDoc* pTemplate;
211 : : String aTemplateNm;
212 : :
213 : : Date aDStamp;
214 : : Time aTStamp;
215 : : DateTime aChkDateTime;
216 : :
217 : : protected:
218 : : SvStream* pStrm;
219 : : SotStorageRef pStg;
220 : : com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
221 : : SfxMedium* pMedium; // Who wants to obtain a Medium (W4W).
222 : :
223 : : SwgReaderOption aOpt;
224 : : sal_Bool bInsertMode : 1;
225 : : sal_Bool bTmplBrowseMode : 1;
226 : : sal_Bool bReadUTF8: 1; // Interprete stream as UTF-8.
227 : : sal_Bool bBlockMode: 1;
228 : : sal_Bool bOrganizerMode : 1;
229 : : sal_Bool bHasAskTemplateName : 1;
230 : : sal_Bool bIgnoreHTMLComments : 1;
231 : :
232 : : virtual String GetTemplateName() const;
233 : :
234 : : public:
235 : : Reader();
236 : : virtual ~Reader();
237 : :
238 : : virtual int GetReaderType();
239 : 9 : SwgReaderOption& GetReaderOpt() { return aOpt; }
240 : :
241 : : virtual void SetFltName( const String& rFltNm );
242 : :
243 : : // Adapt item-set of a Frm-Format to the old format.
244 : : static void ResetFrmFmtAttrs( SfxItemSet &rFrmSet );
245 : :
246 : : // Adapt Frame-/Graphics-/OLE- styles to the old format
247 : : // (without borders etc.).
248 : : static void ResetFrmFmts( SwDoc& rDoc );
249 : :
250 : : // Load filter template, set it and release it again.
251 : : SwDoc* GetTemplateDoc();
252 : : sal_Bool SetTemplate( SwDoc& rDoc );
253 : : void ClearTemplate();
254 : : void SetTemplateName( const String& rDir );
255 : : void MakeHTMLDummyTemplateDoc();
256 : :
257 : 2 : sal_Bool IsReadUTF8() const { return bReadUTF8; }
258 : 188 : void SetReadUTF8( sal_Bool bSet ) { bReadUTF8 = bSet; }
259 : :
260 : 252 : sal_Bool IsBlockMode() const { return bBlockMode; }
261 : 188 : void SetBlockMode( sal_Bool bSet ) { bBlockMode = bSet; }
262 : :
263 : 315 : sal_Bool IsOrganizerMode() const { return bOrganizerMode; }
264 : 188 : void SetOrganizerMode( sal_Bool bSet ) { bOrganizerMode = bSet; }
265 : :
266 : 188 : void SetIgnoreHTMLComments( sal_Bool bSet ) { bIgnoreHTMLComments = bSet; }
267 : :
268 : : virtual sal_Bool HasGlossaries() const;
269 : : virtual sal_Bool ReadGlossaries( SwTextBlocks&, sal_Bool bSaveRelFiles ) const;
270 : :
271 : : // Read the sections of the document, which is equal to the medium.
272 : : // Returns the count of it
273 : : virtual size_t GetSectionList( SfxMedium& rMedium,
274 : : std::vector<String*>& rStrings ) const;
275 : :
276 : 125 : SotStorageRef getSotStorageRef() { return pStg; };
277 : 125 : void setSotStorageRef(SotStorageRef pStgRef) { pStg = pStgRef; };
278 : :
279 : : private:
280 : : virtual sal_uLong Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &)=0;
281 : :
282 : : // Everyone who does not need the streams / storages open
283 : : // has to overload the method (W4W!!).
284 : : virtual int SetStrmStgPtr();
285 : : };
286 : :
287 [ - + ]: 146 : class AsciiReader: public Reader
288 : : {
289 : : friend class SwReader;
290 : : virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &);
291 : : public:
292 : 73 : AsciiReader(): Reader() {}
293 : : };
294 : :
295 [ + - ][ - + ]: 24 : class SW_DLLPUBLIC StgReader : public Reader
[ + - ]
296 : : {
297 : : String aFltName;
298 : :
299 : : protected:
300 : : sal_uLong OpenMainStream( SotStorageStreamRef& rRef, sal_uInt16& rBuffSize );
301 : : public:
302 : : virtual int GetReaderType();
303 : 111 : const String& GetFltName() { return aFltName; }
304 : : virtual void SetFltName( const String& r );
305 : : };
306 : :
307 : :
308 : : // The given stream has to be created dynamically and must
309 : : // be requested via Stream() before the instance is deleted!
310 : :
311 : : class SwImpBlocks;
312 : :
313 : : class SW_DLLPUBLIC SwTextBlocks
314 : : {
315 : : SwImpBlocks* pImp;
316 : : sal_uLong nErr;
317 : :
318 : : public:
319 : : SwTextBlocks( const String& );
320 : : ~SwTextBlocks();
321 : :
322 : : void Flush(){}
323 : :
324 : : SwDoc* GetDoc();
325 : : void ClearDoc(); // Delete Doc-contents.
326 : : const String& GetName();
327 : : void SetName( const String& );
328 : 216 : sal_uLong GetError() const { return nErr; }
329 : :
330 : : String GetBaseURL() const;
331 : : void SetBaseURL( const String& rURL );
332 : :
333 : : sal_Bool IsOld() const;
334 : : sal_uLong ConvertToNew(); // Convert text modules.
335 : :
336 : : sal_uInt16 GetCount() const; // Get count text modules.
337 : : sal_uInt16 GetIndex( const String& ) const; // Get index of short names.
338 : : sal_uInt16 GetLongIndex( const String& ) const; // Get index of long names.
339 : : const String& GetShortName( sal_uInt16 ) const; // Get short name for index.
340 : : const String& GetLongName( sal_uInt16 ) const; // Get long name for index.
341 : :
342 : : sal_Bool Delete( sal_uInt16 );
343 : : sal_uInt16 Rename( sal_uInt16, const String*, const String* );
344 : : sal_uLong CopyBlock( SwTextBlocks& rSource, String& rSrcShort,
345 : : const String& rLong );
346 : :
347 : : sal_Bool BeginGetDoc( sal_uInt16 ); // Read text modules.
348 : : void EndGetDoc(); // Release text modules.
349 : :
350 : : sal_Bool BeginPutDoc( const String&, const String& ); // Begin save.
351 : : sal_uInt16 PutDoc(); // End save.
352 : :
353 : : sal_uInt16 PutText( const String&, const String&, const String& ); // Save (short name, text).
354 : :
355 : : sal_Bool IsOnlyTextBlock( sal_uInt16 ) const;
356 : : sal_Bool IsOnlyTextBlock( const String& rShort ) const;
357 : :
358 : : const String& GetFileName() const; // Filename of pImp.
359 : : sal_Bool IsReadOnly() const; // ReadOnly-flag of pImp.
360 : :
361 : : sal_Bool GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTbl );
362 : : sal_Bool SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTbl );
363 : :
364 : : sal_Bool StartPutMuchBlockEntries();
365 : : void EndPutMuchBlockEntries();
366 : : };
367 : :
368 : : // BEGIN source/filter/basflt/fltini.cxx
369 : :
370 : : extern SwRead ReadAscii, /*ReadSwg, ReadSw3, */ReadHTML, ReadXML;
371 : :
372 : : SW_DLLPUBLIC SwRead SwGetReaderXML();
373 : :
374 : : // END source/filter/basflt/fltini.cxx
375 : :
376 : :
377 : : extern sal_Bool SetHTMLTemplate( SwDoc &rDoc ); //For templates from HTML before loading shellio.cxx.
378 : :
379 : :
380 : :
381 : :
382 : :
383 : : // Base-class of all writers.
384 : :
385 : : class IDocumentSettingAccess;
386 : : class IDocumentStylePoolAccess;
387 : :
388 : : class SW_DLLPUBLIC Writer
389 : : : public SvRefBase
390 : : , private ::boost::noncopyable
391 : : {
392 : : SwAsciiOptions aAscOpts;
393 : : String sBaseURL;
394 : :
395 : : void _AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont );
396 : : void _AddFontItems( SfxItemPool& rPool, sal_uInt16 nWhichId );
397 : :
398 : : ::std::auto_ptr<Writer_Impl> m_pImpl;
399 : :
400 : : protected:
401 : :
402 : : SwPaM* pOrigPam; // Last Pam that has to be processed.
403 : : const String* pOrigFileName;
404 : :
405 : : void ResetWriter();
406 : : sal_Bool CopyNextPam( SwPaM ** );
407 : :
408 : : void PutNumFmtFontsInAttrPool();
409 : : void PutEditEngFontsInAttrPool( sal_Bool bIncl_CJK_CTL = sal_True );
410 : :
411 : : virtual sal_uLong WriteStream() = 0;
412 : 32 : void SetBaseURL( const String& rURL ) { sBaseURL = rURL; }
413 : :
414 : : IDocumentSettingAccess* getIDocumentSettingAccess();
415 : : const IDocumentSettingAccess* getIDocumentSettingAccess() const;
416 : :
417 : : IDocumentStylePoolAccess* getIDocumentStylePoolAccess();
418 : : const IDocumentStylePoolAccess* getIDocumentStylePoolAccess() const;
419 : :
420 : : public:
421 : : SwDoc* pDoc;
422 : : SwPaM* pCurPam;
423 : : sal_Bool bWriteAll : 1;
424 : : sal_Bool bShowProgress : 1;
425 : : sal_Bool bWriteClipboardDoc : 1;
426 : : sal_Bool bWriteOnlyFirstTable : 1;
427 : : sal_Bool bASCII_ParaAsCR : 1;
428 : : sal_Bool bASCII_ParaAsBlanc : 1;
429 : : sal_Bool bASCII_NoLastLineEnd : 1;
430 : : sal_Bool bUCS2_WithStartChar : 1;
431 : : sal_Bool bExportPargraphNumbering : 1;
432 : :
433 : : sal_Bool bBlock : 1;
434 : : sal_Bool bOrganizerMode : 1;
435 : :
436 : : Writer();
437 : : virtual ~Writer();
438 : :
439 : : virtual sal_uLong Write( SwPaM&, SfxMedium&, const String* = 0 );
440 : : sal_uLong Write( SwPaM&, SvStream&, const String* = 0 );
441 : : virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String* = 0, SfxMedium* = 0 );
442 : : virtual sal_uLong Write( SwPaM&, SotStorage&, const String* = 0 );
443 : :
444 : : virtual void SetPasswd( const String& );
445 : : virtual void SetVersion( const String&, long );
446 : : virtual sal_Bool IsStgWriter() const;
447 : :
448 : 2 : void SetShowProgress( sal_Bool bFlag = sal_False ) { bShowProgress = bFlag; }
449 : :
450 : 0 : const String* GetOrigFileName() const { return pOrigFileName; }
451 : :
452 : 52550 : const SwAsciiOptions& GetAsciiOptions() const { return aAscOpts; }
453 : 20933 : void SetAsciiOptions( const SwAsciiOptions& rOpt ) { aAscOpts = rOpt; }
454 : :
455 : 23 : const String& GetBaseURL() const { return sBaseURL;}
456 : :
457 : : // Look up next bookmark position from bookmark-table.
458 : : sal_Int32 FindPos_Bkmk( const SwPosition& rPos ) const;
459 : : // Build a bookmark table, which is sort by the node position. The
460 : : // OtherPos of the bookmarks also inserted.
461 : : void CreateBookmarkTbl();
462 : : // Search alle Bookmarks in the range and return it in the Array.
463 : : sal_uInt16 GetBookmarks( const SwCntntNode& rNd,
464 : : xub_StrLen nStt, xub_StrLen nEnd,
465 : : std::vector< const ::sw::mark::IMark* >& rArr );
466 : :
467 : : // Create new PaM at position.
468 : : static SwPaM * NewSwPaM(SwDoc & rDoc,
469 : : sal_uLong const nStartIdx, sal_uLong const nEndIdx);
470 : :
471 : : // If applicable copy a local file into internet.
472 : : sal_Bool CopyLocalFileToINet( String& rFileNm );
473 : :
474 : :
475 : : // Stream-specific routines. Do not use in storage-writer!
476 : :
477 : : // Optimizing output on stream.
478 : : SvStream& OutLong( SvStream& rStrm, long nVal );
479 : : SvStream& OutULong( SvStream& rStrm, sal_uLong nVal );
480 : :
481 : : inline SvStream& OutLong( long nVal ) { return OutLong( Strm(), nVal ); }
482 : 0 : inline SvStream& OutULong( sal_uLong nVal ) { return OutULong( Strm(), nVal ); }
483 : :
484 : : void SetStream(SvStream *const pStream);
485 : : SvStream& Strm();
486 : :
487 : 0 : void SetOrganizerMode( sal_Bool bSet ) { bOrganizerMode = bSet; }
488 : : };
489 : :
490 : : #ifndef SW_DECL_WRITER_DEFINED
491 : : #define SW_DECL_WRITER_DEFINED
492 : 125713 : SV_DECL_REF(Writer)
493 : : #endif
494 [ + + - ]: 52500 : SV_IMPL_REF(Writer)
[ # # ][ + - ]
[ # # - + ]
[ # # ][ + - ]
[ + - ]
495 : :
496 : : // Base class for all storage writers.
497 [ + - ][ + - ]: 30 : class SW_DLLPUBLIC StgWriter : public Writer
[ - + ]
498 : : {
499 : : protected:
500 : : String aFltName;
501 : : SotStorageRef pStg;
502 : : com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
503 : :
504 : : // Create error at call.
505 : : virtual sal_uLong WriteStream();
506 : : virtual sal_uLong WriteStorage() = 0;
507 : : virtual sal_uLong WriteMedium( SfxMedium& ) = 0;
508 : :
509 : : using Writer::Write;
510 : :
511 : : public:
512 [ + - ]: 30 : StgWriter() : Writer() {}
513 : :
514 : : virtual sal_Bool IsStgWriter() const;
515 : :
516 : : virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String* = 0, SfxMedium* = 0 );
517 : : virtual sal_uLong Write( SwPaM&, SotStorage&, const String* = 0 );
518 : :
519 : 72 : SotStorage& GetStorage() const { return *pStg; }
520 : : };
521 : :
522 : :
523 : : // Interface class for general access on special writers.
524 : :
525 : 10500 : class SwWriter
526 : : {
527 : : SvStream* pStrm;
528 : : SotStorageRef pStg;
529 : : com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg;
530 : : SfxMedium* pMedium;
531 : :
532 : : SwPaM* pOutPam;
533 : : SwCrsrShell *pShell;
534 : : SwDoc &rDoc;
535 : :
536 : : sal_Bool bWriteAll;
537 : :
538 : : public:
539 : : sal_uLong Write( WriterRef& rxWriter, const String* = 0);
540 : :
541 : : SwWriter( SvStream&, SwCrsrShell &,sal_Bool bWriteAll = sal_False );
542 : : SwWriter( SvStream&, SwDoc & );
543 : : SwWriter( SvStream&, SwPaM &, sal_Bool bWriteAll = sal_False );
544 : :
545 : : SwWriter( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, SwDoc& );
546 : :
547 : : SwWriter( SfxMedium&, SwCrsrShell &,sal_Bool bWriteAll = sal_False );
548 : : SwWriter( SfxMedium&, SwDoc & );
549 : : };
550 : :
551 : :
552 : :
553 : : typedef Reader* (*FnGetReader)();
554 : : typedef void (*FnGetWriter)(const String&, const String& rBaseURL, WriterRef&);
555 : : sal_uLong SaveOrDelMSVBAStorage( SfxObjectShell&, SotStorage&, sal_Bool, const String& );
556 : : sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
557 : :
558 : : struct SwReaderWriterEntry
559 : : {
560 : : Reader* pReader;
561 : : FnGetReader fnGetReader;
562 : : FnGetWriter fnGetWriter;
563 : : sal_Bool bDelReader;
564 : :
565 : 803 : SwReaderWriterEntry( const FnGetReader fnReader, const FnGetWriter fnWriter, sal_Bool bDel )
566 : 803 : : pReader( NULL ), fnGetReader( fnReader ), fnGetWriter( fnWriter ), bDelReader( bDel )
567 : 803 : {}
568 : :
569 : : /// Get access to the reader.
570 : : Reader* GetReader();
571 : :
572 : : /// Get access to the writer.
573 : : void GetWriter( const String& rNm, const String& rBaseURL, WriterRef& xWrt ) const;
574 : : };
575 : :
576 : : namespace SwReaderWriter
577 : : {
578 : : /// Return reader based on ReaderWriterEnum.
579 : : Reader* GetReader( ReaderWriterEnum eReader );
580 : :
581 : : /// Return reader based on the name.
582 : : Reader* GetReader( const String& rFltName );
583 : :
584 : : /// Return writer based on the name.
585 : : void GetWriter( const String& rFltName, const String& rBaseURL, WriterRef& xWrt );
586 : : }
587 : :
588 : : void GetRTFWriter( const String&, const String&, WriterRef& );
589 : : void GetASCWriter( const String&, const String&, WriterRef& );
590 : : void GetHTMLWriter( const String&, const String&, WriterRef& );
591 : : void GetXMLWriter( const String&, const String&, WriterRef& );
592 : : void GetWW8Writer( const String&, const String&, WriterRef& );
593 : :
594 : : #endif
595 : :
596 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|