| 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 |
#pragma once |
| 20 |
|
| 21 |
#include <sal/config.h> |
| 22 |
|
| 23 |
#include <CommandDispatch.hxx> |
| 24 |
#include <ObjectIdentifier.hxx> |
| 25 |
#include <cppuhelper/implbase.hxx> |
| 26 |
#include <com/sun/star/view/XSelectionChangeListener.hpp> |
| 27 |
#include <rtl/ref.hxx> |
| 28 |
|
| 29 |
namespace com::sun::star::view { class XSelectionSupplier; } |
| 30 |
|
| 31 |
namespace chart |
| 32 |
{ |
| 33 |
|
| 34 |
/** This is a CommandDispatch implementation for all commands the status bar offers |
| 35 |
|
| 36 |
This class reads the information needed from the XModel passed here. |
| 37 |
*/ |
| 38 |
|
| 39 |
namespace impl |
| 40 |
{ |
| 41 |
typedef ::cppu::ImplInheritanceHelper< |
| 42 |
CommandDispatch, |
| 43 |
css::view::XSelectionChangeListener > |
| 44 |
StatusBarCommandDispatch_Base; |
| 45 |
} |
| 46 |
|
| 47 |
class StatusBarCommandDispatch : public impl::StatusBarCommandDispatch_Base |
| 48 |
{ |
| 49 |
public: |
| 50 |
explicit StatusBarCommandDispatch( |
| 51 |
const css::uno::Reference< css::uno::XComponentContext > & xContext, |
| 52 |
rtl::Reference<::chart::ChartModel> xModel, |
| 53 |
const css::uno::Reference< css::view::XSelectionSupplier > & xSelSupp ); |
| 54 |
virtual ~StatusBarCommandDispatch() override; |
| 55 |
|
| 56 |
// late initialisation, especially for adding as listener |
| 57 |
virtual void initialize() override; |
| 58 |
|
| 59 |
protected: |
| 60 |
// ____ XDispatch ____ |
| 61 |
virtual void SAL_CALL dispatch( |
| 62 |
const css::util::URL& URL, |
| 63 |
const css::uno::Sequence< css::beans::PropertyValue >& Arguments ) override; |
| 64 |
|
| 65 |
// ____ WeakComponentImplHelperBase ____ |
| 66 |
/// is called when this is disposed |
| 67 |
virtual void disposing(std::unique_lock<std::mutex>& rGuard) override; |
| 68 |
|
| 69 |
// ____ XModifyListener (override from CommandDispatch) ____ |
| 70 |
virtual void SAL_CALL modified( |
| 71 |
const css::lang::EventObject& aEvent ) override; |
| 72 |
|
| 73 |
// ____ XEventListener (base of XModifyListener) ____ |
| 74 |
virtual void SAL_CALL disposing( |
| 75 |
const css::lang::EventObject& Source ) override; |
| 76 |
|
| 77 |
virtual void fireStatusEvent( |
| 78 |
const OUString & rURL, |
| 79 |
const css::uno::Reference< css::frame::XStatusListener > & xSingleListener ) override; |
| 80 |
|
| 81 |
// ____ XSelectionChangeListener ____ |
| 82 |
virtual void SAL_CALL selectionChanged( |
| 83 |
const css::lang::EventObject& aEvent ) override; |
| 84 |
|
| 85 |
private: |
| 86 |
rtl::Reference<::chart::ChartModel> m_xChartModel; |
| 87 |
css::uno::Reference< css::view::XSelectionSupplier > m_xSelectionSupplier; |
| 88 |
bool m_bIsModified; |
| 89 |
ObjectIdentifier m_aSelectedOID; |
| 90 |
}; |
| 91 |
|
| 92 |
} // namespace chart |
| 93 |
|
| 94 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |