27 #include <uiitems.hxx>
34 #include <svx/dialogs.hrc>
40 #include <osl/diagnose.h>
49 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/outlinepositionpage.ui",
"OutlinePositionPage", &rSet)
52 , pOutlineDlg(nullptr)
56 , bInInintControl(
false)
57 , 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 ||
pOutlineDlg !=
nullptr ) );
143 ( bSingleSelection || bRelative ||
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() ) );
212 if (MAXLEVEL <= nLvl)
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);
399 pSaveNum = const_cast<SwUINumRuleItem*>(pNumberItem)->GetNumRule();
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(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;
538 aNumFormat.SetNumAdjust( eAdjust );
539 pActNum->Set(
i, aNumFormat);
548 sal_uInt16 nSaveNumLvl = 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))
558 else if (!aRows.empty())
560 sal_uInt16 nMask = 1;
563 if (std::find(aRows.begin(), aRows.end(),
i) != aRows.end())
567 rBox.unselect(MAXLEVEL);
571 nActNumLvl = nSaveNumLvl;
572 sal_uInt16 nMask = 1;
575 if(nActNumLvl & nMask)
583 m_xRelativeCB->set_sensitive(1 != nActNumLvl);
585 InitPosAndSpaceMode();
586 ShowControlsDependingOnPosAndSpaceMode();
595 sal_uInt16 nMask = 1;
598 if(nActNumLvl & nMask)
601 if (&rField == m_xDistBorderMF.get())
604 if (m_xRelativeCB->get_active() && m_xRelativeCB->get_sensitive())
609 aNumFormat.SetAbsLSpace( nValue - nTmp );
613 tools::Long nTmp = pActNum->Get(
i - 1 ).GetAbsLSpace() +
614 pActNum->Get(
i - 1 ).GetFirstLineOffset() -
615 pActNum->Get(
i ).GetFirstLineOffset();
617 aNumFormat.SetAbsLSpace( nValue + nTmp );
622 aNumFormat.SetAbsLSpace( nValue - aNumFormat.GetFirstLineOffset());
625 else if (&rField == m_xDistNumMF.get())
627 aNumFormat.SetCharTextDistance( nValue );
629 else if (&rField == m_xIndentMF.get())
632 tools::Long nDiff = nValue + aNumFormat.GetFirstLineOffset();
633 auto const nAbsLSpace = aNumFormat.GetAbsLSpace();
634 aNumFormat.SetAbsLSpace( nAbsLSpace + nDiff );
635 aNumFormat.SetFirstLineOffset( -nValue );
638 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 != nActNumLvl;
652 bool bSetValue =
false;
654 if(bOn || bSingleSelection)
656 sal_uInt16 nMask = 1;
661 if(nActNumLvl & nMask)
668 nValue -= pActNum->Get(
i - 1).GetAbsLSpace();
671 bSetValue = nValue == rNumFormat.
GetAbsLSpace() - 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 || 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 ( nActNumLvl & nMask )
716 pActNum->Set(
i, aNumFormat );
718 if ( nFirstLvl == USHRT_MAX )
724 bSameListtabPos &= aNumFormat.GetListtabPos() ==
725 pActNum->Get( nFirstLvl ).GetListtabPos();
737 m_xListtabMF->set_value(
738 m_xListtabMF->normalize( pActNum->Get( nFirstLvl ).GetListtabPos() ),
743 m_xListtabMF->set_text(OUString());
755 sal_uInt16 nMask = 1;
758 if ( nActNumLvl & nMask )
762 pActNum->Set(
i, aNumFormat );
776 sal_uInt16 nMask = 1;
779 if ( nActNumLvl & nMask )
783 aNumFormat.SetFirstLineIndent( nFirstLineIndent );
784 pActNum->Set(
i, aNumFormat );
798 sal_uInt16 nMask = 1;
801 if ( nActNumLvl & nMask )
805 aNumFormat.GetFirstLineIndent();
806 aNumFormat.SetIndentAt( nValue );
807 const tools::Long nNewFirstLineIndent = nAlignedAt - nValue;
808 aNumFormat.SetFirstLineIndent( nNewFirstLineIndent );
809 pActNum->Set(
i, aNumFormat );
819 sal_uInt16 nMask = 1;
822 if(nActNumLvl & nMask)
825 SwNumRule aTmpNumRule( pWrtSh->GetUniqueNumRuleName(),
826 aNumFormat.GetPositionAndSpaceMode(),
832 aNumFormat.SetAbsLSpace( aTempFormat.GetAbsLSpace());
833 aNumFormat.SetCharTextDistance( aTempFormat.GetCharTextDistance() );
834 aNumFormat.SetFirstLineOffset( aTempFormat.GetFirstLineOffset() );
838 aNumFormat.SetNumAdjust( aTempFormat.GetNumAdjust() );
839 aNumFormat.SetLabelFollowedBy( aTempFormat.GetLabelFollowedBy() );
840 aNumFormat.SetListtabPos( aTempFormat.GetListtabPos() );
841 aNumFormat.SetFirstLineIndent( aTempFormat.GetFirstLineIndent() );
842 aNumFormat.SetIndentAt( aTempFormat.GetIndentAt() );
844 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)) );
#define LINK(Instance, Class, Member)
virtual void ActivatePage(const SfxItemSet &rSet) override
void SetWrtShell(SwWrtShell *pSh)
virtual short Ok() override
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
IMPL_LINK(SwNumPositionTabPage, LevelHdl, weld::TreeView &, rBox, void)
NumberingPreview m_aPreviewWIN
virtual void PageCreated(const SfxAllItemSet &aSet)
static ShellResource * GetShellRes()
std::unique_ptr< weld::TreeView > m_xLevelLB
std::unique_ptr< weld::MetricSpinButton > m_xDistBorderMF
std::unique_ptr< weld::Label > m_xDistBorderFT
const SwNumRule * GetNumRuleAtCurrCursorPos() const
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
void SetLevel(sal_uInt16 nSet)
std::unique_ptr< SfxItemSet > m_xExampleSet
void InitPosAndSpaceMode()
constexpr sal_uInt8 MAXLEVEL
void RemoveTabPage(const OString &rName)
std::unique_ptr< weld::MetricSpinButton > m_xListtabMF
SfxItemSet * GetInputSetImpl()
Of course Writer needs its own rectangles.
virtual void PageCreated(const OString &rPageId, SfxTabPage &rPage) override
std::unique_ptr< weld::Label > m_xIndentFT
Used by the UI to modify the document model.
std::unique_ptr< weld::ComboBox > m_xAlignLB
const SwView & GetView() const
virtual void Reset(const SfxItemSet *rSet) override
std::unique_ptr< weld::Label > m_xIndentAtFT
void SetExchangeSupport()
SwOutlineTabDialog * pOutlineDlg
#define FN_PARAM_NUM_PRESET
void Width(tools::Long nNew)
IMPL_LINK_NOARG(SwNumPositionTabPage, EditModifyHdl, weld::ComboBox &, void)
std::unique_ptr< weld::Label > m_xLabelFollowedByFT
std::unique_ptr< weld::Label > m_xListtabFT
std::unique_ptr< weld::Label > m_xAlign2FT
SwSvxNumBulletTabDialog(weld::Window *pParent, const SfxItemSet *pSwItemSet, SwWrtShell &)
std::unique_ptr< SwNumRule > pActNum
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
virtual ~SwNumPositionTabPage() override
std::unique_ptr< weld::Button > m_xStandardPB
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
std::unique_ptr< weld::Label > m_xAlignFT
std::unique_ptr< weld::Label > m_xDistNumFT
void SetNumRule(const SwNumRule *pNum)
void SetPageWidth(tools::Long nPgWidth)
#define FN_PARAM_ACT_NUMBER
std::unique_ptr< weld::MetricSpinButton > m_xDistNumMF
static void SetActNumLevel(sal_uInt16 nSet)
virtual bool FillItemSet(SfxItemSet *rSet) override
bool bLabelAlignmentPosAndSpaceModeActive
const SfxItemSet * GetDialogExampleSet() const
SwDocShell * GetDocShell()
SwNumPositionTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< weld::MetricSpinButton > m_xIndentMF
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::CheckButton > m_xRelativeCB
std::unique_ptr< weld::ComboBox > m_xDummyCombo
std::unique_ptr< weld::MetricSpinButton > m_xAlignedAtMF
std::unique_ptr< weld::MetricSpinButton > m_xIndentAtMF
virtual ~SwSvxNumBulletTabDialog() override
std::unique_ptr< weld::ComboBox > m_xLabelFollowedByLB
static bool bLastRelative
weld::Button * GetUserButton() const
std::unique_ptr< weld::ComboBox > m_xAlign2LB
std::unique_ptr< weld::Label > m_xAlignedAtFT
void ShowControlsDependingOnPosAndSpaceMode()
bool m_bDetectedRangeSegmentation false
static sal_uInt16 GetActNumLevel()