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>
28 #include <svl/lstner.hxx>
29 #include <com/sun/star/beans/XPropertySetInfo.hpp>
30 #include <sfx2/app.hxx>
31 #include <sfx2/module.hxx>
32 #include <sal/types.h>
33 #include <vcl/virdev.hxx>
41 class SvNumberFormatter
;
42 class SfxErrorHandler
;
44 struct SfxItemPropertyMapEntry
;
46 namespace svtools
{ class ColorConfig
; }
48 namespace com::sun::star::frame
{
52 enum class SdOptionStreamMode
58 typedef std::map
< SfxItemPropertyMapEntry
const * , css::uno::Reference
<css::beans::XPropertySetInfo
> > SdExtPropertySetInfoCache
;
59 typedef std::map
< sal_uInt32
, css::uno::Sequence
< css::uno::Type
> > SdTypesCache
;
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
67 SdModule is like to be compared with the <SfxApplication>-subclass.
69 Remember: Don`t export this class! It uses DLL-internal symbols.
73 class SAL_DLLPUBLIC_RTTI SdModule final
: public SfxModule
, public SfxListener
76 SFX_DECL_INTERFACE(SD_IF_SDAPP
)
77 DECL_LINK( CalcFieldValueHdl
, EditFieldInfo
*, void );
80 /// SfxInterface initializer.
81 static void InitInterface_Impl();
84 SdModule(SfxObjectFactory
* pDrawObjFact
, SfxObjectFactory
* pGraphicObjFact
);
85 virtual ~SdModule() override
;
87 SdTransferable
* pTransferClip
;
88 SdTransferable
* pTransferDrag
;
89 SdTransferable
* pTransferSelection
;
91 void Execute(SfxRequest
& rReq
);
92 void GetState(SfxItemSet
&);
94 SdOptions
* GetSdOptions(DocumentType eDocType
);
95 SD_DLLPUBLIC
tools::SvRef
<SotStorageStream
> GetOptionStream( const OUString
& rOptionName
, SdOptionStreamMode eMode
);
97 bool GetWaterCan() const { return bWaterCan
; }
98 void SetWaterCan( bool bWC
) { bWaterCan
= bWC
; }
100 SvxSearchItem
* GetSearchItem() { return pSearchItem
.get(); }
101 void SetSearchItem(std::unique_ptr
<SvxSearchItem
> pItem
);
103 /** Return the virtual device that can be used for printer independent
106 The returned pointer is NULL when the device could not be
107 created when this modules was instantiated.
109 OutputDevice
* GetVirtualRefDevice() { return mpVirtualRefDevice
;}
111 SD_DLLPUBLIC SvNumberFormatter
* GetNumberFormatter();
113 // virtual methods for the option dialog
114 virtual std::unique_ptr
<SfxItemSet
> CreateItemSet( sal_uInt16 nId
) override
;
115 virtual void ApplyItemSet( sal_uInt16 nId
, const SfxItemSet
& rSet
) override
;
116 virtual std::unique_ptr
<SfxTabPage
> CreateTabPage( sal_uInt16 nId
, weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
) override
;
117 virtual std::unique_ptr
<SfxStyleFamilies
> CreateStyleFamilies() override
;
119 SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache
;
120 SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache
;
121 SdTypesCache gImplTypesCache
;
123 svtools::ColorConfig
& GetColorConfig();
127 SdOptions
* pImpressOptions
;
128 SdOptions
* pDrawOptions
;
129 std::unique_ptr
<SvxSearchItem
> pSearchItem
;
130 std::unique_ptr
<SvNumberFormatter
> pNumberFormatter
;
131 tools::SvRef
<SotStorage
> xOptionStorage
;
133 std::unique_ptr
<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.
138 VclPtr
< VirtualDevice
> mpVirtualRefDevice
;
140 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
142 SfxFrame
* ExecuteNewDocument( SfxRequest
const & rReq
);
144 static SfxFrame
* CreateEmptyDocument( const css::uno::Reference
< css::frame::XFrame
>& i_rFrame
);
145 static SfxFrame
* CreateFromTemplate(const OUString
& rTemplatePath
,
146 const css::uno::Reference
<css::frame::XFrame
>& i_rFrame
,
147 const bool bReplaceable
);
149 bool mbEventListenerAdded
;
151 /** Take an outline from a text document and create a new impress
152 document according to the structure of the outline.
154 This typically is the unmodified request from an execute()
155 function from where this function is called.
157 static bool OutlineToImpress(SfxRequest
const & rRequest
);
159 /** Add an eventlistener as soon as possible in sd, allows to use
160 remote devices to start the slideshow elegantly, and respecting
163 The event listener handler
165 a pointer to a VCLSimpleEvent (see vcl/vclevent.hxx )
167 DECL_STATIC_LINK( SdModule
, EventListenerHdl
, VclSimpleEvent
&, void );
169 std::unique_ptr
<svtools::ColorConfig
> mpColorConfig
;
172 #define SD_MOD() ( static_cast<SdModule*>(SfxApplication::GetModule(SfxToolsModule::Draw)) )
174 #endif // INCLUDED_SD_INC_SDMOD_HXX
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */