fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / main / StatusBarCommandDispatch.cxx
blob4fb944da814fac9f53119179b667978efddb28d6
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 "StatusBarCommandDispatch.hxx"
21 #include "ObjectNameProvider.hxx"
22 #include "macros.hxx"
23 #include <com/sun/star/util/XModifyBroadcaster.hpp>
25 #include "ResId.hxx"
27 using namespace ::com::sun::star;
29 using ::com::sun::star::uno::Reference;
30 using ::com::sun::star::uno::Sequence;
32 namespace chart
35 StatusBarCommandDispatch::StatusBarCommandDispatch(
36 const Reference< uno::XComponentContext > & xContext,
37 const Reference< frame::XModel > & xModel,
38 const Reference< view::XSelectionSupplier > & xSelSupp ) :
39 impl::StatusBarCommandDispatch_Base( xContext ),
40 m_xModifiable( xModel, uno::UNO_QUERY ),
41 m_xSelectionSupplier( xSelSupp ),
42 m_bIsModified( false )
45 StatusBarCommandDispatch::~StatusBarCommandDispatch()
48 void StatusBarCommandDispatch::initialize()
50 if( m_xModifiable.is())
52 Reference< util::XModifyBroadcaster > xModifyBroadcaster( m_xModifiable, uno::UNO_QUERY );
53 OSL_ASSERT( xModifyBroadcaster.is());
54 if( xModifyBroadcaster.is())
55 xModifyBroadcaster->addModifyListener( this );
58 if( m_xSelectionSupplier.is())
60 m_xSelectionSupplier->addSelectionChangeListener( this );
64 void StatusBarCommandDispatch::fireStatusEvent(
65 const OUString & rURL,
66 const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ )
68 bool bFireAll( rURL.isEmpty() );
69 bool bFireContext( bFireAll || rURL == ".uno:Context" );
70 bool bFireModified( bFireAll || rURL == ".uno:ModifiedStatus" );
72 if( bFireContext )
74 uno::Any aArg;
75 Reference< chart2::XChartDocument > xDoc( m_xModifiable, uno::UNO_QUERY );
76 aArg <<= ObjectNameProvider::getSelectedObjectText( m_aSelectedOID.getObjectCID(), xDoc );
77 fireStatusEventForURL( ".uno:Context", aArg, true, xSingleListener );
79 if( bFireModified )
81 uno::Any aArg;
82 if( m_bIsModified )
83 aArg <<= OUString("*");
84 fireStatusEventForURL( ".uno:ModifiedStatus", aArg, true, xSingleListener );
88 // ____ XDispatch ____
89 void SAL_CALL StatusBarCommandDispatch::dispatch(
90 const util::URL& /* URL */,
91 const Sequence< beans::PropertyValue >& /* Arguments */ )
92 throw (uno::RuntimeException, std::exception)
94 // nothing to do here
97 // ____ WeakComponentImplHelperBase ____
98 /// is called when this is disposed
99 void SAL_CALL StatusBarCommandDispatch::disposing()
101 m_xModifiable.clear();
102 m_xSelectionSupplier.clear();
105 // ____ XEventListener (base of XModifyListener) ____
106 void SAL_CALL StatusBarCommandDispatch::disposing( const lang::EventObject& /* Source */ )
107 throw (uno::RuntimeException, std::exception)
109 m_xModifiable.clear();
110 m_xSelectionSupplier.clear();
113 // ____ XModifyListener ____
114 void SAL_CALL StatusBarCommandDispatch::modified( const lang::EventObject& aEvent )
115 throw (uno::RuntimeException, std::exception)
117 if( m_xModifiable.is())
118 m_bIsModified = m_xModifiable->isModified();
120 CommandDispatch::modified( aEvent );
123 // ____ XSelectionChangeListener ____
124 void SAL_CALL StatusBarCommandDispatch::selectionChanged( const lang::EventObject& /* aEvent */ )
125 throw (uno::RuntimeException, std::exception)
127 if( m_xSelectionSupplier.is())
128 m_aSelectedOID = ObjectIdentifier( m_xSelectionSupplier->getSelection() );
129 else
130 m_aSelectedOID = ObjectIdentifier();
131 fireAllStatusEvents( 0 );
134 } // namespace chart
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */