solenv/clang-format/excludelist | 2 +- sw/Library_sw.mk | 2 +- sw/inc/GrammarContact.hxx | 7 ++++--- sw/source/core/crsr/crsrsh.cxx | 2 +- sw/source/core/doc/docnew.cxx | 15 +-------------- sw/source/core/text/txtfrm.cxx | 4 ++-- sw/source/core/txtnode/GrammarContact.cxx | 19 +++++++++++++++---- sw/source/core/unocore/unoflatpara.cxx | 4 ++-- sw/source/core/unocore/unotextmarkup.cxx | 11 +++++------ 9 files changed, 32 insertions(+), 34 deletions(-)
New commits: commit a61a4da16ef2fea05787fa57c45cde11eb72e11e Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Oct 14 13:51:51 2022 +0200 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Tue Dec 6 08:44:22 2022 +0000 sw: Move getGrammarContact function into GrammarContact and rename Change-Id: Id89d7eabb465f047188f8f74bd823cfb3b2f2aff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141433 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit 8e2deed1457e3ab712df2820331136d531927522) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143658 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sw/inc/GrammarContact.hxx b/sw/inc/GrammarContact.hxx index 0b8014160cd4..9b47984b9587 100644 --- a/sw/inc/GrammarContact.hxx +++ b/sw/inc/GrammarContact.hxx @@ -83,13 +83,14 @@ public: /** getGrammarContact() delivers the grammar contact of the document (for a given textnode) @returns grammar contact */ -GrammarContact* getGrammarContact(const SwTextNode&); +GrammarContact* getGrammarContactFor(const SwTextNode&); /** finishGrammarCheck() calls the same function of the grammar contact of the document (for a given textnode) @returns void */ -void finishGrammarCheck(SwTextNode&); -} +void finishGrammarCheckFor(SwTextNode&); + +} // end sw #endif // INCLUDED_SW_INC_IGRAMMARCONTACT_HXX diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 5e6ffab1fc54..7bb6ef051ca5 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -808,19 +808,6 @@ void SwDoc::WriteLayoutCache( SvStream& rStream ) SwLayoutCache::Write( rStream, *this ); } -namespace sw -{ - -sw::GrammarContact* getGrammarContact(const SwTextNode& rTextNode) -{ - const SwDoc& rDoc = rTextNode.GetDoc(); - if (rDoc.IsInDtor()) - return nullptr; - return rDoc.getGrammarContact().get(); -} - -} // end sw - ::sfx2::IXmlIdRegistry& SwDoc::GetXmlIdRegistry() { diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 58873a199adb..3ed591503bbe 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -1802,7 +1802,7 @@ static void lcl_SetWrong( SwTextFrame& rFrame, SwTextNode const& rNode, if ( !rFrame.IsFollow() ) { SwTextNode* pTextNode = const_cast<SwTextNode*>(&rNode); - sw::GrammarContact* pGrammarContact = getGrammarContact(*pTextNode); + sw::GrammarContact* pGrammarContact = sw::getGrammarContactFor(*pTextNode); SwGrammarMarkUp* pWrongGrammar = pGrammarContact ? pGrammarContact->getGrammarCheck( *pTextNode, false ) : pTextNode->GetGrammarCheck(); diff --git a/sw/source/core/txtnode/GrammarContact.cxx b/sw/source/core/txtnode/GrammarContact.cxx index 7f7f41076c1f..4aceeb5a9be9 100644 --- a/sw/source/core/txtnode/GrammarContact.cxx +++ b/sw/source/core/txtnode/GrammarContact.cxx @@ -18,6 +18,7 @@ */ #include <GrammarContact.hxx> +#include <doc.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <txtfrm.hxx> @@ -143,11 +144,21 @@ void GrammarContact::finishGrammarCheck( SwTextNode& rTextNode ) } } -void finishGrammarCheck( SwTextNode& rTextNode ) +sw::GrammarContact* getGrammarContactFor(const SwTextNode& rTextNode) { - sw::GrammarContact* pGrammarContact = getGrammarContact( rTextNode ); + const SwDoc& rDoc = rTextNode.GetDoc(); + if (rDoc.IsInDtor()) + return nullptr; + return rDoc.getGrammarContact().get(); +} + +void finishGrammarCheckFor(SwTextNode& rTextNode) +{ + sw::GrammarContact* pGrammarContact = getGrammarContactFor(rTextNode); if (pGrammarContact) - pGrammarContact->finishGrammarCheck( rTextNode ); + { + pGrammarContact->finishGrammarCheck(rTextNode); + } } } // end sw diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index 3d904907fc8d..213d851e70a6 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -190,7 +190,7 @@ void SAL_CALL SwXFlatParagraph::setChecked( ::sal_Int32 nType, sal_Bool bVal ) { GetTextNode()->SetGrammarCheckDirty( !bVal ); if( bVal ) - sw::finishGrammarCheck( *GetTextNode() ); + sw::finishGrammarCheckFor(*GetTextNode()); } } diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx index 4dd534691fb3..fb7e50596af6 100644 --- a/sw/source/core/unocore/unotextmarkup.cxx +++ b/sw/source/core/unocore/unotextmarkup.cxx @@ -159,7 +159,7 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup( } else if ( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE ) { - sw::GrammarContact* pGrammarContact = getGrammarContact(*m_pImpl->m_pTextNode); + sw::GrammarContact* pGrammarContact = sw::getGrammarContactFor(*m_pImpl->m_pTextNode); if( pGrammarContact ) { pWList = pGrammarContact->getGrammarCheck(*m_pImpl->m_pTextNode, true); @@ -283,7 +283,7 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup( } if( bRepaint ) - finishGrammarCheck(*m_pImpl->m_pTextNode); + sw::finishGrammarCheckFor(*m_pImpl->m_pTextNode); } static void lcl_commitGrammarMarkUp( @@ -413,7 +413,7 @@ void SAL_CALL SwXTextMarkup::commitMultiTextMarkup( // get appropriate list to use... SwGrammarMarkUp* pWList = nullptr; bool bRepaint = false; - sw::GrammarContact* pGrammarContact = getGrammarContact(*m_pImpl->m_pTextNode); + sw::GrammarContact* pGrammarContact = sw::getGrammarContactFor(*m_pImpl->m_pTextNode); if( pGrammarContact ) { pWList = pGrammarContact->getGrammarCheck(*m_pImpl->m_pTextNode, true); @@ -458,7 +458,7 @@ void SAL_CALL SwXTextMarkup::commitMultiTextMarkup( } if( bRepaint ) - finishGrammarCheck(*m_pImpl->m_pTextNode); + sw::finishGrammarCheckFor(*m_pImpl->m_pTextNode); } void SwXTextMarkup::Impl::Notify(const SfxHint& rHint) commit 09a2897822d997216b616e438fb87e8408d30042 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Thu Oct 13 18:56:33 2022 +0200 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Tue Dec 6 08:44:12 2022 +0000 sw: rename IGrammarContact*, SwGrammarContact* to GrammarContact* Change-Id: Ifa9effa5aa8eb014ebf120768893bc982ce73fd0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141432 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit dba424efc15aa2915c38721c27edf0cc1d716bd1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143657 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 81a9baeabd67..f70f91331a2e 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -12806,7 +12806,7 @@ sw/source/core/tox/ToxWhitespaceStripper.cxx sw/source/core/tox/tox.cxx sw/source/core/tox/toxhlp.cxx sw/source/core/tox/txmsrt.cxx -sw/source/core/txtnode/SwGrammarContact.cxx +sw/source/core/txtnode/GrammarContact.cxx sw/source/core/txtnode/atrfld.cxx sw/source/core/txtnode/atrflyin.cxx sw/source/core/txtnode/atrftn.cxx diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 619cd3ec7fad..47fd05e8d0c0 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -422,7 +422,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/core/tox/ToxTabStopTokenHandler \ sw/source/core/tox/ToxTextGenerator \ sw/source/core/tox/ToxWhitespaceStripper \ - sw/source/core/txtnode/SwGrammarContact \ + sw/source/core/txtnode/GrammarContact \ sw/source/core/txtnode/attrcontentcontrol \ sw/source/core/txtnode/atrfld \ sw/source/core/txtnode/atrflyin \ diff --git a/sw/inc/IGrammarContact.hxx b/sw/inc/GrammarContact.hxx similarity index 100% rename from sw/inc/IGrammarContact.hxx rename to sw/inc/GrammarContact.hxx diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 391c4bfe13a1..b7c06403271c 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -54,7 +54,7 @@ #include <unotextrange.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> -#include <IGrammarContact.hxx> +#include <GrammarContact.hxx> #include <comphelper/flagguard.hxx> #include <strings.hrc> #include <IDocumentLayoutAccess.hxx> diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 0deb09a6c2d6..5e6ffab1fc54 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -78,7 +78,7 @@ #include <mvsave.hxx> #include <istyleaccess.hxx> #include "swstylemanager.hxx" -#include <IGrammarContact.hxx> +#include <GrammarContact.hxx> #include <tblafmt.hxx> #include <MarkManager.hxx> #include <UndoManager.hxx> diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index e501f76aff81..58873a199adb 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -66,7 +66,7 @@ #include <fmtflcnt.hxx> #include <fmtcntnt.hxx> #include <numrule.hxx> -#include <IGrammarContact.hxx> +#include <GrammarContact.hxx> #include <calbck.hxx> #include <ftnidx.hxx> #include <ftnfrm.hxx> diff --git a/sw/source/core/txtnode/SwGrammarContact.cxx b/sw/source/core/txtnode/GrammarContact.cxx similarity index 99% rename from sw/source/core/txtnode/SwGrammarContact.cxx rename to sw/source/core/txtnode/GrammarContact.cxx index 90f032395814..7f7f41076c1f 100644 --- a/sw/source/core/txtnode/SwGrammarContact.cxx +++ b/sw/source/core/txtnode/GrammarContact.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <IGrammarContact.hxx> +#include <GrammarContact.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <txtfrm.hxx> diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index 2ef4916c7da4..3d904907fc8d 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -41,7 +41,7 @@ #include <rootfrm.hxx> #include <poolfmt.hxx> #include <pagedesc.hxx> -#include <IGrammarContact.hxx> +#include <GrammarContact.hxx> #include <viewopt.hxx> #include <comphelper/servicehelper.hxx> #include <comphelper/propertysetinfo.hxx> diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx index bc8cd458579a..4dd534691fb3 100644 --- a/sw/source/core/unocore/unotextmarkup.cxx +++ b/sw/source/core/unocore/unotextmarkup.cxx @@ -32,8 +32,7 @@ #include <ndtxt.hxx> #include <SwGrammarMarkUp.hxx> #include <TextCursorHelper.hxx> - -#include <IGrammarContact.hxx> +#include <GrammarContact.hxx> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/text/XTextRange.hpp>