xref: /trunk/main/cui/source/inc/cfg.hxx (revision c4eee24d)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SVXCFG_HXX
24 #define _SVXCFG_HXX
25 
26 #include <vcl/lstbox.hxx>
27 #include <vcl/toolbox.hxx>
28 #include <vcl/fixed.hxx>
29 #include <vcl/group.hxx>
30 #include <vcl/menubtn.hxx>
31 #include <vcl/toolbox.hxx>
32 #include <svtools/svtreebx.hxx>
33 #include <svtools/svmedit2.hxx>
34 #include <svtools/svmedit.hxx>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/container/XIndexContainer.hpp>
37 #include <com/sun/star/container/XNameAccess.hpp>
38 #include <com/sun/star/frame/XModuleManager.hpp>
39 #include <com/sun/star/ui/XUIConfigurationListener.hpp>
40 #include <com/sun/star/ui/XUIConfigurationManager.hpp>
41 #include <com/sun/star/ui/XImageManager.hpp>
42 #include <com/sun/star/graphic/XGraphicProvider.hpp>
43 #include <com/sun/star/frame/XFrame.hpp>
44 #include <com/sun/star/frame/XStorable.hpp>
45 #include <com/sun/star/uno/XComponentContext.hpp>
46 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
47 
48 #define _SVSTDARR_USHORTS
49 #define _SVSTDARR_STRINGSDTOR
50 #include <svl/svstdarr.hxx>		// SvUShorts
51 #include <sfx2/minarray.hxx>
52 #include <sfx2/tabdlg.hxx>
53 #include <vector>
54 #include <vcl/msgbox.hxx>
55 
56 #include "selector.hxx"
57 
58 class SvxConfigEntry;
59 class SvxConfigPage;
60 class SvxMenuConfigPage;
61 class SvxToolbarConfigPage;
62 
63 typedef std::vector< SvxConfigEntry* > SvxEntries;
64 
65 class SvxConfigDialog : public SfxTabDialog
66 {
67 private:
68     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
69 
70 public:
71 	SvxConfigDialog( Window*, const SfxItemSet* );
72 	~SvxConfigDialog();
73 
74 	virtual void				PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
75 	virtual short				Ok();
76 
77     void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
78 };
79 
80 class SaveInData : public ImageProvider
81 {
82 private:
83 
84 	bool		bModified;
85 
86 	bool		bDocConfig;
87 	bool		bReadOnly;
88 
89 	::com::sun::star::uno::Reference
90 		< com::sun::star::ui::XUIConfigurationManager > m_xCfgMgr;
91 
92 	::com::sun::star::uno::Reference
93 		< com::sun::star::ui::XUIConfigurationManager > m_xParentCfgMgr;
94 
95     ::com::sun::star::uno::Reference
96 		< com::sun::star::ui::XImageManager > m_xImgMgr;
97 
98     ::com::sun::star::uno::Reference
99 		< com::sun::star::ui::XImageManager > m_xParentImgMgr;
100 
101     static ::com::sun::star::uno::Reference
102 		< com::sun::star::ui::XImageManager >* xDefaultImgMgr;
103 
104 public:
105 
106 	SaveInData(
107 		const ::com::sun::star::uno::Reference <
108 			::com::sun::star::ui::XUIConfigurationManager >& xCfgMgr,
109 		const ::com::sun::star::uno::Reference <
110 			::com::sun::star::ui::XUIConfigurationManager >& xParentCfgMgr,
111 		const rtl::OUString& aModuleId,
112 		bool docConfig );
113 
~SaveInData()114 	~SaveInData() {}
115 
116 	bool PersistChanges(
117 		const com::sun::star::uno::Reference
118 			< com::sun::star::uno::XInterface >& xManager );
119 
SetModified(bool bValue=sal_True)120 	void SetModified( bool bValue = sal_True ) { bModified = bValue; }
IsModified()121 	bool IsModified( ) { return bModified; }
122 
IsReadOnly()123 	bool IsReadOnly( ) { return bReadOnly; }
IsDocConfig()124 	bool IsDocConfig( ) { return bDocConfig; }
125 
126 	::com::sun::star::uno::Reference
127         < ::com::sun::star::ui::XUIConfigurationManager >
GetConfigManager()128 			GetConfigManager() { return m_xCfgMgr; };
129 
130     ::com::sun::star::uno::Reference
131         < ::com::sun::star::ui::XUIConfigurationManager >
GetParentConfigManager()132 			GetParentConfigManager() { return m_xParentCfgMgr; };
133 
134 	::com::sun::star::uno::Reference
135         < ::com::sun::star::ui::XImageManager >
GetImageManager()136 			GetImageManager() { return m_xImgMgr; };
137 
138 	::com::sun::star::uno::Reference
139         < ::com::sun::star::ui::XImageManager >
GetParentImageManager()140 			GetParentImageManager() { return m_xParentImgMgr; };
141 
142     ::com::sun::star::uno::Reference
143 		< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
144 
145     ::com::sun::star::uno::Reference
146 		< com::sun::star::container::XNameAccess > m_xCommandToLabelMap;
147 
148     com::sun::star::uno::Reference
149 		< com::sun::star::uno::XComponentContext > m_xComponentContext;
150 
151     com::sun::star::uno::Sequence
152 		< com::sun::star::beans::PropertyValue > m_aSeparatorSeq;
153 
154 	Image GetImage( const rtl::OUString& rCommandURL );
155 
156 	virtual bool HasURL( const rtl::OUString& aURL ) = 0;
157 	virtual bool HasSettings() = 0;
158 	virtual SvxEntries* GetEntries() = 0;
159 	virtual void SetEntries( SvxEntries* ) = 0;
160 	virtual void Reset() = 0;
161 	virtual bool Apply() = 0;
162 };
163 
164 class MenuSaveInData : public SaveInData
165 {
166 private:
167 
168 	rtl::OUString				m_aMenuResourceURL;
169 	rtl::OUString				m_aDescriptorContainer;
170 
171 	::com::sun::star::uno::Reference
172 		< com::sun::star::container::XIndexAccess > m_xMenuSettings;
173 
174 	SvxConfigEntry*	pRootEntry;
175 
176 	// static holder of the default menu data
177 	static MenuSaveInData* pDefaultData;
178 
SetDefaultData(MenuSaveInData * pData)179 	static void SetDefaultData( MenuSaveInData* pData ) {pDefaultData = pData;}
GetDefaultData()180 	static MenuSaveInData* GetDefaultData() { return pDefaultData; }
181 
182 	void		Apply( bool bDefault );
183 
184     void		Apply(
185 		SvxConfigEntry* pRootEntry,
186 		com::sun::star::uno::Reference<
187 			com::sun::star::container::XIndexContainer >& rNewMenuBar,
188 		com::sun::star::uno::Reference<
189 			com::sun::star::lang::XSingleComponentFactory >& rFactory,
190 		SvLBoxEntry *pParent = NULL );
191 
192     void		ApplyMenu(
193 		com::sun::star::uno::Reference<
194 			com::sun::star::container::XIndexContainer >& rNewMenuBar,
195 		com::sun::star::uno::Reference<
196 			com::sun::star::lang::XSingleComponentFactory >& rFactory,
197 		SvxConfigEntry *pMenuData = NULL );
198 
199 	bool		LoadSubMenus(
200     	const ::com::sun::star::uno::Reference<
201 			com::sun::star::container::XIndexAccess >& xMenuBarSettings,
202 		const rtl::OUString& rBaseTitle, SvxConfigEntry* pParentData );
203 
204 public:
205 
206 	MenuSaveInData(
207 		const ::com::sun::star::uno::Reference <
208 			::com::sun::star::ui::XUIConfigurationManager >&,
209 		const ::com::sun::star::uno::Reference <
210 			::com::sun::star::ui::XUIConfigurationManager >&,
211 		const rtl::OUString& aModuleId,
212 		bool docConfig );
213 
214 	~MenuSaveInData();
215 
216 	// methods inherited from SaveInData
217 	SvxEntries*			GetEntries();
218 	void				SetEntries( SvxEntries* );
HasURL(const rtl::OUString & URL)219 	bool				HasURL( const rtl::OUString& URL ) { (void)URL; return sal_False; }
HasSettings()220 	bool				HasSettings() { return m_xMenuSettings.is(); }
221 	void				Reset();
222 	bool				Apply();
223 };
224 
225 class SvxConfigEntry
226 {
227 private:
228 
229 	// common properties
230 	sal_uInt16						nId;
231 	::rtl::OUString  			aHelpText;
232 	::rtl::OUString				aLabel;
233 	::rtl::OUString				aCommand;
234     ::rtl::OUString				aHelpURL;
235 
236     bool                        bPopUp;
237     bool                        bStrEdited;
238 	bool						bIsUserDefined;
239 	bool						bIsMain;
240 	bool						bIsDeletable;
241 	bool						bIsMovable;
242     bool                        bIsParentData;
243 
244 	// toolbar specific properties
245 	bool						bIsVisible;
246 	sal_Int32					nStyle;
247 
248 	::com::sun::star::uno::Reference<
249 		::com::sun::star::graphic::XGraphic > xBackupGraphic;
250 
251 	SvxEntries					*pEntries;
252 
253 public:
254 
255 	SvxConfigEntry( const ::rtl::OUString& rDisplayName,
256 					const ::rtl::OUString& rCommandURL,
257 					bool bPopup = sal_False,
258                     bool bParentData = sal_False );
259 
SvxConfigEntry()260 	SvxConfigEntry()
261 		:
262 			nId( 0 ),
263 			bPopUp( sal_False ),
264 			bStrEdited( sal_False ),
265 			bIsUserDefined( sal_False ),
266 			bIsMain( sal_False ),
267             bIsParentData( sal_False ),
268 			bIsVisible( sal_True ),
269 			nStyle( 0 ),
270 			pEntries( 0 )
271 	{}
272 
273 	~SvxConfigEntry();
274 
GetCommand() const275 	const ::rtl::OUString&		GetCommand() const { return aCommand; }
SetCommand(const String & rCmd)276 	void	SetCommand( const String& rCmd ) { aCommand = rCmd; }
277 
GetName() const278 	const ::rtl::OUString& 		GetName() const { return aLabel; }
SetName(const String & rStr)279 	void	SetName( const String& rStr ) { aLabel = rStr; bStrEdited = sal_True; }
HasChangedName() const280     bool	HasChangedName() const { return bStrEdited; }
281 
282 	const ::rtl::OUString&		GetHelpText() ;
SetHelpText(const String & rStr)283 	void	SetHelpText( const String& rStr ) { aHelpText = rStr; }
284 
GetHelpURL() const285     const ::rtl::OUString&		GetHelpURL() const { return aHelpURL; }
SetHelpURL(const String & rStr)286     void	SetHelpURL( const String& rStr ) { aHelpURL = rStr; }
287 
SetPopup(bool bOn=sal_True)288 	void	SetPopup( bool bOn = sal_True ) { bPopUp = bOn; }
IsPopup() const289 	bool	IsPopup() const { return bPopUp; }
290 
SetUserDefined(bool bOn=sal_True)291 	void	SetUserDefined( bool bOn = sal_True ) { bIsUserDefined = bOn; }
IsUserDefined() const292 	bool	IsUserDefined() const { return bIsUserDefined; }
293 
IsBinding() const294 	bool	IsBinding() const { return !bPopUp; }
IsSeparator() const295 	bool	IsSeparator() const { return nId == 0; }
296 
GetEntries() const297 	SvxEntries*	GetEntries() const { return pEntries; }
SetEntries(SvxEntries * entries)298 	void	SetEntries( SvxEntries* entries ) { pEntries = entries; }
HasEntries() const299 	bool	HasEntries() const { return pEntries != NULL; }
300 
SetMain(bool bValue=sal_True)301 	void	SetMain( bool bValue = sal_True ) { bIsMain = bValue; }
IsMain()302 	bool	IsMain() { return bIsMain; }
303 
SetParentData(bool bValue=sal_True)304     void    SetParentData( bool bValue = sal_True ) { bIsParentData = bValue; }
IsParentData()305     bool    IsParentData() { return bIsParentData; }
306 
307     bool	IsMovable();
308 	bool	IsDeletable();
309 	bool	IsRenamable();
310 
SetVisible(bool b)311 	void	SetVisible( bool b ) { bIsVisible = b; }
IsVisible() const312 	bool	IsVisible() const { return bIsVisible; }
313 
SetBackupGraphic(::com::sun::star::uno::Reference<::com::sun::star::graphic::XGraphic> graphic)314 	void	SetBackupGraphic(
315 		::com::sun::star::uno::Reference<
316 			::com::sun::star::graphic::XGraphic > graphic )
317 				{ xBackupGraphic = graphic; }
318 
319 	::com::sun::star::uno::Reference<
320 		::com::sun::star::graphic::XGraphic >
GetBackupGraphic()321 			GetBackupGraphic()
322 				{ return xBackupGraphic; }
323 
IsIconModified()324 	bool	IsIconModified() { return xBackupGraphic.is(); }
325 
GetStyle()326 	sal_Int32	GetStyle() { return nStyle; }
SetStyle(sal_Int32 style)327 	void		SetStyle( sal_Int32 style ) { nStyle = style; }
328 };
329 
330 class SvxMenuEntriesListBox : public SvTreeListBox
331 {
332 private:
333 	SvxConfigPage*		pPage;
334 
335 protected:
336 	bool				m_bIsInternalDrag;
337 
338 public:
339 	SvxMenuEntriesListBox( Window*, const ResId& );
340 	~SvxMenuEntriesListBox();
341 
342 	virtual sal_Int8	AcceptDrop( const AcceptDropEvent& rEvt );
343 
344 	virtual sal_Bool    	NotifyAcceptDrop( SvLBoxEntry* pEntry );
345 
346 	virtual sal_Bool    	NotifyMoving( SvLBoxEntry*, SvLBoxEntry*,
347 									  SvLBoxEntry*&, sal_uLong& );
348 
349 	virtual sal_Bool		NotifyCopying( SvLBoxEntry*, SvLBoxEntry*,
350 									   SvLBoxEntry*&, sal_uLong&);
351 
352 	virtual DragDropMode	NotifyStartDrag(
353 		TransferDataContainer&, SvLBoxEntry* );
354 
355 	virtual void		DragFinished( sal_Int8 );
356 
357 	void 				KeyInput( const KeyEvent& rKeyEvent );
358 };
359 
360 class SvxDescriptionEdit : public ExtMultiLineEdit
361 {
362 private:
363     Rectangle           m_aRealRect;
364 
365 public:
366     SvxDescriptionEdit( Window* pParent, const ResId& _rId );
~SvxDescriptionEdit()367     inline ~SvxDescriptionEdit() {}
368 
369     void                SetNewText( const String& _rText );
Clear()370     inline void         Clear() { SetNewText( String() ); }
371 };
372 
373 class SvxConfigPage : public SfxTabPage
374 {
375 private:
376 
377 	bool								bInitialised;
378 	SaveInData*							pCurrentSaveInData;
379 
380     DECL_LINK(  SelectSaveInLocation, ListBox * );
381     DECL_LINK(  AsyncInfoMsg, String* );
382 
383     bool        SwapEntryData( SvLBoxEntry* pSourceEntry, SvLBoxEntry* pTargetEntry );
384     void        AlignControls();
385 
386 protected:
387 
388 	// the top section of the tab page where top level menus and toolbars
389 	//  are displayed in a listbox
390 	FixedLine							aTopLevelSeparator;
391 	FixedText							aTopLevelLabel;
392 	ListBox								aTopLevelListBox;
393 	PushButton							aNewTopLevelButton;
394 	MenuButton							aModifyTopLevelButton;
395 
396 	// the contents section where the contents of the selected
397 	// menu or toolbar are displayed
398 	FixedLine							aContentsSeparator;
399 	FixedText							aContentsLabel;
400 	SvTreeListBox*						aContentsListBox;
401 
402 	PushButton							aAddCommandsButton;
403 	MenuButton							aModifyCommandButton;
404 
405 	ImageButton							aMoveUpButton;
406 	ImageButton							aMoveDownButton;
407 
408 	FixedText							aSaveInText;
409 	ListBox								aSaveInListBox;
410 
411     FixedText                           aDescriptionLabel;
412     SvxDescriptionEdit                  aDescriptionField;
413 
414 	SvxScriptSelectorDialog*			pSelectorDlg;
415 
416 	// the ResourceURL to select when opening the dialog
417 	rtl::OUString						m_aURLToSelect;
418 
419 	::com::sun::star::uno::Reference
420 		< ::com::sun::star::frame::XFrame > m_xFrame;
421 
422 	SvxConfigPage( Window*, /* const ResId&, */ const SfxItemSet& );
423 	virtual ~SvxConfigPage();
424 
425 	DECL_LINK( MoveHdl, Button * );
426 
427 	virtual SaveInData* CreateSaveInData(
428 		const ::com::sun::star::uno::Reference <
429 			::com::sun::star::ui::XUIConfigurationManager >&,
430         const ::com::sun::star::uno::Reference <
431             ::com::sun::star::ui::XUIConfigurationManager >&,
432 		const rtl::OUString& aModuleId,
433 		bool docConfig ) = 0;
434 
435 	virtual void			Init() = 0;
436 	virtual void			UpdateButtonStates() = 0;
437 	virtual short			QueryReset() = 0;
438 
439 	void			PositionContentsListBox();
440 
441 	SvLBoxEntry*	InsertEntry(		SvxConfigEntry* pNewEntryData,
442 										SvLBoxEntry* pTarget = NULL,
443 										bool bFront = sal_False );
444 
445 	void			AddSubMenusToUI(	const String& rBaseTitle,
446 										SvxConfigEntry* pParentData );
447 
448 	SvLBoxEntry*	InsertEntryIntoUI ( SvxConfigEntry* pNewEntryData,
449 										sal_uLong nPos = LIST_APPEND );
450 
451 	SvxEntries*		FindParentForChild( SvxEntries* pParentEntries,
452 										SvxConfigEntry* pChildData );
453 
454 	void			ReloadTopLevelListBox( SvxConfigEntry* pSelection = NULL );
455 
456 public:
457 
458 	static bool		CanConfig( const ::rtl::OUString& rModuleId );
459 
GetSaveInData()460 	SaveInData*		GetSaveInData() { return pCurrentSaveInData; }
461 
462 	SvLBoxEntry*	AddFunction( SvLBoxEntry* pTarget = NULL,
463 								 bool bFront = sal_False,
464 								 bool bAllowDuplicates = sal_False );
465 
466 	virtual void	MoveEntry( bool bMoveUp );
467 
468 	bool			MoveEntryData(	SvLBoxEntry* pSourceEntry,
469 									SvLBoxEntry* pTargetEntry );
470 
471 	sal_Bool			FillItemSet( SfxItemSet& );
472 	void			Reset( const SfxItemSet& );
473 
474 	virtual bool	DeleteSelectedContent() = 0;
475 	virtual void	DeleteSelectedTopLevel() = 0;
476 
GetTopLevelSelection()477 	SvxConfigEntry*	GetTopLevelSelection()
478 	{
479 		return (SvxConfigEntry*) aTopLevelListBox.GetEntryData(
480 			aTopLevelListBox.GetSelectEntryPos() );
481 	}
482 
483     /** identifies the module in the given frame. If the frame is <NULL/>, a default
484         frame will be determined beforehand.
485 
486         If the given frame is <NULL/>, a default frame will be used: The method the active
487         frame of the desktop, then the current frame. If both are <NULL/>,
488         the SfxViewFrame::Current's XFrame is used. If this is <NULL/>, too, an empty string is returned.
489 
490         If the given frame is not <NULL/>, or an default frame could be successfully determined, then
491         the ModuleManager is asked for the module ID of the component in the frame.
492     */
493     static ::rtl::OUString
494         GetFrameWithDefaultAndIdentify( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _inout_rxFrame );
495 };
496 
497 class SvxMenuConfigPage : public SvxConfigPage
498 {
499 private:
500 
501 	DECL_LINK( SelectMenu, ListBox * );
502 	DECL_LINK( SelectMenuEntry, Control * );
503 	DECL_LINK( NewMenuHdl, Button * );
504 	DECL_LINK( MenuSelectHdl, MenuButton * );
505 	DECL_LINK( EntrySelectHdl, MenuButton * );
506 	DECL_LINK( AddCommandsHdl, Button * );
507 	DECL_LINK( AddFunctionHdl, SvxScriptSelectorDialog * );
508 
509 	void			Init();
510 	void			UpdateButtonStates();
511 	short			QueryReset();
512 	bool			DeleteSelectedContent();
513 	void			DeleteSelectedTopLevel();
514 
515 public:
516 	SvxMenuConfigPage( Window *pParent, const SfxItemSet& rItemSet );
517 	~SvxMenuConfigPage();
518 
519 	SaveInData* CreateSaveInData(
520 		const ::com::sun::star::uno::Reference <
521 			::com::sun::star::ui::XUIConfigurationManager >&,
522 		const ::com::sun::star::uno::Reference <
523 			::com::sun::star::ui::XUIConfigurationManager >&,
524 		const rtl::OUString& aModuleId,
525 		bool docConfig );
526 };
527 
528 class SvxMainMenuOrganizerDialog : public ModalDialog
529 {
530 	FixedText		aMenuNameText;
531 	Edit			aMenuNameEdit;
532 	FixedText		aMenuListText;
533 	SvTreeListBox	aMenuListBox;
534 	ImageButton		aMoveUpButton;
535 	ImageButton		aMoveDownButton;
536 	OKButton		aOKButton;
537 	CancelButton	aCloseButton;
538 	HelpButton		aHelpButton;
539 
540 	SvxEntries*		pEntries;
541 	SvLBoxEntry*	pNewMenuEntry;
542 	bool			bModified;
543 
544 	void UpdateButtonStates();
545 
546 	DECL_LINK( MoveHdl, Button * );
547 	DECL_LINK( ModifyHdl, Edit * );
548 	DECL_LINK( SelectHdl, Control* );
549 
550 public:
551 	SvxMainMenuOrganizerDialog (
552 		Window*, SvxEntries*,
553 		SvxConfigEntry*, bool bCreateMenu = sal_False );
554 
555 	~SvxMainMenuOrganizerDialog ();
556 
557 	SvxEntries* 	GetEntries();
558 	void 			SetEntries( SvxEntries* );
559 	SvxConfigEntry*	GetSelectedEntry();
560 };
561 
562 class SvxToolbarEntriesListBox : public SvxMenuEntriesListBox
563 {
564 	Size			m_aCheckBoxImageSizePixel;
565 	Link			m_aChangedListener;
566 	SvLBoxButtonData*	m_pButtonData;
567 	sal_Bool			m_bHiContrastMode;
568 	SvxConfigPage*	pPage;
569 
570 	void			ChangeVisibility( SvLBoxEntry* pEntry );
571 
572 protected:
573 
574 	virtual void	CheckButtonHdl();
575 	virtual void	DataChanged( const DataChangedEvent& rDCEvt );
576 	void			BuildCheckBoxButtonImages( SvLBoxButtonData* );
577 	Image			GetSizedImage(
578 		VirtualDevice& aDev, const Size& aNewSize, const Image& aImage );
579 
580 public:
581 
582 	SvxToolbarEntriesListBox(
583 		Window* pParent, const ResId& );
584 
585 	~SvxToolbarEntriesListBox();
586 
SetChangedListener(const Link & aChangedListener)587 	void			SetChangedListener( const Link& aChangedListener )
588 		{ m_aChangedListener = aChangedListener; }
589 
GetChangedListener() const590 	const Link&		GetChangedListener() const { return m_aChangedListener; }
591 
GetCheckBoxPixelSize() const592 	Size			GetCheckBoxPixelSize() const
593 		{ return m_aCheckBoxImageSizePixel; }
594 
595 	virtual sal_Bool	NotifyMoving(
596 		SvLBoxEntry*, SvLBoxEntry*, SvLBoxEntry*&, sal_uLong& );
597 
598 	virtual sal_Bool	NotifyCopying(
599 		SvLBoxEntry*, SvLBoxEntry*, SvLBoxEntry*&, sal_uLong&);
600 
601 	void 			KeyInput( const KeyEvent& rKeyEvent );
602 };
603 
604 class SvxToolbarConfigPage : public SvxConfigPage
605 {
606 private:
607 
608 	DECL_LINK( SelectToolbar, ListBox * );
609 	DECL_LINK( SelectToolbarEntry, Control * );
610 	DECL_LINK( ToolbarSelectHdl, MenuButton * );
611 	DECL_LINK( EntrySelectHdl, MenuButton * );
612 	DECL_LINK( NewToolbarHdl, Button * );
613 	DECL_LINK( AddCommandsHdl, Button * );
614 	DECL_LINK( AddFunctionHdl, SvxScriptSelectorDialog * );
615 	DECL_LINK( MoveHdl, Button * );
616 
617 	void			UpdateButtonStates();
618 	short			QueryReset();
619 	void			Init();
620 	bool			DeleteSelectedContent();
621 	void			DeleteSelectedTopLevel();
622 
623 public:
624 	SvxToolbarConfigPage( Window *pParent, const SfxItemSet& rItemSet );
625 	~SvxToolbarConfigPage();
626 
627 	SvLBoxEntry*	AddFunction( SvLBoxEntry* pTarget = NULL,
628 											 bool bFront = sal_False,
629 											 bool bAllowDuplicates = sal_True );
630 
631 	void			MoveEntry( bool bMoveUp );
632 
633 	SaveInData*		CreateSaveInData(
634 		const ::com::sun::star::uno::Reference <
635 			::com::sun::star::ui::XUIConfigurationManager >&,
636 		const ::com::sun::star::uno::Reference <
637 			::com::sun::star::ui::XUIConfigurationManager >&,
638 		const rtl::OUString& aModuleId,
639 		bool docConfig );
640 };
641 
642 class ToolbarSaveInData : public SaveInData
643 {
644 private:
645 
646 	SvxConfigEntry*	                               pRootEntry;
647 	rtl::OUString	                               m_aDescriptorContainer;
648 
649     ::com::sun::star::uno::Reference
650 		< com::sun::star::container::XNameAccess > m_xPersistentWindowState;
651 
652 	bool		LoadToolbar(
653     	const ::com::sun::star::uno::Reference<
654 			com::sun::star::container::XIndexAccess >& xToolBarSettings,
655 		SvxConfigEntry* pParentData );
656 
657 	void		ApplyToolbar(
658 		com::sun::star::uno::Reference<
659 			com::sun::star::container::XIndexContainer >& rNewToolbarBar,
660 		com::sun::star::uno::Reference<
661 			com::sun::star::lang::XSingleComponentFactory >& rFactory,
662 		SvxConfigEntry *pToolbar = NULL );
663 
664 public:
665 
666 	ToolbarSaveInData(
667 		const ::com::sun::star::uno::Reference <
668 			::com::sun::star::ui::XUIConfigurationManager >&,
669             const ::com::sun::star::uno::Reference <
670             ::com::sun::star::ui::XUIConfigurationManager >&,
671 		const rtl::OUString& aModuleId,
672 		bool docConfig );
673 
674 	~ToolbarSaveInData();
675 
676 	void			CreateToolbar( SvxConfigEntry* pToolbar );
677 	void 			RestoreToolbar( SvxConfigEntry* pToolbar );
678 	void 			RemoveToolbar( SvxConfigEntry* pToolbar );
679 	void 			ApplyToolbar( SvxConfigEntry* pToolbar );
680 
681 	rtl::OUString	GetSystemUIName( const rtl::OUString& rResourceURL );
682 
683 	sal_Int32		GetSystemStyle( const rtl::OUString& rResourceURL );
684 
685 	void			SetSystemStyle(
686 		const rtl::OUString& rResourceURL, sal_Int32 nStyle );
687 
688 	void			SetSystemStyle(
689 		::com::sun::star::uno::Reference
690 			< ::com::sun::star::frame::XFrame > xFrame,
691 		const rtl::OUString& rResourceURL, sal_Int32 nStyle );
692 
693 	SvxEntries*		GetEntries();
694 	void 			SetEntries( SvxEntries* );
695 	bool			HasSettings();
696 	bool			HasURL( const rtl::OUString& rURL );
697 	void			Reset();
698 	bool			Apply();
699 };
700 
701 class SvxNewToolbarDialog : public ModalDialog
702 {
703 private:
704 	FixedText		aFtDescription;
705 	Edit			aEdtName;
706 	FixedText		aSaveInText;
707 	OKButton		aBtnOK;
708 	CancelButton	aBtnCancel;
709 	HelpButton		aBtnHelp;
710 
711     Link            aCheckNameHdl;
712 
713     DECL_LINK(ModifyHdl, Edit*);
714 
715 public:
716 	SvxNewToolbarDialog( Window* pWindow, const String& rName );
717 
718 	ListBox			aSaveInListBox;
719 
GetName(rtl::OUString & rName)720     void    GetName( rtl::OUString& rName ){rName = aEdtName.GetText();}
721 
SetCheckNameHdl(const Link & rLink,bool bCheckImmediately=false)722     void    SetCheckNameHdl( const Link& rLink, bool bCheckImmediately = false )
723     {
724         aCheckNameHdl = rLink;
725         if ( bCheckImmediately )
726             aBtnOK.Enable( rLink.Call( this ) > 0 );
727     }
728 
SetEditHelpId(const rtl::OString & aHelpId)729     void    SetEditHelpId( const rtl::OString& aHelpId) {aEdtName.SetHelpId(aHelpId);}
730 };
731 
732 class SvxIconSelectorDialog : public ModalDialog
733 {
734 private:
735 	FixedText		aFtDescription;
736 	ToolBox			aTbSymbol;
737 	FixedText		aFtNote;
738 	OKButton		aBtnOK;
739 	CancelButton	aBtnCancel;
740 	HelpButton		aBtnHelp;
741 	PushButton		aBtnImport;
742 	PushButton      aBtnDelete;
743 	FixedLine       aFlSeparator;
744     sal_uInt16      m_nNextId;
745 
746 	sal_Int32		m_nExpectedSize;
747 
748 	::com::sun::star::uno::Reference<
749 		::com::sun::star::ui::XImageManager > m_xImageManager;
750 
751 	::com::sun::star::uno::Reference<
752 		::com::sun::star::ui::XImageManager > m_xParentImageManager;
753 
754 	::com::sun::star::uno::Reference<
755 		::com::sun::star::ui::XImageManager > m_xImportedImageManager;
756 
757     ::com::sun::star::uno::Reference<
758 		::com::sun::star::graphic::XGraphicProvider > m_xGraphProvider;
759 
760     bool ReplaceGraphicItem( const ::rtl::OUString& aURL );
761 
762     bool ImportGraphic( const ::rtl::OUString& aURL );
763 
764 	void ImportGraphics(
765 		const com::sun::star::uno::Sequence< rtl::OUString >& aURLs );
766 
767     BitmapEx AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize);// Added by shizhoubo
768 
769 public:
770 
771 	SvxIconSelectorDialog(
772 		Window *pWindow,
773 		const ::com::sun::star::uno::Reference<
774 			::com::sun::star::ui::XImageManager >& rXImageManager,
775 		const ::com::sun::star::uno::Reference<
776 			::com::sun::star::ui::XImageManager >& rXParentImageManager
777 			);
778 
779 	~SvxIconSelectorDialog();
780 
781 	::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
782 		GetSelectedIcon();
783 
784 	DECL_LINK( SelectHdl, ToolBox * );
785 	DECL_LINK( ImportHdl, PushButton * );
786 	DECL_LINK( DeleteHdl, PushButton * );
787 };
788 
789 class SvxIconReplacementDialog : public MessBox
790 {
791 public:
792 	SvxIconReplacementDialog(
793 		Window *pWindow,
794 		const rtl::OUString& aMessage,
795 		bool aYestoAll);
796 
797 	SvxIconReplacementDialog(
798 		Window *pWindow,
799 		const rtl::OUString& aMessage );
800 
801 	rtl::OUString ReplaceIconName( const rtl::OUString& );
802 	sal_uInt16 ShowDialog();
803 };
804 //added for issue83555
805 class SvxIconChangeDialog : public ModalDialog
806 {
807 private:
808 	FixedImage		aFImageInfo;
809 	OKButton		aBtnOK;
810 	FixedText         aDescriptionLabel;
811 	SvxDescriptionEdit aLineEditDescription;
812 public:
813 	SvxIconChangeDialog(Window *pWindow, const rtl::OUString& aMessage);
814 };
815 #endif // _SVXCFG_HXX
816