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