diff options
29 files changed, 218 insertions, 21 deletions
diff --git a/fpicker/source/aqua/ControlHelper.hxx b/fpicker/source/aqua/ControlHelper.hxx index a657104c4ba3..227e5472f6af 100644 --- a/fpicker/source/aqua/ControlHelper.hxx +++ b/fpicker/source/aqua/ControlHelper.hxx @@ -82,6 +82,7 @@ public: VERSION, TEMPLATE, IMAGE_TEMPLATE, + IMAGE_ANCHOR, LIST_LAST }; diff --git a/fpicker/source/aqua/ControlHelper.mm b/fpicker/source/aqua/ControlHelper.mm index 0c459e23cee8..54af583b3338 100644 --- a/fpicker/source/aqua/ControlHelper.mm +++ b/fpicker/source/aqua/ControlHelper.mm @@ -205,6 +205,11 @@ void ControlHelper::initialize( sal_Int16 nTemplateId ) m_bToggleVisibility[PREVIEW] = true; m_bListVisibility[IMAGE_TEMPLATE] = true; break; + case FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR: + m_bToggleVisibility[LINK] = true; + m_bToggleVisibility[PREVIEW] = true; + m_bListVisibility[IMAGE_ANCHOR] = true; + break; case FILEOPEN_READONLY_VERSION: m_bToggleVisibility[READONLY] = true; m_bListVisibility[VERSION] = true; @@ -539,6 +544,7 @@ void ControlHelper::createControls() MAP_LIST_(VERSION); MAP_LIST_(TEMPLATE); MAP_LIST_(IMAGE_TEMPLATE); + MAP_LIST_(IMAGE_ANCHOR); } m_aActiveControls.push_back(m_pListControls[i]); @@ -612,6 +618,7 @@ int ControlHelper::getControlElementName(const Class aClazz, const int nControlI LIST_ELEMENT( VERSION ); LIST_ELEMENT( TEMPLATE ); LIST_ELEMENT( IMAGE_TEMPLATE ); + LIST_ELEMENT( IMAGE_ANCHOR ); } } @@ -730,9 +737,11 @@ case ExtendedFilePickerElementIds::LISTBOX_##elem##_LABEL: \ MAP_LIST( VERSION ); MAP_LIST( TEMPLATE ); MAP_LIST( IMAGE_TEMPLATE ); + MAP_LIST( IMAGE_ANCHOR ); MAP_LIST_LABEL( VERSION ); MAP_LIST_LABEL( TEMPLATE ); MAP_LIST_LABEL( IMAGE_TEMPLATE ); + MAP_LIST_LABEL( IMAGE_ANCHOR ); default: SAL_INFO("fpicker.aqua","Handle unknown control " << nControlId); break; diff --git a/fpicker/source/aqua/SalAquaFilePicker.mm b/fpicker/source/aqua/SalAquaFilePicker.mm index 2ab668c0ba32..e76a30b67203 100644 --- a/fpicker/source/aqua/SalAquaFilePicker.mm +++ b/fpicker/source/aqua/SalAquaFilePicker.mm @@ -426,6 +426,9 @@ void SAL_CALL SalAquaFilePicker::initialize( const uno::Sequence<uno::Any>& aArg case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE: m_nDialogType = NAVIGATIONSERVICES_OPEN; break; + case FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR: + m_nDialogType = NAVIGATIONSERVICES_OPEN; + break; case FILEOPEN_PLAY: m_nDialogType = NAVIGATIONSERVICES_OPEN; break; diff --git a/fpicker/source/aqua/resourceprovider.mm b/fpicker/source/aqua/resourceprovider.mm index cdd039ce389b..49009ca16136 100644 --- a/fpicker/source/aqua/resourceprovider.mm +++ b/fpicker/source/aqua/resourceprovider.mm @@ -62,6 +62,7 @@ Entry const CtrlIdToResIdTable[] = { { LISTBOX_VERSION_LABEL, STR_SVT_FILEPICKER_VERSION }, { LISTBOX_TEMPLATE_LABEL, STR_SVT_FILEPICKER_TEMPLATES }, { LISTBOX_IMAGE_TEMPLATE_LABEL, STR_SVT_FILEPICKER_IMAGE_TEMPLATE }, + { LISTBOX_IMAGE_ANCHOR_LABEL, STR_SVT_FILEPICKER_IMAGE_ANCHOR }, { CHECKBOX_SELECTION, STR_SVT_FILEPICKER_SELECTION }, { FOLDERPICKER_TITLE, STR_SVT_FOLDERPICKER_DEFAULT_TITLE }, { FOLDER_PICKER_DEF_DESCRIPTION, STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION }, diff --git a/fpicker/source/office/OfficeControlAccess.cxx b/fpicker/source/office/OfficeControlAccess.cxx index 968e29a825ed..0175c6840008 100644 --- a/fpicker/source/office/OfficeControlAccess.cxx +++ b/fpicker/source/office/OfficeControlAccess.cxx @@ -78,6 +78,8 @@ namespace svt { "FilterOptionsBox", CHECKBOX_FILTEROPTIONS, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX }, { "GpgPassword", CHECKBOX_GPGENCRYPTION, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX }, { "HelpButton", PUSHBUTTON_HELP, PROPERTY_FLAGS_COMMON | PropFlags::Text }, + { "ImageAnchorList", LISTBOX_IMAGE_ANCHOR, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_LISTBOX }, + { "ImageAnchorListLabel", LISTBOX_IMAGE_ANCHOR_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text }, { "ImageTemplateList", LISTBOX_IMAGE_TEMPLATE, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_LISTBOX }, { "ImageTemplateListLabel", LISTBOX_IMAGE_TEMPLATE_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text }, { "LevelUpButton", TOOLBOXBUTOON_LEVEL_UP, PROPERTY_FLAGS_COMMON }, @@ -367,6 +369,7 @@ namespace svt case LISTBOX_VERSION: case LISTBOX_TEMPLATE: case LISTBOX_IMAGE_TEMPLATE: + case LISTBOX_IMAGE_ANCHOR: if ( ControlActions::SET_SELECT_ITEM == _nControlAction ) { nPropertyId = PropFlags::SelectedItemIndex; @@ -428,6 +431,7 @@ namespace svt case LISTBOX_VERSION: case LISTBOX_TEMPLATE: case LISTBOX_IMAGE_TEMPLATE: + case LISTBOX_IMAGE_ANCHOR: switch ( _nControlAction ) { case ControlActions::GET_SELECTED_ITEM: diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index 27b6b905b006..82f9dca8bf12 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -289,6 +289,10 @@ PickerFlags SvtFilePicker::getPickerFlags() { nBits = PickerFlags::Open | PickerFlags::InsertAsLink | PickerFlags::ShowPreview; } + else if ( m_nServiceType == TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR ) + { + nBits = PickerFlags::Open | PickerFlags::InsertAsLink | PickerFlags::ShowPreview | PickerFlags::ImageAnchor; + } else if ( m_nServiceType == TemplateDescription::FILEOPEN_PREVIEW ) { nBits = PickerFlags::Open | PickerFlags::ShowPreview; diff --git a/fpicker/source/office/fpdialogbase.hxx b/fpicker/source/office/fpdialogbase.hxx index 5d41a3a2f8be..f845812ff9ce 100644 --- a/fpicker/source/office/fpdialogbase.hxx +++ b/fpicker/source/office/fpdialogbase.hxx @@ -52,9 +52,10 @@ enum class PickerFlags { Password = 0x001000, ReadOnly = 0x002000, MultiSelection = 0x004000, + ImageAnchor = 0x008000, }; namespace o3tl { - template<> struct typed_flags<PickerFlags> : is_typed_flags<PickerFlags, 0x007fff> {}; + template<> struct typed_flags<PickerFlags> : is_typed_flags<PickerFlags, 0x00ffff> {}; } #define FILEDIALOG_FILTER_ALL "*.*" diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index f497ba451f1c..e5ffecdf0dd0 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -564,6 +564,8 @@ void SvtFileDialog::Init_Impl get(pImpl->_pLbTemplates, "shared"); get(pImpl->_pFtImageTemplates, "shared_label"); get(pImpl->_pLbImageTemplates, "shared"); + get(pImpl->_pFtImageAnchor, "shared_label"); + get(pImpl->_pLbImageAnchor, "shared"); pImpl->_pLbImageTemplates->setMaxWidthChars(40); pImpl->_pLbFilter->setMaxWidthChars(40); @@ -2381,6 +2383,12 @@ Control* SvtFileDialog::getControl( sal_Int16 _nControlId, bool _bLabelControl ) : static_cast< Control* >( pImpl->_pLbImageTemplates ); break; + case LISTBOX_IMAGE_ANCHOR: + pReturn = _bLabelControl + ? static_cast< Control* >( pImpl->_pFtImageAnchor ) + : static_cast< Control* >( pImpl->_pLbImageAnchor ); + break; + case LISTBOX_VERSION_LABEL: pReturn = pImpl->_pFtFileVersion; break; @@ -2393,6 +2401,10 @@ Control* SvtFileDialog::getControl( sal_Int16 _nControlId, bool _bLabelControl ) pReturn = pImpl->_pFtImageTemplates; break; + case LISTBOX_IMAGE_ANCHOR_LABEL: + pReturn = pImpl->_pFtImageAnchor; + break; + case PUSHBUTTON_OK: pReturn = pImpl->_pBtnFileOpen; break; @@ -2532,6 +2544,14 @@ void SvtFileDialog::AddControls_Impl( ) pImpl->_pLbImageTemplates->SetHelpId( HID_FILEOPEN_IMAGE_TEMPLATE ); pImpl->_pLbImageTemplates->Show(); } + else if ( _nPickerFlags & PickerFlags::ImageAnchor ) + { + pImpl->_pFtImageAnchor->SetText( FpsResId( STR_SVT_FILEPICKER_IMAGE_ANCHOR ) ); + pImpl->_pFtImageAnchor->Show(); + + pImpl->_pLbImageAnchor->SetHelpId( HID_FILEOPEN_IMAGE_ANCHOR ); + pImpl->_pLbImageAnchor->Show(); + } pImpl->_pPlaces = VclPtr<PlacesListBox>::Create(_pContainer, this, FpsResId(STR_PLACES_TITLE), WB_BORDER); pImpl->_pPlaces->SetHelpId("SVT_HID_FILESAVE_PLACES_LISTBOX"); diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx index 5b9593caba87..6328c7a44d19 100644 --- a/fpicker/source/office/iodlgimp.cxx +++ b/fpicker/source/office/iodlgimp.cxx @@ -186,6 +186,8 @@ SvtExpFileDlg_Impl::SvtExpFileDlg_Impl() : _pLbTemplates ( nullptr ), _pFtImageTemplates ( nullptr ), _pLbImageTemplates ( nullptr ), + _pFtImageAnchor ( nullptr ), + _pLbImageAnchor ( nullptr ), _pFtFileType ( nullptr ), _pLbFilter ( nullptr ), _pBtnFileOpen ( nullptr ), diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx index c0d6a5523c82..2146900e15df 100644 --- a/fpicker/source/office/iodlgimp.hxx +++ b/fpicker/source/office/iodlgimp.hxx @@ -137,6 +137,9 @@ public: VclPtr<FixedText> _pFtImageTemplates; VclPtr<ListBox> _pLbImageTemplates; + VclPtr<FixedText> _pFtImageAnchor; + VclPtr<ListBox> _pLbImageAnchor; + VclPtr<FixedText> _pFtFileType; VclPtr<ListBox> _pLbFilter; VclPtr<PushButton> _pBtnFileOpen; diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx index 231072c7fbc0..c0dde13bda80 100644 --- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx @@ -425,6 +425,15 @@ void SAL_CALL VistaFilePicker::initialize(const css::uno::Sequence< css::uno::An } break; + case css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR : + { + bFileOpenDialog = true; + nFeatures |= FEATURE_LINK; + nFeatures |= FEATURE_PREVIEW; + nFeatures |= FEATURE_IMAGEANCHOR; + } + break; + case css::ui::dialogs::TemplateDescription::FILEOPEN_PLAY : { bFileOpenDialog = true; diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx index 759228ffeae3..dfc99a336187 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx @@ -87,6 +87,7 @@ static const GUID CLIENTID_FILESAVE_PASSWORD = {0xC12D4F4C, 0x4D41, 0x4D4 static const GUID CLIENTID_FILESAVE_SELECTION = {0x5B2482B3, 0x0358, 0x4E09, 0xAA, 0x64, 0x2B, 0x76, 0xB2, 0xA0, 0xDD, 0xFE}; static const GUID CLIENTID_FILESAVE_TEMPLATE = {0x9996D877, 0x20D5, 0x424B, 0x9C, 0x2E, 0xD3, 0xB6, 0x31, 0xEC, 0xF7, 0xCE}; static const GUID CLIENTID_FILEOPEN_LINK_TEMPLATE = {0x32237796, 0x1509, 0x49D1, 0xBB, 0x7E, 0x63, 0xAD, 0x36, 0xAE, 0x86, 0x8C}; +static const GUID CLIENTID_FILEOPEN_LINK_ANCHOR = {0xBE3188CB, 0x399A, 0x45AE, 0x8F, 0x78, 0x75, 0x17, 0xAF, 0x26, 0x81, 0xEA}; static const GUID CLIENTID_FILEOPEN_PLAY = {0x32CFB147, 0xF5AE, 0x4F90, 0xA1, 0xF1, 0x81, 0x20, 0x72, 0xBB, 0x2F, 0xC5}; static const GUID CLIENTID_FILEOPEN_LINK = {0x39AC4BAE, 0x7D2D, 0x46BC, 0xBE, 0x2E, 0xF8, 0x8C, 0xB5, 0x65, 0x5E, 0x6A}; @@ -492,6 +493,7 @@ static const ::sal_Int32 GROUP_VERSION = 1; static const ::sal_Int32 GROUP_TEMPLATE = 2; static const ::sal_Int32 GROUP_IMAGETEMPLATE = 3; static const ::sal_Int32 GROUP_CHECKBOXES = 4; +static const ::sal_Int32 GROUP_IMAGEANCHOR = 5; static void setLabelToControl(TFileDialogCustomize iCustom, sal_uInt16 nControlId) @@ -535,6 +537,10 @@ void VistaFilePickerImpl::impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_I aGUID = CLIENTID_FILEOPEN_LINK_TEMPLATE; break; + case css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR : + aGUID = CLIENTID_FILEOPEN_LINK_ANCHOR; + break; + case css::ui::dialogs::TemplateDescription::FILEOPEN_PLAY : case css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PLAY : aGUID = CLIENTID_FILEOPEN_PLAY; @@ -573,6 +579,14 @@ void VistaFilePickerImpl::impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_I iCustom->MakeProminent (GROUP_IMAGETEMPLATE); } + if ((nFeatures & FEATURE_IMAGEANCHOR) == FEATURE_IMAGEANCHOR) + { + iCustom->StartVisualGroup (GROUP_IMAGEANCHOR, o3tl::toW(FpsResId(STR_SVT_FILEPICKER_IMAGE_ANCHOR).replaceFirst("~","").getStr())); + iCustom->AddComboBox (css::ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_IMAGE_ANCHOR); + iCustom->EndVisualGroup (); + iCustom->MakeProminent (GROUP_IMAGEANCHOR); + } + iCustom->StartVisualGroup (GROUP_CHECKBOXES, L""); sal_uInt16 nControlId(0); @@ -1058,6 +1072,7 @@ void VistaFilePickerImpl::impl_sta_SetControlValue(const RequestRef& rRequest) case css::ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_VERSION : case css::ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_TEMPLATE : case css::ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE : + case css::ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_IMAGE_ANCHOR : { HRESULT hResult; switch (nAction) @@ -1132,6 +1147,7 @@ void VistaFilePickerImpl::impl_sta_GetControlValue(const RequestRef& rRequest) case css::ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_VERSION: case css::ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_TEMPLATE: case css::ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE: + case css::ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_IMAGE_ANCHOR: { DWORD bValue = 0; HRESULT hResult = iCustom->GetSelectedControlItem(nId, &bValue); diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx index 4b51f9162165..f8a67d414d6d 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx @@ -58,6 +58,7 @@ static const ::sal_Int32 FEATURE_PLAY = 256; static const ::sal_Int32 FEATURE_READONLY = 512; static const ::sal_Int32 FEATURE_VERSION = 1024; static const ::sal_Int32 FEATURE_GPGPASSWORD = 2048; +static const ::sal_Int32 FEATURE_IMAGEANCHOR = 4096; static const OUString PROP_PICKER_LISTENER("picker_listener" ); // [XFilePickerListenert] static const OUString PROP_DIALOG_SHOW_RESULT("dialog_show_result" ); // [sal_Bool] true=OK, false=CANCEL diff --git a/fpicker/source/win32/misc/resourceprovider.cxx b/fpicker/source/win32/misc/resourceprovider.cxx index b7b70d4d45de..a0d536f23032 100644 --- a/fpicker/source/win32/misc/resourceprovider.cxx +++ b/fpicker/source/win32/misc/resourceprovider.cxx @@ -59,6 +59,7 @@ Entry const CtrlIdToResIdTable[] = { { LISTBOX_VERSION_LABEL, STR_SVT_FILEPICKER_VERSION }, { LISTBOX_TEMPLATE_LABEL, STR_SVT_FILEPICKER_TEMPLATES }, { LISTBOX_IMAGE_TEMPLATE_LABEL, STR_SVT_FILEPICKER_IMAGE_TEMPLATE }, + { LISTBOX_IMAGE_ANCHOR_LABEL, STR_SVT_FILEPICKER_IMAGE_ANCHOR }, { CHECKBOX_SELECTION, STR_SVT_FILEPICKER_SELECTION }, { FOLDERPICKER_TITLE, STR_SVT_FOLDERPICKER_DEFAULT_TITLE }, { FOLDER_PICKER_DEF_DESCRIPTION, STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION }, diff --git a/include/fpicker/strings.hrc b/include/fpicker/strings.hrc index eee7cc86f385..3452509ab6b2 100644 --- a/include/fpicker/strings.hrc +++ b/include/fpicker/strings.hrc @@ -23,6 +23,7 @@ #define STR_SVT_FILEPICKER_VERSION NC_("STR_SVT_FILEPICKER_VERSION", "~Version:") #define STR_SVT_FILEPICKER_TEMPLATES NC_("STR_SVT_FILEPICKER_TEMPLATES", "S~tyles:") #define STR_SVT_FILEPICKER_IMAGE_TEMPLATE NC_("STR_SVT_FILEPICKER_IMAGE_TEMPLATE", "Style:") +#define STR_SVT_FILEPICKER_IMAGE_ANCHOR NC_("STR_SVT_FILEPICKER_IMAGE_ANCHOR", "A~nchor:") #define STR_SVT_FILEPICKER_SELECTION NC_("STR_SVT_FILEPICKER_SELECTION", "~Selection") #define STR_SVT_FILEPICKER_FILTER_TITLE NC_("STR_SVT_FILEPICKER_FILTER_TITLE", "File ~type:") #define STR_SVT_FOLDERPICKER_DEFAULT_TITLE NC_("STR_SVT_FOLDERPICKER_DEFAULT_TITLE", "Select Path") diff --git a/include/sfx2/opengrf.hxx b/include/sfx2/opengrf.hxx index 21c01426e3ca..775750c0895b 100644 --- a/include/sfx2/opengrf.hxx +++ b/include/sfx2/opengrf.hxx @@ -23,12 +23,17 @@ #include <vcl/graphicfilter.hxx> #include <sfx2/dllapi.h> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> + struct SvxOpenGrf_Impl; class SFX2_DLLPUBLIC SvxOpenGraphicDialog { public: SvxOpenGraphicDialog(const OUString& rTitle, const vcl::Window* pPreferredParent); + SvxOpenGraphicDialog(const OUString& rTitle, const vcl::Window* pPreferredParent, + sal_Int16 nDialogType); ~SvxOpenGraphicDialog(); ErrCode Execute(); @@ -50,6 +55,8 @@ public: OUString const & GetDetectedFilter() const; void SetDetectedFilter(const OUString&); + css::uno::Reference<css::ui::dialogs::XFilePickerControlAccess> GetFilePickerControlAccess(); + private: SvxOpenGraphicDialog (const SvxOpenGraphicDialog&) = delete; SvxOpenGraphicDialog& operator = ( const SvxOpenGraphicDialog & ) = delete; diff --git a/include/svtools/helpids.h b/include/svtools/helpids.h index 309a42260de3..0c296ba613c2 100644 --- a/include/svtools/helpids.h +++ b/include/svtools/helpids.h @@ -43,6 +43,7 @@ #define HID_FILEOPEN_READONLY "SVT_HID_FILEOPEN_READONLY" #define HID_FILEOPEN_VERSION "SVT_HID_FILEOPEN_VERSION" #define HID_FILEOPEN_IMAGE_TEMPLATE "SVT_HID_FILEOPEN_IMAGE_TEMPLATE" +#define HID_FILEOPEN_IMAGE_ANCHOR "SVT_HID_FILEOPEN_IMAGE_ANCHOR" #define HID_WIZARD_NEXT "SVT_HID_WIZARD_NEXT" #define HID_WIZARD_PREVIOUS "SVT_HID_WIZARD_PREVIOUS" diff --git a/offapi/com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.idl b/offapi/com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.idl index 3464eb3872ae..b0f516e6efd5 100644 --- a/offapi/com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.idl +++ b/offapi/com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.idl @@ -50,6 +50,8 @@ published constants ExtendedFilePickerElementIds const short LISTBOX_IMAGE_TEMPLATE_LABEL = 209; const short LISTBOX_FILTER_SELECTOR = 210; const short CHECKBOX_GPGENCRYPTION = 211; + const short LISTBOX_IMAGE_ANCHOR = 212; + const short LISTBOX_IMAGE_ANCHOR_LABEL = 213; }; diff --git a/offapi/com/sun/star/ui/dialogs/TemplateDescription.idl b/offapi/com/sun/star/ui/dialogs/TemplateDescription.idl index bbb670a844fa..2879f72a7a92 100644 --- a/offapi/com/sun/star/ui/dialogs/TemplateDescription.idl +++ b/offapi/com/sun/star/ui/dialogs/TemplateDescription.idl @@ -133,6 +133,18 @@ published constants TemplateDescription @since LibreOffice 5.3 */ const short FILEOPEN_LINK_PLAY = 12; + + /** A FileOpen dialog with additional controls. + <ul> + <li>A checkbox "Insert as link" + <li>A checkbox "Show Preview" + <li>A listbox "Image Anchor" for choosing how to anchor the image in Calc.</li> + <li>A window for displaying a file preview</li> + </ul> + + @since LibreOffice 6.1 + */ + const short FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR = 13; }; diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index 2d3ad92c3c6b..7aaf4fa723fb 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -330,6 +330,9 @@ #define STR_ZTEST_Z_CRITICAL_TWO_TAIL NC_("STR_ZTEST_Z_CRITICAL_TWO_TAIL", "z Critical two-tail") /*infobar for allowing links to update or not*/ #define STR_ENABLE_CONTENT NC_("STR_ENABLE_CONTENT", "Enable Content") +/*Insert image dialog*/ +#define STR_ANCHOR_TO_CELL NC_("STR_ANCHOR_TO_CELL", "To cell") +#define STR_ANCHOR_TO_PAGE NC_("STR_ANCHOR_TO_PAGE", "To page") #endif diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index 3672faf98788..4097a6ec6848 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -43,7 +43,13 @@ #include <strings.hrc> #include <globstr.hrc> -using namespace ::com::sun::star; +#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> +#include <com/sun/star/ui/dialogs/ListboxControlActions.hpp> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +using namespace css; +using namespace css::uno; void ScLimitSizeOnDrawPage( Size& rSize, Point& rPos, const Size& rPage ) { @@ -92,7 +98,8 @@ void ScLimitSizeOnDrawPage( Size& rSize, Point& rPos, const Size& rPage ) static void lcl_InsertGraphic( const Graphic& rGraphic, const OUString& rFileName, const OUString& rFilterName, bool bAsLink, bool bApi, - ScTabViewShell* pViewSh, const vcl::Window* pWindow, SdrView* pView ) + ScTabViewShell* pViewSh, const vcl::Window* pWindow, SdrView* pView, + bool bAnchorToCell=true ) { ScDrawView* pDrawView = pViewSh->GetScDrawView(); @@ -164,8 +171,8 @@ static void lcl_InsertGraphic( const Graphic& rGraphic, OUString aName = pLayer->GetNewGraphicName(); // "Graphics" pObj->SetName(aName); - // Anchor images to cell by default, tdf#86739 - ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *(rData.GetDocument()), rData.GetTabNo()); + if (bAnchorToCell) + ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *(rData.GetDocument()), rData.GetTabNo()); // don't select if from (dispatch) API, to allow subsequent cell operations SdrInsertFlags nInsOptions = bApi ? SdrInsertFlags::DONTMARK : SdrInsertFlags::NONE; @@ -258,7 +265,30 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell* pViewSh, } else { - SvxOpenGraphicDialog aDlg(ScResId(STR_INSERTGRAPHIC), pWin); + SvxOpenGraphicDialog aDlg(ScResId(STR_INSERTGRAPHIC), pWin, + ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR); + + Reference<ui::dialogs::XFilePickerControlAccess> xCtrlAcc = aDlg.GetFilePickerControlAccess(); + sal_Int16 nSelect = 0; + Sequence<OUString> aListBoxEntries { + ScResId(STR_ANCHOR_TO_CELL), + ScResId(STR_ANCHOR_TO_PAGE) + }; + try + { + Any aTemplates(&aListBoxEntries, cppu::UnoType<decltype(aListBoxEntries)>::get()); + + xCtrlAcc->setValue(ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_IMAGE_ANCHOR, + ui::dialogs::ListboxControlActions::ADD_ITEMS, aTemplates); + + Any aSelectPos(&nSelect, cppu::UnoType<decltype(nSelect)>::get()); + xCtrlAcc->setValue(ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_IMAGE_ANCHOR, + ui::dialogs::ListboxControlActions::SET_SELECT_ITEM, aSelectPos); + } + catch (const Exception&) + { + SAL_WARN("sc", "control access failed"); + } if( aDlg.Execute() == ERRCODE_NONE ) { @@ -278,7 +308,15 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell* pViewSh, bAsLink = false; // don't store as link } - lcl_InsertGraphic( aGraphic, aFileName, aFilterName, bAsLink, false, pViewSh, pWindow, pView ); + // Anchor to cell or to page? + Any aAnchorValue = xCtrlAcc->getValue( + ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_IMAGE_ANCHOR, + ui::dialogs::ListboxControlActions::GET_SELECTED_ITEM ); + OUString sAnchor; + aAnchorValue >>= sAnchor; + bool bAnchorToCell = sAnchor == ScResId(STR_ANCHOR_TO_CELL); + + lcl_InsertGraphic( aGraphic, aFileName, aFilterName, bAsLink, false, pViewSh, pWindow, pView, bAnchorToCell ); // append items for recording rReq.AppendItem( SfxStringItem( SID_INSERT_GRAPHIC, aFileName ) ); diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx index ad779ac66f71..6d190e45fce2 100644 --- a/sfx2/source/appl/opengrf.cxx +++ b/sfx2/source/appl/opengrf.cxx @@ -70,7 +70,8 @@ const char* SvxOpenGrfErr2ResId( ErrCode err ) struct SvxOpenGrf_Impl { - SvxOpenGrf_Impl(const vcl::Window* pPreferredParent); + SvxOpenGrf_Impl(const vcl::Window* pPreferredParent, + sal_Int16 nDialogType); sfx2::FileDialogHelper aFileDlg; OUString sDetectedFilter; @@ -78,9 +79,9 @@ struct SvxOpenGrf_Impl }; -SvxOpenGrf_Impl::SvxOpenGrf_Impl(const vcl::Window* pPreferredParent) - : aFileDlg(ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW, - FileDialogFlags::Graphic, pPreferredParent) +SvxOpenGrf_Impl::SvxOpenGrf_Impl(const vcl::Window* pPreferredParent, + sal_Int16 nDialogType) + : aFileDlg(nDialogType, FileDialogFlags::Graphic, pPreferredParent) { uno::Reference < XFilePicker3 > xFP = aFileDlg.GetFilePicker(); xCtrlAcc.set(xFP, UNO_QUERY); @@ -88,7 +89,14 @@ SvxOpenGrf_Impl::SvxOpenGrf_Impl(const vcl::Window* pPreferredParent) SvxOpenGraphicDialog::SvxOpenGraphicDialog(const OUString& rTitle, const vcl::Window* pPreferredParent) - : mpImpl(new SvxOpenGrf_Impl(pPreferredParent)) + : mpImpl(new SvxOpenGrf_Impl(pPreferredParent, ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW)) +{ + mpImpl->aFileDlg.SetTitle(rTitle); +} + +SvxOpenGraphicDialog::SvxOpenGraphicDialog(const OUString& rTitle, const vcl::Window* pPreferredParent, + sal_Int16 nDialogType) + : mpImpl(new SvxOpenGrf_Impl(pPreferredParent, nDialogType)) { mpImpl->aFileDlg.SetTitle(rTitle); } @@ -269,4 +277,9 @@ void SvxOpenGraphicDialog::SetDetectedFilter(const OUString& rStr) mpImpl->sDetectedFilter = rStr; } +Reference<ui::dialogs::XFilePickerControlAccess> SvxOpenGraphicDialog::GetFilePickerControlAccess() +{ + return mpImpl->xCtrlAcc; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 12efb69e5645..3d20a6a3333d 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -259,6 +259,11 @@ OUString FileDialogHelper_Impl::handleHelpRequested( const FilePickerEvent& aEve sHelpId = HID_FILEOPEN_IMAGE_TEMPLATE; break; + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_ANCHOR_LABEL : + case ExtendedFilePickerElementIds::LISTBOX_IMAGE_ANCHOR : + sHelpId = HID_FILEOPEN_IMAGE_ANCHOR; + break; + case ExtendedFilePickerElementIds::CHECKBOX_SELECTION : sHelpId = HID_FILESAVE_SELECTION; break; @@ -820,6 +825,7 @@ static open_or_save_t lcl_OpenOrSave(sal_Int16 const nDialogType) { case FILEOPEN_SIMPLE: case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE: + case FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR: case FILEOPEN_PLAY: case FILEOPEN_LINK_PLAY: case FILEOPEN_READONLY_VERSION: @@ -982,10 +988,11 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE: nTemplateDescription = TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE; mbHasPreview = true; + break; - // aPreviewTimer - maPreviewIdle.SetPriority( TaskPriority::LOWEST ); - maPreviewIdle.SetInvokeHandler( LINK( this, FileDialogHelper_Impl, TimeOutHdl_Impl ) ); + case FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR: + nTemplateDescription = TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR; + mbHasPreview = true; break; case FILEOPEN_PLAY: @@ -1004,9 +1011,6 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( case FILEOPEN_LINK_PREVIEW: nTemplateDescription = TemplateDescription::FILEOPEN_LINK_PREVIEW; mbHasPreview = true; - // aPreviewTimer - maPreviewIdle.SetPriority( TaskPriority::LOWEST ); - maPreviewIdle.SetInvokeHandler( LINK( this, FileDialogHelper_Impl, TimeOutHdl_Impl ) ); break; case FILESAVE_AUTOEXTENSION: @@ -1018,9 +1022,6 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( case FILEOPEN_PREVIEW: nTemplateDescription = TemplateDescription::FILEOPEN_PREVIEW; mbHasPreview = true; - // aPreviewTimer - maPreviewIdle.SetPriority( TaskPriority::LOWEST ); - maPreviewIdle.SetInvokeHandler( LINK( this, FileDialogHelper_Impl, TimeOutHdl_Impl ) ); break; default: @@ -1028,6 +1029,12 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( break; } + if (mbHasPreview) + { + maPreviewIdle.SetPriority( TaskPriority::LOWEST ); + maPreviewIdle.SetInvokeHandler( LINK( this, FileDialogHelper_Impl, TimeOutHdl_Impl ) ); + } + Sequence < Any > aInitArguments( !mpPreferredParentWindow ? 3 : 4 ); // This is a hack. We currently know that the internal file picker implementation diff --git a/vcl/inc/strings.hrc b/vcl/inc/strings.hrc index 3960232843f7..f9ee189f6d90 100644 --- a/vcl/inc/strings.hrc +++ b/vcl/inc/strings.hrc @@ -102,6 +102,7 @@ #define STR_FPICKER_VERSION NC_("STR_FPICKER_VERSION", "~Version:") #define STR_FPICKER_TEMPLATES NC_("STR_FPICKER_TEMPLATES", "S~tyles:") #define STR_FPICKER_IMAGE_TEMPLATE NC_("STR_FPICKER_IMAGE_TEMPLATE", "Frame Style: ") +#define STR_FPICKER_IMAGE_ANCHOR NC_("STR_FPICKER_IMAGE_ANCHOR", "A~nchor: ") #define STR_FPICKER_SELECTION NC_("STR_FPICKER_SELECTION", "~Selection") #define STR_FPICKER_FOLDER_DEFAULT_TITLE NC_("STR_FPICKER_FOLDER_DEFAULT_TITLE", "Select Path") #define STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION NC_("STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION", "Please select a folder.") diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx index 95524567d898..7437bf44cb2a 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx @@ -202,6 +202,7 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext LABEL_LIST( VERSION ); LABEL_LIST( TEMPLATE ); LABEL_LIST( IMAGE_TEMPLATE ); + LABEL_LIST( IMAGE_ANCHOR ); default: SAL_WARN( "vcl.gtk", "Handle unknown control " << i); break; @@ -1079,9 +1080,11 @@ GtkWidget *SalGtkFilePicker::getWidget( sal_Int16 nControlId, GType *pType ) MAP_LIST( VERSION ); MAP_LIST( TEMPLATE ); MAP_LIST( IMAGE_TEMPLATE ); + MAP_LIST( IMAGE_ANCHOR ); MAP_LIST_LABEL( VERSION ); MAP_LIST_LABEL( TEMPLATE ); MAP_LIST_LABEL( IMAGE_TEMPLATE ); + MAP_LIST_LABEL( IMAGE_ANCHOR ); default: SAL_WARN( "vcl.gtk", "Handle unknown control " << nControlId); break; @@ -1643,6 +1646,14 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu mbListVisibility[IMAGE_TEMPLATE] = true; // TODO break; + case FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR: + eAction = GTK_FILE_CHOOSER_ACTION_OPEN; + first_button_text = GTK_STOCK_OPEN; + mbToggleVisibility[LINK] = true; + mbToggleVisibility[PREVIEW] = true; + mbListVisibility[IMAGE_ANCHOR] = true; + // TODO + break; case FILEOPEN_PLAY: eAction = GTK_FILE_CHOOSER_ACTION_OPEN; first_button_text = GTK_STOCK_OPEN; diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx index bac8395a5359..c46f633b8b39 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx +++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx @@ -181,6 +181,7 @@ class SalGtkFilePicker : public SalGtkPicker, public SalGtkFilePicker_Base VERSION, TEMPLATE, IMAGE_TEMPLATE, + IMAGE_ANCHOR, LIST_LAST }; diff --git a/vcl/unx/gtk/fpicker/resourceprovider.cxx b/vcl/unx/gtk/fpicker/resourceprovider.cxx index 3e5469a7c392..2ced7277066c 100644 --- a/vcl/unx/gtk/fpicker/resourceprovider.cxx +++ b/vcl/unx/gtk/fpicker/resourceprovider.cxx @@ -47,6 +47,7 @@ static const struct { LISTBOX_VERSION_LABEL, STR_FPICKER_VERSION }, { LISTBOX_TEMPLATE_LABEL, STR_FPICKER_TEMPLATES }, { LISTBOX_IMAGE_TEMPLATE_LABEL, STR_FPICKER_IMAGE_TEMPLATE }, + { LISTBOX_IMAGE_ANCHOR_LABEL, STR_FPICKER_IMAGE_ANCHOR }, { CHECKBOX_SELECTION, STR_FPICKER_SELECTION }, { FOLDERPICKER_TITLE, STR_FPICKER_FOLDER_DEFAULT_TITLE }, { FOLDER_PICKER_DEF_DESCRIPTION, STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION }, diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx index 8c983996b791..919328dd9d6c 100644 --- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx +++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx @@ -255,9 +255,13 @@ void Gtk3KDE5FilePicker::addCustomControl(sal_Int16 controlId) case LISTBOX_IMAGE_TEMPLATE: resId = STR_FPICKER_IMAGE_TEMPLATE; break; + case LISTBOX_IMAGE_ANCHOR: + resId = STR_FPICKER_IMAGE_ANCHOR; + break; case LISTBOX_VERSION_LABEL: case LISTBOX_TEMPLATE_LABEL: case LISTBOX_IMAGE_TEMPLATE_LABEL: + case LISTBOX_IMAGE_ANCHOR_LABEL: case LISTBOX_FILTER_SELECTOR: break; } @@ -285,9 +289,11 @@ void Gtk3KDE5FilePicker::addCustomControl(sal_Int16 controlId) case LISTBOX_VERSION: case LISTBOX_TEMPLATE: case LISTBOX_IMAGE_TEMPLATE: + case LISTBOX_IMAGE_ANCHOR: case LISTBOX_VERSION_LABEL: case LISTBOX_TEMPLATE_LABEL: case LISTBOX_IMAGE_TEMPLATE_LABEL: + case LISTBOX_IMAGE_ANCHOR_LABEL: case LISTBOX_FILTER_SELECTOR: break; } @@ -363,6 +369,12 @@ void SAL_CALL Gtk3KDE5FilePicker::initialize(const uno::Sequence<uno::Any>& args addCustomControl(LISTBOX_IMAGE_TEMPLATE); break; + case FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR: + addCustomControl(CHECKBOX_LINK); + addCustomControl(CHECKBOX_PREVIEW); + addCustomControl(LISTBOX_IMAGE_ANCHOR); + break; + case FILEOPEN_PLAY: addCustomControl(PUSHBUTTON_PLAY); break; diff --git a/vcl/unx/kde4/KDE4FilePicker.cxx b/vcl/unx/kde4/KDE4FilePicker.cxx index 6e2c90d87953..f601fe59f92f 100644 --- a/vcl/unx/kde4/KDE4FilePicker.cxx +++ b/vcl/unx/kde4/KDE4FilePicker.cxx @@ -563,9 +563,13 @@ void KDE4FilePicker::addCustomControl(sal_Int16 controlId) case LISTBOX_IMAGE_TEMPLATE: resId = STR_FPICKER_IMAGE_TEMPLATE; break; + case LISTBOX_IMAGE_ANCHOR: + resId = STR_FPICKER_IMAGE_ANCHOR; + break; case LISTBOX_VERSION_LABEL: case LISTBOX_TEMPLATE_LABEL: case LISTBOX_IMAGE_TEMPLATE_LABEL: + case LISTBOX_IMAGE_ANCHOR_LABEL: case LISTBOX_FILTER_SELECTOR: break; } @@ -594,9 +598,11 @@ void KDE4FilePicker::addCustomControl(sal_Int16 controlId) case LISTBOX_VERSION: case LISTBOX_TEMPLATE: case LISTBOX_IMAGE_TEMPLATE: + case LISTBOX_IMAGE_ANCHOR: case LISTBOX_VERSION_LABEL: case LISTBOX_TEMPLATE_LABEL: case LISTBOX_IMAGE_TEMPLATE_LABEL: + case LISTBOX_IMAGE_ANCHOR_LABEL: case LISTBOX_FILTER_SELECTOR: break; } @@ -691,6 +697,12 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args ) addCustomControl( LISTBOX_IMAGE_TEMPLATE ); break; + case FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR: + addCustomControl( CHECKBOX_LINK ); + addCustomControl( CHECKBOX_PREVIEW ); + addCustomControl( LISTBOX_IMAGE_ANCHOR ); + break; + case FILEOPEN_PLAY: addCustomControl( PUSHBUTTON_PLAY ); break; |