1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SwXMLTextBlocks.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SW_XMLTEXTBLOCKS_HXX
31 #define _SW_XMLTEXTBLOCKS_HXX
32 #include <sfx2/objsh.hxx>
33 #include <sfx2/docfile.hxx>
34 #include <swblocks.hxx>
39 class SvxMacroTableDtor
;
42 #define SWXML_CONVBLOCK 0x0001
43 #define SWXML_NOROOTCOMMIT 0x0002
45 class SwXMLTextBlocks
: public SwImpBlocks
50 SfxObjectShellRef xDocShellRef
;
57 void InitBlockMode ( const com::sun::star::uno::Reference
< com::sun::star::embed::XStorage
>& rStorage
);
58 void ResetBlockMode();
61 com::sun::star::uno::Reference
< com::sun::star::embed::XStorage
> xBlkRoot
;
62 com::sun::star::uno::Reference
< com::sun::star::embed::XStorage
> xRoot
;
64 SwXMLTextBlocks( const String
& rFile
);
65 SwXMLTextBlocks( const com::sun::star::uno::Reference
< com::sun::star::embed::XStorage
>&, const String
& rFile
);
66 void AddName( const String
&, const String
&, const String
&, BOOL bOnlyTxt
= FALSE
);
67 virtual void AddName( const String
&, const String
&, BOOL bOnlyTxt
= FALSE
);
68 void GeneratePackageName ( const String
& rShort
, String
& rPackageName
);
69 virtual ~SwXMLTextBlocks();
70 //virtual BOOL IsOld() const;
71 virtual ULONG
Delete( USHORT
);
72 virtual ULONG
Rename( USHORT
, const String
&, const String
& );
73 virtual ULONG
CopyBlock( SwImpBlocks
& rImp
, String
& rShort
, const String
& rLong
);
74 virtual void ClearDoc();
75 virtual ULONG
GetDoc( USHORT
);
76 virtual ULONG
BeginPutDoc( const String
&, const String
& );
77 virtual ULONG
PutDoc();
78 virtual ULONG
GetText( USHORT
, String
& );
79 virtual ULONG
PutText( const String
&, const String
&, const String
& );
80 virtual ULONG
MakeBlockList();
82 virtual short GetFileType ( void ) const;
83 virtual ULONG
OpenFile( BOOL bReadOnly
= TRUE
);
84 virtual void CloseFile();
86 static BOOL
IsFileUCBStorage( const String
& rFileName
);
88 // Methods for the new Autocorrecter
89 ULONG
GetText( const String
& rShort
, String
& );
91 virtual BOOL
IsOnlyTextBlock( const String
& rShort
) const;
92 virtual BOOL
IsOnlyTextBlock( USHORT nIdx
) const;
93 virtual void SetIsTextOnly( const String
& rShort
, BOOL bNewValue
);
94 virtual void SetIsTextOnly( USHORT nIdx
, BOOL bNewValue
);
96 virtual ULONG
GetMacroTable( USHORT
, SvxMacroTableDtor
& rMacroTbl
,
97 sal_Bool bFileAlreadyOpen
= sal_False
);
98 virtual ULONG
SetMacroTable( USHORT nIdx
,
99 const SvxMacroTableDtor
& rMacroTable
,
100 sal_Bool bFileAlreadyOpen
= sal_False
);
101 virtual BOOL
PutMuchEntries( BOOL bOn
);
104 SwDoc
* GetDoc() const { return pDoc
; }
105 //void SetDoc( SwDoc * pNewDoc);
106 ULONG
StartPutBlock( const String
& rShort
, const String
& rPackageName
);
107 ULONG
PutBlock( SwPaM
& rPaM
, const String
& rLong
);
108 ULONG
GetBlockText( const String
& rShort
, String
& rText
);
109 ULONG
PutBlockText( const String
& rShort
, const String
& rName
, const String
& rText
, const String
& rPackageName
);
110 void MakeBlockText( const String
& rText
);