/* -*- 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 .
*/
const Sequence<OUString> aDeckNodeNames (aDeckRootNode.getNodeNames());
maDecks.clear(); for (const OUString& aDeckName : aDeckNodeNames)
{ if (comphelper::LibreOfficeKit::isActive())
{ // Hide these decks in LOK as they aren't fully functional. if (aDeckName == "GalleryDeck") continue;
}
const utl::OConfigurationNode aDeckNode(aDeckRootNode.openNode(aDeckName)); if (!aDeckNode.isValid()) continue;
const Sequence<OUString> aPanelNodeNames (aPanelRootNode.getNodeNames());
maPanels.clear(); for (constauto& rPanelNodeName : aPanelNodeNames)
{ const utl::OConfigurationNode aPanelNode (aPanelRootNode.openNode(rPanelNodeName)); if (!aPanelNode.isValid()) continue;
if (comphelper::LibreOfficeKit::isActive())
{ // Hide these panels in LOK as they aren't fully functional.
OUString aPanelId = getString(aPanelNode, u"Id"_ustr); if (aPanelId == "PageStylesPanel" || aPanelId == "PageHeaderPanel"
|| aPanelId == "PageFooterPanel") continue;
}
// guard against garbage in place of application if (eApplication != vcl::EnumContext::Application::NONE)
maLastActiveDecks.insert( std::make_pair(sApplicationName, sLastUsed ) );
}
// Set up a default for Math - will do nothing if already set for (constauto& aOverrideDeck : GetDeckOverrides())
maLastActiveDecks.emplace(aOverrideDeck.first, aOverrideDeck.second);
}
for (const OUString& sValue : aValues)
{
sal_Int32 nCharacterIndex (0); const OUString sApplicationName (o3tl::trim(o3tl::getToken(sValue, 0, ',', nCharacterIndex))); if (nCharacterIndex < 0)
{ if (sApplicationName.getLength() == 0)
{ // This is a valid case: in the XML file the separator // was used as terminator. Using it in the last line // creates an additional but empty entry. break;
} else
{
SAL_WARN("sfx.sidebar", "expecting three or four values per ContextList entry, separated by comma, entries: " << aValues); continue;
}
}
const OUString sContextName(o3tl::trim(o3tl::getToken(sValue, 0, ',', nCharacterIndex))); if (nCharacterIndex < 0)
{
SAL_WARN("sfx.sidebar", "expecting three or four values per ContextList entry, separated by comma"); continue;
}
// Setup a list of application enums. Note that the // application name may result in more than one value (eg // DrawImpress will result in two enums, one for Draw and one // for Impress).
std::vector<vcl::EnumContext::Application> aApplications;
vcl::EnumContext::Application eApplication (vcl::EnumContext::GetApplicationEnum(sApplicationName));
if (eApplication == vcl::EnumContext::Application::NONE
&& sApplicationName != vcl::EnumContext::GetApplicationName(vcl::EnumContext::Application::NONE))
{ // Handle some special names: abbreviations that make // context descriptions more readable. if (sApplicationName == "Writer")
aApplications.push_back(vcl::EnumContext::Application::Writer); elseif (sApplicationName == "Calc")
aApplications.push_back(vcl::EnumContext::Application::Calc); elseif (sApplicationName == "Draw")
aApplications.push_back(vcl::EnumContext::Application::Draw); elseif (sApplicationName == "Impress")
aApplications.push_back(vcl::EnumContext::Application::Impress); elseif (sApplicationName == "Chart")
aApplications.push_back(vcl::EnumContext::Application::Chart); elseif (sApplicationName == "Math")
aApplications.push_back(vcl::EnumContext::Application::Formula); elseif (sApplicationName == "DrawImpress")
{ // A special case among the special names: it is // common to use the same context descriptions for // both Draw and Impress. This special case helps to // avoid duplication in the .xcu file.
aApplications.push_back(vcl::EnumContext::Application::Draw);
aApplications.push_back(vcl::EnumContext::Application::Impress);
} elseif (sApplicationName == "WriterVariants")
{ // Another special case for all Writer variants.
aApplications.push_back(vcl::EnumContext::Application::Writer);
aApplications.push_back(vcl::EnumContext::Application::WriterGlobal);
aApplications.push_back(vcl::EnumContext::Application::WriterWeb);
aApplications.push_back(vcl::EnumContext::Application::WriterXML);
aApplications.push_back(vcl::EnumContext::Application::WriterForm);
aApplications.push_back(vcl::EnumContext::Application::WriterReport);
} else
{
SAL_WARN("sfx.sidebar", "application name " << sApplicationName << " not recognized"); continue;
}
} else
{ // No conversion of the application name necessary.
aApplications.push_back(eApplication);
}
// Setup the actual context enum. const vcl::EnumContext::Context eContext (vcl::EnumContext::GetContextEnum(sContextName)); if (eContext == vcl::EnumContext::Context::Unknown)
{
SAL_WARN("sfx.sidebar", "context name " << sContextName << " not recognized"); continue;
}
// Setup the flag that controls whether a deck/pane is // initially visible/expanded. bool bIsInitiallyVisible; if (sInitialState == u"visible")
bIsInitiallyVisible = true; elseif (sInitialState == u"hidden")
bIsInitiallyVisible = false; else
{
SAL_WARN("sfx.sidebar", "unrecognized state"); continue;
}
void ResourceManager::ReadLegacyAddons (const Reference<frame::XController>& rxController)
{ // Get module name for given frame.
OUString sModuleName (Tools::GetModuleName(rxController)); if (sModuleName.getLength() == 0) return; if (maProcessedApplications.find(sModuleName) != maProcessedApplications.end())
{ // Addons for this application have already been read. // There is nothing more to do. return;
}
// Mark module as processed. Even when there is an error that // prevents the configuration data from being read, this error // will not be triggered a second time.
maProcessedApplications.insert(sModuleName);
// Get access to the configuration root node for the application.
utl::OConfigurationTreeRoot aLegacyRootNode (GetLegacyAddonRootNode(sModuleName)); if (!aLegacyRootNode.isValid()) return;
// Process child nodes.
std::vector<OUString> aMatchingNodeNames;
GetToolPanelNodeNames(aMatchingNodeNames, aLegacyRootNode); const sal_Int32 nCount (aMatchingNodeNames.size()); for (sal_Int32 nReadIndex(0); nReadIndex<nCount; ++nReadIndex)
{ const OUString& rsNodeName (aMatchingNodeNames[nReadIndex]); const utl::OConfigurationNode aChildNode (aLegacyRootNode.openNode(rsNodeName)); if (!aChildNode.isValid()) continue;
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.