View | Details | Raw Unified | Return to issue 73354
Collapse All | Expand All

(-)old/cfg.cxx (-10 / +110 lines)
Lines 146-151 Link Here
146
#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
146
#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
147
#include <com/sun/star/frame/FrameSearchFlag.hpp>
147
#include <com/sun/star/frame/FrameSearchFlag.hpp>
148
#endif
148
#endif
149
#ifndef _COM_SUN_STAR_EMBED_ELEMENTMODES_HPP_ 
150
#include <com/sun/star/embed/ElementModes.hpp>
151
#endif
149
152
150
#define PRTSTR(x) rtl::OUStringToOString(x, RTL_TEXTENCODING_ASCII_US).pData->buffer
153
#define PRTSTR(x) rtl::OUStringToOString(x, RTL_TEXTENCODING_ASCII_US).pData->buffer
151
154
Lines 5368-5374 Link Here
5368
*******************************************************************************/
5371
*******************************************************************************/
5369
SvxIconSelectorDialog::SvxIconSelectorDialog( Window *pWindow,
5372
SvxIconSelectorDialog::SvxIconSelectorDialog( Window *pWindow,
5370
    const uno::Reference< css::ui::XImageManager >& rXImageManager,
5373
    const uno::Reference< css::ui::XImageManager >& rXImageManager,
5371
	const uno::Reference< css::ui::XImageManager >& rXParentImageManager )
5374
	const uno::Reference< css::ui::XImageManager >& rXParentImageManager ) 
5372
	:
5375
	:
5373
	ModalDialog		     ( pWindow, ResId( MD_ICONSELECTOR, DIALOG_MGR() ) ),
5376
	ModalDialog		     ( pWindow, ResId( MD_ICONSELECTOR, DIALOG_MGR() ) ),
5374
	aFtDescription	     ( this, ResId( FT_SYMBOLS ) ),
5377
	aFtDescription	     ( this, ResId( FT_SYMBOLS ) ),
Lines 5415-5421 Link Here
5415
		aBtnImport.Enable( FALSE );
5418
		aBtnImport.Enable( FALSE );
5416
	}
5419
	}
5417
5420
5418
    uno::Sequence< OUString > names;
5421
	uno::Reference< beans::XPropertySet > xPropSet(
5422
		xServiceManager->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.util.PathSettings" ) ),
5423
		uno::UNO_QUERY );
5424
5425
	uno::Any aAny = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfig" ) ) );
5426
5427
	::rtl::OUString aDirectory;
5428
5429
	aAny >>= aDirectory;
5430
5431
	sal_Int32 aCount = aDirectory.getLength();
5432
5433
	if ( aCount > 0 )
5434
	{
5435
		sal_Unicode aChar = aDirectory[ aCount-1 ];
5436
		if ( aChar != '/')
5437
		{
5438
			aDirectory += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
5439
		}
5440
	}
5441
	else
5442
	{
5443
		aBtnImport.Enable( FALSE );
5444
	}
5445
5446
	aDirectory += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "soffice.cfg/import" ) );
5447
5448
	uno::Reference< lang::XSingleServiceFactory > xStorageFactory(
5449
		xServiceManager->createInstance( 
5450
		::rtl::OUString::createFromAscii( "com.sun.star.embed.FileSystemStorageFactory" )),
5451
		uno::UNO_QUERY );
5452
5453
	uno::Sequence< uno::Any > aArgs( 2 );
5454
	aArgs[ 0 ] <<= aDirectory;
5455
	aArgs[ 1 ] <<= com::sun::star::embed::ElementModes::READWRITE;
5456
5457
	uno::Reference< com::sun::star::embed::XStorage > xStorage( 
5458
		xStorageFactory->createInstanceWithArguments( aArgs ), uno::UNO_QUERY );
5459
5460
	uno::Sequence< uno::Any > aProp( 2 );
5461
	beans::PropertyValue aPropValue;
5462
5463
	aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfigStorage" ) );
5464
	aPropValue.Value <<= xStorage;
