/* -*- 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 .
*/
for (constauto& removedStr : m_RemovedArr)
{
sal_Int32 nIdx{ 0 }; const OUString sDelGroup = removedStr.getToken(0, '\t', nIdx); if( sDelGroup == aActGroup )
{ //when the current group is deleted, the current group has to be relocated if (m_xGroupTLB->n_children())
{
GlosBibUserData* pUserData = weld::fromId<GlosBibUserData*>(m_xGroupTLB->get_id(0));
m_pGlosHdl->SetCurGroup(pUserData->sGroupName);
}
} const OUString sMsg(SwResId(STR_QUERY_DELETE_GROUP1)
+ o3tl::getToken(removedStr, 0, '\t', nIdx)
+ SwResId(STR_QUERY_DELETE_GROUP2));
IMPL_LINK_NOARG(SwGlossaryGroupDlg, EntrySizeAllocHdl, const Size&, void)
{
std::vector<int> aWidths; int x, y, width, height; if (m_xPathLB->get_extents_relative_to(*m_xGroupTLB, x, y, width, height))
{
aWidths.push_back(x);
m_xGroupTLB->set_column_fixed_widths(aWidths);
}
}
IMPL_LINK( SwGlossaryGroupDlg, DeleteHdl, weld::Button&, rButton, void )
{ int nEntry = m_xGroupTLB->get_selected_index(); if (nEntry == -1)
{
rButton.set_sensitive(false); return;
}
GlosBibUserData* pUserData = weld::fromId<GlosBibUserData*>(m_xGroupTLB->get_id(nEntry));
OUString const sEntry(pUserData->sGroupName); // if the name to be deleted is among the new ones - get rid of it bool bDelete = true; auto it = std::find(m_InsertedArr.begin(), m_InsertedArr.end(), sEntry); if (it != m_InsertedArr.end())
{
m_InsertedArr.erase(it);
bDelete = false;
} // it should probably be renamed? if(bDelete)
{
it = std::find_if(m_RenamedArr.begin(), m_RenamedArr.end(),
[&sEntry](OUString& s) { return o3tl::getToken(s, 0, RENAME_TOKEN_DELIM) == sEntry; }); if (it != m_RenamedArr.end())
{
m_RenamedArr.erase(it);
bDelete = false;
}
} if(bDelete)
{
m_RemovedArr.emplace_back(pUserData->sGroupName + "\t" + pUserData->sGroupTitle);
} delete pUserData;
m_xGroupTLB->remove(nEntry); if (!m_xGroupTLB->n_children())
rButton.set_sensitive(false); //the content must be deleted - otherwise the new handler would be called in Apply()
m_xNameED->set_text(OUString());
ModifyHdl(*m_xNameED);
}
// if the name to be renamed is among the new ones - replace bool bDone = false; auto it = std::find(m_InsertedArr.begin(), m_InsertedArr.end(), sEntry); if (it != m_InsertedArr.end())
{
m_InsertedArr.erase(it);
m_InsertedArr.push_back(sNewName);
bDone = true;
} if(!bDone)
{
sEntry += OUStringChar(RENAME_TOKEN_DELIM) + sNewName
+ OUStringChar(RENAME_TOKEN_DELIM) + sNewTitle;
m_RenamedArr.push_back(sEntry);
} delete pUserData;
m_xGroupTLB->remove(nEntry);
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.