diff options
-rw-r--r-- | cui/source/dialogs/SpellDialog.cxx | 15 | ||||
-rw-r--r-- | editeng/source/editeng/editview.cxx | 22 | ||||
-rw-r--r-- | include/vcl/image.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/menu/mnumgr.cxx | 23 | ||||
-rw-r--r-- | sw/source/ui/lingu/olmenu.cxx | 22 | ||||
-rw-r--r-- | vcl/source/gdi/image.cxx | 16 |
6 files changed, 23 insertions, 76 deletions
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 0686caf04833..d32a172249c5 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -802,19 +802,6 @@ void SpellDialog::SetLanguage( sal_uInt16 nLang ) m_pLanguageLB->SelectLanguage( nLang ); } -static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) -{ - Image aRes; - OUString aTmp; - osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); - Graphic aGraphic; - const OUString aFilterName( IMP_PNG ); - if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic ) ) - { - aRes = Image( aGraphic.GetBitmapEx() ); - } - return aRes; -} void SpellDialog::SetTitle_Impl(LanguageType nLang) { OUString sTitle = rParent.HasGrammarChecking() ? m_sTitleSpellingGrammar : m_sTitleSpelling; @@ -876,7 +863,7 @@ int SpellDialog::InitUserDicts() xSvcInfo->getImplementationName()) ); if (!aDictionaryImageUrl.isEmpty()) { - Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) ); + Image aImage( aDictionaryImageUrl ); pMenu->SetItemImage( nItemId, aImage ); } } diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 8f331c80d209..18b0c9a15686 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -862,26 +862,6 @@ sal_Bool EditView::IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMa return pImpEditView->IsWrongSpelledWord( aPaM , bMarkIfWrong ); } - -static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) -{ - Image aRes; - OUString aTmp; - osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); -// OString aPath = OString( aTmp.getStr(), aTmp.getLength(), osl_getThreadTextEncoding() ); -#if defined(WNT) -// aTmp = lcl_Win_GetShortPathName( aTmp ); -#endif - Graphic aGraphic; - const OUString aFilterName( IMP_PNG ); - if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic ) ) - { - aRes = Image( aGraphic.GetBitmapEx() ); - } - return aRes; -} - - void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) { DBG_CHKTHIS( EditView, 0 ); @@ -1036,7 +1016,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) xSvcInfo->getImplementationName()) ); if (!aDictionaryImageUrl.isEmpty() ) { - Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) ); + Image aImage( aDictionaryImageUrl ); pInsertMenu->SetItemImage( nPos, aImage ); } } diff --git a/include/vcl/image.hxx b/include/vcl/image.hxx index dc027f493a7f..f7b34e7d850f 100644 --- a/include/vcl/image.hxx +++ b/include/vcl/image.hxx @@ -58,6 +58,7 @@ public: Image( const Bitmap& rBitmap, const Bitmap& rMaskBitmap ); Image( const Bitmap& rBitmap, const Color& rColor ); Image( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic ); + Image( const OUString &rFileUrl ); ~Image(); Size GetSizePixel() const; diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx index 23c917c9ebac..344834ae78e0 100644 --- a/sfx2/source/menu/mnumgr.cxx +++ b/sfx2/source/menu/mnumgr.cxx @@ -128,27 +128,6 @@ void InsertVerbs_Impl( SfxBindings* pBindings, const com::sun::star::uno::Sequen } } - -//-------------------------------------------------------------------- - - -static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) -{ - Image aRes; - - OUString aTmp; - osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); - - Graphic aGraphic; - const OUString aFilterName( IMP_PNG ); - if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic ) ) - { - aRes = Image( aGraphic.GetBitmapEx() ); - } - return aRes; -} - - PopupMenu* InsertThesaurusSubmenu_Impl( SfxBindings* pBindings, Menu* pSVMenu ) { @@ -188,7 +167,7 @@ PopupMenu* InsertThesaurusSubmenu_Impl( SfxBindings* pBindings, Menu* pSVMenu ) OUString sThesImplName( aHelper.GetThesImplName( aLocale ) ); OUString aSynonymsImageUrl( aCfg.GetSynonymsContextImage( sThesImplName ) ); if (!sThesImplName.isEmpty() && !aSynonymsImageUrl.isEmpty()) - aImage = Image( lcl_GetImageFromPngUrl( aSynonymsImageUrl ) ); + aImage = Image( aSynonymsImageUrl ); for (sal_uInt16 i = 0; (size_t)i < nNumSynonyms; ++i) { diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 45378966c308..4e8cfd5da4de 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -228,22 +228,6 @@ void SwSpellPopup::fillLangPopupMenu( pPopupMenu->InsertItem( nLangItemIdStart + MN_MORE_OFFSET, OUString(SW_RES( STR_LANGSTATUS_MORE )), 0 ); } - -static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) -{ - Image aRes; - OUString aTmp; - osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); - Graphic aGraphic; - const OUString aFilterName( IMP_PNG ); - if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic ) ) - { - aRes = Image( aGraphic.GetBitmapEx() ); - } - return aRes; -} - - OUString RetrieveLabelFromCommand( const OUString& aCmdURL ) { OUString aLabel; @@ -322,7 +306,7 @@ SwSpellPopup::SwSpellPopup( if (xNamed.is()) { aSuggestionImageUrl = aCfg.GetSpellAndGrammarContextSuggestionImage( xNamed->getName() ); - aImage = Image( lcl_GetImageFromPngUrl( aSuggestionImageUrl ) ); + aImage = Image( aSuggestionImageUrl ); } } @@ -416,7 +400,7 @@ SwSpellPopup::SwSpellPopup( xSvcInfo->getImplementationName() ) ); if (!aDictionaryImageUrl.isEmpty()) { - Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) ); + Image aImage( aDictionaryImageUrl ); pMenu->SetItemImage( nItemId, aImage ); } } @@ -537,7 +521,7 @@ aInfo16( SW_RES(IMG_INFO_16) ) if (xInfo.is()) { aSuggestionImageUrl = SvtLinguConfig().GetSpellAndGrammarContextSuggestionImage( xInfo->getImplementationName() ); - aImage = Image( lcl_GetImageFromPngUrl( aSuggestionImageUrl ) ); + aImage = Image( aSuggestionImageUrl ); } } diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index 32bd32466fb9..33fd9192dcea 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -21,6 +21,7 @@ #include <boost/scoped_array.hpp> +#include <osl/file.hxx> #include <tools/debug.hxx> #include <tools/stream.hxx> #include <tools/rc.h> @@ -29,6 +30,7 @@ #include <vcl/settings.hxx> #include <vcl/outdev.hxx> #include <vcl/graph.hxx> +#include <vcl/graphicfilter.hxx> #include <vcl/svapp.hxx> #include <vcl/image.hxx> #include <vcl/imagerepository.hxx> @@ -151,6 +153,20 @@ Image::Image( const uno::Reference< graphic::XGraphic >& rxGraphic ) : ImplInit( aGraphic.GetBitmapEx() ); } +Image::Image( const OUString &rFileUrl ) : + mpImplData( NULL ) +{ + DBG_CTOR( Image, NULL ); + OUString aTmp; + osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); + Graphic aGraphic; + const OUString aFilterName( IMP_PNG ); + if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic ) ) + { + ImplInit( aGraphic.GetBitmapEx() ); + } +} + Image::~Image() { DBG_DTOR( Image, NULL ); |