LibreOffice Module sc (master) 1
drdefuno.cxx
Go to the documentation of this file.
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#include <drdefuno.hxx>
21#include <docsh.hxx>
22#include <drwlayer.hxx>
23
24#include <svx/unoprov.hxx>
25#include <vcl/svapp.hxx>
26
27using namespace ::com::sun::star;
28
31 pDocShell( pDocSh )
32{
33 // SvxUnoDrawPool is initialized without model,
34 // draw layer is created on demand in getModelPool
35
37}
38
40{
42
43 if (pDocShell)
45}
46
48{
49 if ( rHint.GetId() == SfxHintId::Dying )
50 {
51 pDocShell = nullptr; // document gone
52 }
53}
54
56{
57 SfxItemPool* pRet = nullptr;
58
59 try
60 {
61 if ( pDocShell )
62 {
63 ScDrawLayer* pModel = bReadOnly ?
64 pDocShell->GetDocument().GetDrawLayer() :
65 pDocShell->MakeDrawLayer();
66 if ( pModel )
67 pRet = &pModel->GetItemPool();
68 }
69 }
70 catch (...)
71 {
72 }
73
74 if ( !pRet )
75 pRet = SvxUnoDrawPool::getModelPool( bReadOnly ); // uses default pool
76
77 return pRet;
78}
79
80/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:901
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:909
virtual ~ScDrawDefaultsObj() noexcept override
Definition: drdefuno.cxx:39
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: drdefuno.cxx:47
virtual SfxItemPool * getModelPool(bool bReadOnly) noexcept override
Definition: drdefuno.cxx:55
ScDocShell * pDocShell
Definition: drdefuno.hxx:30
ScDrawDefaultsObj(ScDocShell *pDocSh)
Definition: drdefuno.cxx:29
const SfxItemPool & GetItemPool() const
SfxHintId GetId() const
virtual SfxItemPool * getModelPool(bool bReadOnly) noexcept
bool bReadOnly
SVXCORE_DLLPUBLIC rtl::Reference< comphelper::PropertySetInfo > const & getDrawingDefaults() noexcept