Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _SW_XMLTEXTBLOCKS_HXX
21 : #define _SW_XMLTEXTBLOCKS_HXX
22 :
23 : #include <sfx2/objsh.hxx>
24 : #include <sfx2/docfile.hxx>
25 : #include <swblocks.hxx>
26 :
27 : class SwPaM;
28 : class SwDoc;
29 : class SvxMacroTableDtor;
30 : class SwImpBlocks;
31 :
32 : #define SWXML_CONVBLOCK 0x0001
33 : #define SWXML_NOROOTCOMMIT 0x0002
34 :
35 : class SwXMLTextBlocks : public SwImpBlocks
36 : {
37 : protected:
38 : sal_Bool bAutocorrBlock;
39 : sal_Bool bBlock;
40 : SfxObjectShellRef xDocShellRef;
41 : sal_uInt16 nFlags;
42 : rtl::OUString aPackageName;
43 : SfxMediumRef xMedium;
44 :
45 : void ReadInfo();
46 : void WriteInfo();
47 : void InitBlockMode ( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStorage );
48 : void ResetBlockMode();
49 :
50 : public:
51 : com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xBlkRoot;
52 : com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xRoot;
53 : short nCurBlk;
54 : SwXMLTextBlocks( const String& rFile );
55 : SwXMLTextBlocks( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFile );
56 : void AddName( const String&, const String&, const String&, sal_Bool bOnlyTxt = sal_False );
57 : virtual void AddName( const String&, const String&, sal_Bool bOnlyTxt = sal_False );
58 : rtl::OUString GeneratePackageName ( const String& rShort );
59 : virtual ~SwXMLTextBlocks();
60 : //virtual sal_Bool IsOld() const;
61 : virtual sal_uLong Delete( sal_uInt16 );
62 : virtual sal_uLong Rename( sal_uInt16, const String&, const String& );
63 : virtual sal_uLong CopyBlock( SwImpBlocks& rImp, String& rShort, const String& rLong);
64 : virtual void ClearDoc();
65 : virtual sal_uLong GetDoc( sal_uInt16 );
66 : virtual sal_uLong BeginPutDoc( const String&, const String& );
67 : virtual sal_uLong PutDoc();
68 : virtual sal_uLong GetText( sal_uInt16, String& );
69 : virtual sal_uLong PutText( const String&, const String&, const String& );
70 : virtual sal_uLong MakeBlockList();
71 :
72 : virtual short GetFileType ( void ) const;
73 : virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True );
74 : virtual void CloseFile();
75 :
76 : static sal_Bool IsFileUCBStorage( const String & rFileName);
77 :
78 : // Methods for the new Autocorrecter
79 : sal_uLong GetText( const String& rShort, String& );
80 :
81 : virtual sal_Bool IsOnlyTextBlock( const String& rShort ) const;
82 : virtual sal_Bool IsOnlyTextBlock( sal_uInt16 nIdx ) const;
83 : virtual void SetIsTextOnly( const String& rShort, sal_Bool bNewValue );
84 : virtual void SetIsTextOnly( sal_uInt16 nIdx, sal_Bool bNewValue );
85 :
86 : virtual sal_uLong GetMacroTable( sal_uInt16, SvxMacroTableDtor& rMacroTbl,
87 : sal_Bool bFileAlreadyOpen = sal_False );
88 : virtual sal_uLong SetMacroTable( sal_uInt16 nIdx,
89 : const SvxMacroTableDtor& rMacroTable,
90 : sal_Bool bFileAlreadyOpen = sal_False );
91 : virtual sal_Bool PutMuchEntries( sal_Bool bOn );
92 :
93 : public:
94 0 : SwDoc* GetDoc() const { return pDoc; }
95 : //void SetDoc( SwDoc * pNewDoc);
96 : sal_uLong StartPutBlock( const String& rShort, const String& rPackageName );
97 : sal_uLong PutBlock( SwPaM& rPaM, const String& rLong );
98 : sal_uLong GetBlockText( const String& rShort, String& rText );
99 : sal_uLong PutBlockText( const String& rShort, const String& rName, const String& rText, const String& rPackageName );
100 : void MakeBlockText( const String& rText );
101 :
102 : };
103 :
104 : #endif
105 :
106 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|