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