1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include <sfx2/sidebar/ControllerItem.hxx>
22 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
23 #include <sfx2/sidebar/PanelLayout.hxx>
24 #include <vcl/EnumContext.hxx>
25 #include <vcl/image.hxx>
26 #include <com/sun/star/frame/XFrame.hpp>
28 class ToolbarUnoDispatcher
;
29 class ToolbarPopupContainer
;
31 namespace sc::sidebar
{
33 class CellAppearancePropertyPanel
35 public ::sfx2::sidebar::IContextChangeReceiver
,
36 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
39 friend class CellLineStylePopup
;
40 friend class CellBorderStylePopup
;
43 static std::unique_ptr
<PanelLayout
> Create(
44 weld::Widget
* pParent
,
45 const css::uno::Reference
<css::frame::XFrame
>& rxFrame
,
46 SfxBindings
* pBindings
);
48 virtual void HandleContextChange(
49 const vcl::EnumContext
& rContext
) override
;
51 virtual void NotifyItemUpdate(
52 const sal_uInt16 nSId
,
53 const SfxItemState eState
,
54 const SfxPoolItem
* pState
) override
;
56 virtual void GetControlState(
57 const sal_uInt16
/*nSId*/,
58 boost::property_tree::ptree
& /*rState*/) override
{};
60 SfxBindings
* GetBindings() { return mpBindings
;}
62 // constructor/destructor
63 CellAppearancePropertyPanel(
64 weld::Widget
* pParent
,
65 const css::uno::Reference
<css::frame::XFrame
>& rxFrame
,
66 SfxBindings
* pBindings
);
67 virtual ~CellAppearancePropertyPanel() override
;
72 std::unique_ptr
<ToolbarPopupContainer
> mxCellBorderPopoverContainer
;
73 std::unique_ptr
<weld::Toolbar
> mxTBCellBorder
;
74 std::unique_ptr
<weld::Toolbar
> mxTBCellBackground
;
75 std::unique_ptr
<ToolbarUnoDispatcher
> mxBackColorDispatch
;
76 std::unique_ptr
<ToolbarPopupContainer
> mxLinePopoverContainer
;
77 std::unique_ptr
<weld::Toolbar
> mxTBLineStyle
;
78 std::unique_ptr
<weld::Toolbar
> mxTBLineColor
;
79 std::unique_ptr
<ToolbarUnoDispatcher
> mxLineColorDispatch
;
81 bool mbCellBorderPopoverCreated
;
82 bool mbLinePopoverCreated
;
84 ::sfx2::sidebar::ControllerItem maLineStyleControl
;
85 ::sfx2::sidebar::ControllerItem maBorderOuterControl
;
86 ::sfx2::sidebar::ControllerItem maBorderInnerControl
;
87 ::sfx2::sidebar::ControllerItem maGridShowControl
;
88 ::sfx2::sidebar::ControllerItem maBorderTLBRControl
;
89 ::sfx2::sidebar::ControllerItem maBorderBLTRControl
;
92 Image maIMGCellBorder
;
93 OUString msIMGCellBorder
;
94 OUString msIMGLineStyle1
;
95 OUString msIMGLineStyle2
;
96 OUString msIMGLineStyle3
;
97 OUString msIMGLineStyle4
;
98 OUString msIMGLineStyle5
;
99 OUString msIMGLineStyle6
;
100 OUString msIMGLineStyle7
;
101 OUString msIMGLineStyle8
;
102 OUString msIMGLineStyle9
;
104 // BorderStyle defines
105 sal_uInt16 mnInWidth
;
106 sal_uInt16 mnOutWidth
;
107 sal_uInt16 mnDistance
;
108 sal_uInt16 mnDiagTLBRInWidth
;
109 sal_uInt16 mnDiagTLBROutWidth
;
110 sal_uInt16 mnDiagTLBRDistance
;
111 sal_uInt16 mnDiagBLTRInWidth
;
112 sal_uInt16 mnDiagBLTROutWidth
;
113 sal_uInt16 mnDiagBLTRDistance
;
115 bool mbBorderStyleAvailable
: 1;
117 // CellBorder defines
125 bool mbOuterBorder
: 1; // mbLeft || mbRight || mbTop || mbBottom
126 bool mbInnerBorder
: 1; // mbVer || mbHor || bLeft || bRight || bTop || bBottom
131 vcl::EnumContext maContext
;
132 SfxBindings
* mpBindings
;
134 DECL_LINK(TbxCellBorderSelectHdl
, const OString
&, void);
135 DECL_LINK(TbxCellBorderMenuHdl
, const OString
&, void);
136 DECL_LINK(TbxLineStyleSelectHdl
, const OString
&, void);
137 DECL_LINK(TbxLineStyleMenuHdl
, const OString
&, void);
141 void UpdateControlState();
142 void UpdateCellBorder(bool bTop
, bool bBot
, bool bLeft
, bool bRight
, bool bVer
, bool bHor
, bool bTLBR
, bool bBLTR
);
145 } // end of namespace ::sc::sidebar
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */