diff options
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/inc/numberingtypelistbox.hxx | 18 | ||||
-rw-r--r-- | sw/source/uibase/inc/regionsw.hxx | 52 | ||||
-rw-r--r-- | sw/source/uibase/misc/numberingtypelistbox.cxx | 145 |
3 files changed, 24 insertions, 191 deletions
diff --git a/sw/source/uibase/inc/numberingtypelistbox.hxx b/sw/source/uibase/inc/numberingtypelistbox.hxx index b6c83f14e5c1..fc4c48890805 100644 --- a/sw/source/uibase/inc/numberingtypelistbox.hxx +++ b/sw/source/uibase/inc/numberingtypelistbox.hxx @@ -41,23 +41,6 @@ namespace o3tl { struct SwNumberingTypeListBox_Impl; -class SW_DLLPUBLIC SwNumberingTypeListBox : public ListBox -{ - std::unique_ptr<SwNumberingTypeListBox_Impl> pImpl; - -public: - SwNumberingTypeListBox( vcl::Window* pWin, WinBits nStyle ); - virtual ~SwNumberingTypeListBox() override; - virtual void dispose() override; - - virtual bool set_property(const OString &rKey, const OUString &rValue) override; - - void Reload(SwInsertNumTypes nTypeFlags); - - SvxNumType GetSelectedNumberingType(); - bool SelectNumberingType(SvxNumType nType); -}; - class SW_DLLPUBLIC NumberingTypeListBox { std::unique_ptr<weld::ComboBoxText> m_xWidget; @@ -73,6 +56,7 @@ public: SvxNumType GetSelectedNumberingType(); bool SelectNumberingType(SvxNumType nType); void SetNoSelection() { m_xWidget->set_active(-1); } + void Enable(bool bEnable) { m_xWidget->set_sensitive(bEnable); } }; #endif diff --git a/sw/source/uibase/inc/regionsw.hxx b/sw/source/uibase/inc/regionsw.hxx index 83480447d891..df0642a2e140 100644 --- a/sw/source/uibase/inc/regionsw.hxx +++ b/sw/source/uibase/inc/regionsw.hxx @@ -191,39 +191,33 @@ public: class SwSectionFootnoteEndTabPage : public SfxTabPage { - VclPtr<CheckBox> m_pFootnoteNtAtTextEndCB; - - VclPtr<CheckBox> m_pFootnoteNtNumCB; - VclPtr<FixedText> m_pFootnoteOffsetLbl; - VclPtr<NumericField> m_pFootnoteOffsetField; - - VclPtr<CheckBox> m_pFootnoteNtNumFormatCB; - VclPtr<FixedText> m_pFootnotePrefixFT; - VclPtr<Edit> m_pFootnotePrefixED; - VclPtr<SwNumberingTypeListBox> m_pFootnoteNumViewBox; - VclPtr<FixedText> m_pFootnoteSuffixFT; - VclPtr<Edit> m_pFootnoteSuffixED; - - VclPtr<CheckBox> m_pEndNtAtTextEndCB; - - VclPtr<CheckBox> m_pEndNtNumCB; - VclPtr<FixedText> m_pEndOffsetLbl; - VclPtr<NumericField> m_pEndOffsetField; - - VclPtr<CheckBox> m_pEndNtNumFormatCB; - VclPtr<FixedText> m_pEndPrefixFT; - VclPtr<Edit> m_pEndPrefixED; - VclPtr<SwNumberingTypeListBox> m_pEndNumViewBox; - VclPtr<FixedText> m_pEndSuffixFT; - VclPtr<Edit> m_pEndSuffixED; - - DECL_LINK( FootEndHdl, Button*, void ); + std::unique_ptr<weld::CheckButton> m_xFootnoteNtAtTextEndCB; + std::unique_ptr<weld::CheckButton> m_xFootnoteNtNumCB; + std::unique_ptr<weld::Label> m_xFootnoteOffsetLbl; + std::unique_ptr<weld::SpinButton> m_xFootnoteOffsetField; + std::unique_ptr<weld::CheckButton> m_xFootnoteNtNumFormatCB; + std::unique_ptr<weld::Label> m_xFootnotePrefixFT; + std::unique_ptr<weld::Entry> m_xFootnotePrefixED; + std::unique_ptr<NumberingTypeListBox> m_xFootnoteNumViewBox; + std::unique_ptr<weld::Label> m_xFootnoteSuffixFT; + std::unique_ptr<weld::Entry> m_xFootnoteSuffixED; + std::unique_ptr<weld::CheckButton> m_xEndNtAtTextEndCB; + std::unique_ptr<weld::CheckButton> m_xEndNtNumCB; + std::unique_ptr<weld::Label> m_xEndOffsetLbl; + std::unique_ptr<weld::SpinButton> m_xEndOffsetField; + std::unique_ptr<weld::CheckButton> m_xEndNtNumFormatCB; + std::unique_ptr<weld::Label> m_xEndPrefixFT; + std::unique_ptr<weld::Entry> m_xEndPrefixED; + std::unique_ptr<NumberingTypeListBox> m_xEndNumViewBox; + std::unique_ptr<weld::Label> m_xEndSuffixFT; + std::unique_ptr<weld::Entry> m_xEndSuffixED; + + DECL_LINK(FootEndHdl, weld::ToggleButton&, void); void ResetState( bool bFootnote, const SwFormatFootnoteEndAtTextEnd& ); public: - SwSectionFootnoteEndTabPage( vcl::Window *pParent, const SfxItemSet &rAttrSet ); + SwSectionFootnoteEndTabPage(TabPageParent pParent, const SfxItemSet &rAttrSet); virtual ~SwSectionFootnoteEndTabPage() override; - virtual void dispose() override; virtual bool FillItemSet( SfxItemSet* ) override; virtual void Reset( const SfxItemSet* ) override; diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx index c4bc802155ca..ad3b37db48f7 100644 --- a/sw/source/uibase/misc/numberingtypelistbox.cxx +++ b/sw/source/uibase/misc/numberingtypelistbox.cxx @@ -38,151 +38,6 @@ struct SwNumberingTypeListBox_Impl uno::Reference<text::XNumberingTypeInfo> xInfo; }; -SwNumberingTypeListBox::SwNumberingTypeListBox( vcl::Window* pWin, WinBits nStyle ) : - ListBox(pWin, nStyle), - pImpl(new SwNumberingTypeListBox_Impl) -{ - uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); - uno::Reference<text::XDefaultNumberingProvider> xDefNum = text::DefaultNumberingProvider::create(xContext); - - pImpl->xInfo.set(xDefNum, uno::UNO_QUERY); -} - -bool SwNumberingTypeListBox::set_property(const OString &rKey, const OUString &rValue) -{ - if (rKey == "type") - Reload(static_cast<SwInsertNumTypes>(rValue.toInt32())); - else - return ListBox::set_property(rKey, rValue); - return true; -} - -extern "C" SAL_DLLPUBLIC_EXPORT void makeSwNumberingTypeListBox(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap &) -{ - VclPtrInstance<SwNumberingTypeListBox> pListBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK|WB_TABSTOP); - pListBox->EnableAutoSize(true); - rRet = pListBox; -} - -SwNumberingTypeListBox::~SwNumberingTypeListBox() -{ - disposeOnce(); -} - -void SwNumberingTypeListBox::dispose() -{ - pImpl.reset(); - ListBox::dispose(); -} - -void SwNumberingTypeListBox::Reload(SwInsertNumTypes nTypeFlags) -{ - Clear(); - uno::Sequence<sal_Int16> aTypes; - const sal_Int16* pTypes = nullptr; - if(nTypeFlags & SwInsertNumTypes::Extended) - { - if(pImpl->xInfo.is()) - { - aTypes = pImpl->xInfo->getSupportedNumberingTypes(); - pTypes = aTypes.getConstArray(); - } - } - - for(size_t i = 0; i < SvxNumberingTypeTable::Count(); i++) - { - sal_IntPtr nValue = SvxNumberingTypeTable::GetValue(i); - bool bInsert = true; - sal_Int32 nPos = LISTBOX_APPEND; - switch(nValue) - { - case style::NumberingType::NUMBER_NONE: - bInsert = bool(nTypeFlags & SwInsertNumTypes::NoNumbering); - nPos = 0; - - break; - case style::NumberingType::CHAR_SPECIAL: - bInsert = bool(nTypeFlags & SwInsertNumTypes::Bullet); - - break; - case style::NumberingType::PAGE_DESCRIPTOR: - bInsert = bool(nTypeFlags & SwInsertNumTypes::PageStyleNumbering); - - break; - case style::NumberingType::BITMAP: - bInsert = bool(nTypeFlags & SwInsertNumTypes::Bitmap ); - - break; - case style::NumberingType::BITMAP | LINK_TOKEN: - bInsert = false; - - break; - default: - if (nValue > style::NumberingType::CHARS_LOWER_LETTER_N) - { - // Insert only if offered by i18n framework per configuration. - bInsert = false; - if (pTypes) - { - for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++) - { - if (pTypes[nType] == nValue) - { - bInsert = true; - break; // for - } - } - } - } - } - if(bInsert) - { - sal_Int32 nEntry = InsertEntry(SvxNumberingTypeTable::GetString(i), nPos); - SetEntryData( nEntry, reinterpret_cast<void*>(nValue) ); - } - } - if(nTypeFlags & SwInsertNumTypes::Extended) - { - if(pTypes) - { - for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++) - { - sal_Int16 nCurrent = pTypes[nType]; - if(nCurrent > style::NumberingType::CHARS_LOWER_LETTER_N) - { - if(LISTBOX_ENTRY_NOTFOUND == GetEntryPos(reinterpret_cast<void*>(static_cast<sal_uLong>(nCurrent)))) - { - OUString aIdent = pImpl->xInfo->getNumberingIdentifier( nCurrent ); - sal_Int32 nPos = InsertEntry(aIdent); - SetEntryData(nPos, reinterpret_cast<void*>(static_cast<sal_uLong>(nCurrent))); - } - } - } - } - SelectEntryPos(0); - } -} - -SvxNumType SwNumberingTypeListBox::GetSelectedNumberingType() -{ - SvxNumType nRet = SVX_NUM_CHARS_UPPER_LETTER; - sal_Int32 nSelPos = GetSelectedEntryPos(); - if(LISTBOX_ENTRY_NOTFOUND != nSelPos) - nRet = static_cast<SvxNumType>(reinterpret_cast<sal_uLong>(GetEntryData(nSelPos))); -#if OSL_DEBUG_LEVEL > 0 - else - OSL_FAIL("SwNumberingTypeListBox not selected"); -#endif - return nRet; -} - -bool SwNumberingTypeListBox::SelectNumberingType(SvxNumType nType) -{ - sal_Int32 nPos = GetEntryPos(reinterpret_cast<void*>(static_cast<sal_uLong>(nType))); - SelectEntryPos( nPos ); - return LISTBOX_ENTRY_NOTFOUND != nPos; -} - NumberingTypeListBox::NumberingTypeListBox(weld::ComboBoxText* pWidget) : m_xWidget(pWidget) , m_xImpl(new SwNumberingTypeListBox_Impl) |