23 #include <svx/svxids.hrc>
24 #include <svx/strings.hrc>
26 #include <bitmaps.hlst>
36 #define IID_BOTTOMLOCK 1
38 #define IID_CELLLOCK 3
44 SID_ATTR_ALIGN_HOR_JUSTIFY,SID_ATTR_ALIGN_VER_JUSTIFY,
45 SID_ATTR_ALIGN_STACKED,SID_ATTR_ALIGN_LINEBREAK,
46 SID_ATTR_ALIGN_INDENT,SID_ATTR_ALIGN_INDENT,
47 SID_ATTR_ALIGN_DEGREES,SID_ATTR_ALIGN_DEGREES,
48 SID_ATTR_ALIGN_LOCKPOS,SID_ATTR_ALIGN_LOCKPOS,
49 SID_ATTR_ALIGN_HYPHENATION,SID_ATTR_ALIGN_HYPHENATION,
50 SID_ATTR_ALIGN_ASIANVERTICAL,SID_ATTR_ALIGN_ASIANVERTICAL,
51 SID_ATTR_FRAMEDIRECTION,SID_ATTR_FRAMEDIRECTION,
52 SID_ATTR_ALIGN_SHRINKTOFIT,SID_ATTR_ALIGN_SHRINKTOFIT,
59 template<
typename JustContainerType,
typename JustEnumType>
60 void lcl_MaybeResetAlignToDistro(
61 weld::ComboBox& rLB, sal_uInt16 nListPos,
const SfxItemSet& rCoreAttrs, sal_uInt16 nWhichAlign, sal_uInt16 nWhichJM, JustEnumType eBlock)
64 if (rCoreAttrs.
GetItemState(nWhichAlign,
true, &pItem) != SfxItemState::SET)
69 JustContainerType eVal =
static_cast<JustContainerType
>(p->
GetEnumValue());
74 if (rCoreAttrs.
GetItemState(nWhichJM,
true, &pItem) != SfxItemState::SET)
80 if (eMethod == SvxCellJustifyMethod::Distribute)
91 eJM = SvxCellJustifyMethod::Distribute;
95 if (rOldItem.GetValue() == eJM)
108 :
SfxTabPage(pPage, pController,
"cui/ui/cellalignment.ui",
"CellAlignPage", &rCoreAttrs)
109 , m_aVsRefEdge(nullptr)
111 , m_xLbHorAlign(m_xBuilder->weld_combo_box(
"comboboxHorzAlign"))
112 , m_xFtIndent(m_xBuilder->weld_label(
"labelIndent"))
113 , m_xEdIndent(m_xBuilder->weld_metric_spin_button(
"spinIndentFrom",
FieldUnit::
POINT))
114 , m_xFtVerAlign(m_xBuilder->weld_label(
"labelVertAlign"))
115 , m_xLbVerAlign(m_xBuilder->weld_combo_box(
"comboboxVertAlign"))
117 , m_xFtRotate(m_xBuilder->weld_label(
"labelDegrees"))
118 , m_xNfRotate(m_xBuilder->weld_metric_spin_button(
"spinDegrees",
FieldUnit::
DEGREE))
119 , m_xFtRefEdge(m_xBuilder->weld_label(
"labelRefEdge"))
121 , m_xCbStacked(m_xBuilder->weld_check_button(
"checkVertStack"))
122 , m_xCbAsianMode(m_xBuilder->weld_check_button(
"checkAsianMode"))
124 , m_xBoxDirection(m_xBuilder->weld_widget(
"boxDirection"))
125 , m_xBtnWrap(m_xBuilder->weld_check_button(
"checkWrapTextAuto"))
126 , m_xBtnHyphen(m_xBuilder->weld_check_button(
"checkHyphActive"))
127 , m_xBtnShrink(m_xBuilder->weld_check_button(
"checkShrinkFitCellSize"))
130 , m_xFtBotLock(m_xBuilder->weld_label(
"labelSTR_BOTTOMLOCK"))
131 , m_xFtTopLock(m_xBuilder->weld_label(
"labelSTR_TOPLOCK"))
132 , m_xFtCelLock(m_xBuilder->weld_label(
"labelSTR_CELLLOCK"))
133 , m_xFtABCD(m_xBuilder->weld_label(
"labelABCD"))
134 , m_xAlignmentFrame(m_xBuilder->weld_widget(
"alignment"))
135 , m_xOrientFrame(m_xBuilder->weld_widget(
"orientation"))
136 , m_xPropertiesFrame(m_xBuilder->weld_widget(
"properties"))
137 , m_xVsRefEdge(new
weld::CustomWeld(*m_xBuilder,
"references", m_aVsRefEdge))
139 , m_xCtrlDialWin(new
weld::CustomWeld(*m_xBuilder,
"dialcontrol", *m_xCtrlDial))
175 return std::make_unique<AlignmentTabPage>(pPage, pController, *rAttrSet);
184 sal_uInt16 nWhich =
GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY);
191 eJustify = SvxCellHorJustify::Standard;
194 eJustify = SvxCellHorJustify::Left;
197 eJustify = SvxCellHorJustify::Center;
200 eJustify = SvxCellHorJustify::Right;
204 eJustify = SvxCellHorJustify::Block;
207 eJustify = SvxCellHorJustify::Repeat;
213 else if (SfxItemState::DEFAULT == rOldSet.
GetItemState(nWhich,
false))
216 nWhich =
GetWhich(SID_ATTR_ALIGN_INDENT);
220 *rSet, SID_ATTR_ALIGN_INDENT));
222 std::unique_ptr<SfxUInt16Item> pNewIndentItem(pIndentItem->
Clone());
223 pNewIndentItem->SetValue(
m_xEdIndent->get_value(FieldUnit::TWIP));
224 rSet->
Put(*pNewIndentItem);
227 else if (SfxItemState::DEFAULT == rOldSet.
GetItemState(nWhich,
false))
230 nWhich =
GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY);
237 eJustify = SvxCellVerJustify::Standard;
240 eJustify = SvxCellVerJustify::Top;
243 eJustify = SvxCellVerJustify::Center;
246 eJustify = SvxCellVerJustify::Bottom;
250 eJustify = SvxCellVerJustify::Block;
256 else if (SfxItemState::DEFAULT == rOldSet.
GetItemState(nWhich,
false))
259 nWhich =
GetWhich(SID_ATTR_ALIGN_DEGREES);
263 *rSet, SID_ATTR_ALIGN_DEGREES));
265 std::unique_ptr<SdrAngleItem> pNewAngleItem(pAngleItem->
Clone());
266 pNewAngleItem->SetValue(
m_xCtrlDial->GetRotation());
267 rSet->
Put(*pNewAngleItem);
270 else if (SfxItemState::DEFAULT == rOldSet.
GetItemState(nWhich,
false))
273 nWhich =
GetWhich(SID_ATTR_ALIGN_LOCKPOS);
293 else if (SfxItemState::DEFAULT == rOldSet.
GetItemState(nWhich,
false))
296 nWhich =
GetWhich(SID_ATTR_ALIGN_STACKED);
300 *rSet, SID_ATTR_ALIGN_STACKED));
302 std::unique_ptr<SfxBoolItem> pNewStackItem(pStackItem->
Clone());
304 rSet->
Put(*pNewStackItem);
307 else if (SfxItemState::DEFAULT == rOldSet.
GetItemState(nWhich,
false))
310 nWhich =
GetWhich(SID_ATTR_ALIGN_ASIANVERTICAL);
316 else if (SfxItemState::DEFAULT == rOldSet.
GetItemState(nWhich,
false))
319 nWhich =
GetWhich(SID_ATTR_ALIGN_LINEBREAK);
320 if (
m_xBtnWrap->get_state_changed_from_saved())
323 *rSet, SID_ATTR_ALIGN_LINEBREAK));
325 std::unique_ptr<SfxBoolItem> pNewWrapItem(pWrapItem->
Clone());
326 pNewWrapItem->SetValue(
m_xBtnWrap->get_active());
327 rSet->
Put(*pNewWrapItem);
330 else if (SfxItemState::DEFAULT == rOldSet.
GetItemState(nWhich,
false))
333 nWhich =
GetWhich(SID_ATTR_ALIGN_HYPHENATION);
337 *rSet, SID_ATTR_ALIGN_HYPHENATION));
339 std::unique_ptr<SfxBoolItem> pNewHyphItem(pHyphItem->
Clone());
341 rSet->
Put(*pNewHyphItem);
344 else if (SfxItemState::DEFAULT == rOldSet.
GetItemState(nWhich,
false))
347 nWhich =
GetWhich(SID_ATTR_ALIGN_SHRINKTOFIT);
351 *rSet, SID_ATTR_ALIGN_SHRINKTOFIT));
353 std::unique_ptr<SfxBoolItem> pNewShrinkItem(pShrinkItem->
Clone());
355 rSet->
Put(*pNewShrinkItem);
358 else if (SfxItemState::DEFAULT == rOldSet.
GetItemState(nWhich,
false))
363 nWhich =
GetWhich(SID_ATTR_FRAMEDIRECTION);
370 else if (SfxItemState::DEFAULT == rOldSet.
GetItemState(nWhich,
false))
376 sal_uInt16 nWhichHorJM =
GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD);
381 sal_uInt16 nWhichVerJM =
GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD);
396 case SfxItemState::UNKNOWN:
400 case SfxItemState::DISABLED:
401 case SfxItemState::READONLY:
405 case SfxItemState::DONTCARE:
409 case SfxItemState::DEFAULT:
410 case SfxItemState::SET:
432 sal_uInt16 nWhich =
GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY);
436 case SfxItemState::UNKNOWN:
439 case SfxItemState::DISABLED:
440 case SfxItemState::READONLY:
443 case SfxItemState::DONTCARE:
446 case SfxItemState::DEFAULT:
447 case SfxItemState::SET:
450 switch (rJustifyItem.GetValue())
452 case SvxCellHorJustify::Standard:
455 case SvxCellHorJustify::Left:
458 case SvxCellHorJustify::Center:
461 case SvxCellHorJustify::Right:
464 case SvxCellHorJustify::Block:
467 case SvxCellHorJustify::Repeat:
475 nWhich =
GetWhich(SID_ATTR_ALIGN_INDENT);
479 case SfxItemState::UNKNOWN:
483 case SfxItemState::DISABLED:
484 case SfxItemState::READONLY:
487 case SfxItemState::DONTCARE:
490 case SfxItemState::DEFAULT:
491 case SfxItemState::SET:
499 nWhich =
GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY);
503 case SfxItemState::UNKNOWN:
507 case SfxItemState::DISABLED:
508 case SfxItemState::READONLY:
511 case SfxItemState::DONTCARE:
514 case SfxItemState::DEFAULT:
515 case SfxItemState::SET:
518 switch (rJustifyItem.GetValue())
520 case SvxCellVerJustify::Standard:
523 case SvxCellVerJustify::Top:
526 case SvxCellVerJustify::Center:
529 case SvxCellVerJustify::Bottom:
532 case SvxCellVerJustify::Block:
540 nWhich =
GetWhich(SID_ATTR_ALIGN_DEGREES);
544 case SfxItemState::UNKNOWN:
548 case SfxItemState::DISABLED:
549 case SfxItemState::READONLY:
553 case SfxItemState::DONTCARE:
556 case SfxItemState::DEFAULT:
557 case SfxItemState::SET:
565 nWhich =
GetWhich(SID_ATTR_ALIGN_LOCKPOS);
569 case SfxItemState::UNKNOWN:
572 case SfxItemState::DISABLED:
573 case SfxItemState::READONLY:
576 case SfxItemState::DONTCARE:
579 case SfxItemState::DEFAULT:
580 case SfxItemState::SET:
583 switch (rRotateModeItem.GetValue())
585 case SvxRotateMode::SVX_ROTATE_MODE_STANDARD:
588 case SvxRotateMode::SVX_ROTATE_MODE_TOP:
591 case SvxRotateMode::SVX_ROTATE_MODE_BOTTOM:
604 nWhich =
GetWhich(SID_ATTR_FRAMEDIRECTION);
608 case SfxItemState::UNKNOWN:
611 case SfxItemState::DISABLED:
612 case SfxItemState::READONLY:
615 case SfxItemState::DONTCARE:
618 case SfxItemState::DEFAULT:
619 case SfxItemState::SET:
631 lcl_MaybeResetAlignToDistro<SvxCellHorJustify, SvxCellHorJustify>(
633 GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY),
GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD),
634 SvxCellHorJustify::Block);
636 lcl_MaybeResetAlignToDistro<SvxCellVerJustify, SvxCellVerJustify>(
638 GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY),
GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD),
639 SvxCellVerJustify::Block);
641 m_xLbHorAlign->save_value();
643 m_xLbVerAlign->save_value();
654 return DeactivateRC::LeavePage;
662 Image aBottomLock(StockImage::Yes, RID_SVXBMP_BOTTOMLOCK);
663 Image aTopLock(StockImage::Yes, RID_SVXBMP_TOPLOCK);
664 Image aCellLock(StockImage::Yes, RID_SVXBMP_CELLLOCK);
716 m_xNfRotate->set_sensitive(!bHorFill && !bStackedText);
725 if (rOld.
GetItemState(nWhich,
true, &pItem) == SfxItemState::SET)
731 if (rNew.
GetItemState(nWhich,
true, &pItem) == SfxItemState::SET)
737 return eMethodOld != eMethodNew;
742 m_aStackedState.ButtonToggled(rToggle);
743 UpdateEnableControls();
748 m_aAsianModeState.ButtonToggled(rToggle);
753 m_aWrapState.ButtonToggled(rToggle);
754 UpdateEnableControls();
759 m_aHyphenState.ButtonToggled(rToggle);
764 m_aShrinkState.ButtonToggled(rToggle);
769 UpdateEnableControls();
void UpdateEnableControls()
#define LINK(Instance, Class, Member)
#define ALIGNDLG_HORALIGN_DISTRIBUTED
weld::TriStateEnabled m_aHyphenState
virtual SfxBoolItem * Clone(SfxItemPool *=nullptr) const override
virtual sal_uInt16 GetEnumValue() const =0
std::unique_ptr< weld::Widget > m_xAlignmentFrame
std::unique_ptr< svx::FrameDirectionListBox > m_xLbFrameDir
std::unique_ptr< weld::Label > m_xFtRefEdge
sal_uInt16 GetValue() const
void InvalidateItem(sal_uInt16 nWhich)
#define ALIGNDLG_VERALIGN_STD
sal_uInt16 GetSelectedItemId() const
static const sal_uInt16 s_pRanges[]
virtual int get_active() const =0
void SetStyle(WinBits nStyle)
std::unique_ptr< weld::Label > m_xFtVerAlign
AlignmentTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rCoreSet)
std::unique_ptr< weld::MetricSpinButton > m_xNfRotate
#define ALIGNDLG_HORALIGN_RIGHT
virtual bool FillItemSet(SfxItemSet *)
std::unique_ptr< weld::Label > m_xFtRotate
std::unique_ptr< weld::CheckButton > m_xBtnWrap
weld::TriStateEnabled m_aWrapState
std::unique_ptr< weld::CheckButton > m_xBtnHyphen
OUString SvxResId(const char *pId)
std::unique_ptr< weld::ComboBox > m_xLbVerAlign
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void SetExchangeSupport()
std::unique_ptr< weld::CustomWeld > m_xCtrlDialWin
virtual void Reset(const SfxItemSet *)
std::unique_ptr< DialControl > m_xCtrlDial
#define ALIGNDLG_HORALIGN_CENTER
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
const SfxItemSet & GetItemSet() const
std::unique_ptr< weld::Label > m_xFtCelLock
#define ALIGNDLG_HORALIGN_LEFT
std::unique_ptr< weld::ComboBox > m_xLbHorAlign
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
std::unique_ptr< weld::Label > m_xFtABCD
virtual SdrAngleItem * Clone(SfxItemPool *pPool=nullptr) const override
#define ALIGNDLG_VERALIGN_BOTTOM
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define ALIGNDLG_VERALIGN_MID
bool HasAlignmentChanged(const SfxItemSet &rNew, sal_uInt16 nWhich) const
std::unique_ptr< weld::CustomWeld > m_xVsRefEdge
weld::TriStateEnabled m_aAsianModeState
bool IsValueChangedFromSaved() const
void InsertItem(sal_uInt16 nItemId, const Image &rImage)
IMPL_LINK(ClassificationDialog, SelectClassificationHdl, weld::ComboBox &, rBox, void)
std::unique_ptr< weld::Label > m_xFtIndent
std::unique_ptr< weld::MetricSpinButton > m_xEdIndent
virtual void Reset(const SfxItemSet *rSet) override
std::unique_ptr< weld::Label > m_xFtTopLock
virtual void set_active(int pos)=0
#define ALIGNDLG_VERALIGN_DISTRIBUTED
#define ALIGNDLG_VERALIGN_BLOCK
weld::TriStateEnabled m_aStackedState
void SelectItem(sal_uInt16 nItemId)
#define ALIGNDLG_HORALIGN_FILL
#define ALIGNDLG_HORALIGN_BLOCK
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< weld::Widget > m_xOrientFrame
std::unique_ptr< weld::CheckButton > m_xBtnShrink
#define ALIGNDLG_VERALIGN_TOP
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
std::unique_ptr< weld::CheckButton > m_xCbAsianMode
void SetColCount(sal_uInt16 nNewCols=1)
weld::TriStateEnabled m_aShrinkState
Degree100 GetValue() const
virtual ~AlignmentTabPage() override
IMPL_LINK_NOARG(AccessibilityCheckEntry, GotoButtonClicked, weld::Button &, void)
std::unique_ptr< weld::Widget > m_xPropertiesFrame
virtual SfxUInt16Item * Clone(SfxItemPool *=nullptr) const override
virtual bool FillItemSet(SfxItemSet *rSet) override
std::unique_ptr< weld::CheckButton > m_xCbStacked
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
#define ALIGNDLG_HORALIGN_STD
std::unique_ptr< weld::Label > m_xFtBotLock
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const