LibreOffice Module sd (master) 1
tpaction.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <svx/svxids.hrc>
21#include <com/sun/star/presentation/ClickAction.hpp>
22#include <com/sun/star/embed/NeedsRunningStateException.hpp>
23#include <com/sun/star/embed/VerbDescriptor.hpp>
24#include <com/sun/star/embed/EmbedStates.hpp>
25#include <com/sun/star/embed/XEmbeddedObject.hpp>
26#include <comphelper/string.hxx>
27#include <com/sun/star/embed/VerbAttributes.hpp>
28#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
29
30#include <sdattr.hrc>
31#include <sfx2/sfxresid.hxx>
32#include <sfx2/strings.hrc>
33#include <o3tl/safeint.hxx>
34#include <tools/debug.hxx>
35#include <sfx2/app.hxx>
36#include <svx/svdograf.hxx>
37#include <svl/stritem.hxx>
38#include <svx/svdoole2.hxx>
39#include <sfx2/docfile.hxx>
40#include <svx/xtable.hxx>
41#include <vcl/mnemonic.hxx>
42#include <svl/intitem.hxx>
43#include <svl/urihelper.hxx>
45#include <svx/drawitem.hxx>
46#include <osl/diagnose.h>
47#include <o3tl/string_view.hxx>
48#include <View.hxx>
49#include <sdresid.hxx>
50#include <tpaction.hxx>
51#include <ViewShell.hxx>
52#include <drawdoc.hxx>
53#include <DrawDocShell.hxx>
54#include <strings.hrc>
55
56#include <filedlg.hxx>
57
58#include <algorithm>
59
60using namespace ::com::sun::star;
61using namespace com::sun::star::uno;
62using namespace com::sun::star::lang;
63
64#define DOCUMENT_TOKEN '#'
65
66// XML content stream
67constexpr OUStringLiteral pStarDrawXMLContent( u"content.xml" );
68
72SdActionDlg::SdActionDlg(weld::Window* pParent, const SfxItemSet* pAttr, ::sd::View const * pView)
73 : SfxSingleTabDialogController(pParent, pAttr, "modules/simpress/ui/interactiondialog.ui",
74 "InteractionDialog")
75{
76 std::unique_ptr<SfxTabPage> xNewPage = SdTPAction::Create(get_content_area(), this, *pAttr);
77
78 // formerly in PageCreated
79 static_cast<SdTPAction*>( xNewPage.get() )->SetView( pView );
80 static_cast<SdTPAction*>( xNewPage.get() )->Construct();
81
82 SetTabPage(std::move(xNewPage));
83}
84
89 : SfxTabPage(pPage, pController, "modules/simpress/ui/interactionpage.ui", "InteractionPage", &rInAttrs)
90 , mpView(nullptr)
91 , mpDoc(nullptr)
92 , bTreeUpdated(false)
93 , m_xLbAction(m_xBuilder->weld_combo_box("listbox"))
94 , m_xFtTree(m_xBuilder->weld_label("fttree"))
95 , m_xLbTree(new SdPageObjsTLV(m_xBuilder->weld_tree_view("tree")))
96 , m_xLbTreeDocument(new SdPageObjsTLV(m_xBuilder->weld_tree_view("treedoc")))
97 , m_xLbOLEAction(m_xBuilder->weld_tree_view("oleaction"))
98 , m_xFrame(m_xBuilder->weld_frame("frame"))
99 , m_xEdtSound(m_xBuilder->weld_entry("sound"))
100 , m_xEdtBookmark(m_xBuilder->weld_entry("bookmark"))
101 , m_xEdtDocument(m_xBuilder->weld_entry("document"))
102 , m_xEdtProgram(m_xBuilder->weld_entry("program"))
103 , m_xEdtMacro(m_xBuilder->weld_entry("macro"))
104 , m_xBtnSearch(m_xBuilder->weld_button("browse"))
105 , m_xBtnSeek(m_xBuilder->weld_button("find"))
106{
107 m_xLbOLEAction->set_size_request(m_xLbOLEAction->get_approximate_digit_width() * 48,
108 m_xLbOLEAction->get_height_rows(12));
109
110 m_xBtnSearch->connect_clicked( LINK( this, SdTPAction, ClickSearchHdl ) );
111 m_xBtnSeek->connect_clicked( LINK( this, SdTPAction, ClickSearchHdl ) );
112
113 // this page needs ExchangeSupport
115
116 m_xLbAction->connect_changed( LINK( this, SdTPAction, ClickActionHdl ) );
117 m_xLbTree->connect_changed( LINK( this, SdTPAction, SelectTreeHdl ) );
118 m_xEdtDocument->connect_focus_out( LINK( this, SdTPAction, CheckFileHdl ) );
119 m_xEdtMacro->connect_focus_out( LINK( this, SdTPAction, CheckFileHdl ) );
120
121 //Lock to initial max size
122 Size aSize(m_xContainer->get_preferred_size());
123 m_xContainer->set_size_request(aSize.Width(), aSize.Height());
124
125 ClickActionHdl( *m_xLbAction );
126}
127
129{
130}
131
132void SdTPAction::SetView( const ::sd::View* pSdView )
133{
134 mpView = pSdView;
135
136 // get ColorTable and fill ListBox
138 if( pDocSh && pDocSh->GetViewShell() )
139 {
140 mpDoc = pDocSh->GetDoc();
141 SfxViewFrame* pFrame = pDocSh->GetViewShell()->GetViewFrame();
142 m_xLbTree->SetViewFrame( pFrame );
143 m_xLbTreeDocument->SetViewFrame( pFrame );
144
145 pColList = pDocSh->GetItem( SID_COLOR_TABLE )->GetColorList();
146 DBG_ASSERT( pColList.is(), "No color table available!" );
147 }
148 else
149 {
150 OSL_FAIL("sd::SdTPAction::SetView(), no docshell or viewshell?");
151 }
152}
153
155{
156 // fill OLE-Actionlistbox
157 SdrOle2Obj* pOleObj = nullptr;
158 SdrGrafObj* pGrafObj = nullptr;
159 bool bOLEAction = false;
160
161 if ( mpView->AreObjectsMarked() )
162 {
163 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
164 if (rMarkList.GetMarkCount() == 1)
165 {
166 SdrMark* pMark = rMarkList.GetMark(0);
167 SdrObject* pObj = pMark->GetMarkedSdrObj();
168
169 SdrInventor nInv = pObj->GetObjInventor();
170 SdrObjKind nSdrObjKind = pObj->GetObjIdentifier();
171
172 if (nInv == SdrInventor::Default && nSdrObjKind == SdrObjKind::OLE2)
173 {
174 pOleObj = static_cast<SdrOle2Obj*>(pObj);
175 }
176 else if (nInv == SdrInventor::Default && nSdrObjKind == SdrObjKind::Graphic)
177 {
178 pGrafObj = static_cast<SdrGrafObj*>(pObj);
179 }
180 }
181 }
182 if( pGrafObj )
183 {
184 bOLEAction = true;
185
186 aVerbVector.push_back( 0 );
187 m_xLbOLEAction->append_text( MnemonicGenerator::EraseAllMnemonicChars( SdResId( STR_EDIT_OBJ ) ) );
188 }
189 else if( pOleObj )
190 {
191 const uno::Reference < embed::XEmbeddedObject >& xObj = pOleObj->GetObjRef();
192 if ( xObj.is() )
193 {
194 bOLEAction = true;
195 uno::Sequence < embed::VerbDescriptor > aVerbs;
196 try
197 {
198 aVerbs = xObj->getSupportedVerbs();
199 }
200 catch ( embed::NeedsRunningStateException& )
201 {
202 xObj->changeState( embed::EmbedStates::RUNNING );
203 aVerbs = xObj->getSupportedVerbs();
204 }
205
206 for( const embed::VerbDescriptor& aVerb : std::as_const(aVerbs) )
207 {
208 if( aVerb.VerbAttributes & embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU )
209 {
210 OUString aTmp( aVerb.VerbName );
211 aVerbVector.push_back( aVerb.VerbID );
213 }
214 }
215 }
216 }
217
218 maCurrentActions.push_back( presentation::ClickAction_NONE );
219 maCurrentActions.push_back( presentation::ClickAction_PREVPAGE );
220 maCurrentActions.push_back( presentation::ClickAction_NEXTPAGE );
221 maCurrentActions.push_back( presentation::ClickAction_FIRSTPAGE );
222 maCurrentActions.push_back( presentation::ClickAction_LASTPAGE );
223 maCurrentActions.push_back( presentation::ClickAction_BOOKMARK );
224 maCurrentActions.push_back( presentation::ClickAction_DOCUMENT );
225 maCurrentActions.push_back( presentation::ClickAction_SOUND );
226 if( bOLEAction && m_xLbOLEAction->n_children() )
227 maCurrentActions.push_back( presentation::ClickAction_VERB );
228 maCurrentActions.push_back( presentation::ClickAction_PROGRAM );
229 maCurrentActions.push_back( presentation::ClickAction_MACRO );
230 maCurrentActions.push_back( presentation::ClickAction_STOPPRESENTATION );
231
232 // fill Action-Listbox
233 for (const presentation::ClickAction & rAction : maCurrentActions)
234 {
235 TranslateId pRId = GetClickActionSdResId(rAction);
236 m_xLbAction->append_text(SdResId(pRId));
237 }
238
239}
240
242{
243 bool bModified = false;
244 presentation::ClickAction eCA = presentation::ClickAction_NONE;
245
246 if (m_xLbAction->get_active() != -1)
247 eCA = GetActualClickAction();
248
249 if( m_xLbAction->get_value_changed_from_saved() )
250 {
251 rAttrs->Put( SfxUInt16Item( ATTR_ACTION, static_cast<sal_uInt16>(eCA) ) );
252 bModified = true;
253 }
254 else
255 rAttrs->InvalidateItem( ATTR_ACTION );
256
257 OUString aFileName = GetEditText( true );
258 if( aFileName.isEmpty() )
259 rAttrs->InvalidateItem( ATTR_ACTION_FILENAME );
260 else
261 {
262 if( mpDoc && mpDoc->GetDocSh() && mpDoc->GetDocSh()->GetMedium() )
263 {
264 OUString aBaseURL = mpDoc->GetDocSh()->GetMedium()->GetBaseURL();
265 if( eCA == presentation::ClickAction_SOUND ||
266 eCA == presentation::ClickAction_DOCUMENT ||
267 eCA == presentation::ClickAction_PROGRAM )
268 aFileName = ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), aFileName, URIHelper::GetMaybeFileHdl(), true, false,
271
272 rAttrs->Put( SfxStringItem( ATTR_ACTION_FILENAME, aFileName ) );
273 bModified = true;
274 }
275 else
276 {
277 OSL_FAIL("sd::SdTPAction::FillItemSet(), I need a medium!");
278 }
279 }
280
281 return bModified;
282}
283
284void SdTPAction::Reset( const SfxItemSet* rAttrs )
285{
286 presentation::ClickAction eCA = presentation::ClickAction_NONE;
287 OUString aFileName;
288
289 // m_xLbAction
290 if( rAttrs->GetItemState( ATTR_ACTION ) != SfxItemState::DONTCARE )
291 {
292 eCA = static_cast<presentation::ClickAction>( rAttrs->
293 Get( ATTR_ACTION ).GetValue());
295 }
296 else
297 m_xLbAction->set_active(-1);
298
299 // m_xEdtSound
300 if( rAttrs->GetItemState( ATTR_ACTION_FILENAME ) != SfxItemState::DONTCARE )
301 {
302 aFileName = rAttrs->Get( ATTR_ACTION_FILENAME ).GetValue();
303 SetEditText( aFileName );
304 }
305
306 switch( eCA )
307 {
308 case presentation::ClickAction_BOOKMARK:
309 {
310 if (!m_xLbTree->SelectEntry(aFileName))
311 m_xLbTree->unselect_all();
312 }
313 break;
314
315 case presentation::ClickAction_DOCUMENT:
316 {
318 m_xLbTreeDocument->SelectEntry( o3tl::getToken(aFileName, 1, DOCUMENT_TOKEN ) );
319 }
320 break;
321
322 default:
323 break;
324 }
325 ClickActionHdl( *m_xLbAction );
326
327 m_xLbAction->save_value();
328 m_xEdtSound->save_value();
329}
330
332{
333}
334
336{
337 if( pPageSet )
338 FillItemSet( pPageSet );
339
340 return DeactivateRC::LeavePage;
341}
342
343std::unique_ptr<SfxTabPage> SdTPAction::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrs)
344{
345 return std::make_unique<SdTPAction>( pPage, pController, rAttrs );
346}
347
349{
350 if( !bTreeUpdated && mpDoc && mpDoc->GetDocSh() && mpDoc->GetDocSh()->GetMedium() )
351 {
352 m_xLbTree->Fill( mpDoc, true, mpDoc->GetDocSh()->GetMedium()->GetName() );
353 bTreeUpdated = true;
354 }
355}
356
358{
359 // Soundpreview only for interaction with sound
360 presentation::ClickAction eCA = GetActualClickAction();
361 bool bSound = ( eCA == presentation::ClickAction_SOUND );
362 bool bPage = ( eCA == presentation::ClickAction_BOOKMARK );
363 bool bDocument = ( eCA == presentation::ClickAction_DOCUMENT ||
364 eCA == presentation::ClickAction_PROGRAM );
365 bool bMacro = ( eCA == presentation::ClickAction_MACRO );
366
367 if( bPage )
368 {
369 // search in the TreeLB for the specified object
370 m_xLbTree->SelectEntry(GetEditText());
371 }
372 else
373 {
374 OUString aFile( GetEditText() );
375
376 if (bSound)
377 {
378 SdOpenSoundFileDialog aFileDialog(GetFrameWeld());
379
380 if( !aFile.isEmpty() )
381 aFileDialog.SetPath( aFile );
382
383 if( aFileDialog.Execute() == ERRCODE_NONE )
384 {
385 aFile = aFileDialog.GetPath();
386 SetEditText( aFile );
387 }
388 }
389 else if (bMacro)
390 {
391 // choose macro dialog
392 OUString aScriptURL = SfxApplication::ChooseScript(GetFrameWeld());
393
394 if ( !aScriptURL.isEmpty() )
395 {
396 SetEditText( aScriptURL );
397 }
398 }
399 else
400 {
401 sfx2::FileDialogHelper aFileDialog(
402 ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
403 FileDialogFlags::NONE, GetFrameWeld());
405
406 // The following is a workaround for #i4306#:
407 // The addition of the implicitly existing "all files"
408 // filter makes the (Windows system) open file dialog follow
409 // links on the desktop to directories.
410 aFileDialog.AddFilter (
411 SfxResId(STR_SFX_FILTERNAME_ALL),
412 "*.*");
413
414 if( aFileDialog.Execute() == ERRCODE_NONE )
415 {
416 aFile = aFileDialog.GetPath();
417 SetEditText( aFile );
418 }
419 if( bDocument )
420 CheckFileHdl( *m_xEdtDocument );
421 }
422 }
423}
424
426{
427 OpenFileDialog();
428}
429
431{
432 presentation::ClickAction eCA = GetActualClickAction();
433
434 // hide controls we don't need
435 switch( eCA )
436 {
437 case presentation::ClickAction_NONE:
438 case presentation::ClickAction_INVISIBLE:
439 case presentation::ClickAction_PREVPAGE:
440 case presentation::ClickAction_NEXTPAGE:
441 case presentation::ClickAction_FIRSTPAGE:
442 case presentation::ClickAction_LASTPAGE:
443 case presentation::ClickAction_STOPPRESENTATION:
444 default:
445 m_xFtTree->hide();
446 m_xLbTree->hide();
447 m_xLbTreeDocument->hide();
448 m_xLbOLEAction->hide();
449
450 m_xFrame->hide();
451 m_xEdtSound->hide();
452 m_xEdtBookmark->hide();
453 m_xEdtDocument->hide();
454 m_xEdtProgram->hide();
455 m_xEdtMacro->hide();
456 m_xBtnSearch->hide();
457 m_xBtnSeek->hide();
458 break;
459
460 case presentation::ClickAction_SOUND:
461 case presentation::ClickAction_PROGRAM:
462 case presentation::ClickAction_MACRO:
463 m_xFtTree->hide();
464 m_xLbTree->hide();
465 m_xLbTreeDocument->hide();
466 m_xLbOLEAction->hide();
467
468 m_xEdtDocument->hide();
469
470 if( eCA == presentation::ClickAction_MACRO )
471 {
472 m_xEdtSound->hide();
473 m_xEdtProgram->hide();
474 }
475 else if( eCA == presentation::ClickAction_PROGRAM )
476 {
477 m_xEdtSound->hide();
478 m_xEdtMacro->hide();
479 }
480 else if( eCA == presentation::ClickAction_SOUND )
481 {
482 m_xEdtProgram->hide();
483 m_xEdtMacro->hide();
484 }
485
486 m_xBtnSeek->hide();
487 break;
488
489 case presentation::ClickAction_DOCUMENT:
490 m_xLbTree->hide();
491 m_xLbOLEAction->hide();
492
493 m_xEdtSound->hide();
494 m_xEdtProgram->hide();
495 m_xEdtMacro->hide();
496 m_xEdtBookmark->hide();
497 m_xBtnSeek->hide();
498 break;
499
500 case presentation::ClickAction_BOOKMARK:
501 m_xLbTreeDocument->hide();
502 m_xLbOLEAction->hide();
503 m_xEdtSound->hide();
504 m_xEdtDocument->hide();
505 m_xEdtProgram->hide();
506 m_xEdtMacro->hide();
507 m_xBtnSearch->hide();
508 break;
509
510 case presentation::ClickAction_VERB:
511 m_xLbTree->hide();
512 m_xEdtDocument->hide();
513 m_xEdtProgram->hide();
514 m_xEdtBookmark->hide();
515 m_xEdtMacro->hide();
516 m_xBtnSearch->hide();
517 m_xFrame->hide();
518 m_xEdtSound->hide();
519 m_xBtnSeek->hide();
520 break;
521 }
522
523 // show controls we do need
524 switch( eCA )
525 {
526 case presentation::ClickAction_NONE:
527 case presentation::ClickAction_INVISIBLE:
528 case presentation::ClickAction_PREVPAGE:
529 case presentation::ClickAction_NEXTPAGE:
530 case presentation::ClickAction_FIRSTPAGE:
531 case presentation::ClickAction_LASTPAGE:
532 case presentation::ClickAction_STOPPRESENTATION:
533 // none
534 break;
535
536 case presentation::ClickAction_SOUND:
537 m_xFrame->show();
538 m_xEdtSound->show();
539 m_xEdtSound->set_sensitive(true);
540 m_xBtnSearch->show();
541 m_xBtnSearch->set_sensitive(true);
542 m_xFrame->set_label( SdResId( STR_EFFECTDLG_SOUND ) );
543 break;
544
545 case presentation::ClickAction_PROGRAM:
546 case presentation::ClickAction_MACRO:
547 m_xFrame->show();
548 m_xBtnSearch->show();
549 m_xBtnSearch->set_sensitive(true);
550 if( eCA == presentation::ClickAction_MACRO )
551 {
552 m_xEdtMacro->show();
553 m_xFrame->set_label( SdResId( STR_EFFECTDLG_MACRO ) );
554 }
555 else
556 {
557 m_xEdtProgram->show();
558 m_xFrame->set_label( SdResId( STR_EFFECTDLG_PROGRAM ) );
559 }
560 break;
561
562 case presentation::ClickAction_DOCUMENT:
563 m_xFtTree->show();
564 m_xLbTreeDocument->show();
565
566 m_xFrame->show();
567 m_xEdtDocument->show();
568 m_xBtnSearch->show();
569 m_xBtnSearch->set_sensitive(true);
570
571 m_xFtTree->set_label( SdResId( STR_EFFECTDLG_JUMP ) );
572 m_xFrame->set_label( SdResId( STR_EFFECTDLG_DOCUMENT ) );
573
574 CheckFileHdl( *m_xEdtDocument );
575 break;
576
577 case presentation::ClickAction_VERB:
578 m_xFtTree->show();
579 m_xLbOLEAction->show();
580
581 m_xFtTree->set_label( SdResId( STR_EFFECTDLG_ACTION ) );
582 break;
583
584 case presentation::ClickAction_BOOKMARK:
585 UpdateTree();
586
587 m_xFtTree->show();
588 m_xLbTree->show();
589
590 m_xFrame->show();
591 m_xEdtBookmark->show();
592 m_xBtnSeek->show();
593
594 m_xFtTree->set_label( SdResId( STR_EFFECTDLG_JUMP ) );
595 m_xFrame->set_label( SdResId( STR_EFFECTDLG_PAGE_OBJECT ) );
596 break;
597 default:
598 break;
599 }
600}
601
603{
604 m_xEdtBookmark->set_text( m_xLbTree->get_selected_text() );
605}
606
608{
609 OUString aFile( GetEditText() );
610
611 if( aFile == aLastFile )
612 return;
613
614 bool bHideTreeDocument = true;
615
616 if (mpDoc)
617 {
618 // check if it is a valid draw file
619 SfxMedium aMedium( aFile,
620 StreamMode::READ | StreamMode::NOCREATE );
621
622 if( aMedium.IsStorage() )
623 {
625
626 // is it a draw file?
627 // open with READ, otherwise the Storages might write into the file!
628 uno::Reference < embed::XStorage > xStorage = aMedium.GetStorage();
629 DBG_ASSERT( xStorage.is(), "No storage!" );
630
631 if (xStorage.is())
632 {
633 try
634 {
635 if (xStorage->hasByName(pStarDrawXMLContent))
636 {
637 if (SdDrawDocument* pBookmarkDoc = mpDoc->OpenBookmarkDoc(aFile))
638 {
639 aLastFile = aFile;
640
641 m_xLbTreeDocument->clear();
642 m_xLbTreeDocument->Fill(pBookmarkDoc, true, aFile);
643 mpDoc->CloseBookmarkDoc();
644 m_xLbTreeDocument->show();
645 bHideTreeDocument = false;
646 }
647 }
648 }
649 catch (...)
650 {
651 }
652 }
653 }
654 }
655
656 if (bHideTreeDocument)
657 m_xLbTreeDocument->hide();
658}
659
660presentation::ClickAction SdTPAction::GetActualClickAction()
661{
662 presentation::ClickAction eCA = presentation::ClickAction_NONE;
663 int nPos = m_xLbAction->get_active();
664 if (nPos != -1 && o3tl::make_unsigned(nPos) < maCurrentActions.size())
665 eCA = maCurrentActions[ nPos ];
666 return eCA;
667}
668
669void SdTPAction::SetActualClickAction( presentation::ClickAction eCA )
670{
671 std::vector<css::presentation::ClickAction>::const_iterator pIter =
672 std::find(maCurrentActions.begin(),maCurrentActions.end(),eCA);
673
674 if ( pIter != maCurrentActions.end() )
675 m_xLbAction->set_active(pIter-maCurrentActions.begin());
676}
677
678void SdTPAction::SetEditText( OUString const & rStr )
679{
680 presentation::ClickAction eCA = GetActualClickAction();
681 OUString aText(rStr);
682
683 // possibly convert URI back to system path
684 switch( eCA )
685 {
686 case presentation::ClickAction_DOCUMENT:
688 aText = rStr.getToken( 0, DOCUMENT_TOKEN );
689
690 [[fallthrough]];
691 case presentation::ClickAction_SOUND:
692 case presentation::ClickAction_PROGRAM:
693 {
694 INetURLObject aURL( aText );
695
696 // try to convert to system path
697 OUString aTmpStr(aURL.getFSysPath(FSysStyle::Detect));
698
699 if( !aTmpStr.isEmpty() )
700 aText = aTmpStr; // was a system path
701 }
702 break;
703 default:
704 break;
705 }
706
707 // set the string to the corresponding control
708 switch( eCA )
709 {
710 case presentation::ClickAction_SOUND:
711 m_xEdtSound->set_text(aText );
712 break;
713 case presentation::ClickAction_VERB:
714 {
715 ::std::vector< tools::Long >::iterator aFound( ::std::find( aVerbVector.begin(), aVerbVector.end(), rStr.toInt32() ) );
716 if( aFound != aVerbVector.end() )
717 m_xLbOLEAction->select(aFound - aVerbVector.begin());
718 }
719 break;
720 case presentation::ClickAction_PROGRAM:
721 m_xEdtProgram->set_text( aText );
722 break;
723 case presentation::ClickAction_MACRO:
724 m_xEdtMacro->set_text( aText );
725 break;
726 case presentation::ClickAction_DOCUMENT:
727 m_xEdtDocument->set_text( aText );
728 break;
729 case presentation::ClickAction_BOOKMARK:
730 m_xEdtBookmark->set_text( aText );
731 break;
732 default:
733 break;
734 }
735}
736
737OUString SdTPAction::GetEditText( bool bFullDocDestination )
738{
739 OUString aStr;
740 presentation::ClickAction eCA = GetActualClickAction();
741
742 switch( eCA )
743 {
744 case presentation::ClickAction_SOUND:
745 aStr = m_xEdtSound->get_text();
746 break;
747 case presentation::ClickAction_VERB:
748 {
749 const int nPos = m_xLbOLEAction->get_selected_index();
750 if (nPos != -1 && o3tl::make_unsigned(nPos) < aVerbVector.size() )
751 aStr = OUString::number( aVerbVector[ nPos ] );
752 return aStr;
753 }
754 case presentation::ClickAction_DOCUMENT:
755 aStr = m_xEdtDocument->get_text();
756 break;
757
758 case presentation::ClickAction_PROGRAM:
759 aStr = m_xEdtProgram->get_text();
760 break;
761
762 case presentation::ClickAction_MACRO:
763 {
764 return m_xEdtMacro->get_text();
765 }
766
767 case presentation::ClickAction_BOOKMARK:
768 return m_xEdtBookmark->get_text();
769
770 default:
771 break;
772 }
773
774 // validate file URI
776 OUString aBaseURL;
777 if( mpDoc && mpDoc->GetDocSh() && mpDoc->GetDocSh()->GetMedium() )
778 aBaseURL = mpDoc->GetDocSh()->GetMedium()->GetBaseURL();
779
780 if( !aStr.isEmpty() && aURL.GetProtocol() == INetProtocol::NotValid )
781 aURL = INetURLObject( ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), aStr, URIHelper::GetMaybeFileHdl() ) );
782
783 // get adjusted file name
785
786 if( bFullDocDestination &&
787 eCA == presentation::ClickAction_DOCUMENT &&
788 m_xLbTreeDocument->get_visible() &&
789 m_xLbTreeDocument->get_selected() )
790 {
791 OUString aTmpStr( m_xLbTreeDocument->get_selected_text() );
792 if( !aTmpStr.isEmpty() )
793 {
794 aStr += OUStringChar(DOCUMENT_TOKEN) + aTmpStr;
795 }
796 }
797
798 return aStr;
799}
800
801/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::lang::XComponent > m_xFrame
static OUString EraseAllMnemonicChars(const OUString &rStr)
SdActionDlg(weld::Window *pParent, const SfxItemSet *pAttr, ::sd::View const *pView)
Constructor of the Tab dialog: appends the pages to the dialog.
Definition: tpaction.cxx:72
SdDrawDocument * OpenBookmarkDoc(const OUString &rBookmarkFile)
Definition: drawdoc3.cxx:256
SAL_DLLPRIVATE::sd::DrawDocShell * GetDocSh() const
Definition: drawdoc.hxx:242
The class SdOpenSoundFileDialog wraps the FileDialogHelper, displaying the FILEOPEN_PLAY dialog templ...
Definition: filedlg.hxx:40
void SetPath(const OUString &rPath)
Definition: filedlg.cxx:252
OUString GetPath() const
Definition: filedlg.cxx:247
Interaction-Tab-Page.
Definition: tpaction.hxx:49
void OpenFileDialog()
Definition: tpaction.cxx:357
void SetView(const ::sd::View *pSdView)
Definition: tpaction.cxx:132
virtual ~SdTPAction() override
Definition: tpaction.cxx:128
std::unique_ptr< SdPageObjsTLV > m_xLbTree
Definition: tpaction.hxx:62
void UpdateTree()
Definition: tpaction.cxx:348
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: tpaction.cxx:331
css::presentation::ClickAction GetActualClickAction()
Definition: tpaction.cxx:660
std::unique_ptr< weld::Entry > m_xEdtMacro
Definition: tpaction.hxx:70
std::unique_ptr< weld::Button > m_xBtnSearch
Definition: tpaction.hxx:71
std::unique_ptr< weld::Entry > m_xEdtProgram
Definition: tpaction.hxx:69
::std::vector< tools::Long > aVerbVector
Definition: tpaction.hxx:58
void Construct()
Definition: tpaction.cxx:154
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &)
Definition: tpaction.cxx:343
std::unique_ptr< weld::ComboBox > m_xLbAction
Definition: tpaction.hxx:60
std::unique_ptr< SdPageObjsTLV > m_xLbTreeDocument
Definition: tpaction.hxx:63
XColorListRef pColList
Definition: tpaction.hxx:53
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tpaction.cxx:335
std::unique_ptr< weld::Entry > m_xEdtBookmark
Definition: tpaction.hxx:67
SdTPAction(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
Action-TabPage.
Definition: tpaction.cxx:88
std::unique_ptr< weld::Button > m_xBtnSeek
Definition: tpaction.hxx:72
virtual bool FillItemSet(SfxItemSet *) override
Definition: tpaction.cxx:241
virtual void Reset(const SfxItemSet *) override
Definition: tpaction.cxx:284
std::unique_ptr< weld::Entry > m_xEdtSound
Definition: tpaction.hxx:66
void SetActualClickAction(css::presentation::ClickAction eCA)
Definition: tpaction.cxx:669
OUString GetEditText(bool bURL=false)
Definition: tpaction.cxx:737
bool bTreeUpdated
Definition: tpaction.hxx:55
void SetEditText(OUString const &rStr)
Definition: tpaction.cxx:678
SdDrawDocument * mpDoc
Definition: tpaction.hxx:52
std::vector< css::presentation::ClickAction > maCurrentActions
Definition: tpaction.hxx:56
static SD_DLLPUBLIC TranslateId GetClickActionSdResId(css::presentation::ClickAction eCA)
Definition: unomodel.cxx:150
std::unique_ptr< weld::TreeView > m_xLbOLEAction
Definition: tpaction.hxx:64
std::unique_ptr< weld::Entry > m_xEdtDocument
Definition: tpaction.hxx:68
const ::sd::View * mpView
Definition: tpaction.hxx:51
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
bool AreObjectsMarked() const
SdrObject * GetMarkedSdrObj() const
virtual SdrInventor GetObjInventor() const
virtual SdrObjKind GetObjIdentifier() const
css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef() const
static OUString ChooseScript(weld::Window *pParent)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void InvalidateItem(sal_uInt16 nWhich)
css::uno::Reference< css::embed::XStorage > GetStorage(bool bCreateTempFile=true)
bool IsStorage()
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
void SetTabPage(std::unique_ptr< SfxTabPage > xTabPage)
weld::Container * get_content_area()
void SetExchangeSupport()
weld::Window * GetFrameWeld() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
sd::ViewShell * GetViewShell()
SdDrawDocument * GetDoc()
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
Definition: viewshel.cxx:118
DrawDocShell * GetDocSh() const
Definition: View.hxx:142
OUString GetPath() const
void AddFilter(const OUString &rFilterName, const OUString &rExtension)
void SetContext(Context _eNewContext)
#define DBG_ASSERT(sCon, aError)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
URL aURL
#define ERRCODE_NONE
sal_uInt16 nPos
aStr
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
Reference< XNameAccess > m_xContainer
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
SFX2_DLLPUBLIC OUString SfxResId(TranslateId aId)
UnoViewSharedPtr mpView
SdrInventor
SdrObjKind
DeactivateRC
constexpr OUStringLiteral pStarDrawXMLContent(u"content.xml")
IMPL_LINK_NOARG(SdTPAction, ClickSearchHdl, weld::Button &, void)
Definition: tpaction.cxx:425
#define DOCUMENT_TOKEN
Definition: tpaction.cxx:64