weld panel TitleBar
use an expander for the expander-like feature Change-Id: I3af63dc252479914a0000aab59a30744f8073fd1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105310 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
parent
590b4e75e3
commit
64dcfe2957
20 changed files with 371 additions and 510 deletions
|
@ -73,7 +73,6 @@ public:
|
|||
|
||||
private:
|
||||
const OUString msPanelId;
|
||||
VclPtr<PanelTitleBar> mpTitleBar;
|
||||
const bool mbIsTitleBarOptional;
|
||||
css::uno::Reference<css::ui::XUIElement> mxElement;
|
||||
css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent;
|
||||
|
@ -81,8 +80,8 @@ private:
|
|||
bool mbLurking;
|
||||
const std::function<void()> maDeckLayoutTrigger;
|
||||
const std::function<Context()> maContextAccess;
|
||||
|
||||
const css::uno::Reference<css::frame::XFrame>& mxFrame;
|
||||
VclPtr<PanelTitleBar> mpTitleBar;
|
||||
|
||||
};
|
||||
typedef std::vector<VclPtr<Panel> > SharedPanelContainer;
|
||||
|
|
|
@ -56,12 +56,7 @@ public:
|
|||
|
||||
AnyItem_ = Pre_Image_,
|
||||
|
||||
Image_Grip,
|
||||
Image_Expand,
|
||||
Image_Collapse,
|
||||
Image_TabBarMenu,
|
||||
Image_PanelMenu,
|
||||
Image_Closer,
|
||||
Image_CloseIndicator,
|
||||
|
||||
Image_Color_,
|
||||
|
|
|
@ -259,7 +259,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
|
|||
sfx2/source/sidebar/SidebarPanelBase \
|
||||
sfx2/source/sidebar/SidebarToolBox \
|
||||
sfx2/source/sidebar/Accessible \
|
||||
sfx2/source/sidebar/AccessibleTitleBar \
|
||||
sfx2/source/sidebar/AsynchronousCall \
|
||||
sfx2/source/sidebar/Context \
|
||||
sfx2/source/sidebar/ContextChangeBroadcaster \
|
||||
|
|
|
@ -22,6 +22,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
|
|||
sfx2/uiconfig/ui/cmisinfopage \
|
||||
sfx2/uiconfig/ui/cmisline \
|
||||
sfx2/uiconfig/ui/custominfopage \
|
||||
sfx2/uiconfig/ui/decktitlebar \
|
||||
sfx2/uiconfig/ui/descriptioninfopage \
|
||||
sfx2/uiconfig/ui/dockingwindow \
|
||||
sfx2/uiconfig/ui/documentfontspage \
|
||||
|
@ -50,6 +51,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
|
|||
sfx2/uiconfig/ui/newstyle \
|
||||
sfx2/uiconfig/ui/notebookbar \
|
||||
sfx2/uiconfig/ui/optprintpage \
|
||||
sfx2/uiconfig/ui/paneltitlebar \
|
||||
sfx2/uiconfig/ui/password \
|
||||
sfx2/uiconfig/ui/notebookbarpopup \
|
||||
sfx2/uiconfig/ui/printeroptionsdialog \
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/* -*- 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 .
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
|
||||
|
||||
namespace com::sun::star::accessibility { class XAccessible; }
|
||||
|
||||
namespace sfx2::sidebar {
|
||||
|
||||
class TitleBar;
|
||||
|
||||
class AccessibleTitleBar final
|
||||
: public VCLXAccessibleComponent
|
||||
{
|
||||
public:
|
||||
static css::uno::Reference<css::accessibility::XAccessible> Create (TitleBar& rTitleBar);
|
||||
|
||||
private:
|
||||
virtual void FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet) override;
|
||||
|
||||
explicit AccessibleTitleBar (VCLXWindow* pWindow);
|
||||
virtual ~AccessibleTitleBar() override;
|
||||
};
|
||||
|
||||
} // end of namespace sfx2::sidebar
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -19,31 +19,40 @@
|
|||
#pragma once
|
||||
|
||||
#include <sidebar/TitleBar.hxx>
|
||||
#include <vcl/customweld.hxx>
|
||||
|
||||
namespace sfx2::sidebar {
|
||||
|
||||
class GripWidget;
|
||||
|
||||
class DeckTitleBar final : public TitleBar
|
||||
{
|
||||
public:
|
||||
DeckTitleBar(const OUString& rsTitle,
|
||||
vcl::Window* pParentWindow,
|
||||
const std::function<void()>& rCloserAction);
|
||||
virtual void dispose() override;
|
||||
virtual ~DeckTitleBar() override;
|
||||
|
||||
virtual void SetTitle (const OUString& rsTitle) override;
|
||||
virtual OUString GetTitle() const override;
|
||||
|
||||
void SetCloserVisible(const bool bIsCloserVisible);
|
||||
static tools::Rectangle GetDragArea();
|
||||
tools::Rectangle GetDragArea();
|
||||
|
||||
virtual void DataChanged(const DataChangedEvent& rEvent) override;
|
||||
virtual void MouseMove(const MouseEvent& rMouseEvent) override;
|
||||
|
||||
private:
|
||||
virtual tools::Rectangle GetTitleArea(const tools::Rectangle& rTitleBarBox) override;
|
||||
virtual void PaintDecoration(vcl::RenderContext& rRenderContext) override;
|
||||
virtual Color GetBackgroundPaintColor() override;
|
||||
virtual void HandleToolBoxItemClick(const sal_uInt16 nItemIndex) override;
|
||||
virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
|
||||
virtual void HandleToolBoxItemClick() override;
|
||||
|
||||
DECL_LINK(DrawGripHdl, weld::DrawingArea::draw_args, void);
|
||||
|
||||
std::unique_ptr<GripWidget> mxGripWidget;
|
||||
std::unique_ptr<weld::CustomWeld> mxGripWeld;
|
||||
std::unique_ptr<weld::Label> mxLabel;
|
||||
|
||||
static const sal_uInt16 mnCloserItemIndex = 1;
|
||||
const std::function<void()> maCloserAction;
|
||||
BitmapEx maGrip;
|
||||
bool mbIsCloserVisible;
|
||||
};
|
||||
|
||||
|
|
|
@ -32,25 +32,26 @@ class PanelTitleBar final
|
|||
{
|
||||
public:
|
||||
PanelTitleBar(const OUString& rsTitle, vcl::Window* pParentWindow, Panel* pPanel);
|
||||
virtual ~PanelTitleBar() override;
|
||||
virtual void dispose() override;
|
||||
virtual ~PanelTitleBar() override;
|
||||
|
||||
virtual void SetTitle (const OUString& rsTitle) override;
|
||||
virtual OUString GetTitle() const override;
|
||||
|
||||
void SetMoreOptionsCommand(const OUString& rsCommandName,
|
||||
const css::uno::Reference<css::frame::XFrame>& rxFrame,
|
||||
const css::uno::Reference<css::frame::XController>& rxController);
|
||||
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
||||
|
||||
void UpdateExpandedState();
|
||||
|
||||
virtual void DataChanged(const DataChangedEvent& rEvent) override;
|
||||
virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override;
|
||||
virtual void MouseButtonUp(const MouseEvent& rMouseEvent) override;
|
||||
|
||||
private:
|
||||
virtual tools::Rectangle GetTitleArea(const tools::Rectangle& rTitleBarBox) override;
|
||||
virtual void PaintDecoration(vcl::RenderContext& rRenderContext) override;
|
||||
virtual Color GetBackgroundPaintColor() override;
|
||||
virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex) override;
|
||||
virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
|
||||
virtual void HandleToolBoxItemClick() override;
|
||||
|
||||
DECL_LINK(ExpandHdl, weld::Expander&, void);
|
||||
|
||||
std::unique_ptr<weld::Expander> mxExpander;
|
||||
|
||||
bool mbIsLeftButtonDown;
|
||||
VclPtr<Panel> mpPanel;
|
||||
static const sal_uInt16 mnMenuItemIndex = 1;
|
||||
css::uno::Reference<css::frame::XFrame> mxFrame;
|
||||
|
|
|
@ -19,54 +19,46 @@
|
|||
#pragma once
|
||||
|
||||
#include <sidebar/SidebarToolBox.hxx>
|
||||
#include <sfx2/sidebar/Theme.hxx>
|
||||
#include <sfx2/weldutils.hxx>
|
||||
#include <vcl/InterimItemWindow.hxx>
|
||||
|
||||
namespace sfx2::sidebar {
|
||||
|
||||
class TitleBar : public vcl::Window
|
||||
class TitleBar : public InterimItemWindow
|
||||
{
|
||||
public:
|
||||
TitleBar (const OUString& rsTitle,
|
||||
vcl::Window* pParentWindow,
|
||||
const Color& rInitialBackgroundColor);
|
||||
virtual ~TitleBar() override;
|
||||
TitleBar(vcl::Window* pParentWindow,
|
||||
const OUString& rUIXMLDescription, const OString& rID,
|
||||
Theme::ThemeItem eThemeItem);
|
||||
virtual void dispose() override;
|
||||
virtual ~TitleBar() override;
|
||||
|
||||
void SetTitle (const OUString& rsTitle);
|
||||
const OUString& GetTitle() const {return msTitle; }
|
||||
virtual void SetTitle (const OUString& rsTitle) = 0;
|
||||
virtual OUString GetTitle() const = 0;
|
||||
|
||||
void SetIcon(const css::uno::Reference<css::graphic::XGraphic>& rIcon);
|
||||
|
||||
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rUpdateArea) override;
|
||||
virtual void DataChanged (const DataChangedEvent& rEvent) override;
|
||||
virtual void setPosSizePixel (tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags = PosSizeFlags::All) override;
|
||||
|
||||
ToolBox& GetToolBox()
|
||||
weld::Toolbar& GetToolBox()
|
||||
{
|
||||
return *maToolBox;
|
||||
return *mxToolBox;
|
||||
}
|
||||
const ToolBox& GetToolBox() const
|
||||
const weld::Toolbar& GetToolBox() const
|
||||
{
|
||||
return *maToolBox;
|
||||
return *mxToolBox;
|
||||
}
|
||||
|
||||
protected:
|
||||
VclPtr<SidebarToolBox> maToolBox;
|
||||
OUString msTitle;
|
||||
std::unique_ptr<weld::Image> mxAddonImage;
|
||||
std::unique_ptr<weld::Toolbar> mxToolBox;
|
||||
std::unique_ptr<ToolbarUnoDispatcher> mxToolBoxController;
|
||||
Theme::ThemeItem meThemeItem;
|
||||
|
||||
virtual tools::Rectangle GetTitleArea (const tools::Rectangle& rTitleBarBox) = 0;
|
||||
virtual void PaintDecoration (vcl::RenderContext& rRenderContext) = 0;
|
||||
void PaintFocus(vcl::RenderContext& rRenderContext, const tools::Rectangle& rFocusBox);
|
||||
virtual Color GetBackgroundPaintColor() = 0;
|
||||
virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex);
|
||||
virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
|
||||
virtual void HandleToolBoxItemClick() = 0;
|
||||
|
||||
private:
|
||||
Image maIcon;
|
||||
Color maBackgroundColor;
|
||||
|
||||
void PaintTitle(vcl::RenderContext& rRenderContext, const tools::Rectangle& rTitleBox);
|
||||
DECL_LINK(SelectionHandler, ToolBox*, void);
|
||||
DECL_LINK(SelectionHandler, const OString&, void);
|
||||
};
|
||||
|
||||
} // end of namespace sfx2::sidebar
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/* -*- 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 <sidebar/AccessibleTitleBar.hxx>
|
||||
#include <sidebar/Accessible.hxx>
|
||||
#include <sidebar/TitleBar.hxx>
|
||||
|
||||
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
|
||||
|
||||
#include <unotools/accessiblestatesethelper.hxx>
|
||||
|
||||
using namespace css;
|
||||
using namespace css::uno;
|
||||
|
||||
namespace sfx2::sidebar {
|
||||
|
||||
Reference<accessibility::XAccessible> AccessibleTitleBar::Create (TitleBar& rTitleBar)
|
||||
{
|
||||
rTitleBar.GetComponentInterface();
|
||||
VCLXWindow* pWindow = rTitleBar.GetWindowPeer();
|
||||
if (pWindow != nullptr)
|
||||
return new Accessible(new AccessibleTitleBar(pWindow));
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AccessibleTitleBar::AccessibleTitleBar (VCLXWindow* pWindow)
|
||||
: VCLXAccessibleComponent(pWindow)
|
||||
{
|
||||
}
|
||||
|
||||
AccessibleTitleBar::~AccessibleTitleBar()
|
||||
{
|
||||
}
|
||||
|
||||
void AccessibleTitleBar::FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet)
|
||||
{
|
||||
VCLXAccessibleComponent::FillAccessibleStateSet(rStateSet);
|
||||
rStateSet.AddState(accessibility::AccessibleStateType::FOCUSABLE);
|
||||
}
|
||||
|
||||
} // end of namespace sfx2::sidebar
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -22,8 +22,7 @@
|
|||
#include <sfx2/sfxresid.hxx>
|
||||
#include <sfx2/strings.hrc>
|
||||
|
||||
#include <vcl/event.hxx>
|
||||
#include <vcl/image.hxx>
|
||||
#include <vcl/customweld.hxx>
|
||||
#include <vcl/ptrstyle.hxx>
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -32,19 +31,46 @@
|
|||
|
||||
namespace sfx2::sidebar {
|
||||
|
||||
namespace
|
||||
class GripWidget : public weld::CustomWidgetController
|
||||
{
|
||||
const sal_Int32 gaLeftGripPadding (3);
|
||||
const sal_Int32 gaRightGripPadding (6);
|
||||
private:
|
||||
BitmapEx maGrip;
|
||||
public:
|
||||
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
|
||||
{
|
||||
weld::CustomWidgetController::SetDrawingArea(pDrawingArea);
|
||||
StyleUpdated();
|
||||
}
|
||||
|
||||
virtual void StyleUpdated() override
|
||||
{
|
||||
maGrip = BitmapEx("sfx2/res/grip.png");
|
||||
Size aGripSize(maGrip.GetSizePixel());
|
||||
set_size_request(aGripSize.Width(), aGripSize.Height());
|
||||
weld::CustomWidgetController::StyleUpdated();
|
||||
}
|
||||
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/) override
|
||||
{
|
||||
rRenderContext.SetBackground(Theme::GetColor(Theme::Color_DeckTitleBarBackground));
|
||||
rRenderContext.DrawBitmapEx(Point(0, 0), maGrip);
|
||||
}
|
||||
};
|
||||
|
||||
DeckTitleBar::DeckTitleBar (const OUString& rsTitle,
|
||||
vcl::Window* pParentWindow,
|
||||
const std::function<void()>& rCloserAction)
|
||||
: TitleBar(rsTitle, pParentWindow, GetBackgroundPaintColor())
|
||||
: TitleBar(pParentWindow, "sfx/ui/decktitlebar.ui", "DeckTitleBar",
|
||||
Theme::Color_DeckTitleBarBackground)
|
||||
, mxGripWidget(new GripWidget)
|
||||
, mxGripWeld(new weld::CustomWeld(*m_xBuilder, "grip", *mxGripWidget))
|
||||
, mxLabel(m_xBuilder->weld_label("label"))
|
||||
, maCloserAction(rCloserAction)
|
||||
, mbIsCloserVisible(false)
|
||||
{
|
||||
mxLabel->set_label(rsTitle);
|
||||
mxGripWidget->SetPointer(PointerStyle::Move);
|
||||
|
||||
OSL_ASSERT(pParentWindow != nullptr);
|
||||
|
||||
if (maCloserAction)
|
||||
|
@ -55,6 +81,37 @@ DeckTitleBar::DeckTitleBar (const OUString& rsTitle,
|
|||
#endif
|
||||
}
|
||||
|
||||
DeckTitleBar::~DeckTitleBar()
|
||||
{
|
||||
disposeOnce();
|
||||
}
|
||||
|
||||
void DeckTitleBar::dispose()
|
||||
{
|
||||
mxLabel.reset();
|
||||
mxGripWeld.reset();
|
||||
mxGripWidget.reset();
|
||||
TitleBar::dispose();
|
||||
}
|
||||
|
||||
tools::Rectangle DeckTitleBar::GetDragArea()
|
||||
{
|
||||
int x, y, width, height;
|
||||
if (mxGripWidget->GetDrawingArea()->get_extents_relative_to(*m_xContainer, x, y, width, height))
|
||||
return tools::Rectangle(Point(x, y), Size(width, height));
|
||||
return tools::Rectangle();
|
||||
}
|
||||
|
||||
void DeckTitleBar::SetTitle(const OUString& rsTitle)
|
||||
{
|
||||
mxLabel->set_label(rsTitle);
|
||||
}
|
||||
|
||||
OUString DeckTitleBar::GetTitle() const
|
||||
{
|
||||
return mxLabel->get_label();
|
||||
}
|
||||
|
||||
void DeckTitleBar::SetCloserVisible (const bool bIsCloserVisible)
|
||||
{
|
||||
if (mbIsCloserVisible == bIsCloserVisible)
|
||||
|
@ -64,82 +121,29 @@ void DeckTitleBar::SetCloserVisible (const bool bIsCloserVisible)
|
|||
|
||||
if (mbIsCloserVisible)
|
||||
{
|
||||
maToolBox->InsertItem(mnCloserItemIndex,
|
||||
Theme::GetImage(Theme::Image_Closer));
|
||||
maToolBox->SetQuickHelpText(mnCloserItemIndex,
|
||||
mxToolBox->set_item_visible("button", true);
|
||||
mxToolBox->set_item_icon_name("button", "sfx2/res/closedoc.png");
|
||||
mxToolBox->set_item_tooltip_text("button",
|
||||
SfxResId(SFX_STR_SIDEBAR_CLOSE_DECK));
|
||||
}
|
||||
else
|
||||
maToolBox->RemoveItem(maToolBox->GetItemPos(mnCloserItemIndex));
|
||||
{
|
||||
mxToolBox->set_item_visible("button", false);
|
||||
}
|
||||
}
|
||||
|
||||
tools::Rectangle DeckTitleBar::GetTitleArea (const tools::Rectangle& rTitleBarBox)
|
||||
void DeckTitleBar::HandleToolBoxItemClick()
|
||||
{
|
||||
Image aGripImage (Theme::GetImage(Theme::Image_Grip));
|
||||
return tools::Rectangle(
|
||||
aGripImage.GetSizePixel().Width() + gaLeftGripPadding + gaRightGripPadding,
|
||||
rTitleBarBox.Top(),
|
||||
rTitleBarBox.Right(),
|
||||
rTitleBarBox.Bottom());
|
||||
}
|
||||
|
||||
tools::Rectangle DeckTitleBar::GetDragArea()
|
||||
{
|
||||
Image aGripImage (Theme::GetImage(Theme::Image_Grip));
|
||||
return tools::Rectangle(0,0,
|
||||
aGripImage.GetSizePixel().Width() + gaLeftGripPadding + gaRightGripPadding,
|
||||
aGripImage.GetSizePixel().Height()
|
||||
);
|
||||
}
|
||||
|
||||
void DeckTitleBar::PaintDecoration(vcl::RenderContext& rRenderContext)
|
||||
{
|
||||
Image aImage (Theme::GetImage(Theme::Image_Grip));
|
||||
const Point aTopLeft(gaLeftGripPadding,
|
||||
(GetSizePixel().Height() - aImage.GetSizePixel().Height()) / 2);
|
||||
rRenderContext.DrawImage(aTopLeft, aImage);
|
||||
}
|
||||
|
||||
Color DeckTitleBar::GetBackgroundPaintColor()
|
||||
{
|
||||
return Theme::GetColor(Theme::Color_DeckTitleBarBackground);
|
||||
}
|
||||
|
||||
void DeckTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
|
||||
{
|
||||
if (nItemIndex == mnCloserItemIndex && maCloserAction)
|
||||
if (maCloserAction)
|
||||
maCloserAction();
|
||||
}
|
||||
|
||||
css::uno::Reference<css::accessibility::XAccessible> DeckTitleBar::CreateAccessible()
|
||||
{
|
||||
SetAccessibleName(msTitle);
|
||||
SetAccessibleDescription(msTitle);
|
||||
return TitleBar::CreateAccessible();
|
||||
}
|
||||
|
||||
void DeckTitleBar::DataChanged (const DataChangedEvent& rEvent)
|
||||
{
|
||||
maToolBox->SetItemImage(
|
||||
mnCloserItemIndex,
|
||||
Theme::GetImage(Theme::Image_Closer));
|
||||
mxToolBox->set_item_icon_name("button", "sfx2/res/closedoc.png");
|
||||
TitleBar::DataChanged(rEvent);
|
||||
}
|
||||
|
||||
|
||||
void DeckTitleBar::MouseMove (const MouseEvent& rMouseEvent)
|
||||
{
|
||||
tools::Rectangle aGrip = GetDragArea();
|
||||
PointerStyle eStyle = PointerStyle::Arrow;
|
||||
|
||||
if ( aGrip.IsInside( rMouseEvent.GetPosPixel() ) )
|
||||
eStyle = PointerStyle::Move;
|
||||
|
||||
SetPointer( eStyle );
|
||||
|
||||
Window::MouseMove( rMouseEvent );
|
||||
}
|
||||
|
||||
} // end of namespace sfx2::sidebar
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -78,7 +78,6 @@ void FocusManager::ClearPanels()
|
|||
if (panel->GetTitleBar())
|
||||
{
|
||||
UnregisterWindow(*panel->GetTitleBar());
|
||||
UnregisterWindow(panel->GetTitleBar()->GetToolBox());
|
||||
}
|
||||
|
||||
panel->RemoveChildEventListener(LINK(this, FocusManager, ChildEventListener));
|
||||
|
@ -100,14 +99,12 @@ void FocusManager::SetDeckTitle (DeckTitleBar* pDeckTitleBar)
|
|||
if (mpDeckTitleBar != nullptr)
|
||||
{
|
||||
UnregisterWindow(*mpDeckTitleBar);
|
||||
UnregisterWindow(mpDeckTitleBar->GetToolBox());
|
||||
}
|
||||
mpDeckTitleBar = pDeckTitleBar;
|
||||
|
||||
if (mpDeckTitleBar != nullptr)
|
||||
{
|
||||
RegisterWindow(*mpDeckTitleBar);
|
||||
RegisterWindow(mpDeckTitleBar->GetToolBox());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +117,6 @@ void FocusManager::SetPanels (const SharedPanelContainer& rPanels)
|
|||
if (panel->GetTitleBar())
|
||||
{
|
||||
RegisterWindow(*panel->GetTitleBar());
|
||||
RegisterWindow(panel->GetTitleBar()->GetToolBox());
|
||||
}
|
||||
|
||||
// Register also as child event listener at the panel.
|
||||
|
@ -157,8 +153,6 @@ FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& r
|
|||
{
|
||||
if (mpDeckTitleBar == &rWindow)
|
||||
return FocusLocation(PC_DeckTitle, -1);
|
||||
else if (&mpDeckTitleBar->GetToolBox() == &rWindow)
|
||||
return FocusLocation(PC_DeckToolBox, -1);
|
||||
}
|
||||
|
||||
// Search the panels.
|
||||
|
@ -169,8 +163,6 @@ FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& r
|
|||
VclPtr<TitleBar> pTitleBar = maPanels[nIndex]->GetTitleBar();
|
||||
if (pTitleBar == &rWindow)
|
||||
return FocusLocation(PC_PanelTitle, nIndex);
|
||||
if (pTitleBar!=nullptr && &pTitleBar->GetToolBox()==&rWindow)
|
||||
return FocusLocation(PC_PanelToolBox, nIndex);
|
||||
}
|
||||
|
||||
// Search the buttons.
|
||||
|
@ -190,11 +182,10 @@ void FocusManager::FocusDeckTitle()
|
|||
{
|
||||
mpDeckTitleBar->GrabFocus();
|
||||
}
|
||||
else if (mpDeckTitleBar->GetToolBox().GetItemCount() > 0)
|
||||
else if (mpDeckTitleBar->GetToolBox().get_n_items() > 0)
|
||||
{
|
||||
ToolBox& rToolBox = mpDeckTitleBar->GetToolBox();
|
||||
rToolBox.GrabFocus();
|
||||
rToolBox.Invalidate();
|
||||
weld::Toolbar& rToolBox = mpDeckTitleBar->GetToolBox();
|
||||
rToolBox.grab_focus();
|
||||
}
|
||||
else
|
||||
FocusPanel(0, false);
|
||||
|
@ -293,7 +284,6 @@ void FocusManager::RemoveWindow (vcl::Window& rWindow)
|
|||
if ((*iPanel)->GetTitleBar() != nullptr)
|
||||
{
|
||||
UnregisterWindow(*(*iPanel)->GetTitleBar());
|
||||
UnregisterWindow((*iPanel)->GetTitleBar()->GetToolBox());
|
||||
}
|
||||
maPanels.erase(iPanel);
|
||||
return;
|
||||
|
@ -313,12 +303,12 @@ void FocusManager::MoveFocusInsidePanel (
|
|||
const sal_Int32 nDirection)
|
||||
{
|
||||
const bool bHasToolBoxItem (
|
||||
maPanels[rFocusLocation.mnIndex]->GetTitleBar()->GetToolBox().GetItemCount() > 0);
|
||||
maPanels[rFocusLocation.mnIndex]->GetTitleBar()->GetToolBox().get_n_items() > 0);
|
||||
switch (rFocusLocation.meComponent)
|
||||
{
|
||||
case PC_PanelTitle:
|
||||
if (nDirection > 0 && bHasToolBoxItem)
|
||||
maPanels[rFocusLocation.mnIndex]->GetTitleBar()->GetToolBox().GrabFocus();
|
||||
maPanels[rFocusLocation.mnIndex]->GetTitleBar()->GetToolBox().grab_focus();
|
||||
else
|
||||
FocusPanelContent(rFocusLocation.mnIndex);
|
||||
break;
|
||||
|
@ -343,14 +333,14 @@ void FocusManager::MoveFocusInsideDeckTitle (
|
|||
// is moved between a) deck title, b) deck closer and c) content
|
||||
// of panel 0.
|
||||
const bool bHasToolBoxItem (
|
||||
mpDeckTitleBar->GetToolBox().GetItemCount() > 0);
|
||||
mpDeckTitleBar->GetToolBox().get_n_items() > 0);
|
||||
switch (rFocusLocation.meComponent)
|
||||
{
|
||||
case PC_DeckTitle:
|
||||
if (nDirection<0 && ! IsPanelTitleVisible(0))
|
||||
FocusPanelContent(0);
|
||||
else if (bHasToolBoxItem)
|
||||
mpDeckTitleBar->GetToolBox().GrabFocus();
|
||||
mpDeckTitleBar->GetToolBox().grab_focus();
|
||||
break;
|
||||
|
||||
case PC_DeckToolBox:
|
||||
|
|
|
@ -51,7 +51,6 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor,
|
|||
)
|
||||
: Window(pParentWindow)
|
||||
, msPanelId(rPanelDescriptor.msId)
|
||||
, mpTitleBar(VclPtr<PanelTitleBar>::Create(rPanelDescriptor.msTitle, pParentWindow, this))
|
||||
, mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional)
|
||||
, mxElement()
|
||||
, mxPanelComponent()
|
||||
|
@ -60,6 +59,7 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor,
|
|||
, maDeckLayoutTrigger(rDeckLayoutTrigger)
|
||||
, maContextAccess(rContextAccess)
|
||||
, mxFrame(rxFrame)
|
||||
, mpTitleBar(VclPtr<PanelTitleBar>::Create(rPanelDescriptor.msTitle, pParentWindow, this))
|
||||
{
|
||||
SetText(rPanelDescriptor.msTitle);
|
||||
}
|
||||
|
@ -134,6 +134,7 @@ void Panel::SetExpanded (const bool bIsExpanded)
|
|||
return;
|
||||
|
||||
mbIsExpanded = bIsExpanded;
|
||||
mpTitleBar->UpdateExpandedState();
|
||||
maDeckLayoutTrigger();
|
||||
|
||||
if (maContextAccess && pSidebarController)
|
||||
|
|
|
@ -36,25 +36,43 @@ using namespace css::uno;
|
|||
|
||||
namespace sfx2::sidebar {
|
||||
|
||||
const sal_Int32 gaLeftIconPadding (5);
|
||||
const sal_Int32 gaRightIconPadding (5);
|
||||
|
||||
PanelTitleBar::PanelTitleBar(const OUString& rsTitle,
|
||||
vcl::Window* pParentWindow,
|
||||
Panel* pPanel)
|
||||
: TitleBar(rsTitle, pParentWindow, GetBackgroundPaintColor()),
|
||||
mbIsLeftButtonDown(false),
|
||||
: TitleBar(pParentWindow, "sfx/ui/paneltitlebar.ui", "PanelTitleBar",
|
||||
Theme::Color_PanelTitleBarBackground),
|
||||
mxExpander(m_xBuilder->weld_expander("expander")),
|
||||
mpPanel(pPanel),
|
||||
mxFrame(),
|
||||
msMoreOptionsCommand()
|
||||
{
|
||||
OSL_ASSERT(mpPanel != nullptr);
|
||||
mxExpander->set_label(rsTitle);
|
||||
mxExpander->connect_expanded(LINK(this, PanelTitleBar, ExpandHdl));
|
||||
|
||||
assert(mpPanel);
|
||||
|
||||
UpdateExpandedState();
|
||||
|
||||
#ifdef DEBUG
|
||||
SetText(OUString("PanelTitleBar"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void PanelTitleBar::SetTitle(const OUString& rsTitle)
|
||||
{
|
||||
mxExpander->set_label(rsTitle);
|
||||
}
|
||||
|
||||
OUString PanelTitleBar::GetTitle() const
|
||||
{
|
||||
return mxExpander->get_label();
|
||||
}
|
||||
|
||||
void PanelTitleBar::UpdateExpandedState()
|
||||
{
|
||||
mxExpander->set_expanded(mpPanel->IsExpanded());
|
||||
}
|
||||
|
||||
PanelTitleBar::~PanelTitleBar()
|
||||
{
|
||||
disposeOnce();
|
||||
|
@ -63,18 +81,18 @@ PanelTitleBar::~PanelTitleBar()
|
|||
void PanelTitleBar::dispose()
|
||||
{
|
||||
mpPanel.clear();
|
||||
mxExpander.reset();
|
||||
TitleBar::dispose();
|
||||
}
|
||||
|
||||
void PanelTitleBar::SetMoreOptionsCommand(const OUString& rsCommandName,
|
||||
const css::uno::Reference<css::frame::XFrame>& rxFrame,
|
||||
const css::uno::Reference<css::frame::XController>& rxController)
|
||||
const css::uno::Reference<css::frame::XFrame>& rxFrame)
|
||||
{
|
||||
if (rsCommandName == msMoreOptionsCommand)
|
||||
return;
|
||||
|
||||
if (msMoreOptionsCommand.getLength() > 0)
|
||||
maToolBox->RemoveItem(maToolBox->GetItemPos(mnMenuItemIndex));
|
||||
mxToolBox->set_item_visible("button", false);
|
||||
|
||||
msMoreOptionsCommand = rsCommandName;
|
||||
mxFrame = rxFrame;
|
||||
|
@ -82,63 +100,15 @@ void PanelTitleBar::SetMoreOptionsCommand(const OUString& rsCommandName,
|
|||
if (msMoreOptionsCommand.getLength() <= 0)
|
||||
return;
|
||||
|
||||
maToolBox->InsertItem(
|
||||
mnMenuItemIndex,
|
||||
Theme::GetImage(Theme::Image_PanelMenu));
|
||||
Reference<frame::XToolbarController> xController (
|
||||
ControllerFactory::CreateToolBoxController(
|
||||
maToolBox.get(),
|
||||
mnMenuItemIndex,
|
||||
msMoreOptionsCommand,
|
||||
rxFrame, rxController,
|
||||
VCLUnoHelper::GetInterface(maToolBox.get()),
|
||||
0, true));
|
||||
maToolBox->SetController(mnMenuItemIndex, xController);
|
||||
maToolBox->SetQuickHelpText(
|
||||
mnMenuItemIndex,
|
||||
mxToolBox->set_item_visible("button", true);
|
||||
mxToolBox->set_item_icon_name("button", "sfx2/res/symphony/morebutton.png");
|
||||
mxToolBox->set_item_tooltip_text(
|
||||
"button",
|
||||
SfxResId(SFX_STR_SIDEBAR_MORE_OPTIONS));
|
||||
}
|
||||
|
||||
tools::Rectangle PanelTitleBar::GetTitleArea (const tools::Rectangle& rTitleBarBox)
|
||||
void PanelTitleBar::HandleToolBoxItemClick()
|
||||
{
|
||||
if (mpPanel != nullptr)
|
||||
{
|
||||
Image aImage (mpPanel->IsExpanded()
|
||||
? Theme::GetImage(Theme::Image_Expand)
|
||||
: Theme::GetImage(Theme::Image_Collapse));
|
||||
return tools::Rectangle(
|
||||
aImage.GetSizePixel().Width() + gaLeftIconPadding + gaRightIconPadding,
|
||||
rTitleBarBox.Top(),
|
||||
rTitleBarBox.Right(),
|
||||
rTitleBarBox.Bottom());
|
||||
}
|
||||
else
|
||||
return rTitleBarBox;
|
||||
}
|
||||
|
||||
void PanelTitleBar::PaintDecoration (vcl::RenderContext& rRenderContext)
|
||||
{
|
||||
if (mpPanel != nullptr)
|
||||
{
|
||||
Image aImage (mpPanel->IsExpanded()
|
||||
? Theme::GetImage(Theme::Image_Collapse)
|
||||
: Theme::GetImage(Theme::Image_Expand));
|
||||
const Point aTopLeft(gaLeftIconPadding,
|
||||
(GetSizePixel().Height() - aImage.GetSizePixel().Height()) / 2);
|
||||
rRenderContext.DrawImage(aTopLeft, aImage);
|
||||
}
|
||||
}
|
||||
|
||||
Color PanelTitleBar::GetBackgroundPaintColor()
|
||||
{
|
||||
return Theme::GetColor(Theme::Color_PanelTitleBarBackground);
|
||||
}
|
||||
|
||||
void PanelTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
|
||||
{
|
||||
if (nItemIndex != mnMenuItemIndex)
|
||||
return;
|
||||
|
||||
if (msMoreOptionsCommand.getLength() <= 0)
|
||||
return;
|
||||
|
||||
|
@ -155,48 +125,16 @@ void PanelTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
|
|||
}
|
||||
}
|
||||
|
||||
Reference<accessibility::XAccessible> PanelTitleBar::CreateAccessible()
|
||||
IMPL_LINK(PanelTitleBar, ExpandHdl, weld::Expander&, rExpander, void)
|
||||
{
|
||||
SetAccessibleName(msTitle);
|
||||
SetAccessibleDescription(msTitle);
|
||||
return TitleBar::CreateAccessible();
|
||||
}
|
||||
|
||||
void PanelTitleBar::MouseButtonDown (const MouseEvent& rMouseEvent)
|
||||
{
|
||||
if (rMouseEvent.IsLeft())
|
||||
{
|
||||
mbIsLeftButtonDown = true;
|
||||
CaptureMouse();
|
||||
}
|
||||
}
|
||||
|
||||
void PanelTitleBar::MouseButtonUp (const MouseEvent& rMouseEvent)
|
||||
{
|
||||
if (IsMouseCaptured())
|
||||
ReleaseMouse();
|
||||
|
||||
if (rMouseEvent.IsLeft())
|
||||
{
|
||||
if (mbIsLeftButtonDown)
|
||||
{
|
||||
if (mpPanel != nullptr)
|
||||
{
|
||||
mpPanel->SetExpanded( ! mpPanel->IsExpanded());
|
||||
Invalidate();
|
||||
GrabFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mbIsLeftButtonDown)
|
||||
mbIsLeftButtonDown = false;
|
||||
if (!mpPanel)
|
||||
return;
|
||||
mpPanel->SetExpanded(rExpander.get_expanded());
|
||||
}
|
||||
|
||||
void PanelTitleBar::DataChanged (const DataChangedEvent& rEvent)
|
||||
{
|
||||
maToolBox->SetItemImage(
|
||||
mnMenuItemIndex,
|
||||
Theme::GetImage(Theme::Image_PanelMenu));
|
||||
mxToolBox->set_item_icon_name("button", "sfx2/res/symphony/morebutton.png");
|
||||
TitleBar::DataChanged(rEvent);
|
||||
}
|
||||
|
||||
|
|
|
@ -734,7 +734,7 @@ void SidebarController::CreatePanels(const OUString& rDeckId, const Context& rCo
|
|||
{
|
||||
pTitleBar->SetMoreOptionsCommand(
|
||||
rPanelContexDescriptor.msMenuCommand,
|
||||
mxFrame, xController);
|
||||
mxFrame);
|
||||
}
|
||||
++nWriteIndex;
|
||||
}
|
||||
|
@ -1575,17 +1575,15 @@ void SidebarController::FadeIn()
|
|||
tools::Rectangle SidebarController::GetDeckDragArea() const
|
||||
{
|
||||
tools::Rectangle aRect;
|
||||
|
||||
if (mpCurrentDeck)
|
||||
{
|
||||
VclPtr<DeckTitleBar> pTitleBar(mpCurrentDeck->GetTitleBar());
|
||||
|
||||
if (pTitleBar)
|
||||
{
|
||||
aRect = DeckTitleBar::GetDragArea();
|
||||
aRect = pTitleBar->GetDragArea();
|
||||
}
|
||||
}
|
||||
|
||||
return aRect;
|
||||
}
|
||||
|
||||
|
|
|
@ -240,24 +240,9 @@ void Theme::UpdateTheme()
|
|||
setPropertyValue(
|
||||
maPropertyIdToNameMap[Color_VerticalBorder],
|
||||
Any(sal_Int32(aBorderColor.GetRGBColor())));
|
||||
setPropertyValue(
|
||||
maPropertyIdToNameMap[Image_Grip],
|
||||
Any(OUString("private:graphicrepository/sfx2/res/grip.png")));
|
||||
setPropertyValue(
|
||||
maPropertyIdToNameMap[Image_Expand],
|
||||
Any(OUString("private:graphicrepository/res/plus.png")));
|
||||
setPropertyValue(
|
||||
maPropertyIdToNameMap[Image_Collapse],
|
||||
Any(OUString("private:graphicrepository/res/minus.png")));
|
||||
setPropertyValue(
|
||||
maPropertyIdToNameMap[Image_TabBarMenu],
|
||||
Any(OUString("private:graphicrepository/sfx2/res/symphony/open_more.png")));
|
||||
setPropertyValue(
|
||||
maPropertyIdToNameMap[Image_PanelMenu],
|
||||
Any(OUString("private:graphicrepository/sfx2/res/symphony/morebutton.png")));
|
||||
setPropertyValue(
|
||||
maPropertyIdToNameMap[Image_Closer],
|
||||
Any(OUString("private:graphicrepository/sfx2/res/closedoc.png")));
|
||||
setPropertyValue(
|
||||
maPropertyIdToNameMap[Image_CloseIndicator],
|
||||
Any(OUString("private:graphicrepository/cmd/lc_decrementlevel.png")));
|
||||
|
@ -532,24 +517,9 @@ void Theme::SetupPropertyMaps()
|
|||
maIntegers.resize(Int_Bool_ - Color_Int_ - 1);
|
||||
maBooleans.resize(Post_Bool_ - Int_Bool_ - 1);
|
||||
|
||||
maPropertyNameToIdMap["Image_Grip"]=Image_Grip;
|
||||
maPropertyIdToNameMap[Image_Grip]="Image_Grip";
|
||||
|
||||
maPropertyNameToIdMap["Image_Expand"]=Image_Expand;
|
||||
maPropertyIdToNameMap[Image_Expand]="Image_Expand";
|
||||
|
||||
maPropertyNameToIdMap["Image_Collapse"]=Image_Collapse;
|
||||
maPropertyIdToNameMap[Image_Collapse]="Image_Collapse";
|
||||
|
||||
maPropertyNameToIdMap["Image_TabBarMenu"]=Image_TabBarMenu;
|
||||
maPropertyIdToNameMap[Image_TabBarMenu]="Image_TabBarMenu";
|
||||
|
||||
maPropertyNameToIdMap["Image_PanelMenu"]=Image_PanelMenu;
|
||||
maPropertyIdToNameMap[Image_PanelMenu]="Image_PanelMenu";
|
||||
|
||||
maPropertyNameToIdMap["Image_Closer"]=Image_Closer;
|
||||
maPropertyIdToNameMap[Image_Closer]="Image_Closer";
|
||||
|
||||
maPropertyNameToIdMap["Image_CloseIndicator"]=Image_CloseIndicator;
|
||||
maPropertyIdToNameMap[Image_CloseIndicator]="Image_CloseIndicator";
|
||||
|
||||
|
@ -672,12 +642,7 @@ Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem)
|
|||
{
|
||||
switch(eItem)
|
||||
{
|
||||
case Image_Grip:
|
||||
case Image_Expand:
|
||||
case Image_Collapse:
|
||||
case Image_TabBarMenu:
|
||||
case Image_PanelMenu:
|
||||
case Image_Closer:
|
||||
case Image_CloseIndicator:
|
||||
return PT_Image;
|
||||
|
||||
|
|
|
@ -18,28 +18,22 @@
|
|||
*/
|
||||
|
||||
#include <sidebar/TitleBar.hxx>
|
||||
#include <sidebar/AccessibleTitleBar.hxx>
|
||||
|
||||
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
const sal_Int32 gnLeftIconSpace (3);
|
||||
const sal_Int32 gnRightIconSpace (3);
|
||||
}
|
||||
|
||||
namespace sfx2::sidebar {
|
||||
|
||||
TitleBar::TitleBar(const OUString& rsTitle,
|
||||
vcl::Window* pParentWindow,
|
||||
const Color& rInitialBackgroundColor)
|
||||
: Window(pParentWindow)
|
||||
, maToolBox(VclPtr<SidebarToolBox>::Create(this))
|
||||
, msTitle(rsTitle)
|
||||
, maIcon()
|
||||
, maBackgroundColor(rInitialBackgroundColor)
|
||||
TitleBar::TitleBar(vcl::Window* pParentWindow,
|
||||
const OUString& rUIXMLDescription, const OString& rID,
|
||||
Theme::ThemeItem eThemeItem)
|
||||
: InterimItemWindow(pParentWindow, rUIXMLDescription, rID)
|
||||
, mxAddonImage(m_xBuilder->weld_image("addonimage"))
|
||||
, mxToolBox(m_xBuilder->weld_toolbar("toolbar"))
|
||||
, meThemeItem(eThemeItem)
|
||||
{
|
||||
maToolBox->SetSelectHdl(LINK(this, TitleBar, SelectionHandler));
|
||||
Color aBgColor = Theme::GetColor(meThemeItem);
|
||||
m_xContainer->set_background(aBgColor);
|
||||
mxToolBox->set_background(aBgColor);
|
||||
|
||||
mxToolBox->connect_clicked(LINK(this, TitleBar, SelectionHandler));
|
||||
}
|
||||
|
||||
TitleBar::~TitleBar()
|
||||
|
@ -49,121 +43,25 @@ TitleBar::~TitleBar()
|
|||
|
||||
void TitleBar::dispose()
|
||||
{
|
||||
maToolBox.disposeAndClear();
|
||||
vcl::Window::dispose();
|
||||
}
|
||||
|
||||
void TitleBar::SetTitle(const OUString& rsTitle)
|
||||
{
|
||||
msTitle = rsTitle;
|
||||
Invalidate();
|
||||
mxToolBox.reset();
|
||||
mxAddonImage.reset();
|
||||
InterimItemWindow::dispose();
|
||||
}
|
||||
|
||||
void TitleBar::SetIcon(const css::uno::Reference<css::graphic::XGraphic>& rIcon)
|
||||
{
|
||||
maIcon = Image(rIcon);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void TitleBar::ApplySettings(vcl::RenderContext& rRenderContext)
|
||||
{
|
||||
rRenderContext.SetBackground(maBackgroundColor);
|
||||
}
|
||||
|
||||
void TitleBar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rUpdateArea*/)
|
||||
{
|
||||
// Paint title bar background.
|
||||
Size aWindowSize (GetSizePixel());
|
||||
tools::Rectangle aTitleBarBox(0,0, aWindowSize.Width(), aWindowSize.Height());
|
||||
|
||||
PaintDecoration(rRenderContext);
|
||||
const tools::Rectangle aTitleBox(GetTitleArea(aTitleBarBox));
|
||||
PaintTitle(rRenderContext, aTitleBox);
|
||||
PaintFocus(rRenderContext, aTitleBox);
|
||||
mxAddonImage->set_image(rIcon);
|
||||
mxAddonImage->set_visible(rIcon.is());
|
||||
}
|
||||
|
||||
void TitleBar::DataChanged (const DataChangedEvent& /*rEvent*/)
|
||||
{
|
||||
maBackgroundColor = GetBackgroundPaintColor();
|
||||
Invalidate();
|
||||
m_xContainer->set_background(Theme::GetColor(meThemeItem));
|
||||
}
|
||||
|
||||
void TitleBar::setPosSizePixel (tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags)
|
||||
IMPL_LINK_NOARG(TitleBar, SelectionHandler, const OString&, void)
|
||||
{
|
||||
Window::setPosSizePixel(nX, nY, nWidth, nHeight, nFlags);
|
||||
|
||||
// Place the toolbox.
|
||||
const sal_Int32 nToolBoxWidth (maToolBox->GetItemPosRect(0).GetWidth());
|
||||
maToolBox->setPosSizePixel(nWidth - nToolBoxWidth,0, nToolBoxWidth, nHeight);
|
||||
maToolBox->Show();
|
||||
}
|
||||
|
||||
void TitleBar::HandleToolBoxItemClick(const sal_uInt16 /*nItemIndex*/)
|
||||
{
|
||||
// Any real processing has to be done in derived class.
|
||||
}
|
||||
|
||||
css::uno::Reference<css::accessibility::XAccessible> TitleBar::CreateAccessible()
|
||||
{
|
||||
SetAccessibleRole(css::accessibility::AccessibleRole::PANEL);
|
||||
return AccessibleTitleBar::Create(*this);
|
||||
}
|
||||
|
||||
void TitleBar::PaintTitle(vcl::RenderContext& rRenderContext, const tools::Rectangle& rTitleBox)
|
||||
{
|
||||
rRenderContext.Push(PushFlags::FONT | PushFlags::TEXTCOLOR);
|
||||
|
||||
tools::Rectangle aTitleBox(rTitleBox);
|
||||
|
||||
// When there is an icon then paint it at the left of the given
|
||||
// box.
|
||||
if (!!maIcon)
|
||||
{
|
||||
rRenderContext.DrawImage(Point(aTitleBox.Left() + gnLeftIconSpace,
|
||||
aTitleBox.Top() + (aTitleBox.GetHeight() - maIcon.GetSizePixel().Height()) / 2),
|
||||
maIcon);
|
||||
aTitleBox.AdjustLeft(gnLeftIconSpace + maIcon.GetSizePixel().Width() + gnRightIconSpace );
|
||||
}
|
||||
|
||||
vcl::Font aFont(rRenderContext.GetFont());
|
||||
aFont.SetWeight(WEIGHT_BOLD);
|
||||
rRenderContext.SetFont(aFont);
|
||||
|
||||
// Paint title bar text.
|
||||
rRenderContext.SetTextColor(rRenderContext.GetTextColor());
|
||||
rRenderContext.DrawText(aTitleBox, msTitle, DrawTextFlags::Left | DrawTextFlags::VCenter);
|
||||
rRenderContext.Pop();
|
||||
}
|
||||
|
||||
void TitleBar::PaintFocus(vcl::RenderContext& rRenderContext, const tools::Rectangle& rFocusBox)
|
||||
{
|
||||
rRenderContext.Push(PushFlags::FONT | PushFlags::TEXTCOLOR);
|
||||
|
||||
vcl::Font aFont(rRenderContext.GetFont());
|
||||
aFont.SetWeight(WEIGHT_BOLD);
|
||||
rRenderContext.SetFont(aFont);
|
||||
|
||||
const tools::Rectangle aTextBox(rRenderContext.GetTextRect(rFocusBox, msTitle, DrawTextFlags::Left | DrawTextFlags::VCenter));
|
||||
|
||||
const tools::Rectangle aLargerTextBox(aTextBox.Left() - 2,
|
||||
aTextBox.Top() - 2,
|
||||
aTextBox.Right() + 2,
|
||||
aTextBox.Bottom() + 2);
|
||||
|
||||
if (HasFocus())
|
||||
Window::ShowFocus(aLargerTextBox);
|
||||
else
|
||||
Window::HideFocus();
|
||||
|
||||
rRenderContext.Pop();
|
||||
}
|
||||
|
||||
IMPL_LINK(TitleBar, SelectionHandler, ToolBox*, pToolBox, void)
|
||||
{
|
||||
OSL_ASSERT(maToolBox.get()==pToolBox);
|
||||
const sal_uInt16 nItemId (maToolBox->GetHighlightItemId());
|
||||
|
||||
HandleToolBoxItemClick(nItemId);
|
||||
HandleToolBoxItemClick();
|
||||
}
|
||||
|
||||
} // end of namespace sfx2::sidebar
|
||||
|
|
82
sfx2/uiconfig/ui/decktitlebar.ui
Normal file
82
sfx2/uiconfig/ui/decktitlebar.ui
Normal file
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.38.1 -->
|
||||
<interface domain="sfx">
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkBox" id="DeckTitleBar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="grip">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="addonimage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="toolbar-style">icons</property>
|
||||
<property name="show-arrow">False</property>
|
||||
<property name="icon_size">2</property>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="use-underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<style>
|
||||
<class name="small-button"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
89
sfx2/uiconfig/ui/paneltitlebar.ui
Normal file
89
sfx2/uiconfig/ui/paneltitlebar.ui
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.38.1 -->
|
||||
<interface domain="sfx">
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkBox" id="PanelTitleBar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="addonimage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander" id="expander">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label-fill">True</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="use-underline">True</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="toolbar-style">icons</property>
|
||||
<property name="show-arrow">False</property>
|
||||
<property name="icon_size">2</property>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="use-underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<style>
|
||||
<class name="small-button"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -11697,7 +11697,6 @@ sfx2/inc/notebookbar/NotebookbarTabControl.hxx
|
|||
sfx2/inc/preventduplicateinteraction.hxx
|
||||
sfx2/inc/recentdocsview.hxx
|
||||
sfx2/inc/sidebar/Accessible.hxx
|
||||
sfx2/inc/sidebar/AccessibleTitleBar.hxx
|
||||
sfx2/inc/sidebar/ContextChangeBroadcaster.hxx
|
||||
sfx2/inc/sidebar/ContextList.hxx
|
||||
sfx2/inc/sidebar/ControlFactory.hxx
|
||||
|
@ -11947,7 +11946,6 @@ sfx2/source/notify/hintpost.cxx
|
|||
sfx2/source/notify/openurlhint.cxx
|
||||
sfx2/source/safemode/safemode.cxx
|
||||
sfx2/source/sidebar/Accessible.cxx
|
||||
sfx2/source/sidebar/AccessibleTitleBar.cxx
|
||||
sfx2/source/sidebar/AsynchronousCall.cxx
|
||||
sfx2/source/sidebar/Context.cxx
|
||||
sfx2/source/sidebar/ContextChangeBroadcaster.cxx
|
||||
|
|
|
@ -10,6 +10,9 @@ sfx2/uiconfig/ui/cmisline.ui://GtkSpinButton[@id='time'] no-labelled-by
|
|||
sfx2/uiconfig/ui/custominfopage.ui://GtkLabel[@id='name'] orphan-label
|
||||
sfx2/uiconfig/ui/custominfopage.ui://GtkLabel[@id='type'] orphan-label
|
||||
sfx2/uiconfig/ui/custominfopage.ui://GtkLabel[@id='value'] orphan-label
|
||||
sfx2/uiconfig/ui/decktitlebar.ui://GtkImage[@id='addonimage'] no-labelled-by
|
||||
sfx2/uiconfig/ui/decktitlebar.ui://GtkLabel[@id='label'] orphan-label
|
||||
sfx2/uiconfig/ui/decktitlebar.ui://GtkToolButton[@id='button'] button-no-label
|
||||
sfx2/uiconfig/ui/documentinfopage.ui://GtkLabel[@id='showcreate'] orphan-label
|
||||
sfx2/uiconfig/ui/documentinfopage.ui://GtkLabel[@id='showmodify'] orphan-label
|
||||
sfx2/uiconfig/ui/documentinfopage.ui://GtkLabel[@id='showsigned'] orphan-label
|
||||
|
@ -41,6 +44,8 @@ sfx2/uiconfig/ui/templatepanel.ui://GtkToggleToolButton[@id='5'] button-no-label
|
|||
sfx2/uiconfig/ui/templatepanel.ui://GtkToggleToolButton[@id='6'] button-no-label
|
||||
sfx2/uiconfig/ui/templatepanel.ui://GtkToggleToolButton[@id='65535'] button-no-label
|
||||
sfx2/uiconfig/ui/templatedlg.ui://GtkLabel[@id='label1'] orphan-label
|
||||
sfx2/uiconfig/ui/paneltitlebar.ui://GtkImage[@id='addonimage'] no-labelled-by
|
||||
sfx2/uiconfig/ui/paneltitlebar.ui://GtkToolButton[@id='button'] button-no-label
|
||||
sfx2/uiconfig/ui/versioncommentdialog.ui://GtkLabel[@id='timestamp'] orphan-label
|
||||
sfx2/uiconfig/ui/versioncommentdialog.ui://GtkLabel[@id='author'] orphan-label
|
||||
sfx2/uiconfig/ui/versioncommentdialog.ui://GtkTextView[@id='textview'] no-labelled-by
|
||||
|
|
Loading…
Reference in a new issue