update credits
[LibreOffice.git] / sd / inc / sdmod.hxx
blob1eb11fe7f9e269c4af2d3bd6c45421ed9e6f48e4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SDMOD_HXX
21 #define _SDMOD_HXX
23 #include "glob.hxx"
24 #include "pres.hxx"
26 #include <sot/storage.hxx>
27 #include <tools/shl.hxx>
28 #include "sddllapi.h"
29 #include <svl/lstner.hxx>
30 #include <com/sun/star/text/WritingMode.hpp>
31 #include <sfx2/module.hxx>
32 #include <vcl/vclevent.hxx>
34 #include <memory>
36 class SdOptions;
37 class SvxSearchItem;
38 class EditFieldInfo;
39 class SdTransferable;
40 class SvNumberFormatter;
41 class SfxErrorHandler;
42 class OutputDevice;
43 class SdDrawDocument;
44 class SfxFrame;
46 namespace sd {
47 class DrawDocShell;
48 class SdGlobalResourceContainer;
51 namespace com { namespace sun { namespace star { namespace frame {
52 class XFrame;
53 } } } }
56 // ----------------------
57 // - SdOptionStreamMode -
58 // ----------------------
60 enum SdOptionStreamMode
62 SD_OPTION_LOAD = 0,
63 SD_OPTION_STORE = 1
66 /*************************************************************************
68 |* This subclass of <SfxModule> (which is a subclass of <SfxShell>) is
69 |* linked to the DLL. One instance of this class exists while the DLL is
70 |* loaded.
72 |* SdModule is like to be compared with the <SfxApplication>-subclass.
74 |* Remember: Don`t export this class! It uses DLL-internal symbols.
76 \************************************************************************/
78 class SdModule : public SfxModule, public SfxListener
80 public:
82 TYPEINFO();
83 SFX_DECL_INTERFACE(SD_IF_SDAPP)
84 DECL_LINK( CalcFieldValueHdl, EditFieldInfo* );
86 SdModule(SfxObjectFactory* pDrawObjFact, SfxObjectFactory* pGraphicObjFact);
87 virtual ~SdModule();
89 SdTransferable* pTransferClip;
90 SdTransferable* pTransferDrag;
91 SdTransferable* pTransferSelection;
93 void Execute(SfxRequest& rReq);
94 void GetState(SfxItemSet&);
96 SdOptions* GetSdOptions(DocumentType eDocType);
97 SD_DLLPUBLIC SvStorageStreamRef GetOptionStream( const String& rOptionName, SdOptionStreamMode eMode );
99 sal_Bool GetWaterCan() const { return bWaterCan; }
100 void SetWaterCan( sal_Bool bWC ) { bWaterCan = bWC; }
102 SvxSearchItem* GetSearchItem() { return (pSearchItem); }
103 void SetSearchItem(SvxSearchItem* pItem) { pSearchItem = pItem; }
105 /** Return the virtual device that can be used for printer independent
106 layout.
107 @return
108 The returned pointer is NULL when the device could not be
109 created when this modules was instantiated.
111 OutputDevice* GetVirtualRefDevice (void);
113 /** Deprecated alias to <member>GetVirtualRefDevice</member>.
114 @param rDocShell
115 Unused dummy parameter.
117 OutputDevice* GetRefDevice (::sd::DrawDocShell& rDocShell);
119 SD_DLLPUBLIC SvNumberFormatter* GetNumberFormatter();
121 // virtual methods for the option dialog
122 virtual SfxItemSet* CreateItemSet( sal_uInt16 nId );
123 virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
124 virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet );
126 protected:
128 SdOptions* pImpressOptions;
129 SdOptions* pDrawOptions;
130 SvxSearchItem* pSearchItem;
131 SvNumberFormatter* pNumberFormatter;
132 SvStorageRef xOptionStorage;
133 sal_Bool bAutoSave;
134 sal_Bool bWaterCan;
135 SfxErrorHandler* mpErrorHdl;
136 /** This device is used for printer independent layout. It is virtual
137 in the sense that it does not represent a printer. The pointer may
138 be NULL when the virtual device could not be created.
140 OutputDevice* mpVirtualRefDevice;
142 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
144 private:
145 SfxFrame* ExecuteNewDocument( SfxRequest& rReq );
147 static void ChangeMedium( ::sd::DrawDocShell* pDocShell, SfxViewFrame* pViewFrame, const sal_Int32 eMedium );
148 static SfxFrame* CreateEmptyDocument( DocumentType eDocType, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
149 static SfxFrame* CreateFromTemplate( const String& rTemplatePath, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
151 /** The resource container controls the lifetime of some singletons.
153 ::std::auto_ptr< ::sd::SdGlobalResourceContainer> mpResourceContainer;
155 /** Create a new summary page. When the document has been created in
156 the kiosk mode with automatical transitions then this method adds
157 this kind of transition to the new summary page.
158 @param pViewFrame
159 The view frame that is used to execute the slot for creating the
160 summary page.
161 @param pDocument
162 The document which will contain the summary page and from which
163 the information about the default transition is retrieved.
165 void AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument);
167 /** Take an outline from a text document and create a new impress
168 document according to the structure of the outline.
169 @param rRequest
170 This typically is the unmodified request from a execute()
171 function from where this function is called.
173 void OutlineToImpress (SfxRequest& rRequest);
175 /** Add an eventlistener as soon as possible in sd, allows to use
176 remote devices to start the slideshow elegantly, and respecting
177 portability
178 @EventListenerHdl
179 The event listener handler
180 @VclSimpleEvent *
181 a poiter to a VCLSimpleEvent (see vcl/vclevent.hxx )
183 DECL_LINK( EventListenerHdl, VclSimpleEvent* );
187 #define SD_MOD() ( *(SdModule**) GetAppData(SHL_DRAW) )
189 #endif // _SDMOD_HXX
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */