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 .
19 #ifndef INCLUDED_CUI_SOURCE_INC_BORDER_HXX
20 #define INCLUDED_CUI_SOURCE_INC_BORDER_HXX
22 #include <editeng/shaditem.hxx>
23 #include <svtools/ctrlbox.hxx>
24 #include <vcl/weld.hxx>
25 #include <svtools/valueset.hxx>
26 #include <sfx2/tabdlg.hxx>
27 #include <svx/algitem.hxx>
28 #include <svx/colorbox.hxx>
29 #include <svx/frmsel.hxx>
30 #include <svx/flagsdef.hxx>
34 // forward ---------------------------------------------------------------
41 class ShadowControlsWrapper
44 explicit ShadowControlsWrapper(SvtValueSet
& rVsPos
, weld::MetricSpinButton
& rMfSize
, ColorListBox
& rLbColor
);
46 SvxShadowItem
GetControlValue(const SvxShadowItem
& rItem
) const;
47 void SetControlValue(const SvxShadowItem
& rItem
);
48 void SetControlDontKnow();
50 bool get_value_changed_from_saved() const;
54 weld::MetricSpinButton
& mrMfSize
;
55 ColorListBox
& mrLbColor
;
58 class MarginControlsWrapper
61 explicit MarginControlsWrapper(weld::MetricSpinButton
& rMfLeft
, weld::MetricSpinButton
& rMfRight
,
62 weld::MetricSpinButton
& rMfTop
, weld::MetricSpinButton
& rMfBottom
);
64 SvxMarginItem
GetControlValue(const SvxMarginItem
& rItem
) const;
65 void SetControlValue(const SvxMarginItem
& rItem
);
66 void SetControlDontKnow();
68 bool get_value_changed_from_saved() const;
71 weld::MetricSpinButton
& mrLeftWrp
;
72 weld::MetricSpinButton
& mrRightWrp
;
73 weld::MetricSpinButton
& mrTopWrp
;
74 weld::MetricSpinButton
& mrBottomWrp
;
77 class SvxBorderTabPage
: public SfxTabPage
79 static const sal_uInt16 pRanges
[];
82 SvxBorderTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rCoreAttrs
);
83 virtual ~SvxBorderTabPage() override
;
84 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
85 const SfxItemSet
* rAttrSet
);
86 static const sal_uInt16
* GetRanges() { return pRanges
; }
88 virtual bool FillItemSet( SfxItemSet
* rCoreAttrs
) override
;
89 virtual void Reset( const SfxItemSet
* ) override
;
90 virtual void ChangesApplied() override
;
92 void HideShadowControls();
93 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
96 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
99 std::vector
<Image
> m_aShadowImgVec
;
100 std::vector
<Image
> m_aBorderImgVec
;
102 long nMinValue
; ///< minimum distance
103 SwBorderModes nSWMode
; ///< table, textframe, paragraph
104 sal_uInt16 mnBoxSlot
;
105 sal_uInt16 mnShadowSlot
;
107 bool mbHorEnabled
; ///< true = Inner horizontal border enabled.
108 bool mbVerEnabled
; ///< true = Inner vertical border enabled.
109 bool mbTLBREnabled
; ///< true = Top-left to bottom-right border enabled.
110 bool mbBLTREnabled
; ///< true = Bottom-left to top-right border enabled.
111 bool mbUseMarginItem
;
113 bool mbRightModified
;
115 bool mbBottomModified
;
117 bool mbRemoveAdjacentCellBorders
;
120 std::set
<SvxBorderLineStyle
> maUsedBorderStyles
;
123 svx::FrameSelector m_aFrameSel
;
124 std::unique_ptr
<SvtValueSet
> m_xWndPresets
;
125 std::unique_ptr
<weld::CustomWeld
> m_xWndPresetsWin
;
126 std::unique_ptr
<weld::Label
> m_xUserDefFT
;
127 std::unique_ptr
<weld::CustomWeld
> m_xFrameSelWin
;
129 std::unique_ptr
<SvtLineListBox
> m_xLbLineStyle
;
130 std::unique_ptr
<ColorListBox
> m_xLbLineColor
;
131 std::unique_ptr
<weld::MetricSpinButton
> m_xLineWidthMF
;
133 std::unique_ptr
<weld::Container
> m_xSpacingFrame
;
134 std::unique_ptr
<weld::Label
> m_xLeftFT
;
135 std::unique_ptr
<weld::MetricSpinButton
> m_xLeftMF
;
136 std::unique_ptr
<weld::Label
> m_xRightFT
;
137 std::unique_ptr
<weld::MetricSpinButton
> m_xRightMF
;
138 std::unique_ptr
<weld::Label
> m_xTopFT
;
139 std::unique_ptr
<weld::MetricSpinButton
> m_xTopMF
;
140 std::unique_ptr
<weld::Label
> m_xBottomFT
;
141 std::unique_ptr
<weld::MetricSpinButton
> m_xBottomMF
;
142 std::unique_ptr
<weld::CheckButton
> m_xSynchronizeCB
;
144 std::unique_ptr
<weld::Container
> m_xShadowFrame
;
145 std::unique_ptr
<SvtValueSet
> m_xWndShadows
;
146 std::unique_ptr
<weld::CustomWeld
> m_xWndShadowsWin
;
147 std::unique_ptr
<weld::Label
> m_xFtShadowSize
;
148 std::unique_ptr
<weld::MetricSpinButton
> m_xEdShadowSize
;
149 std::unique_ptr
<weld::Label
> m_xFtShadowColor
;
150 std::unique_ptr
<ColorListBox
> m_xLbShadowColor
;
152 std::unique_ptr
<weld::Container
> m_xPropertiesFrame
;///< properties - "Merge with next paragraph" in Writer
153 std::unique_ptr
<weld::CheckButton
> m_xMergeWithNextCB
;
155 std::unique_ptr
<weld::CheckButton
> m_xMergeAdjacentBordersCB
;
156 std::unique_ptr
<weld::CheckButton
> m_xRemoveAdjcentCellBordersCB
;
157 std::unique_ptr
<weld::Label
> m_xRemoveAdjcentCellBordersFT
;
158 std::unique_ptr
<ShadowControlsWrapper
> m_xShadowControls
;
159 std::unique_ptr
<MarginControlsWrapper
> m_xMarginControls
;
162 DECL_LINK(SelStyleHdl_Impl
, SvtLineListBox
&, void);
163 DECL_LINK(SelColHdl_Impl
, ColorListBox
&, void);
164 DECL_LINK(SelPreHdl_Impl
, SvtValueSet
*, void);
165 DECL_LINK(SelSdwHdl_Impl
, SvtValueSet
*, void);
166 DECL_LINK(LinesChanged_Impl
, LinkParamNone
*, void);
167 DECL_LINK(ModifyDistanceHdl_Impl
, weld::MetricSpinButton
&, void);
168 DECL_LINK(ModifyWidthHdl_Impl
, weld::MetricSpinButton
&, void);
169 DECL_LINK(SyncHdl_Impl
, weld::ToggleButton
&, void);
170 DECL_LINK(RemoveAdjacentCellBorderHdl_Impl
, weld::ToggleButton
&, void);
172 sal_uInt16
GetPresetImageId(sal_uInt16 nValueSetIdx
) const;
173 const char* GetPresetStringId(sal_uInt16 nValueSetIdx
) const;
177 void FillValueSets();
180 void FillLineListBox_Impl();
182 /// share for individual Frame-/Core-Line
183 void ResetFrameLine_Impl( svx::FrameBorderType eBorder
,
184 const editeng::SvxBorderLine
* pCurLine
,
187 bool IsBorderLineStyleAllowed( SvxBorderLineStyle nStyle
) const;
188 void UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset
);
194 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */