Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SVXCFG_HXX
29 : : #define _SVXCFG_HXX
30 : :
31 : : #include <vcl/lstbox.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 : : #include <sfx2/minarray.hxx>
53 : : #include <sfx2/tabdlg.hxx>
54 : : #include <vector>
55 : : #include <vcl/msgbox.hxx>
56 : :
57 : : #include "selector.hxx"
58 : :
59 : : class SvxConfigEntry;
60 : : class SvxConfigPage;
61 : : class SvxMenuConfigPage;
62 : : class SvxToolbarConfigPage;
63 : :
64 : : typedef std::vector< SvxConfigEntry* > SvxEntries;
65 : :
66 : : class SvxConfigDialog : public SfxTabDialog
67 : : {
68 : : private:
69 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
70 : :
71 : : public:
72 : : SvxConfigDialog( Window*, const SfxItemSet* );
73 : : ~SvxConfigDialog();
74 : :
75 : : virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
76 : : virtual short Ok();
77 : :
78 : : void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
79 : : };
80 : :
81 : : class SaveInData : public ImageProvider
82 : : {
83 : : private:
84 : :
85 : : bool bModified;
86 : :
87 : : bool bDocConfig;
88 : : bool bReadOnly;
89 : :
90 : : ::com::sun::star::uno::Reference
91 : : < com::sun::star::ui::XUIConfigurationManager > m_xCfgMgr;
92 : :
93 : : ::com::sun::star::uno::Reference
94 : : < com::sun::star::ui::XUIConfigurationManager > m_xParentCfgMgr;
95 : :
96 : : ::com::sun::star::uno::Reference
97 : : < com::sun::star::ui::XImageManager > m_xImgMgr;
98 : :
99 : : ::com::sun::star::uno::Reference
100 : : < com::sun::star::ui::XImageManager > m_xParentImgMgr;
101 : :
102 : : static ::com::sun::star::uno::Reference
103 : : < com::sun::star::ui::XImageManager >* xDefaultImgMgr;
104 : :
105 : : public:
106 : :
107 : : SaveInData(
108 : : const ::com::sun::star::uno::Reference <
109 : : ::com::sun::star::ui::XUIConfigurationManager >& xCfgMgr,
110 : : const ::com::sun::star::uno::Reference <
111 : : ::com::sun::star::ui::XUIConfigurationManager >& xParentCfgMgr,
112 : : const rtl::OUString& aModuleId,
113 : : bool docConfig );
114 : :
115 [ # # ][ # # ]: 0 : ~SaveInData() {}
116 : :
117 : : bool PersistChanges(
118 : : const com::sun::star::uno::Reference
119 : : < com::sun::star::uno::XInterface >& xManager );
120 : :
121 : 0 : void SetModified( bool bValue = sal_True ) { bModified = bValue; }
122 : 0 : bool IsModified( ) { return bModified; }
123 : :
124 : 0 : bool IsReadOnly( ) { return bReadOnly; }
125 : 0 : bool IsDocConfig( ) { return bDocConfig; }
126 : :
127 : : ::com::sun::star::uno::Reference
128 : : < ::com::sun::star::ui::XUIConfigurationManager >
129 : 0 : GetConfigManager() { return m_xCfgMgr; };
130 : :
131 : : ::com::sun::star::uno::Reference
132 : : < ::com::sun::star::ui::XUIConfigurationManager >
133 : 0 : GetParentConfigManager() { return m_xParentCfgMgr; };
134 : :
135 : : ::com::sun::star::uno::Reference
136 : : < ::com::sun::star::ui::XImageManager >
137 : 0 : GetImageManager() { return m_xImgMgr; };
138 : :
139 : : ::com::sun::star::uno::Reference
140 : : < ::com::sun::star::ui::XImageManager >
141 : 0 : GetParentImageManager() { return m_xParentImgMgr; };
142 : :
143 : : ::com::sun::star::uno::Reference
144 : : < com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
145 : :
146 : : ::com::sun::star::uno::Reference
147 : : < com::sun::star::container::XNameAccess > m_xCommandToLabelMap;
148 : :
149 : : com::sun::star::uno::Reference
150 : : < com::sun::star::uno::XComponentContext > m_xComponentContext;
151 : :
152 : : com::sun::star::uno::Sequence
153 : : < com::sun::star::beans::PropertyValue > m_aSeparatorSeq;
154 : :
155 : : Image GetImage( const rtl::OUString& rCommandURL );
156 : :
157 : : virtual bool HasURL( const rtl::OUString& aURL ) = 0;
158 : : virtual bool HasSettings() = 0;
159 : : virtual SvxEntries* GetEntries() = 0;
160 : : virtual void SetEntries( SvxEntries* ) = 0;
161 : : virtual void Reset() = 0;
162 : : virtual bool Apply() = 0;
163 : : };
164 : :
165 : : class MenuSaveInData : public SaveInData
166 : : {
167 : : private:
168 : :
169 : : rtl::OUString m_aMenuResourceURL;
170 : : rtl::OUString m_aDescriptorContainer;
171 : :
172 : : ::com::sun::star::uno::Reference
173 : : < com::sun::star::container::XIndexAccess > m_xMenuSettings;
174 : :
175 : : SvxConfigEntry* pRootEntry;
176 : :
177 : :
178 : : static MenuSaveInData* pDefaultData; ///< static holder of the default menu data
179 : :
180 : 0 : static void SetDefaultData( MenuSaveInData* pData ) {pDefaultData = pData;}
181 : 0 : static MenuSaveInData* GetDefaultData() { return pDefaultData; }
182 : :
183 : : void Apply( bool bDefault );
184 : :
185 : : void Apply(
186 : : SvxConfigEntry* pRootEntry,
187 : : com::sun::star::uno::Reference<
188 : : com::sun::star::container::XIndexContainer >& rNewMenuBar,
189 : : com::sun::star::uno::Reference<
190 : : com::sun::star::lang::XSingleComponentFactory >& rFactory,
191 : : SvLBoxEntry *pParent = NULL );
192 : :
193 : : void ApplyMenu(
194 : : com::sun::star::uno::Reference<
195 : : com::sun::star::container::XIndexContainer >& rNewMenuBar,
196 : : com::sun::star::uno::Reference<
197 : : com::sun::star::lang::XSingleComponentFactory >& rFactory,
198 : : SvxConfigEntry *pMenuData = NULL );
199 : :
200 : : bool LoadSubMenus(
201 : : const ::com::sun::star::uno::Reference<
202 : : com::sun::star::container::XIndexAccess >& xMenuBarSettings,
203 : : const rtl::OUString& rBaseTitle, SvxConfigEntry* pParentData );
204 : :
205 : : public:
206 : :
207 : : MenuSaveInData(
208 : : const ::com::sun::star::uno::Reference <
209 : : ::com::sun::star::ui::XUIConfigurationManager >&,
210 : : const ::com::sun::star::uno::Reference <
211 : : ::com::sun::star::ui::XUIConfigurationManager >&,
212 : : const rtl::OUString& aModuleId,
213 : : bool docConfig );
214 : :
215 : : ~MenuSaveInData();
216 : :
217 : : /// methods inherited from SaveInData
218 : : SvxEntries* GetEntries();
219 : : void SetEntries( SvxEntries* );
220 : 0 : bool HasURL( const rtl::OUString& URL ) { (void)URL; return sal_False; }
221 : 0 : bool HasSettings() { return m_xMenuSettings.is(); }
222 : : void Reset();
223 : : bool Apply();
224 : : };
225 : :
226 : : class SvxConfigEntry
227 : : {
228 : : private:
229 : :
230 : : /// common properties
231 : : sal_uInt16 nId;
232 : : ::rtl::OUString aHelpText;
233 : : ::rtl::OUString aLabel;
234 : : ::rtl::OUString aCommand;
235 : : ::rtl::OUString aHelpURL;
236 : :
237 : : bool bPopUp;
238 : : bool bStrEdited;
239 : : bool bIsUserDefined;
240 : : bool bIsMain;
241 : : bool bIsDeletable;
242 : : bool bIsMovable;
243 : : bool bIsParentData;
244 : :
245 : : /// toolbar specific properties
246 : : bool bIsVisible;
247 : : sal_Int32 nStyle;
248 : :
249 : : ::com::sun::star::uno::Reference<
250 : : ::com::sun::star::graphic::XGraphic > xBackupGraphic;
251 : :
252 : : SvxEntries *pEntries;
253 : :
254 : : public:
255 : :
256 : : SvxConfigEntry( const ::rtl::OUString& rDisplayName,
257 : : const ::rtl::OUString& rCommandURL,
258 : : bool bPopup = sal_False,
259 : : bool bParentData = sal_False );
260 : :
261 : 0 : SvxConfigEntry()
262 : : :
263 : : nId( 0 ),
264 : : bPopUp( sal_False ),
265 : : bStrEdited( sal_False ),
266 : : bIsUserDefined( sal_False ),
267 : : bIsMain( sal_False ),
268 : : bIsParentData( sal_False ),
269 : : bIsVisible( sal_True ),
270 : : nStyle( 0 ),
271 : 0 : pEntries( 0 )
272 : 0 : {}
273 : :
274 : : ~SvxConfigEntry();
275 : :
276 : 0 : const ::rtl::OUString& GetCommand() const { return aCommand; }
277 : : void SetCommand( const String& rCmd ) { aCommand = rCmd; }
278 : :
279 : 0 : const ::rtl::OUString& GetName() const { return aLabel; }
280 : 0 : void SetName( const String& rStr ) { aLabel = rStr; bStrEdited = sal_True; }
281 : 0 : bool HasChangedName() const { return bStrEdited; }
282 : :
283 : : const ::rtl::OUString& GetHelpText() ;
284 : : void SetHelpText( const String& rStr ) { aHelpText = rStr; }
285 : :
286 : : const ::rtl::OUString& GetHelpURL() const { return aHelpURL; }
287 : : void SetHelpURL( const String& rStr ) { aHelpURL = rStr; }
288 : :
289 : : void SetPopup( bool bOn = sal_True ) { bPopUp = bOn; }
290 : 0 : bool IsPopup() const { return bPopUp; }
291 : :
292 : 0 : void SetUserDefined( bool bOn = sal_True ) { bIsUserDefined = bOn; }
293 : 0 : bool IsUserDefined() const { return bIsUserDefined; }
294 : :
295 : 0 : bool IsBinding() const { return !bPopUp; }
296 : 0 : bool IsSeparator() const { return nId == 0; }
297 : :
298 : 0 : SvxEntries* GetEntries() const { return pEntries; }
299 : 0 : void SetEntries( SvxEntries* entries ) { pEntries = entries; }
300 : : bool HasEntries() const { return pEntries != NULL; }
301 : :
302 : 0 : void SetMain( bool bValue = sal_True ) { bIsMain = bValue; }
303 : 0 : bool IsMain() { return bIsMain; }
304 : :
305 : 0 : void SetParentData( bool bValue = sal_True ) { bIsParentData = bValue; }
306 : 0 : bool IsParentData() { return bIsParentData; }
307 : :
308 : : bool IsMovable();
309 : : bool IsDeletable();
310 : : bool IsRenamable();
311 : :
312 : 0 : void SetVisible( bool b ) { bIsVisible = b; }
313 : 0 : bool IsVisible() const { return bIsVisible; }
314 : :
315 : 0 : void SetBackupGraphic(
316 : : ::com::sun::star::uno::Reference<
317 : : ::com::sun::star::graphic::XGraphic > graphic )
318 : 0 : { xBackupGraphic = graphic; }
319 : :
320 : : ::com::sun::star::uno::Reference<
321 : : ::com::sun::star::graphic::XGraphic >
322 : 0 : GetBackupGraphic()
323 : 0 : { return xBackupGraphic; }
324 : :
325 : 0 : bool IsIconModified() { return xBackupGraphic.is(); }
326 : :
327 : 0 : sal_Int32 GetStyle() { return nStyle; }
328 : 0 : void SetStyle( sal_Int32 style ) { nStyle = style; }
329 : : };
330 : :
331 : : class SvxMenuEntriesListBox : public SvTreeListBox
332 : : {
333 : : private:
334 : : SvxConfigPage* pPage;
335 : :
336 : : protected:
337 : : bool m_bIsInternalDrag;
338 : :
339 : : public:
340 : : SvxMenuEntriesListBox( Window*, const ResId& );
341 : : ~SvxMenuEntriesListBox();
342 : :
343 : : virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
344 : :
345 : : virtual sal_Bool NotifyAcceptDrop( SvLBoxEntry* pEntry );
346 : :
347 : : virtual sal_Bool NotifyMoving( SvLBoxEntry*, SvLBoxEntry*,
348 : : SvLBoxEntry*&, sal_uLong& );
349 : :
350 : : virtual sal_Bool NotifyCopying( SvLBoxEntry*, SvLBoxEntry*,
351 : : SvLBoxEntry*&, sal_uLong&);
352 : :
353 : : virtual DragDropMode NotifyStartDrag(
354 : : TransferDataContainer&, SvLBoxEntry* );
355 : :
356 : : virtual void DragFinished( sal_Int8 );
357 : :
358 : : void KeyInput( const KeyEvent& rKeyEvent );
359 : : };
360 : :
361 : : class SvxDescriptionEdit : public ExtMultiLineEdit
362 : : {
363 : : private:
364 : : Rectangle m_aRealRect;
365 : :
366 : : public:
367 : : SvxDescriptionEdit( Window* pParent, const ResId& _rId );
368 [ # # ]: 0 : inline ~SvxDescriptionEdit() {}
369 : :
370 : : void SetNewText( const String& _rText );
371 [ # # ]: 0 : inline void Clear() { SetNewText( String() ); }
372 : : };
373 : :
374 : : class SvxConfigPage : public SfxTabPage
375 : : {
376 : : private:
377 : :
378 : : bool bInitialised;
379 : : SaveInData* pCurrentSaveInData;
380 : :
381 : : DECL_LINK( SelectSaveInLocation, ListBox * );
382 : : DECL_LINK( AsyncInfoMsg, String* );
383 : :
384 : : bool SwapEntryData( SvLBoxEntry* pSourceEntry, SvLBoxEntry* pTargetEntry );
385 : : void AlignControls();
386 : :
387 : : protected:
388 : :
389 : : // the top section of the tab page where top level menus and toolbars
390 : : // are displayed in a listbox
391 : : FixedLine aTopLevelSeparator;
392 : : FixedText aTopLevelLabel;
393 : : ListBox aTopLevelListBox;
394 : : PushButton aNewTopLevelButton;
395 : : MenuButton aModifyTopLevelButton;
396 : :
397 : : // the contents section where the contents of the selected
398 : : // menu or toolbar are displayed
399 : : FixedLine aContentsSeparator;
400 : : FixedText aContentsLabel;
401 : : SvTreeListBox* aContentsListBox;
402 : :
403 : : PushButton aAddCommandsButton;
404 : : MenuButton aModifyCommandButton;
405 : :
406 : : ImageButton aMoveUpButton;
407 : : ImageButton aMoveDownButton;
408 : :
409 : : FixedText aSaveInText;
410 : : ListBox aSaveInListBox;
411 : :
412 : : FixedText aDescriptionLabel;
413 : : SvxDescriptionEdit aDescriptionField;
414 : :
415 : : SvxScriptSelectorDialog* pSelectorDlg;
416 : :
417 : : /// the ResourceURL to select when opening the dialog
418 : : rtl::OUString m_aURLToSelect;
419 : :
420 : : ::com::sun::star::uno::Reference
421 : : < ::com::sun::star::frame::XFrame > m_xFrame;
422 : :
423 : : SvxConfigPage( Window*, const SfxItemSet& );
424 : : virtual ~SvxConfigPage();
425 : :
426 : : DECL_LINK( MoveHdl, Button * );
427 : :
428 : : virtual SaveInData* CreateSaveInData(
429 : : const ::com::sun::star::uno::Reference <
430 : : ::com::sun::star::ui::XUIConfigurationManager >&,
431 : : const ::com::sun::star::uno::Reference <
432 : : ::com::sun::star::ui::XUIConfigurationManager >&,
433 : : const rtl::OUString& aModuleId,
434 : : bool docConfig ) = 0;
435 : :
436 : : virtual void Init() = 0;
437 : : virtual void UpdateButtonStates() = 0;
438 : : virtual short QueryReset() = 0;
439 : :
440 : : void PositionContentsListBox();
441 : :
442 : : SvLBoxEntry* InsertEntry( SvxConfigEntry* pNewEntryData,
443 : : SvLBoxEntry* pTarget = NULL,
444 : : bool bFront = sal_False );
445 : :
446 : : void AddSubMenusToUI( const String& rBaseTitle,
447 : : SvxConfigEntry* pParentData );
448 : :
449 : : SvLBoxEntry* InsertEntryIntoUI ( SvxConfigEntry* pNewEntryData,
450 : : sal_uLong nPos = LIST_APPEND );
451 : :
452 : : SvxEntries* FindParentForChild( SvxEntries* pParentEntries,
453 : : SvxConfigEntry* pChildData );
454 : :
455 : : void ReloadTopLevelListBox( SvxConfigEntry* pSelection = NULL );
456 : :
457 : : public:
458 : :
459 : : static bool CanConfig( const ::rtl::OUString& rModuleId );
460 : :
461 : 0 : SaveInData* GetSaveInData() { return pCurrentSaveInData; }
462 : :
463 : : SvLBoxEntry* AddFunction( SvLBoxEntry* pTarget = NULL,
464 : : bool bFront = sal_False,
465 : : bool bAllowDuplicates = sal_False );
466 : :
467 : : virtual void MoveEntry( bool bMoveUp );
468 : :
469 : : bool MoveEntryData( SvLBoxEntry* pSourceEntry,
470 : : SvLBoxEntry* pTargetEntry );
471 : :
472 : : sal_Bool FillItemSet( SfxItemSet& );
473 : : void Reset( const SfxItemSet& );
474 : :
475 : : virtual bool DeleteSelectedContent() = 0;
476 : : virtual void DeleteSelectedTopLevel() = 0;
477 : :
478 : 0 : SvxConfigEntry* GetTopLevelSelection()
479 : : {
480 : : return (SvxConfigEntry*) aTopLevelListBox.GetEntryData(
481 : 0 : aTopLevelListBox.GetSelectEntryPos() );
482 : : }
483 : :
484 : : /** identifies the module in the given frame. If the frame is <NULL/>, a default
485 : : frame will be determined beforehand.
486 : :
487 : : If the given frame is <NULL/>, a default frame will be used: The method the active
488 : : frame of the desktop, then the current frame. If both are <NULL/>,
489 : : the SfxViewFrame::Current's XFrame is used. If this is <NULL/>, too, an empty string is returned.
490 : :
491 : : If the given frame is not <NULL/>, or an default frame could be successfully determined, then
492 : : the ModuleManager is asked for the module ID of the component in the frame.
493 : : */
494 : : static ::rtl::OUString
495 : : GetFrameWithDefaultAndIdentify( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _inout_rxFrame );
496 : : };
497 : :
498 : : class SvxMenuConfigPage : public SvxConfigPage
499 : : {
500 : : private:
501 : :
502 : : DECL_LINK( SelectMenu, ListBox * );
503 : : DECL_LINK( SelectMenuEntry, Control * );
504 : : DECL_LINK( NewMenuHdl, Button * );
505 : : DECL_LINK( MenuSelectHdl, MenuButton * );
506 : : DECL_LINK( EntrySelectHdl, MenuButton * );
507 : : DECL_LINK( AddCommandsHdl, Button * );
508 : : DECL_LINK( AddFunctionHdl, SvxScriptSelectorDialog * );
509 : :
510 : : void Init();
511 : : void UpdateButtonStates();
512 : : short QueryReset();
513 : : bool DeleteSelectedContent();
514 : : void DeleteSelectedTopLevel();
515 : :
516 : : public:
517 : : SvxMenuConfigPage( Window *pParent, const SfxItemSet& rItemSet );
518 : : ~SvxMenuConfigPage();
519 : :
520 : : SaveInData* CreateSaveInData(
521 : : const ::com::sun::star::uno::Reference <
522 : : ::com::sun::star::ui::XUIConfigurationManager >&,
523 : : const ::com::sun::star::uno::Reference <
524 : : ::com::sun::star::ui::XUIConfigurationManager >&,
525 : : const rtl::OUString& aModuleId,
526 : : bool docConfig );
527 : : };
528 : :
529 : : class SvxMainMenuOrganizerDialog : public ModalDialog
530 : : {
531 : : FixedText aMenuNameText;
532 : : Edit aMenuNameEdit;
533 : : FixedText aMenuListText;
534 : : SvTreeListBox aMenuListBox;
535 : : ImageButton aMoveUpButton;
536 : : ImageButton aMoveDownButton;
537 : : OKButton aOKButton;
538 : : CancelButton aCloseButton;
539 : : HelpButton aHelpButton;
540 : :
541 : : SvxEntries* pEntries;
542 : : SvLBoxEntry* pNewMenuEntry;
543 : : bool bModified;
544 : :
545 : : void UpdateButtonStates();
546 : :
547 : : DECL_LINK( MoveHdl, Button * );
548 : : DECL_LINK( ModifyHdl, Edit * );
549 : : DECL_LINK( SelectHdl, Control* );
550 : :
551 : : public:
552 : : SvxMainMenuOrganizerDialog (
553 : : Window*, SvxEntries*,
554 : : SvxConfigEntry*, bool bCreateMenu = sal_False );
555 : :
556 : : ~SvxMainMenuOrganizerDialog ();
557 : :
558 : : SvxEntries* GetEntries();
559 : : void SetEntries( SvxEntries* );
560 : : SvxConfigEntry* GetSelectedEntry();
561 : : };
562 : :
563 : : class SvxToolbarEntriesListBox : public SvxMenuEntriesListBox
564 : : {
565 : : Size m_aCheckBoxImageSizePixel;
566 : : Link m_aChangedListener;
567 : : SvLBoxButtonData* m_pButtonData;
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 : :
587 : : void SetChangedListener( const Link& aChangedListener )
588 : : { m_aChangedListener = aChangedListener; }
589 : :
590 : : const Link& GetChangedListener() const { return m_aChangedListener; }
591 : :
592 : : 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 [ # # ][ # # ]: 0 : 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 : :
720 [ # # ]: 0 : void GetName( rtl::OUString& rName ){rName = aEdtName.GetText();}
721 : :
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 : :
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 : : public:
768 : :
769 : : SvxIconSelectorDialog(
770 : : Window *pWindow,
771 : : const ::com::sun::star::uno::Reference<
772 : : ::com::sun::star::ui::XImageManager >& rXImageManager,
773 : : const ::com::sun::star::uno::Reference<
774 : : ::com::sun::star::ui::XImageManager >& rXParentImageManager
775 : : );
776 : :
777 : : ~SvxIconSelectorDialog();
778 : :
779 : : ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
780 : : GetSelectedIcon();
781 : :
782 : : DECL_LINK( SelectHdl, ToolBox * );
783 : : DECL_LINK( ImportHdl, PushButton * );
784 : : DECL_LINK( DeleteHdl, PushButton * );
785 : : };
786 : :
787 [ # # ]: 0 : class SvxIconReplacementDialog : public MessBox
788 : : {
789 : : public:
790 : : SvxIconReplacementDialog(
791 : : Window *pWindow,
792 : : const rtl::OUString& aMessage,
793 : : bool aYestoAll);
794 : :
795 : : SvxIconReplacementDialog(
796 : : Window *pWindow,
797 : : const rtl::OUString& aMessage );
798 : :
799 : : rtl::OUString ReplaceIconName( const rtl::OUString& );
800 : : sal_uInt16 ShowDialog();
801 : : };
802 : : //added for issue83555
803 [ # # ][ # # ]: 0 : class SvxIconChangeDialog : public ModalDialog
[ # # ][ # # ]
[ # # ]
804 : : {
805 : : private:
806 : : FixedImage aFImageInfo;
807 : : OKButton aBtnOK;
808 : : FixedText aDescriptionLabel;
809 : : SvxDescriptionEdit aLineEditDescription;
810 : : public:
811 : : SvxIconChangeDialog(Window *pWindow, const rtl::OUString& aMessage);
812 : : };
813 : : #endif // _SVXCFG_HXX
814 : :
815 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|