LCOV - code coverage report
Current view: top level - sw/source/core/inc - swblocks.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 9 10 90.0 %
Date: 2014-04-11 Functions: 8 9 88.9 %
Legend: Lines: hit not hit

          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             : #ifndef INCLUDED_SW_SOURCE_CORE_INC_SWBLOCKS_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_INC_SWBLOCKS_HXX
      21             : 
      22             : #include <tools/datetime.hxx>
      23             : #include <o3tl/sorted_vector.hxx>
      24             : 
      25             : class SwPaM;
      26             : class SwDoc;
      27             : class SvxMacroTableDtor;
      28             : 
      29             : // Name eines Textblocks:
      30             : 
      31          41 : class SwBlockName
      32             : {
      33             :     friend class SwImpBlocks;
      34             :     sal_uInt16 nHashS, nHashL;          // Hash-Codes zum Checken
      35             : public:
      36             :     OUString aShort;                    // Short name
      37             :     OUString aLong;                     // Long name
      38             :     OUString aPackageName;         // Package name
      39             :     sal_Bool bIsOnlyTxtFlagInit : 1;        // ist das Flag gueltig?
      40             :     sal_Bool bIsOnlyTxt : 1;                // unformatted text
      41             :     sal_Bool bInPutMuchBlocks : 1;          // put serveral block entries
      42             : 
      43             :     SwBlockName( const OUString& rShort, const OUString& rLong );
      44             :     SwBlockName( const OUString& rShort, const OUString& rLong, const OUString& rPackageName );
      45             : 
      46             :     // fuer das Einsortieren in das Array
      47             :     bool operator==( const SwBlockName& r ) const { return aShort == r.aShort; }
      48           6 :     bool operator< ( const SwBlockName& r ) const { return aShort <  r.aShort; }
      49             : };
      50             : 
      51         117 : class SwBlockNames : public o3tl::sorted_vector<SwBlockName*, o3tl::less_ptr_to<SwBlockName> > {};
      52             : 
      53             : class SwImpBlocks
      54             : {
      55             :     friend class SwTextBlocks;
      56             : protected:
      57             :     OUString aFile;                     // physikalischer Dateiname
      58             :     OUString aName;                     // logischer Name der Datei
      59             :     OUString aCur;                      // aktueller Text
      60             :     OUString aShort, aLong;             // Kurz- und Langname (PutDoc)
      61             :     OUString sBaseURL;                  // base URL - has to be set at the Readers and Writers
      62             :     SwBlockNames aNames;                // Liste aller Bausteine
      63             :     Date aDateModified;                 // fuers abgleichen bei den Aktionen
      64             :     Time aTimeModified;
      65             :     SwDoc* pDoc;                        // Austauschdokument
      66             :     sal_uInt16 nCur;                        // aktueller Index
      67             :     sal_Bool bReadOnly : 1;
      68             :     sal_Bool bInPutMuchBlocks : 1;          // put serveral block entries
      69             :     sal_Bool bInfoChanged : 1;              // any Info of TextBlock is changed
      70             : 
      71             :     SwImpBlocks( const OUString&, sal_Bool = sal_False );
      72             :     virtual ~SwImpBlocks();
      73             : 
      74             :     static short GetFileType( const OUString& );
      75             :     virtual short GetFileType() const = 0;
      76             : #define SWBLK_NO_FILE   0               // nicht da
      77             : #define SWBLK_NONE      1               // keine TB-Datei
      78             : #define SWBLK_SW2       2               // SW2-Datei
      79             : #define SWBLK_SW3       3               // SW3-Datei
      80             : #define SWBLK_XML       4               // XML Block List
      81             : 
      82             :     virtual void   ClearDoc();                  // Doc-Inhalt loeschen
      83             :     SwPaM* MakePaM();                   // PaM ueber Doc aufspannen
      84             :     virtual void   AddName( const OUString&, const OUString&, sal_Bool bOnlyTxt = sal_False );
      85             :     sal_Bool   IsFileChanged() const;
      86             :     void   Touch();
      87             : 
      88             : public:
      89             :     static sal_uInt16 Hash( const OUString& );      // Hashcode fuer Blocknamen
      90             :     sal_uInt16 GetCount() const;                    // Anzahl Textbausteine ermitteln
      91             :     sal_uInt16 GetIndex( const OUString& ) const;     // Index fuer Kurznamen ermitteln
      92             :     sal_uInt16 GetLongIndex( const OUString& ) const; //Index fuer Langnamen ermitteln
      93             :     OUString GetShortName( sal_uInt16 ) const;     // Kurzname fuer Index zurueck
      94             :     OUString GetLongName( sal_uInt16 ) const;      // Langname fuer Index zurueck
      95             :     OUString GetPackageName( sal_uInt16 ) const;   // Langname fuer Index zurueck
      96             : 
      97           0 :     OUString GetFileName() const {return aFile;}   // phys. Dateinamen liefern
      98          61 :     void SetName( const OUString& rName )          // logic name
      99          61 :         { aName = rName; bInfoChanged = sal_True; }
     100          23 :     OUString GetName( void )
     101          23 :         { return aName; }
     102             : 
     103           1 :     OUString            GetBaseURL() const { return sBaseURL;}
     104           7 :     void                SetBaseURL( const OUString& rURL ) { sBaseURL = rURL; }
     105             : 
     106             :     virtual sal_uLong Delete( sal_uInt16 ) = 0;
     107             :     virtual sal_uLong Rename( sal_uInt16, const OUString&, const OUString& ) = 0;
     108             :     virtual sal_uLong CopyBlock( SwImpBlocks& rImp, OUString& rShort, const OUString& rLong) = 0;
     109             :     virtual sal_uLong GetDoc( sal_uInt16 ) = 0;
     110             :     virtual sal_uLong BeginPutDoc( const OUString&, const OUString& ) = 0;
     111             :     virtual sal_uLong PutDoc() = 0;
     112             :     virtual sal_uLong GetText( sal_uInt16, OUString& ) = 0;
     113             :     virtual sal_uLong PutText( const OUString&, const OUString&, const OUString& ) = 0;
     114             :     virtual sal_uLong MakeBlockList() = 0;
     115             : 
     116             :     virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True ) = 0;
     117             :     virtual void  CloseFile() = 0;
     118             : 
     119             :     virtual sal_Bool IsOnlyTextBlock( const OUString& rShort ) const;
     120             : 
     121             :     virtual sal_uLong GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTbl,
     122             :                                  sal_Bool bFileAlreadyOpen = sal_False );
     123             :     virtual sal_uLong SetMacroTable( sal_uInt16 nIdx,
     124             :                                  const SvxMacroTableDtor& rMacroTbl,
     125             :                                  sal_Bool bFileAlreadyOpen = sal_False );
     126             :     virtual sal_Bool PutMuchEntries( sal_Bool bOn );
     127             : };
     128             : 
     129             : #endif
     130             : 
     131             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10