[Libreoffice-commits] core.git: 2 commits - extensions/source
Lionel Elie Mamane
lionel at mamane.lu
Thu Dec 4 10:18:02 PST 2014
extensions/source/propctrlr/formcomponenthandler.cxx | 38 +++++++++++++++++--
1 file changed, 34 insertions(+), 4 deletions(-)
New commits:
commit ac49b8abb40098edb8f650037a2b5742b35c415f
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Dec 4 19:14:52 2014 +0100
fdo#65163 reintroduce embedded picture for form components
but not for report components (fdo#53001)
Change-Id: Ie07e1c2993304d4deb2124e72baa7a326b587918
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 63688cb..41c955d 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -69,6 +69,7 @@
#include <com/sun/star/inspection/PropertyLineElement.hpp>
#include <com/sun/star/resource/XStringResourceManager.hpp>
#include <com/sun/star/resource/MissingResourceException.hpp>
+#include <com/sun/star/report/XReportDefinition.hpp>
#include <com/sun/star/graphic/GraphicObject.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
@@ -127,6 +128,7 @@ namespace pcr
using namespace sdb;
using namespace sdbc;
using namespace sdbcx;
+ using namespace report;
using namespace container;
using namespace ui::dialogs;
using namespace inspection;
@@ -2775,8 +2777,17 @@ namespace pcr
aFileDlg.SetTitle(aStrTrans);
// 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;
+ bool bHandleNonLink;
+ {
+ Reference< XModel > xModel( impl_getContextDocument_nothrow() );
+ bHandleNonLink = xModel.is();
+ // Not implemented in reports
+ if (bHandleNonLink)
+ {
+ Reference< XReportDefinition > xReportDef( xModel, ::com::sun::star::uno::UNO_QUERY );
+ bHandleNonLink = !xReportDef.is();
+ }
+ }
Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY);
DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!");
commit c8b7165b9ff1e656f9ea484b3fb0c8f5aa06810a
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
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 41167b0..63688cb 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;
}
More information about the Libreoffice-commits
mailing list