Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svx / sidebar / LinePropertyPanelBase.hxx
blobdd4452e7944c37e6112c50405905dd38bcdcb3cc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEPROPERTYPANELBASE_HXX
20 #define INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEPROPERTYPANELBASE_HXX
22 #include <svx/xdash.hxx>
23 #include <vcl/ctrl.hxx>
24 #include <sfx2/sidebar/SidebarPanelBase.hxx>
25 #include <sfx2/sidebar/ControllerItem.hxx>
26 #include <vcl/fixed.hxx>
27 #include <vcl/field.hxx>
28 #include <vcl/layout.hxx>
29 #include <memory>
30 #include <svx/sidebar/PanelLayout.hxx>
31 #include <svx/xtable.hxx>
32 #include "LineWidthPopup.hxx"
33 #include <svx/svxdllapi.h>
36 class XLineStyleItem;
37 class XLineDashItem;
38 class XLineStartItem;
39 class XLineWidthItem;
40 class XLineEndItem;
41 class XLineEndList;
42 class XLineJointItem;
43 class XLineCapItem;
44 class XLineTransparenceItem;
45 class XDashList;
46 class ListBox;
47 class ToolBox;
48 class FloatingWindow;
50 #define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE "PopupPanel_LineWidth"
52 namespace sfx2 { namespace sidebar {
54 class SidebarToolBox;
56 } }
58 namespace svx
60 namespace sidebar
63 class SVX_DLLPUBLIC LinePropertyPanelBase : public PanelLayout
65 public:
66 virtual ~LinePropertyPanelBase() override;
67 virtual void dispose() override;
69 virtual void DataChanged(
70 const DataChangedEvent& rEvent) override;
72 void SetWidth(long nWidth);
73 void SetWidthIcon(int n);
74 void SetWidthIcon();
76 // constructor/destructor
77 LinePropertyPanelBase(
78 vcl::Window* pParent,
79 const css::uno::Reference<css::frame::XFrame>& rxFrame);
81 virtual void setLineWidth(const XLineWidthItem& rItem) = 0;
83 protected:
85 virtual void setLineStyle(const XLineStyleItem& rItem) = 0;
86 virtual void setLineDash(const XLineDashItem& rItem) = 0;
87 virtual void setLineEndStyle(const XLineEndItem* pItem) = 0;
88 virtual void setLineStartStyle(const XLineStartItem* pItem) = 0;
89 virtual void setLineTransparency(const XLineTransparenceItem& rItem) = 0;
90 virtual void setLineJoint(const XLineJointItem* pItem) = 0;
91 virtual void setLineCap(const XLineCapItem* pItem) = 0;
94 void updateLineStyle(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
95 void updateLineDash(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
96 void updateLineTransparence(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
97 void updateLineWidth(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
98 void updateLineStart(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
99 void updateLineEnd(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
100 void updateLineJoint(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
101 void updateLineCap(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
103 void FillLineEndList();
104 void FillLineStyleList();
105 void SelectEndStyle(bool bStart);
106 void SelectLineStyle();
107 void ActivateControls();
109 void setMapUnit(MapUnit eMapUnit);
111 void disableArrowHead();
113 protected:
115 VclPtr<sfx2::sidebar::SidebarToolBox> mpTBColor;
117 private:
118 //ui controls
119 VclPtr<FixedText> mpFTWidth;
120 VclPtr<ToolBox> mpTBWidth;
121 VclPtr<ListBox> mpLBStyle;
122 VclPtr<FixedText> mpFTTransparency;
123 VclPtr<MetricField> mpMFTransparent;
124 VclPtr<ListBox> mpLBStart;
125 VclPtr<ListBox> mpLBEnd;
126 VclPtr<FixedText> mpFTEdgeStyle;
127 VclPtr<ListBox> mpLBEdgeStyle;
128 VclPtr<FixedText> mpFTCapStyle;
129 VclPtr<ListBox> mpLBCapStyle;
130 VclPtr<VclGrid> mpGridLineProps;
131 VclPtr<VclVBox> mpBoxArrowProps;
133 std::unique_ptr<XLineStyleItem> mpStyleItem;
134 std::unique_ptr<XLineDashItem> mpDashItem;
136 sal_uInt16 mnTrans;
137 MapUnit meMapUnit;
138 sal_Int32 mnWidthCoreValue;
139 XLineEndListRef mxLineEndList;
140 XDashListRef mxLineStyleList;
141 std::unique_ptr<XLineStartItem> mpStartItem;
142 std::unique_ptr<XLineEndItem> mpEndItem;
144 //popup windows
145 VclPtr<LineWidthPopup> mxLineWidthPopup;
147 // images from resource
148 Image maIMGNone;
150 // multi-images
151 std::unique_ptr<Image[]> mpIMGWidthIcon;
153 bool mbWidthValuable : 1;
154 bool mbArrowSupported;
156 void Initialize();
158 DECL_LINK(ChangeLineStyleHdl, ListBox&, void);
159 DECL_LINK(ToolboxWidthSelectHdl, ToolBox*, void);
160 DECL_LINK(ChangeTransparentHdl, Edit&, void );
161 DECL_LINK(ChangeStartHdl, ListBox&, void);
162 DECL_LINK(ChangeEndHdl, ListBox&, void);
163 DECL_LINK(ChangeEdgeStyleHdl, ListBox&, void);
164 DECL_LINK(ChangeCapStyleHdl, ListBox&, void);
167 } } // end of namespace svx::sidebar
169 #endif
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */