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 28 #ifndef _SDMOD_HXX 29 #define _SDMOD_HXX 30 31 32 #ifndef _SDDLL_HXX 33 #define _SD_DLL // fuer SD_MOD() 34 #include "sddll.hxx" // fuer SdModuleDummy 35 #endif 36 #include "glob.hxx" 37 #include "pres.hxx" 38 39 #include <sot/storage.hxx> 40 #include <tools/shl.hxx> 41 #include "sddllapi.h" 42 #include <svl/lstner.hxx> 43 #include <com/sun/star/text/WritingMode.hpp> 44 #include <sfx2/module.hxx> 45 #include <vcl/vclevent.hxx> 46 47 #ifndef INCLUDED_MEMORY 48 #include <memory> 49 #define INCLUDED_MEMORY 50 #endif 51 52 class SdOptions; 53 class BasicIDE; 54 class SvxSearchItem; 55 class SdAppLinkHdl; 56 class SvxErrorHandler; 57 class EditFieldInfo; 58 class SvFactory; 59 class SdTransferable; 60 class SvNumberFormatter; 61 class SfxErrorHandler; 62 class OutputDevice; 63 class SdPage; 64 class SdDrawDocument; 65 class SfxFrame; 66 67 namespace sd { 68 class DrawDocShell; 69 class SdGlobalResourceContainer; 70 } 71 72 namespace com { namespace sun { namespace star { namespace frame { 73 class XFrame; 74 } } } } 75 76 77 // ---------------------- 78 // - SdOptionStreamMode - 79 // ---------------------- 80 81 enum SdOptionStreamMode 82 { 83 SD_OPTION_LOAD = 0, 84 SD_OPTION_STORE = 1 85 }; 86 87 /************************************************************************* 88 |* 89 |* This subclass of <SfxModule> (which is a subclass of <SfxShell>) is 90 |* linked to the DLL. One instance of this class exists while the DLL is 91 |* loaded. 92 |* 93 |* SdModule is like to be compared with the <SfxApplication>-subclass. 94 |* 95 |* Remember: Don`t export this class! It uses DLL-internal symbols. 96 |* 97 \************************************************************************/ 98 99 class SdModule : public SfxModule, public SfxListener 100 { 101 public: 102 103 TYPEINFO(); 104 SFX_DECL_INTERFACE(SD_IF_SDAPP) 105 DECL_LINK( CalcFieldValueHdl, EditFieldInfo* ); 106 107 SdModule(SfxObjectFactory* pDrawObjFact, SfxObjectFactory* pGraphicObjFact); 108 virtual ~SdModule(); 109 110 SdTransferable* pTransferClip; 111 SdTransferable* pTransferDrag; 112 SdTransferable* pTransferSelection; 113 114 void Execute(SfxRequest& rReq); 115 void GetState(SfxItemSet&); 116 117 SdOptions* GetSdOptions(DocumentType eDocType); 118 SD_DLLPUBLIC SvStorageStreamRef GetOptionStream( const String& rOptionName, SdOptionStreamMode eMode ); 119 120 sal_Bool GetWaterCan() const { return bWaterCan; } 121 void SetWaterCan( sal_Bool bWC ) { bWaterCan = bWC; } 122 123 SvxSearchItem* GetSearchItem() { return (pSearchItem); } 124 void SetSearchItem(SvxSearchItem* pItem) { pSearchItem = pItem; } 125 126 /** Return the virtual device that can be used for printer independent 127 layout. 128 @return 129 The returned pointer is NULL when the device could not be 130 created when this modules was instantiated. 131 */ 132 OutputDevice* GetVirtualRefDevice (void); 133 134 /** Deprecated alias to <member>GetVirtualRefDevice</member>. 135 @param rDocShell 136 Unused dummy parameter. 137 */ 138 OutputDevice* GetRefDevice (::sd::DrawDocShell& rDocShell); 139 140 SD_DLLPUBLIC SvNumberFormatter* GetNumberFormatter(); 141 142 //virtuelle Methoden fuer den Optionendialog 143 virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ); 144 virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ); 145 virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet ); 146 147 protected: 148 149 SdOptions* pImpressOptions; 150 SdOptions* pDrawOptions; 151 SvxSearchItem* pSearchItem; 152 SvNumberFormatter* pNumberFormatter; 153 SvStorageRef xOptionStorage; 154 sal_Bool bAutoSave; 155 sal_Bool bWaterCan; 156 SfxErrorHandler* mpErrorHdl; 157 /** This device is used for printer independent layout. It is virtual 158 in the sense that it does not represent a printer. The pointer may 159 be NULL when the virtual device could not be created. 160 */ 161 OutputDevice* mpVirtualRefDevice; 162 163 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 164 165 private: 166 SfxFrame* ExecuteNewDocument( SfxRequest& rReq ); 167 168 static void ChangeMedium( ::sd::DrawDocShell* pDocShell, SfxViewFrame* pViewFrame, const sal_Int32 eMedium ); 169 static SfxFrame* CreateEmptyDocument( DocumentType eDocType, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ); 170 static SfxFrame* CreateFromTemplate( const String& rTemplatePath, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ); 171 172 /** The resource container controls the lifetime of some singletons. 173 */ 174 ::std::auto_ptr< ::sd::SdGlobalResourceContainer> mpResourceContainer; 175 176 /** Create a new summary page. When the document has been created in 177 the kiosk mode with automatical transitions then this method adds 178 this kind of transition to the new summary page. 179 @param pViewFrame 180 The view frame that is used to execute the slot for creating the 181 summary page. 182 @param pDocument 183 The document which will contain the summary page and from which 184 the information about the default transition is retrieved. 185 */ 186 void AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument); 187 188 /** Take an outline from a text document and create a new impress 189 document according to the structure of the outline. 190 @param rRequest 191 This typically is the unmodified request from a execute() 192 function from where this function is called. 193 */ 194 void OutlineToImpress (SfxRequest& rRequest); 195 196 /** Add an eventlistener as soon as possible in sd, allows to use 197 remote devices to start the slideshow elegantly, and respecting 198 portability 199 @EventListenerHdl 200 The event listener handler 201 @VclSimpleEvent * 202 a poiter to a VCLSimpleEvent (see vcl/vclevent.hxx ) 203 */ 204 DECL_LINK( EventListenerHdl, VclSimpleEvent* ); 205 206 }; 207 208 209 210 211 #ifndef SD_MOD 212 #define SD_MOD() ( *(SdModule**) GetAppData(SHL_DRAW) ) 213 #endif 214 215 #endif // _SDMOD_HXX 216 217