summaryrefslogtreecommitdiff
path: root/cui/source/customize/cfg.cxx
diff options
context:
space:
mode:
authorXiaofei Zhang <Zhangxiaofei@openoffice.org>2010-11-10 13:50:33 +0800
committerXiaofei Zhang <Zhangxiaofei@openoffice.org>2010-11-10 13:50:33 +0800
commitecf66d8aa3b1792e53d8b691a7b679fd47133ac9 (patch)
tree3e08d97c782594c74bc2e88c552150f71e016e5e /cui/source/customize/cfg.cxx
parent16ae4c1524769458f6d205430e7dcb8fc4ae333b (diff)
parent8373a5b7946d6731609f989f1aa4a762ed70854a (diff)
removetooltypes01: #i112600# resync to DEV300_m92; remove tooltypes from xmloff, linguistic, vcl, svtools, accessibility, fpicker, uui and framework
Diffstat (limited to 'cui/source/customize/cfg.cxx')
-rw-r--r--cui/source/customize/cfg.cxx335
1 files changed, 29 insertions, 306 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index d9f730e0224f..a2ee0d977f67 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -112,7 +112,6 @@
#define ENTRY_HEIGHT 16
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";
@@ -144,6 +143,8 @@ namespace container = com::sun::star::container;
namespace beans = com::sun::star::beans;
namespace graphic = com::sun::star::graphic;
+#if OSL_DEBUG_LEVEL > 1
+
void printPropertySet(
const OUString& prefix,
const uno::Reference< beans::XPropertySet >& xPropSet )
@@ -208,6 +209,8 @@ void printEntries(SvxEntries* entries)
}
}
+#endif
+
OUString
stripHotKey( const OUString& str )
{
@@ -518,7 +521,6 @@ bool GetMenuItemData(
const uno::Reference< container::XIndexAccess >& rItemContainer,
sal_Int32 nIndex,
OUString& rCommandURL,
- OUString& rHelpURL,
OUString& rLabel,
sal_uInt16& rType,
uno::Reference< container::XIndexAccess >& rSubMenu )
@@ -534,10 +536,6 @@ bool GetMenuItemData(
{
aProp[i].Value >>= rCommandURL;
}
- else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL ))
- {
- aProp[i].Value >>= rHelpURL;
- }
else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_CONTAINER ))
{
aProp[i].Value >>= rSubMenu;
@@ -566,7 +564,6 @@ bool GetToolbarItemData(
const uno::Reference< container::XIndexAccess >& rItemContainer,
sal_Int32 nIndex,
OUString& rCommandURL,
- OUString& rHelpURL,
OUString& rLabel,
sal_uInt16& rType,
sal_Bool& rIsVisible,
@@ -588,10 +585,6 @@ bool GetToolbarItemData(
{
aProp[i].Value >>= rStyle;
}
- else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL ))
- {
- aProp[i].Value >>= rHelpURL;
- }
else if (aProp[i].Name.equalsAscii(ITEM_DESCRIPTOR_CONTAINER))
{
aProp[i].Value >>= rSubMenu;
@@ -634,13 +627,10 @@ ConvertSvxConfigEntry(
static const OUString aDescriptorLabel(
RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL ) );
- static const OUString aDescriptorHelpURL(
- RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL ) );
-
static const OUString aDescriptorContainer(
RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER ) );
- uno::Sequence< beans::PropertyValue > aPropSeq( 4 );
+ uno::Sequence< beans::PropertyValue > aPropSeq( 3 );
aPropSeq[0].Name = aDescriptorCommandURL;
aPropSeq[0].Value <<= rtl::OUString( pEntry->GetCommand() );
@@ -698,9 +688,6 @@ ConvertSvxConfigEntry(
aPropSeq[2].Value <<= rtl::OUString( pEntry->GetName() );
}
- aPropSeq[3].Name = aDescriptorHelpURL;
- aPropSeq[3].Value <<= rtl::OUString( pEntry->GetHelpURL() );
-
return aPropSeq;
}
@@ -718,16 +705,13 @@ ConvertToolbarEntry(
static const OUString aDescriptorLabel(
RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL ) );
- static const OUString aDescriptorHelpURL(
- RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL ) );
-
static const OUString aDescriptorContainer(
RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER ) );
static const OUString aIsVisible(
RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_ISVISIBLE ) );
- uno::Sequence< beans::PropertyValue > aPropSeq( 5 );
+ uno::Sequence< beans::PropertyValue > aPropSeq( 4 );
aPropSeq[0].Name = aDescriptorCommandURL;
aPropSeq[0].Value <<= rtl::OUString( pEntry->GetCommand() );
@@ -785,11 +769,8 @@ ConvertToolbarEntry(
aPropSeq[2].Value <<= rtl::OUString( pEntry->GetName() );
}
- aPropSeq[3].Name = aDescriptorHelpURL;
- aPropSeq[3].Value <<= rtl::OUString( pEntry->GetHelpURL() );
-
- aPropSeq[4].Name = aIsVisible;
- aPropSeq[4].Value <<= pEntry->IsVisible();
+ aPropSeq[3].Name = aIsVisible;
+ aPropSeq[3].Value <<= pEntry->IsVisible();
return aPropSeq;
}
@@ -918,11 +899,6 @@ void SvxConfigDialog::PageCreated( USHORT nId, SfxTabPage& rPage )
}
}
-void SvxConfigDialog::ActivateTabPage( USHORT nSlotId )
-{
- (void)nSlotId;
-}
-
/******************************************************************************
*
* The SaveInData class is used to hold data for entries in the Save In
@@ -1177,20 +1153,23 @@ bool MenuSaveInData::LoadSubMenus(
const OUString& rBaseTitle,
SvxConfigEntry* pParentData )
{
- SvxEntries* pEntries = pParentData->GetEntries();
+ SvxEntries* pEntries = pParentData->GetEntries();
+
+ // Don't access non existing menu configuration!
+ if ( !xMenuSettings.is() )
+ return true;
for ( sal_Int32 nIndex = 0; nIndex < xMenuSettings->getCount(); nIndex++ )
{
uno::Reference< container::XIndexAccess > xSubMenu;
OUString aCommandURL;
- OUString aHelpURL;
OUString aLabel;
bool bIsUserDefined = TRUE;
sal_uInt16 nType( css::ui::ItemType::DEFAULT );
bool bItem = GetMenuItemData( xMenuSettings, nIndex,
- aCommandURL, aHelpURL, aLabel, nType, xSubMenu );
+ aCommandURL, aLabel, nType, xSubMenu );
if ( bItem )
{
@@ -1232,7 +1211,6 @@ bool MenuSaveInData::LoadSubMenus(
aLabel, aCommandURL, TRUE );
pEntry->SetUserDefined( bIsUserDefined );
- pEntry->SetHelpURL( aHelpURL );
pEntries->push_back( pEntry );
@@ -1257,7 +1235,6 @@ bool MenuSaveInData::LoadSubMenus(
SvxConfigEntry* pEntry = new SvxConfigEntry(
aLabel, aCommandURL, FALSE );
pEntry->SetUserDefined( bIsUserDefined );
- pEntry->SetHelpURL( aHelpURL );
pEntries->push_back( pEntry );
}
}
@@ -2154,7 +2131,6 @@ SvLBoxEntry* SvxConfigPage::AddFunction(
SvxConfigEntry* pNewEntryData =
new SvxConfigEntry( aDisplayName, aURL, FALSE );
pNewEntryData->SetUserDefined( TRUE );
- pNewEntryData->SetHelpURL( aURL );
// check that this function is not already in the menu
SvxConfigEntry* pParent = GetTopLevelSelection();
@@ -2594,17 +2570,20 @@ IMPL_LINK( SvxMenuConfigPage, SelectMenu, ListBox *, pBox )
SvxConfigEntry* pMenuData = GetTopLevelSelection();
PopupMenu* pPopup = aModifyTopLevelButton.GetPopupMenu();
- pPopup->EnableItem( ID_DELETE, pMenuData->IsDeletable() );
- pPopup->EnableItem( ID_RENAME, pMenuData->IsRenamable() );
- pPopup->EnableItem( ID_MOVE, pMenuData->IsMovable() );
+ if ( pMenuData )
+ {
+ pPopup->EnableItem( ID_DELETE, pMenuData->IsDeletable() );
+ pPopup->EnableItem( ID_RENAME, pMenuData->IsRenamable() );
+ pPopup->EnableItem( ID_MOVE, pMenuData->IsMovable() );
- SvxEntries* pEntries = pMenuData->GetEntries();
- SvxEntries::const_iterator iter = pEntries->begin();
+ SvxEntries* pEntries = pMenuData->GetEntries();
+ SvxEntries::const_iterator iter = pEntries->begin();
- for ( ; iter != pEntries->end(); iter++ )
- {
- SvxConfigEntry* pEntry = *iter;
- InsertEntryIntoUI( pEntry );
+ for ( ; iter != pEntries->end(); iter++ )
+ {
+ SvxConfigEntry* pEntry = *iter;
+ InsertEntryIntoUI( pEntry );
+ }
}
UpdateButtonStates();
@@ -3055,228 +3034,20 @@ SvxConfigEntry* SvxMainMenuOrganizerDialog::GetSelectedEntry()
return (SvxConfigEntry*)aMenuListBox.FirstSelected()->GetUserData();
}
-SvxConfigEntry::SvxConfigEntry(
- const uno::Sequence< beans::PropertyValue >& rProperties,
- const uno::Reference< container::XNameAccess >& rCommandToLabelMap )
- :
- nId( 1 ),
- bPopUp( FALSE ),
- bStrEdited( FALSE ),
- bIsUserDefined( FALSE ),
- bIsMain( FALSE ),
- bIsParentData( FALSE ),
- bIsVisible( TRUE ),
- nStyle( 0 ),
- pEntries( 0 )
-{
- sal_uInt16 nType( css::ui::ItemType::DEFAULT );
- OUString aHelpURL_;
-
- for ( sal_Int32 i = 0; i < rProperties.getLength(); i++ )
- {
- if ( rProperties[i].Name.equalsAscii( ITEM_DESCRIPTOR_COMMANDURL ))
- {
- rProperties[i].Value >>= aCommand;
- }
- else if ( rProperties[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL ))
- {
- rProperties[i].Value >>= aHelpURL_;
- }
- else if ( rProperties[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ))
- {
- rProperties[i].Value >>= aLabel;
- }
- else if ( rProperties[i].Name.equalsAscii( ITEM_DESCRIPTOR_TYPE ))
- {
- rProperties[i].Value >>= nType;
- }
- }
-
- if ( nType == css::ui::ItemType::DEFAULT )
- {
- uno::Any a;
- try
- {
- a = rCommandToLabelMap->getByName( aCommand );
- bIsUserDefined = FALSE;
- }
- catch ( container::NoSuchElementException& )
- {
- bIsUserDefined = TRUE;
- }
-
- // If custom label not set retrieve it from the command to info service
- if ( aLabel.equals( OUString() ) )
- {
- uno::Sequence< beans::PropertyValue > aPropSeq;
- if ( a >>= aPropSeq )
- {
- for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
- {
- if ( aPropSeq[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ) )
- {
- aPropSeq[i].Value >>= aLabel;
- break;
- }
- }
- }
- }
- }
-}
-
const OUString&
SvxConfigEntry::GetHelpText()
{
if ( aHelpText.getLength() == 0 )
{
- OUString helpid = OUString::createFromAscii( "helpid:" );
- if ( aHelpURL.indexOf( helpid ) != -1 )
- {
- aHelpURL = aHelpURL.copy( helpid.getLength() );
- }
-
- Help* pHelp = Application::GetHelp();
- if ( aHelpURL.toInt32() != 0 )
- {
- aHelpText = pHelp->GetHelpText( aHelpURL.toInt32(), NULL );
- }
-
- if ( aHelpText.getLength() == 0 && aCommand.getLength() != 0 )
+ if ( aCommand.getLength() )
{
- aHelpText = pHelp->GetHelpText( aCommand, NULL );
+ aHelpText = Application::GetHelp()->GetHelpText( aCommand, NULL );
}
}
return aHelpText;
}
-uno::Sequence< beans::PropertyValue >
-SvxConfigEntry::GetProperties(
- const uno::Reference< container::XNameAccess >& rCommandToLabelMap )
-{
- if ( IsSeparator() )
- {
- uno::Sequence< beans::PropertyValue > aPropSeq( 1 );
-
- aPropSeq[0].Name = OUString(
- RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE ) );
- aPropSeq[0].Value <<= css::ui::ItemType::SEPARATOR_LINE;
-
- return aPropSeq;
- }
-
- static const OUString aDescriptorCommandURL (
- RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL ) );
-
- static const OUString aDescriptorType(
- RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE ) );
-
- static const OUString aDescriptorLabel(
- RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL ) );
-
- static const OUString aDescriptorHelpURL(
- RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_HELPURL ) );
-
- uno::Sequence< beans::PropertyValue > aPropSeq( 4 );
-
- aPropSeq[0].Name = aDescriptorCommandURL;
- aPropSeq[0].Value <<= rtl::OUString( GetCommand() );
-
- aPropSeq[1].Name = aDescriptorType;
- aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
-
- // If the name has not been changed and the name is the same as
- // in the default command to label map then the label can be stored
- // as an empty string.
- // It will be initialised again later using the command to label map.
- aPropSeq[2].Name = aDescriptorLabel;
- if ( HasChangedName() == FALSE && GetCommand().getLength() )
- {
- BOOL isDefaultName = FALSE;
- try
- {
- uno::Any a( rCommandToLabelMap->getByName( GetCommand() ) );
- uno::Sequence< beans::PropertyValue > tmpPropSeq;
- if ( a >>= tmpPropSeq )
- {
- for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); i++ )
- {
- if ( tmpPropSeq[i].Name.equals( aDescriptorLabel ) )
- {
- OUString tmpLabel;
- tmpPropSeq[i].Value >>= tmpLabel;
-
- if ( tmpLabel.equals( GetName() ) )
- {
- isDefaultName = TRUE;
- }
-
- break;
- }
- }
- }
- }
- catch ( container::NoSuchElementException& )
- {
- // isDefaultName is left as FALSE
- }
-
- if ( isDefaultName )
- {
- aPropSeq[2].Value <<= rtl::OUString();
- }
- else
- {
- aPropSeq[2].Value <<= rtl::OUString( GetName() );
- }
- }
- else
- {
- aPropSeq[2].Value <<= rtl::OUString( GetName() );
- }
-
- aPropSeq[3].Name = aDescriptorHelpURL;
- aPropSeq[3].Value <<= rtl::OUString( GetHelpURL() );
-
- return aPropSeq;
-}
-
-/*
-SvxMenuConfigEntry::SvxMenuConfigEntry(
- const uno::Sequence< beans::PropertyValue >& rProperties,
- const uno::Reference< container::XNameAccess >& rCommandToLabelMap )
- :
- SvxConfigEntry( rProperties, rCommandToLabelMap )
-{
- uno::Reference< container::XIndexAccess > aChildren;
-
- for ( sal_Int32 i = 0; i < rProperties.getLength(); i++ )
- {
- if ( rProperties[i].Name.equalsAscii( ITEM_DESCRIPTOR_CONTAINER ))
- {
- rProperties[i].Value >>= aChildren;
- }
- }
-
- if ( aChildren.is() )
- {
- SetPopup( TRUE );
- SetEntries( new SvxEntries() );
-
- uno::Sequence< beans::PropertyValue > aProps;
- for ( sal_Int32 i = 0; i < aChildren->getCount(); i++ )
- {
- if ( aChildren->getByIndex( i ) >>= aProps )
- {
- SvxConfigEntry* pEntry =
- new SvxMenuConfigEntry( aProps, rCommandToLabelMap );
- GetEntries()->push_back( pEntry );
- }
- }
- }
-}
-*/
-
SvxConfigEntry::SvxConfigEntry( const OUString& rDisplayName,
const OUString& rCommandURL, bool bPopup, bool bParentData )
: nId( 1 )
@@ -4695,51 +4466,6 @@ void ToolbarSaveInData::RestoreToolbar( SvxConfigEntry* pToolbar )
}
}
-void ToolbarSaveInData::ReloadToolbar( const OUString& rResourceURL )
-{
- SvxEntries::const_iterator iter = GetEntries()->begin();
- SvxConfigEntry* pToolbar = NULL;
-
- for ( ; iter != GetEntries()->end(); iter++ )
- {
- SvxConfigEntry* pEntry = *iter;
-
- if ( pEntry->GetCommand().equals( rResourceURL ) )
- {
- pToolbar = pEntry;
- break;
- }
- }
-
- if ( pToolbar != NULL )
- {
- delete pToolbar->GetEntries();
-
- try
- {
- uno::Reference< container::XIndexAccess > xToolbarSettings;
-
- if ( pToolbar->IsParentData() )
- {
- xToolbarSettings = GetParentConfigManager()->getSettings(
- pToolbar->GetCommand(), sal_False);
- }
- else
- {
- xToolbarSettings = GetConfigManager()->getSettings(
- pToolbar->GetCommand(), sal_False);
- }
-
- LoadToolbar( xToolbarSettings, pToolbar );
- }
- catch ( container::NoSuchElementException& )
- {
- // toolbar not found for some reason
- // it will not appear in the toolbar list
- }
- }
-}
-
bool ToolbarSaveInData::LoadToolbar(
const uno::Reference< container::XIndexAccess >& xToolbarSettings,
SvxConfigEntry* pParentData )
@@ -4750,7 +4476,6 @@ bool ToolbarSaveInData::LoadToolbar(
{
uno::Reference< container::XIndexAccess > xSubMenu;
OUString aCommandURL;
- OUString aHelpURL;
OUString aLabel;
bool bIsUserDefined = TRUE;
sal_Bool bIsVisible;
@@ -4759,7 +4484,7 @@ bool ToolbarSaveInData::LoadToolbar(
sal_uInt16 nType( css::ui::ItemType::DEFAULT );
bool bItem = GetToolbarItemData( xToolbarSettings, nIndex, aCommandURL,
- aHelpURL, aLabel, nType, bIsVisible, nStyle, xSubMenu );
+ aLabel, nType, bIsVisible, nStyle, xSubMenu );
if ( bItem )
{
@@ -4800,7 +4525,6 @@ bool ToolbarSaveInData::LoadToolbar(
aLabel, aCommandURL, TRUE );
pEntry->SetUserDefined( bIsUserDefined );
- pEntry->SetHelpURL( aHelpURL );
pEntry->SetVisible( bIsVisible );
pEntries->push_back( pEntry );
@@ -4812,7 +4536,6 @@ bool ToolbarSaveInData::LoadToolbar(
SvxConfigEntry* pEntry = new SvxConfigEntry(
aLabel, aCommandURL, FALSE );
pEntry->SetUserDefined( bIsUserDefined );
- pEntry->SetHelpURL( aHelpURL );
pEntry->SetVisible( bIsVisible );
pEntry->SetStyle( nStyle );
pEntries->push_back( pEntry );