55 std::unique_ptr<weld::Entry> m_xFormEdit;
56 std::unique_ptr<weld::TreeView> m_xFormBox;
57 std::unique_ptr<weld::Button> m_xOKBtn;
65 void SetUserNames(
const OUString *pList[]);
66 OUString
GetName()
const {
return m_xFormEdit->get_text(); }
67 int GetCurEntryPos()
const {
return m_xFormBox->get_selected_index(); }
75 m_xFormEdit->set_text(rBox.get_selected_text());
76 m_xFormEdit->select_region(0, -1);
83void SwNumNamesDlg::SetUserNames(
const OUString *pList[])
85 sal_uInt16 nSelect = 0;
90 m_xFormBox->remove(i);
91 m_xFormBox->insert_text(i, *pList[i]);
96 m_xFormBox->select(
std::min(nSelect, o3tl::narrowing<sal_uInt16>(m_xFormBox->n_children() - 1)));
97 SelectHdl(*m_xFormBox);
103 m_xOKBtn->set_sensitive(!rBox.get_text().isEmpty());
114 : GenericDialogController(pParent,
115 "modules/swriter/ui/numberingnamedialog.ui",
116 "NumberingNameDialog")
117 , m_xFormEdit(m_xBuilder->weld_entry(
"entry"))
118 , m_xFormBox(m_xBuilder->weld_tree_view(
"form"))
119 , m_xOKBtn(m_xBuilder->weld_button(
"ok"))
121 for (
auto const& aID : OUTLINE_STYLE)
122 m_xFormBox->append_text(
SwResId(aID));
124 m_xFormEdit->connect_changed(
LINK(
this, SwNumNamesDlg, ModifyHdl));
125 m_xFormBox->connect_changed(
LINK(
this, SwNumNamesDlg, SelectHdl));
126 m_xFormBox->connect_row_activated(
LINK(
this, SwNumNamesDlg, DoubleClickHdl));
127 m_xFormBox->set_size_request(-1, m_xFormBox->get_height_rows(9));
132 constexpr sal_uInt16 MAXLEVEL_MASK = USHRT_MAX >> (
sizeof(sal_uInt16) * CHAR_BIT -
MAXLEVEL);
133 assert((nActLevel & MAXLEVEL_MASK) == nActLevel);
134 sal_uInt16 nTmp = nActLevel & MAXLEVEL_MASK;
135 sal_uInt16 nTmpLevel = 0;
136 while( 0 != (nTmp >>= 1) )
145 :
SfxTabDialogController(pParent,
"modules/swriter/ui/outlinenumbering.ui",
"OutlineNumberingDialog", pSwItemSet)
147 , m_pChapterNumRules(
SW_MOD()->GetChapterNumRules())
148 , m_bModified(m_rWrtSh.IsModified())
149 , m_xMenuButton(m_xBuilder->weld_menu_button(
"format"))
201 if (rPageId ==
"position")
206 else if (rPageId ==
"numbering")
215 m_rWrtSh.ResetModified();
221 if (!m_xMenuButton->get_active())
230 m_xMenuButton->set_item_label(
"form" + OUString::number(
i + 1), pRules->
GetName());
238 if (rIdent ==
"form1")
240 else if (rIdent ==
"form2")
242 else if (rIdent ==
"form3")
244 else if (rIdent ==
"form4")
246 else if (rIdent ==
"form5")
248 else if (rIdent ==
"form6")
250 else if (rIdent ==
"form7")
252 else if (rIdent ==
"form8")
254 else if (rIdent ==
"form9")
256 else if (rIdent ==
"saveas")
266 aStrArr[
i] =
nullptr;
268 aDlg.SetUserNames(aStrArr);
271 const OUString
aName(aDlg.GetName());
273 *m_xNumRule,
aName ), aDlg.GetCurEntryPos() );
274 m_xMenuButton->set_item_label(
"form" + OUString::number(aDlg.GetCurEntryPos() + 1),
aName);
286 SfxTabPage* pOutlinePage = GetTabPage(
u"numbering");
287 assert(pOutlinePage);
291 *m_xNumRule = *m_rWrtSh.GetOutlineNumRule();
392 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/outlinenumberingpage.ui",
"OutlineNumberingPage", &
rSet)
393 , m_aNoFormatName(
SwResId(SW_STR_NONE))
395 , m_pNumRule(nullptr)
396 , m_pCollNames(nullptr)
398 , m_xLevelLB(m_xBuilder->weld_tree_view(
"level"))
399 , m_xCollBox(m_xBuilder->weld_combo_box(
"style"))
401 , m_xCharFormatLB(m_xBuilder->weld_combo_box(
"charstyle"))
402 , m_xAllLevelFT(m_xBuilder->weld_label(
"sublevelsft"))
403 , m_xAllLevelNF(m_xBuilder->weld_spin_button(
"sublevelsnf"))
404 , m_xPrefixED(m_xBuilder->weld_entry(
"prefix"))
405 , m_xSuffixED(m_xBuilder->weld_entry(
"suffix"))
406 , m_xStartEdit(m_xBuilder->weld_spin_button(
"startat"))
407 , m_xPreviewWIN(new
weld::CustomWeld(*m_xBuilder,
"preview", m_aPreviewWIN))
431 bool bSamePrefix =
true;
432 bool bSameSuffix =
true;
433 bool bSameType =
true;
434 bool bSameComplete =
true;
435 bool bSameStart =
true;
436 bool bSameCharFormat =
true;
455 bSameCharFormat &= (!pFirstFormat && !pFormat)
456 || (pFirstFormat && pFormat && pFormat->
GetName() == pFirstFormat->
GetName());
461 m_xNumberBox->SelectNumberingType( aNumFormatArr[0]->GetNumberingType() );
469 m_xPrefixED->set_text(aNumFormatArr[0]->GetPrefix());
473 m_xSuffixED->set_text(aNumFormatArr[0]->GetSuffix());
492 m_xAllLevelNF->set_value(aNumFormatArr[0]->GetIncludeUpperLevels());
540 auto aRows = rBox.get_selected_rows();
541 assert(aRows.empty() || aRows.size() == 1);
542 if (aRows.empty() || aRows[0] ==
MAXLEVEL)
544 m_nActLevel = USHRT_MAX;
548 m_nActLevel = 1 << aRows[0];
555 sal_uInt16 nMask = 1;
558 if(m_nActLevel & nMask)
565 m_pNumRule->Set(
i, aNumFormat);
576 const OUString aCollName(rBox.get_active_text());
579 OUString sOldName( m_pCollNames[nTmpLevel] );
582 m_pCollNames[
i] = m_aSaveCollNames[
i];
584 m_pCollNames[nTmpLevel] = aCollName;
587 if(
i != nTmpLevel && m_pCollNames[
i] == aCollName )
588 m_pCollNames[
i].clear();
591 if( !sOldName.isEmpty() )
593 if( m_aSaveCollNames[
i ] == sOldName &&
i != nTmpLevel &&
594 m_pCollNames[
i ].isEmpty() )
598 if( m_pCollNames[
n ] == sOldName )
603 m_pCollNames[
i ] = sOldName;
618 sal_uInt16 nMask = 1;
619 SvxNumType nNumberType = m_xNumberBox->GetSelectedNumberingType();
622 if(m_nActLevel & nMask)
626 m_pNumRule->Set(
i, aNumFormat);
627 CheckForStartValue_Impl(nNumberType);
636 sal_uInt16 nMask = 1;
639 if(m_nActLevel & nMask)
642 aNumFormat.
SetListFormat( m_xPrefixED->get_text(), m_xSuffixED->get_text(),
i );
643 m_pNumRule->Set(
i, aNumFormat);
652 sal_uInt16 nMask = 1;
655 if(m_nActLevel & nMask)
658 aNumFormat.
SetStart(o3tl::narrowing<sal_uInt16>(rEdit.get_value()));
659 m_pNumRule->Set(
i, aNumFormat);
668 OUString sEntry = m_xCharFormatLB->get_active_text();
669 sal_uInt16 nMask = 1;
674 sal_uInt16 nChCount = m_pSh->GetCharFormatCount();
675 for(sal_uInt16
i = 0;
i < nChCount;
i++)
678 if(rChFormat.
GetName() == sEntry)
680 pFormat = &rChFormat;
688 pBase = pPool->
Find(sEntry, SfxStyleFamily::Char);
690 pBase = &pPool->
Make(sEntry, SfxStyleFamily::Page);
698 if(m_nActLevel & nMask)
705 m_pNumRule->Set(
i, aNumFormat);
736 m_xLevelLB->append_text( OUString::number(
i + 1) );
738 OUString sStr =
"1 - " + OUString::number(
MAXLEVEL);
779 return DeactivateRC::LeavePage;
795 return std::make_unique<SwOutlineSettingsTabPage>(pPage, pController, *rAttrSet);
805 if (bIsNull && bNoZeroAllowed)
815 Size aTmpSize(rSize);
833 OUString aText(&cBullet, 1);
854 nRet = aGSize.
Width();
867 pVDev->SetMapMode(rRenderContext.
GetMapMode());
868 pVDev->SetOutputSize(aSize);
875 pVDev->SetFillColor(rDocColor);
876 pVDev->SetLineColor(rDocBoundariesColor);
886 nWidthRelation = nWidthRelation * 2 / 3;
888 nWidthRelation = nWidthRelation / 4;
896 GetDefaultFontFlags::OnlyOne, &rRenderContext);
910 const tools::Long nLineHeight = nFontHeight * 8 / 7;
921 for (
sal_uInt8 nLevel = nStart; nLevel < nEnd; ++nLevel)
924 aNumVector.push_back(rFormat.
GetStart());
933 nNumberXPos = nXStart;
944 nNumberXPos = (nTmpNumberXPos < 0) ? 0 : nTmpNumberXPos;
951 nYStart, nWidthRelation);
962 aNumVector[nLevel] = nPreNum;
964 pVDev->DrawText(
Point(nNumberXPos, nYStart), aText );
965 nBulletWidth = pVDev->GetTextWidth(aText);
973 pVDev->DrawText(
Point(nNumberXPos, nYStart), aText );
974 nBulletWidth += pVDev->GetTextWidth(aText);
982 nTextXPos = nTextXPos + nTextOffset;
983 if (nNumberXPos + nBulletWidth + nTextOffset > nTextXPos)
984 nTextXPos = nNumberXPos + nBulletWidth + nTextOffset;
993 if (nTextXPos < nNumberXPos + nBulletWidth)
995 nTextXPos = nNumberXPos + nBulletWidth;
1003 nTextXPos = nNumberXPos + nBulletWidth;
1013 pVDev->DrawRect(aRect1);
1016 pVDev->DrawRect(aRect2);
1017 nYStart += 2 * nLineHeight;
1023 const tools::Long nLineHeight = nFontHeight * 3 / 2;
1024 for (
sal_uInt8 nLevel = 0; nLevel <
MAXLEVEL; ++nLevel, nYStart = nYStart + nYStep)
1027 aNumVector.push_back(rFormat.
GetStart());
1036 nXStart = (nTmpXStart < 0) ? 0 : nTmpXStart;
1044 nTextOffset = nLineHeight + nXStep;
1049 nTextOffset += nXStep;
1055 aNumVector[nLevel] = nPreNum;
1057 pVDev->DrawText(
Point(nXStart, nYStart), aText );
1058 nTextOffset = pVDev->GetTextWidth(aText) + nXStep;
1063 Point(nXStart + nTextOffset, nYStart),
Reference< XExecutableDialog > m_xDialog
const StyleSettings & GetStyleSettings() const
void Draw(OutputDevice &rOutDev, const Point &rDestPt) const
virtual int getOutlineLevel(const tSortedOutlineNodeList::size_type nIdx) const =0
void SetOutlineNames(const OUString *pNames)
const SwNumRule * m_pActNum
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
void SetNumRule(const SwNumRule *pNum)
const OUString * m_pOutlineNames
const vcl::Font & GetFont() const
void SetFont(const vcl::Font &rNewFont)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
SAL_DLLPRIVATE void DrawOutDev(const Point &, const Size &, const Point &, const Size &, const Printer &)=delete
const MapMode & GetMapMode() const
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
const AllSettings & GetSettings() const
const Color & GetFillColor() const
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
void AddTabPage(const OUString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
weld::Button & GetCancelButton() const
virtual void Reset(const SfxItemSet *)
SfxOkDialogController * GetDialogController() const
void SetExchangeSupport()
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const Color & GetWindowColor() const
const Graphic * GetGraphic(OUString const &referer=OUString()) const
void SetNumberingType(SvxNumType nSet)
SvxNumType GetNumberingType() const
void EndAction(const bool bIdleEnd=false)
SwOutlineNodes::size_type GetOutlinePos(sal_uInt8 nLevel=UCHAR_MAX, SwPaM *pPaM=nullptr)
search "outline position" before previous outline node at given level
void SetOutlineNumRule(const SwNumRule &)
SwTextFormatColl & GetTextFormatColl(sal_uInt16 nTextFormatColl) const
sal_uInt16 GetTextFormatCollCount() const
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
const SwNumRule * GetOutlineNumRule() const
SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
bool IsContinusNum() const
const SwNumFormat & Get(sal_uInt16 i) const
const OUString & GetName() const
OUString MakeNumString(const SwNodeNum &, bool bInclStrings=true) const
void ResetNumRule(SwWrtShell &rSh, SwNumRule &) const
const OUString & GetName() const
static constexpr auto npos
virtual void ActivatePage(const SfxItemSet &rSet) override
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
std::unique_ptr< weld::ComboBox > m_xCollBox
std::unique_ptr< SwNumberingTypeListBox > m_xNumberBox
NumberingPreview m_aPreviewWIN
virtual bool FillItemSet(SfxItemSet *rSet) override
virtual ~SwOutlineSettingsTabPage() override
std::unique_ptr< weld::TreeView > m_xLevelLB
std::unique_ptr< weld::Label > m_xAllLevelFT
void SetWrtShell(SwWrtShell *pShell)
std::unique_ptr< weld::SpinButton > m_xAllLevelNF
virtual void Reset(const SfxItemSet *rSet) override
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
std::unique_ptr< weld::Entry > m_xSuffixED
std::unique_ptr< weld::Entry > m_xPrefixED
SwOutlineSettingsTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
OUString m_aSaveCollNames[MAXLEVEL]
std::unique_ptr< weld::SpinButton > m_xStartEdit
std::unique_ptr< weld::ComboBox > m_xCharFormatLB
void CheckForStartValue_Impl(sal_uInt16 nNumberingType)
virtual short Ok() override
OUString m_aCollNames[MAXLEVEL]
std::unique_ptr< weld::MenuButton > m_xMenuButton
std::unique_ptr< SwNumRule > m_xNumRule
SwOutlineTabDialog(weld::Window *pParent, const SfxItemSet *pSwItemSet, SwWrtShell &)
static sal_uInt16 s_nNumLevel
virtual void PageCreated(const OUString &rPageId, SfxTabPage &rPage) override
static void SetActNumLevel(sal_uInt16 nSet)
virtual ~SwOutlineTabDialog() override
sal_uInt16 GetLevel(std::u16string_view rFormatName) const
static sal_uInt16 GetActNumLevel()
static const OUString & GetUIName(const OUString &rName, SwGetPoolIdFromName)
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
Represents the style of a paragraph.
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
bool IsAssignedToListLevelOfOutlineStyle() const
void DeleteAssignmentToListLevelOfOutlineStyle()
virtual bool SetFormatAttr(const SfxPoolItem &rAttr) override
Override to recognize changes on the <SwNumRuleItem> and register/unregister the paragragh style at t...
void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
int GetAssignedOutlineStyleLevel() const
const Color & GetDocBoundariesColor() const
const Color & GetFontColor() const
static const SwViewOption & GetCurrentViewOptions()
const Color & GetDocColor() const
static ShellResource * GetShellRes()
const IDocumentOutlineNodes * getIDocumentOutlineNodesAccess() const
SwDocShell * GetDocShell()
Used by the UI to modify the document model.
SwTextFormatColl * GetParaStyle(const OUString &rCollName, GetStyle eCreate=GETSTYLE_NOCREATE)
const SwView & GetView() const
reference_type * get() const
static OUString getProductName()
void SetFontSize(const Size &)
void SetTransparent(bool bTransparent)
void SetColor(const Color &)
const Size & GetFontSize() const
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
virtual OUString GetName() const override
virtual const SfxItemSet * GetOutputItemSet() const override
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
LanguageType GetAppLanguage()
#define LINK(Instance, Class, Member)
sal_Int32 nFirstLineOffset
std::vector< tSwNumTreeNumber > tNumberVector
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
IMPL_LINK_NOARG(SwNumNamesDlg, DoubleClickHdl, weld::TreeView &, bool)
static sal_uInt16 lcl_BitToLevel(sal_uInt16 nActLevel)
static tools::Long lcl_DrawBullet(vcl::RenderContext *pVDev, const SwNumFormat &rFormat, tools::Long nXStart, tools::Long nYStart, const Size &rSize)
static tools::Long lcl_DrawGraphic(vcl::RenderContext &rVDev, const SwNumFormat &rFormat, tools::Long nXStart, tools::Long nYStart, tools::Long nDivision)
IMPL_LINK(SwNumNamesDlg, SelectHdl, weld::TreeView &, rBox, void)
@ RES_POOLCOLL_HEADLINE1
Heading 1.
SVX_NUM_CHARS_LOWER_LETTER_N
SVX_NUM_CHARS_UPPER_LETTER_N
OUString SwResId(TranslateId aId)
constexpr sal_uInt8 MAXLEVEL