diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-15 14:03:31 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-06-17 20:23:08 +0200 |
commit | 73b1aeca87d050634bae9194632601561dedec06 (patch) | |
tree | 4f3625bbcac39349e4acae2ea7cee7e8ac165f05 /svx | |
parent | 09205edb4f33d7149d82f192d11f7d405be3d202 (diff) |
weld SvxPageDescPage
Change-Id: I5e2457b51a294cbdacc5c78db4ec0a048567b93d
Reviewed-on: https://gerrit.libreoffice.org/55952
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/SvxNumOptionsTabPageHelper.cxx | 52 | ||||
-rw-r--r-- | svx/source/dialog/pagectrl.cxx | 2 | ||||
-rw-r--r-- | svx/source/dialog/pagenumberlistbox.cxx | 44 | ||||
-rw-r--r-- | svx/source/dialog/papersizelistbox.cxx | 50 |
4 files changed, 146 insertions, 2 deletions
diff --git a/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx b/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx index e8ffdc79d443..8d5ef1950153 100644 --- a/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx +++ b/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx @@ -89,4 +89,56 @@ void SvxNumOptionsTabPageHelper::GetI18nNumbering( ListBox& rFmtLB, sal_uInt16 n } } +void SvxNumOptionsTabPageHelper::GetI18nNumbering(weld::ComboBoxText& rFmtLB, sal_uInt16 nDoNotRemove) +{ + Reference<XDefaultNumberingProvider> xDefNum = GetNumberingProvider(); + Reference<XNumberingTypeInfo> xInfo(xDefNum, UNO_QUERY); + + // Extended numbering schemes present in the resource but not offered by + // the i18n framework per configuration must be removed from the listbox. + // Do not remove a special entry matching nDoNotRemove. + const sal_uInt16 nDontRemove = SAL_MAX_UINT16; + ::std::vector< sal_uInt16> aRemove( rFmtLB.get_count(), nDontRemove); + for (size_t i=0; i<aRemove.size(); ++i) + { + sal_uInt16 nEntryData = rFmtLB.get_id(i).toInt32(); + if (nEntryData > NumberingType::CHARS_LOWER_LETTER_N && nEntryData != nDoNotRemove) + aRemove[i] = nEntryData; + } + if(xInfo.is()) + { + Sequence<sal_Int16> aTypes = xInfo->getSupportedNumberingTypes( ); + const sal_Int16* pTypes = aTypes.getConstArray(); + for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++) + { + sal_Int16 nCurrent = pTypes[nType]; + if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N) + { + bool bInsert = true; + for (int nEntry = 0; nEntry < rFmtLB.get_count(); ++nEntry) + { + sal_uInt16 nEntryData = rFmtLB.get_id(nEntry).toInt32(); + if (nEntryData == static_cast<sal_uInt16>(nCurrent)) + { + bInsert = false; + aRemove[nEntry] = nDontRemove; + break; + } + } + if(bInsert) + { + OUString aIdent = xInfo->getNumberingIdentifier( nCurrent ); + rFmtLB.append(OUString::number(nCurrent), aIdent); + } + } + } + } + for (unsigned short i : aRemove) + { + if (i == nDontRemove) + continue; + rFmtLB.remove_id(OUString::number(i)); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx index 7c3d4a7e54f4..d3fc8044231f 100644 --- a/svx/source/dialog/pagectrl.cxx +++ b/svx/source/dialog/pagectrl.cxx @@ -86,8 +86,6 @@ SvxPageWindow::~SvxPageWindow() disposeOnce(); } -VCL_BUILDER_FACTORY(SvxPageWindow) - void SvxPageWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { Fraction aXScale(aWinSize.Width(), std::max(long(aSize.Width() * 2 + aSize.Width() / 8), 1L)); diff --git a/svx/source/dialog/pagenumberlistbox.cxx b/svx/source/dialog/pagenumberlistbox.cxx index ade3baa6d0e0..904d28b16d04 100644 --- a/svx/source/dialog/pagenumberlistbox.cxx +++ b/svx/source/dialog/pagenumberlistbox.cxx @@ -74,4 +74,48 @@ Size PageNumberListBox::GetOptimalSize() const return Size(150, ListBox::GetOptimalSize().Height()); } +SvxPageNumberListBox::SvxPageNumberListBox(weld::ComboBoxText* pControl) + : m_xControl(pControl) +{ + m_xControl->set_size_request(150, -1); + + for (size_t i = 0; i < SAL_N_ELEMENTS(RID_SVXSTRARY_NUMBERINGTYPE); ++i) + { + sal_uInt16 nData = RID_SVXSTRARY_NUMBERINGTYPE[i].second; + switch (nData) + { + // String list array is also used in Writer and contains strings + // for Bullet and Graphics, ignore those here. + case css::style::NumberingType::CHAR_SPECIAL: + case css::style::NumberingType::BITMAP: + case css::style::NumberingType::BITMAP | LINK_TOKEN: + break; + default: + { + OUString aStr = SvxResId(RID_SVXSTRARY_NUMBERINGTYPE[i].first); + m_xControl->append(OUString::number(nData), aStr); + break; + } + } + } +} + +void SvxPageNumberListBox::SetSelection( sal_uInt16 nPos ) +{ + int nEntryCount = m_xControl->get_count(); + int nSelPos = -1; + + for (sal_Int32 i = 0; i < nEntryCount; ++i) + { + sal_uInt16 nTmp = static_cast<sal_uInt16>(m_xControl->get_id(i).toInt32()); + + if (nTmp == nPos) + { + nSelPos = i; + break; + } + } + m_xControl->set_active(nSelPos); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/papersizelistbox.cxx b/svx/source/dialog/papersizelistbox.cxx index 54e0743c3424..8f9807f663c5 100644 --- a/svx/source/dialog/papersizelistbox.cxx +++ b/svx/source/dialog/papersizelistbox.cxx @@ -83,5 +83,55 @@ Size PaperSizeListBox::GetOptimalSize() const { return Size(150, ListBox::GetOptimalSize().Height()); } + +SvxPaperSizeListBox::SvxPaperSizeListBox(weld::ComboBoxText* pControl) + : m_xControl(pControl) +{ + m_xControl->set_size_request(150, -1); +} + +void SvxPaperSizeListBox::FillPaperSizeEntries( PaperSizeApp eApp ) +{ + const std::pair<const char*, int>* pPaperAry = eApp == PaperSizeApp::Std ? + RID_SVXSTRARY_PAPERSIZE_STD : RID_SVXSTRARY_PAPERSIZE_DRAW; + sal_uInt32 nCnt = eApp == PaperSizeApp::Std ? + SAL_N_ELEMENTS(RID_SVXSTRARY_PAPERSIZE_STD) : SAL_N_ELEMENTS(RID_SVXSTRARY_PAPERSIZE_DRAW); + + for ( sal_uInt32 i = 0; i < nCnt; ++i ) + { + OUString aStr = SvxResId(pPaperAry[i].first); + Paper eSize = static_cast<Paper>(pPaperAry[i].second); + m_xControl->append(OUString::number(static_cast<sal_Int32>(eSize)), aStr); + } +} + +void SvxPaperSizeListBox::SetSelection( Paper ePreselectPaper ) +{ + int nEntryCount = m_xControl->get_count(); + int nSelPos = -1; + int nUserPos = -1; + + for (int i = 0; i < nEntryCount; ++i) + { + Paper eTmp = static_cast<Paper>(m_xControl->get_id(i).toInt32()); + if (eTmp == ePreselectPaper) + { + nSelPos = i; + break; + } + + if (eTmp == PAPER_USER) + nUserPos = i; + } + + // preselect current paper format - #115915#: ePaper might not be in aPaperSizeBox so use PAPER_USER instead + m_xControl->set_active((nSelPos != -1) ? nSelPos : nUserPos); +} + +Paper SvxPaperSizeListBox::GetSelection() const +{ + return static_cast<Paper>(m_xControl->get_active_id().toInt32()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |