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 INCLUDED_SD_INC_SDMOD_HXX
21 : #define INCLUDED_SD_INC_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 : #include <sal/types.h>
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 : enum SdOptionStreamMode
56 : {
57 : SD_OPTION_LOAD = 0,
58 : SD_OPTION_STORE = 1
59 : };
60 :
61 : /*
62 :
63 : This subclass of <SfxModule> (which is a subclass of <SfxShell>) is
64 : linked to the DLL. One instance of this class exists while the DLL is
65 : loaded.
66 :
67 : SdModule is like to be compared with the <SfxApplication>-subclass.
68 :
69 : Remember: Don`t export this class! It uses DLL-internal symbols.
70 :
71 : */
72 :
73 : class SdModule : public SfxModule, public SfxListener
74 : {
75 : public:
76 :
77 : TYPEINFO_OVERRIDE();
78 0 : SFX_DECL_INTERFACE(SD_IF_SDAPP)
79 : DECL_LINK( CalcFieldValueHdl, EditFieldInfo* );
80 :
81 : SdModule(SfxObjectFactory* pDrawObjFact, SfxObjectFactory* pGraphicObjFact);
82 : virtual ~SdModule();
83 :
84 : SdTransferable* pTransferClip;
85 : SdTransferable* pTransferDrag;
86 : SdTransferable* pTransferSelection;
87 :
88 : void Execute(SfxRequest& rReq);
89 : void GetState(SfxItemSet&);
90 :
91 : SdOptions* GetSdOptions(DocumentType eDocType);
92 : SD_DLLPUBLIC SvStorageStreamRef GetOptionStream( const OUString& rOptionName, SdOptionStreamMode eMode );
93 :
94 0 : sal_Bool GetWaterCan() const { return bWaterCan; }
95 0 : void SetWaterCan( sal_Bool bWC ) { bWaterCan = bWC; }
96 :
97 0 : SvxSearchItem* GetSearchItem() { return (pSearchItem); }
98 0 : void SetSearchItem(SvxSearchItem* pItem) { pSearchItem = pItem; }
99 :
100 : /** Return the virtual device that can be used for printer independent
101 : layout.
102 : @return
103 : The returned pointer is NULL when the device could not be
104 : created when this modules was instantiated.
105 : */
106 : OutputDevice* GetVirtualRefDevice (void);
107 :
108 : /** Deprecated alias to <member>GetVirtualRefDevice</member>.
109 : @param rDocShell
110 : Unused dummy parameter.
111 : */
112 : OutputDevice* GetRefDevice (::sd::DrawDocShell& rDocShell);
113 :
114 : SD_DLLPUBLIC SvNumberFormatter* GetNumberFormatter();
115 :
116 : // virtual methods for the option dialog
117 : virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) SAL_OVERRIDE;
118 : virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
119 : virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
120 :
121 : protected:
122 :
123 : SdOptions* pImpressOptions;
124 : SdOptions* pDrawOptions;
125 : SvxSearchItem* pSearchItem;
126 : SvNumberFormatter* pNumberFormatter;
127 : SvStorageRef xOptionStorage;
128 : sal_Bool bWaterCan;
129 : SfxErrorHandler* mpErrorHdl;
130 : /** This device is used for printer independent layout. It is virtual
131 : in the sense that it does not represent a printer. The pointer may
132 : be NULL when the virtual device could not be created.
133 : */
134 : OutputDevice* mpVirtualRefDevice;
135 :
136 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
137 :
138 : private:
139 : SfxFrame* ExecuteNewDocument( SfxRequest& rReq );
140 :
141 : static void ChangeMedium( ::sd::DrawDocShell* pDocShell, SfxViewFrame* pViewFrame, const sal_Int32 eMedium );
142 : static SfxFrame* CreateEmptyDocument( DocumentType eDocType, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
143 : static SfxFrame* CreateFromTemplate( const OUString& rTemplatePath, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
144 :
145 : /** The resource container controls the lifetime of some singletons.
146 : */
147 : ::std::auto_ptr< ::sd::SdGlobalResourceContainer> mpResourceContainer;
148 :
149 : /** Create a new summary page. When the document has been created in
150 : the kiosk mode with automatical transitions then this method adds
151 : this kind of transition to the new summary page.
152 : @param pViewFrame
153 : The view frame that is used to execute the slot for creating the
154 : summary page.
155 : @param pDocument
156 : The document which will contain the summary page and from which
157 : the information about the default transition is retrieved.
158 : */
159 : void AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument);
160 :
161 : /** Take an outline from a text document and create a new impress
162 : document according to the structure of the outline.
163 : @param rRequest
164 : This typically is the unmodified request from a execute()
165 : function from where this function is called.
166 : */
167 : void OutlineToImpress (SfxRequest& rRequest);
168 :
169 : /** Add an eventlistener as soon as possible in sd, allows to use
170 : remote devices to start the slideshow elegantly, and respecting
171 : portability
172 : @EventListenerHdl
173 : The event listener handler
174 : @VclSimpleEvent *
175 : a poiter to a VCLSimpleEvent (see vcl/vclevent.hxx )
176 : */
177 : DECL_LINK( EventListenerHdl, VclSimpleEvent* );
178 :
179 : };
180 :
181 : #define SD_MOD() ( *(SdModule**) GetAppData(SHL_DRAW) )
182 :
183 : #endif // INCLUDED_SD_INC_SDMOD_HXX
184 :
185 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|