LCOV - code coverage report
Current view: top level - sw/inc - IDocumentRedlineAccess.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 8 10 80.0 %
Date: 2012-08-25 Functions: 5 7 71.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

           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                 :            : 
      29                 :            :  #ifndef IDOCUMENTREDLINE_HXX_INCLUDED
      30                 :            :  #define IDOCUMENTREDLINE_HXX_INCLUDED
      31                 :            : 
      32                 :            :  #ifndef _SAL_TYPES_H_
      33                 :            :  #include <sal/types.h>
      34                 :            :  #endif
      35                 :            :  #ifndef _SOLAR_H
      36                 :            :  #include <tools/solar.h>
      37                 :            :  #endif
      38                 :            : 
      39                 :            :  #include <limits.h> // USHRT_MAX
      40                 :            : 
      41                 :            :  #ifndef _COM_SUN_STAR_SEQUENCE_HXX_
      42                 :            :  #include <com/sun/star/uno/Sequence.hxx>
      43                 :            :  #endif
      44                 :            : 
      45                 :            :  class SwRedline;
      46                 :            :  class SwRedlineTbl;
      47                 :            :  class SwPaM;
      48                 :            :  struct SwPosition;
      49                 :            :  class SwStartNode;
      50                 :            :  class SwNode;
      51                 :            :  class String;
      52                 :            : 
      53                 :            : typedef sal_uInt16 RedlineMode_t;
      54                 :            : namespace nsRedlineMode_t
      55                 :            : {
      56                 :            :     const RedlineMode_t REDLINE_NONE = 0; ///< no RedlineMode
      57                 :            :     const RedlineMode_t REDLINE_ON = 0x01;///< RedlineMode on
      58                 :            :     const RedlineMode_t REDLINE_IGNORE = 0x02;///< ignore Redlines
      59                 :            :     const RedlineMode_t REDLINE_SHOW_INSERT = 0x10;///< show all inserts
      60                 :            :     const RedlineMode_t REDLINE_SHOW_DELETE = 0x20;///< show all deletes
      61                 :            :     const RedlineMode_t REDLINE_SHOW_MASK = REDLINE_SHOW_INSERT | REDLINE_SHOW_DELETE;
      62                 :            : 
      63                 :            :     // For internal management:
      64                 :            :     // remove the original Redlines together with their content
      65                 :            :     // (Clipboard/text modules).
      66                 :            :     const RedlineMode_t REDLINE_DELETE_REDLINES = 0x100;
      67                 :            :     // When deleting within a RedlineObject
      68                 :            :     // ignore the DeleteRedline during Append.
      69                 :            :     const RedlineMode_t REDLINE_IGNOREDELETE_REDLINES = 0x200;
      70                 :            :     // don't combine any redlines. This flag may be only used in Undo.
      71                 :            :     const RedlineMode_t REDLINE_DONTCOMBINE_REDLINES = 0x400;
      72                 :            : }
      73                 :            : 
      74                 :            : typedef sal_uInt16 RedlineType_t;
      75                 :            : namespace nsRedlineType_t
      76                 :            : {
      77                 :            :     // Range of RedlineTypes is 0 to 127.
      78                 :            :     const RedlineType_t REDLINE_INSERT = 0x0;// Content has been inserted.
      79                 :            :     const RedlineType_t REDLINE_DELETE = 0x1;// Content has been deleted.
      80                 :            :     const RedlineType_t REDLINE_FORMAT = 0x2;// Attributes have been applied.
      81                 :            :     const RedlineType_t REDLINE_TABLE = 0x3;// Table structure has been altered.
      82                 :            :     const RedlineType_t REDLINE_FMTCOLL = 0x4;// Style has been altered (Autoformat!).
      83                 :            : 
      84                 :            :     // When larger than 128, flags can be inserted.
      85                 :            :     const RedlineType_t REDLINE_NO_FLAG_MASK = 0x7F;
      86                 :            :     const RedlineType_t REDLINE_FORM_AUTOFMT = 0x80;// Can be a flag in RedlineType.
      87                 :            : }
      88                 :            : 
      89                 :            : /** IDocumentRedlineAccess
      90                 :            : */
      91                 :       1549 : class IDocumentRedlineAccess
      92                 :            : {
      93                 :            :      // Static helper functions
      94                 :            : public:
      95                 :     141255 :     static bool IsShowChanges(const sal_uInt16 eM)
      96                 :     141255 :     { return (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
      97                 :            : 
      98                 :          0 :     static bool IsHideChanges(const sal_uInt16 eM)
      99                 :          0 :     { return nsRedlineMode_t::REDLINE_SHOW_INSERT == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
     100                 :            : 
     101                 :       2334 :     static bool IsShowOriginal(const sal_uInt16 eM)
     102                 :       2334 :     { return nsRedlineMode_t::REDLINE_SHOW_DELETE == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
     103                 :            : 
     104                 :     186559 :     static bool IsRedlineOn(const sal_uInt16 eM)
     105                 :     186559 :     { return nsRedlineMode_t::REDLINE_ON == (eM & (nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE )); }
     106                 :            : 
     107                 :            : public:
     108                 :            : 
     109                 :            :     /*************************************************
     110                 :            :         Query
     111                 :            :     *************************************************/
     112                 :            : 
     113                 :            :     /** Query the currently set redline mode
     114                 :            : 
     115                 :            :         @returns
     116                 :            :         the currently set redline mode
     117                 :            :     */
     118                 :            :      virtual RedlineMode_t GetRedlineMode() const = 0;
     119                 :            : 
     120                 :            :     /** Set a new redline mode.
     121                 :            : 
     122                 :            :         @param eMode
     123                 :            :         [in] the new redline mode.
     124                 :            :     */
     125                 :            :     virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode) = 0;
     126                 :            : 
     127                 :            :     /** Set a new redline mode.
     128                 :            : 
     129                 :            :         @param eMode
     130                 :            :         [in] the new redline mode.
     131                 :            :     */
     132                 :            :     virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode) = 0;
     133                 :            : 
     134                 :            :     /** Query if redlining is on.
     135                 :            : 
     136                 :            :         @returns
     137                 :            :         <TRUE/> if redlining is on <FALSE/> otherwise
     138                 :            :     */
     139                 :            :     virtual bool IsRedlineOn() const = 0;
     140                 :            : 
     141                 :            :     virtual bool IsIgnoreRedline() const = 0;
     142                 :            : 
     143                 :            :     virtual const SwRedlineTbl& GetRedlineTbl() const = 0;
     144                 :            : 
     145                 :            :     virtual bool IsInRedlines(const SwNode& rNode) const = 0;
     146                 :            : 
     147                 :            :     /***************************************************
     148                 :            :         Manipulation
     149                 :            :      ***************************************************/
     150                 :            : 
     151                 :            :     /** Append a new redline
     152                 :            : 
     153                 :            :         @param pPtr
     154                 :            : 
     155                 :            :         @param bCallDelete
     156                 :            : 
     157                 :            :         @returns
     158                 :            :     */
     159                 :            :     virtual bool AppendRedline(/*[in]*/SwRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
     160                 :            : 
     161                 :            :     virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) = 0;
     162                 :            : 
     163                 :            :     virtual bool DeleteRedline(
     164                 :            :         /*[in]*/const SwPaM& rPam,
     165                 :            :         /*[in]*/bool bSaveInUndo,
     166                 :            :         /*[in]*/sal_uInt16 nDelType) = 0;
     167                 :            : 
     168                 :            :     virtual bool DeleteRedline(
     169                 :            :         /*[in]*/const SwStartNode& rSection,
     170                 :            :         /*[in]*/bool bSaveInUndo,
     171                 :            :         /*[in]*/sal_uInt16 nDelType) = 0;
     172                 :            : 
     173                 :            :     virtual sal_uInt16 GetRedlinePos(
     174                 :            :         /*[in]*/const SwNode& rNode,
     175                 :            :         /*[in]*/sal_uInt16 nType) const = 0;
     176                 :            : 
     177                 :            :     virtual void CompressRedlines() = 0;
     178                 :            : 
     179                 :            :     virtual const SwRedline* GetRedline(
     180                 :            :         /*[in]*/const SwPosition& rPos,
     181                 :            :         /*[in]*/sal_uInt16* pFndPos) const = 0;
     182                 :            : 
     183                 :            :     virtual bool IsRedlineMove() const = 0;
     184                 :            : 
     185                 :            :     virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0;
     186                 :            : 
     187                 :            :     virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0;
     188                 :            : 
     189                 :            :     virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
     190                 :            : 
     191                 :            :     virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0;
     192                 :            : 
     193                 :            :     virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
     194                 :            : 
     195                 :            :     virtual const SwRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 0;
     196                 :            : 
     197                 :            :     virtual const SwRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const = 0;
     198                 :            : 
     199                 :            :     // Representation has changed, invalidate all Redlines.
     200                 :            :     virtual void UpdateRedlineAttr() = 0;
     201                 :            : 
     202                 :            :     // Create a new Author if required.
     203                 :            :     virtual sal_uInt16 GetRedlineAuthor() = 0;
     204                 :            : 
     205                 :            :     // For Readers etc.: register new Author in table.
     206                 :            :     virtual sal_uInt16 InsertRedlineAuthor(const String& rAuthor) = 0;
     207                 :            : 
     208                 :            :     // Place a comment at Redline at given position.
     209                 :            :     virtual bool SetRedlineComment(
     210                 :            :         /*[in]*/const SwPaM& rPam,
     211                 :            :         /*[in]*/const String& rComment) = 0;
     212                 :            : 
     213                 :            :     virtual const ::com::sun::star::uno::Sequence <sal_Int8>& GetRedlinePassword() const = 0;
     214                 :            : 
     215                 :            :     virtual void SetRedlinePassword(
     216                 :            :         /*[in]*/const ::com::sun::star::uno::Sequence <sal_Int8>& rNewPassword) = 0;
     217                 :            : 
     218                 :            :  protected:
     219         [ -  + ]:       1458 :      virtual ~IDocumentRedlineAccess() {};
     220                 :            :  };
     221                 :            : 
     222                 :            :  #endif
     223                 :            : 
     224                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10