Files
libreoffice/sw/source/core/inc/swblocks.hxx

149 lines
6.2 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2000-09-18 23:08:29 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 23:08:29 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 23:08:29 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 23:08:29 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 23:08:29 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 23:08:29 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 23:08:29 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 23:08:29 +00:00
*
************************************************************************/
#ifndef _SWBLOCKS_HXX
#define _SWBLOCKS_HXX
#include <tools/string.hxx>
#include <tools/datetime.hxx>
#include <svl/svarray.hxx>
2000-09-18 23:08:29 +00:00
2000-10-31 19:33:20 +00:00
class SfxMedium;
2000-09-18 23:08:29 +00:00
class SwPaM;
class SwDoc;
class SvxMacroTableDtor;
2000-09-18 23:08:29 +00:00
// Name eines Textblocks:
class SwBlockName
{
friend class SwImpBlocks;
friend class Sw2TextBlocks;
sal_uInt16 nHashS, nHashL; // Hash-Codes zum Checken
2000-09-18 23:08:29 +00:00
long nPos; // Dateiposition (SW2-Format)
public:
String aShort; // Short name
String aLong; // Long name
String aPackageName; // Package name
sal_Bool bIsOnlyTxtFlagInit : 1; // ist das Flag gueltig?
sal_Bool bIsOnlyTxt : 1; // unformatted text
sal_Bool bInPutMuchBlocks : 1; // put serveral block entries
2000-09-18 23:08:29 +00:00
SwBlockName( const String& rShort, const String& rLong, long n );
SwBlockName( const String& rShort, const String& rLong, const String& rPackageName );
2000-09-18 23:08:29 +00:00
// fuer das Einsortieren in das Array
int operator==( const SwBlockName& r ) { return aShort == r.aShort; }
int operator< ( const SwBlockName& r ) { return aShort < r.aShort; }
};
SV_DECL_PTRARR_SORT( SwBlockNames, SwBlockName*, 10 )
2000-09-18 23:08:29 +00:00
class SwImpBlocks
{
friend class SwTextBlocks;
protected:
String aFile; // physikalischer Dateiname
String aName; // logischer Name der Datei
String aCur; // aktueller Text
String aShort, aLong; // Kurz- und Langname (PutDoc)
String sBaseURL; // base URL - has to be set at the Readers and Writers
2000-09-18 23:08:29 +00:00
SwBlockNames aNames; // Liste aller Bausteine
Date aDateModified; // fuers abgleichen bei den Aktionen
Time aTimeModified;
SwDoc* pDoc; // Austauschdokument
sal_uInt16 nCur; // aktueller Index
sal_Bool bReadOnly : 1;
sal_Bool bInPutMuchBlocks : 1; // put serveral block entries
sal_Bool bInfoChanged : 1; // any Info of TextBlock is changed
2000-09-18 23:08:29 +00:00
SwImpBlocks( const String&, sal_Bool = sal_False );
2000-09-18 23:08:29 +00:00
virtual ~SwImpBlocks();
static short GetFileType( const String& );
virtual short GetFileType() const = 0;
2000-09-18 23:08:29 +00:00
#define SWBLK_NO_FILE 0 // nicht da
#define SWBLK_NONE 1 // keine TB-Datei
#define SWBLK_SW2 2 // SW2-Datei
#define SWBLK_SW3 3 // SW3-Datei
#define SWBLK_XML 4 // XML Block List
2000-09-18 23:08:29 +00:00
2001-04-30 18:58:27 +00:00
virtual void ClearDoc(); // Doc-Inhalt loeschen
2000-09-18 23:08:29 +00:00
SwPaM* MakePaM(); // PaM ueber Doc aufspannen
virtual void AddName( const String&, const String&, sal_Bool bOnlyTxt = sal_False );
sal_Bool IsFileChanged() const;
2000-09-18 23:08:29 +00:00
void Touch();
public:
static sal_uInt16 Hash( const String& ); // Hashcode fuer Blocknamen
sal_uInt16 GetCount() const; // Anzahl Textbausteine ermitteln
sal_uInt16 GetIndex( const String& ) const; // Index fuer Kurznamen ermitteln
sal_uInt16 GetLongIndex( const String& ) const; //Index fuer Langnamen ermitteln
const String& GetShortName( sal_uInt16 ) const; // Kurzname fuer Index zurueck
const String& GetLongName( sal_uInt16 ) const; // Langname fuer Index zurueck
const String& GetPackageName( sal_uInt16 ) const; // Langname fuer Index zurueck
2000-09-18 23:08:29 +00:00
const String& GetFileName() const {return aFile;} // phys. Dateinamen liefern
void SetName( const String& rName ) // logic name
{ aName = rName; bInfoChanged = sal_True; }
const String & GetName( void )
{ return aName; }
2000-09-18 23:08:29 +00:00
const String& GetBaseURL() const { return sBaseURL;}
void SetBaseURL( const String& rURL ) { sBaseURL = rURL; }
virtual sal_uLong Delete( sal_uInt16 ) = 0;
virtual sal_uLong Rename( sal_uInt16, const String&, const String& ) = 0;
virtual sal_uLong CopyBlock( SwImpBlocks& rImp, String& rShort, const String& rLong) = 0;
virtual sal_uLong GetDoc( sal_uInt16 ) = 0;
virtual sal_uLong GetDocForConversion( sal_uInt16 );
virtual sal_uLong BeginPutDoc( const String&, const String& ) = 0;
virtual sal_uLong PutDoc() = 0;
virtual sal_uLong GetText( sal_uInt16, String& ) = 0;
virtual sal_uLong PutText( const String&, const String&, const String& ) = 0;
virtual sal_uLong MakeBlockList() = 0;
virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True ) = 0;
2000-09-18 23:08:29 +00:00
virtual void CloseFile() = 0;
virtual sal_Bool IsOnlyTextBlock( const String& rShort ) const;
2000-09-18 23:08:29 +00:00
virtual sal_uLong GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTbl,
sal_Bool bFileAlreadyOpen = sal_False );
virtual sal_uLong SetMacroTable( sal_uInt16 nIdx,
const SvxMacroTableDtor& rMacroTbl,
sal_Bool bFileAlreadyOpen = sal_False );
virtual sal_Bool PutMuchEntries( sal_Bool bOn );
2000-09-18 23:08:29 +00:00
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */