diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /include/svx/sidebar | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/svx/sidebar')
-rw-r--r-- | include/svx/sidebar/AreaPropertyPanelBase.hxx | 186 | ||||
-rw-r--r-- | include/svx/sidebar/AreaTransparencyGradientPopup.hxx | 69 | ||||
-rw-r--r-- | include/svx/sidebar/ContextChangeEventMultiplexer.hxx | 65 | ||||
-rw-r--r-- | include/svx/sidebar/InspectorTextPanel.hxx | 61 | ||||
-rw-r--r-- | include/svx/sidebar/LinePropertyPanelBase.hxx | 140 | ||||
-rw-r--r-- | include/svx/sidebar/LineWidthPopup.hxx | 71 | ||||
-rw-r--r-- | include/svx/sidebar/SelectionAnalyzer.hxx | 76 | ||||
-rw-r--r-- | include/svx/sidebar/SelectionChangeHandler.hxx | 75 | ||||
-rw-r--r-- | include/svx/sidebar/ValueSetWithTextControl.hxx | 62 |
9 files changed, 805 insertions, 0 deletions
diff --git a/include/svx/sidebar/AreaPropertyPanelBase.hxx b/include/svx/sidebar/AreaPropertyPanelBase.hxx new file mode 100644 index 0000000000..07a5873acf --- /dev/null +++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx @@ -0,0 +1,186 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANELBASE_HXX +#define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANELBASE_HXX + +#include <memory> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <svx/sidebar/AreaTransparencyGradientPopup.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <svx/colorbox.hxx> +#include <basegfx/utils/bgradient.hxx> +#include <svx/xfilluseslidebackgrounditem.hxx> +#include <svx/xfillit0.hxx> +#include <svx/xflclit.hxx> +#include <svx/xflgrit.hxx> +#include <svx/xflhtit.hxx> +#include <svx/xbtmpit.hxx> +#include <sfx2/sidebar/PanelLayout.hxx> +#include <svl/intitem.hxx> +#include <svx/svxdllapi.h> +#include <vcl/EnumContext.hxx> + +class ToolbarUnoDispatcher; +class XFillFloatTransparenceItem; +class XFillUseSlideBackgroundItem; +class XFillTransparenceItem; +class XFillStyleItem; +class XFillGradientItem; +class XFillColorItem; +class XFillHatchItem; +class XFillBitmapItem; + +namespace svx::sidebar { + +class SVX_DLLPUBLIC AreaPropertyPanelBase +: public PanelLayout, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState) override; + + virtual void GetControlState( + const sal_uInt16 /*nSId*/, + boost::property_tree::ptree& /*rState*/) override {}; + + const static sal_Int32 DEFAULT_CENTERX; + const static sal_Int32 DEFAULT_CENTERY; + const static sal_Int32 DEFAULT_ANGLE; + const static sal_Int32 DEFAULT_STARTVALUE; + const static sal_Int32 DEFAULT_ENDVALUE; + const static sal_Int32 DEFAULT_BORDER; + + const basegfx::BGradient& GetGradient (const css::awt::GradientStyle eStyle) const; + void SetGradient (const basegfx::BGradient& rGradient); + sal_Int32 GetSelectedTransparencyTypeIndex() const; + + // constructor/destructor + AreaPropertyPanelBase( + weld::Widget* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame); + + virtual ~AreaPropertyPanelBase() override; + + virtual void setFillTransparence(const XFillTransparenceItem& rItem) = 0; + virtual void setFillFloatTransparence(const XFillFloatTransparenceItem& rItem) = 0; + virtual void setFillStyle(const XFillStyleItem& rItem) = 0; + virtual void setFillStyleAndColor(const XFillStyleItem* pStyleItem, const XFillColorItem& aColorItem) = 0; + virtual void setFillStyleAndGradient(const XFillStyleItem* pStyleItem, const XFillGradientItem& aGradientItem) = 0; + virtual void setFillStyleAndHatch(const XFillStyleItem* pStyleItem, const XFillHatchItem& aHatchItem) = 0; + virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const XFillBitmapItem& aHatchItem) = 0; + virtual void setFillUseBackground(const XFillStyleItem* pStyleItem, const XFillUseSlideBackgroundItem& rItem) = 0; + + void updateFillTransparence(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState); + void updateFillFloatTransparence(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState); + void updateFillStyle(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState); + void updateFillGradient(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState); + void updateFillHatch(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState); + void updateFillColor(bool bDefaultOrSet, const SfxPoolItem* pState); + void updateFillBitmap(bool BDisabled, bool bDefaultOrSet, const SfxPoolItem* pState); + void updateFillUseBackground(bool BDisabled, bool bDefaultOrSet, const SfxPoolItem* pState); + +private: + void Initialize(); + virtual void HandleContextChange(const vcl::EnumContext& rContext) override; + +protected: + const css::uno::Reference<css::frame::XFrame>& mxFrame; + vcl::EnumContext maContext; + + sal_uInt16 meLastXFS; + + sal_Int32 mnLastPosHatch; + sal_Int32 mnLastPosBitmap; + sal_Int32 mnLastPosPattern; + sal_uInt16 mnLastTransSolid; + OUString msUseBackgroundText; + + basegfx::BGradient maGradientLinear; + basegfx::BGradient maGradientAxial; + basegfx::BGradient maGradientRadial; + basegfx::BGradient maGradientElliptical; + basegfx::BGradient maGradientSquare; + basegfx::BGradient maGradientRect; + + //ui controls + std::unique_ptr<weld::Label> mxColorTextFT; + std::unique_ptr<weld::ComboBox> mxLbFillType; + std::unique_ptr<weld::ComboBox> mxLbFillAttr; + std::unique_ptr<ColorListBox> mxLbFillGradFrom; + std::unique_ptr<ColorListBox> mxLbFillGradTo; + std::unique_ptr<weld::Toolbar> mxToolBoxColor; // for new color picker + std::unique_ptr<ToolbarUnoDispatcher> mxColorDispatch; + std::unique_ptr<weld::Label> mxTrspTextFT; + std::unique_ptr<weld::ComboBox> mxLBTransType; + std::unique_ptr<weld::MetricSpinButton> mxMTRTransparent; + std::unique_ptr<weld::Scale> mxSldTransparent; + std::unique_ptr<weld::Toolbar> mxBTNGradient; + std::unique_ptr<weld::MetricSpinButton> mxMTRAngle; + std::unique_ptr<weld::ComboBox> mxGradientStyle; + std::unique_ptr<weld::Button> mxBmpImport; + std::unique_ptr<AreaTransparencyGradientPopup> mxTrGrPopup; + + std::unique_ptr< XFillStyleItem > mpStyleItem; + std::unique_ptr< XFillColorItem > mpColorItem; + std::unique_ptr< XFillGradientItem > mpFillGradientItem; + std::unique_ptr< XFillHatchItem > mpHatchItem; + std::unique_ptr< XFillBitmapItem > mpBitmapItem; + + OUString maImgAxial; + OUString maImgElli; + OUString maImgQuad; + OUString maImgRadial; + OUString maImgSquare; + OUString maImgLinear; + + std::unique_ptr< XFillFloatTransparenceItem > mpFloatTransparenceItem; + std::unique_ptr< SfxUInt16Item > mpTransparenceItem; + + // MCGR: Preserve ColorStops until we have a UI to edit these + basegfx::BColorStops maColorStops; + + DECL_DLLPRIVATE_LINK(SelectFillTypeHdl, weld::ComboBox&, void ); + DECL_DLLPRIVATE_LINK(SelectFillAttrHdl, weld::ComboBox&, void ); + DECL_DLLPRIVATE_LINK(SelectFillColorHdl, ColorListBox&, void); + DECL_DLLPRIVATE_LINK(ChangeGradientAngle, weld::MetricSpinButton&, void); + DECL_DLLPRIVATE_LINK(ChangeTrgrTypeHdl_Impl, weld::ComboBox&, void); + DECL_DLLPRIVATE_LINK(ModifyTransparentHdl_Impl, weld::MetricSpinButton&, void); + DECL_DLLPRIVATE_LINK(ModifyTransSliderHdl, weld::Scale&, void); + DECL_DLLPRIVATE_LINK(ClickImportBitmapHdl, weld::Button&, void); + DECL_DLLPRIVATE_LINK(ToolbarHdl_Impl, const OUString&, void); + + void ImpUpdateTransparencies(); + void SetTransparency(sal_uInt16 nVal); + void SelectFillAttrHdl_Impl(); + void FillStyleChanged(bool bUpdateModel); + + // MCGR: Preserve ColorStops until we have a UI to edit these + basegfx::BColorStops createColorStops(); +}; + +} // end of namespace svx::sidebar + +#endif // INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sidebar/AreaTransparencyGradientPopup.hxx b/include/svx/sidebar/AreaTransparencyGradientPopup.hxx new file mode 100644 index 0000000000..09931e89e1 --- /dev/null +++ b/include/svx/sidebar/AreaTransparencyGradientPopup.hxx @@ -0,0 +1,69 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTPOPUP_HXX +#define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREATRANSPARENCYGRADIENTPOPUP_HXX + +#include <basegfx/utils/bgradient.hxx> +#include <vcl/weld.hxx> +#include <svtools/toolbarmenu.hxx> + +class XFillFloatTransparenceItem; + +namespace svx::sidebar +{ +class AreaPropertyPanelBase; + +class AreaTransparencyGradientPopup final : public WeldToolbarPopup +{ +private: + AreaPropertyPanelBase& mrAreaPropertyPanel; + std::unique_ptr<weld::Widget> mxCenterGrid; + std::unique_ptr<weld::Widget> mxAngleGrid; + std::unique_ptr<weld::MetricSpinButton> mxMtrTrgrCenterX; + std::unique_ptr<weld::MetricSpinButton> mxMtrTrgrCenterY; + std::unique_ptr<weld::MetricSpinButton> mxMtrTrgrAngle; + std::unique_ptr<weld::Toolbar> mxBtnLeft45; + std::unique_ptr<weld::Toolbar> mxBtnRight45; + std::unique_ptr<weld::MetricSpinButton> mxMtrTrgrStartValue; + std::unique_ptr<weld::MetricSpinButton> mxMtrTrgrEndValue; + std::unique_ptr<weld::MetricSpinButton> mxMtrTrgrBorder; + + // MCGR: Preserve ColorStops until we have a UI to edit these + basegfx::BColorStops maColorStops; + + void InitStatus(XFillFloatTransparenceItem const* pGradientItem); + void ExecuteValueModify(); + DECL_LINK(ModifiedTrgrHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(Left_Click45_Impl, const OUString&, void); + DECL_LINK(Right_Click45_Impl, const OUString&, void); + +public: + AreaTransparencyGradientPopup(const css::uno::Reference<css::frame::XFrame>& rFrame, + AreaPropertyPanelBase& rPanel, weld::Widget* pParent); + ~AreaTransparencyGradientPopup(); + + void Rearrange(XFillFloatTransparenceItem const* pItem); + virtual void GrabFocus() override; +}; + +} // end of namespace svx::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sidebar/ContextChangeEventMultiplexer.hxx b/include/svx/sidebar/ContextChangeEventMultiplexer.hxx new file mode 100644 index 0000000000..1c8f58d1cc --- /dev/null +++ b/include/svx/sidebar/ContextChangeEventMultiplexer.hxx @@ -0,0 +1,65 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_SVX_SIDEBAR_CONTEXTCHANGEEVENTMULTIPLEXER_HXX +#define INCLUDED_SVX_SIDEBAR_CONTEXTCHANGEEVENTMULTIPLEXER_HXX + +#include <svx/svxdllapi.h> +#include <vcl/EnumContext.hxx> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XFrame.hpp> + + +class SfxViewShell; + +/** Convenience frontend for css::ui::ContextChangeEventMultiplexer +*/ +class SVX_DLLPUBLIC ContextChangeEventMultiplexer +{ +public: + /** Notify the activation of a context. + @param rxController + This controller is used to determine the module (ie + application like Writer or Calc). + @param eContext + The activated context. + */ + static void NotifyContextChange ( + const css::uno::Reference<css::frame::XController>& rxController, + const vcl::EnumContext::Context eContext); + + /** Notify the activation of a context. + @param pViewShell + This view shell is used to determine the module (ie + application like Writer or Calc). When <NULL/> then no + notification is made. + @param eContext + The activated context. + */ + static void NotifyContextChange ( + const SfxViewShell* pViewShell, + const vcl::EnumContext::Context eContext); + +private: + static OUString GetModuleName ( + const css::uno::Reference<css::frame::XFrame>& rxFrame); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sidebar/InspectorTextPanel.hxx b/include/svx/sidebar/InspectorTextPanel.hxx new file mode 100644 index 0000000000..f6ef0234ad --- /dev/null +++ b/include/svx/sidebar/InspectorTextPanel.hxx @@ -0,0 +1,61 @@ +/* -*- 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 <sfx2/sidebar/PanelLayout.hxx> +#include <svx/svxdllapi.h> + +namespace svx::sidebar +{ +struct TreeNode +{ + OUString sNodeName; + css::uno::Any aValue; + bool isGrey; + enum + { + Category, + ComplexProperty, + SimpleProperty + } NodeType; + std::vector<TreeNode> children; + TreeNode() + : isGrey(false) + , NodeType(SimpleProperty) + { + } +}; +class SVX_DLLPUBLIC InspectorTextPanel : public PanelLayout +{ +public: + virtual ~InspectorTextPanel() override; + + static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent); + + InspectorTextPanel(weld::Widget* pParent); + + void updateEntries(const std::vector<TreeNode>& rStore, const sal_Int32 nParIdx); + +private: + std::unique_ptr<weld::TreeView> mpListBoxStyles; +}; + +} // end of namespace svx::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sidebar/LinePropertyPanelBase.hxx b/include/svx/sidebar/LinePropertyPanelBase.hxx new file mode 100644 index 0000000000..891ca7aa18 --- /dev/null +++ b/include/svx/sidebar/LinePropertyPanelBase.hxx @@ -0,0 +1,140 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEPROPERTYPANELBASE_HXX +#define INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEPROPERTYPANELBASE_HXX + +#include <vcl/weld.hxx> +#include <memory> +#include <svl/poolitem.hxx> +#include <sfx2/sidebar/PanelLayout.hxx> +#include <svx/sidebar/LineWidthPopup.hxx> +#include <svx/svxdllapi.h> +#include <com/sun/star/frame/XFrame.hpp> + +class ToolbarUnoDispatcher; +class XLineStyleItem; +class XLineDashItem; +class XLineStartItem; +class XLineWidthItem; +class XLineEndItem; +class XLineEndList; +class XLineJointItem; +class XLineCapItem; +class XLineTransparenceItem; +class XDashList; + +namespace svx::sidebar +{ +class LineStyleNoneChange; + +class SVX_DLLPUBLIC LinePropertyPanelBase : public PanelLayout +{ +public: + virtual ~LinePropertyPanelBase() override; + + void SetWidth(tools::Long nWidth); + void SetWidthIcon(int n); + void SetWidthIcon(); + + void EndLineWidthPopup(); + + // constructor/destructor + LinePropertyPanelBase(weld::Widget* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame); + + virtual void setLineWidth(const XLineWidthItem& rItem) = 0; + + void SetNoneLineStyle(bool bNoneLineStyle) + { + if (bNoneLineStyle != mbNoneLineStyle) + { + mbNoneLineStyle = bNoneLineStyle; + ActivateControls(); + } + } + +protected: + void ActivateControls(); + + virtual void setLineTransparency(const XLineTransparenceItem& rItem) = 0; + virtual void setLineJoint(const XLineJointItem* pItem) = 0; + virtual void setLineCap(const XLineCapItem* pItem) = 0; + + void updateLineTransparence(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem); + virtual void updateLineWidth(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem); + void updateLineJoint(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem); + void updateLineCap(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem); + + void setMapUnit(MapUnit eMapUnit); + + void enableArrowHead(); + void disableArrowHead(); + +protected: + std::unique_ptr<weld::Toolbar> mxTBColor; + std::unique_ptr<ToolbarUnoDispatcher> mxColorDispatch; + + std::unique_ptr<weld::Toolbar> mxLineStyleTB; + std::unique_ptr<ToolbarUnoDispatcher> mxLineStyleDispatch; + + sal_Int32 mnWidthCoreValue; + +private: + //ui controls + std::unique_ptr<weld::Label> mxFTWidth; + std::unique_ptr<weld::Toolbar> mxTBWidth; + std::unique_ptr<weld::Label> mxFTTransparency; + std::unique_ptr<weld::MetricSpinButton> mxMFTransparent; + std::unique_ptr<weld::Label> mxFTEdgeStyle; + std::unique_ptr<weld::ComboBox> mxLBEdgeStyle; + std::unique_ptr<weld::Label> mxFTCapStyle; + std::unique_ptr<weld::ComboBox> mxLBCapStyle; + std::unique_ptr<weld::Widget> mxGridLineProps; + std::unique_ptr<weld::Widget> mxBoxArrowProps; + //popup windows + std::unique_ptr<LineWidthPopup> mxLineWidthPopup; + + std::unique_ptr<LineStyleNoneChange> mxLineStyleNoneChange; + + sal_uInt16 mnTrans; + MapUnit meMapUnit; + + // images from resource + OUString maIMGNone; + + // multi-images + BitmapEx maIMGWidthIcon[8]; + + bool mbWidthValuable : 1; + bool mbArrowSupported; + bool mbNoneLineStyle; + + void Initialize(); + + DECL_DLLPRIVATE_LINK(ToolboxWidthSelectHdl, const OUString&, void); + DECL_DLLPRIVATE_LINK(ChangeTransparentHdl, weld::MetricSpinButton&, void); + DECL_DLLPRIVATE_LINK(ChangeEdgeStyleHdl, weld::ComboBox&, void); + DECL_DLLPRIVATE_LINK(ChangeCapStyleHdl, weld::ComboBox&, void); +}; + +} // end of namespace svx::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sidebar/LineWidthPopup.hxx b/include/svx/sidebar/LineWidthPopup.hxx new file mode 100644 index 0000000000..262f354094 --- /dev/null +++ b/include/svx/sidebar/LineWidthPopup.hxx @@ -0,0 +1,71 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHPOPUP_HXX +#define INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHPOPUP_HXX + +#include <tools/mapunit.hxx> +#include <vcl/customweld.hxx> +#include <vcl/image.hxx> +#include <vcl/weld.hxx> +#include <svtools/toolbarmenu.hxx> +#include <array> + +class ValueSet; + +namespace svx::sidebar +{ +class LinePropertyPanelBase; +class LineWidthValueSet; + +class LineWidthPopup final : public WeldToolbarPopup +{ +public: + LineWidthPopup(weld::Widget* pParent, LinePropertyPanelBase& rParent); + ~LineWidthPopup(); + + void SetWidthSelect(tools::Long lValue, bool bValuable, MapUnit eMapUnit); + + weld::Container* getTopLevel() const { return m_xTopLevel.get(); } + + virtual void GrabFocus() override; + +private: + LinePropertyPanelBase& m_rParent; + std::array<OUString, 9> maStrUnits; + OUString m_sPt; + MapUnit m_eMapUnit; + bool m_bVSFocus; + bool m_bCustom; + tools::Long m_nCustomWidth; + Image m_aIMGCus; + Image m_aIMGCusGray; + + std::unique_ptr<weld::MetricSpinButton> m_xMFWidth; + std::unique_ptr<LineWidthValueSet> m_xVSWidth; + std::unique_ptr<weld::CustomWeld> m_xVSWidthWin; + + DECL_LINK(VSSelectHdl, ValueSet*, void); + DECL_LINK(MFModifyHdl, weld::MetricSpinButton&, void); +}; + +} // end of namespace svx::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sidebar/SelectionAnalyzer.hxx b/include/svx/sidebar/SelectionAnalyzer.hxx new file mode 100644 index 0000000000..349db88513 --- /dev/null +++ b/include/svx/sidebar/SelectionAnalyzer.hxx @@ -0,0 +1,76 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_SVX_SIDEBAR_SELECTIONANALYZER_HXX +#define INCLUDED_SVX_SIDEBAR_SELECTIONANALYZER_HXX + +#include <vcl/EnumContext.hxx> +#include <svx/svxdllapi.h> + +class SdrMarkList; +class SdrObject; +enum class SdrInventor : sal_uInt32; +enum class SdrObjKind : sal_uInt16; + +namespace svx::sidebar { + +/** Analyze the current selection of Calc or Draw/Impress documents + and return the associated sidebar context. + + The decision is based on heuristics. Do not expect pretty code. +*/ +class SVX_DLLPUBLIC SelectionAnalyzer +{ +public: + static vcl::EnumContext::Context GetContextForSelection_SC ( + const SdrMarkList& rMarkList); + + enum class ViewType + { + Standard, + Master, + Handout, + Notes, + }; + static vcl::EnumContext::Context GetContextForSelection_SD ( + const SdrMarkList& rMarkList, + const ViewType eViewType); + +private: + static vcl::EnumContext::Context GetContextForObjectId_SC ( + const SdrObjKind nObjectId); + static vcl::EnumContext::Context GetContextForObjectId_SD ( + const SdrObjKind nObjectId, + const ViewType eViewType); + static SdrInventor GetInventorTypeFromMark ( + const SdrMarkList& rMarkList); + static SdrObjKind GetObjectTypeFromMark ( + const SdrMarkList& rMarkList); + static SdrObjKind GetObjectTypeFromGroup ( + const SdrObject* pObj); + static bool IsShapeType ( + const SdrObjKind nType); + static bool IsTextObjType ( + const SdrObjKind nType); +}; + +} // end of namespace svx::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sidebar/SelectionChangeHandler.hxx b/include/svx/sidebar/SelectionChangeHandler.hxx new file mode 100644 index 0000000000..0a714debb8 --- /dev/null +++ b/include/svx/sidebar/SelectionChangeHandler.hxx @@ -0,0 +1,75 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_SVX_SIDEBAR_SELECTIONCHANGEHANDLER_HXX +#define INCLUDED_SVX_SIDEBAR_SELECTIONCHANGEHANDLER_HXX + +#include <svx/svxdllapi.h> +#include <vcl/EnumContext.hxx> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/view/XSelectionChangeListener.hpp> + +#include <comphelper/compbase.hxx> + +#include <functional> + +class SdrMarkView; + + +namespace svx::sidebar { + +typedef comphelper::WeakComponentImplHelper< + css::view::XSelectionChangeListener + > SelectionChangeHandlerInterfaceBase; + +class SVX_DLLPUBLIC SelectionChangeHandler final + : public SelectionChangeHandlerInterfaceBase +{ +public: + SelectionChangeHandler ( + std::function<OUString ()> aSelectionChangeCallback, + const css::uno::Reference<css::frame::XController>& rxController, + const vcl::EnumContext::Context eDefaultContext); + virtual ~SelectionChangeHandler() override; + + virtual void SAL_CALL selectionChanged (const css::lang::EventObject& rEvent) override; + + virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) override; + + virtual void disposing(std::unique_lock<std::mutex>&) override; + + void Connect(); + void Disconnect(); + +private: + SelectionChangeHandler(const SelectionChangeHandler&) = delete; + SelectionChangeHandler& operator=(const SelectionChangeHandler&) = delete; + + const std::function<OUString ()> maSelectionChangeCallback; + css::uno::Reference<css::frame::XController> mxController; + const vcl::EnumContext::Context meDefaultContext; + bool mbIsConnected; +}; + + +} // end of namespace svx::sidebar + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sidebar/ValueSetWithTextControl.hxx b/include/svx/sidebar/ValueSetWithTextControl.hxx new file mode 100644 index 0000000000..407e960675 --- /dev/null +++ b/include/svx/sidebar/ValueSetWithTextControl.hxx @@ -0,0 +1,62 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_SVX_SIDEBAR_VALUESETWITHTEXTCONTROL_HXX +#define INCLUDED_SVX_SIDEBAR_VALUESETWITHTEXTCONTROL_HXX + +#include <svx/svxdllapi.h> + +#include <svtools/valueset.hxx> + +#include <vector> + +namespace svx::sidebar +{ +/** Specialization of class <ValueSet>. + This specialization allows is a one-columned ValueSet which allow + items containing an image and a text or a text and a second text. + + Especially, used for sidebar related controls. +*/ +class SVX_DLLPUBLIC ValueSetWithTextControl final : public ValueSet +{ +public: + ValueSetWithTextControl(); + + SVX_DLLPRIVATE virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + + void SetOptimalDrawingAreaHeight(); + void AddItem(const OUString& rItemText, const OUString& rItemText2); + + SVX_DLLPRIVATE virtual void UserDraw(const UserDrawEvent& rUDEvt) override; + +private: + struct ValueSetWithTextItem + { + OUString maItemText; + OUString maItemText2; + }; + + ::std::vector<ValueSetWithTextItem> maItems; +}; + +} // end of namespace svx::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |