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_SC_SOURCE_UI_SIDEBAR_CELLAPPEARANCEPROPERTYPANEL_HXX
20 : #define INCLUDED_SC_SOURCE_UI_SIDEBAR_CELLAPPEARANCEPROPERTYPANEL_HXX
21 :
22 : #include <sfx2/sidebar/ControllerItem.hxx>
23 : #include <sfx2/sidebar/IContextChangeReceiver.hxx>
24 : #include <svx/sidebar/PanelLayout.hxx>
25 : #include <boost/scoped_ptr.hpp>
26 : #include <svx/sidebar/ColorPopup.hxx>
27 :
28 : class FixedText;
29 : namespace svx { class ToolboxButtonColorUpdater; }
30 : namespace sc { namespace sidebar {
31 : class CellLineStylePopup;
32 : class CellBorderStylePopup;
33 : class CellLineStyleControl;
34 : class CellBorderUpdater;
35 : }}
36 : class ToolBox;
37 : class CheckBox;
38 :
39 : namespace sc { namespace sidebar {
40 :
41 : class CellAppearancePropertyPanel
42 : : public PanelLayout,
43 : public ::sfx2::sidebar::IContextChangeReceiver,
44 : public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
45 : {
46 : private:
47 : friend class CellLineStyleControl;
48 : friend class CellBorderStyleControl;
49 :
50 : public:
51 : static CellAppearancePropertyPanel* Create(
52 : vcl::Window* pParent,
53 : const css::uno::Reference<css::frame::XFrame>& rxFrame,
54 : SfxBindings* pBindings);
55 :
56 : virtual void DataChanged(
57 : const DataChangedEvent& rEvent) SAL_OVERRIDE;
58 :
59 : virtual void HandleContextChange(
60 : const ::sfx2::sidebar::EnumContext aContext) SAL_OVERRIDE;
61 :
62 : virtual void NotifyItemUpdate(
63 : const sal_uInt16 nSId,
64 : const SfxItemState eState,
65 : const SfxPoolItem* pState,
66 : const bool bIsEnabled) SAL_OVERRIDE;
67 :
68 0 : SfxBindings* GetBindings() { return mpBindings;}
69 :
70 : private:
71 : //ui controls
72 :
73 : ToolBox* mpTBCellBorder;
74 : ToolBox* mpTBLineStyle;
75 : ToolBox* mpTBLineColor;
76 : ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpLineColorUpdater;
77 : ::boost::scoped_ptr< CellBorderUpdater > mpCellBorderUpdater;
78 : CheckBox* mpCBXShowGrid;
79 :
80 : ::sfx2::sidebar::ControllerItem maLineColorControl;
81 : ::sfx2::sidebar::ControllerItem maLineStyleControl;
82 : ::sfx2::sidebar::ControllerItem maBorderOuterControl;
83 : ::sfx2::sidebar::ControllerItem maBorderInnerControl;
84 : ::sfx2::sidebar::ControllerItem maGridShowControl;
85 : ::sfx2::sidebar::ControllerItem maBorderTLBRControl;
86 : ::sfx2::sidebar::ControllerItem maBorderBLTRControl;
87 :
88 : // images
89 : Image maIMGCellBorder;
90 : Image maIMGLineStyle1;
91 : Image maIMGLineStyle2;
92 : Image maIMGLineStyle3;
93 : Image maIMGLineStyle4;
94 : Image maIMGLineStyle5;
95 : Image maIMGLineStyle6;
96 : Image maIMGLineStyle7;
97 : Image maIMGLineStyle8;
98 : Image maIMGLineStyle9;
99 :
100 : // cell line color(s)
101 : Color maLineColor;
102 : Color maTLBRColor;
103 : Color maBLTRColor;
104 :
105 : // BorderStyle defines
106 : sal_uInt16 mnIn;
107 : sal_uInt16 mnOut;
108 : sal_uInt16 mnDis;
109 : sal_uInt16 mnTLBRIn;
110 : sal_uInt16 mnTLBROut;
111 : sal_uInt16 mnTLBRDis;
112 : sal_uInt16 mnBLTRIn;
113 : sal_uInt16 mnBLTROut;
114 : sal_uInt16 mnBLTRDis;
115 :
116 : /// bitfield
117 : bool mbLineColorAvailable : 1;
118 : bool mbBorderStyleAvailable : 1;
119 :
120 : // CellBorder defines
121 : bool mbLeft : 1;
122 : bool mbRight : 1;
123 : bool mbTop : 1;
124 : bool mbBottom : 1;
125 : bool mbVer : 1;
126 : bool mbHor : 1;
127 :
128 : bool mbOuterBorder : 1; // mbLeft || mbRight || mbTop || mbBottom
129 : bool mbInnerBorder : 1; // mbVer || mbHor || bLeft || bRight || bTop || bBottom
130 :
131 : bool mbTLBR : 1;
132 : bool mbBLTR : 1;
133 :
134 : // popups
135 : svx::sidebar::ColorPopup maLineColorPopup;
136 : ::boost::scoped_ptr< CellLineStylePopup > mpCellLineStylePopup;
137 : ::boost::scoped_ptr< CellBorderStylePopup > mpCellBorderStylePopup;
138 :
139 : css::uno::Reference<css::frame::XFrame> mxFrame;
140 : ::sfx2::sidebar::EnumContext maContext;
141 : SfxBindings* mpBindings;
142 :
143 : DECL_LINK(TbxLineColorSelectHdl, ToolBox*);
144 : DECL_LINK(TbxCellBorderSelectHdl, ToolBox*);
145 : DECL_LINK(TbxLineStyleSelectHdl, ToolBox*);
146 : DECL_LINK(CBOXGridShowClkHdl, void*);
147 :
148 : // for line color picker
149 : svx::sidebar::PopupControl* CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent);
150 : void SetLineColor(const OUString& rsColorName, const Color aColor);
151 :
152 : // for CellLineStyle popup
153 : svx::sidebar::PopupControl* CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent);
154 : void EndCellLineStylePopupMode(void);
155 :
156 : // for CellBorderStyle popup
157 : svx::sidebar::PopupControl* CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent);
158 : void EndCellBorderStylePopupMode(void);
159 :
160 : // constructor/destuctor
161 : CellAppearancePropertyPanel(
162 : vcl::Window* pParent,
163 : const css::uno::Reference<css::frame::XFrame>& rxFrame,
164 : SfxBindings* pBindings);
165 : virtual ~CellAppearancePropertyPanel();
166 :
167 : void Initialize();
168 : void SetStyleIcon();
169 : void UpdateControlState();
170 : };
171 :
172 : } } // end of namespace ::sc::sidebar
173 :
174 : #endif
175 :
176 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|