include/xmlreader/xmlreader.hxx | 4 sw/inc/crsrsh.hxx | 16 +- sw/inc/cshtyp.hxx | 105 ++++++++++--------- sw/inc/pam.hxx | 41 +++---- sw/inc/swcrsr.hxx | 18 +-- sw/qa/core/macros-test.cxx | 4 sw/qa/extras/uiwriter/uiwriter.cxx | 16 +- sw/source/core/access/acctable.cxx | 4 sw/source/core/crsr/crsrsh.cxx | 6 - sw/source/core/crsr/findattr.cxx | 22 +-- sw/source/core/crsr/findcoll.cxx | 4 sw/source/core/crsr/findfmt.cxx | 6 - sw/source/core/crsr/findtxt.cxx | 16 +- sw/source/core/crsr/pam.cxx | 70 ++++++------ sw/source/core/crsr/paminit.cxx | 61 +---------- sw/source/core/crsr/swcrsr.cxx | 58 +++++----- sw/source/core/crsr/trvlcol.cxx | 6 - sw/source/core/crsr/trvlreg.cxx | 47 +------- sw/source/core/crsr/trvlreg.hxx | 33 ----- sw/source/core/crsr/trvltbl.cxx | 23 +--- sw/source/core/crsr/trvltbl.hxx | 32 ----- sw/source/core/edit/editsh.cxx | 4 sw/source/core/edit/edlingu.cxx | 2 sw/source/core/edit/edtox.cxx | 4 sw/source/core/frmedt/fecopy.cxx | 4 sw/source/core/frmedt/fetab.cxx | 2 sw/source/core/inc/pamtyp.hxx | 7 - sw/source/core/layout/trvlfrm.cxx | 8 - sw/source/core/unocore/unoobj.cxx | 26 ++-- sw/source/core/unocore/unoobj2.cxx | 4 sw/source/core/unocore/unoparagraph.cxx | 14 +- sw/source/core/unocore/unotbl.cxx | 4 sw/source/core/unocore/unotext.cxx | 8 - sw/source/filter/html/swhtml.cxx | 2 sw/source/ui/chrdlg/drpcps.cxx | 4 sw/source/ui/dbui/dbinsdlg.cxx | 14 +- sw/source/ui/dbui/mmlayoutpage.cxx | 2 sw/source/ui/index/swuiidxmrk.cxx | 4 sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 16 +- sw/source/uibase/inc/wrtsh.hxx | 6 - sw/source/uibase/shells/basesh.cxx | 2 sw/source/uibase/shells/langhelper.cxx | 4 sw/source/uibase/shells/tabsh.cxx | 8 - sw/source/uibase/shells/txtcrsr.cxx | 8 - sw/source/uibase/table/tablemgr.cxx | 2 sw/source/uibase/uiview/view2.cxx | 2 sw/source/uibase/uiview/viewling.cxx | 42 +++---- sw/source/uibase/uiview/viewmdi.cxx | 8 - sw/source/uibase/uiview/viewsrch.cxx | 26 ++-- sw/source/uibase/uno/unotxdoc.cxx | 30 ++--- sw/source/uibase/wrtsh/delete.cxx | 6 - sw/source/uibase/wrtsh/move.cxx | 38 +++--- sw/source/uibase/wrtsh/select.cxx | 10 - sw/source/uibase/wrtsh/wrtsh4.cxx | 20 +-- xmlreader/source/xmlreader.cxx | 28 ++--- 55 files changed, 405 insertions(+), 556 deletions(-)
New commits: commit bf02fe3b4db51c8e5c80c3438f0fc166ef386861 Author: Noel Grandin <n...@peralex.com> Date: Tue Aug 30 16:03:52 2016 +0200 inline some get-function-pointer-collection functions no need to have two different ways of getting to the SwMoveFnCollection structs, they are already exposed and used as global constants Change-Id: Iec6e1ee2d9cd2edb8237f24d72024652271a9d5e diff --git a/sw/inc/cshtyp.hxx b/sw/inc/cshtyp.hxx index baefa82..3546bb1 100644 --- a/sw/inc/cshtyp.hxx +++ b/sw/inc/cshtyp.hxx @@ -45,8 +45,8 @@ typedef bool (*SwWhichPara)( SwPaM&, SwMoveFnCollection const & ); bool GoPrevPara( SwPaM&, SwMoveFnCollection const &); SW_DLLPUBLIC bool GoCurrPara( SwPaM&, SwMoveFnCollection const &); bool GoNextPara( SwPaM&, SwMoveFnCollection const &); -extern SwMoveFnCollection const & fnParaStart; -extern SwMoveFnCollection const & fnParaEnd; +extern SW_DLLPUBLIC SwMoveFnCollection const & fnParaStart; +extern SW_DLLPUBLIC SwMoveFnCollection const & fnParaEnd; // Direction-parameter for MoveSection. typedef bool (*SwWhichSection)( SwPaM&, SwMoveFnCollection const & ); @@ -60,8 +60,8 @@ typedef bool (*SwWhichTable)( SwPaM&, SwMoveFnCollection const &, bool bInReadOn SW_DLLPUBLIC bool GotoPrevTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); SW_DLLPUBLIC bool GotoCurrTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); bool GotoNextTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); -extern SwMoveFnCollection const & fnTableStart; -extern SwMoveFnCollection const & fnTableEnd; +extern SW_DLLPUBLIC SwMoveFnCollection const & fnTableStart; +extern SW_DLLPUBLIC SwMoveFnCollection const & fnTableEnd; // Direction-parameter for MoveColumn typedef SwLayoutFrame * (*SwWhichColumn)( const SwLayoutFrame * ); @@ -110,12 +110,6 @@ enum class SwDocPositions OtherEnd }; -SW_DLLPUBLIC SwMoveFnCollection const & GetfnParaStart(); -SW_DLLPUBLIC SwMoveFnCollection const & GetfnParaEnd(); - -SW_DLLPUBLIC SwMoveFnCollection const & GetfnTableStart(); -SW_DLLPUBLIC SwMoveFnCollection const & GetfnTableEnd(); - #endif // INCLUDED_SW_INC_CSHTYP_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index e1b9a65..875c2c1 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -399,7 +399,7 @@ void SwUiWriterTest::testBookmarkCopy() rIDCO.SplitNode(*aPaM.GetPoint(), false); rIDCO.InsertString(aPaM, "bar"); aPaM.SetMark(); - aPaM.MovePara(GoCurrPara, GetfnParaStart()); + aPaM.MovePara(GoCurrPara, fnParaStart); rIDMA.makeMark(aPaM, "Mark", IDocumentMarkAccess::MarkType::BOOKMARK); aPaM.Exchange(); aPaM.DeleteMark(); diff --git a/sw/source/core/crsr/paminit.cxx b/sw/source/core/crsr/paminit.cxx index 9362d11..0495bd7 100644 --- a/sw/source/core/crsr/paminit.cxx +++ b/sw/source/core/crsr/paminit.cxx @@ -57,21 +57,4 @@ SwMoveFnCollection const & fnRegionEnd = aBwrd; SwMoveFnCollection const & fnMoveBackward = aBwrd; SwMoveFnCollection const & fnMoveForward = aFwrd; -SwMoveFnCollection const & GetfnParaStart() -{ - return fnParaStart; -} -SwMoveFnCollection const & GetfnParaEnd() -{ - return fnParaEnd; -} -SwMoveFnCollection const & GetfnTableStart() -{ - return fnTableStart; -} -SwMoveFnCollection const & GetfnTableEnd() -{ - return fnTableEnd; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index 1ff76ed..1810065 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -281,7 +281,7 @@ void SwDropCapsPict::UpdatePaintSettings() mpPage->rSh.SttCursorMove(); mpPage->rSh.ClearMark(); SwWhichPara pSwuifnParaCurr = GoCurrPara; - SwMoveFnCollection const & pSwuifnParaStart = GetfnParaStart(); + SwMoveFnCollection const & pSwuifnParaStart = fnParaStart; mpPage->rSh.MovePara(pSwuifnParaCurr,pSwuifnParaStart); // normal GetFontSettings( *mpPage, aFont, RES_CHRATR_FONT ); diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index d8f0546e..412a667 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1036,7 +1036,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, rSh.InsertTable( pModOpt->GetInsTableFlags(bHTML), nRows, nCols, text::HoriOrientation::FULL, (pSelection ? pTAutoFormat : nullptr) ); - rSh.MoveTable( GotoPrevTable, GetfnTableStart() ); + rSh.MoveTable( GotoPrevTable, fnTableStart ); if( pSelection && pTableSet ) SetTabSet(); @@ -1173,7 +1173,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, pWait.reset(new SwWait( *pView->GetDocShell(), true )); } - rSh.MoveTable( GotoCurrTable, GetfnTableStart() ); + rSh.MoveTable( GotoCurrTable, fnTableStart ); if( !pSelection && ( pTableSet || pTAutoFormat )) { if( pTableSet ) @@ -1368,13 +1368,13 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, // at the end. rSh.SwCursorShell::MovePara( - GoCurrPara, GetfnParaStart() ); + GoCurrPara, fnParaStart ); pMark = rSh.SetBookmark( vcl::KeyCode(), OUString(), OUString(), IDocumentMarkAccess::MarkType::UNO_BOOKMARK ); rSh.SwCursorShell::MovePara( - GoCurrPara, GetfnParaEnd() ); + GoCurrPara, fnParaEnd ); bSetCursor = false; } } @@ -1462,14 +1462,14 @@ void SwInsertDBColAutoPilot::SetTabSet() rSh.GetTableFormat()->GetName() ) pTableSet->ClearItem( FN_PARAM_TABLE_NAME ); - rSh.MoveTable( GotoCurrTable, GetfnTableStart() ); + rSh.MoveTable( GotoCurrTable, fnTableStart ); rSh.SetMark(); - rSh.MoveTable( GotoCurrTable, GetfnTableEnd() ); + rSh.MoveTable( GotoCurrTable, fnTableEnd ); ItemSetToTableParam( *pTableSet, rSh ); rSh.ClearMark(); - rSh.MoveTable( GotoCurrTable, GetfnTableStart() ); + rSh.MoveTable( GotoCurrTable, fnTableStart ); } DB_ColumnConfigData::~DB_ColumnConfigData() {} diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index 6f9a4f4..5ff97ed 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -449,7 +449,7 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig else { //we may end up inside of a paragraph if the left margin is not at DEFAULT_LEFT_DISTANCE - rShell.MovePara(GoCurrPara, GetfnParaStart()); + rShell.MovePara(GoCurrPara, fnParaStart); } bool bSplitNode = !rShell.GetText().isEmpty(); sal_Int32 nMoves = rConfigItem.GetGreetingMoves(); commit f1226d19d944791fc0150c064d1a9985d5913907 Author: Noel Grandin <n...@peralex.com> Date: Tue Aug 30 15:25:00 2016 +0200 Get rid of a pointless indirect function pointer variable Change-Id: I7c202c6bff8ed405817ea1e7feb4a2c6427825ad diff --git a/sw/inc/cshtyp.hxx b/sw/inc/cshtyp.hxx index 2ac0f69..baefa82 100644 --- a/sw/inc/cshtyp.hxx +++ b/sw/inc/cshtyp.hxx @@ -69,7 +69,8 @@ typedef SwContentFrame * (*SwPosColumn)( const SwLayoutFrame * ); SwLayoutFrame* GetPrevColumn( const SwLayoutFrame* pLayFrame ); SwLayoutFrame* GetCurrColumn( const SwLayoutFrame* pLayFrame ); SwLayoutFrame* GetNextColumn( const SwLayoutFrame* pLayFrame ); -extern SwPosColumn fnColumnStart, fnColumnEnd; +SwContentFrame* GetColumnStt( const SwLayoutFrame* pColFrame ); +SwContentFrame* GetColumnEnd( const SwLayoutFrame* pColFrame ); // Direction-parameter for MoveRegion (ranges!) typedef bool (*SwWhichRegion)( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); diff --git a/sw/source/core/crsr/trvlcol.cxx b/sw/source/core/crsr/trvlcol.cxx index ce7ea36..f309ea1 100644 --- a/sw/source/core/crsr/trvlcol.cxx +++ b/sw/source/core/crsr/trvlcol.cxx @@ -64,9 +64,6 @@ SwContentFrame* GetColumnEnd( const SwLayoutFrame* pColFrame ) return pRet; } -SwPosColumn fnColumnStart = &GetColumnStt; -SwPosColumn fnColumnEnd = &GetColumnEnd; - bool SwCursorShell::MoveColumn( SwWhichColumn fnWhichCol, SwPosColumn fnPosCol ) { bool bRet = false; diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index 34438bd..5e1184e 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -357,37 +357,37 @@ void SwWrtShell::EndPara( bool bSelect ) void SwWrtShell::StartOfColumn() { ShellMoveCursor aTmp( this, false/*bSelect*/); - MoveColumn(GetCurrColumn, fnColumnStart); + MoveColumn(GetCurrColumn, GetColumnStt); } void SwWrtShell::EndOfColumn() { ShellMoveCursor aTmp( this, false/*bSelect*/); - MoveColumn(GetCurrColumn, fnColumnEnd); + MoveColumn(GetCurrColumn, GetColumnEnd); } void SwWrtShell::StartOfNextColumn() { ShellMoveCursor aTmp( this, false/*bSelect*/); - MoveColumn( GetNextColumn, fnColumnStart); + MoveColumn( GetNextColumn, GetColumnStt); } void SwWrtShell::EndOfNextColumn() { ShellMoveCursor aTmp( this, false/*bSelect*/); - MoveColumn(GetNextColumn, fnColumnEnd); + MoveColumn(GetNextColumn, GetColumnEnd); } void SwWrtShell::StartOfPrevColumn() { ShellMoveCursor aTmp( this, false/*bSelect*/); - MoveColumn(GetPrevColumn, fnColumnStart); + MoveColumn(GetPrevColumn, GetColumnStt); } void SwWrtShell::EndOfPrevColumn() { ShellMoveCursor aTmp( this, false/*bSelect*/); - MoveColumn(GetPrevColumn, fnColumnEnd); + MoveColumn(GetPrevColumn, GetColumnEnd); } bool SwWrtShell::PushCursor(SwTwips lOffset, bool bSelect) commit 12b4d982c2f0dbebd2380823f3f63fe30e219f09 Author: Noel Grandin <n...@peralex.com> Date: Tue Aug 30 14:54:47 2016 +0200 Get rid of a pointless indirect function pointer variable Change-Id: I913a6be200b78790f465d2672d6da22a3b8d2b73 diff --git a/sw/inc/cshtyp.hxx b/sw/inc/cshtyp.hxx index 7596245..2ac0f69 100644 --- a/sw/inc/cshtyp.hxx +++ b/sw/inc/cshtyp.hxx @@ -73,7 +73,9 @@ extern SwPosColumn fnColumnStart, fnColumnEnd; // Direction-parameter for MoveRegion (ranges!) typedef bool (*SwWhichRegion)( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); -extern SwWhichRegion fnRegionPrev, fnRegionCurr, fnRegionNext, fnRegionCurrAndSkip; +bool GotoPrevRegion( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +bool GotoNextRegion( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +bool GotoCurrRegionAndSkip( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); extern SwMoveFnCollection const & fnRegionStart; extern SwMoveFnCollection const & fnRegionEnd; diff --git a/sw/source/core/crsr/paminit.cxx b/sw/source/core/crsr/paminit.cxx index e21e7bf..9362d11 100644 --- a/sw/source/core/crsr/paminit.cxx +++ b/sw/source/core/crsr/paminit.cxx @@ -19,7 +19,6 @@ #include <pam.hxx> #include <pamtyp.hxx> -#include <trvlreg.hxx> static SwMoveFnCollection aFwrd = { /* fnNd */ &GoNext, @@ -52,10 +51,6 @@ SwMoveFnCollection const & fnSectionEnd = aBwrd; SwMoveFnCollection const & fnTableStart = aFwrd; SwMoveFnCollection const & fnTableEnd = aBwrd; -SwWhichRegion fnRegionPrev = &GotoPrevRegion; -SwWhichRegion fnRegionCurr = &GotoCurrRegion; -SwWhichRegion fnRegionCurrAndSkip = &GotoCurrRegionAndSkip; -SwWhichRegion fnRegionNext = &GotoNextRegion; SwMoveFnCollection const & fnRegionStart = aFwrd; SwMoveFnCollection const & fnRegionEnd = aBwrd; diff --git a/sw/source/core/crsr/trvlreg.cxx b/sw/source/core/crsr/trvlreg.cxx index ccdde1d..447eef2 100644 --- a/sw/source/core/crsr/trvlreg.cxx +++ b/sw/source/core/crsr/trvlreg.cxx @@ -26,7 +26,6 @@ #include <callnk.hxx> #include <pamtyp.hxx> #include <section.hxx> -#include <trvlreg.hxx> bool GotoPrevRegion( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosRegion, bool bInReadOnly ) @@ -135,36 +134,6 @@ bool GotoNextRegion( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosRegi return false; } -bool GotoCurrRegion( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosRegion, - bool bInReadOnly ) -{ - SwSectionNode* pNd = rCurrentCursor.GetNode().FindSectionNode(); - if( !pNd ) - return false; - - SwPosition* pPos = rCurrentCursor.GetPoint(); - bool bMoveBackward = &fnPosRegion == &fnMoveBackward; - - SwContentNode* pCNd; - if( bMoveBackward ) - { - SwNodeIndex aIdx( *pNd->EndOfSectionNode() ); - pCNd = SwNodes::GoPrevSection( &aIdx, true, !bInReadOnly ); - } - else - { - SwNodeIndex aIdx( *pNd ); - pCNd = pNd->GetNodes().GoNextSection( &aIdx, true, !bInReadOnly ); - } - - if( pCNd ) - { - pPos->nNode = *pCNd; - pPos->nContent.Assign( pCNd, bMoveBackward ? pCNd->Len() : 0 ); - } - return nullptr != pCNd; -} - bool GotoCurrRegionAndSkip( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosRegion, bool bInReadOnly ) { diff --git a/sw/source/core/crsr/trvlreg.hxx b/sw/source/core/crsr/trvlreg.hxx deleted file mode 100644 index ea069ba..0000000 --- a/sw/source/core/crsr/trvlreg.hxx +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ - -#ifndef INCLUDED_SW_SOURCE_CORE_CRSR_TRVLREG_HXX -#define INCLUDED_SW_SOURCE_CORE_CRSR_TRVLREG_HXX - -#include <sal/config.h> - -// Travelling in regions -bool GotoPrevRegion( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); -bool GotoCurrRegion( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); -bool GotoCurrRegionAndSkip( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); -bool GotoNextRegion( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/shells/txtcrsr.cxx b/sw/source/uibase/shells/txtcrsr.cxx index b14c08c..fa25fd5 100644 --- a/sw/source/uibase/shells/txtcrsr.cxx +++ b/sw/source/uibase/shells/txtcrsr.cxx @@ -402,10 +402,10 @@ void SwTextShell::ExecMoveMisc(SfxRequest &rReq) bRet = rSh.MoveTable(GotoNextTable, fnTableStart); break; case FN_GOTO_NEXT_REGION : - bRet = rSh.MoveRegion(fnRegionNext, fnRegionStart); + bRet = rSh.MoveRegion(GotoNextRegion, fnRegionStart); break; case FN_GOTO_PREV_REGION : - bRet = rSh.MoveRegion(fnRegionPrev, fnRegionStart); + bRet = rSh.MoveRegion(GotoPrevRegion, fnRegionStart); break; case FN_NEXT_TOXMARK: bRet = rSh.GotoNxtPrvTOXMark(); diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx index 79a6614..a2d19df 100644 --- a/sw/source/uibase/uiview/viewmdi.cxx +++ b/sw/source/uibase/uiview/viewmdi.cxx @@ -352,9 +352,9 @@ IMPL_LINK_TYPED( SwView, MoveNavigationHdl, void*, p, void ) case NID_REG : rSh.EnterStdMode(); if(bNext) - rSh.MoveRegion(fnRegionNext, fnRegionStart); + rSh.MoveRegion(GotoNextRegion, fnRegionStart); else - rSh.MoveRegion(fnRegionPrev, fnRegionStart); + rSh.MoveRegion(GotoPrevRegion, fnRegionStart); break; case NID_BKM : diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index 58ab873..34438bd 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -252,7 +252,7 @@ bool SwWrtShell::GoStart( bool bKeepArea, bool *pMoveTable, return true; } // Regions ??? - return SwCursorShell::MoveRegion( fnRegionCurrAndSkip, fnRegionStart ) || + return SwCursorShell::MoveRegion( GotoCurrRegionAndSkip, fnRegionStart ) || SwCursorShell::SttEndDoc(true); } @@ -286,7 +286,7 @@ bool SwWrtShell::GoEnd(bool bKeepArea, bool *pMoveTable) } } // Regions ??? - return SwCursorShell::MoveRegion( fnRegionCurrAndSkip, fnRegionEnd ) || + return SwCursorShell::MoveRegion( GotoCurrRegionAndSkip, fnRegionEnd ) || SwCursorShell::SttEndDoc(false); } commit f0a563cce1c6e6f6babbe33bc3382d4ad4439754 Author: Noel Grandin <n...@peralex.com> Date: Tue Aug 30 14:26:13 2016 +0200 Get rid of a pointless indirect function pointer variable Change-Id: Ibcfac031bb0891b4849dc48904893bb891887788 diff --git a/sw/inc/cshtyp.hxx b/sw/inc/cshtyp.hxx index ac1761b..7596245 100644 --- a/sw/inc/cshtyp.hxx +++ b/sw/inc/cshtyp.hxx @@ -66,7 +66,9 @@ extern SwMoveFnCollection const & fnTableEnd; // Direction-parameter for MoveColumn typedef SwLayoutFrame * (*SwWhichColumn)( const SwLayoutFrame * ); typedef SwContentFrame * (*SwPosColumn)( const SwLayoutFrame * ); -extern SwWhichColumn fnColumnPrev, fnColumnCurr, fnColumnNext; +SwLayoutFrame* GetPrevColumn( const SwLayoutFrame* pLayFrame ); +SwLayoutFrame* GetCurrColumn( const SwLayoutFrame* pLayFrame ); +SwLayoutFrame* GetNextColumn( const SwLayoutFrame* pLayFrame ); extern SwPosColumn fnColumnStart, fnColumnEnd; // Direction-parameter for MoveRegion (ranges!) diff --git a/sw/source/core/crsr/trvlcol.cxx b/sw/source/core/crsr/trvlcol.cxx index fcfeb30..ce7ea36 100644 --- a/sw/source/core/crsr/trvlcol.cxx +++ b/sw/source/core/crsr/trvlcol.cxx @@ -64,9 +64,6 @@ SwContentFrame* GetColumnEnd( const SwLayoutFrame* pColFrame ) return pRet; } -SwWhichColumn fnColumnPrev = &GetPrevColumn; -SwWhichColumn fnColumnCurr = &GetCurrColumn; -SwWhichColumn fnColumnNext = &GetNextColumn; SwPosColumn fnColumnStart = &GetColumnStt; SwPosColumn fnColumnEnd = &GetColumnEnd; diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index 3aedea4..58ab873 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -357,37 +357,37 @@ void SwWrtShell::EndPara( bool bSelect ) void SwWrtShell::StartOfColumn() { ShellMoveCursor aTmp( this, false/*bSelect*/); - MoveColumn(fnColumnCurr, fnColumnStart); + MoveColumn(GetCurrColumn, fnColumnStart); } void SwWrtShell::EndOfColumn() { ShellMoveCursor aTmp( this, false/*bSelect*/); - MoveColumn(fnColumnCurr, fnColumnEnd); + MoveColumn(GetCurrColumn, fnColumnEnd); } void SwWrtShell::StartOfNextColumn() { ShellMoveCursor aTmp( this, false/*bSelect*/); - MoveColumn( fnColumnNext, fnColumnStart); + MoveColumn( GetNextColumn, fnColumnStart); } void SwWrtShell::EndOfNextColumn() { ShellMoveCursor aTmp( this, false/*bSelect*/); - MoveColumn(fnColumnNext, fnColumnEnd); + MoveColumn(GetNextColumn, fnColumnEnd); } void SwWrtShell::StartOfPrevColumn() { ShellMoveCursor aTmp( this, false/*bSelect*/); - MoveColumn(fnColumnPrev, fnColumnStart); + MoveColumn(GetPrevColumn, fnColumnStart); } void SwWrtShell::EndOfPrevColumn() { ShellMoveCursor aTmp( this, false/*bSelect*/); - MoveColumn(fnColumnPrev, fnColumnEnd); + MoveColumn(GetPrevColumn, fnColumnEnd); } bool SwWrtShell::PushCursor(SwTwips lOffset, bool bSelect) commit 8c0db3e8ac158c8e131085843fcc326073e28c05 Author: Noel Grandin <n...@peralex.com> Date: Tue Aug 30 13:58:14 2016 +0200 Get rid of a pointless indirect function pointer variable Change-Id: I81055c6973247e226dc9dc3fda072aef94fa8966 diff --git a/sw/inc/cshtyp.hxx b/sw/inc/cshtyp.hxx index 5615d34..ac1761b 100644 --- a/sw/inc/cshtyp.hxx +++ b/sw/inc/cshtyp.hxx @@ -57,7 +57,9 @@ bool GoCurrSection( SwPaM&, SwMoveFnCollection const &); // Direction-parameter for MoveTable typedef bool (*SwWhichTable)( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); -extern SwWhichTable fnTablePrev, fnTableCurr, fnTableNext; +SW_DLLPUBLIC bool GotoPrevTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +SW_DLLPUBLIC bool GotoCurrTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); +bool GotoNextTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); extern SwMoveFnCollection const & fnTableStart; extern SwMoveFnCollection const & fnTableEnd; @@ -106,8 +108,6 @@ enum class SwDocPositions SW_DLLPUBLIC SwMoveFnCollection const & GetfnParaStart(); SW_DLLPUBLIC SwMoveFnCollection const & GetfnParaEnd(); -SW_DLLPUBLIC SwWhichTable GetfnTablePrev(); -SW_DLLPUBLIC SwWhichTable GetfnTableCurr(); SW_DLLPUBLIC SwMoveFnCollection const & GetfnTableStart(); SW_DLLPUBLIC SwMoveFnCollection const & GetfnTableEnd(); diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index 7551311..0402dd1 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -1538,7 +1538,7 @@ void SAL_CALL SwAccessibleTable::selectAccessibleChild( // Move cursor to the end of the table creating a selection and a table // cursor. pCursorShell->SetMark(); - pCursorShell->MoveTable( fnTableCurr, fnTableEnd ); + pCursorShell->MoveTable( GotoCurrTable, fnTableEnd ); // now set the cursor into the cell again. SwPaM *pPaM = pCursorShell->GetTableCrs() ? pCursorShell->GetTableCrs() : pCursorShell->GetCursor(); @@ -1689,7 +1689,7 @@ void SAL_CALL SwAccessibleTable::deselectAccessibleChild( // Move cursor to the end of the table creating a selection and a table // cursor. pCursorShell->SetMark(); - pCursorShell->MoveTable( fnTableCurr, fnTableEnd ); + pCursorShell->MoveTable( GotoCurrTable, fnTableEnd ); // now set the cursor into the cell again. pPaM = pCursorShell->GetTableCrs() ? pCursorShell->GetTableCrs() : pCursorShell->GetCursor(); diff --git a/sw/source/core/crsr/paminit.cxx b/sw/source/core/crsr/paminit.cxx index a296b9b..e21e7bf 100644 --- a/sw/source/core/crsr/paminit.cxx +++ b/sw/source/core/crsr/paminit.cxx @@ -20,7 +20,6 @@ #include <pam.hxx> #include <pamtyp.hxx> #include <trvlreg.hxx> -#include <trvltbl.hxx> static SwMoveFnCollection aFwrd = { /* fnNd */ &GoNext, @@ -50,9 +49,6 @@ SwMoveFnCollection const & fnParaEnd = aBwrd; SwMoveFnCollection const & fnSectionStart = aFwrd; SwMoveFnCollection const & fnSectionEnd = aBwrd; -SwWhichTable fnTablePrev = &GotoPrevTable; -SwWhichTable fnTableCurr = &GotoCurrTable; -SwWhichTable fnTableNext = &GotoNextTable; SwMoveFnCollection const & fnTableStart = aFwrd; SwMoveFnCollection const & fnTableEnd = aBwrd; @@ -70,10 +66,6 @@ SwMoveFnCollection const & GetfnParaStart() { return fnParaStart; } -SwWhichTable GetfnTablePrev() -{ - return fnTablePrev; -} SwMoveFnCollection const & GetfnParaEnd() { return fnParaEnd; @@ -82,10 +74,6 @@ SwMoveFnCollection const & GetfnTableStart() { return fnTableStart; } -SwWhichTable GetfnTableCurr() -{ - return fnTableCurr; -} SwMoveFnCollection const & GetfnTableEnd() { return fnTableEnd; diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index f56b196c..9c8f174 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -37,7 +37,6 @@ #include <cellatr.hxx> #include <cellfrm.hxx> #include <rowfrm.hxx> -#include <trvltbl.hxx> #include <IDocumentLayoutAccess.hxx> /// set cursor into next/previous cell diff --git a/sw/source/core/crsr/trvltbl.hxx b/sw/source/core/crsr/trvltbl.hxx deleted file mode 100644 index 51ad420..0000000 --- a/sw/source/core/crsr/trvltbl.hxx +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ - -#ifndef INCLUDED_SW_SOURCE_CORE_CRSR_TRVLTBL_HXX -#define INCLUDED_SW_SOURCE_CORE_CRSR_TRVLTBL_HXX - -#include <sal/config.h> - -// Travelling in tables -bool GotoPrevTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); -bool GotoCurrTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); -bool GotoNextTable( SwPaM&, SwMoveFnCollection const &, bool bInReadOnly ); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 6c71f8ef..4e92529 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1607,7 +1607,7 @@ void SwXTextTableCursor::gotoStart(sal_Bool bExpand) throw( uno::RuntimeExceptio SwUnoCursor& rUnoCursor = GetCursor(); SwUnoTableCursor& rTableCursor = dynamic_cast<SwUnoTableCursor&>(rUnoCursor); lcl_CursorSelect(rTableCursor, bExpand); - rTableCursor.MoveTable(fnTableCurr, fnTableStart); + rTableCursor.MoveTable(GotoCurrTable, fnTableStart); } void SwXTextTableCursor::gotoEnd(sal_Bool bExpand) throw( uno::RuntimeException, std::exception ) @@ -1616,7 +1616,7 @@ void SwXTextTableCursor::gotoEnd(sal_Bool bExpand) throw( uno::RuntimeException, SwUnoCursor& rUnoCursor = GetCursor(); SwUnoTableCursor& rTableCursor = dynamic_cast<SwUnoTableCursor&>(rUnoCursor); lcl_CursorSelect(rTableCursor, bExpand); - rTableCursor.MoveTable(fnTableCurr, fnTableEnd); + rTableCursor.MoveTable(GotoCurrTable, fnTableEnd); } sal_Bool SwXTextTableCursor::mergeRange() diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 279f963..d8f0546e 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1036,7 +1036,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, rSh.InsertTable( pModOpt->GetInsTableFlags(bHTML), nRows, nCols, text::HoriOrientation::FULL, (pSelection ? pTAutoFormat : nullptr) ); - rSh.MoveTable( GetfnTablePrev(), GetfnTableStart() ); + rSh.MoveTable( GotoPrevTable, GetfnTableStart() ); if( pSelection && pTableSet ) SetTabSet(); @@ -1173,7 +1173,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, pWait.reset(new SwWait( *pView->GetDocShell(), true )); } - rSh.MoveTable( GetfnTableCurr(), GetfnTableStart() ); + rSh.MoveTable( GotoCurrTable, GetfnTableStart() ); if( !pSelection && ( pTableSet || pTAutoFormat )) { if( pTableSet ) @@ -1462,14 +1462,14 @@ void SwInsertDBColAutoPilot::SetTabSet() rSh.GetTableFormat()->GetName() ) pTableSet->ClearItem( FN_PARAM_TABLE_NAME ); - rSh.MoveTable( GetfnTableCurr(), GetfnTableStart() ); + rSh.MoveTable( GotoCurrTable, GetfnTableStart() ); rSh.SetMark(); - rSh.MoveTable( GetfnTableCurr(), GetfnTableEnd() ); + rSh.MoveTable( GotoCurrTable, GetfnTableEnd() ); ItemSetToTableParam( *pTableSet, rSh ); rSh.ClearMark(); - rSh.MoveTable( GetfnTableCurr(), GetfnTableStart() ); + rSh.MoveTable( GotoCurrTable, GetfnTableStart() ); } DB_ColumnConfigData::~DB_ColumnConfigData() {} diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 7c281a5..3293dae 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -2685,7 +2685,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest ) rSh.DelRight(); rSh.InsertTable( aInsTableOpts, nRows, nCols, text::HoriOrientation::FULL, pTAFormat ); - rSh.MoveTable( fnTablePrev, fnTableStart ); + rSh.MoveTable( GotoPrevTable, fnTableStart ); if( !aTableName.isEmpty() && !rSh.GetTableStyle( aTableName ) ) rSh.GetTableFormat()->SetName( aTableName ); diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 0f83534..132b91c 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -724,11 +724,11 @@ void SwTableShell::Execute(SfxRequest &rReq) bCallDone = true; break; case FN_END_TABLE: - rSh.MoveTable( fnTableCurr, fnTableEnd ); + rSh.MoveTable( GotoCurrTable, fnTableEnd ); bCallDone = true; break; case FN_START_TABLE: - rSh.MoveTable( fnTableCurr, fnTableStart ); + rSh.MoveTable( GotoCurrTable, fnTableStart ); bCallDone = true; break; case FN_GOTO_NEXT_CELL: @@ -793,9 +793,9 @@ void SwTableShell::Execute(SfxRequest &rReq) break; case FN_TABLE_SELECT_ALL: rSh.EnterStdMode(); - rSh.MoveTable( fnTableCurr, fnTableStart ); + rSh.MoveTable( GotoCurrTable, fnTableStart ); rSh.SttSelect(); - rSh.MoveTable( fnTableCurr, fnTableEnd ); + rSh.MoveTable( GotoCurrTable, fnTableEnd ); rSh.EndSelect(); bCallDone = true; break; diff --git a/sw/source/uibase/shells/txtcrsr.cxx b/sw/source/uibase/shells/txtcrsr.cxx index 3319993..b14c08c 100644 --- a/sw/source/uibase/shells/txtcrsr.cxx +++ b/sw/source/uibase/shells/txtcrsr.cxx @@ -396,10 +396,10 @@ void SwTextShell::ExecMoveMisc(SfxRequest &rReq) rSh.GotoFootnoteText(); break; case FN_PREV_TABLE: - bRet = rSh.MoveTable( fnTablePrev, fnTableStart); + bRet = rSh.MoveTable( GotoPrevTable, fnTableStart); break; case FN_NEXT_TABLE: - bRet = rSh.MoveTable(fnTableNext, fnTableStart); + bRet = rSh.MoveTable(GotoNextTable, fnTableStart); break; case FN_GOTO_NEXT_REGION : bRet = rSh.MoveRegion(fnRegionNext, fnRegionStart); diff --git a/sw/source/uibase/table/tablemgr.cxx b/sw/source/uibase/table/tablemgr.cxx index e9fb41e..b2e7cd0 100644 --- a/sw/source/uibase/table/tablemgr.cxx +++ b/sw/source/uibase/table/tablemgr.cxx @@ -204,7 +204,7 @@ uno::Reference< frame::XModel > SwTableFUNC::InsertChart( { aName = pSh->GetTableFormat()->GetName(); // insert node before table - pSh->MoveTable( fnTableCurr, fnTableStart ); + pSh->MoveTable( GotoCurrTable, fnTableStart ); pSh->Up( false ); if ( pSh->IsCursorInTable() ) { diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx index 1cd00ba..79a6614 100644 --- a/sw/source/uibase/uiview/viewmdi.cxx +++ b/sw/source/uibase/uiview/viewmdi.cxx @@ -319,9 +319,9 @@ IMPL_LINK_TYPED( SwView, MoveNavigationHdl, void*, p, void ) case NID_TBL : rSh.EnterStdMode(); if(bNext) - rSh.MoveTable(fnTableNext, fnTableStart); + rSh.MoveTable(GotoNextTable, fnTableStart); else - rSh.MoveTable(fnTablePrev, fnTableStart); + rSh.MoveTable(GotoPrevTable, fnTableStart); break; case NID_FRM : case NID_GRF: diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index f859747..3aedea4 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -211,7 +211,7 @@ bool SwWrtShell::GoStart( bool bKeepArea, bool *pMoveTable, *pMoveTable = false; return true; } - if( MoveTable( fnTableCurr, fnTableStart ) || bDontMoveRegion ) + if( MoveTable( GotoCurrTable, fnTableStart ) || bDontMoveRegion ) { if ( pMoveTable ) *pMoveTable = true; @@ -259,12 +259,12 @@ bool SwWrtShell::GoStart( bool bKeepArea, bool *pMoveTable, bool SwWrtShell::GoEnd(bool bKeepArea, bool *pMoveTable) { if ( pMoveTable && *pMoveTable ) - return MoveTable( fnTableCurr, fnTableEnd ); + return MoveTable( GotoCurrTable, fnTableEnd ); if ( IsCursorInTable() ) { if ( MoveSection( GoCurrSection, fnSectionEnd ) || - MoveTable( fnTableCurr, fnTableEnd ) ) + MoveTable( GotoCurrTable, fnTableEnd ) ) return true; } else commit d562c4e4ead3174a9cc720835ecfbfa16e40e15d Author: Noel Grandin <n...@peralex.com> Date: Tue Aug 30 13:20:34 2016 +0200 Get rid of a pointless indirect function pointer variable Change-Id: I542a5fb00a5c972230c072d72a745fddb095f708 diff --git a/sw/inc/cshtyp.hxx b/sw/inc/cshtyp.hxx index d456fec..5615d34 100644 --- a/sw/inc/cshtyp.hxx +++ b/sw/inc/cshtyp.hxx @@ -31,7 +31,7 @@ class SwLayoutFrame; struct SwMoveFnCollection; // Type definition for CursorShell. -// Direction-parameter for MovePage (initialized in SwContentFrame). +// Direction-parameter for MovePage. typedef SwLayoutFrame * (*SwWhichPage)( const SwLayoutFrame * ); SwLayoutFrame *GetPrevFrame( const SwLayoutFrame *pFrame ); SwLayoutFrame *GetThisFrame( const SwLayoutFrame *pFrame ); @@ -40,9 +40,11 @@ typedef SwContentFrame * (*SwPosPage)( const SwLayoutFrame * ); SwContentFrame *GetFirstSub( const SwLayoutFrame *pLayout ); SwContentFrame *GetLastSub( const SwLayoutFrame *pLayout ); -// Direction-parameter for MovePara (initialized in SwContentFrame). +// Direction-parameter for MovePara. typedef bool (*SwWhichPara)( SwPaM&, SwMoveFnCollection const & ); -extern SwWhichPara fnParaPrev, fnParaCurr, fnParaNext; +bool GoPrevPara( SwPaM&, SwMoveFnCollection const &); +SW_DLLPUBLIC bool GoCurrPara( SwPaM&, SwMoveFnCollection const &); +bool GoNextPara( SwPaM&, SwMoveFnCollection const &); extern SwMoveFnCollection const & fnParaStart; extern SwMoveFnCollection const & fnParaEnd; @@ -101,7 +103,6 @@ enum class SwDocPositions OtherEnd }; -SW_DLLPUBLIC SwWhichPara GetfnParaCurr(); SW_DLLPUBLIC SwMoveFnCollection const & GetfnParaStart(); SW_DLLPUBLIC SwMoveFnCollection const & GetfnParaEnd(); diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 3ef3363..e1b9a65 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -399,7 +399,7 @@ void SwUiWriterTest::testBookmarkCopy() rIDCO.SplitNode(*aPaM.GetPoint(), false); rIDCO.InsertString(aPaM, "bar"); aPaM.SetMark(); - aPaM.MovePara(GetfnParaCurr(), GetfnParaStart()); + aPaM.MovePara(GoCurrPara, GetfnParaStart()); rIDMA.makeMark(aPaM, "Mark", IDocumentMarkAccess::MarkType::BOOKMARK); aPaM.Exchange(); aPaM.DeleteMark(); diff --git a/sw/source/core/crsr/paminit.cxx b/sw/source/core/crsr/paminit.cxx index 47879a9..a296b9b 100644 --- a/sw/source/core/crsr/paminit.cxx +++ b/sw/source/core/crsr/paminit.cxx @@ -44,9 +44,6 @@ static SwMoveFnCollection aBwrd = { /* fnSection */ &SwNodes::GoEndOfSection }; -SwWhichPara fnParaPrev = &GoPrevPara; -SwWhichPara fnParaCurr = &GoCurrPara; -SwWhichPara fnParaNext = &GoNextPara; SwMoveFnCollection const & fnParaStart = aFwrd; SwMoveFnCollection const & fnParaEnd = aBwrd; @@ -69,10 +66,6 @@ SwMoveFnCollection const & fnRegionEnd = aBwrd; SwMoveFnCollection const & fnMoveBackward = aBwrd; SwMoveFnCollection const & fnMoveForward = aFwrd; -SwWhichPara GetfnParaCurr() -{ - return fnParaCurr; -} SwMoveFnCollection const & GetfnParaStart() { return fnParaStart; diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 484b0be..1eb2c3e 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -2037,10 +2037,10 @@ bool SwCursor::MovePara(SwWhichPara fnWhichPara, SwMoveFnCollection const & fnPo // for optimization test something before const SwNode* pNd = &GetPoint()->nNode.GetNode(); bool bShortCut = false; - if ( fnWhichPara == fnParaCurr ) + if ( fnWhichPara == GoCurrPara ) { // #i41048# - // If fnWhichPara == fnParaCurr then (*fnWhichPara)( *this, fnPosPara ) + // If fnWhichPara == GoCurrPara then (*fnWhichPara)( *this, fnPosPara ) // can already move the cursor to a different text node. In this case // we better check if IsSelOvr(). const SwContentNode* pContentNd = pNd->GetContentNode(); @@ -2055,7 +2055,7 @@ bool SwCursor::MovePara(SwWhichPara fnWhichPara, SwMoveFnCollection const & fnPo { if ( pNd->IsTextNode() && pNd->GetNodes()[ pNd->GetIndex() + - (fnWhichPara == fnParaNext ? 1 : -1 ) ]->IsTextNode() ) + (fnWhichPara == GoNextPara ? 1 : -1 ) ]->IsTextNode() ) bShortCut = true; } diff --git a/sw/source/core/inc/pamtyp.hxx b/sw/source/core/inc/pamtyp.hxx index 3e02c99..9b5bd95 100644 --- a/sw/source/core/inc/pamtyp.hxx +++ b/sw/source/core/inc/pamtyp.hxx @@ -42,11 +42,6 @@ bool GoPrevious(SwNode* pNd, SwIndex * pIdx, sal_uInt16 nMode ); SW_DLLPUBLIC SwContentNode* GoNextNds( SwNodeIndex * pIdx, bool ); SwContentNode* GoPreviousNds( SwNodeIndex * pIdx, bool ); -// Funktionsdefinitionen fuer die SwCursorShell -bool GoPrevPara( SwPaM&, SwMoveFnCollection const &); -bool GoCurrPara( SwPaM&, SwMoveFnCollection const &); -bool GoNextPara( SwPaM&, SwMoveFnCollection const &); - // Typedefiniton fuer Funktionen typedef bool (*GoNd)( SwNode*, SwIndex*, sal_uInt16 ); typedef SwContentNode* (*GoNds)( SwNodeIndex*, bool ); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 76f3bc9..1a17693 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -1249,7 +1249,7 @@ SwXTextCursor::gotoNextWord(sal_Bool Expand) throw (uno::RuntimeException, std:: // try to go to the start of the next paragraph if (!bTmp) { - rUnoCursor.MovePara(fnParaNext, fnParaStart); + rUnoCursor.MovePara(GoNextPara, fnParaStart); } } @@ -1436,7 +1436,7 @@ SwXTextCursor::gotoNextSentence(sal_Bool Expand) throw (uno::RuntimeException, s bool bRet = rUnoCursor.GoSentence(SwCursor::NEXT_SENT); if (!bRet) { - bRet = rUnoCursor.MovePara(fnParaNext, fnParaStart); + bRet = rUnoCursor.MovePara(GoNextPara, fnParaStart); } // if at the end of the sentence (i.e. at the space after the '.') @@ -1471,10 +1471,10 @@ throw (uno::RuntimeException, std::exception) bool bRet = rUnoCursor.GoSentence(SwCursor::PREV_SENT); if (!bRet) { - bRet = rUnoCursor.MovePara(fnParaPrev, fnParaStart); + bRet = rUnoCursor.MovePara(GoPrevPara, fnParaStart); if (bRet) { - rUnoCursor.MovePara(fnParaCurr, fnParaEnd); + rUnoCursor.MovePara(GoCurrPara, fnParaEnd); // at the end of a paragraph move to the sentence end again rUnoCursor.GoSentence(SwCursor::PREV_SENT); } @@ -1526,7 +1526,7 @@ SwXTextCursor::gotoEndOfSentence(sal_Bool Expand) throw (uno::RuntimeException, bool bAlreadyParaEnd = SwUnoCursorHelper::IsEndOfPara(rUnoCursor); bool bRet = !bAlreadyParaEnd && (rUnoCursor.GoSentence(SwCursor::END_SENT) - || rUnoCursor.MovePara(fnParaCurr, fnParaEnd)); + || rUnoCursor.MovePara(GoCurrPara, fnParaEnd)); if (CURSOR_META == m_pImpl->m_eType) { bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText, @@ -1574,10 +1574,10 @@ throw (uno::RuntimeException, std::exception) bool bRet = SwUnoCursorHelper::IsStartOfPara(rUnoCursor); if (!bRet) { - bRet = rUnoCursor.MovePara(fnParaCurr, fnParaStart); + bRet = rUnoCursor.MovePara(GoCurrPara, fnParaStart); } - // since MovePara(fnParaCurr, fnParaStart) only returns false + // since MovePara(GoCurrPara, fnParaStart) only returns false // if we were already at the start of the paragraph this function // should always complete successfully. OSL_ENSURE( bRet, "gotoStartOfParagraph failed" ); @@ -1599,10 +1599,10 @@ SwXTextCursor::gotoEndOfParagraph(sal_Bool Expand) throw (uno::RuntimeException, bool bRet = SwUnoCursorHelper::IsEndOfPara(rUnoCursor); if (!bRet) { - bRet = rUnoCursor.MovePara(fnParaCurr, fnParaEnd); + bRet = rUnoCursor.MovePara(GoCurrPara, fnParaEnd); } - // since MovePara(fnParaCurr, fnParaEnd) only returns false + // since MovePara(GoCurrPara, fnParaEnd) only returns false // if we were already at the end of the paragraph this function // should always complete successfully. OSL_ENSURE( bRet, "gotoEndOfParagraph failed" ); @@ -1621,7 +1621,7 @@ SwXTextCursor::gotoNextParagraph(sal_Bool Expand) throw (uno::RuntimeException, return false; } SwUnoCursorHelper::SelectPam(rUnoCursor, Expand); - const bool bRet = rUnoCursor.MovePara(fnParaNext, fnParaStart); + const bool bRet = rUnoCursor.MovePara(GoNextPara, fnParaStart); return bRet; } @@ -1638,7 +1638,7 @@ throw (uno::RuntimeException, std::exception) return false; } SwUnoCursorHelper::SelectPam(rUnoCursor, Expand); - const bool bRet = rUnoCursor.MovePara(fnParaPrev, fnParaStart); + const bool bRet = rUnoCursor.MovePara(GoPrevPara, fnParaStart); return bRet; } @@ -2002,14 +2002,14 @@ lcl_SelectParaAndReset( SwPaM &rPaM, SwDoc & rDoc, auto pTemp ( rDoc.CreateUnoCursor(aStart) ); if(!SwUnoCursorHelper::IsStartOfPara(*pTemp)) { - pTemp->MovePara(fnParaCurr, fnParaStart); + pTemp->MovePara(GoCurrPara, fnParaStart); } pTemp->SetMark(); *pTemp->GetPoint() = aEnd; SwUnoCursorHelper::SelectPam(*pTemp, true); if(!SwUnoCursorHelper::IsEndOfPara(*pTemp)) { - pTemp->MovePara(fnParaCurr, fnParaEnd); + pTemp->MovePara(GoCurrPara, fnParaEnd); } rDoc.ResetAttrs(*pTemp, true, rWhichIds); } diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index f05434a..61f3f995 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -593,7 +593,7 @@ SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementE } else { - aNewCursor->MovePara(fnParaNext, fnParaStart); + aNewCursor->MovePara(GoNextPara, fnParaStart); } if (m_nEndIndex < aNewCursor->Start()->nNode.GetIndex()) { @@ -625,7 +625,7 @@ SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementE // before AND after the movement... if (lcl_CursorIsInSection( &rUnoCursor, m_pOwnStartNode ) && (m_bFirstParagraph || bInTable || - (rUnoCursor.MovePara(fnParaNext, fnParaStart) && + (rUnoCursor.MovePara(GoNextPara, fnParaStart) && lcl_CursorIsInSection( &rUnoCursor, m_pOwnStartNode )))) { SwPosition* pStart = rUnoCursor.Start(); diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index 301f60a..5715ac0 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -75,13 +75,13 @@ SwParaSelection::SwParaSelection(SwCursor & rCursor) // is it at the start? if (m_rCursor.GetPoint()->nContent != 0) { - m_rCursor.MovePara(fnParaCurr, fnParaStart); + m_rCursor.MovePara(GoCurrPara, fnParaStart); } // or at the end already? if (m_rCursor.GetPoint()->nContent != m_rCursor.GetContentNode()->Len()) { m_rCursor.SetMark(); - m_rCursor.MovePara(fnParaCurr, fnParaEnd); + m_rCursor.MovePara(GoCurrPara, fnParaEnd); } } @@ -90,7 +90,7 @@ SwParaSelection::~SwParaSelection() if (m_rCursor.GetPoint()->nContent != 0) { m_rCursor.DeleteMark(); - m_rCursor.MovePara(fnParaCurr, fnParaStart); + m_rCursor.MovePara(GoCurrPara, fnParaStart); } } @@ -1180,7 +1180,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) auto pTemp( aCursor.GetDoc()->CreateUnoCursor(aStart) ); if(!SwUnoCursorHelper::IsStartOfPara(*pTemp)) { - pTemp->MovePara(fnParaCurr, fnParaStart); + pTemp->MovePara(GoCurrPara, fnParaStart); } pTemp->SetMark(); @@ -1190,7 +1190,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) if (!SwUnoCursorHelper::IsEndOfPara(*pTemp)) { - pTemp->MovePara(fnParaCurr, fnParaEnd); + pTemp->MovePara(GoCurrPara, fnParaEnd); } @@ -1399,11 +1399,11 @@ throw (uno::RuntimeException, std::exception) SwPosition aPos( *pTextNode ); SwCursor aCursor( aPos, nullptr ); if (!SwUnoCursorHelper::IsStartOfPara(aCursor)) { - aCursor.MovePara(fnParaCurr, fnParaStart); + aCursor.MovePara(GoCurrPara, fnParaStart); } SwUnoCursorHelper::SelectPam(aCursor, true); if (pTextNode->GetText().getLength()) { - aCursor.MovePara(fnParaCurr, fnParaEnd); + aCursor.MovePara(GoCurrPara, fnParaEnd); } SwUnoCursorHelper::SetString(aCursor, aString); SwUnoCursorHelper::SelectPam(aCursor, false); diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 24d0822..354c481 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1617,9 +1617,9 @@ SwXText::convertToTextFrame( SwCursor aDelete(*aStartPam.GetPoint(), nullptr); *aStartPam.GetPoint() = // park it because node is deleted SwPosition(GetDoc()->GetNodes().GetEndOfContent()); - aDelete.MovePara(fnParaCurr, fnParaStart); + aDelete.MovePara(GoCurrPara, fnParaStart); aDelete.SetMark(); - aDelete.MovePara(fnParaCurr, fnParaEnd); + aDelete.MovePara(GoCurrPara, fnParaEnd); GetDoc()->getIDocumentContentOperations().DelFullPara(aDelete); } if (bParaAfterInserted) @@ -1627,9 +1627,9 @@ SwXText::convertToTextFrame( SwCursor aDelete(*pEndPam->GetPoint(), nullptr); *pEndPam->GetPoint() = // park it because node is deleted SwPosition(GetDoc()->GetNodes().GetEndOfContent()); - aDelete.MovePara(fnParaCurr, fnParaStart); + aDelete.MovePara(GoCurrPara, fnParaStart); aDelete.SetMark(); - aDelete.MovePara(fnParaCurr, fnParaEnd); + aDelete.MovePara(GoCurrPara, fnParaEnd); GetDoc()->getIDocumentContentOperations().DelFullPara(aDelete); } throw lang::IllegalArgumentException(); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 36f2fc1..84eccfb 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -765,7 +765,7 @@ if( m_pSttNdIdx->GetIndex()+1 == m_pPam->GetBound( false ).nNode.GetIndex() ) pCursorSh->GetCursor()->GetPoint() ->nNode.GetIndex() == nNodeIdx ) { - pCursorSh->MovePara(fnParaPrev, fnParaEnd ); + pCursorSh->MovePara(GoPrevPara, fnParaEnd ); pCursorSh->SetMark(); pCursorSh->ClearMark(); } diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index c1e8433..1ff76ed 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -280,7 +280,7 @@ void SwDropCapsPict::UpdatePaintSettings() mpPage->rSh.Push(); mpPage->rSh.SttCursorMove(); mpPage->rSh.ClearMark(); - SwWhichPara pSwuifnParaCurr = GetfnParaCurr(); + SwWhichPara pSwuifnParaCurr = GoCurrPara; SwMoveFnCollection const & pSwuifnParaStart = GetfnParaStart(); mpPage->rSh.MovePara(pSwuifnParaCurr,pSwuifnParaStart); // normal diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 1aa7803..279f963 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1368,13 +1368,13 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, // at the end. rSh.SwCursorShell::MovePara( - GetfnParaCurr(), GetfnParaStart() ); + GoCurrPara, GetfnParaStart() ); pMark = rSh.SetBookmark( vcl::KeyCode(), OUString(), OUString(), IDocumentMarkAccess::MarkType::UNO_BOOKMARK ); rSh.SwCursorShell::MovePara( - GetfnParaCurr(), GetfnParaEnd() ); + GoCurrPara, GetfnParaEnd() ); bSetCursor = false; } } diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index 9745e49..6f9a4f4 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -449,7 +449,7 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig else { //we may end up inside of a paragraph if the left margin is not at DEFAULT_LEFT_DISTANCE - rShell.MovePara(GetfnParaCurr(), GetfnParaStart()); + rShell.MovePara(GoCurrPara, GetfnParaStart()); } bool bSplitNode = !rShell.GetText().isEmpty(); sal_Int32 nMoves = rConfigItem.GetGreetingMoves(); diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx index a8a7f8f..a879fac 100644 --- a/sw/source/uibase/shells/langhelper.cxx +++ b/sw/source/uibase/shells/langhelper.cxx @@ -587,12 +587,12 @@ namespace SwLangHelper { // select current para if (!rWrtSh.IsSttPara()) - rWrtSh.MovePara( fnParaCurr, fnParaStart ); + rWrtSh.MovePara( GoCurrPara, fnParaStart ); if (!rWrtSh.HasMark()) rWrtSh.SetMark(); rWrtSh.SwapPam(); if (!rWrtSh.IsEndPara()) - rWrtSh.MovePara( fnParaCurr, fnParaEnd ); + rWrtSh.MovePara( GoCurrPara, fnParaEnd ); #if OSL_DEBUG_LEVEL > 1 OUString aSelText; rWrtSh.GetSelectedText( aSelText ); diff --git a/sw/source/uibase/wrtsh/delete.cxx b/sw/source/uibase/wrtsh/delete.cxx index 8ce3d42..1736273 100644 --- a/sw/source/uibase/wrtsh/delete.cxx +++ b/sw/source/uibase/wrtsh/delete.cxx @@ -394,7 +394,7 @@ void SwWrtShell::DelToEndOfPara() ResetCursorStack(); Push(); SetMark(); - if( !MovePara(fnParaCurr,fnParaEnd)) + if( !MovePara(GoCurrPara,fnParaEnd)) { Pop(false); return; @@ -411,7 +411,7 @@ void SwWrtShell::DelToStartOfPara() ResetCursorStack(); Push(); SetMark(); - if( !MovePara(fnParaCurr,fnParaStart)) + if( !MovePara(GoCurrPara,fnParaStart)) { Pop(false); return; @@ -452,7 +452,7 @@ long SwWrtShell::DelToEndOfSentence() SetMark(); if (!IsEndPara()) // can only be at the end if it's empty { // for an empty paragraph this would actually select the _next_ - SwCursorShell::MovePara(fnParaCurr, fnParaEnd); + SwCursorShell::MovePara(GoCurrPara, fnParaEnd); } if (!IsEndOfDoc()) // do not delete last paragraph in body text { diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index 8ffe3c8..f859747 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -341,13 +341,13 @@ bool SwWrtShell::EndPg( bool bSelect ) bool SwWrtShell::SttPara( bool bSelect ) { ShellMoveCursor aTmp( this, bSelect ); - return MovePara( fnParaCurr, fnParaStart ); + return MovePara( GoCurrPara, fnParaStart ); } void SwWrtShell::EndPara( bool bSelect ) { ShellMoveCursor aTmp( this, bSelect ); - MovePara(fnParaCurr,fnParaEnd); + MovePara(GoCurrPara,fnParaEnd); } // Column-by-jumping. diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx index 4998aa9..c92f528 100644 --- a/sw/source/uibase/wrtsh/select.cxx +++ b/sw/source/uibase/wrtsh/select.cxx @@ -108,9 +108,9 @@ void SwWrtShell::SelPara(const Point *pPt ) { SwMvContext aMvContext(this); ClearMark(); - SwCursorShell::MovePara( fnParaCurr, fnParaStart ); + SwCursorShell::MovePara( GoCurrPara, fnParaStart ); SttSelect(); - SwCursorShell::MovePara( fnParaCurr, fnParaEnd ); + SwCursorShell::MovePara( GoCurrPara, fnParaEnd ); } EndSelect(); if(pPt) diff --git a/sw/source/uibase/wrtsh/wrtsh4.cxx b/sw/source/uibase/wrtsh/wrtsh4.cxx index 4b4d478..e610aae 100644 --- a/sw/source/uibase/wrtsh/wrtsh4.cxx +++ b/sw/source/uibase/wrtsh/wrtsh4.cxx @@ -36,7 +36,7 @@ bool SwWrtShell::SttWrd() ClearMark(); if( !GoStartWord() ) // not found --> go to the beginning of the paragraph. - SwCursorShell::MovePara( fnParaCurr, fnParaStart ); + SwCursorShell::MovePara( GoCurrPara, fnParaStart ); ClearMark(); // If Mark was previously set, summarize. Combine(); @@ -57,7 +57,7 @@ bool SwWrtShell::EndWrd() ClearMark(); if( !GoEndWord() ) // not found --> go to the end of the paragraph. - SwCursorShell::MovePara(fnParaCurr, fnParaEnd); + SwCursorShell::MovePara(GoCurrPara, fnParaEnd); ClearMark(); // If Mark was previously set, summarize. Combine(); @@ -82,7 +82,7 @@ bool SwWrtShell::NxtWrd_() { if( !GoNextWord() ) { - if( (!IsEndPara() && !SwCursorShell::MovePara( fnParaCurr, fnParaEnd ) ) + if( (!IsEndPara() && !SwCursorShell::MovePara( GoCurrPara, fnParaEnd ) ) || !SwCursorShell::Right(1,CRSR_SKIP_CHARS) ) break; bRet = IsStartWord(); @@ -113,7 +113,7 @@ bool SwWrtShell::PrvWrd_() { if( !GoPrevWord() ) { - if( (!IsSttPara() && !SwCursorShell::MovePara( fnParaCurr, fnParaStart ) ) + if( (!IsSttPara() && !SwCursorShell::MovePara( GoCurrPara, fnParaStart ) ) || !SwCursorShell::Left(1,CRSR_SKIP_CHARS) ) break; bRet = IsStartWord(); @@ -143,7 +143,7 @@ bool SwWrtShell::NxtWrdForDelete() ClearMark(); if ( !GoNextWord() ) { - SwCursorShell::MovePara( fnParaCurr, fnParaEnd ); + SwCursorShell::MovePara( GoCurrPara, fnParaEnd ); } ClearMark(); Combine(); @@ -166,7 +166,7 @@ bool SwWrtShell::PrvWrdForDelete() ClearMark(); if( !GoPrevWord() ) { - SwCursorShell::MovePara( fnParaCurr, fnParaStart ); + SwCursorShell::MovePara( GoCurrPara, fnParaStart ); } ClearMark(); Combine(); @@ -183,7 +183,7 @@ bool SwWrtShell::FwdSentence_() return false; } if( !GoNextSentence() && !IsEndPara() ) - SwCursorShell::MovePara(fnParaCurr, fnParaEnd); + SwCursorShell::MovePara(GoCurrPara, fnParaEnd); ClearMark(); Combine(); @@ -201,7 +201,7 @@ bool SwWrtShell::BwdSentence_() } if( !GoStartSentence() && !IsSttPara() ) // not found --> go to the beginning of the paragraph - SwCursorShell::MovePara( fnParaCurr, fnParaStart ); + SwCursorShell::MovePara( GoCurrPara, fnParaStart ); ClearMark(); Combine(); return true; @@ -211,7 +211,7 @@ bool SwWrtShell::FwdPara_() { Push(); ClearMark(); - bool bRet = SwCursorShell::MovePara(fnParaNext, fnParaStart); + bool bRet = SwCursorShell::MovePara(GoNextPara, fnParaStart); ClearMark(); Combine(); @@ -223,7 +223,7 @@ bool SwWrtShell::BwdPara_() Push(); ClearMark(); - bool bRet = SwCursorShell::MovePara(fnParaPrev, fnParaStart); + bool bRet = SwCursorShell::MovePara(GoPrevPara, fnParaStart); if ( !bRet && !IsSttOfPara() ) { SttPara(); commit 7bf9abffb69966882feecca4b35a04722e5b7822 Author: Noel Grandin <n...@peralex.com> Date: Tue Aug 30 12:35:42 2016 +0200 convert FindRanges to o3tl::typed_flags_set Change-Id: I745b2f469e44b79a06a18bc5264aae75b096835c diff --git a/sw/inc/cshtyp.hxx b/sw/inc/cshtyp.hxx index c2e9a3b..d456fec 100644 --- a/sw/inc/cshtyp.hxx +++ b/sw/inc/cshtyp.hxx @@ -21,6 +21,7 @@ #include <tools/solar.h> #include "swdllapi.h" +#include <o3tl/typed_flags_set.hxx> class SwPaM; class SwContentFrame; @@ -72,20 +73,24 @@ extern SwMoveFnCollection const & fnRegionEnd; /* * The following combinations are allowed: - * - find one in body -> FND_IN_BODY - * - find all in body: -> FND_IN_BODYONLY | FND_IN_SELALL - * - find in selections: one/all -> FND_IN_SEL [ | FND_IN_SELALL ] - * - find not in body: one/all -> FND_IN_OTHER [ | FND_IN_SELALL ] - * - find all everywhere -> FND_IN_SELALL + * - find one in body -> FindRanges::InBody + * - find all in body: -> FindRanges::InBodyOnly | FindRanges::InSelAll + * - find in selections: one/all -> FindRanges::InSel [ | FindRanges::InSelAll ] + * - find not in body: one/all -> FindRanges::InOther [ | FindRanges::InSelAll ] + * - find all everywhere -> FindRanges::InSelAll */ -enum FindRanges +enum class FindRanges { - FND_IN_BODY = 0x00, ///< Find "one" only in body text. - FND_IN_OTHER = 0x02, ///< Find "all" in Footer/Header/Fly... - FND_IN_SEL = 0x04, ///< Find in selections. - FND_IN_BODYONLY = 0x08, ///< Find only in body - only in combination with FND_IN_SELALL !!! - FND_IN_SELALL = 0x01 ///< All (only in non-body and selections). + InBody = 0x00, ///< Find "one" only in body text. + InSelAll = 0x01, ///< All (only in non-body and selections). + InOther = 0x02, ///< Find "all" in Footer/Header/Fly... + InSel = 0x04, ///< Find in selections. + InBodyOnly = 0x08, ///< Find only in body - only in combination with FindRanges::InSelAll !!! }; +namespace o3tl +{ + template<> struct typed_flags<FindRanges> : is_typed_flags<FindRanges, 0x0f> {}; +} enum class SwDocPositions { diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx index 122dc4c..0e9d7d3 100644 --- a/sw/inc/swcrsr.hxx +++ b/sw/inc/swcrsr.hxx @@ -116,17 +116,17 @@ public: bool bSearchInNotes, SwDocPositions nStart, SwDocPositions nEnde, bool& bCancel, - FindRanges = FND_IN_BODY, + FindRanges = FindRanges::InBody, bool bReplace = false ); sal_uLong Find( const SwTextFormatColl& rFormatColl, SwDocPositions nStart, SwDocPositions nEnde, bool& bCancel, - FindRanges = FND_IN_BODY, + FindRanges = FindRanges::InBody, const SwTextFormatColl* pReplFormat = nullptr ); sal_uLong Find( const SfxItemSet& rSet, bool bNoCollections, SwDocPositions nStart, SwDocPositions nEnde, bool& bCancel, - FindRanges = FND_IN_BODY, + FindRanges = FindRanges::InBody, const css::util::SearchOptions2* pSearchOpt = nullptr, const SfxItemSet* rReplSet = nullptr ); diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index b732055..88e4e11 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -566,7 +566,7 @@ void SwMacrosTest::testFindReplace() // now do another Find, inside the selection from the first Find // opts.searchFlags = 71680; bFound = pPaM->Find( - opts, false, SwDocPositions::Curr, SwDocPositions::End, bCancel, FND_IN_SEL); + opts, false, SwDocPositions::Curr, SwDocPositions::End, bCancel, FindRanges::InSel); CPPUNIT_ASSERT(bFound); CPPUNIT_ASSERT(pPaM->HasMark()); CPPUNIT_ASSERT_EQUAL(OUString(""), pPaM->GetText()); diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 32df042..057d0a9 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -729,7 +729,7 @@ sal_uLong SwCursor::Find( const SearchOptions2& rSearchOpt, bool bSearchInNotes, bool bSearchSel = 0 != (rSearchOpt.searchFlag & SearchFlags::REG_NOT_BEGINOFLINE); if( bSearchSel ) - eFndRngs = (FindRanges)(eFndRngs | FND_IN_SEL); + eFndRngs = (FindRanges)(eFndRngs | FindRanges::InSel); SwFindParaText aSwFindParaText( rSearchOpt, bSearchInNotes, bReplace, *this ); sal_uLong nRet = FindAll( aSwFindParaText, nStart, nEnd, eFndRngs, bCancel ); pDoc->SetOle2Link( aLnk ); diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 3309d89..484b0be 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -751,7 +751,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCurso bool bIsUnoCursor = dynamic_cast<SwUnoCursor*>(pCurrentCursor) != nullptr; std::unique_ptr<PercentHdl> pPHdl; sal_uInt16 nCursorCnt = 0; - if( FND_IN_SEL & eFndRngs ) + if( FindRanges::InSel & eFndRngs ) { while( pCurrentCursor != ( pTmpCursor = pTmpCursor->GetNext() )) ++nCursorCnt; @@ -797,7 +797,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCurso ++nFound; - if( !( eFndRngs & FND_IN_SELALL) ) + if( !( eFndRngs & FindRanges::InSelAll) ) { bEnd = true; break; @@ -841,7 +841,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCurso } } - if( bEnd || !( eFndRngs & ( FND_IN_SELALL | FND_IN_SEL )) ) + if( bEnd || !( eFndRngs & ( FindRanges::InSelAll | FindRanges::InSel )) ) break; pTmpCursor = pTmpCursor->GetNext(); @@ -943,7 +943,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, SwNodes& rNds = GetDoc()->GetNodes(); // search in sections? - if( FND_IN_SEL & eFndRngs ) + if( FindRanges::InSel & eFndRngs ) { // if string was not found in region then get all sections (cursors // stays unchanged) @@ -962,7 +962,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, pFndRing->GetRingContainer().merge( GetRingContainer() ); delete pFndRing; } - else if( FND_IN_OTHER & eFndRngs ) + else if( FindRanges::InOther & eFndRngs ) { // put cursor as copy of current into ring // chaining points always to first created, so forward @@ -999,7 +999,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, } pSav.release(); - if( !( FND_IN_SELALL & eFndRngs )) + if( !( FindRanges::InSelAll & eFndRngs )) { // there should only be a single one, thus add it // independent from search direction: SPoint is always bigger than @@ -1021,11 +1021,11 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, } delete pFndRing; } - else if( FND_IN_SELALL & eFndRngs ) + else if( FindRanges::InSelAll & eFndRngs ) { std::unique_ptr< SwCursor> pSav( Create( this ) ); // save the current cursor - const SwNode* pSttNd = ( FND_IN_BODYONLY & eFndRngs ) + const SwNode* pSttNd = ( FindRanges::InBodyOnly & eFndRngs ) ? rNds.GetEndOfContent().StartOfSectionNode() : rNds.GetEndOfPostIts().StartOfSectionNode(); @@ -1065,7 +1065,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, // if a GetMark is set then keep the GetMark of the found object // This allows spanning an area with this search. SwPosition aMarkPos( *GetMark() ); - const bool bMarkPos = HasMark() && !eFndRngs; + const bool bMarkPos = HasMark() && (eFndRngs == FindRanges::InBody); if( 0 != (nFound = rParas.Find( this, fnMove, &aRegion, bInReadOnly ) ? 1 : 0) diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index d1d58f5..c4756af 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -374,7 +374,7 @@ void SwEditShell::ApplyAutoMark() // todo/mba: assuming that notes shouldn't be searched bool bSearchInNotes = false; sal_uLong nRet = Find( aSearchOpt, bSearchInNotes, SwDocPositions::Start, SwDocPositions::End, bCancel, - (FindRanges)(FND_IN_SELALL) ); + (FindRanges)(FindRanges::InSelAll) ); if(nRet) { diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 2bbf614..d86f9e7 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -456,7 +456,7 @@ static void lcl_SelectSameStrings(SwWrtShell& rSh, bool bWordOnly, bool bCaseSen //todo/mba: assuming that notes should not be searched bool bSearchInNotes = false; rSh.Find( aSearchOpt, bSearchInNotes, SwDocPositions::Start, SwDocPositions::End, bCancel, - (FindRanges)(FND_IN_SELALL|FND_IN_BODYONLY) ); + (FindRanges)(FindRanges::InSelAll|FindRanges::InBodyOnly) ); } void SwIndexMarkPane::InsertMark() diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index 0042cfe..5226c3a 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -364,18 +364,18 @@ typedef bool (SwWrtShell:: *FNSimpleMove)(); sal_uLong SearchPattern(const css::util::SearchOptions2& rSearchOpt, bool bSearchInNotes, SwDocPositions eStart, SwDocPositions eEnd, - FindRanges eFlags = FND_IN_BODY, + FindRanges eFlags = FindRanges::InBody, bool bReplace = false ); sal_uLong SearchTempl (const OUString &rTempl, SwDocPositions eStart, SwDocPositions eEnd, - FindRanges eFlags = FND_IN_BODY, + FindRanges eFlags = FindRanges::InBody, const OUString* pReplTempl = nullptr ); sal_uLong SearchAttr (const SfxItemSet& rFindSet, bool bNoColls, SwDocPositions eStart, SwDocPositions eEnd, - FindRanges eFlags = FND_IN_BODY, + FindRanges eFlags = FindRanges::InBody, const css::util::SearchOptions2* pSearchOpt = nullptr, const SfxItemSet* pReplaceSet = nullptr); diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index 48eee5e..6bbc5f4 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -791,11 +791,13 @@ sal_uLong SwView::FUNC_Search( const SwSearchOptions& rOptions ) bool bDoReplace = m_pSrchItem->GetCommand() == SvxSearchCmd::REPLACE || m_pSrchItem->GetCommand() == SvxSearchCmd::REPLACE_ALL; - int eRanges = m_pSrchItem->GetSelection() ? - FND_IN_SEL : m_bExtra ? FND_IN_OTHER : FND_IN_BODY; + FindRanges eRanges = m_pSrchItem->GetSelection() + ? FindRanges::InSel + : m_bExtra + ? FindRanges::InOther : FindRanges::InBody; if (m_pSrchItem->GetCommand() == SvxSearchCmd::FIND_ALL || m_pSrchItem->GetCommand() == SvxSearchCmd::REPLACE_ALL) - eRanges |= FND_IN_SELALL; + eRanges |= FindRanges::InSelAll; m_pWrtShell->SttSelect(); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 4944162..b1737ca3 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -756,7 +756,7 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor > const SwXTextSearch* pSearch = reinterpret_cast<const SwXTextSearch*>( xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId())); - int eRanges(FND_IN_BODY|FND_IN_SELALL); + int eRanges(FindRanges::InBody|FindRanges::InSelAll); util::SearchOptions2 aSearchOpt; pSearch->FillSearchOptions( aSearchOpt ); @@ -886,17 +886,17 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor > /** * The following combinations are allowed: - * - Search in the body: -> FND_IN_BODY - * - Search all in the body: -> FND_IN_BODYONLY | FND_IN_SELALL - * - Search in selections: one / all -> FND_IN_SEL [ | FND_IN_SELALL ] - * - Search outside the body: one / all -> FND_IN_OTHER [ | FND_IN_SELALL ] - * - Search everywhere all: -> FND_IN_SELALL + * - Search in the body: -> FindRanges::InBody + * - Search all in the body: -> FindRanges::InBodyOnly | FindRanges::InSelAll + * - Search in selections: one / all -> FindRanges::InSel [ | FindRanges::InSelAll ] + * - Search outside the body: one / all -> FindRanges::InOther [ | FindRanges::InSelAll ] + * - Search everywhere all: -> FindRanges::InSelAll */ - int eRanges(FND_IN_BODY); + FindRanges eRanges(FindRanges::InBody); if(bParentInExtra) - eRanges = FND_IN_OTHER; + eRanges = FindRanges::InOther; if(bAll) //always - everywhere? - eRanges = FND_IN_SELALL; + eRanges = FindRanges::InSelAll; SwDocPositions eStart = !bAll ? SwDocPositions::Curr : pSearch->m_bBack ? SwDocPositions::End : SwDocPositions::Start; SwDocPositions eEnd = pSearch->m_bBack ? SwDocPositions::Start : SwDocPositions::End; @@ -938,10 +938,10 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor > eStart, eEnd, bCancel, (FindRanges)eRanges ); } - if(nResult || (eRanges&(FND_IN_SELALL|FND_IN_OTHER))) + if(nResult || (eRanges&(FindRanges::InSelAll|FindRanges::InOther))) break; //second step - find in other - eRanges = FND_IN_OTHER; + eRanges = FindRanges::InOther; } return pUnoCursor; } diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx index 90e5c98..4998aa9 100644 --- a/sw/source/uibase/wrtsh/select.cxx +++ b/sw/source/uibase/wrtsh/select.cxx @@ -214,7 +214,7 @@ sal_uLong SwWrtShell::SearchPattern( const SearchOptions2& rSearchOpt, bool bSea FindRanges eFlags, bool bReplace ) { // no enhancement of existing selections - if(!(eFlags & FND_IN_SEL)) + if(!(eFlags & FindRanges::InSel)) ClearMark(); bool bCancel = false; sal_uLong nRet = Find( rSearchOpt, bSearchInNotes, eStt, eEnd, bCancel, eFlags, bReplace ); @@ -233,7 +233,7 @@ sal_uLong SwWrtShell::SearchTempl( const OUString &rTempl, FindRanges eFlags, const OUString* pReplTempl ) { // no enhancement of existing selections - if(!(eFlags & FND_IN_SEL)) + if(!(eFlags & FindRanges::InSel)) ClearMark(); SwTextFormatColl *pColl = GetParaStyle(rTempl, SwWrtShell::GETSTYLE_CREATESOME); SwTextFormatColl *pReplaceColl = nullptr; @@ -259,7 +259,7 @@ sal_uLong SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, bool bNoColls, const SfxItemSet* pReplaceSet ) { // no enhancement of existing selections - if (!(eFlags & FND_IN_SEL)) + if (!(eFlags & FindRanges::InSel)) ClearMark(); // Searching commit 8b52d4e73a06d433d128d61a4939e92e4a497d71 Author: Noel Grandin <n...@peralex.com> Date: Tue Aug 30 12:15:41 2016 +0200 convert SwDocPositions to scoped enum Change-Id: Idd9414b4a10398130337e474fb8fd4063e3bd4f8 diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 2b9b013..dbe62d6 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -267,7 +267,7 @@ typedef bool (SwCursor:: *FNCursor)(); protected: - inline SwMoveFnCollection const & MakeFindRange( sal_uInt16, sal_uInt16, SwPaM* ) const; + inline SwMoveFnCollection const & MakeFindRange( SwDocPositions, SwDocPositions, SwPaM* ) const; /* * Compare-Methode for the StackCursor and the current Cursor. @@ -846,9 +846,9 @@ public: // Cursor Inlines: inline SwMoveFnCollection const & SwCursorShell::MakeFindRange( - sal_uInt16 nStt, sal_uInt16 nEnd, SwPaM* pPam ) const + SwDocPositions nStt, SwDocPositions nEnd, SwPaM* pPam ) const { - return m_pCurrentCursor->MakeFindRange( (SwDocPositions)nStt, (SwDocPositions)nEnd, pPam ); + return m_pCurrentCursor->MakeFindRange( nStt, nEnd, pPam ); } inline SwCursor* SwCursorShell::GetSwCursor() const diff --git a/sw/inc/cshtyp.hxx b/sw/inc/cshtyp.hxx index e9dc3a7..c2e9a3b 100644 --- a/sw/inc/cshtyp.hxx +++ b/sw/inc/cshtyp.hxx @@ -87,13 +87,13 @@ enum FindRanges FND_IN_SELALL = 0x01 ///< All (only in non-body and selections). }; -enum SwDocPositions +enum class SwDocPositions { - DOCPOS_START, - DOCPOS_CURR, - DOCPOS_END, - DOCPOS_OTHERSTART, - DOCPOS_OTHEREND + Start, + Curr, + End, + OtherStart, + OtherEnd }; SW_DLLPUBLIC SwWhichPara GetfnParaCurr(); diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index 2f4d953..b732055 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -558,7 +558,7 @@ void SwMacrosTest::testFindReplace() // find newline on 1st paragraph bool bFound = pPaM->Find( - opts, false, DOCPOS_CURR, DOCPOS_END, bCancel); + opts, false, SwDocPositions::Curr, SwDocPositions::End, bCancel); CPPUNIT_ASSERT(bFound); CPPUNIT_ASSERT(pPaM->HasMark()); CPPUNIT_ASSERT_EQUAL(OUString(""), pPaM->GetText()); @@ -566,7 +566,7 @@ void SwMacrosTest::testFindReplace() // now do another Find, inside the selection from the first Find // opts.searchFlags = 71680; bFound = pPaM->Find( - opts, false, DOCPOS_CURR, DOCPOS_END, bCancel, FND_IN_SEL); + opts, false, SwDocPositions::Curr, SwDocPositions::End, bCancel, FND_IN_SEL); CPPUNIT_ASSERT(bFound); CPPUNIT_ASSERT(pPaM->HasMark()); CPPUNIT_ASSERT_EQUAL(OUString(""), pPaM->GetText()); diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index b2ebfff..3ef3363 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1967,14 +1967,14 @@ void SwUiWriterTest::testSearchWithTransliterate() SearchOpt.AlgorithmType2 = css::util::SearchAlgorithms2::ABSOLUTE; SearchOpt.WildcardEscapeCharacter = 0; //transliteration option set so that at least one of the search strings is not found - sal_uLong case1 = pWrtShell->SearchPattern(SearchOpt,true,DOCPOS_START,DOCPOS_END); + sal_uLong case1 = pWrtShell->SearchPattern(SearchOpt,true,SwDocPositions::Start,SwDocPositions::End); SwShellCursor* pShellCursor = pWrtShell->getShellCursor(true); CPPUNIT_ASSERT_EQUAL(OUString(""),pShellCursor->GetText()); CPPUNIT_ASSERT_EQUAL(0,(int)case1); SearchOpt.searchString = "paragraph"; SearchOpt.transliterateFlags = css::i18n::TransliterationModulesExtra::IGNORE_KASHIDA_CTL; //transliteration option set so that all search strings are found - sal_uLong case2 = pWrtShell->SearchPattern(SearchOpt,true,DOCPOS_START,DOCPOS_END); + sal_uLong case2 = pWrtShell->SearchPattern(SearchOpt,true,SwDocPositions::Start,SwDocPositions::End); pShellCursor = pWrtShell->getShellCursor(true); CPPUNIT_ASSERT_EQUAL(OUString("paragraph"),pShellCursor->GetText()); CPPUNIT_ASSERT_EQUAL(1,(int)case2); @@ -2002,19 +2002,19 @@ void SwUiWriterTest::testTdf73660() searchOpt.searchFlag = css::util::SearchFlags::NORM_WORD_ONLY; //case 1 searchOpt.searchString = "First"; - CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,DOCPOS_START,DOCPOS_END)); + CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,SwDocPositions::Start,SwDocPositions::End)); //case 2 searchOpt.searchString = "Second"; - CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,DOCPOS_START,DOCPOS_END)); + CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,SwDocPositions::Start,SwDocPositions::End)); //case 3 searchOpt.searchString = "Third"; - CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,DOCPOS_START,DOCPOS_END)); + CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,SwDocPositions::Start,SwDocPositions::End)); //case 4 searchOpt.searchString = "Fourth"; - CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,DOCPOS_START,DOCPOS_END)); + CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,SwDocPositions::Start,SwDocPositions::End)); //case 5 searchOpt.searchString = "Fifth"; - CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,DOCPOS_START,DOCPOS_END)); + CPPUNIT_ASSERT_EQUAL(sal_uLong(1), pWrtShell->SearchPattern(searchOpt,true,SwDocPositions::Start,SwDocPositions::End)); } void SwUiWriterTest::testNewDocModifiedState() diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 0e377e9..3309d89 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -729,9 +729,9 @@ SwMoveFnCollection const & SwCursor::MakeFindRange( SwDocPositions nStart, FillFindPos( nEnd, *pRange->GetPoint() ); // determine direction of search - return ( DOCPOS_START == nStart || DOCPOS_OTHERSTART == nStart || - (DOCPOS_CURR == nStart && - (DOCPOS_END == nEnd || DOCPOS_OTHEREND == nEnd ) )) + return ( SwDocPositions::Start == nStart || SwDocPositions::OtherStart == nStart || + (SwDocPositions::Curr == nStart && + (SwDocPositions::End == nEnd || SwDocPositions::OtherEnd == nEnd ) )) ? fnMoveForward : fnMoveBackward; } @@ -1086,20 +1086,20 @@ void SwCursor::FillFindPos( SwDocPositions ePos, SwPosition& rPos ) const switch( ePos ) { - case DOCPOS_START: + case SwDocPositions::Start: rPos.nNode = *rNds.GetEndOfContent().StartOfSectionNode(); pCNd = rNds.GoNext( &rPos.nNode ); break; - case DOCPOS_END: + case SwDocPositions::End: rPos.nNode = rNds.GetEndOfContent(); pCNd = SwNodes::GoPrevious( &rPos.nNode ); bIsStart = false; break; - case DOCPOS_OTHERSTART: + case SwDocPositions::OtherStart: rPos.nNode = *rNds[ sal_uLong(0) ]; pCNd = rNds.GoNext( &rPos.nNode ); break; - case DOCPOS_OTHEREND: + case SwDocPositions::OtherEnd: rPos.nNode = *rNds.GetEndOfContent().StartOfSectionNode(); pCNd = SwNodes::GoPrevious( &rPos.nNode ); bIsStart = false; diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 20b5765..d714783 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -729,9 +729,9 @@ void SwEditShell::SetNumberingRestart() for(int i = 0; i < 2; i++) { if(!i) - MakeFindRange(DOCPOS_START, DOCPOS_END, pCursor); // body content + MakeFindRange(SwDocPositions::Start, SwDocPositions::End, pCursor); // body content else - MakeFindRange(DOCPOS_OTHERSTART, DOCPOS_OTHEREND, pCursor); // extra content + MakeFindRange(SwDocPositions::OtherStart, SwDocPositions::OtherEnd, pCursor); // extra content SwPosition* pSttPos = pCursor->Start(), *pEndPos = pCursor->End(); sal_uLong nCurrNd = pSttPos->nNode.GetIndex(); sal_uLong nEndNd = pEndPos->nNode.GetIndex(); diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index 4d0c46e..afaba23 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -617,7 +617,7 @@ bool SwEditShell::HasHyphIter() void SwEditShell::SetLinguRange( SwDocPositions eStart, SwDocPositions eEnd ) { SwPaM *pCursor = GetCursor(); - MakeFindRange( static_cast<sal_uInt16>(eStart), static_cast<sal_uInt16>(eEnd), pCursor ); + MakeFindRange( eStart, eEnd, pCursor ); if( *pCursor->GetPoint() > *pCursor->GetMark() ) pCursor->Exchange(); } diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index eb00641..d1d58f5 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -373,7 +373,7 @@ void SwEditShell::ApplyAutoMark() // todo/mba: assuming that notes shouldn't be searched bool bSearchInNotes = false; - sal_uLong nRet = Find( aSearchOpt, bSearchInNotes, DOCPOS_START, DOCPOS_END, bCancel, + sal_uLong nRet = Find( aSearchOpt, bSearchInNotes, SwDocPositions::Start, SwDocPositions::End, bCancel, (FindRanges)(FND_IN_SELALL) ); if(nRet) diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 361a910..2bbf614 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -455,7 +455,7 @@ static void lcl_SelectSameStrings(SwWrtShell& rSh, bool bWordOnly, bool bCaseSen //todo/mba: assuming that notes should not be searched bool bSearchInNotes = false; - rSh.Find( aSearchOpt, bSearchInNotes, DOCPOS_START, DOCPOS_END, bCancel, + rSh.Find( aSearchOpt, bSearchInNotes, SwDocPositions::Start, SwDocPositions::End, bCancel, (FindRanges)(FND_IN_SELALL|FND_IN_BODYONLY) ); } diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index dc383d0..105da59 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -232,7 +232,7 @@ svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence(bool bRecheck) { m_pSpellState->pOtherCursor = new SwPaM(*pWrtShell->GetCursor()->GetPoint()); m_pSpellState->m_bStartedInOther = true; - pWrtShell->SpellStart( DOCPOS_OTHERSTART, DOCPOS_OTHEREND, DOCPOS_CURR ); + pWrtShell->SpellStart( SwDocPositions::OtherStart, SwDocPositions::OtherEnd, SwDocPositions::Curr ); } else { @@ -245,7 +245,7 @@ svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence(bool bRecheck) *pWrtShell->GetDoc(), *pCursor->Start(), pCursor->End()); } - pWrtShell->SpellStart( DOCPOS_START, DOCPOS_END, DOCPOS_CURR ); + pWrtShell->SpellStart( SwDocPositions::Start, SwDocPositions::End, SwDocPositions::Curr ); } } else @@ -290,7 +290,7 @@ The code below would only be part of the solution. // if there's any that has not been spelled yet if(!m_pSpellState->m_bOtherSpelled && pWrtShell->HasOtherCnt()) { - pWrtShell->SpellStart(DOCPOS_OTHERSTART, DOCPOS_OTHEREND, DOCPOS_OTHERSTART ); + pWrtShell->SpellStart(SwDocPositions::OtherStart, SwDocPositions::OtherEnd, SwDocPositions::OtherStart ); if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn)) { pWrtShell->SpellEnd(); @@ -302,7 +302,7 @@ The code below would only be part of the solution. // if no result has been found try at the body text - completely if(!m_pSpellState->m_bBodySpelled && aRet.empty()) { - pWrtShell->SpellStart(DOCPOS_START, DOCPOS_END, DOCPOS_START ); + pWrtShell->SpellStart(SwDocPositions::Start, SwDocPositions::End, SwDocPositions::Start ); if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn)) { m_pSpellState->m_bBodySpelled = true; @@ -331,7 +331,7 @@ The code below would only be part of the solution. pWrtShell->SpellEnd(); delete m_pSpellState->pOtherCursor; m_pSpellState->pOtherCursor = nullptr; - pWrtShell->SpellStart(DOCPOS_OTHERSTART, DOCPOS_CURR, DOCPOS_OTHERSTART ); + pWrtShell->SpellStart(SwDocPositions::OtherStart, SwDocPositions::Curr, SwDocPositions::OtherStart ); (void)pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn); } if(aRet.empty()) @@ -344,7 +344,7 @@ The code below would only be part of the solution. // has the body been spelled? if(!m_pSpellState->m_bBodySpelled) { - pWrtShell->SpellStart(DOCPOS_START, DOCPOS_END, DOCPOS_START ); + pWrtShell->SpellStart(SwDocPositions::Start, SwDocPositions::End, SwDocPositions::Start ); if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn)) { m_pSpellState->m_bBodySpelled = true; @@ -357,7 +357,7 @@ The code below would only be part of the solution. m_pSpellState->m_bBodySpelled = true; if(!m_pSpellState->m_bOtherSpelled && pWrtShell->HasOtherCnt()) { - pWrtShell->SpellStart(DOCPOS_OTHERSTART, DOCPOS_OTHEREND, DOCPOS_OTHERSTART ); + pWrtShell->SpellStart(SwDocPositions::OtherStart, SwDocPositions::OtherEnd, SwDocPositions::OtherStart ); if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn)) { pWrtShell->SpellEnd(); @@ -400,7 +400,7 @@ The code below would only be part of the solution. m_pSpellState->m_xStartRange)) { pWrtShell->SetSelection(aPam); - pWrtShell->SpellStart(DOCPOS_START, DOCPOS_CURR, DOCPOS_START); + pWrtShell->SpellStart(SwDocPositions::Start, SwDocPositions::Curr, SwDocPositions::Start); if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn)) pWrtShell->SpellEnd(); } diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index e07f723..a0828a9 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -2001,7 +2001,7 @@ bool SwView::JumpToSwMark( const OUString& rMark ) //todo/mba: assuming that notes shouldn't be searched bool bSearchInNotes = false; - if( m_pWrtShell->SearchPattern( aSearchOpt, bSearchInNotes, DOCPOS_START, DOCPOS_END )) + if( m_pWrtShell->SearchPattern( aSearchOpt, bSearchInNotes, SwDocPositions::Start, SwDocPositions::End )) { m_pWrtShell->EnterStdMode(); // remove the selection bRet = true; diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index f900061..cfaf396 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -273,49 +273,49 @@ void SwView::SpellStart( SvxSpellArea eWhich, Reference< XLinguProperties > xProp = ::GetLinguPropertySet(); bool bIsWrapReverse = !pConvArgs && xProp.is() && xProp->getIsWrapReverse(); - SwDocPositions eStart = DOCPOS_START; - SwDocPositions eEnd = DOCPOS_END; - SwDocPositions eCurr = DOCPOS_CURR; + SwDocPositions eStart = SwDocPositions::Start; + SwDocPositions eEnd = SwDocPositions::End; + SwDocPositions eCurr = SwDocPositions::Curr; switch ( eWhich ) { case SvxSpellArea::Body: if( bIsWrapReverse ) - eCurr = DOCPOS_END; + eCurr = SwDocPositions::End; else - eCurr = DOCPOS_START; + eCurr = SwDocPositions::Start; break; case SvxSpellArea::BodyEnd: if( bIsWrapReverse ) { if( bStartDone ) - eStart = DOCPOS_CURR; - eCurr = DOCPOS_END; + eStart = SwDocPositions::Curr; + eCurr = SwDocPositions::End; } else if( bStartDone ) - eCurr = DOCPOS_START; + eCurr = SwDocPositions::Start; break; case SvxSpellArea::BodyStart: if( !bIsWrapReverse ) { if( bEndDone ) - eEnd = DOCPOS_CURR; - eCurr = DOCPOS_START; + eEnd = SwDocPositions::Curr; + eCurr = SwDocPositions::Start; } else if( bEndDone ) - eCurr = DOCPOS_END; + eCurr = SwDocPositions::End; break; case SvxSpellArea::Other: if( bIsWrapReverse ) { - eStart = DOCPOS_OTHERSTART; - eEnd = DOCPOS_OTHEREND; - eCurr = DOCPOS_OTHEREND; + eStart = SwDocPositions::OtherStart; + eEnd = SwDocPositions::OtherEnd; + eCurr = SwDocPositions::OtherEnd; } else { - eStart = DOCPOS_OTHERSTART; - eEnd = DOCPOS_OTHEREND; - eCurr = DOCPOS_OTHERSTART; + eStart = SwDocPositions::OtherStart; + eEnd = SwDocPositions::OtherEnd; + eCurr = SwDocPositions::OtherStart; } break; default: @@ -398,16 +398,16 @@ void SwView::HyphStart( SvxSpellArea eWhich ) switch ( eWhich ) { case SvxSpellArea::Body: - m_pWrtShell->HyphStart( DOCPOS_START, DOCPOS_END ); + m_pWrtShell->HyphStart( SwDocPositions::Start, SwDocPositions::End ); break; case SvxSpellArea::BodyEnd: - m_pWrtShell->HyphStart( DOCPOS_CURR, DOCPOS_END ); + m_pWrtShell->HyphStart( SwDocPositions::Curr, SwDocPositions::End ); break; case SvxSpellArea::BodyStart: - m_pWrtShell->HyphStart( DOCPOS_START, DOCPOS_CURR ); + m_pWrtShell->HyphStart( SwDocPositions::Start, SwDocPositions::Curr ); break; case SvxSpellArea::Other: - m_pWrtShell->HyphStart( DOCPOS_OTHERSTART, DOCPOS_OTHEREND ); + m_pWrtShell->HyphStart( SwDocPositions::OtherStart, SwDocPositions::OtherEnd ); break; default: OSL_ENSURE( false, "HyphStart with unknown Area" ); diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index 2c8752c..48eee5e 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -367,7 +367,7 @@ void SwView::ExecSearch(SfxRequest& rReq) // i#8288 "replace all" should not change cursor // position, so save current cursor m_pWrtShell->Push(); - if (DOCPOS_START == aOpts.eEnd) + if (SwDocPositions::Start == aOpts.eEnd) { m_pWrtShell->EndDoc(); } @@ -523,7 +523,7 @@ bool SwView::SearchAndWrap(bool bApi) // occurrence in the document instead of the second. if( m_eLastSearchCommand == SvxSearchCmd::FIND_ALL ) { - if( DOCPOS_START == aOpts.eEnd ) + if( SwDocPositions::Start == aOpts.eEnd ) m_pWrtShell->EndDoc(); else m_pWrtShell->SttDoc(); @@ -604,10 +604,10 @@ bool SwView::SearchAndWrap(bool bApi) m_pWrtShell->Pop(false); pWait.reset(new SwWait( *GetDocShell(), true )); - bool bSrchBkwrd = DOCPOS_START == aOpts.eEnd; + bool bSrchBkwrd = SwDocPositions::Start == aOpts.eEnd; - aOpts.eEnd = bSrchBkwrd ? DOCPOS_START : DOCPOS_END; - aOpts.eStart = bSrchBkwrd ? DOCPOS_END : DOCPOS_START; + aOpts.eEnd = bSrchBkwrd ? SwDocPositions::Start : SwDocPositions::End; + aOpts.eStart = bSrchBkwrd ? SwDocPositions::End : SwDocPositions::Start; if (bHasSrchInOther) { @@ -661,7 +661,7 @@ bool SwView::SearchAll() // Cancel existing selections, if should not be sought in selected areas. m_pWrtShell->KillSelection(nullptr, false); - if( DOCPOS_START == aOpts.eEnd ) + if( SwDocPositions::Start == aOpts.eEnd ) m_pWrtShell->EndDoc(); else m_pWrtShell->SttDoc(); @@ -770,15 +770,15 @@ void SwView::Replace() SwSearchOptions::SwSearchOptions( SwWrtShell* pSh, bool bBackward ) { - eStart = DOCPOS_CURR; + eStart = SwDocPositions::Curr; if( bBackward ) { - eEnd = DOCPOS_START; + eEnd = SwDocPositions::Start; bDontWrap = pSh->IsEndOfDoc(); } else { - eEnd = DOCPOS_END; + eEnd = SwDocPositions::End; bDontWrap = pSh->IsStartOfDoc(); } } diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 1214162..4944162 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -761,8 +761,8 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor > util::SearchOptions2 aSearchOpt; pSearch->FillSearchOptions( aSearchOpt ); - SwDocPositions eStart = pSearch->m_bBack ? DOCPOS_END : DOCPOS_START; - SwDocPositions eEnd = pSearch->m_bBack ? DOCPOS_START : DOCPOS_END; + SwDocPositions eStart = pSearch->m_bBack ? SwDocPositions::End : SwDocPositions::Start; + SwDocPositions eEnd = pSearch->m_bBack ? SwDocPositions::Start : SwDocPositions::End; // Search should take place anywhere pUnoCursor->SetRemainInSection(false); @@ -897,8 +897,8 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor > eRanges = FND_IN_OTHER; if(bAll) //always - everywhere? eRanges = FND_IN_SELALL; - SwDocPositions eStart = !bAll ? DOCPOS_CURR : pSearch->m_bBack ? DOCPOS_END : DOCPOS_START; - SwDocPositions eEnd = pSearch->m_bBack ? DOCPOS_START : DOCPOS_END; + SwDocPositions eStart = !bAll ? SwDocPositions::Curr : pSearch->m_bBack ? SwDocPositions::End : SwDocPositions::Start; + SwDocPositions eEnd = pSearch->m_bBack ? SwDocPositions::Start : SwDocPositions::End; nResult = 0; for (int nSearchProc = 0; nSearchProc < 2; ++nSearchProc) commit fd405ab457183f1c0d48d47bbd3308edb2e30242 Author: Noel Grandin <n...@peralex.com> Date: Tue Aug 30 11:48:07 2016 +0200 remove the SwMoveFnCollection* typedefs which were just obscuring the code, and pass it around by const& Change-Id: I4fce5ef4bf616867c46a145f660a8e90d3c94462 diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index b549980..2b9b013 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -267,7 +267,7 @@ typedef bool (SwCursor:: *FNCursor)(); protected: - inline SwMoveFnCollection* MakeFindRange( sal_uInt16, sal_uInt16, SwPaM* ) const; + inline SwMoveFnCollection const & MakeFindRange( sal_uInt16, sal_uInt16, SwPaM* ) const; /* * Compare-Methode for the StackCursor and the current Cursor. @@ -361,11 +361,11 @@ public: bool SttEndDoc( bool bStt ); bool MovePage( SwWhichPage, SwPosPage ); - bool MovePara( SwWhichPara, SwPosPara ); - bool MoveSection( SwWhichSection, SwPosSection ); - bool MoveTable( SwWhichTable, SwPosTable ); + bool MovePara( SwWhichPara, SwMoveFnCollection const & ); + bool MoveSection( SwWhichSection, SwMoveFnCollection const & ); + bool MoveTable( SwWhichTable, SwMoveFnCollection const & ); bool MoveColumn( SwWhichColumn, SwPosColumn ); - bool MoveRegion( SwWhichRegion, SwPosRegion ); + bool MoveRegion( SwWhichRegion, SwMoveFnCollection const & ); sal_uLong Find( const css::util::SearchOptions2& rSearchOpt, bool bSearchInNotes, @@ -845,7 +845,7 @@ public: }; // Cursor Inlines: -inline SwMoveFnCollection* SwCursorShell::MakeFindRange( +inline SwMoveFnCollection const & SwCursorShell::MakeFindRange( ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits