Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SWBLOCKS_HXX
29 : : #define _SWBLOCKS_HXX
30 : :
31 : : #include <tools/string.hxx>
32 : :
33 : : #include <tools/datetime.hxx>
34 : : #include <o3tl/sorted_vector.hxx>
35 : :
36 : :
37 : : class SwPaM;
38 : : class SwDoc;
39 : : class SvxMacroTableDtor;
40 : :
41 : : // Name eines Textblocks:
42 : :
43 [ + - ]: 82 : class SwBlockName
44 : : {
45 : : friend class SwImpBlocks;
46 : : sal_uInt16 nHashS, nHashL; // Hash-Codes zum Checken
47 : : long nPos; // Dateiposition (SW2-Format)
48 : : public:
49 : : String aShort; // Short name
50 : : String aLong; // Long name
51 : : rtl::OUString aPackageName; // Package name
52 : : sal_Bool bIsOnlyTxtFlagInit : 1; // ist das Flag gueltig?
53 : : sal_Bool bIsOnlyTxt : 1; // unformatted text
54 : : sal_Bool bInPutMuchBlocks : 1; // put serveral block entries
55 : :
56 : : SwBlockName( const String& rShort, const String& rLong, long n );
57 : : SwBlockName( const String& rShort, const String& rLong, const String& rPackageName );
58 : :
59 : : // fuer das Einsortieren in das Array
60 : : bool operator==( const SwBlockName& r ) const { return aShort == r.aShort; }
61 : 12 : bool operator< ( const SwBlockName& r ) const { return aShort < r.aShort; }
62 : : };
63 : :
64 : 234 : class SwBlockNames : public o3tl::sorted_vector<SwBlockName*, o3tl::less_ptr_to<SwBlockName> > {};
65 : :
66 : :
67 : : class SwImpBlocks
68 : : {
69 : : friend class SwTextBlocks;
70 : : protected:
71 : : String aFile; // physikalischer Dateiname
72 : : String aName; // logischer Name der Datei
73 : : String aCur; // aktueller Text
74 : : String aShort, aLong; // Kurz- und Langname (PutDoc)
75 : : String sBaseURL; // base URL - has to be set at the Readers and Writers
76 : : SwBlockNames aNames; // Liste aller Bausteine
77 : : Date aDateModified; // fuers abgleichen bei den Aktionen
78 : : Time aTimeModified;
79 : : SwDoc* pDoc; // Austauschdokument
80 : : sal_uInt16 nCur; // aktueller Index
81 : : sal_Bool bReadOnly : 1;
82 : : sal_Bool bInPutMuchBlocks : 1; // put serveral block entries
83 : : sal_Bool bInfoChanged : 1; // any Info of TextBlock is changed
84 : :
85 : : SwImpBlocks( const String&, sal_Bool = sal_False );
86 : : virtual ~SwImpBlocks();
87 : :
88 : : static short GetFileType( const String& );
89 : : virtual short GetFileType() const = 0;
90 : : #define SWBLK_NO_FILE 0 // nicht da
91 : : #define SWBLK_NONE 1 // keine TB-Datei
92 : : #define SWBLK_SW2 2 // SW2-Datei
93 : : #define SWBLK_SW3 3 // SW3-Datei
94 : : #define SWBLK_XML 4 // XML Block List
95 : :
96 : : virtual void ClearDoc(); // Doc-Inhalt loeschen
97 : : SwPaM* MakePaM(); // PaM ueber Doc aufspannen
98 : : virtual void AddName( const String&, const String&, sal_Bool bOnlyTxt = sal_False );
99 : : sal_Bool IsFileChanged() const;
100 : : void Touch();
101 : :
102 : : public:
103 : : static sal_uInt16 Hash( const String& ); // Hashcode fuer Blocknamen
104 : : sal_uInt16 GetCount() const; // Anzahl Textbausteine ermitteln
105 : : sal_uInt16 GetIndex( const String& ) const; // Index fuer Kurznamen ermitteln
106 : : sal_uInt16 GetLongIndex( const String& ) const; //Index fuer Langnamen ermitteln
107 : : const String& GetShortName( sal_uInt16 ) const; // Kurzname fuer Index zurueck
108 : : const String& GetLongName( sal_uInt16 ) const; // Langname fuer Index zurueck
109 : : rtl::OUString GetPackageName( sal_uInt16 ) const; // Langname fuer Index zurueck
110 : :
111 : 0 : const String& GetFileName() const {return aFile;} // phys. Dateinamen liefern
112 : 122 : void SetName( const String& rName ) // logic name
113 : 122 : { aName = rName; bInfoChanged = sal_True; }
114 : 46 : const String & GetName( void )
115 : 46 : { return aName; }
116 : :
117 : 2 : const String& GetBaseURL() const { return sBaseURL;}
118 : 14 : void SetBaseURL( const String& rURL ) { sBaseURL = rURL; }
119 : :
120 : : virtual sal_uLong Delete( sal_uInt16 ) = 0;
121 : : virtual sal_uLong Rename( sal_uInt16, const String&, const String& ) = 0;
122 : : virtual sal_uLong CopyBlock( SwImpBlocks& rImp, String& rShort, const String& rLong) = 0;
123 : : virtual sal_uLong GetDoc( sal_uInt16 ) = 0;
124 : : virtual sal_uLong GetDocForConversion( sal_uInt16 );
125 : : virtual sal_uLong BeginPutDoc( const String&, const String& ) = 0;
126 : : virtual sal_uLong PutDoc() = 0;
127 : : virtual sal_uLong GetText( sal_uInt16, String& ) = 0;
128 : : virtual sal_uLong PutText( const String&, const String&, const String& ) = 0;
129 : : virtual sal_uLong MakeBlockList() = 0;
130 : :
131 : : virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True ) = 0;
132 : : virtual void CloseFile() = 0;
133 : :
134 : : virtual sal_Bool IsOnlyTextBlock( const String& rShort ) const;
135 : :
136 : : virtual sal_uLong GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTbl,
137 : : sal_Bool bFileAlreadyOpen = sal_False );
138 : : virtual sal_uLong SetMacroTable( sal_uInt16 nIdx,
139 : : const SvxMacroTableDtor& rMacroTbl,
140 : : sal_Bool bFileAlreadyOpen = sal_False );
141 : : virtual sal_Bool PutMuchEntries( sal_Bool bOn );
142 : : };
143 : :
144 : : #endif
145 : :
146 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|