Liang Weike schrieb: > Hello Carsten, > > I've carried on an investigation in AddonsToolBarManager and > AddonsOptions. And I've written the new method whose several lines are > as follows: > void ToolBarManager::QueryAddonsImage() > { > ... > for ( USHORT nPos = 0; nPos < m_pToolBar->GetItemCount(); nPos++ ) > { > m_bIsHiContrast = > m_pToolBar->GetSettings().GetStyleSettings().GetFaceColor().IsDark(); > sal_Bool bBigImages( SvtMiscOptions().AreCurrentSymbolsLarge() ); > ... > USHORT nId( m_pToolBar->GetItemId( nPos ) ); > if ( nId > 0 ) > { > OUString aURL = m_pToolBar->GetItemCommand( nId ); > Image aImage = framework::AddonsOptions().GetImageFromURL( aURL, > bBigImages, m_bIsHiContrast ); > m_pToolBar->SetItemImage( nId, aImage ); > } > } > ... > } > > After it was compiled OOo's toolbar became confused, but the Addons' > icon appeared. I assume the other items of toolbar were set again, > however, I couldn't make clear how to get the ID of Addons and its URL. > So could you give me some more hints and tell me the mistakes in the > above lines of method? Hi Liang Weike,
Your code is OK to look for add-on images for the whole toolbar, but I think it's not good for the current ToolBarManager implementation. The current code works completely different and therefore you have to adjust your QueryAddonsImage code. There are two methods which are responsible to query for images: - ToolBarManager::RefreshImages() This method is used to update the images at runtime. - ToolBarManager::RequestImages() This method is used for the first image initialization. It has to do some bookkeeping to store the image source. Both methods must be extended to also use your new method. They use a loop to retrieve an image for every toolbar button. Therefore you have to change your method so it can be used for a single command URL. Something like Image ToolBarManager::QueryAddonImage( const ::rtl::OUString& aCommandURL, bool bBigImages, bool bHiContrast ) { ... } Regards, Carsten --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]