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>
34 #include <tools/debug.hxx>
35 #include <vcl/waitobj.hxx>
36 #include <sfx2/app.hxx>
37 #include <unotools/pathoptions.hxx>
38 #include <svx/svdograf.hxx>
39 #include <svl/aeitem.hxx>
40 #include <svl/stritem.hxx>
41 #include <svx/svdoole2.hxx>
42 #include <sfx2/docfile.hxx>
43 #include <svx/xtable.hxx>
44 #include <vcl/mnemonic.hxx>
45 #include <vcl/lstbox.hxx>
46 #include <svl/urihelper.hxx>
47 #include <sfx2/filedlghelper.hxx>
48 #include <svx/drawitem.hxx>
50 #include <sdresid.hxx>
51 #include <tpaction.hxx>
53 #include <ViewShell.hxx>
54 #include <drawdoc.hxx>
55 #include <DrawDocShell.hxx>
56 #include <strings.hrc>
58 #include <filedlg.hxx>
62 using namespace ::com::sun::star
;
63 using namespace com::sun::star::uno
;
64 using namespace com::sun::star::lang
;
66 #define DOCUMENT_TOKEN '#'
69 * Constructor of the Tab dialog: appends the pages to the dialog
71 SdActionDlg::SdActionDlg(weld::Window
* pParent
, const SfxItemSet
* pAttr
, ::sd::View
const * pView
)
72 : SfxSingleTabDialogController(pParent
, pAttr
, "modules/simpress/ui/interactiondialog.ui",
76 TabPageParent
aParent(get_content_area(), this);
77 VclPtr
<SfxTabPage
> xNewPage
= SdTPAction::Create(aParent
, rOutAttrs
);
79 // formerly in PageCreated
80 static_cast<SdTPAction
*>( xNewPage
.get() )->SetView( pView
);
81 static_cast<SdTPAction
*>( xNewPage
.get() )->Construct();
89 SdTPAction::SdTPAction(TabPageParent pWindow
, const SfxItemSet
& rInAttrs
)
90 : SfxTabPage(pWindow
, "modules/simpress/ui/interactionpage.ui", "InteractionPage", &rInAttrs
)
94 , m_xLbAction(m_xBuilder
->weld_combo_box("listbox"))
95 , m_xFtTree(m_xBuilder
->weld_label("fttree"))
96 , m_xLbTree(new SdPageObjsTLV(m_xBuilder
->weld_tree_view("tree")))
97 , m_xLbTreeDocument(new SdPageObjsTLV(m_xBuilder
->weld_tree_view("treedoc")))
98 , m_xLbOLEAction(m_xBuilder
->weld_tree_view("oleaction"))
99 , m_xFrame(m_xBuilder
->weld_frame("frame"))
100 , m_xEdtSound(m_xBuilder
->weld_entry("sound"))
101 , m_xEdtBookmark(m_xBuilder
->weld_entry("bookmark"))
102 , m_xEdtDocument(m_xBuilder
->weld_entry("document"))
103 , m_xEdtProgram(m_xBuilder
->weld_entry("program"))
104 , m_xEdtMacro(m_xBuilder
->weld_entry("macro"))
105 , m_xBtnSearch(m_xBuilder
->weld_button("browse"))
106 , m_xBtnSeek(m_xBuilder
->weld_button("find"))
108 m_xLbOLEAction
->set_size_request(m_xLbOLEAction
->get_approximate_digit_width() * 48,
109 m_xLbOLEAction
->get_height_rows(12));
111 m_xBtnSearch
->connect_clicked( LINK( this, SdTPAction
, ClickSearchHdl
) );
112 m_xBtnSeek
->connect_clicked( LINK( this, SdTPAction
, ClickSearchHdl
) );
114 // this page needs ExchangeSupport
115 SetExchangeSupport();
117 m_xLbAction
->connect_changed( LINK( this, SdTPAction
, ClickActionHdl
) );
118 m_xLbTree
->connect_changed( LINK( this, SdTPAction
, SelectTreeHdl
) );
119 m_xEdtDocument
->connect_focus_out( LINK( this, SdTPAction
, CheckFileHdl
) );
120 m_xEdtMacro
->connect_focus_out( LINK( this, SdTPAction
, CheckFileHdl
) );
122 //Lock to initial max size
123 Size
aSize(m_xContainer
->get_preferred_size());
124 m_xContainer
->set_size_request(aSize
.Width(), aSize
.Height());
126 ClickActionHdl( *m_xLbAction
);
129 SdTPAction::~SdTPAction()
134 void SdTPAction::SetView( const ::sd::View
* pSdView
)
138 // get ColorTable and fill ListBox
139 ::sd::DrawDocShell
* pDocSh
= mpView
->GetDocSh();
140 if( pDocSh
&& pDocSh
->GetViewShell() )
142 mpDoc
= pDocSh
->GetDoc();
143 SfxViewFrame
* pFrame
= pDocSh
->GetViewShell()->GetViewFrame();
144 m_xLbTree
->SetViewFrame( pFrame
);
145 m_xLbTreeDocument
->SetViewFrame( pFrame
);
147 pColList
= pDocSh
->GetItem( SID_COLOR_TABLE
)->GetColorList();
148 DBG_ASSERT( pColList
.is(), "No color table available!" );
152 OSL_FAIL("sd::SdTPAction::SetView(), no docshell or viewshell?");
156 void SdTPAction::Construct()
158 // fill OLE-Actionlistbox
159 SdrOle2Obj
* pOleObj
= nullptr;
160 SdrGrafObj
* pGrafObj
= nullptr;
161 bool bOLEAction
= false;
163 if ( mpView
->AreObjectsMarked() )
165 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
168 if (rMarkList
.GetMarkCount() == 1)
170 SdrMark
* pMark
= rMarkList
.GetMark(0);
171 pObj
= pMark
->GetMarkedSdrObj();
173 SdrInventor nInv
= pObj
->GetObjInventor();
174 sal_uInt16 nSdrObjKind
= pObj
->GetObjIdentifier();
176 if (nInv
== SdrInventor::Default
&& nSdrObjKind
== OBJ_OLE2
)
178 pOleObj
= static_cast<SdrOle2Obj
*>(pObj
);
180 else if (nInv
== SdrInventor::Default
&& nSdrObjKind
== OBJ_GRAF
)
182 pGrafObj
= static_cast<SdrGrafObj
*>(pObj
);
190 aVerbVector
.push_back( 0 );
191 m_xLbOLEAction
->append_text( MnemonicGenerator::EraseAllMnemonicChars( SdResId( STR_EDIT_OBJ
) ) );
195 const uno::Reference
< embed::XEmbeddedObject
>& xObj
= pOleObj
->GetObjRef();
199 uno::Sequence
< embed::VerbDescriptor
> aVerbs
;
202 aVerbs
= xObj
->getSupportedVerbs();
204 catch ( embed::NeedsRunningStateException
& )
206 xObj
->changeState( embed::EmbedStates::RUNNING
);
207 aVerbs
= xObj
->getSupportedVerbs();
210 for( sal_Int32 i
=0; i
<aVerbs
.getLength(); i
++ )
212 embed::VerbDescriptor aVerb
= aVerbs
[i
];
213 if( aVerb
.VerbAttributes
& embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU
)
215 OUString
aTmp( aVerb
.VerbName
);
216 aVerbVector
.push_back( aVerb
.VerbID
);
217 m_xLbOLEAction
->append_text( MnemonicGenerator::EraseAllMnemonicChars( aTmp
) );
223 maCurrentActions
.push_back( presentation::ClickAction_NONE
);
224 maCurrentActions
.push_back( presentation::ClickAction_PREVPAGE
);
225 maCurrentActions
.push_back( presentation::ClickAction_NEXTPAGE
);
226 maCurrentActions
.push_back( presentation::ClickAction_FIRSTPAGE
);
227 maCurrentActions
.push_back( presentation::ClickAction_LASTPAGE
);
228 maCurrentActions
.push_back( presentation::ClickAction_BOOKMARK
);
229 maCurrentActions
.push_back( presentation::ClickAction_DOCUMENT
);
230 maCurrentActions
.push_back( presentation::ClickAction_SOUND
);
231 if( bOLEAction
&& m_xLbOLEAction
->n_children() )
232 maCurrentActions
.push_back( presentation::ClickAction_VERB
);
233 maCurrentActions
.push_back( presentation::ClickAction_PROGRAM
);
234 maCurrentActions
.push_back( presentation::ClickAction_MACRO
);
235 maCurrentActions
.push_back( presentation::ClickAction_STOPPRESENTATION
);
237 // fill Action-Listbox
238 for (presentation::ClickAction
& rAction
: maCurrentActions
)
240 const char* pRId
= GetClickActionSdResId(rAction
);
241 m_xLbAction
->append_text(SdResId(pRId
));
246 bool SdTPAction::FillItemSet( SfxItemSet
* rAttrs
)
248 bool bModified
= false;
249 presentation::ClickAction eCA
= presentation::ClickAction_NONE
;
251 if (m_xLbAction
->get_active() != -1)
252 eCA
= GetActualClickAction();
254 if( m_xLbAction
->get_value_changed_from_saved() )
256 rAttrs
->Put( SfxAllEnumItem( ATTR_ACTION
, static_cast<sal_uInt16
>(eCA
) ) );
260 rAttrs
->InvalidateItem( ATTR_ACTION
);
262 OUString aFileName
= GetEditText( true );
263 if( aFileName
.isEmpty() )
264 rAttrs
->InvalidateItem( ATTR_ACTION_FILENAME
);
267 if( mpDoc
&& mpDoc
->GetDocSh() && mpDoc
->GetDocSh()->GetMedium() )
269 OUString aBaseURL
= mpDoc
->GetDocSh()->GetMedium()->GetBaseURL();
270 if( eCA
== presentation::ClickAction_SOUND
||
271 eCA
== presentation::ClickAction_DOCUMENT
||
272 eCA
== presentation::ClickAction_PROGRAM
)
273 aFileName
= ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL
), aFileName
, URIHelper::GetMaybeFileHdl(), true, false,
274 INetURLObject::EncodeMechanism::WasEncoded
,
275 INetURLObject::DecodeMechanism::Unambiguous
);
277 rAttrs
->Put( SfxStringItem( ATTR_ACTION_FILENAME
, aFileName
) );
282 OSL_FAIL("sd::SdTPAction::FillItemSet(), I need a medium!");
289 void SdTPAction::Reset( const SfxItemSet
* rAttrs
)
291 presentation::ClickAction eCA
= presentation::ClickAction_NONE
;
295 if( rAttrs
->GetItemState( ATTR_ACTION
) != SfxItemState::DONTCARE
)
297 eCA
= static_cast<presentation::ClickAction
>(static_cast<const SfxAllEnumItem
&>( rAttrs
->
298 Get( ATTR_ACTION
) ).GetValue());
299 SetActualClickAction( eCA
);
302 m_xLbAction
->set_active(-1);
305 if( rAttrs
->GetItemState( ATTR_ACTION_FILENAME
) != SfxItemState::DONTCARE
)
307 aFileName
= static_cast<const SfxStringItem
&>( rAttrs
->Get( ATTR_ACTION_FILENAME
) ).GetValue();
308 SetEditText( aFileName
);
313 case presentation::ClickAction_BOOKMARK
:
315 if (!m_xLbTree
->SelectEntry(aFileName
))
316 m_xLbTree
->unselect_all();
320 case presentation::ClickAction_DOCUMENT
:
322 if( comphelper::string::getTokenCount(aFileName
, DOCUMENT_TOKEN
) == 2 )
323 m_xLbTreeDocument
->SelectEntry( aFileName
.getToken( 1, DOCUMENT_TOKEN
) );
330 ClickActionHdl( *m_xLbAction
);
332 m_xLbAction
->save_value();
333 m_xEdtSound
->save_value();
336 void SdTPAction::ActivatePage( const SfxItemSet
& )
340 DeactivateRC
SdTPAction::DeactivatePage( SfxItemSet
* pPageSet
)
343 FillItemSet( pPageSet
);
345 return DeactivateRC::LeavePage
;
348 VclPtr
<SfxTabPage
> SdTPAction::Create( TabPageParent pParent
,
349 const SfxItemSet
& rAttrs
)
351 return VclPtr
<SdTPAction
>::Create( pParent
, rAttrs
);
354 void SdTPAction::UpdateTree()
356 if( !bTreeUpdated
&& mpDoc
&& mpDoc
->GetDocSh() && mpDoc
->GetDocSh()->GetMedium() )
358 m_xLbTree
->Fill( mpDoc
, true, mpDoc
->GetDocSh()->GetMedium()->GetName() );
363 void SdTPAction::OpenFileDialog()
365 // Soundpreview only for interaction with sound
366 presentation::ClickAction eCA
= GetActualClickAction();
367 bool bSound
= ( eCA
== presentation::ClickAction_SOUND
);
368 bool bPage
= ( eCA
== presentation::ClickAction_BOOKMARK
);
369 bool bDocument
= ( eCA
== presentation::ClickAction_DOCUMENT
||
370 eCA
== presentation::ClickAction_PROGRAM
);
371 bool bMacro
= ( eCA
== presentation::ClickAction_MACRO
);
375 // search in the TreeLB for the specified object
376 m_xLbTree
->SelectEntry(GetEditText());
380 OUString
aFile( GetEditText() );
384 SdOpenSoundFileDialog
aFileDialog(GetDialogFrameWeld());
386 if( !aFile
.isEmpty() )
387 aFileDialog
.SetPath( aFile
);
389 if( aFileDialog
.Execute() == ERRCODE_NONE
)
391 aFile
= aFileDialog
.GetPath();
392 SetEditText( aFile
);
397 // choose macro dialog
398 OUString aScriptURL
= SfxApplication::ChooseScript(GetDialogFrameWeld());
400 if ( !aScriptURL
.isEmpty() )
402 SetEditText( aScriptURL
);
407 sfx2::FileDialogHelper
aFileDialog(
408 ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION
,
409 FileDialogFlags::NONE
, GetDialogFrameWeld());
411 if (bDocument
&& aFile
.isEmpty())
412 aFile
= SvtPathOptions().GetWorkPath();
414 aFileDialog
.SetDisplayDirectory( aFile
);
416 // The following is a workaround for #i4306#:
417 // The addition of the implicitly existing "all files"
418 // filter makes the (Windows system) open file dialog follow
419 // links on the desktop to directories.
420 aFileDialog
.AddFilter (
421 SfxResId(STR_SFX_FILTERNAME_ALL
),
424 if( aFileDialog
.Execute() == ERRCODE_NONE
)
426 aFile
= aFileDialog
.GetPath();
427 SetEditText( aFile
);
430 CheckFileHdl( *m_xEdtDocument
);
435 IMPL_LINK_NOARG(SdTPAction
, ClickSearchHdl
, weld::Button
&, void)
440 IMPL_LINK_NOARG(SdTPAction
, ClickActionHdl
, weld::ComboBox
&, void)
442 presentation::ClickAction eCA
= GetActualClickAction();
444 // hide controls we don't need
447 case presentation::ClickAction_NONE
:
448 case presentation::ClickAction_INVISIBLE
:
449 case presentation::ClickAction_PREVPAGE
:
450 case presentation::ClickAction_NEXTPAGE
:
451 case presentation::ClickAction_FIRSTPAGE
:
452 case presentation::ClickAction_LASTPAGE
:
453 case presentation::ClickAction_STOPPRESENTATION
:
457 m_xLbTreeDocument
->hide();
458 m_xLbOLEAction
->hide();
462 m_xEdtBookmark
->hide();
463 m_xEdtDocument
->hide();
464 m_xEdtProgram
->hide();
466 m_xBtnSearch
->hide();
470 case presentation::ClickAction_SOUND
:
471 case presentation::ClickAction_PROGRAM
:
472 case presentation::ClickAction_MACRO
:
475 m_xLbTreeDocument
->hide();
476 m_xLbOLEAction
->hide();
478 m_xEdtDocument
->hide();
480 if( eCA
== presentation::ClickAction_MACRO
)
483 m_xEdtProgram
->hide();
485 else if( eCA
== presentation::ClickAction_PROGRAM
)
490 else if( eCA
== presentation::ClickAction_SOUND
)
492 m_xEdtProgram
->hide();
499 case presentation::ClickAction_DOCUMENT
:
501 m_xLbOLEAction
->hide();
504 m_xEdtProgram
->hide();
506 m_xEdtBookmark
->hide();
510 case presentation::ClickAction_BOOKMARK
:
511 m_xLbTreeDocument
->hide();
512 m_xLbOLEAction
->hide();
514 m_xEdtDocument
->hide();
515 m_xEdtProgram
->hide();
517 m_xBtnSearch
->hide();
520 case presentation::ClickAction_VERB
:
522 m_xEdtDocument
->hide();
523 m_xEdtProgram
->hide();
524 m_xEdtBookmark
->hide();
526 m_xBtnSearch
->hide();
533 // show controls we do need
536 case presentation::ClickAction_NONE
:
537 case presentation::ClickAction_INVISIBLE
:
538 case presentation::ClickAction_PREVPAGE
:
539 case presentation::ClickAction_NEXTPAGE
:
540 case presentation::ClickAction_FIRSTPAGE
:
541 case presentation::ClickAction_LASTPAGE
:
542 case presentation::ClickAction_STOPPRESENTATION
:
546 case presentation::ClickAction_SOUND
:
549 m_xEdtSound
->set_sensitive(true);
550 m_xBtnSearch
->show();
551 m_xBtnSearch
->set_sensitive(true);
552 m_xFrame
->set_label( SdResId( STR_EFFECTDLG_SOUND
) );
555 case presentation::ClickAction_PROGRAM
:
556 case presentation::ClickAction_MACRO
:
558 m_xBtnSearch
->show();
559 m_xBtnSearch
->set_sensitive(true);
560 if( eCA
== presentation::ClickAction_MACRO
)
563 m_xFrame
->set_label( SdResId( STR_EFFECTDLG_MACRO
) );
567 m_xEdtProgram
->show();
568 m_xFrame
->set_label( SdResId( STR_EFFECTDLG_PROGRAM
) );
572 case presentation::ClickAction_DOCUMENT
:
574 m_xLbTreeDocument
->show();
577 m_xEdtDocument
->show();
578 m_xBtnSearch
->show();
579 m_xBtnSearch
->set_sensitive(true);
581 m_xFtTree
->set_label( SdResId( STR_EFFECTDLG_JUMP
) );
582 m_xFrame
->set_label( SdResId( STR_EFFECTDLG_DOCUMENT
) );
584 CheckFileHdl( *m_xEdtDocument
);
587 case presentation::ClickAction_VERB
:
589 m_xLbOLEAction
->show();
591 m_xFtTree
->set_label( SdResId( STR_EFFECTDLG_ACTION
) );
594 case presentation::ClickAction_BOOKMARK
:
601 m_xEdtBookmark
->show();
604 m_xFtTree
->set_label( SdResId( STR_EFFECTDLG_JUMP
) );
605 m_xFrame
->set_label( SdResId( STR_EFFECTDLG_PAGE_OBJECT
) );
612 IMPL_LINK_NOARG(SdTPAction
, SelectTreeHdl
, weld::TreeView
&, void)
614 m_xEdtBookmark
->set_text( m_xLbTree
->get_selected_text() );
617 IMPL_LINK_NOARG(SdTPAction
, CheckFileHdl
, weld::Widget
&, void)
619 OUString
aFile( GetEditText() );
621 if( aFile
== aLastFile
)
624 // check if it is a valid draw file
625 SfxMedium
aMedium( aFile
,
626 StreamMode::READ
| StreamMode::NOCREATE
);
628 if( aMedium
.IsStorage() )
630 WaitObject
aWait( GetParentDialog() );
632 bool bHideTreeDocument
= true;
634 // is it a draw file?
635 // open with READ, otherwise the Storages might write into the file!
636 uno::Reference
< embed::XStorage
> xStorage
= aMedium
.GetStorage();
637 DBG_ASSERT( xStorage
.is(), "No storage!" );
639 uno::Reference
< container::XNameAccess
> xAccess( xStorage
, uno::UNO_QUERY
);
644 if (xAccess
->hasByName(pStarDrawXMLContent
) ||
645 xAccess
->hasByName(pStarDrawOldXMLContent
))
647 if (SdDrawDocument
* pBookmarkDoc
= mpDoc
->OpenBookmarkDoc(aFile
))
651 m_xLbTreeDocument
->clear();
652 m_xLbTreeDocument
->Fill(pBookmarkDoc
, true, aFile
);
653 mpDoc
->CloseBookmarkDoc();
654 m_xLbTreeDocument
->show();
655 bHideTreeDocument
= false;
664 if (bHideTreeDocument
)
665 m_xLbTreeDocument
->hide();
669 m_xLbTreeDocument
->hide();
672 presentation::ClickAction
SdTPAction::GetActualClickAction()
674 presentation::ClickAction eCA
= presentation::ClickAction_NONE
;
675 int nPos
= m_xLbAction
->get_active();
676 if (nPos
!= -1 && static_cast<size_t>(nPos
) < maCurrentActions
.size())
677 eCA
= maCurrentActions
[ nPos
];
681 void SdTPAction::SetActualClickAction( presentation::ClickAction eCA
)
683 std::vector
<css::presentation::ClickAction
>::const_iterator pIter
=
684 std::find(maCurrentActions
.begin(),maCurrentActions
.end(),eCA
);
686 if ( pIter
!= maCurrentActions
.end() )
687 m_xLbAction
->set_active(pIter
-maCurrentActions
.begin());
690 void SdTPAction::SetEditText( OUString
const & rStr
)
692 presentation::ClickAction eCA
= GetActualClickAction();
693 OUString
aText(rStr
);
695 // possibly convert URI back to system path
698 case presentation::ClickAction_DOCUMENT
:
699 if( comphelper::string::getTokenCount(rStr
, DOCUMENT_TOKEN
) == 2 )
700 aText
= rStr
.getToken( 0, DOCUMENT_TOKEN
);
703 case presentation::ClickAction_SOUND
:
704 case presentation::ClickAction_PROGRAM
:
706 INetURLObject
aURL( aText
);
708 // try to convert to system path
709 OUString
aTmpStr(aURL
.getFSysPath(FSysStyle::Detect
));
711 if( !aTmpStr
.isEmpty() )
712 aText
= aTmpStr
; // was a system path
719 // set the string to the corresponding control
722 case presentation::ClickAction_SOUND
:
723 m_xEdtSound
->set_text(aText
);
725 case presentation::ClickAction_VERB
:
727 ::std::vector
< long >::iterator
aFound( ::std::find( aVerbVector
.begin(), aVerbVector
.end(), rStr
.toInt32() ) );
728 if( aFound
!= aVerbVector
.end() )
729 m_xLbOLEAction
->select(aFound
- aVerbVector
.begin());
732 case presentation::ClickAction_PROGRAM
:
733 m_xEdtProgram
->set_text( aText
);
735 case presentation::ClickAction_MACRO
:
736 m_xEdtMacro
->set_text( aText
);
738 case presentation::ClickAction_DOCUMENT
:
739 m_xEdtDocument
->set_text( aText
);
741 case presentation::ClickAction_BOOKMARK
:
742 m_xEdtBookmark
->set_text( aText
);
749 OUString
SdTPAction::GetEditText( bool bFullDocDestination
)
752 presentation::ClickAction eCA
= GetActualClickAction();
756 case presentation::ClickAction_SOUND
:
757 aStr
= m_xEdtSound
->get_text();
759 case presentation::ClickAction_VERB
:
761 const int nPos
= m_xLbOLEAction
->get_selected_index();
762 if (nPos
!= -1 && static_cast<size_t>(nPos
) < aVerbVector
.size() )
763 aStr
= OUString::number( aVerbVector
[ nPos
] );
766 case presentation::ClickAction_DOCUMENT
:
767 aStr
= m_xEdtDocument
->get_text();
770 case presentation::ClickAction_PROGRAM
:
771 aStr
= m_xEdtProgram
->get_text();
774 case presentation::ClickAction_MACRO
:
776 return m_xEdtMacro
->get_text();
779 case presentation::ClickAction_BOOKMARK
:
780 return m_xEdtBookmark
->get_text();
787 INetURLObject
aURL( aStr
);
789 if( mpDoc
&& mpDoc
->GetDocSh() && mpDoc
->GetDocSh()->GetMedium() )
790 aBaseURL
= mpDoc
->GetDocSh()->GetMedium()->GetBaseURL();
792 if( !aStr
.isEmpty() && aURL
.GetProtocol() == INetProtocol::NotValid
)
793 aURL
= INetURLObject( ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL
), aStr
, URIHelper::GetMaybeFileHdl() ) );
795 // get adjusted file name
796 aStr
= aURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
798 if( bFullDocDestination
&&
799 eCA
== presentation::ClickAction_DOCUMENT
&&
800 m_xLbTreeDocument
->get_visible() &&
801 m_xLbTreeDocument
->get_selected() )
803 OUString
aTmpStr( m_xLbTreeDocument
->get_selected_text() );
804 if( !aTmpStr
.isEmpty() )
806 aStr
+= OUStringLiteral1(DOCUMENT_TOKEN
) + aTmpStr
;
813 const char* SdTPAction::GetClickActionSdResId( presentation::ClickAction eCA
)
817 case presentation::ClickAction_NONE
: return STR_CLICK_ACTION_NONE
;
818 case presentation::ClickAction_PREVPAGE
: return STR_CLICK_ACTION_PREVPAGE
;
819 case presentation::ClickAction_NEXTPAGE
: return STR_CLICK_ACTION_NEXTPAGE
;
820 case presentation::ClickAction_FIRSTPAGE
: return STR_CLICK_ACTION_FIRSTPAGE
;
821 case presentation::ClickAction_LASTPAGE
: return STR_CLICK_ACTION_LASTPAGE
;
822 case presentation::ClickAction_BOOKMARK
: return STR_CLICK_ACTION_BOOKMARK
;
823 case presentation::ClickAction_DOCUMENT
: return STR_CLICK_ACTION_DOCUMENT
;
824 case presentation::ClickAction_PROGRAM
: return STR_CLICK_ACTION_PROGRAM
;
825 case presentation::ClickAction_MACRO
: return STR_CLICK_ACTION_MACRO
;
826 case presentation::ClickAction_SOUND
: return STR_CLICK_ACTION_SOUND
;
827 case presentation::ClickAction_VERB
: return STR_CLICK_ACTION_VERB
;
828 case presentation::ClickAction_STOPPRESENTATION
: return STR_CLICK_ACTION_STOPPRESENTATION
;
829 default: OSL_FAIL( "No StringResource for ClickAction available!" );
834 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */