[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - extensions/source

Lionel Elie Mamane lionel at mamane.lu
Fri Dec 5 01:13:50 PST 2014


 extensions/source/propctrlr/formcomponenthandler.cxx |   25 ++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

New commits:
commit c5133d6f9c909619a3534c1e3f7f3c7bb3f69ab7
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Dec 4 19:04:46 2014 +0100

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 460371e..f3ae47c 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;
     }


More information about the Libreoffice-commits mailing list