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 | |
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')
-rw-r--r-- | svx/source/dialog/ClassificationDialog.cxx | 51 | ||||
-rw-r--r-- | svx/source/dialog/ClassificationEditView.cxx | 9 | ||||
-rw-r--r-- | svx/uiconfig/ui/classificationdialog.ui | 65 |
3 files changed, 79 insertions, 46 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()); diff --git a/svx/uiconfig/ui/classificationdialog.ui b/svx/uiconfig/ui/classificationdialog.ui index a4469611c80c..911363016f25 100644 --- a/svx/uiconfig/ui/classificationdialog.ui +++ b/svx/uiconfig/ui/classificationdialog.ui @@ -78,12 +78,9 @@ <property name="column_spacing">12</property> <child> <object class="svxlo-ClassificationEditView" id="classificationEditWindow"> - <property name="width_request">400</property> - <property name="height_request">250</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="vexpand">True</property> </object> <packing> <property name="left_attach">0</property> @@ -125,7 +122,7 @@ <object class="GtkLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes" context="classificationdialog|label-InternationalClassification">International Classification:</property> + <property name="label" translatable="yes" context="classificationdialog|label-InternationalClassification">International:</property> <property name="xalign">0</property> </object> <packing> @@ -271,7 +268,7 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="height">2</property> + <property name="height">3</property> </packing> </child> <child> @@ -285,17 +282,6 @@ <property name="row_spacing">6</property> <property name="column_spacing">6</property> <child> - <object class="GtkComboBoxText" id="intellectualPropertyPartNumberCB"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="active">0</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> <object class="GtkLabel"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -330,8 +316,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="height">2</property> + <property name="top_attach">1</property> </packing> </child> <child> @@ -343,6 +328,33 @@ </object> <packing> <property name="left_attach">2</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="classificationdialog|label-PartNumber">Part:</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkTreeView" id="intellectualPropertyPartNumberLB"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection"/> + </child> + </object> + <packing> + <property name="left_attach">1</property> <property name="top_attach">1</property> </packing> </child> @@ -364,10 +376,25 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="top_attach">3</property> <property name="width">2</property> </packing> </child> + <child> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> </object> <packing> <property name="expand">True</property> |