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