diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2022-02-15 17:16:37 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2022-02-23 11:04:08 +0100 |
commit | b6fb3c0a9dcc699dff033d1fe11471302251de15 (patch) | |
tree | 376c650627510f72b1282c5dac2517dd1885f318 | |
parent | Adapt to hamcrest-2.2-3.fc35.noarch.rpm (diff) | |
download | core-b6fb3c0a9dcc699dff033d1fe11471302251de15.tar.gz core-b6fb3c0a9dcc699dff033d1fe11471302251de15.zip |
Add logging to auotext functions
Change-Id: Id7e69e764664978cc97016803773c1077cd15979
-rw-r--r-- | include/sal/log-areas.dox | 1 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/gloshdl.cxx | 16 | ||||
-rw-r--r-- | sw/source/uibase/misc/glosdoc.cxx | 20 | ||||
-rw-r--r-- | sw/source/uibase/utlui/gloslst.cxx | 10 |
4 files changed, 47 insertions, 0 deletions
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index 904ba74b4425..9a0c43587bc9 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -514,6 +514,7 @@ certain functionality. @li @c sw @li @c sw.a11y - accessibility +@li @c sw.autotext - Autotext @li @c sw.calc - formula calculation @li @c sw.core - Writer core @li @c sw.createcopy diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index fc1f13dae296..30353d27f00c 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -349,12 +349,15 @@ bool SwGlossaryHdl::DelGlossary(const OUString &rShortName) // expand short name bool SwGlossaryHdl::ExpandGlossary(weld::Window* pParent) { + SAL_INFO("sw.autotext", "SwGlossaryHdl::ExpandGlossary"); OSL_ENSURE(pWrtShell->CanInsert(), "illegal"); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); ::GlossaryGetCurrGroup fnGetCurrGroup = pFact->GetGlossaryCurrGroupFunc(); OUString sGroupName( (*fnGetCurrGroup)() ); + SAL_INFO("sw.autotext", "current group name: " << sGroupName); if (sGroupName.indexOf(GLOS_DELIM)<0) FindGroupName(sGroupName); + SAL_INFO("sw.autotext", "new group name: " << sGroupName); std::unique_ptr<SwTextBlocks> pGlossary = rStatGlossaries.GetGroupDoc(sGroupName); OUString aShortName; @@ -378,6 +381,7 @@ bool SwGlossaryHdl::ExpandGlossary(weld::Window* pParent) if(pWrtShell->IsSelection()) aShortName = pWrtShell->GetSelText(); } + SAL_INFO("sw.autotext", "END SwGlossaryHdl::ExpandGlossary"); return pGlossary && Expand(pParent, aShortName, &rStatGlossaries, std::move(pGlossary)); } @@ -385,16 +389,19 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName, SwGlossaries *pGlossaries, std::unique_ptr<SwTextBlocks> pGlossary) { + SAL_INFO("sw.autotext", "SwGlossaryHdl::Expand rShortName: " << rShortName); std::vector<TextBlockInfo_Impl> aFoundArr; OUString aShortName( rShortName ); bool bCancel = false; // search for text block // - don't prefer current group depending on configuration setting const SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get(); + SAL_INFO("sw.autotext", "rCfg.IsSearchInAllCategories(): " << rCfg.IsSearchInAllCategories()); sal_uInt16 nFound = !rCfg.IsSearchInAllCategories() ? pGlossary->GetIndex( aShortName ) : -1; // if not found then search in all groups if( nFound == sal_uInt16(-1) ) { + SAL_INFO("sw.autotext", "not found"); const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore(); SwGlossaryList* pGlossaryList = ::GetGlossaryList(); const size_t nGroupCount = pGlossaryList->GetGroupCount(); @@ -402,11 +409,14 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName, { // get group name with path-extension const OUString sGroupName = pGlossaryList->GetGroupName(i); + SAL_INFO("sw.autotext", "checking group " << sGroupName); if(sGroupName == pGlossary->GetName()) continue; + SAL_INFO("sw.autotext", "found group " << sGroupName); const sal_uInt16 nBlockCount = pGlossaryList->GetBlockCount(i); if(nBlockCount) { + SAL_INFO("sw.autotext", "found block"); const OUString sTitle = pGlossaryList->GetGroupTitle(i); for(sal_uInt16 j = 0; j < nBlockCount; j++) { @@ -414,6 +424,7 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName, const OUString sShortName(pGlossaryList->GetBlockShortName(i, j)); if( rSCmp.isEqual( rShortName, sShortName )) { + SAL_INFO("sw.autotext", "found: sTitle: " << sTitle << " sLongName" << sLongName << " sGroupName " << sGroupName ); aFoundArr.emplace_back(sTitle, sLongName, sGroupName); } } @@ -421,9 +432,11 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName, } if( !aFoundArr.empty() ) // one was found { + SAL_INFO("sw.autotext", "one was found"); pGlossary.reset(); if (1 == aFoundArr.size()) { + SAL_INFO("sw.autotext", "aFoundArr.size() == 1"); TextBlockInfo_Impl& rData = aFoundArr.front(); pGlossary = pGlossaries->GetGroupDoc(rData.sGroupName); nFound = pGlossary->GetIndex( aShortName ); @@ -459,6 +472,7 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName, // not found if( nFound == sal_uInt16(-1) ) { + SAL_INFO("sw.autotext", "not found."); if( !bCancel ) { pGlossary.reset(); @@ -480,6 +494,7 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName, } else { + SAL_INFO("sw.autotext", "inserting glossary."); SvxMacro aStartMacro(OUString(), OUString(), STARBASIC); SvxMacro aEndMacro(OUString(), OUString(), STARBASIC); GetMacros( aShortName, aStartMacro, aEndMacro, pGlossary.get() ); @@ -510,6 +525,7 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName, if( aFieldLst.BuildSortLst() ) pWrtShell->UpdateInputFields( &aFieldLst ); } + SAL_INFO("sw.autotext", "END SwGlossaryHdl::Expand"); return true; } diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index 08cab28a4304..1666cfac5905 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -347,11 +347,13 @@ static OUString lcl_makePath(const std::vector<OUString>& rPaths) void SwGlossaries::UpdateGlosPath(bool bFull) { + SAL_INFO("sw.autotext", "SwGlossaries::UpdateGlosPath bFull: " << true); SvtPathOptions aPathOpt; const OUString& aNewPath( aPathOpt.GetAutoTextPath() ); bool bPathChanged = m_aPath != aNewPath; if (bFull || bPathChanged) { + SAL_INFO("sw.autotext", "if (bFull || bPathChanged)"); m_aPath = aNewPath; m_PathArr.clear(); @@ -360,6 +362,7 @@ void SwGlossaries::UpdateGlosPath(bool bFull) std::vector<OUString> aInvalidPaths; if (!m_aPath.isEmpty()) { + SAL_INFO("sw.autotext", "if (!m_aPath.isEmpty())"); sal_Int32 nIndex = 0; do { @@ -374,19 +377,27 @@ void SwGlossaries::UpdateGlosPath(bool bFull) } aDirArr.push_back(sPth); if( !FStatHelper::IsFolder( sPth ) ) + { aInvalidPaths.push_back(sPth); + SAL_INFO("sw.autotext", "invalid path: " << sPth); + } else + { m_PathArr.push_back(sPth); + SAL_INFO("sw.autotext", "valid path: " << sPth); + } } while (nIndex>=0); } if (m_aPath.isEmpty() || !aInvalidPaths.empty()) { + SAL_INFO("sw.autotext", "if (m_aPath.isEmpty() || !aInvalidPaths.empty())"); std::sort(aInvalidPaths.begin(), aInvalidPaths.end()); aInvalidPaths.erase(std::unique(aInvalidPaths.begin(), aInvalidPaths.end()), aInvalidPaths.end()); if (bPathChanged || (m_aInvalidPaths != aInvalidPaths)) { + SAL_INFO("sw.autotext", "err condition!"); m_aInvalidPaths = aInvalidPaths; // wrong path, that means AutoText directory doesn't exist @@ -403,10 +414,12 @@ void SwGlossaries::UpdateGlosPath(bool bFull) if (!m_GlosArr.empty()) { + SAL_INFO("sw.autotext", "if (!m_GlosArr.empty())"); m_GlosArr.clear(); GetNameList(); } } + SAL_INFO("sw.autotext", "END SwGlossaries::UpdateGlosPath"); } void SwGlossaries::ShowError() @@ -591,16 +604,23 @@ Reference< text::XAutoTextEntry > SwGlossaries::GetAutoTextEntry( const OUString& rGroupName, const OUString& rEntryName ) { + SAL_INFO("sw.autotext", "SwGlossaries::GetAutoTextEntry rCompleteGroupName: " << rCompleteGroupName << " rGroupName: " << rGroupName << " rEntryName: " << rEntryName); //standard must be created bool bCreate = ( rCompleteGroupName == GetDefName() ); std::unique_ptr< SwTextBlocks > pGlosGroup( GetGroupDoc( rCompleteGroupName, bCreate ) ); if (!pGlosGroup || pGlosGroup->GetError()) + { + SAL_INFO("sw.autotext", "pGlosGroup empty!"); throw lang::WrappedTargetException(); + } sal_uInt16 nIdx = pGlosGroup->GetIndex( rEntryName ); if ( USHRT_MAX == nIdx ) + { + SAL_INFO("sw.autotext", "rEntryName not found!"); throw container::NoSuchElementException(); + } Reference< text::XAutoTextEntry > xReturn; diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx index 6041dbd881d8..0d80082fd21c 100644 --- a/sw/source/uibase/utlui/gloslst.cxx +++ b/sw/source/uibase/utlui/gloslst.cxx @@ -82,6 +82,7 @@ IMPL_LINK_NOARG(SwGlossDecideDlg, SelectHdl, weld::TreeView&, void) SwGlossaryList::SwGlossaryList() : bFilled(false) { + SAL_INFO("sw.autotext", "SwGlossaryList::SwGlossaryList"); SvtPathOptions aPathOpt; sPath = aPathOpt.GetAutoTextPath(); SetTimeout(GLOS_TIMEOUT); @@ -89,6 +90,7 @@ SwGlossaryList::SwGlossaryList() : SwGlossaryList::~SwGlossaryList() { + SAL_INFO("sw.autotext", "SwGlossaryList::~SwGlossaryList"); ClearGroups(); } @@ -225,6 +227,7 @@ OUString SwGlossaryList::GetBlockShortName(size_t nGroup, sal_uInt16 nBlock) void SwGlossaryList::Update() { + SAL_INFO("sw.autotext", "SwGlossaryList::Update"); if(!IsActive()) Start(); @@ -232,6 +235,7 @@ void SwGlossaryList::Update() const OUString& sTemp( aPathOpt.GetAutoTextPath() ); if(sTemp != sPath) { + SAL_INFO("sw.autotext", "sTemp != sPath"); sPath = sTemp; bFilled = false; ClearGroups(); @@ -241,6 +245,7 @@ void SwGlossaryList::Update() const OUString sExt( SwGlossaries::GetExtension() ); if(!bFilled) { + SAL_INFO("sw.autotext", "!bFilled"); const size_t nGroupCount = pGlossaries->GetGroupCnt(); for(size_t i = 0; i < nGroupCount; ++i) { @@ -266,6 +271,7 @@ void SwGlossaryList::Update() } else { + SAL_INFO("sw.autotext", "bFilled"); for( size_t nPath = 0; nPath < rPathArr.size(); nPath++ ) { std::vector<OUString> aFoundGroupNames; @@ -323,10 +329,12 @@ void SwGlossaryList::Update() } } } + SAL_INFO("sw.autotext", "END SwGlossaryList::Update"); } void SwGlossaryList::Invoke() { + SAL_INFO("sw.autotext", "SwGlossaryList::Invoke"); // Only update automatically if a SwView has the focus. if(::GetActiveView()) Update(); @@ -350,6 +358,7 @@ void SwGlossaryList::FillGroup(AutoTextGroup* pGroup, SwGlossaries* pGlossaries) pGroup->sShortNames.clear(); if(pBlock) pGroup->sTitle = pBlock->GetName(); + SAL_INFO("sw.autotext", "SwGlossaryList::FillGroup " << pGroup->sTitle); for(sal_uInt16 j = 0; j < pGroup->nCount; j++) { @@ -358,6 +367,7 @@ void SwGlossaryList::FillGroup(AutoTextGroup* pGroup, SwGlossaries* pGlossaries) pGroup->sShortNames += pBlock->GetShortName(j) + OUStringLiteral1(STRING_DELIM); } + SAL_INFO("sw.autotext", "END SwGlossaryList::FillGroup"); } // Give back all (not exceeding FIND_MAX_GLOS) found modules |