Kaydet (Commit) 38839ae1 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

Remove the ability to set tooltips in the toolbar xml files

It was possible to set a tooltip for a certain toolbar entry.
However, this hasn't been used since that tooltip needed to be repeated for each occurence of the same command.
Instead, a TooltipLabel property has been introduced lately (see 9c2f197e).

This doesn't affect extensions (They have their own format to specify toolbars).

Change-Id: I0f0fd05b310bb49dd5b4123e31d3e7fec997dd15
üst 97fc4f7c
......@@ -42,7 +42,6 @@
#define ATTRIBUTE_WIDTH "width"
#define ATTRIBUTE_USER "userdefined"
#define ATTRIBUTE_HELPID "helpid"
#define ATTRIBUTE_TOOLTIP "tooltip"
#define ATTRIBUTE_ITEMSTYLE "style"
#define ELEMENT_NS_TOOLBAR "toolbar:toolbar"
......
......@@ -55,7 +55,6 @@ class FWE_DLLPUBLIC OReadToolBoxDocumentHandler :
TB_ATTRIBUTE_HELPID,
TB_ATTRIBUTE_STYLE,
TB_ATTRIBUTE_UINAME,
TB_ATTRIBUTE_TOOLTIP,
TB_XML_ENTRY_COUNT
};
......@@ -139,7 +138,6 @@ class FWE_DLLPUBLIC OReadToolBoxDocumentHandler :
OUString m_aLabel;
OUString m_aStyle;
OUString m_aHelpURL;
OUString m_aTooltip;
OUString m_aIsVisible;
OUString m_aCommandURL;
};
......@@ -157,7 +155,7 @@ class FWE_DLLPUBLIC OWriteToolBoxDocumentHandler
css::uno::RuntimeException );
protected:
void WriteToolBoxItem( const OUString& aCommandURL, const OUString& aLabel, const OUString& aHelpURL, const OUString& aTooltip, sal_Int16 nStyle,
void WriteToolBoxItem( const OUString& aCommandURL, const OUString& aLabel, const OUString& aHelpURL, sal_Int16 nStyle,
sal_Int16 nWidth, bool bVisible ) throw
( css::xml::sax::SAXException,
css::uno::RuntimeException );
......
......@@ -49,7 +49,6 @@ namespace framework
// Property names of a menu/menu item ItemDescriptor
static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL";
static const char ITEM_DESCRIPTOR_HELPURL[] = "HelpURL";
static const char ITEM_DESCRIPTOR_TOOLTIP[] = "Tooltip";
static const char ITEM_DESCRIPTOR_LABEL[] = "Label";
static const char ITEM_DESCRIPTOR_TYPE[] = "Type";
static const char ITEM_DESCRIPTOR_STYLE[] = "Style";
......@@ -59,7 +58,6 @@ static void ExtractToolbarParameters( const Sequence< PropertyValue >& rProp,
OUString& rCommandURL,
OUString& rLabel,
OUString& rHelpURL,
OUString& rTooltip,
sal_Int16& rStyle,
sal_Int16& rWidth,
bool& rVisible,
......@@ -74,8 +72,6 @@ static void ExtractToolbarParameters( const Sequence< PropertyValue >& rProp,
}
else if ( rProp[i].Name == ITEM_DESCRIPTOR_HELPURL )
rProp[i].Value >>= rHelpURL;
else if ( rProp[i].Name == ITEM_DESCRIPTOR_TOOLTIP )
rProp[i].Value >>= rTooltip;
else if ( rProp[i].Name == ITEM_DESCRIPTOR_LABEL )
rProp[i].Value >>= rLabel;
else if ( rProp[i].Name == ITEM_DESCRIPTOR_TYPE )
......@@ -131,7 +127,6 @@ ToolBarEntryProperty ToolBoxEntries[OReadToolBoxDocumentHandler::TB_XML_ENTRY_CO
{ OReadToolBoxDocumentHandler::TB_NS_TOOLBAR, ATTRIBUTE_HELPID },
{ OReadToolBoxDocumentHandler::TB_NS_TOOLBAR, ATTRIBUTE_ITEMSTYLE },
{ OReadToolBoxDocumentHandler::TB_NS_TOOLBAR, ATTRIBUTE_UINAME },
{ OReadToolBoxDocumentHandler::TB_NS_TOOLBAR, ATTRIBUTE_TOOLTIP },
};
OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XIndexContainer >& rItemContainer ) :
......@@ -140,7 +135,6 @@ OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XInde
m_aLabel( ITEM_DESCRIPTOR_LABEL ),
m_aStyle( ITEM_DESCRIPTOR_STYLE ),
m_aHelpURL( ITEM_DESCRIPTOR_HELPURL ),
m_aTooltip( ITEM_DESCRIPTOR_TOOLTIP ),
m_aIsVisible( ITEM_DESCRIPTOR_VISIBLE ),
m_aCommandURL( ITEM_DESCRIPTOR_COMMANDURL )
{
......@@ -295,7 +289,6 @@ throw( SAXException, RuntimeException, std::exception )
OUString aLabel;
OUString aCommandURL;
OUString aHelpURL;
OUString aTooltip;
OUString aBitmapName;
sal_uInt16 nItemBits( 0 );
bool bVisible( true );
......@@ -353,12 +346,6 @@ throw( SAXException, RuntimeException, std::exception )
}
break;
case TB_ATTRIBUTE_TOOLTIP:
{
aTooltip = xAttribs->getValueByIndex( n );
}
break;
case TB_ATTRIBUTE_STYLE:
{
// read space separated item style list
......@@ -409,14 +396,13 @@ throw( SAXException, RuntimeException, std::exception )
if ( !aCommandURL.isEmpty() )
{
Sequence< PropertyValue > aToolbarItemProp( 7 );
Sequence< PropertyValue > aToolbarItemProp( 6 );
aToolbarItemProp[0].Name = m_aCommandURL;
aToolbarItemProp[1].Name = m_aHelpURL;
aToolbarItemProp[2].Name = m_aLabel;
aToolbarItemProp[3].Name = m_aType;
aToolbarItemProp[4].Name = m_aStyle;
aToolbarItemProp[5].Name = m_aIsVisible;
aToolbarItemProp[6].Name = m_aTooltip;
//fix for fdo#39370
/// check whether RTL interface or not
......@@ -441,7 +427,6 @@ throw( SAXException, RuntimeException, std::exception )
aToolbarItemProp[3].Value = makeAny( css::ui::ItemType::DEFAULT );
aToolbarItemProp[4].Value <<= nItemBits;
aToolbarItemProp[5].Value <<= bVisible;
aToolbarItemProp[6].Value <<= aTooltip;
m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
}
......@@ -727,15 +712,14 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxDocument() throw
OUString aCommandURL;
OUString aLabel;
OUString aHelpURL;
OUString aTooltip;
bool bVisible( true );
sal_Int16 nType( css::ui::ItemType::DEFAULT );
sal_Int16 nWidth( 0 );
sal_Int16 nStyle( 0 );
ExtractToolbarParameters( aProps, aCommandURL, aLabel, aHelpURL, aTooltip, nStyle, nWidth, bVisible, nType );
ExtractToolbarParameters( aProps, aCommandURL, aLabel, aHelpURL, nStyle, nWidth, bVisible, nType );
if ( nType == css::ui::ItemType::DEFAULT )
WriteToolBoxItem( aCommandURL, aLabel, aHelpURL, aTooltip, nStyle, nWidth, bVisible );
WriteToolBoxItem( aCommandURL, aLabel, aHelpURL, nStyle, nWidth, bVisible );
else if ( nType == css::ui::ItemType::SEPARATOR_SPACE )
WriteToolBoxSpace();
else if ( nType == css::ui::ItemType::SEPARATOR_LINE )
......@@ -757,7 +741,6 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxItem(
const OUString& rCommandURL,
const OUString& rLabel,
const OUString& rHelpURL,
const OUString& rTooltip,
sal_Int16 nStyle,
sal_Int16 nWidth,
bool bVisible )
......@@ -795,13 +778,6 @@ throw ( SAXException, RuntimeException )
rHelpURL );
}
if ( !rTooltip.isEmpty() )
{
pList->AddAttribute( m_aXMLToolbarNS + ATTRIBUTE_TOOLTIP,
m_aAttributeType,
rTooltip );
}
if ( nStyle > 0 )
{
OUString aValue;
......
......@@ -91,7 +91,6 @@ namespace framework
static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL";
static const char ITEM_DESCRIPTOR_HELPURL[] = "HelpURL";
static const char ITEM_DESCRIPTOR_TOOLTIP[] = "Tooltip";
static const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer";
static const char ITEM_DESCRIPTOR_LABEL[] = "Label";
static const char ITEM_DESCRIPTOR_TYPE[] = "Type";
......@@ -1203,7 +1202,6 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
OUString aCommandURL;
OUString aLabel;
OUString aHelpURL;
OUString aTooltip;
sal_uInt16 nType( css::ui::ItemType::DEFAULT );
sal_uInt16 nWidth( 0 );
sal_uInt32 nStyle( 0 );
......@@ -1256,8 +1254,6 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
}
else if ( aProp[i].Name == ITEM_DESCRIPTOR_HELPURL )
aProp[i].Value >>= aHelpURL;
else if ( aProp[i].Name == ITEM_DESCRIPTOR_TOOLTIP )
aProp[i].Value >>= aTooltip;
else if ( aProp[i].Name == ITEM_DESCRIPTOR_LABEL )
aProp[i].Value >>= aLabel;
else if ( aProp[i].Name == ITEM_DESCRIPTOR_TYPE )
......@@ -1273,7 +1269,6 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
{
OUString aString(vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommandURL, m_xFrame));
OUString aTooltipFromCommand(vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommandURL, m_xFrame, false));
ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( nStyle );
if ( aMenuDesc.is() )
......@@ -1283,20 +1278,9 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
}
m_pToolBar->InsertItem( nId, aString, nItemBits );
m_pToolBar->SetItemCommand( nId, aCommandURL );
OUString sQuickHelp( aString );
// Use custom tooltip if available
if ( !aTooltip.isEmpty() ) // Tooltip from menu xml file (toolbar:tooltip)
sQuickHelp = aTooltip;
else if ( !aTooltipFromCommand.isEmpty() ) // Tooltip from uno command (TooltipLabel)
sQuickHelp = aTooltipFromCommand;
OUString sShortCut = vcl::CommandInfoProvider::Instance().GetCommandShortcut(aCommandURL, m_xFrame);
if( !sShortCut.isEmpty() )
{
sQuickHelp += " (";
sQuickHelp += sShortCut;
sQuickHelp += ")";
}
m_pToolBar->SetQuickHelpText( nId, sQuickHelp );
OUString sTooltip = vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommandURL, m_xFrame);
if (!sTooltip.isEmpty())
m_pToolBar->SetQuickHelpText( nId, sTooltip );
if ( !aLabel.isEmpty() )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment