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

(-)old/cfg.cxx (-9 / +220 lines)
Lines 5380-5386 Link Here
5380
	aBtnOK			     ( this, ResId( BTN_OK ) ),
5380
	aBtnOK			     ( this, ResId( BTN_OK ) ),
5381
	aBtnCancel		     ( this, ResId( BTN_CANCEL ) ),
5381
	aBtnCancel		     ( this, ResId( BTN_CANCEL ) ),
5382
	aBtnHelp		     ( this, ResId( BTN_HELP ) ),
5382
	aBtnHelp		     ( this, ResId( BTN_HELP ) ),
5383
	aBtnImport		     ( this, ResId( BTN_IMPORT ) ), 
5383
	aBtnImport		     ( this, ResId( BTN_IMPORT ) ),
5384
	aBtnDelete			 ( this, ResId( BTN_DELETE ) ), 
5385
	aFlSeparator		 ( this, ResId( FL_SEPARATOR ) ), 
5384
	m_xImageManager	     ( rXImageManager ),
5386
	m_xImageManager	     ( rXImageManager ),
5385
    m_xParentImageManager( rXParentImageManager )
5387
    m_xParentImageManager( rXParentImageManager )
5386
{
5388
{
Lines 5558-5565 Link Here
5558
        ++pConstIter;
5560
        ++pConstIter;
5559
	}
5561
	}
5560
5562
5563
	aBtnDelete.Enable( FALSE ); 
5561
	aTbSymbol.SetSelectHdl( LINK(this, SvxIconSelectorDialog, SelectHdl) );
5564
	aTbSymbol.SetSelectHdl( LINK(this, SvxIconSelectorDialog, SelectHdl) );
5562
	aBtnImport.SetClickHdl( LINK(this, SvxIconSelectorDialog, ImportHdl) );
5565
	aBtnImport.SetClickHdl( LINK(this, SvxIconSelectorDialog, ImportHdl) );
5566
	aBtnDelete.SetClickHdl( LINK(this, SvxIconSelectorDialog, DeleteHdl) ); 
5563
}
5567
}
5564
5568
5565
SvxIconSelectorDialog::~SvxIconSelectorDialog()
5569
SvxIconSelectorDialog::~SvxIconSelectorDialog()
Lines 5617-5622 Link Here
5617
5621
5618
	USHORT nId = aTbSymbol.GetCurItemId();
5622
	USHORT nId = aTbSymbol.GetCurItemId();
5619
	aTbSymbol.CheckItem( nId );
5623
	aTbSymbol.CheckItem( nId );
5624
	
5625
	::rtl::OUString aSelImageText = aTbSymbol.GetItemText( nId );
5626
	if ( m_xImportedImageManager->hasImage( GetImageType(), aSelImageText ) )
5627
	{
5628
		aBtnDelete.Enable( TRUE );
5629
	}
5630
	else 
5631
	{
5632
		aBtnDelete.Enable( FALSE );
5633
	}
5620
5634
5621
	return 0;
5635
	return 0;
5622
}
5636
}
Lines 5651-5679 Link Here
5651
	return 0;
5665
	return 0;
5652
}
5666
}
5653
5667
5668
IMPL_LINK( SvxIconSelectorDialog, DeleteHdl, PushButton *, pButton )
5669
{
5670
	(void)pButton;
5671
5672
	OUString message = String( SVX_RES( RID_SVXSTR_DELETE_ICON_CONFIRM ) );
5673
	bool ret = WarningBox( this, WinBits(WB_OK_CANCEL), message ).Execute(); 
5674
5675
	if ( ret == RET_OK )
5676
	{
5677
		USHORT nCount = aTbSymbol.GetItemCount();
5678
5679
		for (USHORT n = 0; n < nCount; n++ )
5680
		{
5681
			USHORT nId = aTbSymbol.GetItemId( n );
5682
5683
			if ( aTbSymbol.IsItemChecked( nId ) )
5684
			{
5685
				::rtl::OUString aSelImageText = aTbSymbol.GetItemText( nId );
5686
				uno::Sequence< OUString > URLs(1);
5687
				URLs[0] = aSelImageText;
5688
				aTbSymbol.RemoveItem( aTbSymbol.GetItemPos( nId ) );
5689
				m_xImportedImageManager->removeImages( GetImageType(), URLs );
5690
				uno::Reference< css::ui::XUIConfigurationPersistence > 
5691
					xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY );
5692
				if ( xConfigPersistence.is() && xConfigPersistence->isModified() )
5693
				{
5694
					xConfigPersistence->store();
5695
				}
5696
				break;
5697
			}
5698
		}
5699
	}
5700
	return 0;
5701
}
5702
5654
void SvxIconSelectorDialog::ImportGraphics(
5703
void SvxIconSelectorDialog::ImportGraphics(
5655
	const uno::Sequence< OUString >& rPaths )
5704
	const uno::Sequence< OUString >& rPaths )
5656
{
5705
{
5657
	uno::Sequence< OUString > rejected( rPaths.getLength() );
5706
	uno::Sequence< OUString > rejected( rPaths.getLength() );
5658
	sal_Int32 rejectedCount = 0;
5707
	sal_Int32 rejectedCount = 0;
5659
5708
5709
	USHORT ret = 0, nId, nCount;
5710
	sal_Int32 aIndex;
5711
	OUString aIconName;
5712
	uno::Sequence< OUString > URLs(1);
5713
	uno::Sequence< uno::Reference<graphic::XGraphic > > aImportGraph( 1 );
5714
	uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
5715
	aMediaProps[0].Name = ::rtl::OUString::createFromAscii("URL");
5716
	uno::Reference< css::ui::XUIConfigurationPersistence > 
5717
		xConfigPer( m_xImportedImageManager, uno::UNO_QUERY );
5718
5660
	if ( rPaths.getLength() == 1 )
5719
	if ( rPaths.getLength() == 1 )
5661
	{
5720
	{
5662
		if ( ImportGraphic( rPaths[0] ) == FALSE )
5721
		if ( m_xImportedImageManager->hasImage( GetImageType(), rPaths[0] ) ) 
5722
		{
5723
			aIndex = rPaths[0].lastIndexOf( '/' );
5724
			aIconName = rPaths[0].copy( aIndex+1 );  
5725
			ret = SvxIconReplacementDialog( this, aIconName ).ShowDialog();
5726
			if ( ret == 2 )
5727
			{
5728
				nCount = aTbSymbol.GetItemCount();
5729
				for (USHORT n = 0; n < nCount; n++ )
5730
				{
5731
					nId = aTbSymbol.GetItemId( n );
5732
5733
					if ( OUString( aTbSymbol.GetItemText( nId ) ) == rPaths[0] )
5734
					{
5735
						URLs[0] = rPaths[0];
5736
						aTbSymbol.RemoveItem( aTbSymbol.GetItemPos( nId ) );
5737
						aMediaProps[0].Value <<= rPaths[0];
5738
						aImportGraph[ 0 ] = m_xGraphProvider->queryGraphic( aMediaProps );
5739
						aTbSymbol.InsertItem( nId, Image( aImportGraph[ 0 ] ), rPaths[0], 0, 0 );
5740
						m_xImportedImageManager->replaceImages( GetImageType(), URLs, aImportGraph );
5741
						if ( xConfigPer.is() && xConfigPer->isModified() )
5742
						{
5743
							xConfigPer->store();
5744
							break;
5745
						}
5746
					}
5747
				}
5748
			}
5749
		}
5750
		else
5663
		{
5751
		{
5664
			rejected[0] = rPaths[0];
5752
			if ( ImportGraphic( rPaths[0] ) == FALSE )
5665
			rejectedCount = 1;
5753
			{
5754
				rejected[0] = rPaths[0];
5755
				rejectedCount = 1;
5756
			}
5666
		}
5757
		}
5667
	}
5758
	}
5668
	else
5759
	else
5669
	{
5760
	{
5670
		for ( sal_Int32 i = 1; i < rPaths.getLength(); i++ )
5761
		for ( sal_Int32 i = 1; i < rPaths.getLength(); i++ ) 
5671
		{
5762
		{
5672
			bool result = ImportGraphic( rPaths[0] + OUString::createFromAscii("/") + rPaths[i] );
5763
			::rtl::OUString aPath = rPaths[0] + OUString::createFromAscii("/") + rPaths[i];
5673
			if ( result == FALSE )
5764
			if ( m_xImportedImageManager->hasImage( GetImageType(), aPath ) )
5674
			{
5765
			{
5675
				rejected[ rejectedCount ] = rPaths[i];
5766
				aIndex = rPaths[i].lastIndexOf( '/' );
5676
				rejectedCount++;
5767
				aIconName = rPaths[i].copy( aIndex+1 );
5768
				ret = SvxIconReplacementDialog( this, aIconName, TRUE ).ShowDialog();
5769
				nCount = aTbSymbol.GetItemCount();
5770
				if ( ret == 2 )
5771
				{
5772
					for (USHORT n = 0; n < nCount; n++ )
5773
					{
5774
						nId = aTbSymbol.GetItemId( n );
5775
						if ( OUString( aTbSymbol.GetItemText( nId ) ) == aPath )
5776
						{
5777
							URLs[0] = aPath;
5778
							aTbSymbol.RemoveItem( aTbSymbol.GetItemPos( nId ) );
5779
							aMediaProps[0].Value <<= aPath;
5780
							aImportGraph[ 0 ] = m_xGraphProvider->queryGraphic( aMediaProps );
5781
							aTbSymbol.InsertItem( nId, Image( aImportGraph[ 0 ] ), aPath, 0, 0 );
5782
							m_xImportedImageManager->replaceImages( GetImageType(), URLs, aImportGraph );
5783
							if ( xConfigPer.is() && xConfigPer->isModified() )
5784
							{
5785
								xConfigPer->store();
5786
								break;
5787
							}
5788
						}
5789
					}
5790
				}
5791
				else if ( ret == 5 )
5792
				{
5793
					for ( sal_Int32 k = i; k < rPaths.getLength(); k++ )
5794
					{
5795
						aPath = rPaths[0] + OUString::createFromAscii("/") + rPaths[k];
5796
						bool bHasReplaced = FALSE;
5797
						for (USHORT n = 0; n < nCount; n++ )
5798
						{
5799
							nId = aTbSymbol.GetItemId( n );
5800
							if ( OUString( aTbSymbol.GetItemText( nId ) ) == aPath )
5801
							{
5802
								URLs[0] = aPath;
5803
								aTbSymbol.RemoveItem( aTbSymbol.GetItemPos( nId ) );
5804
								aMediaProps[0].Value <<= aPath;
5805
								aImportGraph[ 0 ] = m_xGraphProvider->queryGraphic( aMediaProps );
5806
								aTbSymbol.InsertItem( nId, Image( aImportGraph[ 0 ] ), aPath, 0, 0 );
5807
								m_xImportedImageManager->replaceImages( GetImageType(), URLs, aImportGraph );
5808
								if ( xConfigPer.is() && xConfigPer->isModified() )
5809
								{
5810
									xConfigPer->store();
5811
									bHasReplaced = TRUE;
5812
									break;
5813
								}
5814
							}
5815
						}
5816
						if ( !bHasReplaced ) 
5817
						{
5818
							bool result = ImportGraphic( aPath );
5819
							if ( result == FALSE )
5820
							{
5821
								rejected[ rejectedCount ] = rPaths[i];
5822
								rejectedCount++;
5823
							}
5824
						}
5825
					}
5826
					break;
5827
				}
5828
			}
5829
			else
5830
			{
5831
				bool result = ImportGraphic( rPaths[0] + OUString::createFromAscii("/") + rPaths[i] );
5832
				if ( result == FALSE )
5833
				{
5834
					rejected[ rejectedCount ] = rPaths[i];
5835
					rejectedCount++;
5836
				}
5677
			}
5837
			}
5678
		}
5838
		}
5679
	}
5839
	}
Lines 5774-5776 Link Here
5774
	}
5934
	}
5775
	return result;
5935
	return result;
5776
}
5936
}
5937
5938
/*******************************************************************************
5939
*
5940
* The SvxIconReplacementDialog class
5941
*
5942
*******************************************************************************/
5943
SvxIconReplacementDialog :: SvxIconReplacementDialog( 
5944
	Window *pWindow, const rtl::OUString& aMessage, bool bYestoAll )
5945
	:
5946
MessBox( pWindow, WB_DEF_YES, String( SVX_RES( RID_SVXSTR_REPLACE_ICON_CONFIRM ) ),  String( SVX_RES( RID_SVXSTR_REPLACE_ICON_WARNING ) ) )
5947
5948
{
5949
	FreeResource();
5950
	SetImage( WarningBox( this, NULL ).GetStandardImage() );
5951
	SetMessText( ReplaceIconName( aMessage ) );
5952
	RemoveButton( 1 );
5953
	AddButton( BUTTON_YES, 2, 0 );
5954
	AddButton( String( SVX_RES( RID_SVXSTR_YESTOALL ) ), 5, 0 );
5955
	AddButton( BUTTON_NO, 3, 0 );
5956
	AddButton( BUTTON_CANCEL, 4, 0 );
5957
}
5958
5959
SvxIconReplacementDialog :: SvxIconReplacementDialog( 
5960
	Window *pWindow, const rtl::OUString& aMessage )
5961
	:
5962
MessBox( pWindow, WB_YES_NO_CANCEL, String( SVX_RES( RID_SVXSTR_REPLACE_ICON_CONFIRM ) ),  String( SVX_RES( RID_SVXSTR_REPLACE_ICON_WARNING ) ) )
5963
{
5964
	FreeResource();
5965
	SetImage( WarningBox( this, NULL ).GetStandardImage() );
5966
	SetMessText( ReplaceIconName( aMessage ));
5967
}
5968
5969
rtl::OUString SvxIconReplacementDialog :: ReplaceIconName( const OUString& rMessage )
5970
{
5971
	rtl::OUString name;
5972
	rtl::OUString message = String( SVX_RES( RID_SVXSTR_REPLACE_ICON_WARNING ) );
5973
	rtl::OUString placeholder = OUString::createFromAscii( "%ICONNAME" );
5974
	sal_Int32 pos = message.indexOf( placeholder );
5975
	if ( pos != -1 )
5976
	{
5977
		name = message.replaceAt(
5978
			pos, placeholder.getLength(), rMessage );
5979
	}
5980
	return name;
5981
}
5982
5983
USHORT SvxIconReplacementDialog :: ShowDialog()
5984
{
5985
	this->Execute();
5986
	return ( this->GetCurButtonId() );
5987
}
(-)old/cfg.hrc (-1 / +4 lines)
Lines 101-104 Link Here
101
#define BTN_OK (103 + CFG_OFFSET)
101
#define BTN_OK (103 + CFG_OFFSET)
102
#define BTN_CANCEL (104 + CFG_OFFSET)
102
#define BTN_CANCEL (104 + CFG_OFFSET)
103
#define BTN_HELP (105 + CFG_OFFSET)
103
#define BTN_HELP (105 + CFG_OFFSET)
104
#define FT_NAME (106 + CFG_OFFSET)
104
#define FT_NAME (106 + CFG_OFFSET)
105
106
#define FL_SEPARATOR (108 + CFG_OFFSET)
107
#define BTN_DELETE (109 + CFG_OFFSET)
(-)old/cfg.hxx (+19 lines)
Lines 796-801 Link Here
796
	CancelButton	aBtnCancel;
796
	CancelButton	aBtnCancel;
797
	HelpButton		aBtnHelp;
797
	HelpButton		aBtnHelp;
798
	PushButton		aBtnImport;
798
	PushButton		aBtnImport;
799
	PushButton      aBtnDelete; 
800
	FixedLine       aFlSeparator; 
799
801
800
	sal_Int32		m_nExpectedSize;
802
	sal_Int32		m_nExpectedSize;
801
803
Lines 833-838 Link Here
833
835
834
	DECL_LINK( SelectHdl, ToolBox * );
836
	DECL_LINK( SelectHdl, ToolBox * );
835
	DECL_LINK( ImportHdl, PushButton * );
837
	DECL_LINK( ImportHdl, PushButton * );
838
	DECL_LINK( DeleteHdl, PushButton * ); 
839
};
840
841
class SvxIconReplacementDialog : public MessBox
842
{
843
public:
844
	SvxIconReplacementDialog( 
845
		Window *pWindow, 
846
		const rtl::OUString& aMessage,
847
		bool aYestoAll);
848
849
	SvxIconReplacementDialog( 
850
		Window *pWindow, 
851
		const rtl::OUString& aMessage );
852
853
	rtl::OUString ReplaceIconName( const rtl::OUString& );
854
	USHORT ShowDialog();
836
};
855
};
837
856
838
#endif // _SVXCFG_HXX
857
#endif // _SVXCFG_HXX
(-)old/cfg.src (-7 / +39 lines)
Lines 636-682 Link Here
636
	ToolBox TB_SYMBOLS
636
	ToolBox TB_SYMBOLS
637
	{
637
	{
638
		Pos = MAP_APPFONT ( 12 , 14 ) ;
638
		Pos = MAP_APPFONT ( 12 , 14 ) ;
639
		Size = MAP_APPFONT ( 160 , 96 ) ;
639
		Size = MAP_APPFONT ( 160 , 80 ) ;
640
		Scroll = TRUE ;
640
		Scroll = TRUE ;
641
		LineSpacing = TRUE ;
641
		LineSpacing = TRUE ;
642
		Customize = FALSE ;
642
		Customize = FALSE ;
643
	};
643
	};       
644
	OKButton BTN_OK
644
	OKButton BTN_OK
645
	{
645
	{
646
		Pos = MAP_APPFONT ( 184 , 7 ) ;
646
		Pos = MAP_APPFONT ( 60 , 130 ) ; 
647
		Size = MAP_APPFONT ( 50 , 14 ) ;
647
		Size = MAP_APPFONT ( 50 , 14 ) ;
648
		TabStop = TRUE ;
648
		TabStop = TRUE ;
649
		DefButton = TRUE ;
649
		DefButton = TRUE ;
650
	};
650
	};
651
	CancelButton BTN_CANCEL
651
	CancelButton BTN_CANCEL
652
	{
652
	{
653
		Pos = MAP_APPFONT ( 184 , 24 ) ;
653
		Pos = MAP_APPFONT ( 120 , 130 ) ;
654
		Size = MAP_APPFONT ( 50 , 14 ) ;
654
		Size = MAP_APPFONT ( 50 , 14 ) ;
655
		TabStop = TRUE ;
655
		TabStop = TRUE ;
656
	};
656
	};
657
	HelpButton BTN_HELP
657
	HelpButton BTN_HELP
658
	{
658
	{
659
		Pos = MAP_APPFONT ( 184 , 44 ) ;
659
		Pos = MAP_APPFONT ( 180 , 130 ) ;
660
		Size = MAP_APPFONT ( 50 , 14 ) ;
660
		Size = MAP_APPFONT ( 50 , 14 ) ;
661
		TabStop = TRUE ;
661
		TabStop = TRUE ;
662
	};
662
	};
663
	PushButton BTN_IMPORT
663
	PushButton BTN_IMPORT
664
	{
664
	{
665
		Pos = MAP_APPFONT ( 184 , 95 ) ;
665
		Pos = MAP_APPFONT ( 184 , 7 ) ;
666
		Size = MAP_APPFONT ( 50 , 14 ) ;
666
		Size = MAP_APPFONT ( 50 , 14 ) ;
667
		TabStop = TRUE ;
667
		TabStop = TRUE ;
668
		Text [ de ] = "Importieren..." ;
668
		Text [ de ] = "Importieren..." ;
669
 	   	Text[ en-US ] = "Import...";
669
 	   	Text[ en-US ] = "Import...";
670
	};
670
	};
671
	PushButton BTN_DELETE
672
	{
673
		Pos = MAP_APPFONT ( 184 , 24 ) ;
674
		Size = MAP_APPFONT ( 50 , 14 ) ;
675
		TabStop = TRUE ;
676
 	   	Text[ en-US ] = "Delete...";
677
	};
671
	FixedText FT_NOTE
678
	FixedText FT_NOTE
672
	{
679
	{
673
		Pos = MAP_APPFONT ( 12 , 117 ) ;
680
		Pos = MAP_APPFONT ( 12 , 95 ) ; 
674
		Size = MAP_APPFONT ( 172 , 24 ) ;
681
		Size = MAP_APPFONT ( 172 , 24 ) ;
675
		Text [ de ] = "Hinweis:\nBitte beachten Sie das für einen erfolgreichen Import die Symbole eine Größe  von 16x16 Pixel haben müssen." ;
682
		Text [ de ] = "Hinweis:\nBitte beachten Sie das für einen erfolgreichen Import die Symbole eine Größe  von 16x16 Pixel haben müssen." ;
676
		Text [ en-US ] = "Note:\nThe size of the icons must be 16x16 pixels for them to be successfully imported." ;
683
		Text [ en-US ] = "Note:\nThe size of the icons must be 16x16 pixels for them to be successfully imported." ;
677
		Left = TRUE ;
684
		Left = TRUE ;
678
		WordBreak = TRUE;
685
		WordBreak = TRUE;
679
	};
686
	};
687
	FixedLine FL_SEPARATOR 
688
	{
689
		Pos = MAP_APPFONT ( 0, 120 );
690
		Size = MAP_APPFONT ( 240, 8 );
691
	};
680
	Color IMAGE_BTN_COLOR
692
	Color IMAGE_BTN_COLOR
681
	{
693
	{
682
		Red = 0xC000 ;
694
		Red = 0xC000 ;
Lines 692-697 Link Here
692
	Text [ en-US ] = "The files listed here could not be imported. The icons are not the required 16x16 pixels in size." ;
704
	Text [ en-US ] = "The files listed here could not be imported. The icons are not the required 16x16 pixels in size." ;
693
};
705
};
694
706
707
String RID_SVXSTR_DELETE_ICON_CONFIRM  
708
{
709
	Text [ en-US ] = "Are you sure to delete the image?" ;
710
};
711
712
String RID_SVXSTR_REPLACE_ICON_WARNING  
713
{
714
	Text [ en-US ] = "The icon %ICONNAME is already contained in the image list.\nWould you like to replace the existing icon?";
715
};
716
717
String RID_SVXSTR_REPLACE_ICON_CONFIRM 
718
{
719
	Text [ en-US ] = "Confirm Icon Replacement";
720
};
721
722
String RID_SVXSTR_YESTOALL 
723
{
724
	Text [ en-US ] = "Yes to All";
725
};
726
695
String RID_SVXSTR_PRODUCTNAME_TOOLBARS
727
String RID_SVXSTR_PRODUCTNAME_TOOLBARS
696
{
728
{
697
	Text [ de ] = "%PRODUCTNAME %MODULENAME Symbolleisten" ;
729
	Text [ de ] = "%PRODUCTNAME %MODULENAME Symbolleisten" ;

Return to issue 73355