1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
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>
44 #include <sfx2/filedlghelper.hxx>
45 #include <svx/drawitem.hxx>
46 #include <osl/diagnose.h>
47 #include <o3tl/string_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>
56 #include <filedlg.hxx>
60 using namespace ::com::sun::star
;
61 using namespace com::sun::star::uno
;
63 #define DOCUMENT_TOKEN '#'
66 constexpr OUStringLiteral
pStarDrawXMLContent( u
"content.xml" );
69 * Constructor of the Tab dialog: appends the pages to the dialog
71 SdActionDlg::SdActionDlg(weld::Window
* pParent
, const SfxItemSet
& rAttr
, ::sd::View
const * pView
)
72 : SfxSingleTabDialogController(pParent
, &rAttr
, u
"modules/simpress/ui/interactiondialog.ui"_ustr
,
73 u
"InteractionDialog"_ustr
)
74 , m_xContent(m_xBuilder
->weld_container(u
"content"_ustr
))
76 std::unique_ptr
<SfxTabPage
> xNewPage
= SdTPAction::Create(m_xContent
.get(), this, rAttr
);
78 // formerly in PageCreated
79 static_cast<SdTPAction
*>( xNewPage
.get() )->SetView( pView
);
80 static_cast<SdTPAction
*>( xNewPage
.get() )->Construct();
82 SetTabPage(std::move(xNewPage
));
88 SdTPAction::SdTPAction(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
)
89 : SfxTabPage(pPage
, pController
, u
"modules/simpress/ui/interactionpage.ui"_ustr
, u
"InteractionPage"_ustr
, &rInAttrs
)
93 , m_xLbAction(m_xBuilder
->weld_combo_box(u
"listbox"_ustr
))
94 , m_xFtTree(m_xBuilder
->weld_label(u
"fttree"_ustr
))
95 , m_xLbTree(new SdPageObjsTLV(m_xBuilder
->weld_tree_view(u
"tree"_ustr
)))
96 , m_xLbTreeDocument(new SdPageObjsTLV(m_xBuilder
->weld_tree_view(u
"treedoc"_ustr
)))
97 , m_xLbOLEAction(m_xBuilder
->weld_tree_view(u
"oleaction"_ustr
))
98 , m_xFrame(m_xBuilder
->weld_frame(u
"frame"_ustr
))
99 , m_xEdtSound(m_xBuilder
->weld_entry(u
"sound"_ustr
))
100 , m_xEdtBookmark(m_xBuilder
->weld_entry(u
"bookmark"_ustr
))
101 , m_xEdtDocument(m_xBuilder
->weld_entry(u
"document"_ustr
))
102 , m_xEdtProgram(m_xBuilder
->weld_entry(u
"program"_ustr
))
103 , m_xEdtMacro(m_xBuilder
->weld_entry(u
"macro"_ustr
))
104 , m_xBtnSearch(m_xBuilder
->weld_button(u
"browse"_ustr
))
105 , m_xBtnSeek(m_xBuilder
->weld_button(u
"find"_ustr
))
107 m_xLbOLEAction
->set_size_request(m_xLbOLEAction
->get_approximate_digit_width() * 48,
108 m_xLbOLEAction
->get_height_rows(12));
110 m_xBtnSearch
->connect_clicked( LINK( this, SdTPAction
, ClickSearchHdl
) );
111 m_xBtnSeek
->connect_clicked( LINK( this, SdTPAction
, ClickSearchHdl
) );
113 // this page needs ExchangeSupport
114 SetExchangeSupport();
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
) );
121 //Lock to initial max size
122 Size
aSize(m_xContainer
->get_preferred_size());
123 m_xContainer
->set_size_request(aSize
.Width(), aSize
.Height());
125 ClickActionHdl( *m_xLbAction
);
128 SdTPAction::~SdTPAction()
132 void SdTPAction::SetView( const ::sd::View
* pSdView
)
136 // get ColorTable and fill ListBox
137 ::sd::DrawDocShell
* pDocSh
= mpView
->GetDocSh();
138 if( pDocSh
&& pDocSh
->GetViewShell() )
140 mpDoc
= pDocSh
->GetDoc();
141 SfxViewFrame
* pFrame
= pDocSh
->GetViewShell()->GetViewFrame();
142 m_xLbTree
->SetViewFrame( pFrame
);
143 m_xLbTreeDocument
->SetViewFrame( pFrame
);
147 OSL_FAIL("sd::SdTPAction::SetView(), no docshell or viewshell?");
151 void SdTPAction::Construct()
153 // fill OLE-Actionlistbox
154 SdrOle2Obj
* pOleObj
= nullptr;
155 SdrGrafObj
* pGrafObj
= nullptr;
156 bool bOLEAction
= false;
158 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
159 if ( rMarkList
.GetMarkCount() != 0 )
161 if (rMarkList
.GetMarkCount() == 1)
163 SdrMark
* pMark
= rMarkList
.GetMark(0);
164 SdrObject
* pObj
= pMark
->GetMarkedSdrObj();
166 SdrInventor nInv
= pObj
->GetObjInventor();
167 SdrObjKind nSdrObjKind
= pObj
->GetObjIdentifier();
169 if (nInv
== SdrInventor::Default
&& nSdrObjKind
== SdrObjKind::OLE2
)
171 pOleObj
= static_cast<SdrOle2Obj
*>(pObj
);
173 else if (nInv
== SdrInventor::Default
&& nSdrObjKind
== SdrObjKind::Graphic
)
175 pGrafObj
= static_cast<SdrGrafObj
*>(pObj
);
183 aVerbVector
.push_back( 0 );
184 m_xLbOLEAction
->append_text( MnemonicGenerator::EraseAllMnemonicChars( SdResId( STR_EDIT_OBJ
) ) );
188 const uno::Reference
< embed::XEmbeddedObject
>& xObj
= pOleObj
->GetObjRef();
192 uno::Sequence
< embed::VerbDescriptor
> aVerbs
;
195 aVerbs
= xObj
->getSupportedVerbs();
197 catch ( embed::NeedsRunningStateException
& )
199 xObj
->changeState( embed::EmbedStates::RUNNING
);
200 aVerbs
= xObj
->getSupportedVerbs();
203 for (const embed::VerbDescriptor
& aVerb
: aVerbs
)
205 if( aVerb
.VerbAttributes
& embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU
)
207 OUString
aTmp( aVerb
.VerbName
);
208 aVerbVector
.push_back( aVerb
.VerbID
);
209 m_xLbOLEAction
->append_text( MnemonicGenerator::EraseAllMnemonicChars( aTmp
) );
215 maCurrentActions
.push_back( presentation::ClickAction_NONE
);
216 maCurrentActions
.push_back( presentation::ClickAction_PREVPAGE
);
217 maCurrentActions
.push_back( presentation::ClickAction_NEXTPAGE
);
218 maCurrentActions
.push_back( presentation::ClickAction_FIRSTPAGE
);
219 maCurrentActions
.push_back( presentation::ClickAction_LASTPAGE
);
220 maCurrentActions
.push_back( presentation::ClickAction_BOOKMARK
);
221 maCurrentActions
.push_back( presentation::ClickAction_DOCUMENT
);
222 maCurrentActions
.push_back( presentation::ClickAction_SOUND
);
223 if( bOLEAction
&& m_xLbOLEAction
->n_children() )
224 maCurrentActions
.push_back( presentation::ClickAction_VERB
);
225 maCurrentActions
.push_back( presentation::ClickAction_PROGRAM
);
226 maCurrentActions
.push_back( presentation::ClickAction_MACRO
);
227 maCurrentActions
.push_back( presentation::ClickAction_STOPPRESENTATION
);
229 // fill Action-Listbox
230 for (const presentation::ClickAction
& rAction
: maCurrentActions
)
232 TranslateId pRId
= GetClickActionSdResId(rAction
);
233 m_xLbAction
->append_text(SdResId(pRId
));
238 bool SdTPAction::FillItemSet( SfxItemSet
* rAttrs
)
240 bool bModified
= false;
241 presentation::ClickAction eCA
= presentation::ClickAction_NONE
;
243 if (m_xLbAction
->get_active() != -1)
244 eCA
= GetActualClickAction();
246 if( m_xLbAction
->get_value_changed_from_saved() )
248 rAttrs
->Put( SfxUInt16Item( ATTR_ACTION
, static_cast<sal_uInt16
>(eCA
) ) );
252 rAttrs
->InvalidateItem( ATTR_ACTION
);
254 OUString aFileName
= GetEditText( true );
255 if( aFileName
.isEmpty() )
256 rAttrs
->InvalidateItem( ATTR_ACTION_FILENAME
);
259 if( mpDoc
&& mpDoc
->GetDocSh() && mpDoc
->GetDocSh()->GetMedium() )
261 OUString aBaseURL
= mpDoc
->GetDocSh()->GetMedium()->GetBaseURL();
262 if( eCA
== presentation::ClickAction_SOUND
||
263 eCA
== presentation::ClickAction_DOCUMENT
||
264 eCA
== presentation::ClickAction_PROGRAM
)
265 aFileName
= ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL
), aFileName
, URIHelper::GetMaybeFileHdl(), true, false,
266 INetURLObject::EncodeMechanism::WasEncoded
,
267 INetURLObject::DecodeMechanism::Unambiguous
);
269 rAttrs
->Put( SfxStringItem( ATTR_ACTION_FILENAME
, aFileName
) );
274 OSL_FAIL("sd::SdTPAction::FillItemSet(), I need a medium!");
281 void SdTPAction::Reset( const SfxItemSet
* rAttrs
)
283 presentation::ClickAction eCA
= presentation::ClickAction_NONE
;
287 if( rAttrs
->GetItemState( ATTR_ACTION
) != SfxItemState::INVALID
)
289 eCA
= static_cast<presentation::ClickAction
>( rAttrs
->
290 Get( ATTR_ACTION
).GetValue());
291 SetActualClickAction( eCA
);
294 m_xLbAction
->set_active(-1);
297 if( rAttrs
->GetItemState( ATTR_ACTION_FILENAME
) != SfxItemState::INVALID
)
299 aFileName
= rAttrs
->Get( ATTR_ACTION_FILENAME
).GetValue();
300 SetEditText( aFileName
);
305 case presentation::ClickAction_BOOKMARK
:
307 if (!m_xLbTree
->SelectEntry(aFileName
))
308 m_xLbTree
->unselect_all();
312 case presentation::ClickAction_DOCUMENT
:
314 if( comphelper::string::getTokenCount(aFileName
, DOCUMENT_TOKEN
) == 2 )
315 m_xLbTreeDocument
->SelectEntry( o3tl::getToken(aFileName
, 1, DOCUMENT_TOKEN
) );
322 ClickActionHdl( *m_xLbAction
);
324 m_xLbAction
->save_value();
325 m_xEdtSound
->save_value();
328 void SdTPAction::ActivatePage( const SfxItemSet
& )
332 DeactivateRC
SdTPAction::DeactivatePage( SfxItemSet
* pPageSet
)
335 FillItemSet( pPageSet
);
337 return DeactivateRC::LeavePage
;
340 std::unique_ptr
<SfxTabPage
> SdTPAction::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rAttrs
)
342 return std::make_unique
<SdTPAction
>( pPage
, pController
, rAttrs
);
345 void SdTPAction::UpdateTree()
347 if( !bTreeUpdated
&& mpDoc
&& mpDoc
->GetDocSh() && mpDoc
->GetDocSh()->GetMedium() )
349 m_xLbTree
->Fill( mpDoc
, true, mpDoc
->GetDocSh()->GetMedium()->GetName() );
354 void SdTPAction::OpenFileDialog()
356 // Soundpreview only for interaction with sound
357 presentation::ClickAction eCA
= GetActualClickAction();
358 bool bSound
= ( eCA
== presentation::ClickAction_SOUND
);
359 bool bPage
= ( eCA
== presentation::ClickAction_BOOKMARK
);
360 bool bDocument
= ( eCA
== presentation::ClickAction_DOCUMENT
||
361 eCA
== presentation::ClickAction_PROGRAM
);
362 bool bMacro
= ( eCA
== presentation::ClickAction_MACRO
);
366 // search in the TreeLB for the specified object
367 m_xLbTree
->SelectEntry(GetEditText());
371 OUString
aFile( GetEditText() );
375 SdOpenSoundFileDialog
aFileDialog(GetFrameWeld());
377 if( !aFile
.isEmpty() )
378 aFileDialog
.SetPath( aFile
);
380 if( aFileDialog
.Execute() == ERRCODE_NONE
)
382 aFile
= aFileDialog
.GetPath();
383 SetEditText( aFile
);
388 // choose macro dialog
389 OUString aScriptURL
= SfxApplication::ChooseScript(GetFrameWeld());
391 if ( !aScriptURL
.isEmpty() )
393 SetEditText( aScriptURL
);
398 sfx2::FileDialogHelper
aFileDialog(
399 ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION
,
400 FileDialogFlags::NONE
, GetFrameWeld());
401 aFileDialog
.SetContext(sfx2::FileDialogHelper::ImpressClickAction
);
403 // The following is a workaround for #i4306#:
404 // The addition of the implicitly existing "all files"
405 // filter makes the (Windows system) open file dialog follow
406 // links on the desktop to directories.
407 aFileDialog
.AddFilter (
408 SfxResId(STR_SFX_FILTERNAME_ALL
),
411 if( aFileDialog
.Execute() == ERRCODE_NONE
)
413 aFile
= aFileDialog
.GetPath();
414 SetEditText( aFile
);
417 CheckFileHdl( *m_xEdtDocument
);
422 IMPL_LINK_NOARG(SdTPAction
, ClickSearchHdl
, weld::Button
&, void)
427 IMPL_LINK_NOARG(SdTPAction
, ClickActionHdl
, weld::ComboBox
&, void)
429 presentation::ClickAction eCA
= GetActualClickAction();
431 // hide controls we don't need
434 case presentation::ClickAction_NONE
:
435 case presentation::ClickAction_INVISIBLE
:
436 case presentation::ClickAction_PREVPAGE
:
437 case presentation::ClickAction_NEXTPAGE
:
438 case presentation::ClickAction_FIRSTPAGE
:
439 case presentation::ClickAction_LASTPAGE
:
440 case presentation::ClickAction_STOPPRESENTATION
:
444 m_xLbTreeDocument
->hide();
445 m_xLbOLEAction
->hide();
449 m_xEdtBookmark
->hide();
450 m_xEdtDocument
->hide();
451 m_xEdtProgram
->hide();
453 m_xBtnSearch
->hide();
457 case presentation::ClickAction_SOUND
:
458 case presentation::ClickAction_PROGRAM
:
459 case presentation::ClickAction_MACRO
:
462 m_xLbTreeDocument
->hide();
463 m_xLbOLEAction
->hide();
465 m_xEdtDocument
->hide();
467 if( eCA
== presentation::ClickAction_MACRO
)
470 m_xEdtProgram
->hide();
472 else if( eCA
== presentation::ClickAction_PROGRAM
)
477 else if( eCA
== presentation::ClickAction_SOUND
)
479 m_xEdtProgram
->hide();
486 case presentation::ClickAction_DOCUMENT
:
488 m_xLbOLEAction
->hide();
491 m_xEdtProgram
->hide();
493 m_xEdtBookmark
->hide();
497 case presentation::ClickAction_BOOKMARK
:
498 m_xLbTreeDocument
->hide();
499 m_xLbOLEAction
->hide();
501 m_xEdtDocument
->hide();
502 m_xEdtProgram
->hide();
504 m_xBtnSearch
->hide();
507 case presentation::ClickAction_VERB
:
509 m_xEdtDocument
->hide();
510 m_xEdtProgram
->hide();
511 m_xEdtBookmark
->hide();
513 m_xBtnSearch
->hide();
520 // show controls we do need
523 case presentation::ClickAction_NONE
:
524 case presentation::ClickAction_INVISIBLE
:
525 case presentation::ClickAction_PREVPAGE
:
526 case presentation::ClickAction_NEXTPAGE
:
527 case presentation::ClickAction_FIRSTPAGE
:
528 case presentation::ClickAction_LASTPAGE
:
529 case presentation::ClickAction_STOPPRESENTATION
:
533 case presentation::ClickAction_SOUND
:
536 m_xEdtSound
->set_sensitive(true);
537 m_xBtnSearch
->show();
538 m_xBtnSearch
->set_sensitive(true);
539 m_xFrame
->set_label( SdResId( STR_EFFECTDLG_SOUND
) );
542 case presentation::ClickAction_PROGRAM
:
543 case presentation::ClickAction_MACRO
:
545 m_xBtnSearch
->show();
546 m_xBtnSearch
->set_sensitive(true);
547 if( eCA
== presentation::ClickAction_MACRO
)
550 m_xFrame
->set_label( SdResId( STR_EFFECTDLG_MACRO
) );
554 m_xEdtProgram
->show();
555 m_xFrame
->set_label( SdResId( STR_EFFECTDLG_PROGRAM
) );
559 case presentation::ClickAction_DOCUMENT
:
561 m_xLbTreeDocument
->show();
564 m_xEdtDocument
->show();
565 m_xBtnSearch
->show();
566 m_xBtnSearch
->set_sensitive(true);
568 m_xFtTree
->set_label( SdResId( STR_EFFECTDLG_JUMP
) );
569 m_xFrame
->set_label( SdResId( STR_EFFECTDLG_DOCUMENT
) );
571 CheckFileHdl( *m_xEdtDocument
);
574 case presentation::ClickAction_VERB
:
576 m_xLbOLEAction
->show();
578 m_xFtTree
->set_label( SdResId( STR_EFFECTDLG_ACTION
) );
581 case presentation::ClickAction_BOOKMARK
:
588 m_xEdtBookmark
->show();
591 m_xFtTree
->set_label( SdResId( STR_EFFECTDLG_JUMP
) );
592 m_xFrame
->set_label( SdResId( STR_EFFECTDLG_PAGE_OBJECT
) );
599 IMPL_LINK_NOARG(SdTPAction
, SelectTreeHdl
, weld::TreeView
&, void)
601 m_xEdtBookmark
->set_text( m_xLbTree
->get_selected_text() );
604 IMPL_LINK_NOARG(SdTPAction
, CheckFileHdl
, weld::Widget
&, void)
606 OUString
aFile( GetEditText() );
608 if( aFile
== aLastFile
)
611 bool bHideTreeDocument
= true;
615 // check if it is a valid draw file
616 SfxMedium
aMedium( aFile
,
617 StreamMode::READ
| StreamMode::NOCREATE
);
619 if( aMedium
.IsStorage() )
621 weld::WaitObject
aWait(GetFrameWeld());
623 // is it a draw file?
624 // open with READ, otherwise the Storages might write into the file!
625 uno::Reference
< embed::XStorage
> xStorage
= aMedium
.GetStorage();
626 DBG_ASSERT( xStorage
.is(), "No storage!" );
632 if (xStorage
->hasByName(pStarDrawXMLContent
))
634 if (SdDrawDocument
* pBookmarkDoc
= mpDoc
->OpenBookmarkDoc(aFile
))
638 m_xLbTreeDocument
->clear();
639 m_xLbTreeDocument
->Fill(pBookmarkDoc
, true, aFile
);
640 mpDoc
->CloseBookmarkDoc();
641 m_xLbTreeDocument
->show();
642 bHideTreeDocument
= false;
653 if (bHideTreeDocument
)
654 m_xLbTreeDocument
->hide();
657 presentation::ClickAction
SdTPAction::GetActualClickAction()
659 presentation::ClickAction eCA
= presentation::ClickAction_NONE
;
660 int nPos
= m_xLbAction
->get_active();
661 if (nPos
!= -1 && o3tl::make_unsigned(nPos
) < maCurrentActions
.size())
662 eCA
= maCurrentActions
[ nPos
];
666 void SdTPAction::SetActualClickAction( presentation::ClickAction eCA
)
668 std::vector
<css::presentation::ClickAction
>::const_iterator pIter
=
669 std::find(maCurrentActions
.begin(),maCurrentActions
.end(),eCA
);
671 if ( pIter
!= maCurrentActions
.end() )
672 m_xLbAction
->set_active(pIter
-maCurrentActions
.begin());
675 void SdTPAction::SetEditText( OUString
const & rStr
)
677 presentation::ClickAction eCA
= GetActualClickAction();
678 OUString
aText(rStr
);
680 // possibly convert URI back to system path
683 case presentation::ClickAction_DOCUMENT
:
684 if( comphelper::string::getTokenCount(rStr
, DOCUMENT_TOKEN
) == 2 )
685 aText
= rStr
.getToken( 0, DOCUMENT_TOKEN
);
688 case presentation::ClickAction_SOUND
:
689 case presentation::ClickAction_PROGRAM
:
691 INetURLObject
aURL( aText
);
693 // try to convert to system path
694 OUString
aTmpStr(aURL
.getFSysPath(FSysStyle::Detect
));
696 if( !aTmpStr
.isEmpty() )
697 aText
= aTmpStr
; // was a system path
704 // set the string to the corresponding control
707 case presentation::ClickAction_SOUND
:
708 m_xEdtSound
->set_text(aText
);
710 case presentation::ClickAction_VERB
:
712 ::std::vector
< tools::Long
>::iterator
aFound( ::std::find( aVerbVector
.begin(), aVerbVector
.end(), rStr
.toInt32() ) );
713 if( aFound
!= aVerbVector
.end() )
714 m_xLbOLEAction
->select(aFound
- aVerbVector
.begin());
717 case presentation::ClickAction_PROGRAM
:
718 m_xEdtProgram
->set_text( aText
);
720 case presentation::ClickAction_MACRO
:
721 m_xEdtMacro
->set_text( aText
);
723 case presentation::ClickAction_DOCUMENT
:
724 m_xEdtDocument
->set_text( aText
);
726 case presentation::ClickAction_BOOKMARK
:
727 m_xEdtBookmark
->set_text( aText
);
734 OUString
SdTPAction::GetEditText( bool bFullDocDestination
)
737 presentation::ClickAction eCA
= GetActualClickAction();
741 case presentation::ClickAction_SOUND
:
742 aStr
= m_xEdtSound
->get_text();
744 case presentation::ClickAction_VERB
:
746 const int nPos
= m_xLbOLEAction
->get_selected_index();
747 if (nPos
!= -1 && o3tl::make_unsigned(nPos
) < aVerbVector
.size() )
748 aStr
= OUString::number( aVerbVector
[ nPos
] );
751 case presentation::ClickAction_DOCUMENT
:
752 aStr
= m_xEdtDocument
->get_text();
755 case presentation::ClickAction_PROGRAM
:
756 aStr
= m_xEdtProgram
->get_text();
759 case presentation::ClickAction_MACRO
:
761 return m_xEdtMacro
->get_text();
764 case presentation::ClickAction_BOOKMARK
:
765 return m_xEdtBookmark
->get_text();
772 INetURLObject
aURL( aStr
);
774 if( mpDoc
&& mpDoc
->GetDocSh() && mpDoc
->GetDocSh()->GetMedium() )
775 aBaseURL
= mpDoc
->GetDocSh()->GetMedium()->GetBaseURL();
777 if( !aStr
.isEmpty() && aURL
.GetProtocol() == INetProtocol::NotValid
)
778 aURL
= INetURLObject( ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL
), aStr
, URIHelper::GetMaybeFileHdl() ) );
780 // get adjusted file name
781 aStr
= aURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
783 if( bFullDocDestination
&&
784 eCA
== presentation::ClickAction_DOCUMENT
&&
785 m_xLbTreeDocument
->get_visible() &&
786 m_xLbTreeDocument
->get_selected() )
788 OUString
aTmpStr( m_xLbTreeDocument
->get_selected_text() );
789 if( !aTmpStr
.isEmpty() )
791 aStr
+= OUStringChar(DOCUMENT_TOKEN
) + aTmpStr
;
798 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */