diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2014-12-04 19:04:46 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2014-12-04 19:17:32 +0100 |
commit | c8b7165b9ff1e656f9ea484b3fb0c8f5aa06810a (patch) | |
tree | 7454c050b1116696fd70084724b477cb51f27461 | |
parent | 4a8c18dcca2aa4eb6b1306d6312c8a7d9d7257a9 (diff) |
Revert "coverity#735424 Logically dead code"
This reverts commit 1f22e2f954baeec825190ded03510cb6c8069d93.
in preparation for fix for fdo#65163
Conflicts:
extensions/source/propctrlr/formcomponenthandler.cxx
Change-Id: Ifa252ac66724dd3e4b257e3bb6679d9503f8a9db
-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; } |