1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_SD_INC_SDMOD_HXX
21 #define INCLUDED_SD_INC_SDMOD_HXX
26 #include <sot/storage.hxx>
27 #include <tools/shl.hxx>
29 #include <svl/itemprop.hxx>
30 #include <svl/lstner.hxx>
31 #include <com/sun/star/text/WritingMode.hpp>
32 #include <sfx2/module.hxx>
33 #include <vcl/vclevent.hxx>
34 #include <vcl/virdev.hxx>
35 #include <sal/types.h>
43 class SvNumberFormatter
;
44 class SfxErrorHandler
;
50 class SdGlobalResourceContainer
;
53 namespace com
{ namespace sun
{ namespace star
{ namespace frame
{
57 enum SdOptionStreamMode
63 typedef std::map
< sal_uIntPtr
, css::uno::Reference
<css::beans::XPropertySetInfo
> > SdExtPropertySetInfoCache
;
64 typedef std::map
< sal_uInt32
, css::uno::Sequence
< css::uno::Type
> > SdTypesCache
;
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
72 SdModule is like to be compared with the <SfxApplication>-subclass.
74 Remember: Don`t export this class! It uses DLL-internal symbols.
78 class SdModule
: public SfxModule
, public SfxListener
82 SFX_DECL_INTERFACE(SD_IF_SDAPP
)
83 DECL_LINK( CalcFieldValueHdl
, EditFieldInfo
* );
86 /// SfxInterface initializer.
87 static void InitInterface_Impl();
90 SdModule(SfxObjectFactory
* pDrawObjFact
, SfxObjectFactory
* pGraphicObjFact
);
93 SdTransferable
* pTransferClip
;
94 SdTransferable
* pTransferDrag
;
95 SdTransferable
* pTransferSelection
;
97 void Execute(SfxRequest
& rReq
);
98 void GetState(SfxItemSet
&);
100 SdOptions
* GetSdOptions(DocumentType eDocType
);
101 SD_DLLPUBLIC
tools::SvRef
<SotStorageStream
> GetOptionStream( const OUString
& rOptionName
, SdOptionStreamMode eMode
);
103 bool GetWaterCan() const { return bWaterCan
; }
104 void SetWaterCan( bool bWC
) { bWaterCan
= bWC
; }
106 SvxSearchItem
* GetSearchItem() { return pSearchItem
; }
107 void SetSearchItem(SvxSearchItem
* pItem
) { pSearchItem
= pItem
; }
109 /** Return the virtual device that can be used for printer independent
112 The returned pointer is NULL when the device could not be
113 created when this modules was instantiated.
115 OutputDevice
* GetVirtualRefDevice() { return mpVirtualRefDevice
;}
117 /** Deprecated alias to <member>GetVirtualRefDevice</member>.
119 Unused dummy parameter.
121 OutputDevice
* GetRefDevice (::sd::DrawDocShell
& rDocShell
);
123 SD_DLLPUBLIC SvNumberFormatter
* GetNumberFormatter();
125 // virtual methods for the option dialog
126 virtual SfxItemSet
* CreateItemSet( sal_uInt16 nId
) SAL_OVERRIDE
;
127 virtual void ApplyItemSet( sal_uInt16 nId
, const SfxItemSet
& rSet
) SAL_OVERRIDE
;
128 virtual VclPtr
<SfxTabPage
> CreateTabPage( sal_uInt16 nId
, vcl::Window
* pParent
, const SfxItemSet
& rSet
) SAL_OVERRIDE
;
130 SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache
;
131 SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache
;
132 SdTypesCache gImplTypesCache
;
136 SdOptions
* pImpressOptions
;
137 SdOptions
* pDrawOptions
;
138 SvxSearchItem
* pSearchItem
;
139 SvNumberFormatter
* pNumberFormatter
;
140 tools::SvRef
<SotStorage
> xOptionStorage
;
142 SfxErrorHandler
* mpErrorHdl
;
143 /** This device is used for printer independent layout. It is virtual
144 in the sense that it does not represent a printer. The pointer may
145 be NULL when the virtual device could not be created.
147 VclPtr
< VirtualDevice
> mpVirtualRefDevice
;
149 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
152 SfxFrame
* ExecuteNewDocument( SfxRequest
& rReq
);
154 static void ChangeMedium( ::sd::DrawDocShell
* pDocShell
, SfxViewFrame
* pViewFrame
, const sal_Int32 eMedium
);
155 static SfxFrame
* CreateEmptyDocument( DocumentType eDocType
, const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& i_rFrame
);
156 static SfxFrame
* CreateFromTemplate( const OUString
& rTemplatePath
, const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& i_rFrame
);
158 /** The resource container controls the lifetime of some singletons.
160 ::std::unique_ptr
< ::sd::SdGlobalResourceContainer
> mpResourceContainer
;
162 bool mbEventListenerAdded
;
164 /** Create a new summary page. When the document has been created in
165 the kiosk mode with automatical transitions then this method adds
166 this kind of transition to the new summary page.
168 The view frame that is used to execute the slot for creating the
171 The document which will contain the summary page and from which
172 the information about the default transition is retrieved.
174 static void AddSummaryPage (SfxViewFrame
* pViewFrame
, SdDrawDocument
* pDocument
);
176 /** Take an outline from a text document and create a new impress
177 document according to the structure of the outline.
179 This typically is the unmodified request from a execute()
180 function from where this function is called.
182 static bool OutlineToImpress(SfxRequest
& rRequest
);
184 /** Add an eventlistener as soon as possible in sd, allows to use
185 remote devices to start the slideshow elegantly, and respecting
188 The event listener handler
190 a poiter to a VCLSimpleEvent (see vcl/vclevent.hxx )
192 DECL_STATIC_LINK( SdModule
, EventListenerHdl
, VclSimpleEvent
* );
196 #define SD_MOD() ( *reinterpret_cast<SdModule**>(GetAppData(SHL_DRAW)) )
198 #endif // INCLUDED_SD_INC_SDMOD_HXX
200 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */