27#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
39#include <svx/strings.hrc>
40#include <svx/svxids.hrc>
46#include <osl/diagnose.h>
72 if ( ( nSID == SID_IMAP_EXEC ) && pItem )
95 const TargetList* pTargetList,
void* pEditingObj )
99 pDlg->
UpdateLink(rGraphic, pImageMap, pTargetList, pEditingObj);
105 , aIMapItem(*this, *_pBindings)
107 , m_xTbxIMapDlg1(m_xBuilder->weld_toolbar(
"toolbar"))
108 , m_xFtURL(m_xBuilder->weld_label(
"urlft"))
109 , m_xURLBox(new
SvtURLBox(m_xBuilder->weld_combo_box(
"url")))
110 , m_xFtText(m_xBuilder->weld_label(
"textft"))
111 , m_xEdtText(m_xBuilder->weld_entry(
"text"))
112 , m_xFtTarget(m_xBuilder->weld_label(
"targetft"))
113 , m_xCbbTarget(m_xBuilder->weld_combo_box(
"target"))
114 , m_xCancelBtn(m_xBuilder->weld_button(
"cancel"))
115 , m_xStbStatus1(m_xBuilder->weld_label(
"statusurl"))
116 , m_xStbStatus2(m_xBuilder->weld_label(
"statuspos"))
117 , m_xStbStatus3(m_xBuilder->weld_label(
"statussize"))
118 , m_xIMapWndWeld(new
weld::CustomWeld(*m_xBuilder,
"container", *m_xIMapWnd))
130 for (
const OUString & s : aTmpList)
151 OUString sSelect(
"TBI_SELECT");
153 TbxClickHdl(sSelect);
156 const int nWidth =
m_xStbStatus1->get_pixel_size(
" 9999,99 cm / 9999,99 cm ").Width();
187 if ( m_xTbxIMapDlg1->get_item_sensitive(
"TBI_APPLY") )
190 std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog(
"QueryModifyImageMapChangesDialog"));
197 SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
203 else if( m_xIMapWnd->IsChanged() )
206 std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog(
"QuerySaveImageMapChangesDialog"));
237 for (
const OUString & s : rTargetList)
242 const TargetList* pTargetList,
void* pEditingObj )
244 pOwnData->aUpdateGraphic = rGraphic;
247 pOwnData->aUpdateImageMap = *pImageMap;
249 pOwnData->aUpdateImageMap.ClearImageMap();
251 pOwnData->pUpdateEditingObject = pEditingObj;
260 pOwnData->aUpdateTargetList = *pTargetList;
262 pOwnData->aUpdateTargetList.clear();
272 if (rNewItemId ==
"TBI_APPLY")
274 URLLoseFocusHdl(*m_xCbbTarget);
277 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
280 else if (rNewItemId ==
"TBI_OPEN")
282 else if (rNewItemId ==
"TBI_SAVEAS")
284 else if (rNewItemId ==
"TBI_CLOSE")
285 CancelHdl(*m_xCancelBtn);
286 else if (rNewItemId ==
"TBI_SELECT")
288 SetActiveTool( rNewItemId );
289 m_xIMapWnd->SetEditMode(
true );
291 else if (rNewItemId ==
"TBI_RECT")
293 SetActiveTool( rNewItemId );
296 else if (rNewItemId ==
"TBI_CIRCLE")
298 SetActiveTool( rNewItemId );
301 else if (rNewItemId ==
"TBI_POLY")
303 SetActiveTool( rNewItemId );
306 else if (rNewItemId ==
"TBI_FREEPOLY")
308 SetActiveTool( rNewItemId );
311 else if (rNewItemId ==
"TBI_ACTIVE")
313 URLLoseFocusHdl(*m_xCbbTarget);
314 bool bNewState = !m_xTbxIMapDlg1->get_item_active(rNewItemId);
315 m_xTbxIMapDlg1->set_item_active(rNewItemId, bNewState);
316 m_xIMapWnd->SetCurrentObjState( !bNewState );
318 else if (rNewItemId ==
"TBI_MACRO")
319 m_xIMapWnd->DoMacroAssign();
320 else if (rNewItemId ==
"TBI_PROPERTY")
321 m_xIMapWnd->DoPropertyDialog();
322 else if (rNewItemId ==
"TBI_POLYEDIT")
324 SetActiveTool( rNewItemId );
325 m_xIMapWnd->SetPolyEditMode( m_xTbxIMapDlg1->get_item_active(rNewItemId) ? SID_BEZIER_MOVE : 0 );
327 else if (rNewItemId ==
"TBI_POLYMOVE")
329 SetActiveTool( rNewItemId );
330 m_xIMapWnd->SetPolyEditMode( SID_BEZIER_MOVE );
332 else if (rNewItemId ==
"TBI_POLYINSERT")
334 SetActiveTool( rNewItemId );
335 m_xIMapWnd->SetPolyEditMode( SID_BEZIER_INSERT );
337 else if (rNewItemId ==
"TBI_POLYDELETE")
339 SetActiveTool( rNewItemId );
340 m_xIMapWnd->GetSdrView()->DeleteMarkedPoints();
342 else if (rNewItemId ==
"TBI_UNDO")
344 URLLoseFocusHdl(*m_xCbbTarget);
345 m_xIMapWnd->GetSdrModel()->Undo();
347 else if (rNewItemId ==
"TBI_REDO")
349 URLLoseFocusHdl(*m_xCbbTarget);
350 m_xIMapWnd->GetSdrModel()->Redo();
357 css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
361 const OUString aFilter(
SvxResId(RID_SVXSTR_IMAP_ALL_FILTER));
375 DBG_ASSERT(
aURL.GetProtocol() != INetProtocol::NotValid,
"invalid URL" );
380 aLoadIMap.
Read( *pIStm, IMapFormat::Detect );
382 if( pIStm->GetError() )
397 css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE,
404 const bool bChanged = pModel->
IsChanged();
420 if ( aFilter == aBinFilter )
422 nFormat = IMapFormat::Binary;
425 else if ( aFilter == aCERNFilter )
427 nFormat = IMapFormat::CERN;
430 else if ( aFilter == aNCSAFilter )
432 nFormat = IMapFormat::NCSA;
442 if(
aURL.GetProtocol() == INetProtocol::NotValid )
444 OSL_FAIL(
"invalid URL" );
448 if(
aURL.getExtension().isEmpty() )
449 aURL.setExtension( aExt );
454 m_xIMapWnd->GetImageMap().Write( *pOStm, nFormat );
456 if( pOStm->GetError() )
475 m_xTbxIMapDlg1->set_item_active(
"TBI_FREEPOLY", rId ==
u"TBI_FREEPOLY");
477 m_xTbxIMapDlg1->set_item_active(
"TBI_POLYINSERT", rId ==
u"TBI_POLYINSERT");
480 bool bMove = rId ==
u"TBI_POLYMOVE"
481 || ( rId ==
u"TBI_POLYEDIT"
487 bool bEditMode = ( rId ==
u"TBI_POLYEDIT" )
488 || ( rId ==
u"TBI_POLYMOVE")
489 || ( rId ==
u"TBI_POLYINSERT")
490 || ( rId ==
u"TBI_POLYDELETE" );
501 if (!rInfo.
aMarkURL.isEmpty() && ( m_xURLBox->find_text(rInfo.
aMarkURL) == -1))
502 m_xURLBox->append_text(rInfo.
aMarkURL);
504 m_xURLBox->set_entry_text(rInfo.
aMarkURL);
515 m_xTbxIMapDlg1->set_item_active(
"TBI_ACTIVE",
false);
516 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_ACTIVE",
false);
517 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_MACRO",
false);
518 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_PROPERTY",
false);
519 m_xStbStatus1->set_label(OUString());
521 m_xFtURL->set_sensitive(
false);
522 m_xURLBox->set_sensitive(
false);
523 m_xFtText->set_sensitive(
false);
524 m_xEdtText->set_sensitive(
false);
525 m_xFtTarget->set_sensitive(
false);
526 m_xCbbTarget->set_sensitive(
false);
528 m_xURLBox->set_entry_text(
"" );
529 m_xEdtText->set_text(
"" );
533 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_ACTIVE",
true);
534 m_xTbxIMapDlg1->set_item_active(
"TBI_ACTIVE", !rInfo.
bActivated );
535 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_MACRO",
true);
536 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_PROPERTY",
true);
538 m_xFtURL->set_sensitive(
true);
539 m_xURLBox->set_sensitive(
true);
540 m_xFtText->set_sensitive(
true);
541 m_xEdtText->set_sensitive(
true);
542 m_xFtTarget->set_sensitive(
true);
543 m_xCbbTarget->set_sensitive(
true);
545 m_xStbStatus1->set_label(rInfo.
aMarkURL);
547 if ( m_xURLBox->get_active_text() != rInfo.
aMarkURL )
548 m_xURLBox->set_entry_text( rInfo.
aMarkURL );
563 const Point& rMousePos = pWnd->GetMousePos();
570 m_xStbStatus2->set_label(
aStr);
576 const Size& rSize = pWnd->GetGraphicSize();
583 m_xStbStatus3->set_label(
aStr);
594 m_xIMapWnd->ReplaceActualIMapInfo( aNewInfo );
610 const OUString aURLText( m_xURLBox->get_active_text() );
611 const OUString aTargetText( m_xCbbTarget->get_active_text() );
613 if ( !aURLText.isEmpty() )
625 if ( aTargetText.isEmpty() )
630 m_xIMapWnd->ReplaceActualIMapInfo( aNewInfo );
635 pOwnData->aIdle.Stop();
637 if ( pOwnData->pUpdateEditingObject != pCheckObj )
639 if (m_xIMapWnd->IsChanged())
642 std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog(
"QuerySaveImageMapChangesDialog"));
649 m_xIMapWnd->SetGraphic( pOwnData->aUpdateGraphic );
650 m_xIMapWnd->SetImageMap( pOwnData->aUpdateImageMap );
651 SetTargetList( pOwnData->aUpdateTargetList );
652 pCheckObj = pOwnData->pUpdateEditingObject;
655 m_xTbxIMapDlg1->set_item_active(
"TBI_SELECT",
true);
656 m_xIMapWnd->SetEditMode(
true );
660 pOwnData->aUpdateTargetList.clear();
663 m_xIMapWnd->QueueIdleUpdate();
668 const SdrObject* pObj = pWnd->GetSelectedSdrObject();
669 const SdrModel* pModel = pWnd->GetSdrModel();
670 const SdrView* pView = pWnd->GetSdrView();
671 const bool bPolyEdit = ( pObj != nullptr ) &&
dynamic_cast<const SdrPathObj*
>( pObj) !=
nullptr;
672 const bool bDrawEnabled = !( bPolyEdit && m_xTbxIMapDlg1->get_item_active(
"TBI_POLYEDIT") );
674 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_APPLY", pOwnData->bExecState && pWnd->IsChanged() );
676 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_SELECT", bDrawEnabled);
677 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_RECT", bDrawEnabled);
678 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_CIRCLE", bDrawEnabled);
679 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_POLY", bDrawEnabled);
680 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_FREEPOLY", bDrawEnabled);
683 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_POLYEDIT", bPolyEdit );
684 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_POLYMOVE", !bDrawEnabled );
685 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_POLYINSERT", !bDrawEnabled );
689 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_UNDO", pModel->
HasUndoActions() );
690 m_xTbxIMapDlg1->set_item_sensitive(
"TBI_REDO", pModel->
HasRedoActions() );
694 switch( pWnd->GetPolyEditMode() )
696 case SID_BEZIER_MOVE:
697 m_xTbxIMapDlg1->set_item_active(
"TBI_POLYMOVE",
true);
698 m_xTbxIMapDlg1->set_item_active(
"TBI_POLYINSERT",
false);
700 case SID_BEZIER_INSERT:
701 m_xTbxIMapDlg1->set_item_active(
"TBI_POLYINSERT",
true);
702 m_xTbxIMapDlg1->set_item_active(
"TBI_POLYMOVE",
false);
710 m_xTbxIMapDlg1->set_item_active(
"TBI_POLYEDIT",
false );
711 m_xTbxIMapDlg1->set_item_active(
"TBI_POLYMOVE",
true);
712 m_xTbxIMapDlg1->set_item_active(
"TBI_POLYINSERT",
false );
713 pWnd->SetPolyEditMode( 0 );
716 m_xIMapWnd->QueueIdleUpdate();
723 if (pViewFrm && pViewFrm->
HasChildWindow(SvxIMapDlgChildWindow::GetChildWindowId()))
724 pWnd = pViewFrm->
GetChildWindow(SvxIMapDlgChildWindow::GetChildWindowId());
Reference< XExecutableDialog > m_xDialog
static const AllSettings & GetSettings()
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
void Read(SvStream &rIStm)
const OUString & getNumDecimalSep() const
constexpr tools::Long Y() const
constexpr tools::Long X() const
virtual void SetChanged(bool bFlg=true)
bool HasRedoActions() const
bool HasUndoActions() const
bool IsDeleteMarkedPointsPossible() const override
SfxDispatcher * GetDispatcher() const
void Invalidate(sal_uInt16 nId)
void SetController(std::shared_ptr< SfxDialogController > controller)
std::shared_ptr< SfxDialogController > & GetController()
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
SfxViewFrame * GetFrame() const
SfxModule * GetModule() const
static void GetDefaultTargetList(TargetList &)
OUString GetBaseURL(bool bForSaving=false)
void Initialize(SfxChildWinInfo const *pInfo)
FieldUnit GetFieldUnit() const
SfxMedium * GetMedium() const
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
bool HasChildWindow(sal_uInt16)
SfxChildWindow * GetChildWindow(sal_uInt16)
virtual SfxObjectShell * GetObjectShell() override
constexpr tools::Long Height() const
constexpr tools::Long Width() const
SvxIMapDlgChildWindow(vcl::Window *, sal_uInt16, SfxBindings *, SfxChildWinInfo const *)
static void UpdateIMapDlg(const Graphic &rGraphic, const ImageMap *pImageMap, const TargetList *pTargetList, void *pEditingObj)
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
SvxIMapDlgItem(SvxIMapDlg &rIMapDlg, SfxBindings &rBindings)
std::unique_ptr< weld::Label > m_xStbStatus1
std::unique_ptr< weld::Toolbar > m_xTbxIMapDlg1
SvxIMapDlg(SfxBindings *pBindings, SfxChildWindow *pCW, weld::Window *pParent)
void SetExecState(bool bEnable)
std::unique_ptr< weld::ComboBox > m_xCbbTarget
std::unique_ptr< IMapWindow > m_xIMapWnd
std::unique_ptr< weld::Button > m_xCancelBtn
std::unique_ptr< weld::Label > m_xStbStatus3
std::unique_ptr< weld::Label > m_xFtText
void SetActiveTool(std::u16string_view rId)
std::unique_ptr< IMapOwnData > pOwnData
std::unique_ptr< weld::Label > m_xFtURL
std::unique_ptr< weld::Label > m_xStbStatus2
std::unique_ptr< SvtURLBox > m_xURLBox
std::unique_ptr< weld::Entry > m_xEdtText
const ImageMap & GetImageMap() const
void SetTargetList(const TargetList &rTargetList)
std::unique_ptr< weld::Label > m_xFtTarget
virtual ~SvxIMapDlg() override
void UpdateLink(const Graphic &rGraphic, const ImageMap *pImageMap, const TargetList *pTargetList, void *pEditingObj)
void AddFilter(const OUString &rFilterName, const OUString &rExtension)
OUString GetCurrentFilter() const
void SetCurrentFilter(const OUString &rFilter)
void SetContext(Context _eNewContext)
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
weld::Window * GetFrameWeld() const
#define DBG_ASSERT(sCon, aError)
OUString SvxResId(TranslateId aId)
virtual SfxBindings & GetBindings() override
OUString GetUnitString(tools::Long nVal_100, FieldUnit eFieldUnit, sal_Unicode cSep)
#define ERRCODE_IO_GENERAL
::std::vector< OUString > TargetList
constexpr OUStringLiteral IMAP_CERN_FILTER
constexpr OUStringLiteral IMAP_BINARY_TYPE
constexpr OUStringLiteral IMAP_CERN_TYPE
constexpr OUStringLiteral SELF_TARGET
constexpr OUStringLiteral IMAP_BINARY_FILTER
IMPL_LINK_NOARG(SvxIMapDlg, CancelHdl, weld::Button &, void)
constexpr OUStringLiteral IMAP_NCSA_TYPE
IMPL_LINK(SvxIMapDlg, TbxClickHdl, const OUString &, rNewItemId, void)
constexpr OUStringLiteral IMAP_ALL_TYPE
constexpr OUStringLiteral IMAP_NCSA_FILTER
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(SvxIMapDlgChildWindow, SID_IMAP)
SvxIMapDlg * GetIMapDlg()
#define LINK(Instance, Class, Member)
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
const LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
@ CircleOrEllipse
rectangle (round corners optional)
@ FreehandFill
open free-hand line