5465
	aProp[ 0 ] <<= aPropValue;
5466
5467
	aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" ) );
5468
	aPropValue.Value <<= com::sun::star::embed::ElementModes::READWRITE;
5469
	aProp[ 1 ] <<= aPropValue;
5470
5471
	m_xImportedImageManager = uno::Reference< com::sun::star::ui::XImageManager >(
5472
		xServiceManager->createInstanceWithArguments( 
5473
		::rtl::OUString::createFromAscii( "com.sun.star.ui.ImageManager" ), aProp ), 
5474
		uno::UNO_QUERY );
5475
5476
	uno::Sequence< OUString > names;
5477
	ImageInfo mImageInfo;
5478
	
5479
	if ( m_xImportedImageManager.is() )
5480
	{
5481
		names = m_xImportedImageManager->getAllImageNames( GetImageType() );
5482
		for ( sal_Int32 n = 0; n < names.getLength(); n++ )
5483
			mImageInfo.insert( ImageInfo::value_type( names[n], false ));
5484
	}
5485
	USHORT nId = 1;
5486
	uno::Sequence< OUString > name( 1 );
5487
	ImageInfo::const_iterator pConstIter = mImageInfo.begin();
5488
	while ( pConstIter != mImageInfo.end() )
5489
	{
5490
		name[ 0 ] = pConstIter->first;
5491
		uno::Sequence< uno::Reference< graphic::XGraphic> > graphics = m_xImportedImageManager->getImages( GetImageType(), name );
5492
		if ( graphics.getLength() > 0 )
5493
		{
5494
			Image img = Image( graphics[ 0 ] );
5495
			aTbSymbol.InsertItem( nId, img, pConstIter->first );
5496
5497
			graphics[ 0 ]->acquire();
5498
5499
			aTbSymbol.SetItemData(
5500
				nId, static_cast< void * > ( graphics[ 0 ].get() ) );
5501
5502
			++nId;
5503
		}
5504
		++pConstIter;
5505
	}
5506
5419
    ImageInfo                 aImageInfo;
5507
    ImageInfo                 aImageInfo;
5420
5508
5421
    if ( m_xParentImageManager.is() )
5509
    if ( m_xParentImageManager.is() )
Lines 5434-5444 Link Here
5434
        else
5522
        else
5435
            aImageInfo.insert( ImageInfo::value_type( names[n], true ));
5523
            aImageInfo.insert( ImageInfo::value_type( names[n], true ));
5436
    }
5524
    }
5437
5525
	
5438
	// large growth factor, expecting many entries
5526
	// large growth factor, expecting many entries
5439
    USHORT nId = 1;
5527
	pConstIter = aImageInfo.begin();
5440
	uno::Sequence< OUString > name( 1 );
5441
    ImageInfo::const_iterator pConstIter = aImageInfo.begin();
5442
    while ( pConstIter != aImageInfo.end() )
5528
    while ( pConstIter != aImageInfo.end() )
