/* -*- 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/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ #include <sfx2/sidebar/SidebarDockingWindow.hxx> #include <sfx2/sidebar/SidebarChildWindow.hxx> #include <sfx2/sidebar/SidebarController.hxx> #include <sidebar/PanelDescriptor.hxx>
bool SidebarDockingWindow::Close()
{ if (mpSidebarController.is())
mpSidebarController->SetFloatingDeckClosed(true);
return SfxDockingWindow::Close();
}
void SidebarDockingWindow::SyncUpdate()
{ if (mpSidebarController.is())
mpSidebarController->SyncUpdate();
}
SfxChildAlignment SidebarDockingWindow::CheckAlignment (
SfxChildAlignment eCurrentAlignment,
SfxChildAlignment eRequestedAlignment)
{ switch (eRequestedAlignment)
{ case SfxChildAlignment::TOP: case SfxChildAlignment::HIGHESTTOP: case SfxChildAlignment::LOWESTTOP: case SfxChildAlignment::BOTTOM: case SfxChildAlignment::LOWESTBOTTOM: case SfxChildAlignment::HIGHESTBOTTOM: return eCurrentAlignment;
case SfxChildAlignment::LEFT: case SfxChildAlignment::RIGHT: case SfxChildAlignment::FIRSTLEFT: case SfxChildAlignment::LASTLEFT: case SfxChildAlignment::FIRSTRIGHT: case SfxChildAlignment::LASTRIGHT: return eRequestedAlignment;
default: return eRequestedAlignment;
}
}
bool SidebarDockingWindow::EventNotify(NotifyEvent& rEvent)
{ if (mpSidebarController)
{
NotifyEventType nType = rEvent.GetType(); if (NotifyEventType::KEYINPUT == nType)
{ const vcl::KeyCode& rKeyCode = rEvent.GetKeyEvent()->GetKeyCode(); switch (rKeyCode.GetCode())
{ case KEY_UP: case KEY_DOWN: case KEY_PAGEUP: case KEY_PAGEDOWN: case KEY_HOME: case KEY_END: case KEY_LEFT: case KEY_RIGHT: case KEY_BACKSPACE: case KEY_DELETE: case KEY_INSERT: case KEY_RETURN: case KEY_ESCAPE:
{ returntrue;
} default: break;
} if (!mpAccel)
{
mpAccel = svt::AcceleratorExecute::createAcceleratorHelper();
mpAccel->init(comphelper::getProcessComponentContext(), mpSidebarController->getXFrame());
} const OUString aCommand(mpAccel->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rKeyCode))); if (".uno:DesignerDialog" == aCommand)
{
std::shared_ptr<PanelDescriptor> xPanelDescriptor =
mpSidebarController->GetResourceManager()->GetPanelDescriptor( u"StyleListPanel" ); if ( xPanelDescriptor && mpSidebarController->IsDeckVisible( xPanelDescriptor->msDeckId ) )
Close(); returntrue;
} if (".uno:Undo" == aCommand || ".uno:Redo" == aCommand)
{
comphelper::dispatchCommand(aCommand, {}); returntrue;
}
} elseif (NotifyEventType::MOUSEBUTTONDOWN == nType)
{ const MouseEvent *mEvt = rEvent.GetMouseEvent(); if (mEvt->IsLeft())
{
tools::Rectangle aGrip = mpSidebarController->GetDeckDragArea(); if ( aGrip.Contains( mEvt->GetPosPixel() ) )
mbIsReadyToDrag = true;
}
} elseif (NotifyEventType::MOUSEMOVE == nType)
{ const MouseEvent *mEvt = rEvent.GetMouseEvent();
tools::Rectangle aGrip = mpSidebarController->GetDeckDragArea(); if (mEvt->IsLeft() && aGrip.Contains( mEvt->GetPosPixel() ) && mbIsReadyToDrag )
{
Point aPos = mEvt->GetPosPixel();
vcl::Window* pWindow = rEvent.GetWindow(); if ( pWindow != this )
{
aPos = pWindow->OutputToScreenPixel( aPos );
aPos = ScreenToOutputPixel( aPos );
}
ImplStartDocking( aPos );
}
}
}
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.