1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #include "svx/sidebar/SelectionChangeHandler.hxx"
20 #include "svx/sidebar/SelectionAnalyzer.hxx"
21 #include "svx/sidebar/ContextChangeEventMultiplexer.hxx"
22 #include "svx/svdmrkv.hxx"
24 #include <sfx2/sidebar/EnumContext.hxx>
25 #include <sfx2/shell.hxx>
31 using namespace sfx2::sidebar
;
33 namespace svx
{ namespace sidebar
{
35 SelectionChangeHandler::SelectionChangeHandler (
36 const boost::function
<rtl::OUString(void)>& rSelectionChangeCallback
,
37 const Reference
<frame::XController
>& rxController
,
38 const EnumContext::Context eDefaultContext
)
39 : SelectionChangeHandlerInterfaceBase(m_aMutex
),
40 maSelectionChangeCallback(rSelectionChangeCallback
),
41 mxController(rxController
),
42 meDefaultContext(eDefaultContext
),
50 SelectionChangeHandler::~SelectionChangeHandler (void)
57 void SAL_CALL
SelectionChangeHandler::selectionChanged (const lang::EventObject
&)
58 throw (uno::RuntimeException
, std::exception
)
60 if (maSelectionChangeCallback
)
62 const EnumContext::Context
eContext (
63 EnumContext::GetContextEnum(maSelectionChangeCallback()));
64 ContextChangeEventMultiplexer::NotifyContextChange(
66 eContext
==EnumContext::Context_Unknown
75 void SAL_CALL
SelectionChangeHandler::disposing (const lang::EventObject
&)
76 throw (uno::RuntimeException
, std::exception
)
83 void SAL_CALL
SelectionChangeHandler::disposing (void)
84 throw (uno::RuntimeException
)
93 void SelectionChangeHandler::Connect (void)
95 uno::Reference
<view::XSelectionSupplier
> xSupplier (mxController
, uno::UNO_QUERY
);
99 xSupplier
->addSelectionChangeListener(this);
106 void SelectionChangeHandler::Disconnect (void)
108 uno::Reference
<view::XSelectionSupplier
> xSupplier (mxController
, uno::UNO_QUERY
);
111 mbIsConnected
= false;
112 xSupplier
->removeSelectionChangeListener(this);
117 } } // end of namespace svx::sidebar
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */