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