/* -*- 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 .
*/
//aStr is non-empty when user types in the search box to search some function void FuncPage::UpdateFunctionList(const OUString& aStr)
{
m_xLbFunction->clear();
m_xLbFunction->freeze();
mCategories.clear();
sFuncScores.clear();
const sal_Int32 nSelPos = m_xLbCategory->get_active(); bool bCollapse = nSelPos == ALL_CATEGORY; bool bFilter = !aStr.isEmpty(); // tdf#104487 - remember last used function category
m_nRememberedFunctionCategory = nSelPos;
if (nSelPos >= ALL_CATEGORY)
{ if (pCategory == nullptr)
{ const sal_uInt32 nCount = m_pFunctionManager->getCount(); for (sal_uInt32 i = 0; i < nCount; ++i)
{
impl_addFunctions(m_pFunctionManager->getCategory(i), bCollapse);
}
} else
{
impl_addFunctions(pCategory, false);
}
} elseif (nSelPos == LRU_CATEGORY) // LRU-List
{ for (autoconst& elem : aLRUList)
{ if (elem) // may be null if a function is no longer available
{
OUString aFunction(elem->getFunctionName());
OUString sId(weld::toId(elem));
const sal_uInt32 nCategoryCount = m_pFunctionManager->getCount(); // Category listbox holds additional entries for Last Used and All, so // the offset should be two but hard coded numbers are ugly... const sal_Int32 nCategoryOffset = m_xLbCategory->get_count() - nCategoryCount; // If a real category (not Last Used or All) is selected, list only // functions of that category. Else list all, LRU is handled above.
sal_Int32 nCatBeg = (nSelPos == -1 ? -1 : nSelPos - nCategoryOffset);
sal_uInt32 nCatEnd; if (nCatBeg < 0)
{
nCatBeg = 0;
nCatEnd = nCategoryCount;
} else
{
nCatEnd = nCatBeg + 1;
} for (sal_uInt32 i = nCatBeg; i < nCatEnd; ++i)
{ const IFunctionCategory* pCategory = m_pFunctionManager->getCategory(i); const sal_uInt32 nFunctionCount = pCategory->getCount(); for (sal_uInt32 j = 0; j < nFunctionCount; ++j)
{
TFunctionDesc pDesc(pCategory->getFunction(j)); const OUString aFunction(rCharClass.uppercase(pDesc->getFunctionName()));
SearchFunction(aFunction, aSearchStr, pDesc, m_xSimilaritySearch->get_active());
}
}
m_xLbFunction->thaw(); // Ensure no function is selected so the Next button doesn't overwrite a // function that is not in the list with an arbitrary selected one.
m_xLbFunction->unselect_all();
if (bCollapse && bFilter)
{ for (constauto& category : mCategories)
m_xLbFunction->expand_row(*category.second);
}
if (IsVisible())
SelTreeViewHdl(*m_xLbFunction);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.