Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEPROPERTYPANEL_HXX
20 : #define INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEPROPERTYPANEL_HXX
21 :
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 <boost/scoped_array.hpp>
29 : #include <svx/sidebar/PanelLayout.hxx>
30 : #include <svx/xtable.hxx>
31 : #include "LineWidthPopup.hxx"
32 :
33 :
34 : class XLineStyleItem;
35 : class XLineDashItem;
36 : class XLineStartItem;
37 : class XLineEndItem;
38 : class XLineEndList;
39 : class XDashList;
40 : class ListBox;
41 : class ToolBox;
42 : class FloatingWindow;
43 :
44 : namespace
45 : {
46 :
47 : #define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE "PopupPanel_LineWidth"
48 :
49 : } //end of anonymous namespace
50 :
51 : namespace svx
52 : {
53 : namespace sidebar
54 : {
55 :
56 : class PopupContainer;
57 : class LineWidthControl;
58 :
59 : class LinePropertyPanel : public PanelLayout,
60 : public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
61 : {
62 : public:
63 : virtual ~LinePropertyPanel();
64 : virtual void dispose() SAL_OVERRIDE;
65 :
66 : static VclPtr<vcl::Window> Create(
67 : vcl::Window* pParent,
68 : const css::uno::Reference<css::frame::XFrame>& rxFrame,
69 : SfxBindings* pBindings);
70 :
71 : virtual void DataChanged(
72 : const DataChangedEvent& rEvent) SAL_OVERRIDE;
73 :
74 : virtual void NotifyItemUpdate(
75 : const sal_uInt16 nSId,
76 : const SfxItemState eState,
77 : const SfxPoolItem* pState,
78 : const bool bIsEnabled) SAL_OVERRIDE;
79 :
80 0 : SfxBindings* GetBindings() { return mpBindings;}
81 :
82 : void SetWidth(long nWidth);
83 : void SetWidthIcon(int n);
84 : void SetWidthIcon();
85 :
86 : void EndLineWidthPopupMode();
87 :
88 : // constructor/destuctor
89 : LinePropertyPanel(
90 : vcl::Window* pParent,
91 : const css::uno::Reference<css::frame::XFrame>& rxFrame,
92 : SfxBindings* pBindings);
93 :
94 : private:
95 : //ui controls
96 : VclPtr<FixedText> mpFTWidth;
97 : VclPtr<ToolBox> mpTBWidth;
98 : VclPtr<FixedText> mpFTStyle;
99 : VclPtr<ListBox> mpLBStyle;
100 : VclPtr<FixedText> mpFTTransparency;
101 : VclPtr<MetricField> mpMFTransparent;
102 : VclPtr<FixedText> mpFTArrow;
103 : VclPtr<ListBox> mpLBStart;
104 : VclPtr<ListBox> mpLBEnd;
105 : VclPtr<FixedText> mpFTEdgeStyle;
106 : VclPtr<ListBox> mpLBEdgeStyle;
107 : VclPtr<FixedText> mpFTCapStyle;
108 : VclPtr<ListBox> mpLBCapStyle;
109 :
110 : //ControllerItem
111 : sfx2::sidebar::ControllerItem maStyleControl;
112 : sfx2::sidebar::ControllerItem maDashControl;
113 : sfx2::sidebar::ControllerItem maWidthControl;
114 : sfx2::sidebar::ControllerItem maStartControl;
115 : sfx2::sidebar::ControllerItem maEndControl;
116 : sfx2::sidebar::ControllerItem maLineEndListControl;
117 : sfx2::sidebar::ControllerItem maLineStyleListControl;
118 : sfx2::sidebar::ControllerItem maTransControl;
119 : sfx2::sidebar::ControllerItem maEdgeStyle;
120 : sfx2::sidebar::ControllerItem maCapStyle;
121 :
122 : std::unique_ptr<XLineStyleItem> mpStyleItem;
123 : std::unique_ptr<XLineDashItem> mpDashItem;
124 :
125 : sal_uInt16 mnTrans;
126 : SfxMapUnit meMapUnit;
127 : sal_Int32 mnWidthCoreValue;
128 : XLineEndListRef mxLineEndList;
129 : XDashListRef mxLineStyleList;
130 : std::unique_ptr<XLineStartItem> mpStartItem;
131 : std::unique_ptr<XLineEndItem> mpEndItem;
132 :
133 : //popup windows
134 : LineWidthPopup maLineWidthPopup;
135 :
136 : // images from resource
137 : Image maIMGNone;
138 :
139 : // multi-images
140 : boost::scoped_array<Image> mpIMGWidthIcon;
141 :
142 : css::uno::Reference<css::frame::XFrame> mxFrame;
143 : SfxBindings* mpBindings;
144 :
145 : /// bitfield
146 : bool mbWidthValuable : 1;
147 :
148 : static void SetupIcons();
149 : void Initialize();
150 : void FillLineEndList();
151 : void FillLineStyleList();
152 : void SelectEndStyle(bool bStart);
153 : void SelectLineStyle();
154 :
155 : DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* );
156 : DECL_LINK(ChangeLineStyleHdl, void*);
157 : DECL_LINK_TYPED(ToolboxWidthSelectHdl, ToolBox*, void);
158 : DECL_LINK(ChangeTransparentHdl , void *);
159 : DECL_LINK(ChangeStartHdl, void *);
160 : DECL_LINK(ChangeEndHdl, void *);
161 : DECL_LINK(ChangeEdgeStyleHdl, void *);
162 : DECL_LINK(ChangeCapStyleHdl, void *);
163 :
164 : VclPtr<PopupControl> CreateLineWidthPopupControl (PopupContainer* pParent);
165 : };
166 :
167 : } } // end of namespace svx::sidebar
168 :
169 : #endif
170 :
171 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|