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 bOnlyText = false );
56 : virtual void AddName( const OUString&, const OUString&, bool bOnlyText = false ) SAL_OVERRIDE;
57 : static 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() 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 : bool IsOnlyTextBlock( sal_uInt16 nIdx ) const;
81 : void SetIsTextOnly( const OUString& rShort, bool bNewValue );
82 :
83 : virtual sal_uLong GetMacroTable( sal_uInt16, SvxMacroTableDtor& rMacroTable,
84 : bool bFileAlreadyOpen = false ) SAL_OVERRIDE;
85 : virtual sal_uLong SetMacroTable( sal_uInt16 nIdx,
86 : const SvxMacroTableDtor& rMacroTable,
87 : bool bFileAlreadyOpen = false ) SAL_OVERRIDE;
88 : virtual bool PutMuchEntries( bool bOn ) SAL_OVERRIDE;
89 :
90 : public:
91 0 : SwDoc* GetDoc() const { return pDoc; }
92 : //void SetDoc( SwDoc * pNewDoc);
93 : sal_uLong StartPutBlock( const OUString& rShort, const OUString& rPackageName );
94 : sal_uLong PutBlock( SwPaM& rPaM, const OUString& rLong );
95 : sal_uLong GetBlockText( const OUString& rShort, OUString& rText );
96 : sal_uLong PutBlockText( const OUString& rShort, const OUString& rName, const OUString& rText, const OUString& rPackageName );
97 : void MakeBlockText( const OUString& rText );
98 :
99 : };
100 :
101 : #endif
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|