diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-03-16 18:22:54 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-03-16 18:22:54 +0100 |
commit | 60b14d663ec561a8606170cf0b7af13725265b01 (patch) | |
tree | 825ebb89350d1c04d775709a87039c9a62e7a786 /sw | |
parent | 9b6ed11d58b9f9d0310f95f914a3d354fc813b54 (diff) |
Clean up integers representing "redline authors"
Unlinke in previous such clean-up commits, there appears to be no sufficiently
exposed container type whose size_type could be used throughout, so resorting to
the generic std::size_t in this case.
Change-Id: I3cfbcbe5cce1bfcff2efbb4f8a509fe80ab12151
Diffstat (limited to 'sw')
24 files changed, 98 insertions, 58 deletions
diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx index 47fab8559d8d..ac5d017eda4c 100644 --- a/sw/inc/IDocumentRedlineAccess.hxx +++ b/sw/inc/IDocumentRedlineAccess.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_SW_INC_IDOCUMENTREDLINEACCESS_HXX #define INCLUDED_SW_INC_IDOCUMENTREDLINEACCESS_HXX +#include <sal/config.h> + +#include <cstddef> + #include <sal/types.h> #include <tools/solar.h> @@ -210,10 +214,10 @@ public: virtual void UpdateRedlineAttr() = 0; // Create a new Author if required. - virtual sal_uInt16 GetRedlineAuthor() = 0; + virtual std::size_t GetRedlineAuthor() = 0; // For Readers etc.: register new Author in table. - virtual sal_uInt16 InsertRedlineAuthor(const OUString& rAuthor) = 0; + virtual std::size_t InsertRedlineAuthor(const OUString& rAuthor) = 0; // Place a comment at Redline at given position. virtual bool SetRedlineComment( diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index 38c24ba78bf2..83e3ba469af8 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -20,6 +20,9 @@ #ifndef INCLUDED_SW_INC_POSTITMGR_HXX #define INCLUDED_SW_INC_POSTITMGR_HXX +#include <sal/config.h> + +#include <cstddef> #include <list> #include <vector> #include <editeng/outlobj.hxx> @@ -262,9 +265,9 @@ class SwPostItMgr: public SfxListener void SetSpellChecking(); - static Color GetColorDark(sal_uInt16 aAuthorIndex); - static Color GetColorLight(sal_uInt16 aAuthorIndex); - static Color GetColorAnchor(sal_uInt16 aAuthorIndex); + static Color GetColorDark(std::size_t aAuthorIndex); + static Color GetColorLight(std::size_t aAuthorIndex); + static Color GetColorAnchor(std::size_t aAuthorIndex); void RegisterAnswer(OutlinerParaObject* pAnswer) { mpAnswer = pAnswer;} OutlinerParaObject* IsAnswer() {return mpAnswer;} diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx index 2d89cbc98734..5e323aa4cf5d 100644 --- a/sw/inc/postithelper.hxx +++ b/sw/inc/postithelper.hxx @@ -22,6 +22,7 @@ #include <swrect.hxx> #include <fmtfld.hxx> #include <redline.hxx> +#include <cstddef> #include <vector> #include <vcl/window.hxx> #include <SidebarWindowsTypes.hxx> @@ -54,7 +55,7 @@ struct SwLayoutInfo sw::sidebarwindows::SidebarPosition meSidebarPosition; - sal_uInt16 mRedlineAuthor; + std::size_t mRedlineAuthor; SwLayoutInfo() : mpAnchorFrame(nullptr) diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index dbdedc4a2b89..b75b666ae8a6 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -27,6 +27,7 @@ #include <IDocumentRedlineAccess.hxx> +#include <cstddef> #include <vector> class SfxItemSet; @@ -110,14 +111,15 @@ class SW_DLLPUBLIC SwRedlineData OUString sComment; DateTime aStamp; RedlineType_t eType; - sal_uInt16 nAuthor, nSeqNo; + std::size_t nAuthor; + sal_uInt16 nSeqNo; public: - SwRedlineData( RedlineType_t eT, sal_uInt16 nAut ); + SwRedlineData( RedlineType_t eT, std::size_t nAut ); SwRedlineData( const SwRedlineData& rCpy, bool bCpyNext = true ); // For sw3io: pNext/pExtraData are taken over. - SwRedlineData( RedlineType_t eT, sal_uInt16 nAut, const DateTime& rDT, + SwRedlineData( RedlineType_t eT, std::size_t nAut, const DateTime& rDT, const OUString& rCmnt, SwRedlineData* pNxt ); ~SwRedlineData(); @@ -139,7 +141,7 @@ public: RedlineType_t GetType() const { return ((RedlineType_t)(eType & nsRedlineType_t::REDLINE_NO_FLAG_MASK)); } - sal_uInt16 GetAuthor() const { return nAuthor; } + std::size_t GetAuthor() const { return nAuthor; } const OUString& GetComment() const { return sComment; } const DateTime& GetTimeStamp() const { return aStamp; } const SwRedlineData* Next() const{ return pNext; } @@ -209,7 +211,7 @@ public: void SetAutoFormatFlag() { pRedlineData->SetAutoFormatFlag(); } sal_uInt16 GetStackCount() const; - sal_uInt16 GetAuthor( sal_uInt16 nPos = 0) const; + std::size_t GetAuthor( sal_uInt16 nPos = 0) const; OUString GetAuthorString( sal_uInt16 nPos = 0 ) const; const DateTime& GetTimeStamp( sal_uInt16 nPos = 0) const; RedlineType_t GetRealType( sal_uInt16 nPos = 0 ) const; diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index a05d90b7c09e..de72dd4547b6 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -19,6 +19,10 @@ #ifndef INCLUDED_SW_INC_SWMODULE_HXX #define INCLUDED_SW_INC_SWMODULE_HXX +#include <sal/config.h> + +#include <cstddef> + #include <tools/fldunit.hxx> #include <svl/lstner.hxx> #include <unotools/options.hxx> @@ -187,16 +191,16 @@ public: bool IsInsTableAlignNum(bool bHTML) const; // Redlining. - sal_uInt16 GetRedlineAuthor(); - OUString GetRedlineAuthor(sal_uInt16 nPos); + std::size_t GetRedlineAuthor(); + OUString GetRedlineAuthor(std::size_t nPos); /// See SwXTextDocument::getTrackedChangeAuthors(). OUString GetRedlineAuthorInfo(); - sal_uInt16 InsertRedlineAuthor(const OUString& rAuthor); + std::size_t InsertRedlineAuthor(const OUString& rAuthor); void SetRedlineAuthor(const OUString& rAuthor); // for unit tests - void GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet); - void GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet); - void GetFormatAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet); + void GetInsertAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet); + void GetDeletedAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet); + void GetFormatAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet); sal_uInt16 GetRedlineMarkPos(); const Color& GetRedlineMarkColor(); diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 9ca58a7c8974..0b65b9d7b8ac 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -2597,13 +2597,13 @@ bool DocumentRedlineManager::SetRedlineComment( const SwPaM& rPaM, const OUStrin } // Create a new author if necessary -sal_uInt16 DocumentRedlineManager::GetRedlineAuthor() +std::size_t DocumentRedlineManager::GetRedlineAuthor() { return SW_MOD()->GetRedlineAuthor(); } /// Insert new author into the Table for the Readers etc. -sal_uInt16 DocumentRedlineManager::InsertRedlineAuthor( const OUString& rNew ) +std::size_t DocumentRedlineManager::InsertRedlineAuthor( const OUString& rNew ) { return SW_MOD()->InsertRedlineAuthor(rNew); } diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 53606f2e5b28..a72486b53383 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> +#include <cstddef> #include <vector> #include <list> @@ -1633,7 +1634,7 @@ void CompareData::SetRedlinesToDoc( bool bUseDocInfo ) SwPaM* pTmp = pDelRing; // get the Author / TimeStamp from the "other" document info - sal_uInt16 nAuthor = rDoc.getIDocumentRedlineAccess().GetRedlineAuthor(); + std::size_t nAuthor = rDoc.getIDocumentRedlineAccess().GetRedlineAuthor(); DateTime aTimeStamp( DateTime::SYSTEM ); SwDocShell *pDocShell(rDoc.GetDocShell()); OSL_ENSURE(pDocShell, "no SwDocShell"); diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index a932cf88728f..8a485d5c9f5d 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -856,7 +856,7 @@ bool SwRedlineExtraData_FormattingChanges::operator == ( const SwRedlineExtraDat return false; } -SwRedlineData::SwRedlineData( RedlineType_t eT, sal_uInt16 nAut ) +SwRedlineData::SwRedlineData( RedlineType_t eT, std::size_t nAut ) : pNext( nullptr ), pExtraData( nullptr ), aStamp( DateTime::SYSTEM ), eType( eT ), nAuthor( nAut ), nSeqNo( 0 ) @@ -878,7 +878,7 @@ SwRedlineData::SwRedlineData( } // For sw3io: We now own pNext! -SwRedlineData::SwRedlineData(RedlineType_t eT, sal_uInt16 nAut, const DateTime& rDT, +SwRedlineData::SwRedlineData(RedlineType_t eT, std::size_t nAut, const DateTime& rDT, const OUString& rCmnt, SwRedlineData *pNxt) : pNext(pNxt), pExtraData(nullptr), sComment(rCmnt), aStamp(rDT), eType(eT), nAuthor(nAut), nSeqNo(0) @@ -1630,7 +1630,7 @@ sal_uInt16 SwRangeRedline::GetStackCount() const return nRet; } -sal_uInt16 SwRangeRedline::GetAuthor( sal_uInt16 nPos ) const +std::size_t SwRangeRedline::GetAuthor( sal_uInt16 nPos ) const { return GetRedlineData(nPos).nAuthor; } diff --git a/sw/source/core/inc/DocumentRedlineManager.hxx b/sw/source/core/inc/DocumentRedlineManager.hxx index 6aa688ba04ea..785c8eac8313 100644 --- a/sw/source/core/inc/DocumentRedlineManager.hxx +++ b/sw/source/core/inc/DocumentRedlineManager.hxx @@ -95,9 +95,9 @@ public: virtual void UpdateRedlineAttr() override; - virtual sal_uInt16 GetRedlineAuthor() override; + virtual std::size_t GetRedlineAuthor() override; - virtual sal_uInt16 InsertRedlineAuthor(const OUString& rAuthor) override; + virtual std::size_t InsertRedlineAuthor(const OUString& rAuthor) override; virtual bool SetRedlineComment( /*[in]*/const SwPaM& rPam, diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 1fb498ebb919..32bce6ccb5d5 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -280,7 +280,7 @@ short SwRedlineItr::Seek_(SwFont& rFnt, sal_Int32 nNew, sal_Int32 nOld) return nRet + EnterExtend( rFnt, nNew ); } -void SwRedlineItr::FillHints( sal_uInt16 nAuthor, RedlineType_t eType ) +void SwRedlineItr::FillHints( std::size_t nAuthor, RedlineType_t eType ) { switch ( eType ) { diff --git a/sw/source/core/text/redlnitr.hxx b/sw/source/core/text/redlnitr.hxx index 556c3af662c7..69cfb437c391 100644 --- a/sw/source/core/text/redlnitr.hxx +++ b/sw/source/core/text/redlnitr.hxx @@ -24,6 +24,8 @@ #include <IDocumentRedlineAccess.hxx> #include "swfont.hxx" + +#include <cstddef> #include <vector> class SwTextNode; @@ -71,7 +73,7 @@ class SwRedlineItr void Clear_( SwFont* pFnt ); bool ChkSpecialUnderline_() const; - void FillHints( sal_uInt16 nAuthor, RedlineType_t eType ); + void FillHints( std::size_t nAuthor, RedlineType_t eType ); short Seek_( SwFont& rFnt, sal_Int32 nNew, sal_Int32 nOld ); sal_Int32 GetNextRedln_( sal_Int32 nNext ); short EnterExtend( SwFont& rFnt, sal_Int32 nNew ) { diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 86129ccc4720..71faf3dbb0bd 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -1170,7 +1170,7 @@ void makeRedline( SwPaM& rPaM, //todo: what about REDLINE_FMTCOLL? comphelper::SequenceAsHashMap aPropMap( rRedlineProperties ); - sal_uInt16 nAuthor = 0; + std::size_t nAuthor = 0; OUString sAuthor; if( aPropMap.getValue("RedlineAuthor") >>= sAuthor ) nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor); @@ -1284,7 +1284,7 @@ void makeTableRowRedline( SwTableLine& rTableLine, } comphelper::SequenceAsHashMap aPropMap( rRedlineProperties ); - sal_uInt16 nAuthor = 0; + std::size_t nAuthor = 0; OUString sAuthor; if( aPropMap.getValue("RedlineAuthor") >>= sAuthor ) nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor); @@ -1333,7 +1333,7 @@ void makeTableCellRedline( SwTableBox& rTableBox, } comphelper::SequenceAsHashMap aPropMap( rRedlineProperties ); - sal_uInt16 nAuthor = 0; + std::size_t nAuthor = 0; OUString sAuthor; if( aPropMap.getValue("RedlineAuthor") >>= sAuthor ) nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor); diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx index e195c4a1a149..c0e8c7283e00 100644 --- a/sw/source/filter/basflt/fltshell.cxx +++ b/sw/source/filter/basflt/fltshell.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstddef> + #include <ctype.h> #include <hintids.hxx> #include <hints.hxx> @@ -710,7 +714,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, | RedlineFlags::ShowDelete ); SwFltRedline& rFltRedline = *static_cast<SwFltRedline*>(rEntry.pAttr.get()); - if( USHRT_MAX != rFltRedline.nAutorNoPrev ) + if( SwFltRedline::NoPrevAuthor != rFltRedline.nAutorNoPrev ) { SwRedlineData aData(rFltRedline.eTypePrev, rFltRedline.nAutorNoPrev, diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx index 8c132ef2406a..1a9d643568b8 100644 --- a/sw/source/filter/inc/fltshell.hxx +++ b/sw/source/filter/inc/fltshell.hxx @@ -29,6 +29,8 @@ #include <pam.hxx> #include <IDocumentRedlineAccess.hxx> +#include <cstddef> +#include <limits> #include <memory> #include <deque> @@ -225,14 +227,17 @@ public: DateTime aStampPrev; RedlineType_t eType; RedlineType_t eTypePrev; - sal_uInt16 nAutorNo; - sal_uInt16 nAutorNoPrev; + std::size_t nAutorNo; + std::size_t nAutorNoPrev; + + static constexpr auto NoPrevAuthor + = std::numeric_limits<std::size_t>::max(); SwFltRedline(RedlineType_t eType_, - sal_uInt16 nAutorNo_, + std::size_t nAutorNo_, const DateTime& rStamp_, RedlineType_t eTypePrev_ = nsRedlineType_t::REDLINE_INSERT, - sal_uInt16 nAutorNoPrev_ = USHRT_MAX) + std::size_t nAutorNoPrev_ = NoPrevAuthor) : SfxPoolItem(RES_FLTR_REDLINE), aStamp(rStamp_), aStampPrev( DateTime::EMPTY ), eType(eType_), diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx index bc9f26fbd71e..b8d65a2bf792 100644 --- a/sw/source/filter/inc/msfilter.hxx +++ b/sw/source/filter/inc/msfilter.hxx @@ -20,6 +20,9 @@ #ifndef INCLUDED_SW_SOURCE_FILTER_INC_MSFILTER_HXX #define INCLUDED_SW_SOURCE_FILTER_INC_MSFILTER_HXX +#include <sal/config.h> + +#include <cstddef> #include <set> #include <map> #include <vector> @@ -133,7 +136,7 @@ namespace sw namespace util { /// Redlining Authors, map word author key to writer author value - typedef std::map<sal_uInt16, sal_uInt16> AuthorInfos; + typedef std::map<sal_uInt16, std::size_t> AuthorInfos; /** Clips a value to MAX/MIN 16bit value to make it safe for use as a position value to give to writer. i.e. +-57.8cm. Sometimes diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index a9acbcd2f757..91c5cb85df82 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -822,7 +822,7 @@ namespace sw const SwFltRedline *pFltRedline = static_cast<const SwFltRedline*> (pEntry->pAttr.get()); - if (USHRT_MAX != pFltRedline->nAutorNoPrev) + if (SwFltRedline::NoPrevAuthor != pFltRedline->nAutorNoPrev) { SwRedlineData aData(pFltRedline->eTypePrev, pFltRedline->nAutorNoPrev, pFltRedline->aStampPrev, OUString(), diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 90aa97886cde..05a9160df88b 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1666,7 +1666,7 @@ void WW8_WrtRedlineAuthor::Write( Writer& rWrt ) rWW8Wrt.pFib->m_lcbSttbfRMark); } -sal_uInt16 WW8Export::AddRedlineAuthor( sal_uInt16 nId ) +sal_uInt16 WW8Export::AddRedlineAuthor( std::size_t nId ) { if( !m_pRedlAuthors ) { diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 063b556e58f5..6adb263a614e 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -42,6 +42,7 @@ #include <boost/optional.hpp> #include <o3tl/typed_flags_set.hxx> +#include <cstddef> #include <memory> #include <map> #include <vector> @@ -1010,7 +1011,7 @@ public: SwMSConvertControls& GetOCXExp() { return *m_pOCXExp; } void ExportDopTypography(WW8DopTypography &rTypo); - sal_uInt16 AddRedlineAuthor( sal_uInt16 nId ); + sal_uInt16 AddRedlineAuthor( std::size_t nId ); void WriteFootnoteBegin( const SwFormatFootnote& rFootnote, ww::bytes* pO = nullptr ); void WritePostItBegin( ww::bytes* pO = nullptr ); diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index 6f03cbb6a77b..c787054081d3 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/embed/Aspects.hpp> #include <algorithm> +#include <cstddef> #include <functional> #include <osl/endian.h> #include <sot/storage.hxx> @@ -454,7 +455,7 @@ void SwWW8ImplReader::ReadRevMarkAuthorStrTabl( SvStream& rStrm, for( sal_uInt16 nAuthor = 0; nAuthor < nCount; ++nAuthor ) { // Store author in doc - sal_uInt16 nSWId = rDocOut.getIDocumentRedlineAccess().InsertRedlineAuthor(aAuthorNames[nAuthor]); + std::size_t nSWId = rDocOut.getIDocumentRedlineAccess().InsertRedlineAuthor(aAuthorNames[nAuthor]); // Store matchpair m_aAuthorInfos[nAuthor] = nSWId; } @@ -512,7 +513,7 @@ void SwWW8ImplReader::Read_CRevisionMark(RedlineType_t eType, sal_uInt16 nWWAutNo = pSprmCIbstRMark ? SVBT16ToShort(pSprmCIbstRMark) : 0; sal_uInt32 nWWDate = pSprmCDttmRMark ? SVBT32ToUInt32(pSprmCDttmRMark): 0; DateTime aStamp(msfilter::util::DTTM2DateTime(nWWDate)); - sal_uInt16 nAuthorNo = m_aAuthorInfos[nWWAutNo]; + std::size_t nAuthorNo = m_aAuthorInfos[nWWAutNo]; SwFltRedline aNewAttr(eType, nAuthorNo, aStamp); NewAttr(aNewAttr); } diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index 580370078d39..7157c7e776e7 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstddef> + #include "XMLRedlineImportHelper.hxx" #include <unotextcursor.hxx> #include <unotextrange.hxx> @@ -673,7 +677,7 @@ SwRedlineData* XMLRedlineImportHelper::ConvertRedline( { // convert info: // 1) Author String -> Author ID (default to zero) - sal_uInt16 nAuthorId = (nullptr == pDoc) ? 0 : + std::size_t nAuthorId = (nullptr == pDoc) ? 0 : pDoc->getIDocumentRedlineAccess().InsertRedlineAuthor( pRedlineInfo->sAuthor ); // 2) util::DateTime -> DateTime diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx index f77d5f8b3553..c9ef218bb807 100644 --- a/sw/source/uibase/app/swmodul1.cxx +++ b/sw/source/uibase/app/swmodul1.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstddef> #include <memory> #include <boost/property_tree/json_parser.hpp> @@ -391,7 +394,7 @@ void SwModule::ShowDBObj(SwView& rView, const SwDBData& rData) } } -sal_uInt16 SwModule::GetRedlineAuthor() +std::size_t SwModule::GetRedlineAuthor() { if (!m_bAuthorInitialised) { @@ -415,7 +418,7 @@ void SwModule::SetRedlineAuthor(const OUString &rAuthor) InsertRedlineAuthor( m_sActAuthor ); } -OUString SwModule::GetRedlineAuthor(sal_uInt16 nPos) +OUString SwModule::GetRedlineAuthor(std::size_t nPos) { OSL_ENSURE(nPos < m_pAuthorNames.size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash while(!(nPos < m_pAuthorNames.size())) @@ -425,7 +428,7 @@ OUString SwModule::GetRedlineAuthor(sal_uInt16 nPos) return m_pAuthorNames[nPos]; } -static ColorData lcl_GetAuthorColor(sal_uInt16 nPos) +static ColorData lcl_GetAuthorColor(std::size_t nPos) { static const ColorData aColArr[] = { @@ -438,7 +441,7 @@ static ColorData lcl_GetAuthorColor(sal_uInt16 nPos) } /// Returns a JSON representation of a redline author. -boost::property_tree::ptree lcl_AuthorToJson(const OUString& rAuthor, size_t nIndex) +boost::property_tree::ptree lcl_AuthorToJson(const OUString& rAuthor, std::size_t nIndex) { boost::property_tree::ptree aRet; aRet.put("index", nIndex); @@ -450,7 +453,7 @@ boost::property_tree::ptree lcl_AuthorToJson(const OUString& rAuthor, size_t nIn OUString SwModule::GetRedlineAuthorInfo() { boost::property_tree::ptree aTable; - for (size_t nAuthor = 0; nAuthor < m_pAuthorNames.size(); ++nAuthor) + for (std::size_t nAuthor = 0; nAuthor < m_pAuthorNames.size(); ++nAuthor) { boost::property_tree::ptree aAuthor = lcl_AuthorToJson(m_pAuthorNames[nAuthor], nAuthor); aTable.push_back(std::make_pair("", aAuthor)); @@ -463,9 +466,9 @@ OUString SwModule::GetRedlineAuthorInfo() return OUString::fromUtf8(aStream.str().c_str()); } -sal_uInt16 SwModule::InsertRedlineAuthor(const OUString& rAuthor) +std::size_t SwModule::InsertRedlineAuthor(const OUString& rAuthor) { - sal_uInt16 nPos = 0; + std::size_t nPos = 0; while(nPos < m_pAuthorNames.size() && m_pAuthorNames[nPos] != rAuthor) ++nPos; @@ -476,7 +479,7 @@ sal_uInt16 SwModule::InsertRedlineAuthor(const OUString& rAuthor) return nPos; } -static void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet, +static void lcl_FillAuthorAttr( std::size_t nAuthor, SfxItemSet &rSet, const AuthorCharAttr &rAttr ) { Color aCol( rAttr.nColor ); @@ -535,18 +538,18 @@ static void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet, rSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) ); } -void SwModule::GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet) +void SwModule::GetInsertAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet) { lcl_FillAuthorAttr(nAuthor, rSet, m_pModuleConfig->GetInsertAuthorAttr()); } -void SwModule::GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet) +void SwModule::GetDeletedAuthorAttr(std::size_t nAuthor, SfxItemSet &rSet) { lcl_FillAuthorAttr(nAuthor, rSet, m_pModuleConfig->GetDeletedAuthorAttr()); } // For future extension: -void SwModule::GetFormatAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet ) +void SwModule::GetFormatAuthorAttr( std::size_t nAuthor, SfxItemSet &rSet ) { lcl_FillAuthorAttr( nAuthor, rSet, m_pModuleConfig->GetFormatAuthorAttr() ); } diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 2ea6d0707a2c..dae084be2eec 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -2043,7 +2043,7 @@ unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const return mpWrtShell->GetOut()->PixelToLogic(Size(2,0)).Width(); } -Color SwPostItMgr::GetColorDark(sal_uInt16 aAuthorIndex) +Color SwPostItMgr::GetColorDark(std::size_t aAuthorIndex) { if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode()) { @@ -2058,7 +2058,7 @@ Color SwPostItMgr::GetColorDark(sal_uInt16 aAuthorIndex) return Color(COL_WHITE); } -Color SwPostItMgr::GetColorLight(sal_uInt16 aAuthorIndex) +Color SwPostItMgr::GetColorLight(std::size_t aAuthorIndex) { if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode()) { @@ -2073,7 +2073,7 @@ Color SwPostItMgr::GetColorLight(sal_uInt16 aAuthorIndex) return Color(COL_WHITE); } -Color SwPostItMgr::GetColorAnchor(sal_uInt16 aAuthorIndex) +Color SwPostItMgr::GetColorAnchor(std::size_t aAuthorIndex) { if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode()) { diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx index 1cdbeb50b1ab..330f0094a007 100644 --- a/sw/source/uibase/docvw/SidebarWin.cxx +++ b/sw/source/uibase/docvw/SidebarWin.cxx @@ -19,6 +19,7 @@ #include <sal/config.h> +#include <cstddef> #include <cstdlib> #include <SidebarWin.hxx> @@ -644,7 +645,7 @@ void SwSidebarWin::InitControls() nCntrl &= ~EEControlBits::ONLINESPELLING; mpOutliner->SetControlWord(nCntrl); - sal_uInt16 aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor()); + std::size_t aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor()); SetColor( SwPostItMgr::GetColorDark(aIndex), SwPostItMgr::GetColorLight(aIndex), SwPostItMgr::GetColorAnchor(aIndex)); diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index ac5af4115966..b333f5fc4e6f 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -71,6 +71,7 @@ #include <edtwin.hxx> #include <PostItMgr.hxx> #include <calbck.hxx> +#include <cstddef> #include <memory> #include <swmodule.hxx> @@ -420,7 +421,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) sAuthor = pAuthorItem->GetValue(); else { - sal_uInt16 nAuthor = SW_MOD()->GetRedlineAuthor(); + std::size_t nAuthor = SW_MOD()->GetRedlineAuthor(); sAuthor = SW_MOD()->GetRedlineAuthor(nAuthor); } |