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 <svx/relfld.hxx>
26 #include <com/sun/star/frame/XFrame.hpp>
27 #include <com/sun/star/ui/XSidebar.hpp>
29 #include <svl/poolitem.hxx>
30 #include <tools/fldunit.hxx>
31 #include <vcl/EnumContext.hxx>
33 class ToolbarUnoDispatcher
;
35 namespace svx::sidebar
{
37 class ParaPropertyPanel
39 public ::sfx2::sidebar::IContextChangeReceiver
,
40 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
43 virtual ~ParaPropertyPanel() override
;
45 static std::unique_ptr
<PanelLayout
> Create (
46 weld::Widget
* pParent
,
47 const css::uno::Reference
<css::frame::XFrame
>& rxFrame
,
48 SfxBindings
* pBindings
,
49 const css::uno::Reference
<css::ui::XSidebar
>& rxSidebar
);
51 SfxBindings
* GetBindings() { return mpBindings
;}
53 virtual void HandleContextChange (
54 const vcl::EnumContext
& rContext
) override
;
56 virtual void NotifyItemUpdate(
57 const sal_uInt16 nSId
,
58 const SfxItemState eState
,
59 const SfxPoolItem
* pState
) override
;
61 virtual void GetControlState(
62 const sal_uInt16
/*nSId*/,
63 boost::property_tree::ptree
& /*rState*/) override
{};
65 static FieldUnit
GetCurrentUnit( SfxItemState eState
, const SfxPoolItem
* pState
);
68 weld::Widget
* pParent
,
69 const css::uno::Reference
<css::frame::XFrame
>& rxFrame
,
70 SfxBindings
* pBindings
,
71 css::uno::Reference
<css::ui::XSidebar
> xSidebar
);
76 std::unique_ptr
<weld::Toolbar
> mxTBxHorzAlign
;
77 std::unique_ptr
<ToolbarUnoDispatcher
> mxHorzAlignDispatch
;
78 std::unique_ptr
<weld::Toolbar
> mxTBxVertAlign
;
79 std::unique_ptr
<ToolbarUnoDispatcher
> mxVertAlignDispatch
;
81 std::unique_ptr
<weld::Toolbar
> mxTBxNumBullet
;
82 std::unique_ptr
<ToolbarUnoDispatcher
> mxNumBulletDispatch
;
83 std::unique_ptr
<weld::Toolbar
> mxTBxBackColor
;
84 std::unique_ptr
<ToolbarUnoDispatcher
> mxBackColorDispatch
;
86 std::unique_ptr
<weld::Toolbar
> mxTBxWriteDirection
;
87 std::unique_ptr
<ToolbarUnoDispatcher
> mxWriteDirectionDispatch
;
88 std::unique_ptr
<weld::Toolbar
> mxTBxParaSpacing
;
89 std::unique_ptr
<ToolbarUnoDispatcher
> mxParaSpacingDispatch
;
90 std::unique_ptr
<weld::Toolbar
> mxTBxLineSpacing
;
91 std::unique_ptr
<ToolbarUnoDispatcher
> mxLineSpacingDispatch
;
92 std::unique_ptr
<weld::Toolbar
> mxTBxIndent
;
93 std::unique_ptr
<ToolbarUnoDispatcher
> mxIndentDispatch
;
96 std::optional
<SvxRelativeField
> mxTopDist
;
97 std::optional
<SvxRelativeField
> mxBottomDist
;
98 std::optional
<SvxRelativeField
> mxLeftIndent
;
99 std::optional
<SvxRelativeField
> mxRightIndent
;
100 std::optional
<SvxRelativeField
> mxFLineIndent
;
103 tools::Long maTxtLeft
;
107 FieldUnit m_eMetricUnit
;
108 FieldUnit m_last_eMetricUnit
;
109 MapUnit m_eLRSpaceUnit
;
110 MapUnit m_eULSpaceUnit
;
112 ::sfx2::sidebar::ControllerItem maLRSpaceControl
;
113 ::sfx2::sidebar::ControllerItem maULSpaceControl
;
114 ::sfx2::sidebar::ControllerItem m_aMetricCtl
;
116 vcl::EnumContext maContext
;
117 SfxBindings
* mpBindings
;
118 css::uno::Reference
<css::ui::XSidebar
> mxSidebar
;
120 DECL_LINK(ModifyIndentHdl_Impl
, weld::MetricSpinButton
&, void);
121 DECL_LINK(ULSpaceHdl_Impl
, weld::MetricSpinButton
&, void);
123 void StateChangedIndentImpl( SfxItemState eState
, const SfxPoolItem
* pState
);
124 void StateChangedULImpl( SfxItemState eState
, const SfxPoolItem
* pState
);
128 void InitToolBoxIndent();
129 void InitToolBoxSpacing();
130 void limitMetricWidths();
133 } // end of namespace svx::sidebar
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */