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 : :
29 : : #ifndef _SW_XMLTEXTBLOCKS_HXX
30 : : #define _SW_XMLTEXTBLOCKS_HXX
31 : :
32 : : #include <sfx2/objsh.hxx>
33 : : #include <sfx2/docfile.hxx>
34 : : #include <swblocks.hxx>
35 : :
36 : : class SwPaM;
37 : : class SwDoc;
38 : : class SvxMacroTableDtor;
39 : : class SwImpBlocks;
40 : :
41 : : #define SWXML_CONVBLOCK 0x0001
42 : : #define SWXML_NOROOTCOMMIT 0x0002
43 : :
44 : : class SwXMLTextBlocks : public SwImpBlocks
45 : : {
46 : : protected:
47 : : sal_Bool bAutocorrBlock;
48 : : sal_Bool bBlock;
49 : : SfxObjectShellRef xDocShellRef;
50 : : sal_uInt16 nFlags;
51 : : rtl::OUString aPackageName;
52 : : SfxMediumRef xMedium;
53 : :
54 : : void ReadInfo();
55 : : void WriteInfo();
56 : : void InitBlockMode ( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStorage );
57 : : void ResetBlockMode();
58 : :
59 : : public:
60 : : com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xBlkRoot;
61 : : com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xRoot;
62 : : short nCurBlk;
63 : : SwXMLTextBlocks( const String& rFile );
64 : : SwXMLTextBlocks( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFile );
65 : : void AddName( const String&, const String&, const String&, sal_Bool bOnlyTxt = sal_False );
66 : : virtual void AddName( const String&, const String&, sal_Bool bOnlyTxt = sal_False );
67 : : rtl::OUString GeneratePackageName ( const String& rShort );
68 : : virtual ~SwXMLTextBlocks();
69 : : //virtual sal_Bool IsOld() const;
70 : : virtual sal_uLong Delete( sal_uInt16 );
71 : : virtual sal_uLong Rename( sal_uInt16, const String&, const String& );
72 : : virtual sal_uLong CopyBlock( SwImpBlocks& rImp, String& rShort, const String& rLong);
73 : : virtual void ClearDoc();
74 : : virtual sal_uLong GetDoc( sal_uInt16 );
75 : : virtual sal_uLong BeginPutDoc( const String&, const String& );
76 : : virtual sal_uLong PutDoc();
77 : : virtual sal_uLong GetText( sal_uInt16, String& );
78 : : virtual sal_uLong PutText( const String&, const String&, const String& );
79 : : virtual sal_uLong MakeBlockList();
80 : :
81 : : virtual short GetFileType ( void ) const;
82 : : virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True );
83 : : virtual void CloseFile();
84 : :
85 : : static sal_Bool IsFileUCBStorage( const String & rFileName);
86 : :
87 : : // Methods for the new Autocorrecter
88 : : sal_uLong GetText( const String& rShort, String& );
89 : :
90 : : virtual sal_Bool IsOnlyTextBlock( const String& rShort ) const;
91 : : virtual sal_Bool IsOnlyTextBlock( sal_uInt16 nIdx ) const;
92 : : virtual void SetIsTextOnly( const String& rShort, sal_Bool bNewValue );
93 : : virtual void SetIsTextOnly( sal_uInt16 nIdx, sal_Bool bNewValue );
94 : :
95 : : virtual sal_uLong GetMacroTable( sal_uInt16, SvxMacroTableDtor& rMacroTbl,
96 : : sal_Bool bFileAlreadyOpen = sal_False );
97 : : virtual sal_uLong SetMacroTable( sal_uInt16 nIdx,
98 : : const SvxMacroTableDtor& rMacroTable,
99 : : sal_Bool bFileAlreadyOpen = sal_False );
100 : : virtual sal_Bool PutMuchEntries( sal_Bool bOn );
101 : :
102 : : public:
103 : 0 : SwDoc* GetDoc() const { return pDoc; }
104 : : //void SetDoc( SwDoc * pNewDoc);
105 : : sal_uLong StartPutBlock( const String& rShort, const String& rPackageName );
106 : : sal_uLong PutBlock( SwPaM& rPaM, const String& rLong );
107 : : sal_uLong GetBlockText( const String& rShort, String& rText );
108 : : sal_uLong PutBlockText( const String& rShort, const String& rName, const String& rText, const String& rPackageName );
109 : : void MakeBlockText( const String& rText );
110 : :
111 : : };
112 : :
113 : : #endif
114 : :
115 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|