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