diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-11-23 23:00:55 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2017-11-24 08:00:17 +0100 |
commit | 66076a431e5db967eeeb3ba8004a06a1e54d9fac (patch) | |
tree | ce98f206c0a82d53bd8c4ced716e964257bed7b5 /svx/source | |
parent | a1c0e999b271ac4c6ecb163a1cd2a310b87e9dec (diff) |
TSCP: Advanced dialog UI improvements
- Change the height of TextEdit to ~5 lines (100px)
- IPPart: single to double-click to add
- IPPartNumber: change to ListBox, same behavior as IPPart
- Markings: add on focus change
- Category: remove messagebox when the category changed
Change-Id: I9e695abc7caa702b2150a96ae15e6ce19fc2458a
Reviewed-on: https://gerrit.libreoffice.org/45149
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/dialog/ClassificationDialog.cxx | 51 | ||||
-rw-r--r-- | svx/source/dialog/ClassificationEditView.cxx | 9 |
2 files changed, 33 insertions, 27 deletions
diff --git a/svx/source/dialog/ClassificationDialog.cxx b/svx/source/dialog/ClassificationDialog.cxx index 6ff28786ea50..a7b1469100f5 100644 --- a/svx/source/dialog/ClassificationDialog.cxx +++ b/svx/source/dialog/ClassificationDialog.cxx @@ -170,6 +170,7 @@ ClassificationDialog::ClassificationDialog(vcl::Window* pParent, const bool bPer , m_bPerParagraph(bPerParagraph) , m_aParagraphSignHandler(rParagraphSignHandler) , m_nCurrentSelectedCategory(-1) + , m_nInsertMarkings(-1) { get(m_pOkButton, "ok"); get(m_pEditWindow, "classificationEditWindow"); @@ -180,11 +181,10 @@ ClassificationDialog::ClassificationDialog(vcl::Window* pParent, const bool bPer get(m_pInternationalClassificationListBox, "internationalClassificationCB"); get(m_pMarkingLabel, "markingLabel"); get(m_pMarkingListBox, "markingCB"); - get(m_pIntellectualPropertyPartNumberListBox, "intellectualPropertyPartNumberCB"); + get(m_pIntellectualPropertyPartNumberListBox, "intellectualPropertyPartNumberLB"); get(m_pIntellectualPropertyPartListBox, "intellectualPropertyPartLB"); get(m_pIntellectualPropertyPartAddButton, "intellectualPropertyPartAddButton"); get(m_pIntellectualPropertyPartEdit, "intellectualPropertyPartEntry"); - get(m_pIntellectualPropertyExpander, "intellectualPropertyExpander"); m_pSignButton->SetClickHdl(LINK(this, ClassificationDialog, ButtonClicked)); @@ -197,19 +197,18 @@ ClassificationDialog::ClassificationDialog(vcl::Window* pParent, const bool bPer m_pClassificationListBox->SetSelectHdl(LINK(this, ClassificationDialog, SelectClassificationHdl)); for (const OUString& rName : maHelper.GetBACNames()) m_pClassificationListBox->InsertEntry(rName); - m_pClassificationListBox->EnableAutoSize(true); m_pInternationalClassificationListBox->SetSelectHdl(LINK(this, ClassificationDialog, SelectClassificationHdl)); for (const OUString& rName : maInternationalHelper.GetBACNames()) m_pInternationalClassificationListBox->InsertEntry(rName); - m_pInternationalClassificationListBox->EnableAutoSize(true); if (!maHelper.GetMarkings().empty()) { m_pMarkingListBox->SetSelectHdl(LINK(this, ClassificationDialog, SelectMarkingHdl)); + m_pMarkingListBox->SetLoseFocusHdl(LINK(this, ClassificationDialog, LoseFocusMarkingHdl)); + for (const OUString& rName : maHelper.GetMarkings()) m_pMarkingListBox->InsertEntry(rName); - m_pMarkingListBox->EnableAutoSize(true); } else { @@ -217,15 +216,13 @@ ClassificationDialog::ClassificationDialog(vcl::Window* pParent, const bool bPer m_pMarkingLabel->Show(false); } - m_pIntellectualPropertyPartNumberListBox->SetSelectHdl(LINK(this, ClassificationDialog, SelectIPPartNumbersHdl)); + m_pIntellectualPropertyPartNumberListBox->SetDoubleClickHdl(LINK(this, ClassificationDialog, SelectIPPartNumbersHdl)); for (const OUString& rName : maHelper.GetIntellectualPropertyPartNumbers()) m_pIntellectualPropertyPartNumberListBox->InsertEntry(rName); - m_pIntellectualPropertyPartNumberListBox->EnableAutoSize(true); - m_pIntellectualPropertyPartListBox->SetSelectHdl(LINK(this, ClassificationDialog, SelectIPPartHdl)); + m_pIntellectualPropertyPartListBox->SetDoubleClickHdl(LINK(this, ClassificationDialog, SelectIPPartHdl)); for (const OUString& rName : maHelper.GetIntellectualPropertyParts()) m_pIntellectualPropertyPartListBox->InsertEntry(rName); - m_pIntellectualPropertyPartListBox->EnableAutoSize(true); m_pRecentlyUsedListBox->SetSelectHdl(LINK(this, ClassificationDialog, SelectRecentlyUsedHdl)); @@ -291,6 +288,14 @@ short ClassificationDialog::Execute() return nResult; } +void ClassificationDialog::insertCategoryField(sal_Int32 nID) +{ + const OUString aFullString = maHelper.GetBACNames()[nID]; + const OUString aAbbreviatedString = maHelper.GetAbbreviatedBACNames()[nID]; + const OUString aIdentifierString = maHelper.GetBACIdentifiers()[nID]; + insertField(ClassificationType::CATEGORY, aAbbreviatedString, aFullString, aIdentifierString); +} + void ClassificationDialog::insertField(ClassificationType eType, OUString const & rString, OUString const & rFullString, OUString const & rIdentifier) { ClassificationField aField(eType, rString, rFullString, rIdentifier); @@ -598,22 +603,9 @@ IMPL_LINK(ClassificationDialog, SelectClassificationHdl, ListBox&, rBox, void) } if (bReplaceExisting) - { - ScopedVclPtrInstance<QueryBox> aQueryBox(this, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, SvxResId(RID_CLASSIFICATION_CHANGE_CATEGORY)); - if (aQueryBox->Execute() == RET_NO) - { - // Revert to previosuly selected - m_pInternationalClassificationListBox->SelectEntryPos(m_nCurrentSelectedCategory); - m_pClassificationListBox->SelectEntryPos(m_nCurrentSelectedCategory); - return; - } m_pEditWindow->pEdView->SetSelection(aExistingFieldSelection); - } - const OUString aFullString = maHelper.GetBACNames()[nSelected]; - const OUString aAbbreviatedString = maHelper.GetAbbreviatedBACNames()[nSelected]; - const OUString aIdentifierString = maHelper.GetBACIdentifiers()[nSelected]; - insertField(ClassificationType::CATEGORY, aAbbreviatedString, aFullString, aIdentifierString); + insertCategoryField(nSelected); // Change category to the new selection m_pInternationalClassificationListBox->SelectEntryPos(nSelected); @@ -621,13 +613,22 @@ IMPL_LINK(ClassificationDialog, SelectClassificationHdl, ListBox&, rBox, void) m_nCurrentSelectedCategory = nSelected; } +IMPL_LINK_NOARG(ClassificationDialog, LoseFocusMarkingHdl, Control&, void) +{ + if (m_nInsertMarkings >= 0) + { + const OUString aString = maHelper.GetMarkings()[m_nInsertMarkings]; + insertField(ClassificationType::MARKING, aString, aString); + m_nInsertMarkings = -1; + } +} + IMPL_LINK(ClassificationDialog, SelectMarkingHdl, ListBox&, rBox, void) { sal_Int32 nSelected = rBox.GetSelectedEntryPos(); if (nSelected >= 0) { - const OUString aString = maHelper.GetMarkings()[nSelected]; - insertField(ClassificationType::MARKING, aString, aString); + m_nInsertMarkings = nSelected; } } diff --git a/svx/source/dialog/ClassificationEditView.cxx b/svx/source/dialog/ClassificationEditView.cxx index a992dc0aedf2..76b778303bc2 100644 --- a/svx/source/dialog/ClassificationEditView.cxx +++ b/svx/source/dialog/ClassificationEditView.cxx @@ -48,11 +48,16 @@ ClassificationEditView::ClassificationEditView(vcl::Window* pParent, WinBits nBi const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); Color aBgColor = rStyleSettings.GetWindowColor(); + float fScaleFactor = GetDPIScaleFactor(); + set_width_request(600 * fScaleFactor); + set_height_request(100 * fScaleFactor); + SetMapMode(MapMode(MapUnit::MapTwip)); SetPointer(PointerStyle::Text); SetBackground(aBgColor); - Size aSize(GetOutputSize()); + Size aOutputSize(GetOutputSize()); + Size aSize(aOutputSize); aSize.Height() *= 4; pEdEngine.reset(new ClassificationEditEngine(EditEngine::CreatePool())); @@ -62,7 +67,7 @@ ClassificationEditView::ClassificationEditView(vcl::Window* pParent, WinBits nBi pEdEngine->SetControlWord(pEdEngine->GetControlWord() | EEControlBits::MARKFIELDS); pEdView.reset(new EditView(pEdEngine.get(), this)); - pEdView->SetOutputArea(tools::Rectangle(Point(0,0), GetOutputSize())); + pEdView->SetOutputArea(tools::Rectangle(Point(0,0), aOutputSize)); pEdView->SetBackgroundColor(aBgColor); pEdEngine->InsertView(pEdView.get()); |