Lines 80-85
Link Here
|
80 |
#include <com/sun/star/inspection/PropertyLineElement.hpp> |
80 |
#include <com/sun/star/inspection/PropertyLineElement.hpp> |
81 |
#include <com/sun/star/resource/XStringResourceManager.hpp> |
81 |
#include <com/sun/star/resource/XStringResourceManager.hpp> |
82 |
#include <com/sun/star/resource/MissingResourceException.hpp> |
82 |
#include <com/sun/star/resource/MissingResourceException.hpp> |
|
|
83 |
#include <com/sun/star/graphic/GraphicObject.hpp> |
83 |
/** === end UNO includes === **/ |
84 |
/** === end UNO includes === **/ |
84 |
#include <connectivity/dbexception.hxx> |
85 |
#include <connectivity/dbexception.hxx> |
85 |
#include <vcl/wrkwin.hxx> |
86 |
#include <vcl/wrkwin.hxx> |
Lines 116-121
Link Here
|
116 |
|
117 |
|
117 |
#include <limits> |
118 |
#include <limits> |
118 |
|
119 |
|
|
|
120 |
#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" |
119 |
//------------------------------------------------------------------------ |
121 |
//------------------------------------------------------------------------ |
120 |
extern "C" void SAL_CALL createRegistryInfo_FormComponentPropertyHandler() |
122 |
extern "C" void SAL_CALL createRegistryInfo_FormComponentPropertyHandler() |
121 |
{ |
123 |
{ |
Lines 336-342
namespace pcr
Link Here
|
336 |
::osl::MutexGuard aGuard( m_aMutex ); |
338 |
::osl::MutexGuard aGuard( m_aMutex ); |
337 |
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); // check if property is known by the handler |
339 |
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); // check if property is known by the handler |
338 |
|
340 |
|
339 |
if ( PROPERTY_ID_FONT_NAME == nPropId ) |
341 |
Reference< graphic::XGraphicObject > xGrfObj; |
|
|
342 |
if ( PROPERTY_ID_IMAGE_URL == nPropId && ( _rValue >>= xGrfObj ) ) |
343 |
{ |
344 |
DBG_ASSERT( xGrfObj.is(), "FormComponentPropertyHandler::setPropertyValue() xGrfObj is invalid"); |
345 |
rtl::OUString sObjectID( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) ); |
346 |
sObjectID = sObjectID + xGrfObj->getUniqueID(); |
347 |
m_xComponent->setPropertyValue( _rPropertyName, uno::makeAny( sObjectID ) ); |
348 |
} |
349 |
else if ( PROPERTY_ID_FONT_NAME == nPropId ) |
340 |
{ |
350 |
{ |
341 |
// special handling, the value is a faked value we generated ourself in impl_executeFontDialog_nothrow |
351 |
// special handling, the value is a faked value we generated ourself in impl_executeFontDialog_nothrow |
342 |
Sequence< NamedValue > aFontPropertyValues; |
352 |
Sequence< NamedValue > aFontPropertyValues; |
Lines 561-569
namespace pcr
Link Here
|
561 |
{ |
571 |
{ |
562 |
::rtl::OUString sControlValue; |
572 |
::rtl::OUString sControlValue; |
563 |
OSL_VERIFY( _rControlValue >>= sControlValue ); |
573 |
OSL_VERIFY( _rControlValue >>= sControlValue ); |
564 |
|
574 |
// Don't convert a placeholder |
565 |
INetURLObject aDocURL( impl_getDocumentURL_nothrow() ); |
575 |
if ( nPropId == PROPERTY_ID_IMAGE_URL && sControlValue.equals( String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) ) ) ) |
566 |
aPropertyValue <<= (::rtl::OUString)URIHelper::SmartRel2Abs( aDocURL, sControlValue, Link(), false, true, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI ); |
576 |
aPropertyValue <<= sControlValue; |
|
|
577 |
else |
578 |
{ |
579 |
INetURLObject aDocURL( impl_getDocumentURL_nothrow() ); |
580 |
aPropertyValue <<= (::rtl::OUString)URIHelper::SmartRel2Abs( aDocURL, sControlValue, Link(), false, true, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI ); |
581 |
} |
567 |
} |
582 |
} |
568 |
break; |
583 |
break; |
569 |
|
584 |
|
Lines 2658-2669
namespace pcr
Link Here
|
2658 |
//------------------------------------------------------------------------ |
2673 |
//------------------------------------------------------------------------ |
2659 |
bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const |
2674 |
bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const |
2660 |
{ |
2675 |
{ |
|
|
2676 |
bool bIsLink = true;// reflect the legacy behavior |
2661 |
::rtl::OUString aStrTrans = m_pInfoService->getPropertyTranslation( PROPERTY_ID_IMAGE_URL ); |
2677 |
::rtl::OUString aStrTrans = m_pInfoService->getPropertyTranslation( PROPERTY_ID_IMAGE_URL ); |
2662 |
|
2678 |
|
2663 |
::sfx2::FileDialogHelper aFileDlg(SFXWB_GRAPHIC); |
2679 |
::sfx2::FileDialogHelper aFileDlg(SFXWB_GRAPHIC); |
2664 |
|
2680 |
|
2665 |
aFileDlg.SetTitle(aStrTrans); |
2681 |
aFileDlg.SetTitle(aStrTrans); |
2666 |
|
2682 |
// non-linked images ( e.g. those located in the document |
|
|
2683 |
// stream ) cannot *currently* be handled by openoffice basic dialogs. |
2684 |
bool bHandleNonLink = ( m_eComponentClass == eFormControl ); |
2685 |
|
2667 |
Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY); |
2686 |
Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY); |
2668 |
DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!"); |
2687 |
DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!"); |
2669 |
if (xController.is()) |
2688 |
if (xController.is()) |
Lines 2671-2684
namespace pcr
Link Here
|
2671 |
// do a preview by default |
2690 |
// do a preview by default |
2672 |
xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True)); |
2691 |
xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True)); |
2673 |
|
2692 |
|
2674 |
// "as link" is checked, but disabled |
2693 |
xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any(bIsLink)); |
2675 |
xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any(sal_True)); |
2694 |
xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, bHandleNonLink ); |
2676 |
xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False); |
2695 |
|
2677 |
} |
2696 |
} |
2678 |
|
2697 |
|
2679 |
::rtl::OUString sCurValue; |
2698 |
::rtl::OUString sCurValue; |
2680 |
OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sCurValue ); |
2699 |
OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sCurValue ); |
2681 |
if ( sCurValue.getLength() != 0 ) |
2700 |
if ( sCurValue.getLength() != 0 && sCurValue.compareToAscii(GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH(GRAPHOBJ_URLPREFIX) ) != 0 ) |
2682 |
{ |
2701 |
{ |
2683 |
aFileDlg.SetDisplayDirectory( sCurValue ); |
2702 |
aFileDlg.SetDisplayDirectory( sCurValue ); |
2684 |
// TODO: need to set the display directory _and_ the default name |
2703 |
// TODO: need to set the display directory _and_ the default name |
Lines 2687-2693
namespace pcr
Link Here
|
2687 |
_rClearBeforeDialog.clear(); |
2706 |
_rClearBeforeDialog.clear(); |
2688 |
bool bSuccess = ( 0 == aFileDlg.Execute() ); |
2707 |
bool bSuccess = ( 0 == aFileDlg.Execute() ); |
2689 |
if ( bSuccess ) |
2708 |
if ( bSuccess ) |
2690 |
_out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath(); |
2709 |
{ |
|
|
2710 |
if ( bHandleNonLink && xController.is() ) |
2711 |
{ |
2712 |
xController->getValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bIsLink; |
2713 |
} |
2714 |
if ( !bIsLink ) |
2715 |
{ |
2716 |
Graphic aGraphic; |
2717 |
aFileDlg.GetGraphic( aGraphic ); |
2718 |
|
2719 |
Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObject::create( m_aContext.getUNOContext() ); |
2720 |
xGrfObj->setGraphic( aGraphic.GetXGraphic() ); |
2721 |
|
2722 |
|
2723 |
_out_rNewValue <<= xGrfObj; |
2724 |
|
2725 |
} |
2726 |
else |
2727 |
_out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath(); |
2728 |
} |
2691 |
return bSuccess; |
2729 |
return bSuccess; |
2692 |
} |
2730 |
} |
2693 |
|
2731 |
|