2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-10-11 07:44:04 +00:00
|
|
|
|
2014-05-30 23:30:03 +00:00
|
|
|
#ifndef INCLUDED_SW_INC_IDOCUMENTREDLINEACCESS_HXX
|
|
|
|
#define INCLUDED_SW_INC_IDOCUMENTREDLINEACCESS_HXX
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2017-03-16 18:22:54 +01:00
|
|
|
#include <sal/config.h>
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
|
2014-05-30 23:30:03 +00:00
|
|
|
#include <sal/types.h>
|
|
|
|
#include <tools/solar.h>
|
2014-02-20 10:48:55 +01:00
|
|
|
|
2014-05-30 23:30:03 +00:00
|
|
|
#include <limits.h>
|
2014-02-20 10:48:55 +01:00
|
|
|
|
2014-05-30 23:30:03 +00:00
|
|
|
#include <com/sun/star/uno/Sequence.hxx>
|
2016-09-07 13:10:40 +02:00
|
|
|
#include <o3tl/typed_flags_set.hxx>
|
2006-08-14 14:13:15 +00:00
|
|
|
|
Complete the transition of SwRedlineTable::size_type
...from 9ca8a63fff65acf2ea13b391495ad232f4636548 "Use consistent integer types
in the SwRedlineTable interface". This all started as an attempt to reduce the
number of places a to-be-committed improved loplugin:loopvartoosmall complains
about. Lets see where it ends...
SwRedlineTable::size_type is now the size_type of the underlying std::vector, no
longer sal_uInt16 from ancient times. I tried hard to find all places that are
affected by this change, changing types of affected variables and non-static
data members as needed. Some notes:
* The original code used USHRT_MAX as a "not found" value. I replaced that with
a new SwRedlineTable::npos, of type SwRedlineTable::size_type but still for
now of value USHRT_MAX. This should eventually be changed to something more
sensible, like std::numeric_limits<SwRedlineTable::size_type>::max() (which is
best done after we have constexpr support in all toolchains, so that npos can
be constexpr). It is important that the value of npos is towards positive
infinity, as many places in the code use
for (i = f(); // may return npos
i < table.size(); ++i)
table[i] ...
* There are some borders where values of SwRedlineTable::size_type are converted
into different types, for various reasons. But all of those other types
should be large enough for practical purposes (at least 32 bits wide):
MakrEntry::m_nIdx: long int
SvxRedlinTable::InsertEntry: sal_uIntPtr nPos
SwRangeRedline: size_t
SwRedlineItr: sal_Int32
SwVbaRevision::GetPosition: sal_Int32
SwXRedlines: sal_Int32
* .uno:TrackedChangeIndex= transports textual representations of such values.
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx treats them purely as
strings, while SwTiledRenderingTest converts them to int.
* TODO: The one place I'm unsure about is SfxUInt16Items with IDs
FN_REDLINE_ACCEPT_DIRECT, FN_REDLINE_REJECT_DIRECT, and FN_REDLINE_NEXT_CHANGE
in sw/source/uibase/uiview/view2.cxx. For now, I kept those as
SfxUInt16Items and take care to "map" USHRT_MAX to npos when reading from
those items. But I have no idea where instances of those items would actually
be created, and what it would mean to change those items' types?
Change-Id: Ib7a14dc67e2b970766966e43f4732abd9f045ff8
Reviewed-on: https://gerrit.libreoffice.org/34775
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-02 08:35:18 +01:00
|
|
|
#include <docary.hxx>
|
|
|
|
|
2014-05-30 23:30:03 +00:00
|
|
|
class SwRangeRedline;
|
|
|
|
class SwTableRowRedline;
|
|
|
|
class SwTableCellRedline;
|
2015-05-20 13:05:49 +02:00
|
|
|
class SwRedlineTable;
|
|
|
|
class SwExtraRedlineTable;
|
2014-05-30 23:30:03 +00:00
|
|
|
class SwPaM;
|
|
|
|
struct SwPosition;
|
|
|
|
class SwStartNode;
|
|
|
|
class SwNode;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2016-09-07 13:10:40 +02:00
|
|
|
enum class RedlineFlags
|
2007-09-27 06:53:53 +00:00
|
|
|
{
|
2016-09-07 13:10:40 +02:00
|
|
|
NONE = 0x000, ///< no RedlineFlags
|
|
|
|
On = 0x001, ///< RedlineFlags on
|
|
|
|
Ignore = 0x002, ///< ignore Redlines
|
|
|
|
ShowInsert = 0x010, ///< show all inserts
|
|
|
|
ShowDelete = 0x020, ///< show all deletes
|
|
|
|
ShowMask = ShowInsert | ShowDelete,
|
2007-09-27 06:53:53 +00:00
|
|
|
|
2011-01-08 02:37:47 +01:00
|
|
|
// For internal management:
|
|
|
|
// remove the original Redlines together with their content
|
|
|
|
// (Clipboard/text modules).
|
2016-09-07 13:10:40 +02:00
|
|
|
DeleteRedlines = 0x100,
|
2011-01-08 02:37:47 +01:00
|
|
|
// When deleting within a RedlineObject
|
|
|
|
// ignore the DeleteRedline during Append.
|
2016-09-07 13:10:40 +02:00
|
|
|
IgnoreDeleteRedlines = 0x200,
|
2011-01-08 02:37:47 +01:00
|
|
|
// don't combine any redlines. This flag may be only used in Undo.
|
2016-09-07 13:10:40 +02:00
|
|
|
DontCombineRedlines = 0x400,
|
|
|
|
};
|
|
|
|
namespace o3tl
|
|
|
|
{
|
|
|
|
template<> struct typed_flags<RedlineFlags> : is_typed_flags<RedlineFlags, 0x733> {};
|
2007-09-27 06:53:53 +00:00
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
typedef sal_uInt16 RedlineType_t;
|
2007-09-27 06:53:53 +00:00
|
|
|
namespace nsRedlineType_t
|
|
|
|
{
|
2011-01-08 02:37:47 +01:00
|
|
|
// Range of RedlineTypes is 0 to 127.
|
|
|
|
const RedlineType_t REDLINE_INSERT = 0x0;// Content has been inserted.
|
|
|
|
const RedlineType_t REDLINE_DELETE = 0x1;// Content has been deleted.
|
|
|
|
const RedlineType_t REDLINE_FORMAT = 0x2;// Attributes have been applied.
|
|
|
|
const RedlineType_t REDLINE_TABLE = 0x3;// Table structure has been altered.
|
|
|
|
const RedlineType_t REDLINE_FMTCOLL = 0x4;// Style has been altered (Autoformat!).
|
2014-02-03 17:44:22 +02:00
|
|
|
const RedlineType_t REDLINE_PARAGRAPH_FORMAT = 0x5;// Paragraph attributes have been changed.
|
|
|
|
const RedlineType_t REDLINE_TABLE_ROW_INSERT = 0x6;// Table row has been inserted.
|
|
|
|
const RedlineType_t REDLINE_TABLE_ROW_DELETE = 0x7;// Table row has been deleted.
|
2014-02-05 13:37:45 +02:00
|
|
|
const RedlineType_t REDLINE_TABLE_CELL_INSERT = 0x8;// Table cell has been inserted.
|
|
|
|
const RedlineType_t REDLINE_TABLE_CELL_DELETE = 0x9;// Table cell has been deleted.
|
2011-01-08 02:37:47 +01:00
|
|
|
|
|
|
|
// When larger than 128, flags can be inserted.
|
2007-09-27 06:53:53 +00:00
|
|
|
const RedlineType_t REDLINE_NO_FLAG_MASK = 0x7F;
|
2011-01-08 02:37:47 +01:00
|
|
|
const RedlineType_t REDLINE_FORM_AUTOFMT = 0x80;// Can be a flag in RedlineType.
|
2017-03-03 14:57:39 +05:30
|
|
|
|
|
|
|
inline OUString SwRedlineTypeToOUString(RedlineType_t eType)
|
|
|
|
{
|
|
|
|
OUString sRet;
|
|
|
|
switch(eType & nsRedlineType_t::REDLINE_NO_FLAG_MASK)
|
|
|
|
{
|
|
|
|
case nsRedlineType_t::REDLINE_INSERT: sRet = "Insert"; break;
|
|
|
|
case nsRedlineType_t::REDLINE_DELETE: sRet = "Delete"; break;
|
|
|
|
case nsRedlineType_t::REDLINE_FORMAT: sRet = "Format"; break;
|
|
|
|
case nsRedlineType_t::REDLINE_PARAGRAPH_FORMAT: sRet = "ParagraphFormat"; break;
|
|
|
|
case nsRedlineType_t::REDLINE_TABLE: sRet = "TextTable"; break;
|
|
|
|
case nsRedlineType_t::REDLINE_FMTCOLL:sRet = "Style"; break;
|
|
|
|
}
|
|
|
|
return sRet;
|
|
|
|
}
|
2007-09-27 06:53:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class IDocumentRedlineAccess
|
|
|
|
{
|
|
|
|
// Static helper functions
|
2006-08-14 14:13:15 +00:00
|
|
|
public:
|
2016-09-07 13:10:40 +02:00
|
|
|
static bool IsShowChanges(const RedlineFlags eM)
|
|
|
|
{ return (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete) == (eM & RedlineFlags::ShowMask); }
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2016-09-07 13:10:40 +02:00
|
|
|
static bool IsHideChanges(const RedlineFlags eM)
|
|
|
|
{ return RedlineFlags::ShowInsert == (eM & RedlineFlags::ShowMask); }
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2016-09-07 13:10:40 +02:00
|
|
|
static bool IsShowOriginal(const RedlineFlags eM)
|
|
|
|
{ return RedlineFlags::ShowDelete == (eM & RedlineFlags::ShowMask); }
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2016-09-07 13:10:40 +02:00
|
|
|
static bool IsRedlineOn(const RedlineFlags eM)
|
|
|
|
{ return RedlineFlags::On == (eM & (RedlineFlags::On | RedlineFlags::Ignore )); }
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2007-09-27 06:53:53 +00:00
|
|
|
public:
|
2006-08-14 14:13:15 +00:00
|
|
|
|
|
|
|
/** Query the currently set redline mode
|
|
|
|
|
|
|
|
@returns
|
|
|
|
the currently set redline mode
|
|
|
|
*/
|
2016-09-07 13:10:40 +02:00
|
|
|
virtual RedlineFlags GetRedlineFlags() const = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
|
|
|
/** Set a new redline mode.
|
|
|
|
|
|
|
|
@param eMode
|
|
|
|
[in] the new redline mode.
|
|
|
|
*/
|
2016-09-07 13:10:40 +02:00
|
|
|
virtual void SetRedlineFlags_intern(/*[in]*/RedlineFlags eMode) = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
|
|
|
/** Set a new redline mode.
|
|
|
|
|
|
|
|
@param eMode
|
|
|
|
[in] the new redline mode.
|
|
|
|
*/
|
2016-09-07 13:10:40 +02:00
|
|
|
virtual void SetRedlineFlags(/*[in]*/RedlineFlags eMode) = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
|
|
|
/** Query if redlining is on.
|
|
|
|
|
|
|
|
@returns
|
2011-02-07 16:48:14 +01:00
|
|
|
<TRUE/> if redlining is on <FALSE/> otherwise
|
2006-08-14 14:13:15 +00:00
|
|
|
*/
|
|
|
|
virtual bool IsRedlineOn() const = 0;
|
|
|
|
|
|
|
|
virtual bool IsIgnoreRedline() const = 0;
|
|
|
|
|
2015-05-20 13:05:49 +02:00
|
|
|
virtual const SwRedlineTable& GetRedlineTable() const = 0;
|
|
|
|
virtual SwRedlineTable& GetRedlineTable() = 0;
|
|
|
|
virtual const SwExtraRedlineTable& GetExtraRedlineTable() const = 0;
|
|
|
|
virtual SwExtraRedlineTable& GetExtraRedlineTable() = 0;
|
|
|
|
virtual bool HasExtraRedlineTable() const = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2011-01-08 02:37:47 +01:00
|
|
|
virtual bool IsInRedlines(const SwNode& rNode) const = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
|
|
|
/** Append a new redline
|
|
|
|
|
|
|
|
@param pPtr
|
|
|
|
|
|
|
|
@param bCallDelete
|
|
|
|
|
|
|
|
@returns
|
|
|
|
*/
|
2014-01-13 17:58:25 +02:00
|
|
|
virtual bool AppendRedline(/*[in]*/SwRangeRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2014-02-03 17:44:22 +02:00
|
|
|
virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
|
2014-02-05 13:37:45 +02:00
|
|
|
virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
|
2014-02-03 17:44:22 +02:00
|
|
|
|
2006-08-14 14:13:15 +00:00
|
|
|
virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) = 0;
|
|
|
|
|
|
|
|
virtual bool DeleteRedline(
|
|
|
|
/*[in]*/const SwPaM& rPam,
|
|
|
|
/*[in]*/bool bSaveInUndo,
|
|
|
|
/*[in]*/sal_uInt16 nDelType) = 0;
|
|
|
|
|
|
|
|
virtual bool DeleteRedline(
|
|
|
|
/*[in]*/const SwStartNode& rSection,
|
|
|
|
/*[in]*/bool bSaveInUndo,
|
|
|
|
/*[in]*/sal_uInt16 nDelType) = 0;
|
|
|
|
|
Complete the transition of SwRedlineTable::size_type
...from 9ca8a63fff65acf2ea13b391495ad232f4636548 "Use consistent integer types
in the SwRedlineTable interface". This all started as an attempt to reduce the
number of places a to-be-committed improved loplugin:loopvartoosmall complains
about. Lets see where it ends...
SwRedlineTable::size_type is now the size_type of the underlying std::vector, no
longer sal_uInt16 from ancient times. I tried hard to find all places that are
affected by this change, changing types of affected variables and non-static
data members as needed. Some notes:
* The original code used USHRT_MAX as a "not found" value. I replaced that with
a new SwRedlineTable::npos, of type SwRedlineTable::size_type but still for
now of value USHRT_MAX. This should eventually be changed to something more
sensible, like std::numeric_limits<SwRedlineTable::size_type>::max() (which is
best done after we have constexpr support in all toolchains, so that npos can
be constexpr). It is important that the value of npos is towards positive
infinity, as many places in the code use
for (i = f(); // may return npos
i < table.size(); ++i)
table[i] ...
* There are some borders where values of SwRedlineTable::size_type are converted
into different types, for various reasons. But all of those other types
should be large enough for practical purposes (at least 32 bits wide):
MakrEntry::m_nIdx: long int
SvxRedlinTable::InsertEntry: sal_uIntPtr nPos
SwRangeRedline: size_t
SwRedlineItr: sal_Int32
SwVbaRevision::GetPosition: sal_Int32
SwXRedlines: sal_Int32
* .uno:TrackedChangeIndex= transports textual representations of such values.
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx treats them purely as
strings, while SwTiledRenderingTest converts them to int.
* TODO: The one place I'm unsure about is SfxUInt16Items with IDs
FN_REDLINE_ACCEPT_DIRECT, FN_REDLINE_REJECT_DIRECT, and FN_REDLINE_NEXT_CHANGE
in sw/source/uibase/uiview/view2.cxx. For now, I kept those as
SfxUInt16Items and take care to "map" USHRT_MAX to npos when reading from
those items. But I have no idea where instances of those items would actually
be created, and what it would mean to change those items' types?
Change-Id: Ib7a14dc67e2b970766966e43f4732abd9f045ff8
Reviewed-on: https://gerrit.libreoffice.org/34775
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-02 08:35:18 +01:00
|
|
|
virtual SwRedlineTable::size_type GetRedlinePos(
|
2006-08-14 14:13:15 +00:00
|
|
|
/*[in]*/const SwNode& rNode,
|
|
|
|
/*[in]*/sal_uInt16 nType) const = 0;
|
|
|
|
|
|
|
|
virtual void CompressRedlines() = 0;
|
|
|
|
|
2014-01-13 17:58:25 +02:00
|
|
|
virtual const SwRangeRedline* GetRedline(
|
2006-08-14 14:13:15 +00:00
|
|
|
/*[in]*/const SwPosition& rPos,
|
Complete the transition of SwRedlineTable::size_type
...from 9ca8a63fff65acf2ea13b391495ad232f4636548 "Use consistent integer types
in the SwRedlineTable interface". This all started as an attempt to reduce the
number of places a to-be-committed improved loplugin:loopvartoosmall complains
about. Lets see where it ends...
SwRedlineTable::size_type is now the size_type of the underlying std::vector, no
longer sal_uInt16 from ancient times. I tried hard to find all places that are
affected by this change, changing types of affected variables and non-static
data members as needed. Some notes:
* The original code used USHRT_MAX as a "not found" value. I replaced that with
a new SwRedlineTable::npos, of type SwRedlineTable::size_type but still for
now of value USHRT_MAX. This should eventually be changed to something more
sensible, like std::numeric_limits<SwRedlineTable::size_type>::max() (which is
best done after we have constexpr support in all toolchains, so that npos can
be constexpr). It is important that the value of npos is towards positive
infinity, as many places in the code use
for (i = f(); // may return npos
i < table.size(); ++i)
table[i] ...
* There are some borders where values of SwRedlineTable::size_type are converted
into different types, for various reasons. But all of those other types
should be large enough for practical purposes (at least 32 bits wide):
MakrEntry::m_nIdx: long int
SvxRedlinTable::InsertEntry: sal_uIntPtr nPos
SwRangeRedline: size_t
SwRedlineItr: sal_Int32
SwVbaRevision::GetPosition: sal_Int32
SwXRedlines: sal_Int32
* .uno:TrackedChangeIndex= transports textual representations of such values.
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx treats them purely as
strings, while SwTiledRenderingTest converts them to int.
* TODO: The one place I'm unsure about is SfxUInt16Items with IDs
FN_REDLINE_ACCEPT_DIRECT, FN_REDLINE_REJECT_DIRECT, and FN_REDLINE_NEXT_CHANGE
in sw/source/uibase/uiview/view2.cxx. For now, I kept those as
SfxUInt16Items and take care to "map" USHRT_MAX to npos when reading from
those items. But I have no idea where instances of those items would actually
be created, and what it would mean to change those items' types?
Change-Id: Ib7a14dc67e2b970766966e43f4732abd9f045ff8
Reviewed-on: https://gerrit.libreoffice.org/34775
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-02 08:35:18 +01:00
|
|
|
/*[in]*/SwRedlineTable::size_type* pFndPos) const = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
|
|
|
virtual bool IsRedlineMove() const = 0;
|
|
|
|
|
|
|
|
virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0;
|
|
|
|
|
Complete the transition of SwRedlineTable::size_type
...from 9ca8a63fff65acf2ea13b391495ad232f4636548 "Use consistent integer types
in the SwRedlineTable interface". This all started as an attempt to reduce the
number of places a to-be-committed improved loplugin:loopvartoosmall complains
about. Lets see where it ends...
SwRedlineTable::size_type is now the size_type of the underlying std::vector, no
longer sal_uInt16 from ancient times. I tried hard to find all places that are
affected by this change, changing types of affected variables and non-static
data members as needed. Some notes:
* The original code used USHRT_MAX as a "not found" value. I replaced that with
a new SwRedlineTable::npos, of type SwRedlineTable::size_type but still for
now of value USHRT_MAX. This should eventually be changed to something more
sensible, like std::numeric_limits<SwRedlineTable::size_type>::max() (which is
best done after we have constexpr support in all toolchains, so that npos can
be constexpr). It is important that the value of npos is towards positive
infinity, as many places in the code use
for (i = f(); // may return npos
i < table.size(); ++i)
table[i] ...
* There are some borders where values of SwRedlineTable::size_type are converted
into different types, for various reasons. But all of those other types
should be large enough for practical purposes (at least 32 bits wide):
MakrEntry::m_nIdx: long int
SvxRedlinTable::InsertEntry: sal_uIntPtr nPos
SwRangeRedline: size_t
SwRedlineItr: sal_Int32
SwVbaRevision::GetPosition: sal_Int32
SwXRedlines: sal_Int32
* .uno:TrackedChangeIndex= transports textual representations of such values.
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx treats them purely as
strings, while SwTiledRenderingTest converts them to int.
* TODO: The one place I'm unsure about is SfxUInt16Items with IDs
FN_REDLINE_ACCEPT_DIRECT, FN_REDLINE_REJECT_DIRECT, and FN_REDLINE_NEXT_CHANGE
in sw/source/uibase/uiview/view2.cxx. For now, I kept those as
SfxUInt16Items and take care to "map" USHRT_MAX to npos when reading from
those items. But I have no idea where instances of those items would actually
be created, and what it would mean to change those items' types?
Change-Id: Ib7a14dc67e2b970766966e43f4732abd9f045ff8
Reviewed-on: https://gerrit.libreoffice.org/34775
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-02 08:35:18 +01:00
|
|
|
virtual bool AcceptRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
|
|
|
virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
|
|
|
|
|
Complete the transition of SwRedlineTable::size_type
...from 9ca8a63fff65acf2ea13b391495ad232f4636548 "Use consistent integer types
in the SwRedlineTable interface". This all started as an attempt to reduce the
number of places a to-be-committed improved loplugin:loopvartoosmall complains
about. Lets see where it ends...
SwRedlineTable::size_type is now the size_type of the underlying std::vector, no
longer sal_uInt16 from ancient times. I tried hard to find all places that are
affected by this change, changing types of affected variables and non-static
data members as needed. Some notes:
* The original code used USHRT_MAX as a "not found" value. I replaced that with
a new SwRedlineTable::npos, of type SwRedlineTable::size_type but still for
now of value USHRT_MAX. This should eventually be changed to something more
sensible, like std::numeric_limits<SwRedlineTable::size_type>::max() (which is
best done after we have constexpr support in all toolchains, so that npos can
be constexpr). It is important that the value of npos is towards positive
infinity, as many places in the code use
for (i = f(); // may return npos
i < table.size(); ++i)
table[i] ...
* There are some borders where values of SwRedlineTable::size_type are converted
into different types, for various reasons. But all of those other types
should be large enough for practical purposes (at least 32 bits wide):
MakrEntry::m_nIdx: long int
SvxRedlinTable::InsertEntry: sal_uIntPtr nPos
SwRangeRedline: size_t
SwRedlineItr: sal_Int32
SwVbaRevision::GetPosition: sal_Int32
SwXRedlines: sal_Int32
* .uno:TrackedChangeIndex= transports textual representations of such values.
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx treats them purely as
strings, while SwTiledRenderingTest converts them to int.
* TODO: The one place I'm unsure about is SfxUInt16Items with IDs
FN_REDLINE_ACCEPT_DIRECT, FN_REDLINE_REJECT_DIRECT, and FN_REDLINE_NEXT_CHANGE
in sw/source/uibase/uiview/view2.cxx. For now, I kept those as
SfxUInt16Items and take care to "map" USHRT_MAX to npos when reading from
those items. But I have no idea where instances of those items would actually
be created, and what it would mean to change those items' types?
Change-Id: Ib7a14dc67e2b970766966e43f4732abd9f045ff8
Reviewed-on: https://gerrit.libreoffice.org/34775
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-02 08:35:18 +01:00
|
|
|
virtual bool RejectRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
|
|
|
virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0;
|
|
|
|
|
2014-01-13 17:58:25 +02:00
|
|
|
virtual const SwRangeRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2014-01-13 17:58:25 +02:00
|
|
|
virtual const SwRangeRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2011-01-08 02:37:47 +01:00
|
|
|
// Representation has changed, invalidate all Redlines.
|
2006-08-14 14:13:15 +00:00
|
|
|
virtual void UpdateRedlineAttr() = 0;
|
|
|
|
|
2011-01-08 02:37:47 +01:00
|
|
|
// Create a new Author if required.
|
2017-03-16 18:22:54 +01:00
|
|
|
virtual std::size_t GetRedlineAuthor() = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2011-01-08 02:37:47 +01:00
|
|
|
// For Readers etc.: register new Author in table.
|
2017-03-16 18:22:54 +01:00
|
|
|
virtual std::size_t InsertRedlineAuthor(const OUString& rAuthor) = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2011-01-08 02:37:47 +01:00
|
|
|
// Place a comment at Redline at given position.
|
2006-08-14 14:13:15 +00:00
|
|
|
virtual bool SetRedlineComment(
|
|
|
|
/*[in]*/const SwPaM& rPam,
|
2013-09-17 14:30:05 +02:00
|
|
|
/*[in]*/const OUString& rComment) = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2015-11-05 15:55:58 +02:00
|
|
|
virtual const css::uno::Sequence <sal_Int8>& GetRedlinePassword() const = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
|
|
|
virtual void SetRedlinePassword(
|
2015-11-05 15:55:58 +02:00
|
|
|
/*[in]*/const css::uno::Sequence <sal_Int8>& rNewPassword) = 0;
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2014-05-30 23:30:03 +00:00
|
|
|
protected:
|
2006-08-14 14:13:15 +00:00
|
|
|
virtual ~IDocumentRedlineAccess() {};
|
2014-05-30 23:30:03 +00:00
|
|
|
};
|
2006-08-14 14:13:15 +00:00
|
|
|
|
2014-05-30 23:30:03 +00:00
|
|
|
#endif
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|