oovbaapi/ooo/vba/word/XDocuments.idl | 1 sw/inc/ndarr.hxx | 2 - sw/source/core/crsr/pam.cxx | 10 ++++++++ sw/source/core/docnode/nodes.cxx | 43 +++++++---------------------------- 4 files changed, 20 insertions(+), 36 deletions(-)
New commits: commit 648758906e2d4a7a953d4eda27e95bc9478d336a Author: Michael Stahl <[email protected]> AuthorDate: Mon Nov 25 19:01:57 2019 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Tue Nov 26 11:10:11 2019 +0100 sw: remove SwNodes::CheckNodesRange() Looks like it's the same as ::CheckNodesRange(..., false). Change-Id: I1938892cdba9ff1d9758a0f1b6cb516e28f5d8bd Reviewed-on: https://gerrit.libreoffice.org/83708 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx index 2f2958c977bc..da52d06377f6 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -181,8 +181,6 @@ public: void SectionUp( SwNodeRange *); void SectionDown( SwNodeRange *pRange, SwStartNodeType = SwNormalStartNode ); - bool CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd ) const; - static void GoStartOfSection(SwNodeIndex *); static void GoEndOfSection(SwNodeIndex *); diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index c1fdb7f87d95..b0a6055d782f 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -893,8 +893,10 @@ void SwNodes::SectionDown(SwNodeRange *pRange, SwStartNodeType eSttNdTyp ) { if( pRange->aStart >= pRange->aEnd || pRange->aEnd >= Count() || - !CheckNodesRange( pRange->aStart, pRange->aEnd )) + !::CheckNodesRange(pRange->aStart, pRange->aEnd, false)) + { return; + } // If the beginning of a range is before or at a start node position, so // delete it, otherwise empty S/E or E/S nodes would be created. @@ -945,9 +947,11 @@ void SwNodes::SectionUp(SwNodeRange *pRange) { if( pRange->aStart >= pRange->aEnd || pRange->aEnd >= Count() || - !CheckNodesRange( pRange->aStart, pRange->aEnd ) || + !::CheckNodesRange(pRange->aStart, pRange->aEnd, false) || ( HighestLevel( *this, *pRange ) <= 1 )) + { return; + } // If the beginning of a range is before or at a start node position, so // delete it, otherwise empty S/E or E/S nodes would be created. @@ -1073,8 +1077,10 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes) // check if [rIndex..rIndex + nCnt] is larger than the range if( ( !aRg.aStart.GetNode().StartOfSectionIndex() && !aRg.aStart.GetIndex() ) || - ! CheckNodesRange( aRg.aStart, aRg.aEnd ) ) + !::CheckNodesRange(aRg.aStart, aRg.aEnd, false)) + { return; + } // if aEnd is not on a ContentNode, search the previous one while( ( pCurrentNode = &aRg.aEnd.GetNode())->GetStartNode() || @@ -1302,37 +1308,6 @@ SwContentNode* SwNodes::GoPrevious(SwNodeIndex *pIdx) return static_cast<SwContentNode*>(pNd); } -static bool TstIdx( sal_uLong nSttIdx, sal_uLong nEndIdx, sal_uLong nStt, sal_uLong nEnd ) -{ - return nStt < nSttIdx && nEnd >= nSttIdx && - nStt < nEndIdx && nEnd >= nEndIdx; -} - -/** Check if the given range is inside one of the defined top-level sections. - * - * The top-level sections are Content, AutoText, PostIts, Inserts, and Redlines. - * - * @param rStt start index of the range - * @param rEnd end index of the range - * @return <true> if valid range - */ -bool SwNodes::CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd ) const -{ - sal_uLong nStt = rStt.GetIndex(), nEnd = rEnd.GetIndex(); - if( TstIdx( nStt, nEnd, m_pEndOfContent->StartOfSectionIndex(), - m_pEndOfContent->GetIndex() )) return true; - if( TstIdx( nStt, nEnd, m_pEndOfAutotext->StartOfSectionIndex(), - m_pEndOfAutotext->GetIndex() )) return true; - if( TstIdx( nStt, nEnd, m_pEndOfPostIts->StartOfSectionIndex(), - m_pEndOfPostIts->GetIndex() )) return true; - if( TstIdx( nStt, nEnd, m_pEndOfInserts->StartOfSectionIndex(), - m_pEndOfInserts->GetIndex() )) return true; - if( TstIdx( nStt, nEnd, m_pEndOfRedlines->StartOfSectionIndex(), - m_pEndOfRedlines->GetIndex() )) return true; - - return false; // is somewhere in the middle, ERROR -} - /** Delete a number of nodes * * @param rStart starting position in this nodes array commit 7424588115568576c61005386242e3d7e9662dfd Author: Michael Stahl <[email protected]> AuthorDate: Mon Nov 25 18:29:15 2019 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Tue Nov 26 11:09:46 2019 +0100 sw: document CheckNodesRange functions Change-Id: I6ca104773eee6809258fdea6be6370b726da8fd4 Reviewed-on: https://gerrit.libreoffice.org/83707 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index afc89c8bee0c..9b742776cae9 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -237,6 +237,16 @@ static bool lcl_ChkOneRange( CHKSECTION eSec, bool bChkSections, nSttIdx <= nEnd && nEnd <= nEndIdx; } +/** Check if the given range is inside one of the defined top-level sections. + * + * The top-level sections are Content, AutoText, PostIts, Inserts, and Redlines. + * + * @param bChkSection if true, also check that the given range is inside + * a single second-level section inside any of the + * top-level sections, except for the Content section. + * + * @return <true> if valid range + */ bool CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd, bool bChkSection ) { diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 10cc05aec7af..c1fdb7f87d95 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -1308,9 +1308,9 @@ static bool TstIdx( sal_uLong nSttIdx, sal_uLong nEndIdx, sal_uLong nStt, sal_uL nStt < nEndIdx && nEnd >= nEndIdx; } -/** Check if the given range is inside the defined ranges +/** Check if the given range is inside one of the defined top-level sections. * - * The defined ranges are Content, AutoText, PostIts, Inserts, and Redlines. + * The top-level sections are Content, AutoText, PostIts, Inserts, and Redlines. * * @param rStt start index of the range * @param rEnd end index of the range commit 405c9f65c5dbfddf1f9162716fab0d30e44c420e Author: Tor Lillqvist <[email protected]> AuthorDate: Wed Oct 23 11:54:54 2019 +0300 Commit: Tor Lillqvist <[email protected]> CommitDate: Tue Nov 26 12:09:35 2019 +0200 Add note that SwVbaDocuments::Close() does nothing Change-Id: Ibf4d175b4b4a0b9f168401e52af6b0459aacd046 Reviewed-on: https://gerrit.libreoffice.org/81368 Reviewed-by: Tor Lillqvist <[email protected]> Tested-by: Tor Lillqvist <[email protected]> (cherry picked from commit 61a656cb9c7db1863e56d1183cb82c7e8be63cc5) (cherry picked from commit 5c5034a6d5d411fedf1fb00e736c55b7bdd6f840) diff --git a/oovbaapi/ooo/vba/word/XDocuments.idl b/oovbaapi/ooo/vba/word/XDocuments.idl index 79517c53576f..dda25a4014ad 100644 --- a/oovbaapi/ooo/vba/word/XDocuments.idl +++ b/oovbaapi/ooo/vba/word/XDocuments.idl @@ -34,6 +34,7 @@ interface XDocuments : com::sun::star::uno::XInterface any OpenOld([in] string FileName, [in] any ConfirmConversions, [in] any ReadOnly, [in] any AddToRecentFiles, [in] any PasswordDocument, [in] any PasswordTemplate, [in] any Revert, [in] any WritePasswordDocument, [in] any WritePasswordTemplate, [in] any Format); + // Note that this method doesn't actually do anhything, see sw/source/ui/vba/vbadocuments.cxx void Close([in] any SaveChanges,[in] any OriginalFormat,[in] any RouteDocument); }; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
