/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/** * split from the main class since it needs different ref-counting mana
*/ class NotebookBarContextChangeEventListener : public ::cppu::WeakImplHelper<css::ui::XContextChangeEventListener, css::frame::XFrameActionListener>
{ bool mbActive;
VclPtr<NotebookBar> mpParent;
css::uno::Reference<css::frame::XFrame> mxFrame; public:
NotebookBarContextChangeEventListener(NotebookBar *p, css::uno::Reference<css::frame::XFrame> xFrame) :
mbActive(false),
mpParent(p),
mxFrame(std::move(xFrame))
{}
bool bIsWelded = comphelper::LibreOfficeKit::isActive(); if (bIsWelded)
{
m_bIsWelded = true;
m_xVclContentArea = VclPtr<VclVBox>::Create(this);
m_xVclContentArea->Show(); // now access it using GetMainContainer and set dispose callback with SetDisposeCallback
} else
{
m_pUIBuilder.reset( new VclBuilder(this, sUIDir, rUIXMLDescription, rID, rFrame, true, &aNotebookBarAddonsItem));
// In the Notebookbar's .ui file must exist control handling context // - implementing NotebookbarContextControl interface with id "ContextContainer" // or "ContextContainerX" where X is a number >= 1
NotebookbarContextControl* pContextContainer = nullptr; int i = 0; do
{
OUString aName = u"ContextContainer"_ustr; if (i)
aName += OUString::number(i);
void NotebookBarContextChangeEventListener::setupFrameListener(bool bListen)
{ if (bListen)
mxFrame->addFrameActionListener(this); else
mxFrame->removeFrameActionListener(this);
}
void SAL_CALL NotebookBarContextChangeEventListener::frameAction(const css::frame::FrameActionEvent& rEvent)
{ if (!mbActive) return;
if (rEvent.Action == css::frame::FrameAction_COMPONENT_REATTACHED)
{
setupListener(true);
} elseif (rEvent.Action == css::frame::FrameAction_COMPONENT_DETACHING)
{
setupListener(false); // We don't want to give up on listening; just wait for // another controller to be attached to the frame.
mbActive = true;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.