/* -*- 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 .
*/
// find and replace the %n placeholder in the prefix string
name = prefix.replaceFirst("%n", OUString::number(suffix), &pos);
if (pos == -1)
{ // no placeholder found so just append the suffix
name += OUString::number(suffix);
}
if (!entries) return name;
// now check if there is an already existing entry with this name bool bFoundEntry = false; for (autoconst& entry : *entries)
{ if (name.equals(entry->GetName()))
{
bFoundEntry = true; break;
}
}
if (bFoundEntry)
{ // name already exists so try the next number up return generateCustomName(prefix, entries, ++suffix);
}
// now check is there is an already existing entry with this url bool bFoundEntry = false; for (autoconst& entry : *entries)
{ if (url.equals(entry->GetCommand()))
{
bFoundEntry = true; break;
}
}
if (bFoundEntry)
{ // url already exists so try the next number up return generateCustomMenuURL(entries, ++suffix);
}
OUString SvxConfigPageHelper::generateCustomURL(SvxEntries* entries)
{
OUString url = OUString::Concat(ITEM_TOOLBAR_URL) + CUSTOM_TOOLBAR_STR + // use a random number to minimize possible clash with existing custom toolbars
OUString::number(generateRandomValue(), 16);
// now check is there is an already existing entry with this url bool bFoundEntry = false; for (autoconst& entry : *entries)
{ if (url.equals(entry->GetCommand()))
{
bFoundEntry = true; break;
}
}
if (bFoundEntry)
{ // url already exists so try the next number up return generateCustomURL(entries);
}
css::uno::Sequence<css::beans::PropertyValue>
SvxConfigPageHelper::ConvertSvxConfigEntry(const SvxConfigEntry* pEntry)
{ // If the name has not been changed, then the label can be stored // as an empty string. // It will be initialised again later using the command to label map.
OUString sLabel; if (pEntry->HasChangedName() || pEntry->GetCommand().isEmpty())
sLabel = pEntry->GetName();
css::uno::Sequence<css::beans::PropertyValue>
SvxConfigPageHelper::ConvertToolbarEntry(const SvxConfigEntry* pEntry)
{ // If the name has not been changed, then the label can be stored // as an empty string. // It will be initialised again later using the command to label map.
OUString sLabel; if (pEntry->HasChangedName() || pEntry->GetCommand().isEmpty())
sLabel = pEntry->GetName();
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.