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>
This commit is contained in:
parent
f732897634
commit
ce5cf53a66
6 changed files with 1097 additions and 955 deletions
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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;
|
||||
std::unique_ptr<weld::ScrolledWindow> xScrolledWindow;
|
||||
std::unique_ptr<weld::Widget> xGrid;
|
||||
|
||||
VclPtr<FixedText> pIdentifierFT;
|
||||
VclPtr<FixedText> pAuthTypeFT;
|
||||
VclPtr<FixedText> pYearFT;
|
||||
std::unique_ptr<weld::Label> xIdentifierFT;
|
||||
std::unique_ptr<weld::Entry> xIdentifierED;
|
||||
|
||||
VclPtr<FixedText> pAuthorFT;
|
||||
VclPtr<FixedText> pTitleFT;
|
||||
std::unique_ptr<weld::Label> xAuthTypeFT;
|
||||
std::unique_ptr<weld::ComboBox> xAuthTypeLB;
|
||||
std::unique_ptr<weld::Label> xYearFT;
|
||||
std::unique_ptr<weld::Entry> xYearED;
|
||||
|
||||
VclPtr<FixedText> pPublisherFT;
|
||||
VclPtr<FixedText> pAddressFT;
|
||||
VclPtr<FixedText> pISBNFT;
|
||||
std::unique_ptr<weld::Label> xAuthorFT;
|
||||
std::unique_ptr<weld::Entry> xAuthorED;
|
||||
std::unique_ptr<weld::Label> xTitleFT;
|
||||
std::unique_ptr<weld::Entry> xTitleED;
|
||||
|
||||
VclPtr<FixedText> pChapterFT;
|
||||
VclPtr<FixedText> pPagesFT;
|
||||
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;
|
||||
|
||||
VclPtr<FixedText> pEditorFT;
|
||||
VclPtr<FixedText> pEditionFT;
|
||||
std::unique_ptr<weld::Label> xChapterFT;
|
||||
std::unique_ptr<weld::Entry> xChapterED;
|
||||
std::unique_ptr<weld::Label> xPagesFT;
|
||||
std::unique_ptr<weld::Entry> xPagesED;
|
||||
|
||||
VclPtr<FixedText> pBooktitleFT;
|
||||
VclPtr<FixedText> pVolumeFT;
|
||||
VclPtr<FixedText> pHowpublishedFT;
|
||||
std::unique_ptr<weld::Label> xEditorFT;
|
||||
std::unique_ptr<weld::Entry> xEditorED;
|
||||
std::unique_ptr<weld::Label> xEditionFT;
|
||||
std::unique_ptr<weld::Entry> xEditionED;
|
||||
|
||||
VclPtr<FixedText> pOrganizationsFT;
|
||||
VclPtr<FixedText> pInstitutionFT;
|
||||
VclPtr<FixedText> pSchoolFT;
|
||||
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;
|
||||
|
||||
VclPtr<FixedText> pReportTypeFT;
|
||||
VclPtr<FixedText> pMonthFT;
|
||||
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;
|
||||
|
||||
VclPtr<FixedText> pJournalFT;
|
||||
VclPtr<FixedText> pNumberFT;
|
||||
VclPtr<FixedText> pSeriesFT;
|
||||
std::unique_ptr<weld::Label> xReportTypeFT;
|
||||
std::unique_ptr<weld::Entry> xReportTypeED;
|
||||
std::unique_ptr<weld::Label> xMonthFT;
|
||||
std::unique_ptr<weld::Entry> xMonthED;
|
||||
|
||||
VclPtr<FixedText> pAnnoteFT;
|
||||
VclPtr<FixedText> pNoteFT;
|
||||
VclPtr<FixedText> pURLFT;
|
||||
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;
|
||||
|
||||
VclPtr<FixedText> pCustom1FT;
|
||||
VclPtr<FixedText> pCustom2FT;
|
||||
VclPtr<FixedText> pCustom3FT;
|
||||
VclPtr<FixedText> pCustom4FT;
|
||||
VclPtr<FixedText> pCustom5FT;
|
||||
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;
|
||||
|
||||
VclPtr<FixedText> aFixedTexts[ FIELD_COUNT ];
|
||||
sal_Int16 nFT2CtrlMap[ FIELD_COUNT ];
|
||||
|
||||
css::uno::Reference< css::awt::XWindow >
|
||||
aControls[ FIELD_COUNT ];
|
||||
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;
|
||||
|
||||
css::uno::Reference< css::sdbc::XRowSetListener >
|
||||
xPosListener;
|
||||
|
||||
rtl::Reference<BibGeneralPageFocusListener> mxBibGeneralPageFocusListener;
|
||||
std::vector<rtl::Reference<ChangeListener>> maChangeListeners;
|
||||
|
||||
BibDataManager* pDatMan;
|
||||
|
||||
bool
|
||||
AddXControl( const OUString& rName, FixedText& rLabel, std::string_view sHelpId,
|
||||
sal_Int16& rIndex, std::vector<vcl::Window*>& rChildren );
|
||||
bool AddXControl(const OUString& rName, weld::Entry& rEntry);
|
||||
bool AddXControl(const OUString& rName, weld::ComboBox& rList);
|
||||
|
||||
void AddControlWithError( const OUString& rColumnName, FixedText& rLabel,
|
||||
OUString& rErrorString,
|
||||
std::string_view sHelpId, sal_uInt16 nIndexInFTArray, std::vector<vcl::Window*>& rChildren );
|
||||
template<class Target> void AddControlWithError(const OUString& rColumnName, const OUString& rColumnUIName,
|
||||
Target& rWidget, OUString& rErrorString, const OString& rHelpId);
|
||||
|
||||
protected:
|
||||
void InitFixedTexts(); // create mnemonics and set text an all fixed texts
|
||||
void SaveChanges();
|
||||
|
||||
DECL_LINK(GainFocusHdl, weld::Widget&, void);
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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
|
Loading…
Reference in a new issue