xref: /AOO41X/main/sw/source/core/inc/SwXMLTextBlocks.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SW_XMLTEXTBLOCKS_HXX
28 #define _SW_XMLTEXTBLOCKS_HXX
29 #include <sfx2/objsh.hxx>
30 #include <sfx2/docfile.hxx>
31 #include <swblocks.hxx>
32 
33 class SfxMedium;
34 class SwPaM;
35 class SwDoc;
36 class SvxMacroTableDtor;
37 class SwImpBlocks;
38 
39 #define SWXML_CONVBLOCK 	0x0001
40 #define SWXML_NOROOTCOMMIT 	0x0002
41 
42 class SwXMLTextBlocks : public SwImpBlocks
43 {
44 protected:
45 	sal_Bool 		 bAutocorrBlock;
46 	sal_Bool 		 bBlock;
47     SfxObjectShellRef xDocShellRef;
48 	sal_uInt16		 nFlags;
49 	String		 aPackageName;
50     SfxMediumRef xMedium;
51 
52 	void ReadInfo();
53 	void WriteInfo();
54     void InitBlockMode ( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStorage );
55 	void ResetBlockMode();
56 
57 public:
58     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xBlkRoot;
59     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xRoot;
60 	short				nCurBlk;
61     SwXMLTextBlocks( const String& rFile );
62     SwXMLTextBlocks( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFile );
63 	void   AddName( const String&, const String&, const String&, sal_Bool bOnlyTxt = sal_False );
64 	virtual void   AddName( const String&, const String&, sal_Bool bOnlyTxt = sal_False );
65 	void GeneratePackageName ( const String& rShort, String& rPackageName );
66 	virtual ~SwXMLTextBlocks();
67 	//virtual sal_Bool   IsOld() const;
68 	virtual sal_uLong Delete( sal_uInt16 );
69 	virtual sal_uLong Rename( sal_uInt16, const String&, const String& );
70 	virtual sal_uLong CopyBlock( SwImpBlocks& rImp, String& rShort, const String& rLong);
71 	virtual void  ClearDoc();
72 	virtual sal_uLong GetDoc( sal_uInt16 );
73 	virtual sal_uLong BeginPutDoc( const String&, const String& );
74     virtual sal_uLong PutDoc();
75 	virtual sal_uLong GetText( sal_uInt16, String& );
76 	virtual sal_uLong PutText( const String&, const String&, const String& );
77 	virtual sal_uLong MakeBlockList();
78 
79 	virtual short GetFileType ( void ) const;
80 	virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True );
81 	virtual void  CloseFile();
82 
83 	static sal_Bool IsFileUCBStorage( const String & rFileName);
84 
85 	// Methods for the new Autocorrecter
86 	sal_uLong GetText( const String& rShort, String& );
87 
88 	virtual sal_Bool IsOnlyTextBlock( const String& rShort ) const;
89 	virtual sal_Bool IsOnlyTextBlock( sal_uInt16 nIdx ) const;
90 	virtual void SetIsTextOnly( const String& rShort, sal_Bool bNewValue );
91 	virtual void SetIsTextOnly( sal_uInt16 nIdx, sal_Bool bNewValue );
92 
93 	virtual sal_uLong GetMacroTable( sal_uInt16, SvxMacroTableDtor& rMacroTbl,
94 								 sal_Bool bFileAlreadyOpen = sal_False );
95 	virtual sal_uLong SetMacroTable( sal_uInt16 nIdx,
96 								 const SvxMacroTableDtor& rMacroTable,
97 								 sal_Bool bFileAlreadyOpen = sal_False );
98 	virtual sal_Bool PutMuchEntries( sal_Bool bOn );
99 
100 public:
101 	SwDoc* GetDoc() const { return pDoc; }
102 	//void  SetDoc( SwDoc * pNewDoc);
103 	sal_uLong StartPutBlock( const String& rShort, const String& rPackageName );
104     sal_uLong PutBlock( SwPaM& rPaM, const String& rLong );
105 	sal_uLong GetBlockText( const String& rShort, String& rText );
106 	sal_uLong PutBlockText( const String& rShort, const String& rName, const String& rText,  const String& rPackageName );
107 	void MakeBlockText( const String& rText );
108 
109 };
110 
111 #endif
112