2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 #include "svx/sidebar/SelectionChangeHandler.hxx"
19 #include "svx/sidebar/SelectionAnalyzer.hxx"
20 #include "svx/sidebar/ContextChangeEventMultiplexer.hxx"
21 #include "svx/svdmrkv.hxx"
23 #include <sfx2/sidebar/EnumContext.hxx>
24 #include <sfx2/shell.hxx>
30 using namespace sfx2::sidebar
;
32 namespace svx
{ namespace sidebar
{
34 SelectionChangeHandler::SelectionChangeHandler (
35 const boost::function
<rtl::OUString(void)>& rSelectionChangeCallback
,
36 const Reference
<frame::XController
>& rxController
,
37 const EnumContext::Context eDefaultContext
)
38 : SelectionChangeHandlerInterfaceBase(m_aMutex
),
39 maSelectionChangeCallback(rSelectionChangeCallback
),
40 mxController(rxController
),
41 meDefaultContext(eDefaultContext
),
49 SelectionChangeHandler::~SelectionChangeHandler (void)
56 void SAL_CALL
SelectionChangeHandler::selectionChanged (const lang::EventObject
&)
57 throw (uno::RuntimeException
)
59 if (maSelectionChangeCallback
)
61 const EnumContext::Context
eContext (
62 EnumContext::GetContextEnum(maSelectionChangeCallback()));
63 ContextChangeEventMultiplexer::NotifyContextChange(
65 eContext
==EnumContext::Context_Unknown
74 void SAL_CALL
SelectionChangeHandler::disposing (const lang::EventObject
&)
75 throw (uno::RuntimeException
)
82 void SAL_CALL
SelectionChangeHandler::disposing (void)
83 throw (uno::RuntimeException
)
92 void SelectionChangeHandler::Connect (void)
94 uno::Reference
<view::XSelectionSupplier
> xSupplier (mxController
, uno::UNO_QUERY
);
98 xSupplier
->addSelectionChangeListener(this);
105 void SelectionChangeHandler::Disconnect (void)
107 uno::Reference
<view::XSelectionSupplier
> xSupplier (mxController
, uno::UNO_QUERY
);
110 mbIsConnected
= false;
111 xSupplier
->removeSelectionChangeListener(this);
116 } } // end of namespace svx::sidebar