summaryrefslogtreecommitdiff
path: root/framework/source/xml
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@openoffice.org>2010-01-21 19:39:39 +0100
committerDavid Tardon <dtardon@openoffice.org>2010-01-21 19:39:39 +0100
commitacfb117151070cc43951cb97e2f2957be8f99853 (patch)
tree2101983f94dfc04d894b597ec185e3766653e29b /framework/source/xml
parenta3af41119ca87981acd22b68765ae2bf64715454 (diff)
parent3b3e144c13a85b21b32904f245f44256c63e10e5 (diff)
dtardon01: update to DEV300_m70
Diffstat (limited to 'framework/source/xml')
-rw-r--r--framework/source/xml/menudocumenthandler.cxx135
-rw-r--r--framework/source/xml/toolboxdocumenthandler.cxx83
2 files changed, 198 insertions, 20 deletions
diff --git a/framework/source/xml/menudocumenthandler.cxx b/framework/source/xml/menudocumenthandler.cxx
index 2422d516d0ac..47d8c93f71e0 100644
--- a/framework/source/xml/menudocumenthandler.cxx
+++ b/framework/source/xml/menudocumenthandler.cxx
@@ -47,6 +47,7 @@
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include <com/sun/star/ui/ItemType.hpp>
+#include <com/sun/star/ui/ItemStyle.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -80,11 +81,13 @@
#define ATTRIBUTE_LABEL "http://openoffice.org/2001/menu^label"
#define ATTRIBUTE_HELPID "http://openoffice.org/2001/menu^helpid"
#define ATTRIBUTE_LINEBREAK "http://openoffice.org/2001/menu^linebreak"
+#define ATTRIBUTE_STYLE "http://openoffice.org/2001/menu^style"
#define ATTRIBUTE_NS_ID "menu:id"
#define ATTRIBUTE_NS_LABEL "menu:label"
#define ATTRIBUTE_NS_HELPID "menu:helpid"
#define ATTRIBUTE_NS_LINEBREAK "menu:linebreak"
+#define ATTRIBUTE_NS_STYLE "menu:style"
#define ATTRIBUTE_XMLNS_MENU "xmlns:menu"
@@ -92,12 +95,16 @@
#define MENUBAR_DOCTYPE "<!DOCTYPE menu:menubar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"menubar.dtd\">"
+#define ATTRIBUTE_ITEMSTYLE_TEXT "text"
+#define ATTRIBUTE_ITEMSTYLE_IMAGE "image"
+
// 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_CONTAINER[] = "ItemDescriptorContainer";
static const char ITEM_DESCRIPTOR_LABEL[] = "Label";
static const char ITEM_DESCRIPTOR_TYPE[] = "Type";
+static const char ITEM_DESCRIPTOR_STYLE[] = "Style";
// special popup menus (filled during runtime) must be saved as an empty popup menu or menuitem!!!
static const sal_Int32 CMD_PROTOCOL_SIZE = 5;
@@ -121,12 +128,27 @@ using namespace ::com::sun::star::ui;
namespace framework
{
+struct MenuStyleItem
+{
+ sal_Int16 nBit;
+ const char* attrName;
+};
+
+MenuStyleItem MenuItemStyles[ ] = {
+ { ::com::sun::star::ui::ItemStyle::ICON, ATTRIBUTE_ITEMSTYLE_IMAGE },
+ { ::com::sun::star::ui::ItemStyle::TEXT, ATTRIBUTE_ITEMSTYLE_TEXT },
+};
+
+
+sal_Int32 nMenuStyleItemEntries = sizeof( MenuItemStyles ) / sizeof( MenuItemStyles[ 0 ] );
+
static void ExtractMenuParameters( const Sequence< PropertyValue > rProp,
::rtl::OUString& rCommandURL,
::rtl::OUString& rLabel,
::rtl::OUString& rHelpURL,
Reference< XIndexAccess >& rSubMenu,
- sal_Int16& rType )
+ sal_Int16& rType,
+ sal_Int16& rStyle )
{
for ( sal_Int32 i = 0; i < rProp.getLength(); i++ )
{
@@ -151,6 +173,10 @@ static void ExtractMenuParameters( const Sequence< PropertyValue > rProp,
{
rProp[i].Value >>= rType;
}
+ else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE ))
+ {
+ rProp[i].Value >>= rStyle;
+ }
}
}
@@ -165,7 +191,8 @@ ReadMenuDocumentHandlerBase::ReadMenuDocumentHandlerBase() :
m_aLabel( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL )),
m_aContainer( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER )),
m_aHelpURL( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL )),
- m_aCommandURL( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL ))
+ m_aCommandURL( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL )),
+ m_aStyle( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_STYLE ))
{
}
@@ -207,20 +234,22 @@ throw( SAXException, RuntimeException )
void ReadMenuDocumentHandlerBase::initPropertyCommon(
Sequence< PropertyValue > &rProps, const rtl::OUString &rCommandURL,
- const rtl::OUString &rHelpId, const rtl::OUString &rLabel)
+ const rtl::OUString &rHelpId, const rtl::OUString &rLabel, sal_Int16 nItemStyleBits )
{
rProps[0].Name = m_aCommandURL;
rProps[1].Name = m_aHelpURL;
rProps[2].Name = m_aContainer;
rProps[3].Name = m_aLabel;
- rProps[4].Name = m_aType;
+ rProps[4].Name = m_aStyle;
+ rProps[5].Name = m_aType;
// Common values
rProps[0].Value <<= rCommandURL.intern();
rProps[1].Value <<= rHelpId;
rProps[2].Value <<= Reference< XIndexContainer >();
rProps[3].Value <<= rLabel;
- rProps[4].Value <<= ::com::sun::star::ui::ItemType::DEFAULT;
+ rProps[4].Value <<= nItemStyleBits;
+ rProps[5].Value <<= ::com::sun::star::ui::ItemType::DEFAULT;
}
// -----------------------------------------------------------------------------
@@ -373,6 +402,7 @@ throw( SAXException, RuntimeException )
::rtl::OUString aHelpId;
::rtl::OUString aCommandId;
::rtl::OUString aLabel;
+ sal_Int16 nItemBits(0);
m_bMenuMode = sal_True;
@@ -399,12 +429,29 @@ throw( SAXException, RuntimeException )
aLabel = aValue;
else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_HELPID )))
aHelpId = aValue;
+ else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_STYLE )))
+ {
+ ::rtl::OUString aTemp( aValue );
+ sal_Int32 nIndex = 0;
+ do
+ {
+ ::rtl::OUString aToken = aTemp.getToken( 0, '+', nIndex );
+ if ( aToken.getLength() > 0 )
+ {
+ if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_TEXT ) ) )
+ nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT;
+ if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) )
+ nItemBits |= ::com::sun::star::ui::ItemStyle::ICON;
+ }
+ }
+ while ( nIndex >= 0 );
+ }
}
if ( aCommandId.getLength() > 0 )
{
- Sequence< PropertyValue > aSubMenuProp( 5 );
- initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel );
+ Sequence< PropertyValue > aSubMenuProp( 6 );
+ initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel, nItemBits );
aSubMenuProp[2].Value <<= xSubItemContainer;
m_xMenuBarContainer->insertByIndex( m_xMenuBarContainer->getCount(), makeAny( aSubMenuProp ) );
@@ -589,6 +636,7 @@ throw( SAXException, RuntimeException )
::rtl::OUString aHelpId;
::rtl::OUString aCommandId;
::rtl::OUString aLabel;
+ sal_Int16 nItemBits(0);
m_bMenuMode = sal_True;
@@ -614,12 +662,30 @@ throw( SAXException, RuntimeException )
aLabel = aValue;
else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_HELPID )))
aHelpId = aValue;
+ else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_STYLE )))
+ {
+ ::rtl::OUString aTemp( aValue );
+ sal_Int32 nIndex = 0;
+ do
+ {
+ ::rtl::OUString aToken = aTemp.getToken( 0, '+', nIndex );
+ if ( aToken.getLength() > 0 )
+ {
+ if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_TEXT ) ) )
+ nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT;
+ if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) )
+ nItemBits |= ::com::sun::star::ui::ItemStyle::ICON;
+ }
+ }
+ while ( nIndex >= 0 );
+ }
+
}
if ( aCommandId.getLength() > 0 )
{
- Sequence< PropertyValue > aSubMenuProp( 5 );
- initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel );
+ Sequence< PropertyValue > aSubMenuProp( 6 );
+ initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel, nItemBits );
aSubMenuProp[2].Value <<= xSubItemContainer;
m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), makeAny( aSubMenuProp ) );
@@ -639,7 +705,7 @@ throw( SAXException, RuntimeException )
::rtl::OUString aHelpId;
::rtl::OUString aCommandId;
::rtl::OUString aLabel;
-
+ sal_Int16 nItemBits(0);
// read attributes for menu item
for ( sal_Int16 i=0; i< xAttrList->getLength(); i++ )
{
@@ -651,12 +717,30 @@ throw( SAXException, RuntimeException )
aLabel = aValue;
else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_HELPID )))
aHelpId = aValue;
+ else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_STYLE )))
+ {
+ ::rtl::OUString aTemp( aValue );
+ sal_Int32 nIndex = 0;
+ do
+ {
+ ::rtl::OUString aToken = aTemp.getToken( 0, '+', nIndex );
+ if ( aToken.getLength() > 0 )
+ {
+ if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_TEXT ) ) )
+ nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT;
+ if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) )
+ nItemBits |= ::com::sun::star::ui::ItemStyle::ICON;
+ }
+ }
+ while ( nIndex >= 0 );
+ }
+
}
if ( aCommandId.getLength() > 0 )
{
- Sequence< PropertyValue > aMenuItem( 5 );
- initPropertyCommon( aMenuItem, aCommandId, aHelpId, aLabel );
+ Sequence< PropertyValue > aMenuItem( 6 );
+ initPropertyCommon( aMenuItem, aCommandId, aHelpId, aLabel, nItemBits );
aMenuItem[2].Value <<= Reference< XIndexContainer >();
m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), makeAny( aMenuItem ) );
@@ -809,15 +893,16 @@ throw ( SAXException, RuntimeException )
::rtl::OUString aLabel;
::rtl::OUString aHelpURL;
sal_Int16 nType( ::com::sun::star::ui::ItemType::DEFAULT );
+ sal_Int16 nItemBits( 0 );
Reference< XIndexAccess > xSubMenu;
- ExtractMenuParameters( aProps, aCommandURL, aLabel, aHelpURL, xSubMenu, nType );
+ ExtractMenuParameters( aProps, aCommandURL, aLabel, aHelpURL, xSubMenu, nType, nItemBits );
if ( xSubMenu.is() )
{
if ( aCommandURL.equalsAscii( ADDDIRECT_CMD ) ||
aCommandURL.equalsAscii( AUTOPILOTMENU_CMD ))
{
- WriteMenuItem( aCommandURL, aLabel, aHelpURL );
+ WriteMenuItem( aCommandURL, aLabel, aHelpURL, nItemBits );
bSeparator = sal_False;
}
else if (( aCommandURL.getLength() > 0 ) && !AddonPopupMenu::IsCommandURLPrefix ( aCommandURL ))
@@ -857,7 +942,7 @@ throw ( SAXException, RuntimeException )
if ( aCommandURL.getLength() > 0 )
{
bSeparator = FALSE;
- WriteMenuItem( aCommandURL, aLabel, aHelpURL );
+ WriteMenuItem( aCommandURL, aLabel, aHelpURL, nItemBits );
}
}
else if ( !bSeparator )
@@ -872,7 +957,7 @@ throw ( SAXException, RuntimeException )
}
-void OWriteMenuDocumentHandler::WriteMenuItem( const ::rtl::OUString& aCommandURL, const ::rtl::OUString& aLabel, const ::rtl::OUString& aHelpURL)
+void OWriteMenuDocumentHandler::WriteMenuItem( const ::rtl::OUString& aCommandURL, const ::rtl::OUString& aLabel, const ::rtl::OUString& aHelpURL, sal_Int16 nStyle )
{
::comphelper::AttributeList* pList = new ::comphelper::AttributeList;
Reference< XAttributeList > xList( (XAttributeList *) pList , UNO_QUERY );
@@ -894,6 +979,24 @@ void OWriteMenuDocumentHandler::WriteMenuItem( const ::rtl::OUString& aCommandUR
m_aAttributeType,
aLabel );
}
+ if (( nStyle > 0 ) && !( aCommandURL.copy( CMD_PROTOCOL_SIZE ).equalsAscii( CMD_PROTOCOL )))
+ {
+ rtl::OUString aValue;
+ MenuStyleItem* pStyle = MenuItemStyles;
+
+ for ( sal_Int32 nIndex = 0; nIndex < nMenuStyleItemEntries; ++nIndex, ++pStyle )
+ {
+ if ( nStyle & pStyle->nBit )
+ {
+ if ( aValue.getLength() )
+ aValue = aValue.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("+") ) );
+ aValue += rtl::OUString::createFromAscii( pStyle->attrName );
+ }
+ }
+ pList->AddAttribute( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_NS_STYLE )),
+ m_aAttributeType,
+ aValue );
+ }
m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() );
m_xWriteDocumentHandler->startElement( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENUITEM )), xList );
diff --git a/framework/source/xml/toolboxdocumenthandler.cxx b/framework/source/xml/toolboxdocumenthandler.cxx
index 78d6f8158413..ba01284accdb 100644
--- a/framework/source/xml/toolboxdocumenthandler.cxx
+++ b/framework/source/xml/toolboxdocumenthandler.cxx
@@ -79,6 +79,7 @@ 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";
@@ -89,6 +90,8 @@ static void ExtractToolbarParameters( const Sequence< PropertyValue > rProp,
::rtl::OUString& rCommandURL,
::rtl::OUString& rLabel,
::rtl::OUString& rHelpURL,
+ ::rtl::OUString& rTooltip,
+ sal_Int16& rStyle,
sal_Int16& rWidth,
sal_Bool& rVisible,
sal_Int16& rType )
@@ -102,6 +105,8 @@ static void ExtractToolbarParameters( const Sequence< PropertyValue > rProp,
}
else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL ))
rProp[i].Value >>= rHelpURL;
+ else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_TOOLTIP ))
+ rProp[i].Value >>= rTooltip;
else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ))
rProp[i].Value >>= rLabel;
else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_TYPE ))
@@ -110,9 +115,30 @@ static void ExtractToolbarParameters( const Sequence< PropertyValue > rProp,
rProp[i].Value >>= rVisible;
else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_WIDTH ))
rProp[i].Value >>= rWidth;
+ else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE ))
+ rProp[i].Value >>= rStyle;
}
}
+struct ToolboxStyleItem
+{
+ sal_Int16 nBit;
+ const char* attrName;
+};
+
+ToolboxStyleItem Styles[ ] = {
+ { ::com::sun::star::ui::ItemStyle::RADIO_CHECK, ATTRIBUTE_ITEMSTYLE_RADIO },
+ { ::com::sun::star::ui::ItemStyle::ALIGN_LEFT, ATTRIBUTE_ITEMSTYLE_LEFT },
+ { ::com::sun::star::ui::ItemStyle::AUTO_SIZE, ATTRIBUTE_ITEMSTYLE_AUTO },
+ { ::com::sun::star::ui::ItemStyle::REPEAT, ATTRIBUTE_ITEMSTYLE_REPEAT },
+ { ::com::sun::star::ui::ItemStyle::DROPDOWN_ONLY, ATTRIBUTE_ITEMSTYLE_DROPDOWNONLY },
+ { ::com::sun::star::ui::ItemStyle::DROP_DOWN, ATTRIBUTE_ITEMSTYLE_DROPDOWN },
+ { ::com::sun::star::ui::ItemStyle::ICON, ATTRIBUTE_ITEMSTYLE_IMAGE },
+ { ::com::sun::star::ui::ItemStyle::TEXT, ATTRIBUTE_ITEMSTYLE_TEXT },
+};
+
+sal_Int32 nStyleItemEntries = sizeof( Styles ) / sizeof( Styles[ 0 ] );
+
struct ToolBarEntryProperty
{
OReadToolBoxDocumentHandler::ToolBox_XML_Namespace nNamespace;
@@ -135,7 +161,8 @@ ToolBarEntryProperty ToolBoxEntries[OReadToolBoxDocumentHandler::TB_XML_ENTRY_CO
{ OReadToolBoxDocumentHandler::TB_NS_TOOLBAR, ATTRIBUTE_USER },
{ OReadToolBoxDocumentHandler::TB_NS_TOOLBAR, ATTRIBUTE_HELPID },
{ OReadToolBoxDocumentHandler::TB_NS_TOOLBAR, ATTRIBUTE_ITEMSTYLE },
- { OReadToolBoxDocumentHandler::TB_NS_TOOLBAR, ATTRIBUTE_UINAME }
+ { OReadToolBoxDocumentHandler::TB_NS_TOOLBAR, ATTRIBUTE_UINAME },
+ { OReadToolBoxDocumentHandler::TB_NS_TOOLBAR, ATTRIBUTE_TOOLTIP },
};
OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XIndexContainer >& rItemContainer ) :
@@ -145,6 +172,7 @@ OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XInde
m_aLabel( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL )),
m_aStyle( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_STYLE )),
m_aHelpURL( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL )),
+ m_aTooltip( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TOOLTIP )),
m_aIsVisible( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_VISIBLE )),
m_aCommandURL( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL ))
{
@@ -179,6 +207,8 @@ OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XInde
m_nHashCode_Style_DropDown = ::rtl::OUString::createFromAscii( ATTRIBUTE_ITEMSTYLE_DROPDOWN ).hashCode();
m_nHashCode_Style_Repeat = ::rtl::OUString::createFromAscii( ATTRIBUTE_ITEMSTYLE_REPEAT ).hashCode();
m_nHashCode_Style_DropDownOnly = ::rtl::OUString::createFromAscii( ATTRIBUTE_ITEMSTYLE_DROPDOWNONLY ).hashCode();
+ m_nHashCode_Style_Text = ::rtl::OUString::createFromAscii( ATTRIBUTE_ITEMSTYLE_TEXT ).hashCode();
+ m_nHashCode_Style_Image = ::rtl::OUString::createFromAscii( ATTRIBUTE_ITEMSTYLE_IMAGE ).hashCode();
m_bToolBarStartFound = sal_False;
m_bToolBarEndFound = sal_False;
@@ -298,6 +328,7 @@ throw( SAXException, RuntimeException )
::rtl::OUString aLabel;
::rtl::OUString aCommandURL;
::rtl::OUString aHelpURL;
+ ::rtl::OUString aTooltip;
::rtl::OUString aBitmapName;
sal_uInt16 nItemBits( 0 );
sal_uInt16 nWidth( 0 );
@@ -369,6 +400,12 @@ throw( SAXException, RuntimeException )
}
break;
+ case TB_ATTRIBUTE_TOOLTIP:
+ {
+ aTooltip = xAttribs->getValueByIndex( n );
+ }
+ break;
+
case TB_ATTRIBUTE_STYLE:
{
// read space seperated item style list
@@ -393,6 +430,12 @@ throw( SAXException, RuntimeException )
nItemBits |= ::com::sun::star::ui::ItemStyle::REPEAT;
else if ( nHashCode == m_nHashCode_Style_DropDownOnly )
nItemBits |= ::com::sun::star::ui::ItemStyle::DROPDOWN_ONLY;
+ else if ( nHashCode == m_nHashCode_Style_DropDown )
+ nItemBits |= ::com::sun::star::ui::ItemStyle::DROP_DOWN;
+ else if ( nHashCode == m_nHashCode_Style_Text )
+ nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT;
+ else if ( nHashCode == m_nHashCode_Style_Image )
+ nItemBits |= ::com::sun::star::ui::ItemStyle::ICON;
}
}
while ( nIndex >= 0 );
@@ -414,13 +457,14 @@ throw( SAXException, RuntimeException )
if ( aCommandURL.getLength() > 0 )
{
- Sequence< PropertyValue > aToolbarItemProp( 6 );
+ Sequence< PropertyValue > aToolbarItemProp( 7 );
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;
aToolbarItemProp[0].Value <<= aCommandURL;
aToolbarItemProp[1].Value <<= aHelpURL;
@@ -428,6 +472,7 @@ throw( SAXException, RuntimeException )
aToolbarItemProp[3].Value = makeAny( ::com::sun::star::ui::ItemType::DEFAULT );
aToolbarItemProp[4].Value <<= nItemBits;
aToolbarItemProp[5].Value <<= bVisible;
+ aToolbarItemProp[6].Value <<= aTooltip;
m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
}
@@ -718,13 +763,15 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxDocument() throw
::rtl::OUString aCommandURL;
::rtl::OUString aLabel;
::rtl::OUString aHelpURL;
+ ::rtl::OUString aTooltip;
sal_Bool bVisible( sal_True );
sal_Int16 nType( ::com::sun::star::ui::ItemType::DEFAULT );
sal_Int16 nWidth( 0 );
+ sal_Int16 nStyle( 0 );
- ExtractToolbarParameters( aProps, aCommandURL, aLabel, aHelpURL, nWidth, bVisible, nType );
+ ExtractToolbarParameters( aProps, aCommandURL, aLabel, aHelpURL, aTooltip, nStyle, nWidth, bVisible, nType );
if ( nType == ::com::sun::star::ui::ItemType::DEFAULT )
- WriteToolBoxItem( aCommandURL, aLabel, aHelpURL, nWidth, bVisible );
+ WriteToolBoxItem( aCommandURL, aLabel, aHelpURL, aTooltip, nStyle, nWidth, bVisible );
else if ( nType == ::com::sun::star::ui::ItemType::SEPARATOR_SPACE )
WriteToolBoxSpace();
else if ( nType == ::com::sun::star::ui::ItemType::SEPARATOR_LINE )
@@ -748,6 +795,8 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxItem(
const ::rtl::OUString& rCommandURL,
const ::rtl::OUString& rLabel,
const ::rtl::OUString& rHelpURL,
+ const ::rtl::OUString& rTooltip,
+ sal_Int16 nStyle,
sal_Int16 nWidth,
sal_Bool bVisible )
throw ( SAXException, RuntimeException )
@@ -785,6 +834,32 @@ throw ( SAXException, RuntimeException )
rHelpURL );
}
+ if ( rTooltip.getLength() > 0 )
+ {
+ pList->AddAttribute( m_aXMLToolbarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_TOOLTIP )),
+ m_aAttributeType,
+ rTooltip );
+ }
+
+ if ( nStyle > 0 )
+ {
+ rtl::OUString aValue;
+ ToolboxStyleItem* pStyle = Styles;
+
+ for ( sal_Int32 nIndex = 0; nIndex < nStyleItemEntries; ++nIndex, ++pStyle )
+ {
+ if ( nStyle & pStyle->nBit )
+ {
+ if ( aValue.getLength() )
+ aValue = aValue.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" ") ) );
+ aValue += rtl::OUString::createFromAscii( pStyle->attrName );
+ }
+ }
+ pList->AddAttribute( m_aXMLToolbarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_ITEMSTYLE )),
+ m_aAttributeType,
+ aValue );
+ }
+
if ( nWidth > 0 )
{
pList->AddAttribute( m_aXMLToolbarNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_WIDTH )),