summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2014-12-04 19:04:46 +0100
committerTor Lillqvist <tml@collabora.com>2014-12-15 13:51:39 +0200
commit4d0dd4350d82d2550edd1265283678eb256acf27 (patch)
treec742f0e952d5c9c25b8f4ef45e3bf7a2c74288e5
parentResolves: fdo#85590 'Pick a color' circle location is incorrect when opened (diff)
downloadcore-4d0dd4350d82d2550edd1265283678eb256acf27.tar.gz
core-4d0dd4350d82d2550edd1265283678eb256acf27.zip
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 Reviewed-on: https://gerrit.libreoffice.org/13302 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx25
1 files changed, 22 insertions, 3 deletions
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 460371e303b8..f3ae47c69b6a 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 <<= (OUString)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 <<= (OUString)aFileDlg.GetPath();
}
return bSuccess;
}