Kaydet (Commit) f46ece54 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld FormLinkDialog

Change-Id: I440089f650aea87eab21c148e713a8716e55f2bb
Reviewed-on: https://gerrit.libreoffice.org/73002
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 28fc6e2d
...@@ -12,7 +12,6 @@ $(eval $(call gb_UIConfig_UIConfig,modules/spropctrlr)) ...@@ -12,7 +12,6 @@ $(eval $(call gb_UIConfig_UIConfig,modules/spropctrlr))
$(eval $(call gb_UIConfig_add_uifiles,modules/spropctrlr,\ $(eval $(call gb_UIConfig_add_uifiles,modules/spropctrlr,\
extensions/uiconfig/spropctrlr/ui/controlfontdialog \ extensions/uiconfig/spropctrlr/ui/controlfontdialog \
extensions/uiconfig/spropctrlr/ui/datatypedialog \ extensions/uiconfig/spropctrlr/ui/datatypedialog \
extensions/uiconfig/spropctrlr/ui/fieldlinkrow \
extensions/uiconfig/spropctrlr/ui/formlinksdialog \ extensions/uiconfig/spropctrlr/ui/formlinksdialog \
extensions/uiconfig/spropctrlr/ui/labelselectiondialog \ extensions/uiconfig/spropctrlr/ui/labelselectiondialog \
extensions/uiconfig/spropctrlr/ui/listselectdialog \ extensions/uiconfig/spropctrlr/ui/listselectdialog \
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <toolkit/helper/vclunohelper.hxx>
#include <sal/log.hxx> #include <sal/log.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
#include <vcl/svapp.hxx>
#include "MasterDetailLinkDialog.hxx" #include "MasterDetailLinkDialog.hxx"
#include "formlinkdialog.hxx" #include "formlinkdialog.hxx"
#include "pcrservices.hxx" #include "pcrservices.hxx"
...@@ -102,8 +102,9 @@ namespace pcr ...@@ -102,8 +102,9 @@ namespace pcr
svt::OGenericUnoDialog::Dialog MasterDetailLinkDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) svt::OGenericUnoDialog::Dialog MasterDetailLinkDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
{ {
return svt::OGenericUnoDialog::Dialog(VclPtr<FormLinkDialog>::Create(VCLUnoHelper::GetWindow(rParent),m_xDetail,m_xMaster, m_aContext return svt::OGenericUnoDialog::Dialog(std::make_unique<FormLinkDialog>(Application::GetFrameWeld(rParent), m_xDetail,
,m_sExplanation,m_sDetailLabel,m_sMasterLabel)); m_xMaster, m_aContext, m_sExplanation,
m_sDetailLabel, m_sMasterLabel));
} }
void MasterDetailLinkDialog::implInitialize(const Any& _rValue) void MasterDetailLinkDialog::implInitialize(const Any& _rValue)
......
...@@ -2673,13 +2673,11 @@ namespace pcr ...@@ -2673,13 +2673,11 @@ namespace pcr
if ( !xDetailForm.is() || !xMasterForm.is() ) if ( !xDetailForm.is() || !xMasterForm.is() )
return false; return false;
FormLinkDialog aDialog(impl_getDefaultDialogFrame_nothrow(), m_xComponent, xMasterProp, m_xContext);
ScopedVclPtrInstance< FormLinkDialog > aDialog( impl_getDefaultDialogParent_nothrow(), m_xComponent, xMasterProp, m_xContext );
_rClearBeforeDialog.clear(); _rClearBeforeDialog.clear();
return ( RET_OK == aDialog->Execute() ); return ( RET_OK == aDialog.run() );
} }
bool FormComponentPropertyHandler::impl_dialogFormatting_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const bool FormComponentPropertyHandler::impl_dialogFormatting_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
{ {
bool bChanged = false; bool bChanged = false;
......
...@@ -60,18 +60,18 @@ namespace pcr ...@@ -60,18 +60,18 @@ namespace pcr
//= FieldLinkRow //= FieldLinkRow
class FieldLinkRow : public TabPage class FieldLinkRow
{ {
private: private:
VclPtr<ComboBox> m_pDetailColumn; std::unique_ptr<weld::ComboBox> m_xDetailColumn;
VclPtr<ComboBox> m_pMasterColumn; std::unique_ptr<weld::ComboBox> m_xMasterColumn;
Link<FieldLinkRow&,void> m_aLinkChangeHandler; Link<FieldLinkRow&,void> m_aLinkChangeHandler;
public: public:
explicit FieldLinkRow( vcl::Window* _pParent ); FieldLinkRow(std::unique_ptr<weld::ComboBox> xDetailColumn,
virtual ~FieldLinkRow() override; std::unique_ptr<weld::ComboBox> xMasterColumn);
virtual void dispose() override;
void SetLinkChangeHandler( const Link<FieldLinkRow&,void>& _rHdl ) { m_aLinkChangeHandler = _rHdl; } void SetLinkChangeHandler( const Link<FieldLinkRow&,void>& _rHdl ) { m_aLinkChangeHandler = _rHdl; }
...@@ -88,132 +88,103 @@ namespace pcr ...@@ -88,132 +88,103 @@ namespace pcr
void fillList( LinkParticipant _eWhich, const Sequence< OUString >& _rFieldNames ); void fillList( LinkParticipant _eWhich, const Sequence< OUString >& _rFieldNames );
void Show()
{
m_xDetailColumn->show();
m_xMasterColumn->show();
}
private: private:
DECL_LINK( OnFieldNameChanged, Edit&, void ); DECL_LINK( OnFieldNameChanged, weld::ComboBox&, void );
}; };
FieldLinkRow::FieldLinkRow( vcl::Window* _pParent ) FieldLinkRow::FieldLinkRow(std::unique_ptr<weld::ComboBox> xDetailColumn,
:TabPage( _pParent, "FieldLinkRow", "modules/spropctrlr/ui/fieldlinkrow.ui" ) std::unique_ptr<weld::ComboBox> xMasterColumn)
: m_xDetailColumn(std::move(xDetailColumn))
, m_xMasterColumn(std::move(xMasterColumn))
{ {
get(m_pDetailColumn, "detailCombobox"); m_xDetailColumn->connect_changed( LINK( this, FieldLinkRow, OnFieldNameChanged ) );
get(m_pMasterColumn, "masterCombobox"); m_xMasterColumn->connect_changed( LINK( this, FieldLinkRow, OnFieldNameChanged ) );
m_pDetailColumn->SetDropDownLineCount( 10 );
m_pMasterColumn->SetDropDownLineCount( 10 );
m_pDetailColumn->SetModifyHdl( LINK( this, FieldLinkRow, OnFieldNameChanged ) );
m_pMasterColumn->SetModifyHdl( LINK( this, FieldLinkRow, OnFieldNameChanged ) );
}
FieldLinkRow::~FieldLinkRow()
{
disposeOnce();
}
void FieldLinkRow::dispose()
{
m_pDetailColumn.clear();
m_pMasterColumn.clear();
TabPage::dispose();
} }
void FieldLinkRow::fillList( LinkParticipant _eWhich, const Sequence< OUString >& _rFieldNames ) void FieldLinkRow::fillList( LinkParticipant _eWhich, const Sequence< OUString >& _rFieldNames )
{ {
ComboBox* pBox = ( _eWhich == eDetailField ) ? m_pDetailColumn.get() : m_pMasterColumn.get(); weld::ComboBox* pBox = ( _eWhich == eDetailField ) ? m_xDetailColumn.get() : m_xMasterColumn.get();
const OUString* pFieldName = _rFieldNames.getConstArray(); const OUString* pFieldName = _rFieldNames.getConstArray();
const OUString* pFieldNameEnd = pFieldName + _rFieldNames.getLength(); const OUString* pFieldNameEnd = pFieldName + _rFieldNames.getLength();
for ( ; pFieldName != pFieldNameEnd; ++pFieldName ) for ( ; pFieldName != pFieldNameEnd; ++pFieldName )
pBox->InsertEntry( *pFieldName ); pBox->append_text( *pFieldName );
} }
bool FieldLinkRow::GetFieldName( LinkParticipant _eWhich, OUString& /* [out] */ _rName ) const bool FieldLinkRow::GetFieldName( LinkParticipant _eWhich, OUString& /* [out] */ _rName ) const
{ {
const ComboBox* pBox = ( _eWhich == eDetailField ) ? m_pDetailColumn : m_pMasterColumn; const weld::ComboBox* pBox = ( _eWhich == eDetailField ) ? m_xDetailColumn.get() : m_xMasterColumn.get();
_rName = pBox->GetText(); _rName = pBox->get_active_text();
return !_rName.isEmpty(); return !_rName.isEmpty();
} }
void FieldLinkRow::SetFieldName( LinkParticipant _eWhich, const OUString& _rName ) void FieldLinkRow::SetFieldName( LinkParticipant _eWhich, const OUString& _rName )
{ {
ComboBox* pBox = ( _eWhich == eDetailField ) ? m_pDetailColumn.get() : m_pMasterColumn.get(); weld::ComboBox* pBox = ( _eWhich == eDetailField ) ? m_xDetailColumn.get() : m_xMasterColumn.get();
pBox->SetText( _rName ); pBox->set_entry_text( _rName );
} }
IMPL_LINK_NOARG( FieldLinkRow, OnFieldNameChanged, weld::ComboBox&, void )
IMPL_LINK_NOARG( FieldLinkRow, OnFieldNameChanged, Edit&, void )
{ {
m_aLinkChangeHandler.Call( *this ); m_aLinkChangeHandler.Call( *this );
} }
VCL_BUILDER_FACTORY(FieldLinkRow)
//= FormLinkDialog //= FormLinkDialog
FormLinkDialog::FormLinkDialog( vcl::Window* _pParent, const Reference< XPropertySet >& _rxDetailForm, FormLinkDialog::FormLinkDialog(weld::Window* _pParent, const Reference< XPropertySet >& _rxDetailForm,
const Reference< XPropertySet >& _rxMasterForm, const Reference< XComponentContext >& _rxContext, const Reference< XPropertySet >& _rxMasterForm, const Reference< XComponentContext >& _rxContext,
const OUString& _sExplanation, const OUString& _sExplanation,
const OUString& _sDetailLabel, const OUString& _sDetailLabel,
const OUString& _sMasterLabel) const OUString& _sMasterLabel)
:ModalDialog( _pParent, "FormLinks", "modules/spropctrlr/ui/formlinksdialog.ui" ) : GenericDialogController(_pParent, "modules/spropctrlr/ui/formlinksdialog.ui", "FormLinks")
,m_aRow1 ( VclPtr<FieldLinkRow>::Create( get<VclVBox>("box") ) ) , m_xContext ( _rxContext )
,m_aRow2 ( VclPtr<FieldLinkRow>::Create( get<VclVBox>("box") ) ) , m_xDetailForm( _rxDetailForm )
,m_aRow3 ( VclPtr<FieldLinkRow>::Create( get<VclVBox>("box") ) ) , m_xMasterForm( _rxMasterForm )
,m_aRow4 ( VclPtr<FieldLinkRow>::Create( get<VclVBox>("box") ) ) , m_sDetailLabel(_sDetailLabel)
,m_xContext ( _rxContext ) , m_sMasterLabel(_sMasterLabel)
,m_xDetailForm( _rxDetailForm ) , m_xExplanation(m_xBuilder->weld_label("explanationLabel"))
,m_xMasterForm( _rxMasterForm ) , m_xDetailLabel(m_xBuilder->weld_label("detailLabel"))
,m_sDetailLabel(_sDetailLabel) , m_xMasterLabel(m_xBuilder->weld_label("masterLabel"))
,m_sMasterLabel(_sMasterLabel) , m_xRow1(std::make_unique<FieldLinkRow>(m_xBuilder->weld_combo_box("detailCombobox1"),
m_xBuilder->weld_combo_box("masterCombobox1")))
, m_xRow2(std::make_unique<FieldLinkRow>(m_xBuilder->weld_combo_box("detailCombobox2"),
m_xBuilder->weld_combo_box("masterCombobox2")))
, m_xRow3(std::make_unique<FieldLinkRow>(m_xBuilder->weld_combo_box("detailCombobox3"),
m_xBuilder->weld_combo_box("masterCombobox3")))
, m_xRow4(std::make_unique<FieldLinkRow>(m_xBuilder->weld_combo_box("detailCombobox4"),
m_xBuilder->weld_combo_box("masterCombobox4")))
, m_xOK(m_xBuilder->weld_button("ok"))
, m_xSuggest(m_xBuilder->weld_button("suggestButton"))
{ {
get(m_pExplanation, "explanationLabel"); m_xRow1->Show();
get(m_pDetailLabel, "detailLabel"); m_xRow2->Show();
get(m_pMasterLabel, "masterLabel"); m_xRow3->Show();
get(m_pOK, "ok"); m_xRow4->Show();
get(m_pSuggest, "suggestButton"); m_xDialog->set_size_request(600, -1);
m_aRow1->Show();
m_aRow2->Show();
m_aRow3->Show();
m_aRow4->Show();
set_width_request(600);
if ( !_sExplanation.isEmpty() ) if ( !_sExplanation.isEmpty() )
m_pExplanation->SetText(_sExplanation); m_xExplanation->set_label(_sExplanation);
m_pSuggest->SetClickHdl ( LINK( this, FormLinkDialog, OnSuggest ) ); m_xSuggest->connect_clicked(LINK(this, FormLinkDialog, OnSuggest));
m_aRow1->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) ); m_xRow1->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) );
m_aRow2->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) ); m_xRow2->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) );
m_aRow3->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) ); m_xRow3->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) );
m_aRow4->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) ); m_xRow4->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) );
PostUserEvent( LINK( this, FormLinkDialog, OnInitialize ), nullptr, true ); Application::PostUserEvent(LINK(this, FormLinkDialog, OnInitialize));
updateOkButton(); updateOkButton();
} }
FormLinkDialog::~FormLinkDialog()
FormLinkDialog::~FormLinkDialog( )
{ {
disposeOnce();
}
void FormLinkDialog::dispose( )
{
m_pExplanation.clear();
m_pDetailLabel.clear();
m_pMasterLabel.clear();
m_pOK.clear();
m_pSuggest.clear();
m_aRow1.disposeAndClear();
m_aRow2.disposeAndClear();
m_aRow3.disposeAndClear();
m_aRow4.disposeAndClear();
ModalDialog::dispose();
} }
void FormLinkDialog::commitLinkPairs() void FormLinkDialog::commitLinkPairs()
...@@ -223,7 +194,7 @@ namespace pcr ...@@ -223,7 +194,7 @@ namespace pcr
std::vector< OUString > aMasterFields; aMasterFields.reserve( 4 ); std::vector< OUString > aMasterFields; aMasterFields.reserve( 4 );
const FieldLinkRow* aRows[] = { const FieldLinkRow* aRows[] = {
m_aRow1.get(), m_aRow2.get(), m_aRow3.get(), m_aRow4.get() m_xRow1.get(), m_xRow2.get(), m_xRow3.get(), m_xRow4.get()
}; };
for (const FieldLinkRow* aRow : aRows) for (const FieldLinkRow* aRow : aRows)
...@@ -254,10 +225,9 @@ namespace pcr ...@@ -254,10 +225,9 @@ namespace pcr
} }
} }
short FormLinkDialog::run()
short FormLinkDialog::Execute()
{ {
short nResult = ModalDialog::Execute(); short nResult = GenericDialogController::run();
if ( RET_OK == nResult ) if ( RET_OK == nResult )
commitLinkPairs(); commitLinkPairs();
...@@ -265,7 +235,6 @@ namespace pcr ...@@ -265,7 +235,6 @@ namespace pcr
return nResult; return nResult;
} }
void FormLinkDialog::initializeFieldLists() void FormLinkDialog::initializeFieldLists()
{ {
Sequence< OUString > sDetailFields; Sequence< OUString > sDetailFields;
...@@ -275,7 +244,7 @@ namespace pcr ...@@ -275,7 +244,7 @@ namespace pcr
getFormFields( m_xMasterForm, sMasterFields ); getFormFields( m_xMasterForm, sMasterFields );
FieldLinkRow* aRows[] = { FieldLinkRow* aRows[] = {
m_aRow1.get(), m_aRow2.get(), m_aRow3.get(), m_aRow4.get() m_xRow1.get(), m_xRow2.get(), m_xRow3.get(), m_xRow4.get()
}; };
for (FieldLinkRow* aRow : aRows) for (FieldLinkRow* aRow : aRows)
{ {
...@@ -298,7 +267,7 @@ namespace pcr ...@@ -298,7 +267,7 @@ namespace pcr
} }
sDetailType = m_sDetailLabel; sDetailType = m_sDetailLabel;
} }
m_pDetailLabel->SetText( sDetailType ); m_xDetailLabel->set_label( sDetailType );
// label for the master form // label for the master form
OUString sMasterType = getFormDataSourceType( m_xMasterForm ); OUString sMasterType = getFormDataSourceType( m_xMasterForm );
...@@ -310,10 +279,9 @@ namespace pcr ...@@ -310,10 +279,9 @@ namespace pcr
} }
sMasterType = m_sMasterLabel; sMasterType = m_sMasterLabel;
} }
m_pMasterLabel->SetText( sMasterType ); m_xMasterLabel->set_label( sMasterType );
} }
void FormLinkDialog::initializeFieldRowsFrom( std::vector< OUString >& _rDetailFields, std::vector< OUString >& _rMasterFields ) void FormLinkDialog::initializeFieldRowsFrom( std::vector< OUString >& _rDetailFields, std::vector< OUString >& _rMasterFields )
{ {
// our UI does allow 4 fields max // our UI does allow 4 fields max
...@@ -321,7 +289,7 @@ namespace pcr ...@@ -321,7 +289,7 @@ namespace pcr
_rMasterFields.resize( 4 ); _rMasterFields.resize( 4 );
FieldLinkRow* aRows[] = { FieldLinkRow* aRows[] = {
m_aRow1.get(), m_aRow2.get(), m_aRow3.get(), m_aRow4.get() m_xRow1.get(), m_xRow2.get(), m_xRow3.get(), m_xRow4.get()
}; };
for ( sal_Int32 i = 0; i < 4; ++i ) for ( sal_Int32 i = 0; i < 4; ++i )
{ {
...@@ -366,7 +334,7 @@ namespace pcr ...@@ -366,7 +334,7 @@ namespace pcr
bool bEnable = true; bool bEnable = true;
const FieldLinkRow* aRows[] = { const FieldLinkRow* aRows[] = {
m_aRow1.get(), m_aRow2.get(), m_aRow3.get(), m_aRow4.get() m_xRow1.get(), m_xRow2.get(), m_xRow3.get(), m_xRow4.get()
}; };
for ( sal_Int32 i = 0; ( i < 4 ) && bEnable; ++i ) for ( sal_Int32 i = 0; ( i < 4 ) && bEnable; ++i )
...@@ -378,10 +346,9 @@ namespace pcr ...@@ -378,10 +346,9 @@ namespace pcr
bEnable = false; bEnable = false;
} }
m_pOK->Enable( bEnable ); m_xOK->set_sensitive(bEnable);
} }
OUString FormLinkDialog::getFormDataSourceType( const Reference< XPropertySet >& _rxForm ) OUString FormLinkDialog::getFormDataSourceType( const Reference< XPropertySet >& _rxForm )
{ {
OUString sReturn; OUString sReturn;
...@@ -408,7 +375,6 @@ namespace pcr ...@@ -408,7 +375,6 @@ namespace pcr
return sReturn; return sReturn;
} }
void FormLinkDialog::getFormFields( const Reference< XPropertySet >& _rxForm, Sequence< OUString >& /* [out] */ _rNames ) const void FormLinkDialog::getFormFields( const Reference< XPropertySet >& _rxForm, Sequence< OUString >& /* [out] */ _rNames ) const
{ {
_rNames.realloc( 0 ); _rNames.realloc( 0 );
...@@ -417,7 +383,7 @@ namespace pcr ...@@ -417,7 +383,7 @@ namespace pcr
OUString sCommand; OUString sCommand;
try try
{ {
WaitObject aWaitCursor( const_cast< FormLinkDialog* >( this ) ); weld::WaitObject aWaitCursor(m_xDialog.get());
OSL_ENSURE( _rxForm.is(), "FormLinkDialog::getFormFields: invalid form!" ); OSL_ENSURE( _rxForm.is(), "FormLinkDialog::getFormFields: invalid form!" );
...@@ -455,11 +421,10 @@ namespace pcr ...@@ -455,11 +421,10 @@ namespace pcr
SQLContext aContext; SQLContext aContext;
aContext.Message = sErrorMessage; aContext.Message = sErrorMessage;
aContext.NextException = aErrorInfo.get(); aContext.NextException = aErrorInfo.get();
::dbtools::showError( aContext, VCLUnoHelper::GetInterface( const_cast< FormLinkDialog* >( this ) ), m_xContext ); ::dbtools::showError(aContext, m_xDialog->GetXWindow(), m_xContext);
} }
} }
void FormLinkDialog::ensureFormConnection( const Reference< XPropertySet >& _rxFormProps, Reference< XConnection >& /* [out] */ _rxConnection ) const void FormLinkDialog::ensureFormConnection( const Reference< XPropertySet >& _rxFormProps, Reference< XConnection >& /* [out] */ _rxConnection ) const
{ {
OSL_PRECOND( _rxFormProps.is(), "FormLinkDialog::ensureFormConnection: invalid form!" ); OSL_PRECOND( _rxFormProps.is(), "FormLinkDialog::ensureFormConnection: invalid form!" );
...@@ -641,7 +606,7 @@ namespace pcr ...@@ -641,7 +606,7 @@ namespace pcr
bEnable = ( m_aRelationMasterColumns.size() <= 4 ); bEnable = ( m_aRelationMasterColumns.size() <= 4 );
} }
m_pSuggest->Enable( bEnable ); m_xSuggest->set_sensitive(bEnable);
} }
catch( const Exception& ) catch( const Exception& )
{ {
...@@ -649,19 +614,16 @@ namespace pcr ...@@ -649,19 +614,16 @@ namespace pcr
} }
} }
IMPL_LINK_NOARG( FormLinkDialog, OnSuggest, weld::Button&, void )
IMPL_LINK_NOARG( FormLinkDialog, OnSuggest, Button*, void )
{ {
initializeFieldRowsFrom( m_aRelationDetailColumns, m_aRelationMasterColumns ); initializeFieldRowsFrom( m_aRelationDetailColumns, m_aRelationMasterColumns );
} }
IMPL_LINK_NOARG( FormLinkDialog, OnFieldChanged, FieldLinkRow&, void ) IMPL_LINK_NOARG( FormLinkDialog, OnFieldChanged, FieldLinkRow&, void )
{ {
updateOkButton(); updateOkButton();
} }
IMPL_LINK_NOARG( FormLinkDialog, OnInitialize, void*, void ) IMPL_LINK_NOARG( FormLinkDialog, OnInitialize, void*, void )
{ {
initializeColumnLabels(); initializeColumnLabels();
......
...@@ -20,9 +20,7 @@ ...@@ -20,9 +20,7 @@
#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX #ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
#include <vcl/dialog.hxx> #include <vcl/weld.hxx>
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
#include <com/sun/star/form/XForm.hpp> #include <com/sun/star/form/XForm.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
...@@ -35,25 +33,13 @@ ...@@ -35,25 +33,13 @@
namespace pcr namespace pcr
{ {
class FieldLinkRow; class FieldLinkRow;
//= FormLinkDialog //= FormLinkDialog
class FormLinkDialog : public ModalDialog class FormLinkDialog : public weld::GenericDialogController
{ {
private: private:
VclPtr<FixedText> m_pExplanation;
VclPtr<FixedText> m_pDetailLabel;
VclPtr<FixedText> m_pMasterLabel;
VclPtr<FieldLinkRow> m_aRow1;
VclPtr<FieldLinkRow> m_aRow2;
VclPtr<FieldLinkRow> m_aRow3;
VclPtr<FieldLinkRow> m_aRow4;
VclPtr<OKButton> m_pOK;
VclPtr<PushButton> m_pSuggest;
css::uno::Reference< css::uno::XComponentContext > css::uno::Reference< css::uno::XComponentContext >
m_xContext; m_xContext;
css::uno::Reference< css::beans::XPropertySet > css::uno::Reference< css::beans::XPropertySet >
...@@ -67,9 +53,19 @@ namespace pcr ...@@ -67,9 +53,19 @@ namespace pcr
OUString m_sDetailLabel; OUString m_sDetailLabel;
OUString m_sMasterLabel; OUString m_sMasterLabel;
std::unique_ptr<weld::Label> m_xExplanation;
std::unique_ptr<weld::Label> m_xDetailLabel;
std::unique_ptr<weld::Label> m_xMasterLabel;
std::unique_ptr<FieldLinkRow> m_xRow1;
std::unique_ptr<FieldLinkRow> m_xRow2;
std::unique_ptr<FieldLinkRow> m_xRow3;
std::unique_ptr<FieldLinkRow> m_xRow4;
std::unique_ptr<weld::Button> m_xOK;
std::unique_ptr<weld::Button> m_xSuggest;
public: public:
FormLinkDialog( FormLinkDialog(
vcl::Window* _pParent, weld::Window* _pParent,
const css::uno::Reference< css::beans::XPropertySet >& _rxDetailForm, const css::uno::Reference< css::beans::XPropertySet >& _rxDetailForm,
const css::uno::Reference< css::beans::XPropertySet >& _rxMasterForm, const css::uno::Reference< css::beans::XPropertySet >& _rxMasterForm,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext, const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
...@@ -77,14 +73,14 @@ namespace pcr ...@@ -77,14 +73,14 @@ namespace pcr
const OUString& _sDetailLabel = OUString(), const OUString& _sDetailLabel = OUString(),
const OUString& _sMasterLabel = OUString() const OUString& _sMasterLabel = OUString()
); );
virtual ~FormLinkDialog( ) override;
virtual void dispose() override; virtual ~FormLinkDialog() override;
// Dialog overridables // Dialog overridables
virtual short Execute() override; virtual short run() override;
private: private:
DECL_LINK( OnSuggest, Button*, void ); DECL_LINK( OnSuggest, weld::Button&, void );
DECL_LINK( OnFieldChanged, FieldLinkRow&, void ); DECL_LINK( OnFieldChanged, FieldLinkRow&, void );
DECL_LINK( OnInitialize, void*, void); DECL_LINK( OnInitialize, void*, void);
...@@ -129,10 +125,8 @@ namespace pcr ...@@ -129,10 +125,8 @@ namespace pcr
); );
}; };
} // namespace pcr } // namespace pcr
#endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="pcr">
<requires lib="gtk+" version="3.18"/>
<object class="GtkBox" id="FieldLinkRow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkComboBoxText" id="detailCombobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxtext-entry1">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="masterCombobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxtext-entry2">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</interface>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="pcr"> <interface domain="pcr">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="FormLinks"> <object class="GtkDialog" id="FormLinks">
...@@ -7,27 +8,30 @@ ...@@ -7,27 +8,30 @@
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes" context="formlinksdialog|FormLinks">Link fields</property> <property name="title" translatable="yes" context="formlinksdialog|FormLinks">Link fields</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<child internal-child="action_area"> <child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1"> <object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="layout_style">end</property>
<property name="layout_style">start</property>
<child> <child>
<object class="GtkButton" id="ok"> <object class="GtkButton" id="suggestButton">
<property name="label">gtk-ok</property> <property name="label" translatable="yes" context="formlinksdialog|suggestButton">Suggest</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_stock">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
...@@ -36,13 +40,14 @@ ...@@ -36,13 +40,14 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="cancel"> <object class="GtkButton" id="ok">
<property name="label">gtk-cancel</property> <property name="label">gtk-ok</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="yalign">0.49000000953674316</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
...@@ -51,8 +56,8 @@ ...@@ -51,8 +56,8 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="help"> <object class="GtkButton" id="cancel">
<property name="label">gtk-help</property> <property name="label">gtk-cancel</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
...@@ -65,16 +70,18 @@ ...@@ -65,16 +70,18 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="suggestButton"> <object class="GtkButton" id="help">
<property name="label" translatable="yes" context="formlinksdialog|suggestButton">Suggest</property> <property name="label">gtk-help</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_stock">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">3</property> <property name="position">3</property>
<property name="secondary">True</property>
</packing> </packing>
</child> </child>
</object> </object>
...@@ -97,10 +104,11 @@ ...@@ -97,10 +104,11 @@
<object class="GtkLabel" id="explanationLabel"> <object class="GtkLabel" id="explanationLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="formlinksdialog|explanationLabel">Sub forms can be used to display detailed data about the current record of the master form. To do this, you can specify which columns in the sub form match which columns in the master form.</property> <property name="label" translatable="yes" context="formlinksdialog|explanationLabel">Sub forms can be used to display detailed data about the current record of the master form. To do this, you can specify which columns in the sub form match which columns in the master form.</property>
<property name="wrap">True</property> <property name="wrap">True</property>
<property name="width_chars">60</property>
<property name="max_width_chars">60</property> <property name="max_width_chars">60</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
...@@ -145,6 +153,210 @@ ...@@ -145,6 +153,210 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox" id="FieldLinkRow1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkComboBoxText" id="detailCombobox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
<property name="activates_default">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="masterCombobox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
<property name="activates_default">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="FieldLinkRow2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkComboBoxText" id="detailCombobox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
<property name="activates_default">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="masterCombobox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
<property name="activates_default">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkBox" id="FieldLinkRow3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkComboBoxText" id="detailCombobox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
<property name="activates_default">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="masterCombobox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
<property name="activates_default">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkBox" id="FieldLinkRow4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkComboBoxText" id="detailCombobox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
<property name="activates_default">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="masterCombobox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
<property name="activates_default">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
...@@ -155,10 +367,10 @@ ...@@ -155,10 +367,10 @@
</object> </object>
</child> </child>
<action-widgets> <action-widgets>
<action-widget response="101">suggestButton</action-widget>
<action-widget response="-5">ok</action-widget> <action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget> <action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget> <action-widget response="-11">help</action-widget>
<action-widget response="101">suggestButton</action-widget>
</action-widgets> </action-widgets>
</object> </object>
</interface> </interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment