diff options
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/propctrlr/formcomponenthandler.cxx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 41167b00a02c..63688cbd0065 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -2765,6 +2765,7 @@ namespace pcr bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const { + bool bIsLink = true;// reflect the legacy behavior OUString aStrTrans = m_pInfoService->getPropertyTranslation( PROPERTY_ID_IMAGE_URL ); ::sfx2::FileDialogHelper aFileDlg( @@ -2775,6 +2776,7 @@ namespace pcr // non-linked images ( e.g. those located in the document // stream ) only if document is available Reference< XModel > xModel( impl_getContextDocument_nothrow() ); + bool bHandleNonLink = false; Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY); DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!"); @@ -2783,8 +2785,8 @@ namespace pcr // do a preview by default xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, css::uno::Any(true)); - xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, css::uno::Any(true)); - xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, false); + xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, css::uno::Any(bIsLink)); + xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, bHandleNonLink ); } @@ -2800,7 +2802,24 @@ namespace pcr bool bSuccess = ( 0 == aFileDlg.Execute() ); if ( bSuccess ) { - _out_rNewValue <<= aFileDlg.GetPath(); + if ( bHandleNonLink && xController.is() ) + { + xController->getValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bIsLink; + } + if ( !bIsLink ) + { + Graphic aGraphic; + aFileDlg.GetGraphic( aGraphic ); + + Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObject::create( m_xContext ); + xGrfObj->setGraphic( aGraphic.GetXGraphic() ); + + + _out_rNewValue <<= xGrfObj; + + } + else + _out_rNewValue <<= aFileDlg.GetPath(); } return bSuccess; } |