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