1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _MACROPG_HXX 28 #define _MACROPG_HXX 29 30 #include <sfx2/basedlgs.hxx> 31 #include <sfx2/tabdlg.hxx> 32 33 #include <com/sun/star/container/XNameReplace.hpp> 34 #include <com/sun/star/util/XModifiable.hpp> 35 #include <com/sun/star/beans/PropertyValue.hpp> 36 #include <com/sun/star/uno/Reference.hxx> 37 #include <svl/macitem.hxx> 38 #ifndef _LSTBOX_HXX //autogen 39 #include <vcl/lstbox.hxx> 40 #endif 41 #include <rtl/ustring.hxx> 42 43 #include <hash_map> 44 #include <vector> 45 46 typedef ::std::hash_map< ::rtl::OUString, ::std::pair< ::rtl::OUString, ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventsHash; 47 48 struct EventDisplayName 49 { 50 const sal_Char* pAsciiEventName; 51 sal_uInt16 nEventResourceID; 52 EventDisplayName() : pAsciiEventName( NULL ), nEventResourceID(0) { } 53 EventDisplayName( const sal_Char* _pAsciiName, const sal_uInt16 _nResId ) 54 : pAsciiEventName( _pAsciiName ) 55 , nEventResourceID( _nResId ) 56 { 57 } 58 }; 59 typedef ::std::vector< EventDisplayName > EventDisplayNames; 60 61 class _SvxMacroTabPage; 62 class SvStringsDtor; 63 class SvTabListBox; 64 class Edit; 65 class String; 66 67 class _HeaderTabListBox; 68 class _SvxMacroTabPage_Impl; 69 70 71 class _SvxMacroTabPage : public SfxTabPage 72 { 73 #if _SOLAR__PRIVATE 74 DECL_STATIC_LINK( _SvxMacroTabPage, SelectEvent_Impl, SvTabListBox * ); 75 DECL_STATIC_LINK( _SvxMacroTabPage, AssignDeleteHdl_Impl, PushButton * ); 76 DECL_STATIC_LINK( _SvxMacroTabPage, DoubleClickHdl_Impl, SvTabListBox * ); 77 78 static long GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton* pBtn ); 79 80 #endif 81 protected: 82 _SvxMacroTabPage_Impl* mpImpl; 83 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xAppEvents; 84 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xDocEvents; 85 ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > m_xModifiable; 86 EventsHash m_appEventsHash; 87 EventsHash m_docEventsHash; 88 bool bReadOnly, bDocModified, bAppEvents, bInitialized; 89 EventDisplayNames aDisplayNames; 90 91 _SvxMacroTabPage( Window* pParent, const ResId& rId, const SfxItemSet& rItemSet ); 92 93 void EnableButtons(); 94 ::com::sun::star::uno::Any GetPropsByName( const ::rtl::OUString& eventName, EventsHash& eventsHash ); 95 ::std::pair< ::rtl::OUString, ::rtl::OUString > GetPairFromAny( ::com::sun::star::uno::Any aAny ); 96 97 public: 98 99 virtual ~_SvxMacroTabPage(); 100 void InitResources(); 101 102 void InitAndSetHandler( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xAppEvents, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xDocEvents, ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > xModifiable ); 103 virtual sal_Bool FillItemSet( SfxItemSet& rSet ); 104 105 using SfxTabPage::Reset; 106 virtual void Reset(); 107 108 void DisplayAppEvents( bool appEvents); 109 void SetReadOnly( sal_Bool bSet ); 110 sal_Bool IsReadOnly() const; 111 }; 112 113 class SvxMacroTabPage : public _SvxMacroTabPage 114 { 115 public: 116 SvxMacroTabPage( 117 Window* pParent, 118 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame, 119 const SfxItemSet& rSet, 120 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xNameReplace, 121 sal_uInt16 nSelectedIndex 122 ); 123 virtual ~SvxMacroTabPage(); 124 }; 125 126 // class SvxMacroAssignDlg -------------------------------------------------- 127 128 typedef sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Werte 129 130 class SvxMacroAssignSingleTabDialog : public SfxModalDialog 131 { 132 public: 133 SvxMacroAssignSingleTabDialog( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId ); 134 135 virtual ~SvxMacroAssignSingleTabDialog(); 136 137 void SetTabPage( SfxTabPage* pTabPage ); 138 // SfxTabPage* GetTabPage() const { return pPage; } 139 140 // OKButton* GetOKButton() const { return pOKBtn; } 141 // CancelButton* GetCancelButton() const { return pCancelBtn; } 142 143 private: 144 SfxViewFrame* pFrame; 145 146 FixedLine* pFixedLine; 147 148 OKButton* pOKBtn; 149 CancelButton* pCancelBtn; 150 HelpButton* pHelpBtn; 151 152 SfxTabPage* pPage; 153 const SfxItemSet* pOptions; 154 SfxItemSet* pOutSet; 155 156 #if _SOLAR__PRIVATE 157 DECL_DLLPRIVATE_LINK( OKHdl_Impl, Button * ); 158 #endif 159 }; 160 161 162 class SvxMacroAssignDlg : public SvxMacroAssignSingleTabDialog 163 { 164 public: 165 SvxMacroAssignDlg( 166 Window* pParent, 167 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame, 168 const SfxItemSet& rSet, 169 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace >& xNameReplace, 170 sal_uInt16 nSelectedIndex 171 ); 172 virtual ~SvxMacroAssignDlg(); 173 }; 174 175 #endif 176