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

Generated by: LCOV version 1.10