34#include <svx/dialogs.hrc>
40#include <osl/diagnose.h>
49 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/outlinepositionpage.ui",
"OutlinePositionPage", &
rSet)
52 , m_pOutlineDlg(nullptr)
56 , m_bInInintControl(false)
57 , m_bLabelAlignmentPosAndSpaceModeActive(false)
58 , m_xLevelLB(m_xBuilder->weld_tree_view(
"levellb"))
59 , m_xPositionFrame(m_xBuilder->weld_widget(
"numberingframe"))
60 , m_xDistBorderFT(m_xBuilder->weld_label(
"indent"))
61 , m_xDistBorderMF(m_xBuilder->weld_metric_spin_button(
"indentmf",
FieldUnit::
CM))
62 , m_xRelativeCB(m_xBuilder->weld_check_button(
"relative"))
63 , m_xIndentFT(m_xBuilder->weld_label(
"numberingwidth"))
64 , m_xIndentMF(m_xBuilder->weld_metric_spin_button(
"numberingwidthmf",
FieldUnit::
CM))
65 , m_xDistNumFT(m_xBuilder->weld_label(
"numdist"))
66 , m_xDistNumMF(m_xBuilder->weld_metric_spin_button(
"numdistmf",
FieldUnit::
CM))
67 , m_xAlignFT(m_xBuilder->weld_label(
"numalign"))
68 , m_xAlignLB(m_xBuilder->weld_combo_box(
"numalignlb"))
69 , m_xLabelFollowedByFT(m_xBuilder->weld_label(
"numfollowedby"))
70 , m_xLabelFollowedByLB(m_xBuilder->weld_combo_box(
"numfollowedbylb"))
71 , m_xListtabFT(m_xBuilder->weld_label(
"at"))
72 , m_xListtabMF(m_xBuilder->weld_metric_spin_button(
"atmf",
FieldUnit::
CM))
73 , m_xAlign2FT(m_xBuilder->weld_label(
"num2align"))
74 , m_xAlign2LB(m_xBuilder->weld_combo_box(
"num2alignlb"))
75 , m_xAlignedAtFT(m_xBuilder->weld_label(
"alignedat"))
76 , m_xAlignedAtMF(m_xBuilder->weld_metric_spin_button(
"alignedatmf",
FieldUnit::
CM))
77 , m_xIndentAtFT(m_xBuilder->weld_label(
"indentat"))
78 , m_xIndentAtMF(m_xBuilder->weld_metric_spin_button(
"indentatmf",
FieldUnit::
CM))
79 , m_xStandardPB(m_xBuilder->weld_button(
"standard"))
80 , m_xPreviewWIN(new
weld::CustomWeld(*m_xBuilder,
"preview", m_aPreviewWIN))
84 m_xLevelLB->set_selection_mode(SelectionMode::Multiple);
118 OUString sEntry =
"1 - " + OUString::number(
MAXLEVEL);
137 const bool bSingleSelection =
m_xLevelLB->count_selected_rows() == 1 &&
141 ( bSingleSelection || bRelative ||
m_pOutlineDlg !=
nullptr ) );
143 ( bSingleSelection || bRelative ||
m_pOutlineDlg !=
nullptr ) );
145 bool bSetDistEmpty =
false;
149 bool bSameAdjust =
true;
157 sal_uInt16 nMask = 1;
158 sal_uInt16 nLvl = USHRT_MAX;
165 if(USHRT_MAX == nLvl)
180 if (nFirstBorderTextRelative == -1)
181 nFirstBorderTextRelative = nBorderTextRelative;
183 bSameDistBorderNum &= nFirstBorderTextRelative == nBorderTextRelative;
187 bSameDistBorderNum &=
197 bSameLabelFollowedBy &=
203 == ( aNumFormatArr[nLvl]->GetIndentAt() + aNumFormatArr[nLvl]->
GetFirstLineIndent() ) );
214 OSL_ENSURE(
false,
"cannot happen.");
217 if(bSameDistBorderNum)
222 nDistBorderNum =
static_cast<tools::Long>(aNumFormatArr[nLvl]->
GetAbsLSpace())+ aNumFormatArr[nLvl]->GetFirstLineOffset();
224 nDistBorderNum -=
static_cast<tools::Long>(aNumFormatArr[nLvl - 1]->
GetAbsLSpace())+ aNumFormatArr[nLvl - 1]->GetFirstLineOffset();
228 nDistBorderNum =
static_cast<tools::Long>(aNumFormatArr[nLvl]->
GetAbsLSpace())+ aNumFormatArr[nLvl]->GetFirstLineOffset();
233 bSetDistEmpty =
true;
247 if(aNumFormatArr[nLvl]->GetNumAdjust() == SvxAdjust::Left)
249 else if(aNumFormatArr[nLvl]->GetNumAdjust() == SvxAdjust::Right)
260 if ( bSameLabelFollowedBy )
333 sal_uInt16 nTmpNumLvl =
346 sal_uInt16 nMask = 1;
374 return DeactivateRC::LeavePage;
396 m_xLevelLB->set_selection_mode(SelectionMode::Single);
402 sal_uInt16 nMask = 1;
433 OSL_FAIL(
"<SwNumPositionTabPage::InitPosAndSpaceMode()> - misusage of method -> <pAktNum> has to be already set!" );
439 sal_uInt16 nMask = 1;
485 return std::make_unique<SwNumPositionTabPage>(pPage, pController, *rAttrSet);
504 if(eMetric == FieldUnit::MM)
523 sal_uInt16 nMask = 1;
526 if(m_nActNumLvl & nMask)
530 const int nPos = m_xAlignLB->get_visible()
531 ? m_xAlignLB->get_active()
532 : m_xAlign2LB->get_active();
535 eAdjust = SvxAdjust::Left;
537 eAdjust = SvxAdjust::Right;
539 m_pActNum->Set(
i, aNumFormat);
548 sal_uInt16 nSaveNumLvl = m_nActNumLvl;
550 auto aRows = rBox.get_selected_rows();
551 if ((std::find(aRows.begin(), aRows.end(),
MAXLEVEL) != aRows.end()) &&
552 (aRows.size() == 1 || nSaveNumLvl != 0xffff))
554 m_nActNumLvl = 0xFFFF;
558 else if (!aRows.empty())
560 sal_uInt16 nMask = 1;
563 if (std::find(aRows.begin(), aRows.end(),
i) != aRows.end())
564 m_nActNumLvl |= nMask;
571 m_nActNumLvl = nSaveNumLvl;
572 sal_uInt16 nMask = 1;
575 if(m_nActNumLvl & nMask)
583 m_xRelativeCB->set_sensitive(1 != m_nActNumLvl);
585 InitPosAndSpaceMode();
586 ShowControlsDependingOnPosAndSpaceMode();
592 if(m_bInInintControl)
595 sal_uInt16 nMask = 1;
598 if(m_nActNumLvl & nMask)
601 if (&rField == m_xDistBorderMF.get())
604 if (m_xRelativeCB->get_active() && m_xRelativeCB->get_sensitive())
613 tools::Long nTmp = m_pActNum->Get(
i - 1 ).GetAbsLSpace() +
614 m_pActNum->Get(
i - 1 ).GetFirstLineOffset() -
615 m_pActNum->Get(
i ).GetFirstLineOffset();
625 else if (&rField == m_xDistNumMF.get())
629 else if (&rField == m_xIndentMF.get())
638 m_pActNum->Set(
i, aNumFormat );
644 if(!m_xDistBorderMF->get_sensitive())
645 m_xDistBorderMF->set_text(OUString());
650 bool bOn = rBox.get_active();
651 bool bSingleSelection = m_xLevelLB->n_children() == 1 && USHRT_MAX != m_nActNumLvl;
652 bool bSetValue =
false;
654 if(bOn || bSingleSelection)
656 sal_uInt16 nMask = 1;
661 if(m_nActNumLvl & nMask)
668 nValue -= m_pActNum->Get(
i - 1).GetAbsLSpace();
679 m_xDistBorderMF->set_value(m_xDistBorderMF->normalize(
nValue), FieldUnit::TWIP);
681 m_xDistBorderMF->set_text(OUString());
682 m_xDistBorderMF->set_sensitive(bOn || bSingleSelection || m_pOutlineDlg);
691 const int nPos = m_xLabelFollowedByLB->get_active();
696 else if (
nPos == 2 )
700 else if (
nPos == 3 )
707 bool bSameListtabPos =
true;
708 sal_uInt16 nFirstLvl = USHRT_MAX;
709 sal_uInt16 nMask = 1;
712 if ( m_nActNumLvl & nMask )
716 m_pActNum->Set(
i, aNumFormat );
718 if ( nFirstLvl == USHRT_MAX )
725 m_pActNum->Get( nFirstLvl ).GetListtabPos();
737 m_xListtabMF->set_value(
738 m_xListtabMF->normalize( m_pActNum->Get( nFirstLvl ).GetListtabPos() ),
743 m_xListtabMF->set_text(OUString());
755 sal_uInt16 nMask = 1;
758 if ( m_nActNumLvl & nMask )
762 m_pActNum->Set(
i, aNumFormat );
776 sal_uInt16 nMask = 1;
779 if ( m_nActNumLvl & nMask )
784 m_pActNum->Set(
i, aNumFormat );
798 sal_uInt16 nMask = 1;
801 if ( m_nActNumLvl & nMask )
809 m_pActNum->Set(
i, aNumFormat );
819 sal_uInt16 nMask = 1;
822 if(m_nActNumLvl & nMask)
825 SwNumRule aTmpNumRule( m_pWrtSh->GetUniqueNumRuleName(),
844 m_pActNum->Set(
i, aNumFormat );
864 :
SfxTabDialogController(pParent,
"modules/swriter/ui/bulletsandnumbering.ui",
"BulletsAndNumberingDialog",
867 , m_xDummyCombo(m_xBuilder->weld_combo_box(
"dummycombo"))
872 AddTabPage(
"singlenum", RID_SVXPAGE_PICK_SINGLE_NUM );
873 AddTabPage(
"bullets", RID_SVXPAGE_PICK_BULLET );
874 AddTabPage(
"outlinenum", RID_SVXPAGE_PICK_NUM );
875 AddTabPage(
"graphics", RID_SVXPAGE_PICK_BMP );
883 AddTabPage(
"customize", RID_SVXPAGE_NUM_OPTIONS );
886 AddTabPage(
"position", RID_SVXPAGE_NUM_POSITION );
896 OUString sNumCharFormat, sBulletCharFormat;
900 if (rPageId ==
"singlenum")
907 else if (rPageId ==
"bullets")
913 else if (rPageId ==
"customize")
924 std::vector<OUString> aList;
932 aSet.
Put (
SfxUInt16Item(SID_METRIC_ITEM,
static_cast< sal_uInt16
>(eMetric) ) );
935 else if (rPageId ==
"position")
940 aSet.
Put (
SfxUInt16Item(SID_METRIC_ITEM,
static_cast< sal_uInt16
>(eMetric)) );
Reference< XExecutableDialog > m_xDialog
void SetLevel(sal_uInt16 nSet)
void SetPageWidth(tools::Long nPgWidth)
void SetNumRule(const SwNumRule *pNum)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void AddTabPage(const OUString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
weld::Button * GetUserButton() const
void RemoveTabPage(const OUString &rName)
std::unique_ptr< SfxItemSet > m_xExampleSet
SfxItemSet * GetInputSetImpl()
virtual void PageCreated(const SfxAllItemSet &aSet)
void SetExchangeSupport()
const SfxItemSet * GetDialogExampleSet() const
const SwNumRule * GetNumRuleAtCurrCursorPos() const
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
bool m_bLabelAlignmentPosAndSpaceModeActive
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
virtual bool FillItemSet(SfxItemSet *rSet) override
std::unique_ptr< weld::ComboBox > m_xAlign2LB
std::unique_ptr< weld::CheckButton > m_xRelativeCB
std::unique_ptr< weld::Label > m_xIndentFT
std::unique_ptr< weld::ComboBox > m_xAlignLB
std::unique_ptr< weld::ComboBox > m_xLabelFollowedByLB
std::unique_ptr< weld::Label > m_xAlignFT
std::unique_ptr< weld::Label > m_xDistBorderFT
std::unique_ptr< weld::MetricSpinButton > m_xIndentMF
std::unique_ptr< weld::MetricSpinButton > m_xDistBorderMF
std::unique_ptr< weld::MetricSpinButton > m_xAlignedAtMF
std::unique_ptr< weld::Label > m_xIndentAtFT
std::unique_ptr< weld::MetricSpinButton > m_xDistNumMF
virtual void Reset(const SfxItemSet *rSet) override
SwNumPositionTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
void InitPosAndSpaceMode()
std::unique_ptr< weld::MetricSpinButton > m_xIndentAtMF
NumberingPreview m_aPreviewWIN
std::unique_ptr< weld::Label > m_xAlignedAtFT
SwOutlineTabDialog * m_pOutlineDlg
std::unique_ptr< SwNumRule > m_pActNum
std::unique_ptr< weld::Label > m_xAlign2FT
std::unique_ptr< weld::Label > m_xDistNumFT
virtual ~SwNumPositionTabPage() override
std::unique_ptr< weld::MetricSpinButton > m_xListtabMF
void SetWrtShell(SwWrtShell *pSh)
std::unique_ptr< weld::Button > m_xStandardPB
std::unique_ptr< weld::TreeView > m_xLevelLB
void ShowControlsDependingOnPosAndSpaceMode()
virtual void ActivatePage(const SfxItemSet &rSet) override
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
std::unique_ptr< weld::Label > m_xLabelFollowedByFT
std::unique_ptr< weld::Label > m_xListtabFT
const SwNumFormat & Get(sal_uInt16 i) const
static void SetActNumLevel(sal_uInt16 nSet)
static sal_uInt16 GetActNumLevel()
Of course Writer needs its own rectangles.
void Width(tools::Long nNew)
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
virtual short Ok() override
SwSvxNumBulletTabDialog(weld::Window *pParent, const SfxItemSet *pSwItemSet, SwWrtShell &)
std::unique_ptr< weld::ComboBox > m_xDummyCombo
virtual ~SwSvxNumBulletTabDialog() override
virtual void PageCreated(const OUString &rPageId, SfxTabPage &rPage) override
static ShellResource * GetShellRes()
SwDocShell * GetDocShell()
Used by the UI to modify the document model.
const SwView & GetView() const
#define FN_PARAM_ACT_NUMBER
#define FN_PARAM_NUM_PRESET
@ Page
Rect of current page.
@ Frame
Rect of current frame.
#define LINK(Instance, Class, Member)
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
IMPL_LINK(SwNumPositionTabPage, LevelHdl, weld::TreeView &, rBox, void)
IMPL_LINK_NOARG(SwNumPositionTabPage, EditModifyHdl, weld::ComboBox &, void)
static bool bLastRelative
@ RES_POOLCHR_BULLET_LEVEL
Bullets.
@ RES_POOLCHR_NUM_LEVEL
Numbering symbols.
constexpr sal_uInt8 MAXLEVEL