LCOV - code coverage report
Current view: top level - sw/inc - IDocumentRedlineAccess.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 10 10 100.0 %
Date: 2014-11-03 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        5052 : class IDocumentRedlineAccess
      82             : {
      83             :      // Static helper functions
      84             : public:
      85      608856 :     static bool IsShowChanges(const sal_uInt16 eM)
      86      608856 :     { return (nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE) == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
      87             : 
      88         734 :     static bool IsHideChanges(const sal_uInt16 eM)
      89         734 :     { return nsRedlineMode_t::REDLINE_SHOW_INSERT == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
      90             : 
      91        5142 :     static bool IsShowOriginal(const sal_uInt16 eM)
      92        5142 :     { return nsRedlineMode_t::REDLINE_SHOW_DELETE == (eM & nsRedlineMode_t::REDLINE_SHOW_MASK); }
      93             : 
      94      539422 :     static bool IsRedlineOn(const sal_uInt16 eM)
      95      539422 :     { return nsRedlineMode_t::REDLINE_ON == (eM & (nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE )); }
      96             : 
      97             : public:
      98             : 
      99             :     /** Query the currently set redline mode
     100             : 
     101             :         @returns
     102             :         the currently set redline mode
     103             :     */
     104             :      virtual RedlineMode_t GetRedlineMode() const = 0;
     105             : 
     106             :     /** Set a new redline mode.
     107             : 
     108             :         @param eMode
     109             :         [in] the new redline mode.
     110             :     */
     111             :     virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode) = 0;
     112             : 
     113             :     /** Set a new redline mode.
     114             : 
     115             :         @param eMode
     116             :         [in] the new redline mode.
     117             :     */
     118             :     virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode) = 0;
     119             : 
     120             :     /** Query if redlining is on.
     121             : 
     122             :         @returns
     123             :         <TRUE/> if redlining is on <FALSE/> otherwise
     124             :     */
     125             :     virtual bool IsRedlineOn() const = 0;
     126             : 
     127             :     virtual bool IsIgnoreRedline() const = 0;
     128             : 
     129             :     virtual const SwRedlineTbl& GetRedlineTbl() const = 0;
     130             :     virtual SwRedlineTbl& GetRedlineTbl() = 0;
     131             :     virtual const SwExtraRedlineTbl& GetExtraRedlineTbl() const = 0;
     132             :     virtual SwExtraRedlineTbl& GetExtraRedlineTbl() = 0;
     133             :     virtual bool HasExtraRedlineTbl() const = 0;
     134             : 
     135             :     virtual bool IsInRedlines(const SwNode& rNode) const = 0;
     136             : 
     137             :     /** Append a new redline
     138             : 
     139             :         @param pPtr
     140             : 
     141             :         @param bCallDelete
     142             : 
     143             :         @returns
     144             :     */
     145             :     virtual bool AppendRedline(/*[in]*/SwRangeRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
     146             : 
     147             :     virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
     148             :     virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
     149             : 
     150             :     virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) = 0;
     151             : 
     152             :     virtual bool DeleteRedline(
     153             :         /*[in]*/const SwPaM& rPam,
     154             :         /*[in]*/bool bSaveInUndo,
     155             :         /*[in]*/sal_uInt16 nDelType) = 0;
     156             : 
     157             :     virtual bool DeleteRedline(
     158             :         /*[in]*/const SwStartNode& rSection,
     159             :         /*[in]*/bool bSaveInUndo,
     160             :         /*[in]*/sal_uInt16 nDelType) = 0;
     161             : 
     162             :     virtual sal_uInt16 GetRedlinePos(
     163             :         /*[in]*/const SwNode& rNode,
     164             :         /*[in]*/sal_uInt16 nType) const = 0;
     165             : 
     166             :     virtual void CompressRedlines() = 0;
     167             : 
     168             :     virtual const SwRangeRedline* GetRedline(
     169             :         /*[in]*/const SwPosition& rPos,
     170             :         /*[in]*/sal_uInt16* pFndPos) const = 0;
     171             : 
     172             :     virtual bool IsRedlineMove() const = 0;
     173             : 
     174             :     virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0;
     175             : 
     176             :     virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0;
     177             : 
     178             :     virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
     179             : 
     180             :     virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0;
     181             : 
     182             :     virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
     183             : 
     184             :     virtual const SwRangeRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 0;
     185             : 
     186             :     virtual const SwRangeRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const = 0;
     187             : 
     188             :     // Representation has changed, invalidate all Redlines.
     189             :     virtual void UpdateRedlineAttr() = 0;
     190             : 
     191             :     // Create a new Author if required.
     192             :     virtual sal_uInt16 GetRedlineAuthor() = 0;
     193             : 
     194             :     // For Readers etc.: register new Author in table.
     195             :     virtual sal_uInt16 InsertRedlineAuthor(const OUString& rAuthor) = 0;
     196             : 
     197             :     // Place a comment at Redline at given position.
     198             :     virtual bool SetRedlineComment(
     199             :         /*[in]*/const SwPaM& rPam,
     200             :         /*[in]*/const OUString& rComment) = 0;
     201             : 
     202             :     virtual const ::com::sun::star::uno::Sequence <sal_Int8>& GetRedlinePassword() const = 0;
     203             : 
     204             :     virtual void SetRedlinePassword(
     205             :         /*[in]*/const ::com::sun::star::uno::Sequence <sal_Int8>& rNewPassword) = 0;
     206             : 
     207             : protected:
     208        5045 :      virtual ~IDocumentRedlineAccess() {};
     209             : };
     210             : 
     211             : #endif
     212             : 
     213             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10