Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / basctl / source / basicide / basdoc.cxx
blob2c4654751908b128d01222c39fd7e70341e27a3a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #include <sal/config.h>
22 #include <o3tl/make_unique.hxx>
23 #include <sfx2/app.hxx>
24 #include <sfx2/printer.hxx>
25 #include <sfx2/objface.hxx>
27 #include "unomodel.hxx"
29 #include "basdoc.hxx"
30 #define ShellClass_basctl_DocShell
31 #include <basslots.hxx>
32 #include <sfx2/sfxmodelfactory.hxx>
33 #include <svl/itemset.hxx>
34 #include <svx/svxids.hrc>
35 #include <tools/globname.hxx>
37 namespace basctl
41 SFX_IMPL_OBJECTFACTORY( DocShell, SvGlobalName(), SfxObjectShellFlags::STD_NORMAL, "sbasic" )
43 SFX_IMPL_SUPERCLASS_INTERFACE(basctl_DocShell, SfxObjectShell)
45 void basctl_DocShell::InitInterface_Impl()
47 GetStaticInterface()->RegisterStatusBar(StatusBarId::BasicIdeStatusBar);
50 DocShell::DocShell()
51 :SfxObjectShell( SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | SfxModelFlags::DISABLE_DOCUMENT_RECOVERY )
53 SetPool( &SfxGetpApp()->GetPool() );
54 SetBaseModel( new SIDEModel(this) );
57 DocShell::~DocShell()
59 pPrinter.disposeAndClear();
62 SfxPrinter* DocShell::GetPrinter( bool bCreate )
64 if ( !pPrinter && bCreate )
65 pPrinter.disposeAndReset(VclPtr<SfxPrinter>::Create(o3tl::make_unique<SfxItemSet>(
66 GetPool(), svl::Items<SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN>{}
67 )));
69 return pPrinter.get();
72 void DocShell::SetPrinter( SfxPrinter* pPr )
74 if (pPr != pPrinter.get())
76 pPrinter.disposeAndReset(pPr);
80 void DocShell::FillClass( SvGlobalName*, SotClipboardFormatId*, OUString*, OUString*, OUString*, sal_Int32, bool bTemplate) const
82 DBG_ASSERT( !bTemplate, "No template for Basic" );
85 void DocShell::Draw( OutputDevice *, const JobSetup &, sal_uInt16 )
88 } // namespace basctl
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */