LibreOffice Module sd (master) 1
BasicToolBarFactory.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
21
22#include <ViewTabBar.hxx>
24#include <DrawController.hxx>
26
27#include <com/sun/star/lang/IllegalArgumentException.hpp>
28#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
29#include <com/sun/star/frame/XController.hpp>
30#include <com/sun/star/drawing/framework/XControllerManager.hpp>
31
32using namespace ::com::sun::star;
33using namespace ::com::sun::star::uno;
34using namespace ::com::sun::star::lang;
36
37namespace sd::framework {
38
39//===== BasicToolBarFactory ===================================================
40
42{
43 try
44 {
45 mxController = rxController;
46
47 utl::MediaDescriptor aDescriptor (mxController->getModel()->getArgs());
48 if ( ! aDescriptor.getUnpackedValueOrDefault(
50 false))
51 {
52 // Register the factory for its supported tool bars.
53 mxConfigurationController = mxController->getConfigurationController();
55 {
56 mxConfigurationController->addResourceFactory(
58 }
59
60 Reference<lang::XComponent> xComponent (mxConfigurationController, UNO_QUERY);
61 if (xComponent.is())
62 xComponent->addEventListener(static_cast<lang::XEventListener*>(this));
63 }
64 else
65 {
66 // The view shell is in preview mode and thus does not need
67 // the view tab bar.
69 }
70 }
71 catch (RuntimeException&)
72 {
73 Shutdown();
74 throw;
75 }
76}
77
78
80{
81}
82
83void BasicToolBarFactory::disposing(std::unique_lock<std::mutex>&)
84{
85 Shutdown();
86}
87
89{
90 Reference<lang::XComponent> xComponent (mxConfigurationController, UNO_QUERY);
91 if (xComponent.is())
92 xComponent->removeEventListener(static_cast<lang::XEventListener*>(this));
94 {
95 mxConfigurationController->removeResourceFactoryForReference(this);
97 }
98}
99
100//----- lang::XEventListener --------------------------------------------------
101
102void SAL_CALL BasicToolBarFactory::disposing (
103 const lang::EventObject& rEventObject)
104{
105 if (rEventObject.Source == mxConfigurationController)
107}
108
109//===== XPaneFactory ==========================================================
110
111Reference<XResource> SAL_CALL BasicToolBarFactory::createResource (
112 const Reference<XResourceId>& rxToolBarId)
113{
115
116 if (rxToolBarId->getResourceURL() != FrameworkHelper::msViewTabBarURL)
117 throw lang::IllegalArgumentException();
118
119 Reference<XResource> xToolBar = new ViewTabBar(rxToolBarId, mxController);
120 return xToolBar;
121}
122
124 const Reference<XResource>& rxToolBar)
125{
127
128 Reference<XComponent> xComponent (rxToolBar, UNO_QUERY);
129 if (xComponent.is())
130 xComponent->dispose();
131}
132
134{
135 if (m_bDisposed)
136 {
137 throw lang::DisposedException ("BasicToolBarFactory object has already been disposed",
138 const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
139 }
140}
141
142} // end of namespace sd::framework
143
144/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Tab control for switching between views in the center pane.
Definition: ViewTabBar.hxx:72
virtual void disposing(std::unique_lock< std::mutex > &) override
css::uno::Reference< css::drawing::framework::XConfigurationController > mxConfigurationController
rtl::Reference<::sd::DrawController > mxController
BasicToolBarFactory(const rtl::Reference<::sd::DrawController > &rxController)
virtual css::uno::Reference< css::drawing::framework::XResource > SAL_CALL createResource(const css::uno::Reference< css::drawing::framework::XResourceId > &rxToolBarId) override
virtual void SAL_CALL releaseResource(const css::uno::Reference< css::drawing::framework::XResource > &rxToolBar) override
static const OUString msViewTabBarURL
static constexpr OUStringLiteral PROP_PREVIEW