26#include <svx/strings.hrc>
47#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
48#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
49#include <com/sun/star/sdbc/XRowSet.hpp>
50#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
51#include <com/sun/star/util/XNumberFormats.hpp>
52#include <com/sun/star/sdb/CommandType.hpp>
53#include <com/sun/star/sdbc/DataType.hpp>
54#include <com/sun/star/form/FormComponentType.hpp>
55#include <com/sun/star/form/FormButtonType.hpp>
56#include <com/sun/star/form/binding/XBindableValue.hpp>
57#include <com/sun/star/form/binding/XValueBinding.hpp>
58#include <com/sun/star/form/runtime/FormController.hpp>
59#include <com/sun/star/form/submission/XSubmissionSupplier.hpp>
60#include <com/sun/star/awt/XTabControllerModel.hpp>
61#include <com/sun/star/awt/XControlContainer.hpp>
62#include <com/sun/star/awt/XTabController.hpp>
63#include <com/sun/star/container/XIndexAccess.hpp>
64#include <com/sun/star/awt/XControl.hpp>
65#include <com/sun/star/sdbc/SQLException.hpp>
66#include <com/sun/star/sdb/XQueriesSupplier.hpp>
67#include <com/sun/star/container/XContainer.hpp>
92 using ::com::sun::star::uno::Exception;
93 using ::com::sun::star::uno::XInterface;
94 using ::com::sun::star::uno::Sequence;
95 using ::com::sun::star::uno::UNO_QUERY;
96 using ::com::sun::star::uno::UNO_QUERY_THROW;
97 using ::com::sun::star::uno::UNO_SET_THROW;
98 using ::com::sun::star::uno::Type;
99 using ::com::sun::star::uno::Reference;
100 using ::com::sun::star::uno::Any;
101 using ::com::sun::star::uno::XComponentContext;
102 using ::com::sun::star::form::FormButtonType_SUBMIT;
103 using ::com::sun::star::form::binding::XValueBinding;
104 using ::com::sun::star::form::binding::XBindableValue;
105 using ::com::sun::star::lang::XComponent;
106 using ::com::sun::star::container::XIndexAccess;
107 using ::com::sun::star::form::runtime::FormController;
108 using ::com::sun::star::form::runtime::XFormController;
109 using ::com::sun::star::script::XEventAttacherManager;
110 using ::com::sun::star::awt::XTabControllerModel;
111 using ::com::sun::star::container::XChild;
112 using ::com::sun::star::task::XInteractionHandler;
113 using ::com::sun::star::awt::XTabController;
114 using ::com::sun::star::awt::XControlContainer;
115 using ::com::sun::star::awt::XControl;
116 using ::com::sun::star::form::XFormComponent;
117 using ::com::sun::star::form::XForm;
118 using ::com::sun::star::lang::IndexOutOfBoundsException;
119 using ::com::sun::star::container::XContainer;
120 using ::com::sun::star::container::ContainerEvent;
121 using ::com::sun::star::lang::EventObject;
122 using ::com::sun::star::sdb::SQLErrorEvent;
123 using ::com::sun::star::sdbc::XRowSet;
125 using ::com::sun::star::container::XElementAccess;
126 using ::com::sun::star::awt::XWindow;
127 using ::com::sun::star::awt::FocusEvent;
128 using ::com::sun::star::ui::dialogs::XExecutableDialog;
129 using ::com::sun::star::sdbc::XDataSource;
130 using ::com::sun::star::container::XIndexContainer;
131 using ::com::sun::star::sdbc::XConnection;
132 using ::com::sun::star::container::XNameAccess;
133 using ::com::sun::star::sdbc::SQLException;
134 using ::com::sun::star::util::XNumberFormatsSupplier;
135 using ::com::sun::star::util::XNumberFormats;
136 using ::com::sun::star::beans::XPropertySetInfo;
138 namespace FormComponentType = ::com::sun::star::form::FormComponentType;
139 namespace CommandType = ::com::sun::star::sdb::CommandType;
140 namespace DataType = ::com::sun::star::sdbc::DataType;
152: m_xControlContainer( _rWindow.GetControlContainer() ),
154 m_pViewImpl( _pViewImpl ),
155 m_pWindow( _rWindow.GetPaintWindow().GetOutputDevice().GetOwnerWindow() )
160 DBG_ASSERT( pFormPage,
"FormViewPageWindowAdapter::FormViewPageWindowAdapter: no FmFormPage found!" );
166 Reference< XIndexAccess > xForms( pFormPage->
GetForms(), UNO_QUERY_THROW );
167 sal_uInt32
nLength = xForms->getCount();
170 Reference< XForm > xForm( xForms->getByIndex(
i), UNO_QUERY );
187 for ( ::std::vector< Reference< XFormController > >::const_iterator
i =
m_aControllerList.begin();
194 Reference< XFormController >
xController( *
i, UNO_SET_THROW );
197 Reference< XChild > xControllerModel(
xController->getModel(), UNO_QUERY );
198 if ( xControllerModel.is() )
200 Reference< XEventAttacherManager > xEventManager( xControllerModel->getParent(), UNO_QUERY_THROW );
201 Reference< XInterface > xControllerNormalized(
xController, UNO_QUERY_THROW );
237 throw IndexOutOfBoundsException();
248 Reference< XWindow > xWindow(
Control, UNO_QUERY );
251 awt::Rectangle aRect = xWindow->getPosSize();
252 ::tools::Rectangle aNewRect( aRect.X, aRect.Y, aRect.X + aRect.Width, aRect.Y + aRect.Height );
253 aNewRect =
m_pWindow->PixelToLogic( aNewRect );
258static Reference< XFormController >
getControllerSearchChildren(
const Reference< XIndexAccess > & xIndex,
const Reference< XTabControllerModel > & xModel)
260 if (xIndex.is() && xIndex->getCount())
264 for (sal_Int32
n = xIndex->getCount();
n-- && !
xController.is(); )
277 return Reference< XFormController > ();
283 Reference< XTabControllerModel >
xModel(xForm, UNO_QUERY);
286 if (rpController->getModel().get() ==
xModel.get())
291 if (xChildSearch.is())
294 return Reference< XFormController > ();
300 DBG_ASSERT( xForm.is(),
"FormViewPageWindowAdapter::setController: there should be a form!" );
301 Reference< XIndexAccess > xFormCps(xForm, UNO_QUERY);
305 Reference< XTabControllerModel > xTabOrder(xForm, UNO_QUERY);
310 Reference< XInteractionHandler > xHandler;
311 if ( _rxParentController.is() )
312 xHandler = _rxParentController->getInteractionHandler();
328 if ( _rxParentController.is() )
329 _rxParentController->addChildController(
xController );
337 Reference< XEventAttacherManager > xEventManager( xForm->getParent(), UNO_QUERY );
342 sal_uInt32
nLength = xFormCps->getCount();
343 Reference< XForm > xSubForm;
346 if ( xFormCps->getByIndex(
i) >>= xSubForm )
354 OSL_PRECOND( _rxForm.is(),
"FormViewPageWindowAdapter::updateTabOrder: illegal argument!" );
360 Reference< XTabController > xTabCtrl(
getController( _rxForm ) );
363 xTabCtrl->activateTabOrder();
370 Reference< XForm > xParentForm( _rxForm->getParent(), UNO_QUERY );
372 Reference< XFormController > xParentController;
373 if ( xParentForm.is() )
387 :m_pMarkedGrid(nullptr)
389 ,m_nActivationEvent(nullptr)
390 ,m_nErrorMessageEvent( nullptr )
391 ,m_nAutoFocusEvent( nullptr )
392 ,m_nControlWizardEvent( nullptr )
393 ,m_bFirstActivation( true )
394 ,m_isTabOrderUpdateSuspended( false )
440 rpAdapter->dispose();
482 Reference< XControlContainer > xControlContainer( evt.Source, UNO_QUERY_THROW );
483 Reference< XControl > xControl( evt.Element, UNO_QUERY_THROW );
484 Reference< XFormComponent > xControlModel( xControl->getModel(), UNO_QUERY_THROW );
485 Reference< XForm > xForm( xControlModel->getParent(), UNO_QUERY_THROW );
496 pAdapter->updateTabOrder( xForm );
542 Reference< XContainer > xContainer( xCC, UNO_QUERY );
543 if ( xContainer.is() )
544 xContainer->addContainerListener(
this );
560 Reference< XContainer > xContainer( _rxCC, UNO_QUERY );
561 if ( xContainer.is() )
562 xContainer->removeContainerListener(
this );
580 m_nErrorMessageEvent =
nullptr;
605 if ( !pAdapter.is() )
608 for (
const auto& rForm : rContainer.second)
610 pAdapter->updateTabOrder( rForm );
618 bool isActivableDatabaseForm(
const Reference< XFormController > &xController)
621 Reference< XRowSet > xForm(
xController->getModel(), UNO_QUERY);
625 Reference< XPropertySet > xFormSet( xForm, UNO_QUERY );
626 if ( !xFormSet.is() )
628 SAL_WARN(
"svx.form",
"FmXFormView::OnActivate: a form which does not have properties?" );
632 const OUString aSource = ::comphelper::getString( xFormSet->getPropertyValue(
FM_PROP_COMMAND ) );
634 return !aSource.isEmpty();
637 class find_active_databaseform
639 const Reference< XFormController > xActiveController;
643 explicit find_active_databaseform(
const Reference< XFormController >& _xActiveController )
644 : xActiveController(_xActiveController )
647 Reference < XFormController > operator() (
const Reference< XFormController > &xController)
649 if(xController == xActiveController && isActivableDatabaseForm(xController))
654 SAL_WARN(
"svx.form",
"FmXFormView::OnActivate: a form controller which does not have children?" );
661 Reference < XFormController > xI;
662 if ((a >>= xI) && xI.is())
664 Reference < XFormController > xRes(
operator()(xI));
678 m_nActivationEvent =
nullptr;
682 OSL_FAIL(
"FmXFormView::OnActivate: well... seems we have a timing problem (the view already died)!" );
687 if (!(m_pView->GetFormShell() && m_pView->GetActualOutDev() && m_pView->GetActualOutDev()->GetOutDevType() ==
OUTDEV_WINDOW))
690 FmXFormShell*
const pShImpl = m_pView->GetFormShell()->GetImpl();
695 find_active_databaseform fad(pShImpl->getActiveController_Lock());
697 vcl::Window* pWindow = m_pView->GetActualOutDev()->GetOwnerWindow();
699 for (
const auto& rpPageWindowAdapter : m_aPageWindowAdapters)
701 if ( pWindow == rpPageWindowAdapter->getWindow() )
702 pAdapter = rpPageWindowAdapter;
705 if ( !pAdapter.is() )
708 Reference< XFormController > xControllerToActivate;
709 for (
const Reference< XFormController > &
xController : pAdapter->GetList())
715 Reference< XFormController > xActiveController(fad(
xController));
716 if (xActiveController.is())
718 xControllerToActivate = xActiveController;
723 if(xControllerToActivate.is() || !isActivableDatabaseForm(
xController))
728 pShImpl->setActiveController_Lock(xControllerToActivate);
758 if (pShImpl && bDeactivateController)
759 pShImpl->setActiveController_Lock(
nullptr);
779 if ( !i_rControl.is() )
784 Reference< XPropertySet > xModelProps( i_rControl->getModel(), UNO_QUERY_THROW );
787 bool bEnabled =
false;
788 OSL_VERIFY( xModelProps->getPropertyValue(
FM_PROP_ENABLED ) >>= bEnabled );
793 sal_Int16 nClassId = FormComponentType::CONTROL;
794 OSL_VERIFY( xModelProps->getPropertyValue(
FM_PROP_CLASSID ) >>= nClassId );
797 if ( ( FormComponentType::CONTROL != nClassId )
798 && ( FormComponentType::IMAGEBUTTON != nClassId )
799 && ( FormComponentType::GROUPBOX != nClassId )
800 && ( FormComponentType::FIXEDTEXT != nClassId )
801 && ( FormComponentType::HIDDENCONTROL != nClassId )
802 && ( FormComponentType::IMAGECONTROL != nClassId )
803 && ( FormComponentType::SCROLLBAR != nClassId )
804 && ( FormComponentType::SPINBUTTON!= nClassId )
820 Reference< XControl > xReturn;
823 for (
auto const & control : _rControls )
835 if ( !xReturn.is() && _rControls.hasElements() )
836 xReturn = _rControls[0];
845 void lcl_ensureControlsOfFormExist_nothrow(
const SdrPage& _rPage,
const SdrView& _rView,
const vcl::Window& _rWindow,
const Reference< XForm >& _rxForm )
849 Reference< XInterface > xNormalizedForm( _rxForm, UNO_QUERY_THROW );
852 while ( aSdrObjectLoop.IsMore() )
854 FmFormObj* pFormObject = FmFormObj::GetFormObject( aSdrObjectLoop.Next() );
858 Reference< XChild >
xModel( pFormObject->GetUnoControlModel(), UNO_QUERY_THROW );
859 Reference< XInterface > xModelParent(
xModel->getParent(), UNO_QUERY );
861 if ( xNormalizedForm.get() != xModelParent.get() )
864 pFormObject->GetUnoControl( _rView, *_rWindow.
GetOutDev() );
867 catch (
const Exception&)
883 SAL_WARN(
"svx.form",
"FmXFormView::getFormController: invalid page window adapter!" );
901 m_nAutoFocusEvent =
nullptr;
906 SdrPageView *pPageView = m_pView ? m_pView->GetSdrPageView() :
nullptr;
910 Reference< XIndexAccess > xForms( pPage ? Reference< XIndexAccess >( pPage->
GetForms() ) : Reference< XIndexAccess >() );
913 const vcl::Window* pWindow = pAdapter ? pAdapter->getWindow() :
nullptr;
915 ENSURE_OR_RETURN_VOID( xForms.is() && pWindow,
"FmXFormView::OnAutoFocus: could not collect all essentials!" );
920 if ( !xForms->getCount() )
922 Reference< XForm > xForm( xForms->getByIndex( 0 ), UNO_QUERY_THROW );
923 Reference< XTabController > xTabController( pAdapter->getController( xForm ), UNO_QUERY_THROW );
926 Sequence< Reference< XControl > > aControls( xTabController->getControls() );
927 if ( !aControls.hasElements() )
929 Reference< XElementAccess > xFormElementAccess( xForm, UNO_QUERY_THROW );
930 if (xFormElementAccess->hasElements() && pPage && m_pView)
937 lcl_ensureControlsOfFormExist_nothrow( *pPage, *m_pView, *pWindow, xForm );
938 aControls = xTabController->getControls();
939 OSL_ENSURE( aControls.hasElements(),
"FmXFormView::OnAutoFocus: no controls at all!" );
945 if ( !xControlWindow.is() )
948 xControlWindow->setFocus();
954 if ( pCurrentWindow )
956 awt::Rectangle aRect = xControlWindow->getPosSize();
957 ::tools::Rectangle aNonUnoRect( aRect.X, aRect.Y, aRect.X + aRect.Width, aRect.Y + aRect.Height );
958 m_pView->MakeVisible( pCurrentWindow->
PixelToLogic( aNonUnoRect ), *
const_cast< vcl::Window*
>( pCurrentWindow ) );
972 OSL_ENSURE( pShellImpl,
"FmXFormView::onCreatedFormObject: no form shell!" );
977 pShellImpl->UpdateForms_Lock(
true);
984 FormControlFactory aControlFactory;
985 aControlFactory.initializeControlModel(pShellImpl->getDocumentType_Lock(), _rFormObject);
987 if (!pShellImpl->GetWizardUsing_Lock())
991 if (pShellImpl->isEnhancedForm_Lock())
1023 m_nControlWizardEvent =
nullptr;
1024 OSL_PRECOND( m_xLastCreatedControlModel.is(),
"FmXFormView::OnStartControlWizard: illegal call!" );
1025 if ( !m_xLastCreatedControlModel.is() )
1028 sal_Int16 nClassId = FormComponentType::CONTROL;
1031 OSL_VERIFY( m_xLastCreatedControlModel->getPropertyValue(
FM_PROP_CLASSID ) >>= nClassId );
1038 const char* pWizardAsciiName =
nullptr;
1041 case FormComponentType::GRIDCONTROL:
1042 pWizardAsciiName =
"com.sun.star.sdb.GridControlAutoPilot";
1044 case FormComponentType::LISTBOX:
1045 case FormComponentType::COMBOBOX:
1046 pWizardAsciiName =
"com.sun.star.sdb.ListComboBoxAutoPilot";
1048 case FormComponentType::GROUPBOX:
1049 pWizardAsciiName =
"com.sun.star.sdb.GroupBoxAutoPilot";
1053 if ( pWizardAsciiName )
1057 aWizardArgs.
put(
"ObjectModel", m_xLastCreatedControlModel);
1058 aWizardArgs.
put(
"ParentWindow", GetParentWindow());
1061 Reference< XExecutableDialog > xWizard;
1065 xWizard.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( OUString::createFromAscii(pWizardAsciiName), aWizardArgs.
getWrappedPropertyValues(), xContext ), UNO_QUERY);
1072 if ( !xWizard.is() )
1090 m_xLastCreatedControlModel.clear();
1096 void lcl_insertIntoFormComponentHierarchy_throw(
const FmFormView& _rView,
const SdrUnoObj& _rSdrObj,
1097 const Reference< XDataSource >& _rxDataSource,
const OUString& _rDataSourceName,
1098 const OUString& _rCommand,
const sal_Int32 _nCommandType )
1102 Reference< XFormComponent > xFormComponent( _rSdrObj.
GetUnoControlModel(), UNO_QUERY_THROW );
1103 Reference< XForm > xTargetForm(
1109 Reference< XIndexContainer > xFormAsContainer( xTargetForm, UNO_QUERY_THROW );
1110 xFormAsContainer->insertByIndex( xFormAsContainer->getCount(),
Any( xFormComponent ) );
1121 OUString sCommand, sFieldName;
1122 sal_Int32 nCommandType = CommandType::COMMAND;
1126 _rColumnDescriptor[ DataAccessDescriptorProperty::Command ] >>= sCommand;
1127 _rColumnDescriptor[ DataAccessDescriptorProperty::ColumnName ] >>= sFieldName;
1128 _rColumnDescriptor[ DataAccessDescriptorProperty::CommandType ] >>= nCommandType;
1130 Reference< XConnection > xExternalConnection;
1131 _rColumnDescriptor[ DataAccessDescriptorProperty::Connection ] >>= xExternalConnection;
1135 if ( sCommand.isEmpty()
1136 || sFieldName.isEmpty()
1137 || ( sDataSource.isEmpty()
1138 && !xConnection.
is()
1142 OSL_FAIL(
"FmXFormView::implCreateFieldControl: nonsense!" );
1145 Reference< XDataSource > xDataSource;
1146 SQLErrorEvent aError;
1149 if ( xConnection.
is() && !xDataSource.is() && sDataSource.isEmpty() )
1151 Reference< XChild > xChild( xConnection, UNO_QUERY );
1153 xDataSource.set(xChild->getParent(), css::uno::UNO_QUERY);
1157 if ( !xDataSource.is() )
1161 if ( !xConnection.
is() )
1170 catch (
const SQLException&)
1172 aError.Reason = ::cppu::getCaughtException();
1178 if (aError.Reason.hasValue())
1185 if (!xDataSource.is() || !xConnection.
is())
1187 OSL_FAIL(
"FmXFormView::implCreateFieldControl : could not retrieve the data source or the connection!");
1191 Reference< XComponent > xKeepFieldsAlive;
1196 Reference< XPropertySet > xField;
1199 xConnection, nCommandType, sCommand, xKeepFieldsAlive );
1201 if (xFields.is() && xFields->hasByName(sFieldName))
1202 xFields->getByName(sFieldName) >>= xField;
1206 Reference< XNumberFormatsSupplier > xSupplier(
getNumberFormats( xConnection ), UNO_SET_THROW );
1207 Reference< XNumberFormats > xNumberFormats( xSupplier->getNumberFormats(), UNO_SET_THROW );
1209 OUString sLabelPostfix;
1223 for( sal_uInt32
i = 0;
i < pPageView->PageWindowCount();
i++ )
1246 bool bDateNTimeField =
false;
1248 bool bIsCurrency =
false;
1257 case DataType::BLOB:
1258 case DataType::LONGVARBINARY:
1261 case DataType::LONGVARCHAR:
1262 case DataType::CLOB:
1265 case DataType::BINARY:
1266 case DataType::VARBINARY:
1269 case DataType::BOOLEAN:
1272 case DataType::TINYINT:
1273 case DataType::SMALLINT:
1274 case DataType::INTEGER:
1277 case DataType::REAL:
1278 case DataType::DOUBLE:
1279 case DataType::NUMERIC:
1280 case DataType::DECIMAL:
1283 case DataType::TIMESTAMP:
1284 bDateNTimeField =
true;
1285 sLabelPostfix =
SvxResId(RID_STR_POSTFIX_DATE);
1287 case DataType::DATE:
1290 case DataType::TIME:
1293 case DataType::CHAR:
1294 case DataType::VARCHAR:
1305 pLabel, pControl, xDataSource, sDataSource, sCommand, nCommandType )
1314 OSL_ENSURE( !bCheckbox || !pLabel,
"FmXFormView::implCreateFieldControl: why was there a label created for a check box?" );
1323 if ( bDateNTimeField )
1326 SvxResId(RID_STR_POSTFIX_TIME), pLabel, pControl,
1327 xDataSource, sDataSource, sCommand, nCommandType )
1357 Reference< XNumberFormats > xNumberFormats;
1358 OUString sLabelPostfix = _rDesc.
szName;
1372 for( sal_uInt32
i = 0;
i < pPageView->PageWindowCount();
i++ )
1398 Reference< css::form::submission::XSubmission > xSubmission(_rDesc.
xPropSet, UNO_QUERY);
1401 if ( !xSubmission.is() )
1406 pLabel, pControl,
nullptr,
"",
"", -1 )
1414 Reference< XValueBinding > xValueBinding(_rDesc.
xPropSet,UNO_QUERY);
1415 Reference< XBindableValue > xBindableValue(pControl->GetUnoControlModel(),UNO_QUERY);
1417 DBG_ASSERT( xBindableValue.is(),
"FmXFormView::implCreateXFormsControl: control's not bindable!" );
1418 if ( xBindableValue.is() )
1419 xBindableValue->setValueBinding(xValueBinding);
1422 OSL_ENSURE( !bCheckbox || !pLabel,
"FmXFormView::implCreateXFormsControl: why was there a label created for a check box?" );
1439 const MapMode eSourceMode(MapUnit::Map100thMM);
1441 ::Size controlSize(4000, 500);
1444 getView()->getSdrModelFromSdrView(),
1451 pControl->SetLogicRect(controlRect);
1454 Reference< XPropertySet > xControlSet(pControl->GetUnoControlModel(), UNO_QUERY);
1459 Any( FormButtonType_SUBMIT ) );
1460 Reference< css::form::submission::XSubmissionSupplier > xSubmissionSupplier(pControl->GetUnoControlModel(), UNO_QUERY);
1461 xSubmissionSupplier->setSubmission(xSubmission);
1476 const Reference< XPropertySet >& _rxField,
const Reference< XNumberFormats >& _rxNumberFormats,
1477 SdrObjKind _nControlObjectID, std::u16string_view _rFieldPostfix,
1480 const Reference< XDataSource >& _rxDataSource,
const OUString& _rDataSourceName,
1481 const OUString& _rCommand,
const sal_Int32 _nCommandType )
1497 getView()->getSdrModelFromSdrView(),
1507 lcl_insertIntoFormComponentHierarchy_throw( *
m_pView, *_rpLabel, _rxDataSource, _rDataSourceName, _rCommand, _nCommandType );
1508 lcl_insertIntoFormComponentHierarchy_throw( *
m_pView, *_rpControl, _rxDataSource, _rDataSourceName, _rCommand, _nCommandType );
1511 FormControlFactory aControlFactory;
1521 const Reference< XPropertySet >& _rxField,
1522 const Reference< XNumberFormats >& _rxNumberFormats,
SdrObjKind _nControlObjectID,
1528 OUString sFieldName;
1530 if ( _rxField.is() )
1534 aFieldName >>= sFieldName;
1541 eSourceMode( MapUnit::Map100thMM );
1545 ::Size aDefTxtSize(4000, 500);
1546 ::Size aDefSize(4000, 500);
1547 ::Size aDefImageSize(4000, 4000);
1550 aRealSize.
setWidth( std::max(aRealSize.
Width(), aDefTxtSize.Width()) );
1551 aRealSize.
setHeight( aDefSize.Height() );
1562 Reference< XPropertySet > xLabelModel;
1570 _nLabelObjectID).get() );
1572 OSL_ENSURE(pLabel,
"FmXFormView::createControlLabelPair: could not create the label!");
1577 xLabelModel.set( pLabel->GetUnoControlModel(), UNO_QUERY );
1578 if ( xLabelModel.is() )
1581 if ( _rxField.is() && _rxField->getPropertySetInfo()->hasPropertyByName(
FM_PROP_LABEL) )
1583 if ( sLabel.isEmpty() )
1584 sLabel = sFieldName;
1586 xLabelModel->setPropertyValue(
FM_PROP_LABEL,
Any( sLabel + _rFieldPostfix ) );
1587 OUString sObjectLabel(
SvxResId(RID_STR_OBJECT_LABEL).replaceAll(
"#object#", sFieldName));
1602 _nControlObjectID).
get() ));
1604 OSL_ENSURE(pControl,
"FmXFormView::createControlLabelPair: could not create the control!");
1609 Reference< XPropertySet > xControlSet( pControl->GetUnoControlModel(), UNO_QUERY );
1610 if ( !xControlSet.is() )
1614 ::Size aControlSize( aDefSize );
1615 switch ( nDataType )
1618 case DataType::BOOLEAN:
1619 aControlSize = aDefSize;
1621 case DataType::LONGVARCHAR:
1622 case DataType::CLOB:
1623 case DataType::LONGVARBINARY:
1624 case DataType::BLOB:
1625 aControlSize = aDefImageSize;
1630 aControlSize = aDefImageSize;
1632 aControlSize.setWidth(
tools::Long(
Fraction(aControlSize.Width(), 1) * eTargetMode.GetScaleX()) );
1633 aControlSize.setHeight(
tools::Long(
Fraction(aControlSize.Height(), 1) * eTargetMode.GetScaleY()) );
1641 Reference< XPropertySetInfo > xControlPropInfo = xControlSet->getPropertySetInfo();
1643 if ( aFieldName.hasValue() )
1646 xControlSet->setPropertyValue(
FM_PROP_NAME, aFieldName );
1651 xControlSet->setPropertyValue(
FM_PROP_LABEL,
Any( sFieldName + _rFieldPostfix ) );
1653 OSL_FAIL(
"FmXFormView::createControlLabelPair: can't set a label for the control!" );
1657 if ( (nDataType == DataType::LONGVARCHAR || nDataType == DataType::CLOB) && xControlPropInfo->hasPropertyByName(
FM_PROP_MULTILINE ) )
1669 catch (
const Exception&)
1675 if ( _rxField.is() )
1677 FormControlFactory::initializeFieldDependentProperties( _rxField, xControlSet, _rxNumberFormats );
1680 _rpLabel = std::move(pLabel);
1681 _rpControl = std::move(pControl);
1687 :m_pParent( pParent )
1694 if (rHint.
GetId() != SfxHintId::ThisIsAnSdrHint)
1698 m_pParent->ObjectRemovedInAliveMode(pSdrHint->
GetObject());
1740 DBG_ASSERT( pModel !=
nullptr,
"FmXFormView::startMarkListWatching: shell has no model!" );
1749 OSL_FAIL(
"FmXFormView::startMarkListWatching: already listening!" );
1769 bool bMixed =
false;
1770 while ( aIter.
IsMore() && !bMixed )
1791 OSL_FAIL(
"FmXFormView::saveMarkList: invalid view!" );
1798 bool bFound =
false;
1799 while (rIter.
IsMore() && !bFound)
1800 bFound = pObj == rIter.
Next();
1812 _rRestoredMarkList.
Clear();
1821 bool bMisMatch =
false;
1824 const size_t nCurrentCount = rCurrentList.
GetMarkCount();
1825 for (
size_t i=0;
i<nCurrentCount && !bMisMatch; ++
i )
1830 bool bFound =
false;
1832 for (
size_t j=0; j<nSavedCount && !bFound; ++j )
1846 _rRestoredMarkList = rCurrentList;
1858 for (
size_t i = 0;
i <
nCount && bFound; ++
i)
1865 while (aIter.
IsMore() && bFound)
1871 bFound = bFound && pCurPageView == pMark->
GetPageView();
Reference< XComponentContext > m_xContext
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
static OUString setUniqueName(const css::uno::Reference< css::form::XFormComponent > &xFormComponent, const css::uno::Reference< css::form::XForm > &xControls)
css::uno::Reference< css::form::XForm > findPlaceInFormComponentHierarchy(const css::uno::Reference< css::form::XFormComponent > &rContent, const css::uno::Reference< css::sdbc::XDataSource > &rDatabase=css::uno::Reference< css::sdbc::XDataSource >(), const OUString &rDBTitle=OUString(), const OUString &rCursorSource=OUString(), sal_Int32 nCommandType=0)
finds a place in the form component hierarchy where to insert the given component
const css::uno::Reference< css::form::XForms > & GetForms(bool _bForceCreate=true) const
FmFormPageImpl & GetImpl() const
virtual sal_Int32 SAL_CALL getCount() override
virtual css::uno::Type SAL_CALL getElementType() override
virtual ~FormViewPageWindowAdapter() override
void updateTabOrder(const css::uno::Reference< css::form::XForm > &_rxForm)
VclPtr< vcl::Window > m_pWindow
css::uno::Reference< css::form::runtime::XFormController > getController(const css::uno::Reference< css::form::XForm > &xForm) const
css::uno::Reference< css::uno::XComponentContext > m_xContext
::std::vector< css::uno::Reference< css::form::runtime::XFormController > > m_aControllerList
FormViewPageWindowAdapter(css::uno::Reference< css::uno::XComponentContext > _xContext, const SdrPageWindow &, FmXFormView *pView)
virtual void SAL_CALL makeVisible(const css::uno::Reference< css::awt::XControl > &Control) override
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
css::uno::Reference< css::awt::XControlContainer > m_xControlContainer
virtual sal_Bool SAL_CALL hasElements() override
void setController(const css::uno::Reference< css::form::XForm > &xForm, const css::uno::Reference< css::form::runtime::XFormController > &_rxParentController)
FmXFormView * m_pViewImpl
const Fraction & GetScaleX() const
const Fraction & GetScaleY() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
const MapMode & GetMapMode() const
tools::Long GetTextHeight() const
OutDevType GetOutDevType() const
virtual vcl::Window * GetOwnerWindow() const
SdrHintKind GetKind() const
const SdrObject * GetObject() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
void DeleteMark(size_t nNum)
bool IsObjMarked(SdrObject const *pObj) const
const SdrMarkList & GetMarkedObjectList() const
bool IsDesignMode() const
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
Everything a View needs to know about a selected object.
SdrPageView * GetPageView() const
SdrObject * GetMarkedSdrObj() const
static rtl::Reference< SdrObject > MakeNewObject(SdrModel &rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier, const tools::Rectangle *pSnapRect=nullptr)
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
virtual SdrInventor GetObjInventor() const
virtual SdrObjList * GetSubList() const
bool IsGroupObject() const
SdrPage * GetPage() const
css::uno::Reference< css::awt::XControlContainer > const & GetControlContainer(bool _bCreateIfNecessary=true) const
SdrPaintWindow & GetPaintWindow() const
SdrPageView & GetPageView() const
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin)
SdrPageView * GetSdrPageView() const
OutputDevice & GetOutputDevice() const
bool OutputToWindow() const
const css::uno::Reference< css::awt::XControlModel > & GetUnoControlModel() const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
css::uno::Sequence< css::uno::Any > getWrappedPropertyValues() const
bool put(const OUString &_rValueName, const VALUE_TYPE &_rValue)
css::uno::Type const & get()
class encapsulating the css::sdb::DataAccessDescriptor service.
OUString getDataSource() const
returns either the data source name if given or the database location
void reset(const css::uno::Reference< INTERFACE > &_rxComponent, AssignmentMode _eMode=TakeOwnership)
::OutputDevice const * GetOutDev() const
Point PixelToLogic(const Point &rDevicePt) const
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
#define ENSURE_OR_RETURN_VOID(c, m)
OUString SvxResId(TranslateId aId)
EmbeddedObjectRef * pObject
constexpr OUStringLiteral FM_PROP_BUTTON_TYPE
constexpr OUStringLiteral FM_PROP_COMMAND
constexpr OUStringLiteral FM_PROP_CLASSID
constexpr OUStringLiteral FM_PROP_CONTROLLABEL
constexpr OUStringLiteral FM_PROP_MULTILINE
constexpr OUStringLiteral FM_PROP_ENABLED
constexpr OUStringLiteral FM_PROP_LABEL
constexpr OUStringLiteral FM_PROP_CONTROLSOURCE
constexpr OUStringLiteral FM_PROP_NAME
constexpr OUStringLiteral FM_PROP_FIELDTYPE
constexpr OUStringLiteral FM_PROP_ISCURRENCY
constexpr OUStringLiteral FM_SUN_COMPONENT_NUMERICFIELD
constexpr OUStringLiteral FM_SUN_COMPONENT_CHECKBOX
constexpr OUStringLiteral FM_COMPONENT_COMMANDBUTTON
static bool lcl_hasObject(SdrObjListIter &rIter, SdrObject const *pObj)
static Reference< XFormController > getControllerSearchChildren(const Reference< XIndexAccess > &xIndex, const Reference< XTabControllerModel > &xModel)
static Reference< XControl > lcl_firstFocussableControl(const Sequence< Reference< XControl > > &_rControls)
IMPL_LINK_NOARG(FmXFormView, OnDelayedErrorMessage, void *, void)
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
class SAL_NO_VTABLE XPropertySet
class SvxPropertySetInfoPool
Reference< XComponentContext > getProcessComponentContext()
css::uno::Reference< css::uno::XInterface > getDataSource(const css::uno::Reference< css::uno::XInterface > &_rxDependentObject)
@ CommandType
command (string)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
void VCL_DLLPUBLIC ShowServiceNotAvailableError(weld::Widget *pParent, std::u16string_view rServiceName, bool bError)
Reference< XController > xController
Reference< XModel > xModel
Reference< XComponentContext > _xContext