/* -*- 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 .
*/
{ // insert new menu item
sal_Int32 nIndex = aCommandURL.indexOf( aSlotURL ); if ( nIndex >= 0 )
{ // Special code for our menu implementation: some menu items don't have a // command url but uses the item id as a unique identifier. These entries // got a special url during conversion from menu=>actiontriggercontainer. // Now we have to extract this special url and set the correct item id!!!
nNewItemId = static_cast<sal_uInt16>(o3tl::toInt32(aCommandURL.subView( nIndex+aSlotURL.getLength() )));
rSubMenu->insertItem(nNewItemId, aLabel, 0, i);
} else
{
rSubMenu->insertItem(nNewItemId, aLabel, 0, i);
rSubMenu->setCommand(nNewItemId, aCommandURL);
}
// handle bitmap if (xGraphic)
{
rSubMenu->setItemImage(nNewItemId, xGraphic, false);
} else
{ // Support add-on images for context menu interceptors
BitmapEx aBitmap(aAddonOptions.GetImageFromURL(aCommandURL, false, true)); if (!aBitmap.IsEmpty())
rSubMenu->setItemImage(nNewItemId, Graphic(aBitmap).GetXGraphic(), false);
}
if ( xSubContainer.is() )
{
rtl::Reference xNewSubMenu(new VCLXPopupMenu);
try
{ // Retrieve the menu attributes and set them in our PropertySet
OUString aLabel = rMenu->getItemText(nItemId);
a <<= aLabel;
xPropSet->setPropertyValue(u"Text"_ustr, a );
if (nType == css::awt::MenuItemType_SEPARATOR)
{
xPropSet = CreateActionTriggerSeparator( rActionTriggerContainer );
a <<= xPropSet;
rActionTriggerContainer->insertByIndex( nPos, a );
} else
{
xPropSet = CreateActionTrigger(nItemId, rMenu, rActionTriggerContainer);
a <<= xPropSet;
rActionTriggerContainer->insertByIndex( nPos, a );
css::uno::Reference<XPopupMenu> xPopupMenu = rMenu->getPopupMenu(nItemId); if (xPopupMenu.is())
{ // recursive call to build next sub menu
Reference< XIndexContainer > xSubContainer = CreateActionTriggerContainer( rActionTriggerContainer );
a <<= xSubContainer;
xPropSet->setPropertyValue(u"SubContainer"_ustr, a );
FillActionTriggerContainerWithMenu(xPopupMenu, xSubContainer);
}
}
} catch (const Exception&)
{
}
}
}
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.