diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-02-17 15:42:28 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-02-19 10:08:42 +0100 |
commit | ce5cf53a661a4083c1f2eb1c341c32e7e3cdde8a (patch) | |
tree | 449244ab7ff8223f5c5b8c31b6d867fa0bd2536d | |
parent | f73289763452f2f32993d5defb79ce69ba8f5188 (diff) |
weld BibGeneralPage
go the route of all-welded to replace this mix of vcl and awt
widgets
Change-Id: I242b801dc1d9993fc478bb7253480f5b6c3c0ad1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111088
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | extensions/source/bibliography/bibview.cxx | 40 | ||||
-rw-r--r-- | extensions/source/bibliography/bibview.hxx | 4 | ||||
-rw-r--r-- | extensions/source/bibliography/general.cxx | 1036 | ||||
-rw-r--r-- | extensions/source/bibliography/general.hxx | 229 | ||||
-rw-r--r-- | extensions/uiconfig/sbibliography/ui/generalpage.ui | 694 | ||||
-rw-r--r-- | solenv/sanitizers/ui/modules/sbibliography.suppr | 31 |
6 files changed, 1088 insertions, 946 deletions
diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx index e4eca459631e..09925e6c4ca4 100644 --- a/extensions/source/bibliography/bibview.cxx +++ b/extensions/source/bibliography/bibview.cxx @@ -79,38 +79,11 @@ namespace bib { VclPtr<BibGeneralPage> pGeneralPage = m_pGeneralPage; m_pGeneralPage.clear(); - - pGeneralPage->CommitActiveControl(); - Reference< XForm > xForm = m_pDatMan->getForm(); - Reference< XPropertySet > xProps( xForm, UNO_QUERY ); - Reference< sdbc::XResultSetUpdate > xResUpd( xProps, UNO_QUERY ); - DBG_ASSERT( xResUpd.is(), "BibView::~BibView: invalid form!" ); - - if ( xResUpd.is() ) - { - Any aModified = xProps->getPropertyValue( "IsModified" ); - bool bFlag = false; - if ( ( aModified >>= bFlag ) && bFlag ) - { - - try - { - Any aNew = xProps->getPropertyValue( "IsNew" ); - aNew >>= bFlag; - if ( bFlag ) - xResUpd->insertRow(); - else - xResUpd->updateRow(); - } - catch( const uno::Exception&) {} - } - } + pGeneralPage.disposeAndClear(); // dispose will commit any uncommitted weld::Entry changes if ( m_aFormControlContainer.isFormConnected() ) m_aFormControlContainer.disconnectForm(); - pGeneralPage->RemoveListeners(); - pGeneralPage.disposeAndClear(); BibWindow::dispose(); } @@ -122,7 +95,6 @@ namespace bib if ( m_pGeneralPage ) { m_pGeneralPage->Hide(); - m_pGeneralPage->RemoveListeners(); m_pGeneralPage.disposeAndClear(); } @@ -198,15 +170,7 @@ namespace bib Reference< awt::XControlContainer > BibViewFormControlContainer::getControlContainer() { - return mpBibView->getControlContainer(); - } - - Reference< awt::XControlContainer > BibView::getControlContainer() const - { - Reference< awt::XControlContainer > xReturn; - if ( m_pGeneralPage ) - xReturn = m_pGeneralPage->GetControlContainer(); - return xReturn; + return nullptr; } void BibView::GetFocus() diff --git a/extensions/source/bibliography/bibview.hxx b/extensions/source/bibliography/bibview.hxx index 4198dac03987..00060f7d34ad 100644 --- a/extensions/source/bibliography/bibview.hxx +++ b/extensions/source/bibliography/bibview.hxx @@ -28,11 +28,8 @@ class BibDataManager; namespace com::sun::star::awt{ class XFocusListener;} - namespace bib { - - class BibView; class BibViewFormControlContainer : public FormControlContainer { @@ -73,7 +70,6 @@ namespace bib virtual void dispose() override; void UpdatePages(); - css::uno::Reference< css::awt::XControlContainer > getControlContainer() const; virtual void GetFocus() override; diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx index 479aa7be18b8..5cadd05bc3a2 100644 --- a/extensions/source/bibliography/general.cxx +++ b/extensions/source/bibliography/general.cxx @@ -18,6 +18,7 @@ */ #include <comphelper/processfactory.hxx> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <com/sun/star/sdbc/XRowSet.hpp> #include <com/sun/star/sdb/XColumn.hpp> #include <com/sun/star/sdb/CommandType.hpp> @@ -26,10 +27,9 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <toolkit/helper/vclunohelper.hxx> #include <cppuhelper/implbase.hxx> -#include <vcl/builder.hxx> -#include <vcl/scrbar.hxx> +#include <vcl/event.hxx> +#include <vcl/mnemonic.hxx> #include <vcl/settings.hxx> -#include <vcl/fixed.hxx> #include "general.hxx" #include "bibresid.hxx" #include "datman.hxx" @@ -40,7 +40,6 @@ #include <tools/debug.hxx> #include <vcl/svapp.hxx> #include <vcl/i18nhelp.hxx> -#include <vcl/mnemonic.hxx> #include <algorithm> #include <tools/urlobj.hxx> @@ -65,159 +64,76 @@ static OUString lcl_GetColumnName( const Mapping* pMapping, sal_uInt16 nIndexPos return sRet; } -namespace { - -class BibPosListener :public cppu::WeakImplHelper <sdbc::XRowSetListener> -{ - VclPtr<BibGeneralPage> pParentPage; -public: - explicit BibPosListener(BibGeneralPage* pParent); - - //XPositioningListener - virtual void SAL_CALL cursorMoved(const lang::EventObject& event) override; - virtual void SAL_CALL rowChanged(const lang::EventObject& /*event*/) override { /* not interested in */ } - virtual void SAL_CALL rowSetChanged(const lang::EventObject& /*event*/) override { /* not interested in */ } - - //XEventListener - virtual void SAL_CALL disposing(const lang::EventObject& Source) override; - -}; - -} - -BibPosListener::BibPosListener(BibGeneralPage* pParent) : - pParentPage(pParent) +BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan) + : InterimItemWindow(pParent, "modules/sbibliography/ui/generalpage.ui", "GeneralPage") + , BibShortCutHandler(this) + , xScrolledWindow(m_xBuilder->weld_scrolled_window("scrolledwindow")) + , xGrid(m_xBuilder->weld_widget("grid")) + , xIdentifierFT(m_xBuilder->weld_label("shortname")) + , xIdentifierED(m_xBuilder->weld_entry("shortnamecontrol")) + , xAuthTypeFT(m_xBuilder->weld_label("authtype")) + , xAuthTypeLB(m_xBuilder->weld_combo_box("authtypecontrol")) + , xYearFT(m_xBuilder->weld_label("year")) + , xYearED(m_xBuilder->weld_entry("yearcontrol")) + , xAuthorFT(m_xBuilder->weld_label("authors")) + , xAuthorED(m_xBuilder->weld_entry("authorscontrol")) + , xTitleFT(m_xBuilder->weld_label("title")) + , xTitleED(m_xBuilder->weld_entry("titlecontrol")) + , xPublisherFT(m_xBuilder->weld_label("publisher")) + , xPublisherED(m_xBuilder->weld_entry("publishercontrol")) + , xAddressFT(m_xBuilder->weld_label("address")) + , xAddressED(m_xBuilder->weld_entry("addresscontrol")) + , xISBNFT(m_xBuilder->weld_label("isbn")) + , xISBNED(m_xBuilder->weld_entry("isbncontrol")) + , xChapterFT(m_xBuilder->weld_label("chapter")) + , xChapterED(m_xBuilder->weld_entry("chaptercontrol")) + , xPagesFT(m_xBuilder->weld_label("pages")) + , xPagesED(m_xBuilder->weld_entry("pagescontrol")) + , xEditorFT(m_xBuilder->weld_label("editor")) + , xEditorED(m_xBuilder->weld_entry("editorcontrol")) + , xEditionFT(m_xBuilder->weld_label("edition")) + , xEditionED(m_xBuilder->weld_entry("editioncontrol")) + , xBooktitleFT(m_xBuilder->weld_label("booktitle")) + , xBooktitleED(m_xBuilder->weld_entry("booktitlecontrol")) + , xVolumeFT(m_xBuilder->weld_label("volume")) + , xVolumeED(m_xBuilder->weld_entry("volumecontrol")) + , xHowpublishedFT(m_xBuilder->weld_label("publicationtype")) + , xHowpublishedED(m_xBuilder->weld_entry("publicationtypecontrol")) + , xOrganizationsFT(m_xBuilder->weld_label("organization")) + , xOrganizationsED(m_xBuilder->weld_entry("organizationcontrol")) + , xInstitutionFT(m_xBuilder->weld_label("institution")) + , xInstitutionED(m_xBuilder->weld_entry("institutioncontrol")) + , xSchoolFT(m_xBuilder->weld_label("university")) + , xSchoolED(m_xBuilder->weld_entry("universitycontrol")) + , xReportTypeFT(m_xBuilder->weld_label("reporttype")) + , xReportTypeED(m_xBuilder->weld_entry("reporttypecontrol")) + , xMonthFT(m_xBuilder->weld_label("month")) + , xMonthED(m_xBuilder->weld_entry("monthcontrol")) + , xJournalFT(m_xBuilder->weld_label("journal")) + , xJournalED(m_xBuilder->weld_entry("journalcontrol")) + , xNumberFT(m_xBuilder->weld_label("number")) + , xNumberED(m_xBuilder->weld_entry("numbercontrol")) + , xSeriesFT(m_xBuilder->weld_label("series")) + , xSeriesED(m_xBuilder->weld_entry("seriescontrol")) + , xAnnoteFT(m_xBuilder->weld_label("annotation")) + , xAnnoteED(m_xBuilder->weld_entry("annotationcontrol")) + , xNoteFT(m_xBuilder->weld_label("note")) + , xNoteED(m_xBuilder->weld_entry("notecontrol")) + , xURLFT(m_xBuilder->weld_label("url")) + , xURLED(m_xBuilder->weld_entry("urlcontrol")) + , xCustom1FT(m_xBuilder->weld_label("custom1")) + , xCustom1ED(m_xBuilder->weld_entry("custom1control")) + , xCustom2FT(m_xBuilder->weld_label("custom2")) + , xCustom2ED(m_xBuilder->weld_entry("custom2control")) + , xCustom3FT(m_xBuilder->weld_label("custom3")) + , xCustom3ED(m_xBuilder->weld_entry("custom3control")) + , xCustom4FT(m_xBuilder->weld_label("custom4")) + , xCustom4ED(m_xBuilder->weld_entry("custom4control")) + , xCustom5FT(m_xBuilder->weld_label("custom5")) + , xCustom5ED(m_xBuilder->weld_entry("custom5control")) + , pDatMan(pMan) { -} - -void BibPosListener::cursorMoved(const lang::EventObject& /*aEvent*/) -{ - try - { - uno::Reference< form::XBoundComponent > xLstBox = pParentPage->GetTypeListBoxModel(); - uno::Reference< beans::XPropertySet > xPropSet(xLstBox, UNO_QUERY); - if(xPropSet.is()) - { - BibConfig* pBibConfig = BibModul::GetConfig(); - BibDataManager* pDatMan = pParentPage->GetDataManager(); - BibDBDescriptor aDesc; - aDesc.sDataSource = pDatMan->getActiveDataSource(); - aDesc.sTableOrQuery = pDatMan->getActiveDataTable(); - aDesc.nCommandType = CommandType::TABLE; - - const Mapping* pMapping = pBibConfig->GetMapping(aDesc); - OUString sTypeMapping = pBibConfig->GetDefColumnName(AUTHORITYTYPE_POS); - if(pMapping) - { - for(const auto & aColumnPair : pMapping->aColumnPairs) - { - if(aColumnPair.sLogicalColumnName == sTypeMapping) - { - sTypeMapping = aColumnPair.sRealColumnName; - break; - } - } - } - OUString uTypeMapping = sTypeMapping; - - uno::Reference< form::XForm > xForm = pDatMan->getForm(); - uno::Reference< sdbcx::XColumnsSupplier > xSupplyCols(xForm, UNO_QUERY); - uno::Reference< container::XNameAccess > xValueAcc; - if (xSupplyCols.is()) - xValueAcc = xSupplyCols->getColumns(); - - sal_Int16 nTempVal = -1; - if(xValueAcc.is() && xValueAcc->hasByName(uTypeMapping)) - { - uno::Any aVal = xValueAcc->getByName(uTypeMapping); - uno::Reference< sdb::XColumn > xCol(aVal, UNO_QUERY); - DBG_ASSERT(xCol.is(), "BibPosListener::cursorMoved : invalid column (no sdb::XColumn) !"); - if (xCol.is()) - { - nTempVal = xCol->getShort(); - // getShort returns zero if the value is not a number - if (!nTempVal || xCol->wasNull()) - { - OUString sTempVal = xCol->getString(); - if(sTempVal != "0") - nTempVal = -1; - } - } - } - if(nTempVal < 0 || nTempVal >= TYPE_COUNT) - { - uno::Any aSel; - uno::Sequence<sal_Int16> aSelSeq(1); - sal_Int16* pArr = aSelSeq.getArray(); - pArr[0] = TYPE_COUNT; - aSel <<= aSelSeq; - xPropSet->setPropertyValue("SelectedItems", aSel); - } - } - } - catch(const Exception&) - { - OSL_FAIL("BibPosListener::cursorMoved: something went wrong !"); - } -} - -void BibPosListener::disposing(const lang::EventObject& /*Source*/) -{ -} - -BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan): - TabPage(pParent), - BibShortCutHandler( this ), - mxBibGeneralPageFocusListener(new BibGeneralPageFocusListener(this)), - pDatMan(pMan) -{ - m_pUIBuilder.reset(new VclBuilder(this, AllSettings::GetUIRootDir(), "modules/sbibliography/ui/generalpage.ui", "GeneralPage")); - set_hexpand(true); - set_vexpand(true); - set_expand(true); - - get(pIdentifierFT, "shortname"); - get(pAuthTypeFT, "authtype"); - get(pGrid, "grid"); - get(pScrolledWindow, "scrolledwindow"); - get(pYearFT, "year"); - get(pAuthorFT, "authors"); - get(pTitleFT, "title"); - get(pPublisherFT, "publisher"); - get(pAddressFT, "address"); - get(pISBNFT, "isbn"); - get(pChapterFT, "chapter"); - get(pPagesFT, "pages"); - get(pEditorFT, "editor"); - get(pEditionFT, "edition"); - get(pBooktitleFT, "booktitle"); - get(pVolumeFT, "volume"); - get(pHowpublishedFT, "publicationtype"); - get(pOrganizationsFT, "organization"); - get(pInstitutionFT, "institution"); - get(pSchoolFT, "university"); - get(pReportTypeFT, "reporttype"); - get(pMonthFT, "month"); - get(pJournalFT, "journal"); - get(pNumberFT, "number"); - get(pSeriesFT, "series"); - get(pAnnoteFT, "annotation"); - get(pNoteFT, "note"); - get(pURLFT, "url"); - get(pCustom1FT, "custom1"); - get(pCustom2FT, "custom2"); - get(pCustom3FT, "custom3"); - get(pCustom4FT, "custom4"); - get(pCustom5FT, "custom5"); - - InitFixedTexts(); - - sal_Int16* pMap = nFT2CtrlMap; - for( sal_uInt16 i = 0 ; i < FIELD_COUNT ; ++i, ++pMap ) - { - aControls[ i ] = nullptr; - *pMap = -1; - } + SetStyle(GetStyle() | WB_DIALOGCONTROL); BibConfig* pBibConfig = BibModul::GetConfig(); BibDBDescriptor aDesc; @@ -226,115 +142,133 @@ BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan): aDesc.nCommandType = CommandType::TABLE; const Mapping* pMapping = pBibConfig->GetMapping(aDesc); - xCtrlContnr = VCLUnoHelper::CreateControlContainer(pGrid); - - std::vector<vcl::Window*> aChildren; - - AddControlWithError(lcl_GetColumnName(pMapping, IDENTIFIER_POS), *pIdentifierFT, - sTableErrorString, - HID_BIB_IDENTIFIER_POS, 0, aChildren); + xIdentifierED->connect_key_press(LINK(this, BibGeneralPage, FirstElementKeyInputHdl)); - sTypeColumnName = lcl_GetColumnName(pMapping, AUTHORITYTYPE_POS); + AddControlWithError(lcl_GetColumnName(pMapping, IDENTIFIER_POS), + xIdentifierFT->get_label(), *xIdentifierED, + sTableErrorString, HID_BIB_IDENTIFIER_POS); - AddControlWithError(sTypeColumnName, *pAuthTypeFT, sTableErrorString, - HID_BIB_AUTHORITYTYPE_POS, 1, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, AUTHORITYTYPE_POS), + xAuthTypeFT->get_label(), *xAuthTypeLB, + sTableErrorString, HID_BIB_AUTHORITYTYPE_POS); - AddControlWithError(lcl_GetColumnName(pMapping, YEAR_POS), *pYearFT, - sTableErrorString, HID_BIB_YEAR_POS, 2, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, YEAR_POS), + xYearFT->get_label(), *xYearED, + sTableErrorString, HID_BIB_YEAR_POS); - AddControlWithError(lcl_GetColumnName(pMapping, AUTHOR_POS), *pAuthorFT, - sTableErrorString, HID_BIB_AUTHOR_POS, 3, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, AUTHOR_POS), + xAuthorFT->get_label(), *xAuthorED, + sTableErrorString, HID_BIB_AUTHOR_POS); - AddControlWithError(lcl_GetColumnName(pMapping, TITLE_POS), *pTitleFT, sTableErrorString, - HID_BIB_TITLE_POS, 4, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, TITLE_POS), + xTitleFT->get_label(), *xTitleED, + sTableErrorString, HID_BIB_TITLE_POS); - AddControlWithError(lcl_GetColumnName(pMapping, PUBLISHER_POS), *pPublisherFT, - sTableErrorString, HID_BIB_PUBLISHER_POS, 5, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, PUBLISHER_POS), + xPublisherFT->get_label(), *xPublisherED, + sTableErrorString, HID_BIB_PUBLISHER_POS); - AddControlWithError(lcl_GetColumnName(pMapping, ADDRESS_POS), *pAddressFT, - sTableErrorString, HID_BIB_ADDRESS_POS, 6, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, ADDRESS_POS), + xAddressFT->get_label(), *xAddressED, + sTableErrorString, HID_BIB_ADDRESS_POS); - AddControlWithError(lcl_GetColumnName(pMapping, ISBN_POS), *pISBNFT, - sTableErrorString, HID_BIB_ISBN_POS, 7, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, ISBN_POS), + xISBNFT->get_label(), *xISBNED, + sTableErrorString, HID_BIB_ISBN_POS); - AddControlWithError(lcl_GetColumnName(pMapping, CHAPTER_POS), *pChapterFT, - sTableErrorString, HID_BIB_CHAPTER_POS, 8, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, CHAPTER_POS), + xChapterFT->get_label(), *xChapterED, + sTableErrorString, HID_BIB_CHAPTER_POS); - AddControlWithError(lcl_GetColumnName(pMapping, PAGES_POS), *pPagesFT, - sTableErrorString, HID_BIB_PAGES_POS, 9, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, PAGES_POS), + xPagesFT->get_label(), *xPagesED, + sTableErrorString, HID_BIB_PAGES_POS); - AddControlWithError(lcl_GetColumnName(pMapping, EDITOR_POS), *pEditorFT, - sTableErrorString, HID_BIB_EDITOR_POS, 10, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, EDITOR_POS), + xEditorFT->get_label(), *xEditorED, + sTableErrorString, HID_BIB_EDITOR_POS); - AddControlWithError(lcl_GetColumnName(pMapping, EDITION_POS), *pEditionFT, - sTableErrorString, HID_BIB_EDITION_POS, 11, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, EDITION_POS), + xEditionFT->get_label(), *xEditionED, + sTableErrorString, HID_BIB_EDITION_POS); - AddControlWithError(lcl_GetColumnName(pMapping, BOOKTITLE_POS), *pBooktitleFT, - sTableErrorString, HID_BIB_BOOKTITLE_POS, 12, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, BOOKTITLE_POS), + xBooktitleFT->get_label(), *xBooktitleED, + sTableErrorString, HID_BIB_BOOKTITLE_POS); - AddControlWithError(lcl_GetColumnName(pMapping, VOLUME_POS), *pVolumeFT, - sTableErrorString, HID_BIB_VOLUME_POS, 13, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, VOLUME_POS), + xVolumeFT->get_label(), *xVolumeED, + sTableErrorString, HID_BIB_VOLUME_POS); - AddControlWithError(lcl_GetColumnName(pMapping, HOWPUBLISHED_POS), *pHowpublishedFT, - sTableErrorString, HID_BIB_HOWPUBLISHED_POS, 14, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, HOWPUBLISHED_POS), + xHowpublishedFT->get_label(), *xHowpublishedED, + sTableErrorString, HID_BIB_HOWPUBLISHED_POS); - AddControlWithError(lcl_GetColumnName(pMapping, ORGANIZATIONS_POS), *pOrganizationsFT, - sTableErrorString, HID_BIB_ORGANIZATIONS_POS, 15, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, ORGANIZATIONS_POS), + xOrganizationsFT->get_label(), *xOrganizationsED, + sTableErrorString, HID_BIB_ORGANIZATIONS_POS); - AddControlWithError(lcl_GetColumnName(pMapping, INSTITUTION_POS), *pInstitutionFT, - sTableErrorString, HID_BIB_INSTITUTION_POS, 16, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, INSTITUTION_POS), + xInstitutionFT->get_label(), *xInstitutionED, + sTableErrorString, HID_BIB_INSTITUTION_POS); - AddControlWithError(lcl_GetColumnName(pMapping, SCHOOL_POS), *pSchoolFT, - sTableErrorString, HID_BIB_SCHOOL_POS, 17, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, SCHOOL_POS), + xSchoolFT->get_label(), *xSchoolED, + sTableErrorString, HID_BIB_SCHOOL_POS); - AddControlWithError(lcl_GetColumnName(pMapping, REPORTTYPE_POS), *pReportTypeFT, - sTableErrorString, HID_BIB_REPORTTYPE_POS, 18, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, REPORTTYPE_POS), + xReportTypeFT->get_label(), *xReportTypeED, + sTableErrorString, HID_BIB_REPORTTYPE_POS); - AddControlWithError(lcl_GetColumnName(pMapping, MONTH_POS), *pMonthFT, - sTableErrorString, HID_BIB_MONTH_POS, 19, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, MONTH_POS), + xMonthFT->get_label(), *xMonthED, + sTableErrorString, HID_BIB_MONTH_POS); - AddControlWithError(lcl_GetColumnName(pMapping, JOURNAL_POS), *pJournalFT, - sTableErrorString, HID_BIB_JOURNAL_POS, 20, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, JOURNAL_POS), + xJournalFT->get_label(), *xJournalED, + sTableErrorString, HID_BIB_JOURNAL_POS); - AddControlWithError(lcl_GetColumnName(pMapping, NUMBER_POS), *pNumberFT, - sTableErrorString, HID_BIB_NUMBER_POS, 21, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, NUMBER_POS), + xNumberFT->get_label(), *xNumberED, + sTableErrorString, HID_BIB_NUMBER_POS); - AddControlWithError(lcl_GetColumnName(pMapping, SERIES_POS), *pSeriesFT, - sTableErrorString, HID_BIB_SERIES_POS, 22, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, SERIES_POS), + xSeriesFT->get_label(), *xSeriesED, + sTableErrorString, HID_BIB_SERIES_POS); - AddControlWithError(lcl_GetColumnName(pMapping, ANNOTE_POS), *pAnnoteFT, - sTableErrorString, HID_BIB_ANNOTE_POS, 23, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, ANNOTE_POS), + xAnnoteFT->get_label(), *xAnnoteED, + sTableErrorString, HID_BIB_ANNOTE_POS); - AddControlWithError(lcl_GetColumnName(pMapping, NOTE_POS),*pNoteFT, - sTableErrorString, HID_BIB_NOTE_POS, 24, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, NOTE_POS), + xNoteFT->get_label(), *xNoteED, + sTableErrorString, HID_BIB_NOTE_POS); - AddControlWithError(lcl_GetColumnName(pMapping, URL_POS), *pURLFT, - sTableErrorString, HID_BIB_URL_POS, 25, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, URL_POS), + xURLFT->get_label(), *xURLED, + sTableErrorString, HID_BIB_URL_POS); - AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM1_POS), *pCustom1FT, - sTableErrorString, HID_BIB_CUSTOM1_POS, 26, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM1_POS), + xCustom1FT->get_label(), *xCustom1ED, + sTableErrorString, HID_BIB_CUSTOM1_POS); - AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM2_POS), *pCustom2FT, - sTableErrorString, HID_BIB_CUSTOM2_POS, 27, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM2_POS), + xCustom2FT->get_label(), *xCustom2ED, + sTableErrorString, HID_BIB_CUSTOM2_POS); - AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM3_POS), *pCustom3FT, - sTableErrorString, HID_BIB_CUSTOM3_POS, 28, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM3_POS), + xCustom3FT->get_label(), *xCustom3ED, + sTableErrorString, HID_BIB_CUSTOM3_POS); - AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM4_POS), *pCustom4FT, - sTableErrorString, HID_BIB_CUSTOM4_POS, 29, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM4_POS), + xCustom4FT->get_label(), *xCustom4ED, + sTableErrorString, HID_BIB_CUSTOM4_POS); - AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM5_POS), *pCustom5FT, - sTableErrorString, HID_BIB_CUSTOM5_POS, 30, aChildren); + AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM5_POS), + xCustom5FT->get_label(), *xCustom5ED, + sTableErrorString, HID_BIB_CUSTOM5_POS); - BuilderUtils::reorderWithinParent(aChildren, false); - - xPosListener = new BibPosListener(this); - uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getForm(), UNO_QUERY); - if(xRowSet.is()) - xRowSet->addRowSetListener(xPosListener); - uno::Reference< form::runtime::XFormController > xFormCtrl = pDatMan->GetFormController(); - xFormCtrl->setContainer(xCtrlContnr); - xFormCtrl->activateTabOrder(); + xCustom5ED->connect_key_press(LINK(this, BibGeneralPage, LastElementKeyInputHdl)); if(!sTableErrorString.isEmpty()) sTableErrorString = BibResId(ST_ERROR_PREFIX) + sTableErrorString; @@ -345,117 +279,332 @@ BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan): set_height_request(aSize.Height()); } -BibGeneralPage::~BibGeneralPage() +IMPL_LINK(BibGeneralPage, FirstElementKeyInputHdl, const KeyEvent&, rKeyEvent, bool) { - disposeOnce(); + sal_uInt16 nCode = rKeyEvent.GetKeyCode().GetCode(); + bool bShift = rKeyEvent.GetKeyCode().IsShift(); + bool bCtrl = rKeyEvent.GetKeyCode().IsMod1(); + bool bAlt = rKeyEvent.GetKeyCode().IsMod2(); + if (KEY_TAB == nCode && bShift && !bCtrl && !bAlt) + { + SaveChanges(); + uno::Reference<sdbc::XRowSet> xRowSet(pDatMan->getForm(), UNO_QUERY); + if (xRowSet.is() && !xRowSet->isFirst()) + xRowSet->previous(); + xCustom5ED->grab_focus(); + xCustom5ED->select_region(0, -1); + GainFocusHdl(*xCustom5ED); + return true; + } + return false; } -void BibGeneralPage::dispose() +void BibGeneralPage::SaveChanges() { - if (pDatMan && xPosListener.is()) + Reference< XForm > xForm = pDatMan->getForm(); + Reference< beans::XPropertySet > xProps( xForm, UNO_QUERY ); + Reference< sdbc::XResultSetUpdate > xResUpd( xProps, UNO_QUERY ); + if (xResUpd.is() ) { - uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getForm(), UNO_QUERY); - if(xRowSet.is()) - xRowSet->removeRowSetListener(xPosListener); + Any aModified = xProps->getPropertyValue( "IsModified" ); + bool bFlag = false; + if ( ( aModified >>= bFlag ) && bFlag ) + { + + try + { + Any aNew = xProps->getPropertyValue( "IsNew" ); + aNew >>= bFlag; + if ( bFlag ) + xResUpd->insertRow(); + else + xResUpd->updateRow(); + } + catch( const uno::Exception&) {} + } } - pGrid.clear(); - pScrolledWindow.clear(); - pIdentifierFT.clear(); - pAuthTypeFT.clear(); - pYearFT.clear(); - pAuthorFT.clear(); - pTitleFT.clear(); - pPublisherFT.clear(); - pAddressFT.clear(); - pISBNFT.clear(); - pChapterFT.clear(); - pPagesFT.clear(); - pEditorFT.clear(); - pEditionFT.clear(); - pBooktitleFT.clear(); - pVolumeFT.clear(); - pHowpublishedFT.clear(); - pOrganizationsFT.clear(); - pInstitutionFT.clear(); - pSchoolFT.clear(); - pReportTypeFT.clear(); - pMonthFT.clear(); - pJournalFT.clear(); - pNumberFT.clear(); - pSeriesFT.clear(); - pAnnoteFT.clear(); - pNoteFT.clear(); - pURLFT.clear(); - pCustom1FT.clear(); - pCustom2FT.clear(); - pCustom3FT.clear(); - pCustom4FT.clear(); - pCustom5FT.clear(); - for (auto & a: aFixedTexts) a.clear(); - mxBibGeneralPageFocusListener.clear(); - disposeBuilder(); - TabPage::dispose(); } -void BibGeneralPage::RemoveListeners() +IMPL_LINK(BibGeneralPage, LastElementKeyInputHdl, const KeyEvent&, rKeyEvent, bool) { - for(uno::Reference<awt::XWindow> & aControl : aControls) + sal_uInt16 nCode = rKeyEvent.GetKeyCode().GetCode(); + bool bShift = rKeyEvent.GetKeyCode().IsShift(); + bool bCtrl = rKeyEvent.GetKeyCode().IsMod1(); + bool bAlt = rKeyEvent.GetKeyCode().IsMod2(); + if (KEY_TAB == nCode && !bShift && !bCtrl && !bAlt) { - if(aControl.is()) + SaveChanges(); + uno::Reference<sdbc::XRowSet> xRowSet(pDatMan->getForm(), UNO_QUERY); + if (xRowSet.is()) { - aControl->removeFocusListener( mxBibGeneralPageFocusListener ); - aControl = nullptr; + if (xRowSet->isLast()) + { + uno::Reference<sdbc::XResultSetUpdate> xUpdateCursor(xRowSet, UNO_QUERY); + if (xUpdateCursor.is()) + xUpdateCursor->moveToInsertRow(); + } + else + xRowSet->next(); } + xIdentifierED->grab_focus(); + xIdentifierED->select_region(0, -1); + GainFocusHdl(*xIdentifierED); + return true; } + return false; } -void BibGeneralPage::CommitActiveControl() +BibGeneralPage::~BibGeneralPage() { - uno::Reference< form::runtime::XFormController > xFormCtrl = pDatMan->GetFormController(); - uno::Reference< awt::XControl > xCurr = xFormCtrl->getCurrentControl(); - if(xCurr.is()) - { - uno::Reference< awt::XControlModel > xModel = xCurr->getModel(); - uno::Reference< form::XBoundComponent > xBound(xModel, UNO_QUERY); - if(xBound.is()) - xBound->commit(); - } + disposeOnce(); } -void BibGeneralPage::AddControlWithError( const OUString& rColumnName, FixedText &rLabel, - OUString& rErrorString, std::string_view sHelpId, sal_uInt16 nIndexInFTArray, std::vector<vcl::Window*> &rChildren) +class ChangeListener : public cppu::WeakImplHelper<css::beans::XPropertyChangeListener> { - const OUString aColumnUIName(rLabel.GetText()); - // adds also the XControl and creates a map entry in nFT2CtrlMap[] for mapping between control and FT +public: + explicit ChangeListener(css::uno::Reference<css::beans::XPropertySet>& rPropSet) + : m_xPropSet(rPropSet) + , m_bSelfChanging(false) + { + } - sal_Int16 nIndex = -1; - bool bSuccess = AddXControl(rColumnName, rLabel, sHelpId, nIndex, rChildren); - if (bSuccess) + virtual void SAL_CALL disposing(lang::EventObject const &) override { - DBG_ASSERT( nIndexInFTArray < FIELD_COUNT, "*BibGeneralPage::AddControlWithError(): wrong array index!" ); - DBG_ASSERT( nFT2CtrlMap[ nIndexInFTArray ] < 0, "+BibGeneralPage::AddControlWithError(): index already in use!" ); + } - nFT2CtrlMap[ nIndexInFTArray ] = nIndex; + virtual void start() = 0; + virtual void stop() + { + WriteBack(); } - else + +protected: + css::uno::Reference<css::beans::XPropertySet> m_xPropSet; + bool m_bSelfChanging; + +private: + virtual void WriteBack() = 0; +}; + +namespace +{ + class EntryChangeListener : public ChangeListener { - if( !rErrorString.isEmpty() ) - rErrorString += "\n"; + public: + explicit EntryChangeListener(weld::Entry& rEntry, css::uno::Reference<css::beans::XPropertySet>& rPropSet) + : ChangeListener(rPropSet) + , m_rEntry(rEntry) + { + rEntry.connect_focus_out(LINK(this, EntryChangeListener, LoseFocusHdl)); + setValue(rPropSet->getPropertyValue("Text")); + } + + virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override + { + if (m_bSelfChanging) + return; + setValue(evt.NewValue); + } - rErrorString += MnemonicGenerator::EraseAllMnemonicChars( aColumnUIName ); + virtual void start() override + { + m_xPropSet->addPropertyChangeListener("Text", this); + } + + virtual void stop() override + { + m_xPropSet->removePropertyChangeListener("Text", this); + ChangeListener::stop(); + } + + private: + weld::Entry& m_rEntry; + + DECL_LINK(LoseFocusHdl, weld::Widget&, void); + + void setValue(const css::uno::Any& rValue) + { + OUString sNewName; + rValue >>= sNewName; + m_rEntry.set_text(sNewName); + m_rEntry.save_value(); + } + + virtual void WriteBack() override + { + if (!m_rEntry.get_value_changed_from_saved()) + return; + m_bSelfChanging = true; + + m_xPropSet->setPropertyValue("Text", makeAny(m_rEntry.get_text())); + + css::uno::Reference<css::form::XBoundComponent> xBound(m_xPropSet, css::uno::UNO_QUERY); + if (xBound.is()) + xBound->commit(); + + m_bSelfChanging = false; + m_rEntry.save_value(); + } + + }; + + IMPL_LINK_NOARG(EntryChangeListener, LoseFocusHdl, weld::Widget&, void) + { + WriteBack(); } + + class ComboBoxChangeListener : public ChangeListener + { + public: + explicit ComboBoxChangeListener(weld::ComboBox& rComboBox, css::uno::Reference<css::beans::XPropertySet>& rPropSet) + : ChangeListener(rPropSet) + , m_rComboBox(rComboBox) + { + rComboBox.connect_changed(LINK(this, ComboBoxChangeListener, ChangeHdl)); + setValue(rPropSet->getPropertyValue("SelectedItems")); + } + + virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override + { + if (m_bSelfChanging) + return; + setValue(evt.NewValue); + } + + virtual void start() override + { + m_xPropSet->addPropertyChangeListener("SelectedItems", this); + } + + virtual void stop() override + { + m_xPropSet->removePropertyChangeListener("SelectedItems", this); + ChangeListener::stop(); + } + + private: + weld::ComboBox& m_rComboBox; + + DECL_LINK(ChangeHdl, weld::ComboBox&, void); + + void setValue(const css::uno::Any& rValue) + { + sal_Int16 nSelection = -1; + Sequence<sal_Int16> aSelection; + rValue >>= aSelection; + if (aSelection.hasElements()) + nSelection = aSelection[0]; + + m_rComboBox.set_active(nSelection); + m_rComboBox.save_value(); + } + + virtual void WriteBack() override + { + if (!m_rComboBox.get_value_changed_from_saved()) + return; + m_bSelfChanging = true; + + Sequence<sal_Int16> aSelection(1); + aSelection[0] = m_rComboBox.get_active(); + m_xPropSet->setPropertyValue("SelectedItems", makeAny(aSelection)); + + css::uno::Reference<css::form::XBoundComponent> xBound(m_xPropSet, css::uno::UNO_QUERY); + if (xBound.is()) + xBound->commit(); + + m_bSelfChanging = false; + m_rComboBox.save_value(); + } + }; + + IMPL_LINK_NOARG(ComboBoxChangeListener, ChangeHdl, weld::ComboBox&, void) + { + WriteBack(); + } +} + +void BibGeneralPage::dispose() +{ + for (auto& listener : maChangeListeners) + listener->stop(); + maChangeListeners.clear(); + + SaveChanges(); + + xScrolledWindow.reset(); + xGrid.reset(); + xIdentifierFT.reset(); + xIdentifierED.reset(); + xAuthTypeFT.reset(); + xAuthTypeLB.reset(); + xYearFT.reset(); + xYearED.reset(); + xAuthorFT.reset(); + xAuthorED.reset(); + xTitleFT.reset(); + xTitleED.reset(); + xPublisherFT.reset(); + xPublisherED.reset(); + xAddressFT.reset(); + xAddressED.reset(); + xISBNFT.reset(); + xISBNED.reset(); + xChapterFT.reset(); + xChapterED.reset(); + xPagesFT.reset(); + xPagesED.reset(); + xEditorFT.reset(); + xEditorED.reset(); + xEditionFT.reset(); + xEditionED.reset(); + xBooktitleFT.reset(); + xBooktitleED.reset(); + xVolumeFT.reset(); + xVolumeED.reset(); + xHowpublishedFT.reset(); + xHowpublishedED.reset(); + xOrganizationsFT.reset(); + xOrganizationsED.reset(); + xInstitutionFT.reset(); + xInstitutionED.reset(); + xSchoolFT.reset(); + xSchoolED.reset(); + xReportTypeFT.reset(); + xReportTypeED.reset(); + xMonthFT.reset(); + xMonthED.reset(); + xJournalFT.reset(); + xJournalED.reset(); + xNumberFT.reset(); + xNumberED.reset(); + xSeriesFT.reset(); + xSeriesED.reset(); + xAnnoteFT.reset(); + xAnnoteED.reset(); + xNoteFT.reset(); + xNoteED.reset(); + xURLFT.reset(); + xURLED.reset(); + xCustom1FT.reset(); + xCustom1ED.reset(); + xCustom2FT.reset(); + xCustom2ED.reset(); + xCustom3FT.reset(); + xCustom3ED.reset(); + xCustom4FT.reset(); + xCustom4ED.reset(); + xCustom5FT.reset(); + xCustom5ED.reset(); + InterimItemWindow::dispose(); } -bool BibGeneralPage::AddXControl( - const OUString& rName, - FixedText& rLabel, std::string_view sHelpId, sal_Int16& rIndex, - std::vector<vcl::Window*>& rChildren) +bool BibGeneralPage::AddXControl(const OUString& rName, weld::Entry& rEntry) { uno::Reference< awt::XControlModel > xCtrModel; try { - const bool bTypeListBox = sTypeColumnName == rName; - xCtrModel = pDatMan->loadControlModel(rName, bTypeListBox); + xCtrModel = pDatMan->loadControlModel(rName, false); if ( xCtrModel.is() ) { uno::Reference< beans::XPropertySet > xPropSet( xCtrModel, UNO_QUERY ); @@ -463,62 +612,8 @@ bool BibGeneralPage::AddXControl( if( xPropSet.is()) { uno::Reference< beans::XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo(); - - OUString aControlName; - if (bTypeListBox) - { - aControlName = "com.sun.star.form.control.ListBox"; - xLBModel.set(xCtrModel, UNO_QUERY); - } - else - { - uno::Any aAny = xPropSet->getPropertyValue( "DefaultControl" ); - aAny >>= aControlName; - } - - OUString uProp("HelpURL"); - if(xPropInfo->hasPropertyByName(uProp)) - { - OUString sId( INET_HID_SCHEME ); - DBG_ASSERT( INetURLObject( OStringToOUString( sHelpId, RTL_TEXTENCODING_UTF8 ) ).GetProtocol() == INetProtocol::NotValid, "Wrong HelpId!" ); - sId += OStringToOUString( sHelpId, RTL_TEXTENCODING_UTF8 ); - xPropSet->setPropertyValue( uProp, makeAny( sId ) ); - } - - uno::Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); - uno::Reference< awt::XControl > xControl( xContext->getServiceManager()->createInstanceWithContext(aControlName, xContext), UNO_QUERY); - if ( xControl.is() ) - { - xControl->setModel( xCtrModel); - - // Peer as Child to the FrameWindow - xCtrlContnr->addControl(rName, xControl); - uno::Reference< awt::XWindow > xCtrWin(xControl, UNO_QUERY ); - xCtrWin->addFocusListener( mxBibGeneralPageFocusListener ); - rIndex = -1; // -> implies, that not found - for(sal_uInt16 i = 0; i < FIELD_COUNT; i++) - if(!aControls[i].is()) - { - aControls[i] = xCtrWin; - rIndex = sal_Int16( i ); - break; - } - // initially switch on the design mode - switch it off _after_ loading the form - xCtrWin->setVisible( true ); - xControl->setDesignMode( true ); - - VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xControl->getPeer()); - pWindow->set_grid_top_attach(rLabel.get_grid_top_attach()); - pWindow->set_grid_left_attach(rLabel.get_grid_left_attach()+1); - pWindow->set_valign(VclAlign::Center); - rLabel.set_mnemonic_widget(pWindow); - if (&rLabel == pTitleFT) - pWindow->set_grid_width(3); - else - pWindow->set_hexpand(true); - rChildren.push_back(&rLabel); - rChildren.push_back(pWindow); - } + maChangeListeners.emplace_back(new EntryChangeListener(rEntry, xPropSet)); + maChangeListeners.back()->start(); } } } @@ -529,185 +624,76 @@ bool BibGeneralPage::AddXControl( return xCtrModel.is(); } -void BibGeneralPage::InitFixedTexts() +IMPL_LINK(BibGeneralPage, GainFocusHdl, weld::Widget&, rWidget, void) { - aFixedTexts[0] = pIdentifierFT; - aFixedTexts[1] = pAuthTypeFT; - aFixedTexts[2] = pYearFT; - aFixedTexts[3] = pAuthorFT; - aFixedTexts[4] = pTitleFT; - aFixedTexts[5] = pPublisherFT; - aFixedTexts[6] = pAddressFT; - aFixedTexts[7] = pISBNFT; - aFixedTexts[8] = pChapterFT; - aFixedTexts[9] = pPagesFT; - - aFixedTexts[10] = pEditorFT; - aFixedTexts[11] = pEditionFT; - aFixedTexts[12] = pBooktitleFT; - aFixedTexts[13] = pVolumeFT; - aFixedTexts[14] = pHowpublishedFT; - aFixedTexts[15] = pOrganizationsFT; - aFixedTexts[16] = pInstitutionFT; - aFixedTexts[17] = pSchoolFT; - aFixedTexts[18] = pReportTypeFT; - aFixedTexts[19] = pMonthFT; - - aFixedTexts[20] = pJournalFT; - aFixedTexts[21] = pNumberFT; - aFixedTexts[22] = pSeriesFT; - aFixedTexts[23] = pAnnoteFT; - aFixedTexts[24] = pNoteFT; - aFixedTexts[25] = pURLFT; - - aFixedTexts[26] = pCustom1FT; - aFixedTexts[27] = pCustom2FT; - aFixedTexts[28] = pCustom3FT; - aFixedTexts[29] = pCustom4FT; - aFixedTexts[30] = pCustom5FT; - - int i; - - MnemonicGenerator aMnemonicGenerator; - - OUString aFixedStrings[ FIELD_COUNT ]; - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aFixedStrings[i] = aFixedTexts[i]->GetText(); - - // init mnemonics, first register all strings - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aMnemonicGenerator.RegisterMnemonic( aFixedStrings[ i ] ); - - // ... then get all strings - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aFixedStrings[i] = aMnemonicGenerator.CreateMnemonic(aFixedStrings[i]); - - // set texts - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aFixedTexts[ i ]->SetText( aFixedStrings[ i ] ); -} - -void BibGeneralPage::focusGained(const awt::FocusEvent& rEvent) -{ - Reference<awt::XWindow> xCtrWin(rEvent.Source, UNO_QUERY ); - if(!xCtrWin.is()) + int x, y, width, height; + if (!rWidget.get_extents_relative_to(*xGrid, x, y, width, height)) return; - ::Size aOutSize = pScrolledWindow->getVisibleChildSize(); - awt::Rectangle aRect = xCtrWin->getPosSize(); - Point aOffset(pGrid->GetPosPixel()); - tools::Long nX = aRect.X + aOffset.X(); - if (nX < 0 || nX > aOutSize.Width()) - { - pScrolledWindow->getHorzScrollBar().DoScroll(aRect.X); - } + int bottom = y + height; + int nVScrollPos = xScrolledWindow->vadjustment_get_value(); + if (y < nVScrollPos || bottom > nVScrollPos + xScrolledWindow->vadjustment_get_page_size()) + xScrolledWindow->vadjustment_set_value(y); - tools::Long nY = aRect.Y + aOffset.Y(); - if (nY < 0 || nY > aOutSize.Height()) - { - pScrolledWindow->getVertScrollBar().DoScroll(aRect.Y); - } + int right = x + width; + int nHScrollPos = xScrolledWindow->hadjustment_get_value(); + if (x < nHScrollPos || right > nHScrollPos + xScrolledWindow->hadjustment_get_page_size()) + xScrolledWindow->hadjustment_set_value(x); } -void BibGeneralPage::focusLost() +template<class Target> void BibGeneralPage::AddControlWithError(const OUString& rColumnName, const OUString& rColumnUIName, + Target& rWidget, OUString& rErrorString, const OString& rHelpId) { - CommitActiveControl(); -} - -void BibGeneralPage::GetFocus() -{ - Reference< awt::XWindow >* pxControl = aControls; - - for( int i = FIELD_COUNT ; i ; --i, ++pxControl ) + rWidget.set_help_id(rHelpId); + rWidget.connect_focus_in(LINK(this, BibGeneralPage, GainFocusHdl)); + bool bSuccess = AddXControl(rColumnName, rWidget); + if (!bSuccess) { - if( pxControl->is() ) - { - ( *pxControl )->setFocus(); - return; - } - } + if( !rErrorString.isEmpty() ) + rErrorString += "\n"; - // fallback - GrabFocus(); + rErrorString += MnemonicGenerator::EraseAllMnemonicChars(rColumnUIName); + } } -bool BibGeneralPage::HandleShortCutKey( const KeyEvent& rKeyEvent ) +bool BibGeneralPage::AddXControl(const OUString& rName, weld::ComboBox& rList) { - DBG_ASSERT( KEY_MOD2 == rKeyEvent.GetKeyCode().GetModifier(), "+BibGeneralPage::HandleShortCutKey(): this is not for me!" ); + uno::Reference< awt::XControlModel > xCtrModel; + try + { + xCtrModel = pDatMan->loadControlModel(rName, true); + if ( xCtrModel.is() ) + { + uno::Reference< beans::XPropertySet > xPropSet( xCtrModel, UNO_QUERY ); - const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); - const sal_Unicode c = rKeyEvent.GetCharCode(); - bool bHandled = false; + if( xPropSet.is()) + { + uno::Reference< beans::XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo(); - sal_Int16 i; + css::uno::Sequence<OUString> aEntries; + xPropSet->getPropertyValue("StringItemList") >>= aEntries; + for (const OUString& rString : std::as_const(aEntries)) + rList.append_text(rString); - std::vector<sal_Int16>::size_type nFocused = 0xFFFF; // index of focused in vector, no one focused initial - DBG_ASSERT( nFocused > 0, "*BibGeneralPage::HandleShortCutKey(): size_type works not as expected!" ); + sal_Int16 nSelection = -1; + Sequence<sal_Int16> aSelection; + xPropSet->getPropertyValue("SelectedItems") >>= aSelection; + if (aSelection.hasElements()) + nSelection = aSelection[0]; - std::vector<sal_Int16> aMatchList; + rList.set_active(nSelection); + rList.save_value(); - for( i = 0 ; i < FIELD_COUNT ; ++i ) - { - if( rI18nHelper.MatchMnemonic( aFixedTexts[ i ]->GetText(), c ) ) - { - bHandled = true; - sal_Int16 nCtrlIndex = nFT2CtrlMap[ i ]; - - if( nCtrlIndex >= 0 ) - { // store index of control - DBG_ASSERT( aControls[ nCtrlIndex ].is(), "-BibGeneralPage::HandleShortCutKey(): valid index and no control?" ); - - uno::Reference< awt::XControl > xControl( aControls[ nCtrlIndex ], UNO_QUERY ); - DBG_ASSERT( xControl.is(), "-BibGeneralPage::HandleShortCutKey(): a control which is not a control!" ); - - VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() ); - - if( pWindow ) - { - aMatchList.push_back( nCtrlIndex ); - if( pWindow->HasChildPathFocus() ) - { // save focused control - DBG_ASSERT( nFocused == 0xFFFF, "+BibGeneralPage::HandleShortCutKey(): more than one with focus?!" ); - DBG_ASSERT( !aMatchList.empty(), "+BibGeneralPage::HandleShortCutKey(): push_back and no content?!" ); - nFocused = aMatchList.size() - 1; - } - } + maChangeListeners.emplace_back(new ComboBoxChangeListener(rList, xPropSet)); + maChangeListeners.back()->start(); } } } - - if( bHandled ) + catch(const Exception&) { - DBG_ASSERT( !aMatchList.empty(), "*BibGeneralPage::HandleShortCutKey(): be prepared to crash..." ); - - if( nFocused >= ( aMatchList.size() - 1 ) ) - // >=... includes 0xFFFF - // no one or last focused, take first - nFocused = 0; - else - // take next one - nFocused++; - - aControls[ aMatchList[ nFocused ] ]->setFocus(); + OSL_FAIL("BibGeneralPage::AddXControl: something went wrong!"); } - - return bHandled; -} - -BibGeneralPageFocusListener::BibGeneralPageFocusListener(BibGeneralPage *pBibGeneralPage): mpBibGeneralPage(pBibGeneralPage) -{} - -void BibGeneralPageFocusListener::focusGained( const css::awt::FocusEvent& e ) -{ - mpBibGeneralPage->focusGained(e); -} - -void BibGeneralPageFocusListener::focusLost( const css::awt::FocusEvent& ) -{ - mpBibGeneralPage->focusLost(); + return xCtrModel.is(); } -void BibGeneralPageFocusListener::disposing( const css::lang::EventObject& ) -{} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/general.hxx b/extensions/source/bibliography/general.hxx index 107f40fe2bc6..31eece3891cf 100644 --- a/extensions/source/bibliography/general.hxx +++ b/extensions/source/bibliography/general.hxx @@ -29,8 +29,7 @@ #include <com/sun/star/form/XBoundComponent.hpp> #include <com/sun/star/sdbc/XRowSetListener.hpp> -#include <vcl/layout.hxx> -#include <vcl/tabpage.hxx> +#include <vcl/InterimItemWindow.hxx> #include <cppuhelper/implbase1.hxx> #include "bibshortcuthandler.hxx" @@ -39,157 +38,123 @@ class BibDataManager; #define TYPE_COUNT 22 #define FIELD_COUNT 31 -/** - * We need to split off the listener because both it and the vcl::Window baseclass are ref-counted - */ -class BibGeneralPage; -class BibGeneralPageFocusListener : public cppu::WeakAggImplHelper1 < css::awt::XFocusListener > -{ -private: - VclPtr<BibGeneralPage> mpBibGeneralPage; -public: - explicit BibGeneralPageFocusListener(BibGeneralPage *pBibGeneralPage); - virtual void SAL_CALL focusGained( const css::awt::FocusEvent& e ) override; - virtual void SAL_CALL focusLost( const css::awt::FocusEvent& e ) override; - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; +class ChangeListener; -}; - -class BibGeneralPage : public TabPage - , public VclBuilderContainer +class BibGeneralPage : public InterimItemWindow , public BibShortCutHandler { - VclPtr<VclGrid> pGrid; - VclPtr<VclScrolledWindow> pScrolledWindow; - - VclPtr<FixedText> pIdentifierFT; - VclPtr<FixedText> pAuthTypeFT; - VclPtr<FixedText> pYearFT; - - VclPtr<FixedText> pAuthorFT; - VclPtr<FixedText> pTitleFT; - - VclPtr<FixedText> pPublisherFT; - VclPtr<FixedText> pAddressFT; - VclPtr<FixedText> pISBNFT; - - VclPtr<FixedText> pChapterFT; - VclPtr<FixedText> pPagesFT; - - VclPtr<FixedText> pEditorFT; - VclPtr<FixedText> pEditionFT; - - VclPtr<FixedText> pBooktitleFT; - VclPtr<FixedText> pVolumeFT; - VclPtr<FixedText> pHowpublishedFT; - - VclPtr<FixedText> pOrganizationsFT; - VclPtr<FixedText> pInstitutionFT; - VclPtr<FixedText> pSchoolFT; - - VclPtr<FixedText> pReportTypeFT; - VclPtr<FixedText> pMonthFT; - - VclPtr<FixedText> pJournalFT; - VclPtr<FixedText> pNumberFT; - VclPtr<FixedText> pSeriesFT; - - VclPtr<FixedText> pAnnoteFT; - VclPtr<FixedText> pNoteFT; - VclPtr<FixedText> pURLFT; - - VclPtr<FixedText> pCustom1FT; - VclPtr<FixedText> pCustom2FT; - VclPtr<FixedText> pCustom3FT; - VclPtr<FixedText> pCustom4FT; - VclPtr<FixedText> pCustom5FT; - - VclPtr<FixedText> aFixedTexts[ FIELD_COUNT ]; - sal_Int16 nFT2CtrlMap[ FIELD_COUNT ]; - - css::uno::Reference< css::awt::XWindow > - aControls[ FIELD_COUNT ]; + std::unique_ptr<weld::ScrolledWindow> xScrolledWindow; + std::unique_ptr<weld::Widget> xGrid; + + std::unique_ptr<weld::Label> xIdentifierFT; + std::unique_ptr<weld::Entry> xIdentifierED; + + std::unique_ptr<weld::Label> xAuthTypeFT; + std::unique_ptr<weld::ComboBox> xAuthTypeLB; + std::unique_ptr<weld::Label> xYearFT; + std::unique_ptr<weld::Entry> xYearED; + + std::unique_ptr<weld::Label> xAuthorFT; + std::unique_ptr<weld::Entry> xAuthorED; + std::unique_ptr<weld::Label> xTitleFT; + std::unique_ptr<weld::Entry> xTitleED; + + std::unique_ptr<weld::Label> xPublisherFT; + std::unique_ptr<weld::Entry> xPublisherED; + std::unique_ptr<weld::Label> xAddressFT; + std::unique_ptr<weld::Entry> xAddressED; + std::unique_ptr<weld::Label> xISBNFT; + std::unique_ptr<weld::Entry> xISBNED; + + std::unique_ptr<weld::Label> xChapterFT; + std::unique_ptr<weld::Entry> xChapterED; + std::unique_ptr<weld::Label> xPagesFT; + std::unique_ptr<weld::Entry> xPagesED; + + std::unique_ptr<weld::Label> xEditorFT; + std::unique_ptr<weld::Entry> xEditorED; + std::unique_ptr<weld::Label> xEditionFT; + std::unique_ptr<weld::Entry> xEditionED; + + std::unique_ptr<weld::Label> xBooktitleFT; + std::unique_ptr<weld::Entry> xBooktitleED; + std::unique_ptr<weld::Label> xVolumeFT; + std::unique_ptr<weld::Entry> xVolumeED; + std::unique_ptr<weld::Label> xHowpublishedFT; + std::unique_ptr<weld::Entry> xHowpublishedED; + + std::unique_ptr<weld::Label> xOrganizationsFT; + std::unique_ptr<weld::Entry> xOrganizationsED; + std::unique_ptr<weld::Label> xInstitutionFT; + std::unique_ptr<weld::Entry> xInstitutionED; + std::unique_ptr<weld::Label> xSchoolFT; + std::unique_ptr<weld::Entry> xSchoolED; + + std::unique_ptr<weld::Label> xReportTypeFT; + std::unique_ptr<weld::Entry> xReportTypeED; + std::unique_ptr<weld::Label> xMonthFT; + std::unique_ptr<weld::Entry> xMonthED; + + std::unique_ptr<weld::Label> xJournalFT; + std::unique_ptr<weld::Entry> xJournalED; + std::unique_ptr<weld::Label> xNumberFT; + std::unique_ptr<weld::Entry> xNumberED; + std::unique_ptr<weld::Label> xSeriesFT; + std::unique_ptr<weld::Entry> xSeriesED; + + std::unique_ptr<weld::Label> xAnnoteFT; + std::unique_ptr<weld::Entry> xAnnoteED; + std::unique_ptr<weld::Label> xNoteFT; + std::unique_ptr<weld::Entry> xNoteED; + std::unique_ptr<weld::Label> xURLFT; + std::unique_ptr<weld::Entry> xURLED; + + std::unique_ptr<weld::Label> xCustom1FT; + std::unique_ptr<weld::Entry> xCustom1ED; + std::unique_ptr<weld::Label> xCustom2FT; + std::unique_ptr<weld::Entry> xCustom2ED; + std::unique_ptr<weld::Label> xCustom3FT; + std::unique_ptr<weld::Entry> xCustom3ED; + std::unique_ptr<weld::Label> xCustom4FT; + std::unique_ptr<weld::Entry> xCustom4ED; + std::unique_ptr<weld::Label> xCustom5FT; + std::unique_ptr<weld::Entry> xCustom5ED; OUString sTableErrorString; - OUString sTypeColumnName; - - css::uno::Reference< css::awt::XControlContainer > - xCtrlContnr; - - css::uno::Reference< css::form::XBoundComponent > - xLBModel; + std::vector<rtl::Reference<ChangeListener>> maChangeListeners; - css::uno::Reference< css::sdbc::XRowSetListener > - xPosListener; + BibDataManager* pDatMan; - rtl::Reference<BibGeneralPageFocusListener> mxBibGeneralPageFocusListener; + bool AddXControl(const OUString& rName, weld::Entry& rEntry); + bool AddXControl(const OUString& rName, weld::ComboBox& rList); - BibDataManager* pDatMan; + template<class Target> void AddControlWithError(const OUString& rColumnName, const OUString& rColumnUIName, + Target& rWidget, OUString& rErrorString, const OString& rHelpId); - bool - AddXControl( const OUString& rName, FixedText& rLabel, std::string_view sHelpId, - sal_Int16& rIndex, std::vector<vcl::Window*>& rChildren ); + void SaveChanges(); - void AddControlWithError( const OUString& rColumnName, FixedText& rLabel, - OUString& rErrorString, - std::string_view sHelpId, sal_uInt16 nIndexInFTArray, std::vector<vcl::Window*>& rChildren ); + DECL_LINK(GainFocusHdl, weld::Widget&, void); -protected: - void InitFixedTexts(); // create mnemonics and set text an all fixed texts + DECL_LINK(FirstElementKeyInputHdl, const KeyEvent&, bool); + DECL_LINK(LastElementKeyInputHdl, const KeyEvent&, bool); public: BibGeneralPage(vcl::Window* pParent, BibDataManager* pDatMan); virtual ~BibGeneralPage() override; virtual void dispose() override; - inline const OUString& GetErrorString() const; - - inline const css::uno::Reference< css::form::XBoundComponent >& - GetTypeListBoxModel() const; - inline const css::uno::Reference< css::awt::XControlContainer >& - GetControlContainer() const; - - inline BibDataManager* GetDataManager(); - - void CommitActiveControl(); - - void RemoveListeners(); - - virtual void GetFocus() override; - - virtual bool HandleShortCutKey( const KeyEvent& rKeyEvent ) override; // returns true, if key was handled - - /// @throws css::uno::RuntimeException - void focusGained(const css::awt::FocusEvent& rEvent); - /// @throws css::uno::RuntimeException - void focusLost(); + const OUString& GetErrorString() const + { + return sTableErrorString; + } + BibDataManager* GetDataManager() + { + return pDatMan; + } }; - -inline const OUString& BibGeneralPage::GetErrorString() const -{ - return sTableErrorString; -} - -inline const css::uno::Reference< css::form::XBoundComponent >& - BibGeneralPage::GetTypeListBoxModel() const -{ - return xLBModel; -} - -inline const css::uno::Reference< css::awt::XControlContainer >& - BibGeneralPage::GetControlContainer() const -{ - return xCtrlContnr; -} - -inline BibDataManager* BibGeneralPage::GetDataManager() -{ - return pDatMan; -} - #endif diff --git a/extensions/uiconfig/sbibliography/ui/generalpage.ui b/extensions/uiconfig/sbibliography/ui/generalpage.ui index dc22f8702019..cf8db394fa4a 100644 --- a/extensions/uiconfig/sbibliography/ui/generalpage.ui +++ b/extensions/uiconfig/sbibliography/ui/generalpage.ui @@ -1,582 +1,844 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.36.0 --> +<!-- Generated with glade 3.38.2 --> <interface domain="pcr"> <requires lib="gtk+" version="3.20"/> <object class="GtkBox" id="GeneralPage"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="orientation">vertical</property> <child> <object class="GtkScrolledWindow" id="scrolledwindow"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="shadow_type">in</property> + <property name="shadow-type">in</property> <child> - <object class="GtkViewport" id="viewport2"> + <object class="GtkViewport" id="viewport"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">6</property> + <property name="can-focus">False</property> + <property name="border-width">6</property> <child> - <!-- n-columns=1 n-rows=1 --> + <!-- n-columns=6 n-rows=15 --> <object class="GtkGrid" id="grid"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> + <property name="can-focus">False</property> + <property name="row-spacing">6</property> + <property name="column-spacing">12</property> + <property name="row-homogeneous">True</property> <child> <object class="GtkLabel" id="shortname"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="label" translatable="yes" context="generalpage|shortname">_Short name</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">shortnamecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="authtype"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|authtype">_Type</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">authtypecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> + <property name="left-attach">2</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="authors"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|authors">Author(s)</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">authorscontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel" id="publisher"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|publisher">_Publisher</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">publishercontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="left-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="chapter"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|chapter">_Chapter</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">chaptercontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="left-attach">0</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel" id="title"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|title">Tit_le</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">titlecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">1</property> + <property name="left-attach">2</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkLabel" id="address"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|address">A_ddress</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">addresscontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">2</property> + <property name="left-attach">2</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="pages"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|pages">Pa_ge(s)</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">pagescontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">3</property> + <property name="left-attach">2</property> + <property name="top-attach">3</property> </packing> </child> <child> <object class="GtkLabel" id="year"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|year">_Year</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">yearcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">0</property> + <property name="left-attach">4</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkLabel" id="isbn"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|isbn">_ISBN</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">isbncontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">2</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box1"> - <property name="width_request">12</property> - <property name="height_request">12</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> + <property name="left-attach">4</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkLabel" id="editor"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|editor">Editor</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">editorcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">5</property> + <property name="left-attach">0</property> + <property name="top-attach">5</property> </packing> </child> <child> <object class="GtkLabel" id="booktitle"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|booktitle">_Book title</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">booktitlecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">6</property> + <property name="left-attach">0</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkLabel" id="edition"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|edition">Ed_ition</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">editioncontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">5</property> + <property name="left-attach">2</property> + <property name="top-attach">5</property> </packing> </child> <child> <object class="GtkLabel" id="volume"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|volume">Volume</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">volumecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">6</property> + <property name="left-attach">2</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkLabel" id="institution"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|institution">Instit_ution</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">institutioncontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">7</property> + <property name="left-attach">2</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkLabel" id="month"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|month">_Month</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">monthcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">8</property> + <property name="left-attach">2</property> + <property name="top-attach">8</property> </packing> </child> <child> <object class="GtkLabel" id="publicationtype"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|publicationtype">Publication t_ype</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">publicationtypecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">6</property> + <property name="left-attach">4</property> + <property name="top-attach">6</property> </packing> </child> <child> <object class="GtkLabel" id="university"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|university">University</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">universitycontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">7</property> + <property name="left-attach">4</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkLabel" id="reporttype"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|reporttype">Type of re_port</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">reporttypecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">8</property> + <property name="left-attach">0</property> + <property name="top-attach">8</property> </packing> </child> <child> <object class="GtkLabel" id="organization"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|organization">Organi_zation</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">organizationcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">7</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box2"> - <property name="width_request">12</property> - <property name="height_request">12</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">9</property> + <property name="left-attach">0</property> + <property name="top-attach">7</property> </packing> </child> <child> <object class="GtkLabel" id="journal"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|journal">_Journal</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">journalcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">10</property> + <property name="left-attach">0</property> + <property name="top-attach">10</property> </packing> </child> <child> <object class="GtkLabel" id="annotation"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|annotation">Ann_otation</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">annotationcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">11</property> + <property name="left-attach">0</property> + <property name="top-attach">11</property> </packing> </child> <child> <object class="GtkLabel" id="number"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|number">Numb_er</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">numbercontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">10</property> + <property name="left-attach">2</property> + <property name="top-attach">10</property> </packing> </child> <child> <object class="GtkLabel" id="note"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|note">_Note</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">notecontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">11</property> + <property name="left-attach">2</property> + <property name="top-attach">11</property> </packing> </child> <child> <object class="GtkLabel" id="series"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|series">Se_ries</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">seriescontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">10</property> + <property name="left-attach">4</property> + <property name="top-attach">10</property> </packing> </child> <child> <object class="GtkLabel" id="url"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|url">URL</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">urlcontrol</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">11</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box3"> - <property name="width_request">12</property> - <property name="height_request">12</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">12</property> + <property name="left-attach">4</property> + <property name="top-attach">11</property> </packing> </child> <child> <object class="GtkLabel" id="custom1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|custom1">User-defined field _1</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom1control</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">13</property> + <property name="left-attach">0</property> + <property name="top-attach">13</property> </packing> </child> <child> <object class="GtkLabel" id="custom4"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|custom4">User-defined field _4</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom4control</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">14</property> + <property name="left-attach">0</property> + <property name="top-attach">14</property> </packing> </child> <child> <object class="GtkLabel" id="custom2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|custom2">User-defined field _2</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom2control</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">13</property> + <property name="left-attach">2</property> + <property name="top-attach">13</property> </packing> </child> <child> <object class="GtkLabel" id="custom5"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|custom5">User-defined field _5</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom5control</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">2</property> - <property name="top_attach">14</property> + <property name="left-attach">2</property> + <property name="top-attach">14</property> </packing> </child> <child> <object class="GtkLabel" id="custom3"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="generalpage|custom3">User-defined field _3</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">custom3control</property> <property name="xalign">1</property> </object> <packing> - <property name="left_attach">4</property> - <property name="top_attach">13</property> + <property name="left-attach">4</property> + <property name="top-attach">13</property> </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="shortnamecontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">0</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="titlecontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">1</property> + <property name="width">3</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="yearcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">0</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="authorscontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">1</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="publishercontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">2</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="addresscontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">2</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="isbncontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">2</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkComboBoxText" id="authtypecontrol"> + <property name="visible">True</property> + <property name="can-focus">False</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">0</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="chaptercontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">3</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="pagescontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">3</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="editorcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">5</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="editioncontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">5</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="booktitlecontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">6</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="volumecontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">6</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="publicationtypecontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">6</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="organizationcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">7</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="institutioncontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">7</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="universitycontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">7</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="reporttypecontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">8</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="monthcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">8</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="journalcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">10</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="annotationcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">11</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="numbercontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">10</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="notecontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">11</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="seriescontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">10</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="urlcontrol"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">11</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="custom1control"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">13</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="custom4control"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">14</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="custom2control"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">13</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="custom5control"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">3</property> + <property name="top-attach">14</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="custom3control"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">5</property> + <property name="top-attach">13</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="valign">center</property> + <property name="vexpand">False</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">4</property> + <property name="width">6</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="valign">center</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">12</property> + <property name="width">6</property> + </packing> + </child> + <child> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="valign">center</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">9</property> + <property name="width">6</property> + </packing> </child> <child> <placeholder/> diff --git a/solenv/sanitizers/ui/modules/sbibliography.suppr b/solenv/sanitizers/ui/modules/sbibliography.suppr index 802bc5d83d16..e69de29bb2d1 100644 --- a/solenv/sanitizers/ui/modules/sbibliography.suppr +++ b/solenv/sanitizers/ui/modules/sbibliography.suppr @@ -1,31 +0,0 @@ -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='shortname'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='authtype'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='authors'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='publisher'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='chapter'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='title'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='address'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='pages'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='year'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='isbn'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='editor'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='booktitle'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='edition'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='volume'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='institution'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='month'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='publicationtype'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='university'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='reporttype'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='organization'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='journal'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='annotation'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='number'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='note'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='series'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='url'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='custom1'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='custom4'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='custom2'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='custom5'] orphan-label -extensions/uiconfig/sbibliography/ui/generalpage.ui://GtkLabel[@id='custom3'] orphan-label |