include/svx/ClassificationDialog.hxx | 3 + include/svx/strings.hrc | 3 - svx/source/dialog/ClassificationDialog.cxx | 51 ++++++++++----------- svx/source/dialog/ClassificationEditView.cxx | 9 ++- svx/uiconfig/ui/classificationdialog.ui | 65 +++++++++++++++++++-------- 5 files changed, 82 insertions(+), 49 deletions(-)
New commits: commit 66076a431e5db967eeeb3ba8004a06a1e54d9fac Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Nov 23 23:00:55 2017 +0900 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 <c...@libreoffice.org> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/svx/ClassificationDialog.hxx b/include/svx/ClassificationDialog.hxx index d98f516d2015..a9ec24c99d45 100644 --- a/include/svx/ClassificationDialog.hxx +++ b/include/svx/ClassificationDialog.hxx @@ -60,11 +60,13 @@ private: const std::function<void()> m_aParagraphSignHandler; sal_Int32 m_nCurrentSelectedCategory; + sal_Int16 m_nInsertMarkings; DECL_LINK(ButtonClicked, Button*, void); DECL_LINK(SelectToolboxHdl, ToolBox*, void); DECL_LINK(SelectClassificationHdl, ListBox&, void); DECL_LINK(SelectMarkingHdl, ListBox&, void); + DECL_LINK(LoseFocusMarkingHdl, Control&, void); DECL_LINK(SelectIPPartNumbersHdl, ListBox&, void); DECL_LINK(SelectRecentlyUsedHdl, ListBox&, void); DECL_LINK(SelectIPPartHdl, ListBox&, void); @@ -72,6 +74,7 @@ private: DECL_LINK(ExpandedHdl, VclExpander&, void); void insertField(ClassificationType eType, OUString const & rString, OUString const & rFullString, OUString const & rIdentifier = OUString()); + void insertCategoryField(sal_Int32 nID); std::vector<std::vector<ClassificationResult>> m_aRecentlyUsedValuesCollection; std::vector<ClassificationResult> m_aInitialValues; diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc index e4859d9ecd72..048cdc6c681e 100644 --- a/include/svx/strings.hrc +++ b/include/svx/strings.hrc @@ -1653,9 +1653,6 @@ #define RID_SUBSETSTR_SYRIAC_SUPPLEMENT NC_("RID_SUBSETMAP", "Syriac Supplement") #define RID_SUBSETSTR_ZANABAZAR_SQUARE NC_("RID_SUBSETMAP", "Zanabazar Square") -// TSCP Classification -#define RID_CLASSIFICATION_CHANGE_CATEGORY NC_("RID_CLASSIFICATION_CHANGE_CATEGORY", "Do you really want to change the classification category?") - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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>
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits