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 :
20 : #ifndef _SDMOD_HXX
21 : #define _SDMOD_HXX
22 :
23 : #include "glob.hxx"
24 : #include "pres.hxx"
25 :
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>
33 :
34 : #include <memory>
35 :
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;
45 :
46 : namespace sd {
47 : class DrawDocShell;
48 : class SdGlobalResourceContainer;
49 : }
50 :
51 : namespace com { namespace sun { namespace star { namespace frame {
52 : class XFrame;
53 : } } } }
54 :
55 :
56 : // ----------------------
57 : // - SdOptionStreamMode -
58 : // ----------------------
59 :
60 : enum SdOptionStreamMode
61 : {
62 : SD_OPTION_LOAD = 0,
63 : SD_OPTION_STORE = 1
64 : };
65 :
66 : /*************************************************************************
67 : |*
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.
71 : |*
72 : |* SdModule is like to be compared with the <SfxApplication>-subclass.
73 : |*
74 : |* Remember: Don`t export this class! It uses DLL-internal symbols.
75 : |*
76 : \************************************************************************/
77 :
78 : class SdModule : public SfxModule, public SfxListener
79 : {
80 : public:
81 :
82 : TYPEINFO();
83 11 : SFX_DECL_INTERFACE(SD_IF_SDAPP)
84 : DECL_LINK( CalcFieldValueHdl, EditFieldInfo* );
85 :
86 : SdModule(SfxObjectFactory* pDrawObjFact, SfxObjectFactory* pGraphicObjFact);
87 : virtual ~SdModule();
88 :
89 : SdTransferable* pTransferClip;
90 : SdTransferable* pTransferDrag;
91 : SdTransferable* pTransferSelection;
92 :
93 : void Execute(SfxRequest& rReq);
94 : void GetState(SfxItemSet&);
95 :
96 : SdOptions* GetSdOptions(DocumentType eDocType);
97 : SD_DLLPUBLIC SvStorageStreamRef GetOptionStream( const String& rOptionName, SdOptionStreamMode eMode );
98 :
99 3504 : sal_Bool GetWaterCan() const { return bWaterCan; }
100 0 : void SetWaterCan( sal_Bool bWC ) { bWaterCan = bWC; }
101 :
102 0 : SvxSearchItem* GetSearchItem() { return (pSearchItem); }
103 0 : void SetSearchItem(SvxSearchItem* pItem) { pSearchItem = pItem; }
104 :
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.
110 : */
111 : OutputDevice* GetVirtualRefDevice (void);
112 :
113 : /** Deprecated alias to <member>GetVirtualRefDevice</member>.
114 : @param rDocShell
115 : Unused dummy parameter.
116 : */
117 : OutputDevice* GetRefDevice (::sd::DrawDocShell& rDocShell);
118 :
119 : SD_DLLPUBLIC SvNumberFormatter* GetNumberFormatter();
120 :
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 );
125 :
126 : protected:
127 :
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.
139 : */
140 : OutputDevice* mpVirtualRefDevice;
141 :
142 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
143 :
144 : private:
145 : SfxFrame* ExecuteNewDocument( SfxRequest& rReq );
146 :
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 );
150 :
151 : /** The resource container controls the lifetime of some singletons.
152 : */
153 : ::std::auto_ptr< ::sd::SdGlobalResourceContainer> mpResourceContainer;
154 :
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.
164 : */
165 : void AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument);
166 :
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.
172 : */
173 : void OutlineToImpress (SfxRequest& rRequest);
174 :
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 )
182 : */
183 : DECL_LINK( EventListenerHdl, VclSimpleEvent* );
184 :
185 : };
186 :
187 : #define SD_MOD() ( *(SdModule**) GetAppData(SHL_DRAW) )
188 :
189 : #endif // _SDMOD_HXX
190 :
191 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|