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 INCLUDED_SW_SOURCE_CORE_INC_SWXMLTEXTBLOCKS_HXX
21 : #define INCLUDED_SW_SOURCE_CORE_INC_SWXMLTEXTBLOCKS_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 : 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 OUString& rFile );
55 : SwXMLTextBlocks( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const OUString& rFile );
56 : void AddName( const OUString&, const OUString&, const OUString&, sal_Bool bOnlyTxt = sal_False );
57 : virtual void AddName( const OUString&, const OUString&, sal_Bool bOnlyTxt = sal_False ) SAL_OVERRIDE;
58 : OUString GeneratePackageName ( const OUString& rShort );
59 : virtual ~SwXMLTextBlocks();
60 : //virtual sal_Bool IsOld() const;
61 : virtual sal_uLong Delete( sal_uInt16 ) SAL_OVERRIDE;
62 : virtual sal_uLong Rename( sal_uInt16, const OUString&, const OUString& ) SAL_OVERRIDE;
63 : virtual sal_uLong CopyBlock( SwImpBlocks& rImp, OUString& rShort, const OUString& rLong) SAL_OVERRIDE;
64 : virtual void ClearDoc() SAL_OVERRIDE;
65 : virtual sal_uLong GetDoc( sal_uInt16 ) SAL_OVERRIDE;
66 : virtual sal_uLong BeginPutDoc( const OUString&, const OUString& ) SAL_OVERRIDE;
67 : virtual sal_uLong PutDoc() SAL_OVERRIDE;
68 : virtual sal_uLong GetText( sal_uInt16, OUString& ) SAL_OVERRIDE;
69 : virtual sal_uLong PutText( const OUString&, const OUString&, const OUString& ) SAL_OVERRIDE;
70 : virtual sal_uLong MakeBlockList() SAL_OVERRIDE;
71 :
72 : virtual short GetFileType ( void ) const SAL_OVERRIDE;
73 : virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True ) SAL_OVERRIDE;
74 : virtual void CloseFile() SAL_OVERRIDE;
75 :
76 : static sal_Bool IsFileUCBStorage( const OUString & rFileName);
77 :
78 : // Methods for the new Autocorrecter
79 : sal_uLong GetText( const OUString& rShort, OUString& );
80 :
81 : virtual sal_Bool IsOnlyTextBlock( const OUString& rShort ) const SAL_OVERRIDE;
82 : virtual sal_Bool IsOnlyTextBlock( sal_uInt16 nIdx ) const;
83 : virtual void SetIsTextOnly( const OUString& 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 ) SAL_OVERRIDE;
88 : virtual sal_uLong SetMacroTable( sal_uInt16 nIdx,
89 : const SvxMacroTableDtor& rMacroTable,
90 : sal_Bool bFileAlreadyOpen = sal_False ) SAL_OVERRIDE;
91 : virtual sal_Bool PutMuchEntries( sal_Bool bOn ) SAL_OVERRIDE;
92 :
93 : public:
94 0 : SwDoc* GetDoc() const { return pDoc; }
95 : //void SetDoc( SwDoc * pNewDoc);
96 : sal_uLong StartPutBlock( const OUString& rShort, const OUString& rPackageName );
97 : sal_uLong PutBlock( SwPaM& rPaM, const OUString& rLong );
98 : sal_uLong GetBlockText( const OUString& rShort, OUString& rText );
99 : sal_uLong PutBlockText( const OUString& rShort, const OUString& rName, const OUString& rText, const OUString& rPackageName );
100 : void MakeBlockText( const OUString& rText );
101 :
102 : };
103 :
104 : #endif
105 :
106 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|