Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / cui / source / inc / border.hxx
blob586b05f9410b3466700b6f486048162ffb39491c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
21 #include <editeng/shaditem.hxx>
22 #include <svtools/ctrlbox.hxx>
23 #include <vcl/weld.hxx>
24 #include <svtools/valueset.hxx>
25 #include <sfx2/tabdlg.hxx>
26 #include <svx/algitem.hxx>
27 #include <svx/colorbox.hxx>
28 #include <svx/frmsel.hxx>
29 #include <svx/flagsdef.hxx>
30 #include <unotools/resmgr.hxx>
32 #include <set>
34 // forward ---------------------------------------------------------------
36 namespace editeng
38 class SvxBorderLine;
41 class ShadowControlsWrapper
43 public:
44 explicit ShadowControlsWrapper(ValueSet& 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;
52 private:
53 ValueSet& mrVsPos;
54 weld::MetricSpinButton& mrMfSize;
55 ColorListBox& mrLbColor;
58 class MarginControlsWrapper
60 public:
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;
70 private:
71 weld::MetricSpinButton& mrLeftWrp;
72 weld::MetricSpinButton& mrRightWrp;
73 weld::MetricSpinButton& mrTopWrp;
74 weld::MetricSpinButton& mrBottomWrp;
77 class SvxBorderTabPage : public SfxTabPage
79 static const WhichRangesContainer pRanges;
80 static const std::vector<int> m_aLineWidths;
82 public:
83 SvxBorderTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs);
84 virtual ~SvxBorderTabPage() override;
85 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
86 const SfxItemSet* rAttrSet);
87 static WhichRangesContainer GetRanges() { return pRanges; }
89 virtual bool FillItemSet( SfxItemSet* rCoreAttrs ) override;
90 virtual void Reset( const SfxItemSet* ) override;
91 virtual void ChangesApplied() override;
93 void HideShadowControls();
94 virtual void PageCreated(const SfxAllItemSet& aSet) override;
95 void SetTableMode();
96 protected:
97 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
99 private:
100 std::vector<Image> m_aShadowImgVec;
101 std::vector<Image> m_aBorderImgVec;
103 tools::Long nMinValue; ///< minimum distance
104 SwBorderModes nSWMode; ///< table, textframe, paragraph
105 sal_uInt16 mnBoxSlot;
106 sal_uInt16 mnShadowSlot;
108 bool mbHorEnabled; ///< true = Inner horizontal border enabled.
109 bool mbVerEnabled; ///< true = Inner vertical border enabled.
110 bool mbTLBREnabled; ///< true = Top-left to bottom-right border enabled.
111 bool mbBLTREnabled; ///< true = Bottom-left to top-right border enabled.
112 bool mbUseMarginItem;
113 bool mbLeftModified;
114 bool mbRightModified;
115 bool mbTopModified;
116 bool mbBottomModified;
117 bool mbSync;
118 bool mbRemoveAdjacentCellBorders;
119 bool bIsCalcDoc;
121 std::set<SvxBorderLineStyle> maUsedBorderStyles;
123 // Controls
124 svx::FrameSelector m_aFrameSel;
125 std::unique_ptr<ValueSet> m_xWndPresets;
126 std::unique_ptr<weld::CustomWeld> m_xWndPresetsWin;
127 std::unique_ptr<weld::Label> m_xUserDefFT;
128 std::unique_ptr<weld::CustomWeld> m_xFrameSelWin;
130 std::unique_ptr<SvtLineListBox> m_xLbLineStyle;
131 std::unique_ptr<ColorListBox> m_xLbLineColor;
132 std::unique_ptr<weld::ComboBox> m_xLineWidthLB;
133 std::unique_ptr<weld::MetricSpinButton> m_xLineWidthMF;
135 std::unique_ptr<weld::Container> m_xSpacingFrame;
136 std::unique_ptr<weld::Label> m_xLeftFT;
137 std::unique_ptr<weld::MetricSpinButton> m_xLeftMF;
138 std::unique_ptr<weld::Label> m_xRightFT;
139 std::unique_ptr<weld::MetricSpinButton> m_xRightMF;
140 std::unique_ptr<weld::Label> m_xTopFT;
141 std::unique_ptr<weld::MetricSpinButton> m_xTopMF;
142 std::unique_ptr<weld::Label> m_xBottomFT;
143 std::unique_ptr<weld::MetricSpinButton> m_xBottomMF;
144 std::unique_ptr<weld::CheckButton> m_xSynchronizeCB;
146 std::unique_ptr<weld::Container> m_xShadowFrame;
147 std::unique_ptr<ValueSet> m_xWndShadows;
148 std::unique_ptr<weld::CustomWeld> m_xWndShadowsWin;
149 std::unique_ptr<weld::Label> m_xFtShadowSize;
150 std::unique_ptr<weld::MetricSpinButton> m_xEdShadowSize;
151 std::unique_ptr<weld::Label> m_xFtShadowColor;
152 std::unique_ptr<ColorListBox> m_xLbShadowColor;
154 std::unique_ptr<weld::Container> m_xPropertiesFrame;///< properties - "Merge with next paragraph" in Writer
155 std::unique_ptr<weld::CheckButton> m_xMergeWithNextCB;
156 // #i29550#
157 std::unique_ptr<weld::CheckButton> m_xMergeAdjacentBordersCB;
158 std::unique_ptr<weld::CheckButton> m_xRemoveAdjacentCellBordersCB;
159 std::unique_ptr<weld::Label> m_xRemoveAdjacentCellBordersFT;
160 std::unique_ptr<ShadowControlsWrapper> m_xShadowControls;
161 std::unique_ptr<MarginControlsWrapper> m_xMarginControls;
163 // Handler
164 DECL_LINK(SelStyleHdl_Impl, SvtLineListBox&, void);
165 DECL_LINK(SelColHdl_Impl, ColorListBox&, void);
166 DECL_LINK(SelPreHdl_Impl, ValueSet*, void);
167 DECL_LINK(SelSdwHdl_Impl, ValueSet*, void);
168 DECL_LINK(LinesChanged_Impl, LinkParamNone*, void);
169 DECL_LINK(ModifyDistanceHdl_Impl, weld::MetricSpinButton&, void);
170 DECL_LINK(ModifyWidthLBHdl_Impl, weld::ComboBox&, void);
171 DECL_LINK(ModifyWidthMFHdl_Impl, weld::MetricSpinButton&, void);
172 DECL_LINK(SyncHdl_Impl, weld::Toggleable&, void);
173 DECL_LINK(RemoveAdjacentCellBorderHdl_Impl, weld::Toggleable&, void);
175 sal_uInt16 GetPresetImageId(sal_uInt16 nValueSetIdx) const;
176 TranslateId GetPresetStringId(sal_uInt16 nValueSetIdx) const;
178 void FillPresetVS();
179 void FillShadowVS();
180 void FillValueSets();
181 void SetLineWidth(sal_Int64 nWidth, sal_Int32 nRemovedType = 0);
183 // Filler
184 void FillLineListBox_Impl();
186 /// share for individual Frame-/Core-Line
187 void ResetFrameLine_Impl( svx::FrameBorderType eBorder,
188 const editeng::SvxBorderLine* pCurLine,
189 bool bValid );
191 bool IsBorderLineStyleAllowed( SvxBorderLineStyle nStyle ) const;
192 void UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset );
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */