LCOV - code coverage report
Current view: top level - cui/source/inc - cfg.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 48 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 45 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11