5443
    {
5529
    {
5444
		name[ 0 ] = pConstIter->first;
5530
		name[ 0 ] = pConstIter->first;
Lines 5448-5455 Link Here
5448
		{
5534
		{
5449
            if ( pConstIter->second )
5535
            if ( pConstIter->second )
5450
                graphics = m_xImageManager->getImages( GetImageType(), name );
5536
                graphics = m_xImageManager->getImages( GetImageType(), name );
5451
            else
5537
            else 
5452
                graphics = m_xParentImageManager->getImages( GetImageType(), name );
5538
				graphics = m_xParentImageManager->getImages( GetImageType(), name );
5453
		}
5539
		}
5454
		catch ( uno::Exception& )
5540
		catch ( uno::Exception& )
5455
		{
5541
		{
Lines 5619-5625 Link Here
5619
{
5705
{
5620
	bool result = FALSE;
5706
	bool result = FALSE;
5621
5707
5622
	USHORT nId = aTbSymbol.GetItemId(aTbSymbol.GetItemCount() -1);
5708
	USHORT nId = aTbSymbol.GetItemCount();
5623
	nId++;
5709
	nId++;
5624
5710
5625
	uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
5711
	uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
Lines 5649-5661 Link Here
5649
5735
5650
				if ( !!aImage )
5736
				if ( !!aImage )
5651
				{
5737
				{
5652
					aTbSymbol.InsertItem( nId, aImage, aURL );
5738
					aTbSymbol.InsertItem( nId, aImage, aURL, 0, 0 );
5653
5739
5654
					xGraphic->acquire();
5740
					xGraphic->acquire();
5655
5741
5656
					aTbSymbol.SetItemData(
5742
					aTbSymbol.SetItemData(
5657
						nId, static_cast< void * > ( xGraphic.get() ) );
5743
						nId, static_cast< void * > ( xGraphic.get() ) );
5658
5744
5745
					uno::Sequence< OUString > aImportURL( 1 );
5746
					aImportURL[ 0 ] = aURL;
5747
					uno::Sequence< uno::Reference<graphic::XGraphic > > aImportGraph( 1 );
5748
					aImportGraph[ 0 ] = xGraphic;
5749
					m_xImportedImageManager->insertImages( GetImageType(), aImportURL, aImportGraph );
5750
					
5751
					uno::Reference< css::ui::XUIConfigurationPersistence > 
5752
					xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY );
5753
					
5754
					if ( xConfigPersistence.is() && xConfigPersistence->isModified() )
5755
					{
5756
						xConfigPersistence->store();
5757
					}
5758
5659
					result = TRUE;
5759
					result = TRUE;
5660
				}
5760
				}
5661
				else
5761
				else
(-)old/cfg.hxx (-4 / +7 lines)
Lines 188-194 Link Here
188
    ::com::sun::star::uno::Reference
188
    ::com::sun::star::uno::Reference
189
        < ::com::sun::star::ui::XUIConfigurationManager >
189
        < ::com::sun::star::ui::XUIConfigurationManager >
190
			GetParentConfigManager() { return m_xParentCfgMgr; };
190
			GetParentConfigManager() { return m_xParentCfgMgr; };
191
191
	
192
	::com::sun::star::uno::Reference
192
	::com::sun::star::uno::Reference
193
        < ::com::sun::star::ui::XImageManager >
193
        < ::com::sun::star::ui::XImageManager >
194
			GetImageManager() { return m_xImgMgr; };
194
			GetImageManager() { return m_xImgMgr; };
Lines 805-813 Link Here
805
	::com::sun::star::uno::Reference<
805
	::com::sun::star::uno::Reference<
806
		::com::sun::star::ui::XImageManager > m_xParentImageManager;
806
		::com::sun::star::ui::XImageManager > m_xParentImageManager;
807
807
808
	::com::sun::star::uno::Reference<
809
		::com::sun::star::ui::XImageManager > m_xImportedImageManager; 
810
808
    ::com::sun::star::uno::Reference<
811
    ::com::sun::star::uno::Reference<
809
		::com::sun::star::graphic::XGraphicProvider > m_xGraphProvider;
812
		::com::sun::star::graphic::XGraphicProvider > m_xGraphProvider;
810
813
	
811
	bool ImportGraphic( const rtl::OUString& aURL );
814
	bool ImportGraphic( const rtl::OUString& aURL );
812
815
813
	void ImportGraphics(
816
	void ImportGraphics(
Lines 820-827 Link Here
820
		const ::com::sun::star::uno::Reference<
823
		const ::com::sun::star::uno::Reference<
821
			::com::sun::star::ui::XImageManager >& rXImageManager,
824
			::com::sun::star::ui::XImageManager >& rXImageManager,
822
		const ::com::sun::star::uno::Reference<
825
		const ::com::sun::star::uno::Reference<
823
			::com::sun::star::ui::XImageManager >& rXParentImageManager
826
			::com::sun::star::ui::XImageManager >& rXParentImageManager 
824
		);
827
		); 
825
828
826
	~SvxIconSelectorDialog();
829
	~SvxIconSelectorDialog();
827
830

Return to issue 73354