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 <comphelper/string.hxx>
26 #include <com/sun/star/embed/VerbAttributes.hpp>
27 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
30 #include <sfx2/sfxresid.hxx>
31 #include <sfx2/strings.hrc>
33 #include <vcl/waitobj.hxx>
34 #include <osl/file.hxx>
35 #include <sfx2/app.hxx>
36 #include <unotools/pathoptions.hxx>
37 #include <svx/svdograf.hxx>
38 #include <svx/svdpagv.hxx>
39 #include <unotools/localfilehelper.hxx>
40 #include <svl/aeitem.hxx>
41 #include <editeng/colritem.hxx>
42 #include <svx/svdoole2.hxx>
43 #include <sfx2/docfile.hxx>
44 #include <sot/storage.hxx>
45 #include <basic/sbmeth.hxx>
46 #include <basic/sbmod.hxx>
47 #include <basic/sbstar.hxx>
48 #include <svx/xtable.hxx>
49 #include <vcl/svapp.hxx>
50 #include <vcl/mnemonic.hxx>
51 #include <svl/urihelper.hxx>
52 #include <sfx2/filedlghelper.hxx>
53 #include <svx/drawitem.hxx>
55 #include <sdresid.hxx>
56 #include <tpaction.hxx>
58 #include <ViewShell.hxx>
59 #include <drawdoc.hxx>
60 #include <DrawDocShell.hxx>
61 #include <strings.hrc>
63 #include <filedlg.hxx>
67 using namespace ::com::sun::star
;
68 using namespace com::sun::star::uno
;
69 using namespace com::sun::star::lang
;
71 #define DOCUMENT_TOKEN '#'
74 * Constructor of the Tab dialog: appends the pages to the dialog
76 SdActionDlg::SdActionDlg (
77 vcl::Window
* pParent
, const SfxItemSet
* pAttr
, ::sd::View
const * pView
)
78 : SfxSingleTabDialog(pParent
, *pAttr
, "InteractionDialog",
79 "modules/simpress/ui/interactiondialog.ui")
82 VclPtr
<SfxTabPage
> pNewPage
= SdTPAction::Create(get_content_area(), rOutAttrs
);
83 assert(pNewPage
); //Unable to create page
85 // formerly in PageCreated
86 static_cast<SdTPAction
*>( pNewPage
.get() )->SetView( pView
);
87 static_cast<SdTPAction
*>( pNewPage
.get() )->Construct();
89 SetTabPage( pNewPage
);
95 SdTPAction::SdTPAction(vcl::Window
* pWindow
, const SfxItemSet
& rInAttrs
)
96 : SfxTabPage(pWindow
, "InteractionPage",
97 "modules/simpress/ui/interactionpage.ui", &rInAttrs
)
100 , bTreeUpdated(false)
102 get(m_pLbAction
, "listbox");
103 get(m_pFtTree
, "fttree");
104 get(m_pLbTree
, "tree");
105 get(m_pLbTreeDocument
, "treedoc");
106 get(m_pLbOLEAction
, "oleaction");
107 get(m_pFrame
, "frame");
108 get(m_pEdtSound
, "sound");
109 get(m_pEdtBookmark
, "bookmark");
110 get(m_pEdtDocument
, "document");
111 get(m_pEdtProgram
, "program");
112 get(m_pEdtMacro
, "macro");
113 get(m_pBtnSearch
, "browse");
114 get(m_pBtnSeek
, "find");
116 m_pLbOLEAction
->set_width_request(m_pLbOLEAction
->approximate_char_width() * 52);
117 m_pLbOLEAction
->set_height_request(m_pLbOLEAction
->GetTextHeight() * 12);
119 m_pBtnSearch
->SetClickHdl( LINK( this, SdTPAction
, ClickSearchHdl
) );
120 m_pBtnSeek
->SetClickHdl( LINK( this, SdTPAction
, ClickSearchHdl
) );
122 // this page needs ExchangeSupport
123 SetExchangeSupport();
125 m_pLbAction
->SetSelectHdl( LINK( this, SdTPAction
, ClickActionHdl
) );
126 m_pLbTree
->SetSelectHdl( LINK( this, SdTPAction
, SelectTreeHdl
) );
127 m_pEdtDocument
->SetLoseFocusHdl( LINK( this, SdTPAction
, CheckFileHdl
) );
128 m_pEdtMacro
->SetLoseFocusHdl( LINK( this, SdTPAction
, CheckFileHdl
) );
130 //Lock to initial max size
131 Size
aSize(get_preferred_size());
132 set_width_request(aSize
.Width());
133 set_height_request(aSize
.Height());
135 ClickActionHdl( *m_pLbAction
);
138 SdTPAction::~SdTPAction()
143 void SdTPAction::dispose()
148 m_pLbTreeDocument
.clear();
149 m_pLbOLEAction
.clear();
152 m_pEdtBookmark
.clear();
153 m_pEdtDocument
.clear();
154 m_pEdtProgram
.clear();
156 m_pBtnSearch
.clear();
158 SfxTabPage::dispose();
161 void SdTPAction::SetView( const ::sd::View
* pSdView
)
165 // get ColorTable and fill ListBox
166 ::sd::DrawDocShell
* pDocSh
= mpView
->GetDocSh();
167 if( pDocSh
&& pDocSh
->GetViewShell() )
169 mpDoc
= pDocSh
->GetDoc();
170 SfxViewFrame
* pFrame
= pDocSh
->GetViewShell()->GetViewFrame();
171 m_pLbTree
->SetViewFrame( pFrame
);
172 m_pLbTreeDocument
->SetViewFrame( pFrame
);
174 pColList
= pDocSh
->GetItem( SID_COLOR_TABLE
)->GetColorList();
175 DBG_ASSERT( pColList
.is(), "No color table available!" );
179 OSL_FAIL("sd::SdTPAction::SetView(), no docshell or viewshell?");
183 void SdTPAction::Construct()
185 // fill OLE-Actionlistbox
186 SdrOle2Obj
* pOleObj
= nullptr;
187 SdrGrafObj
* pGrafObj
= nullptr;
188 bool bOLEAction
= false;
190 if ( mpView
->AreObjectsMarked() )
192 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
195 if (rMarkList
.GetMarkCount() == 1)
197 SdrMark
* pMark
= rMarkList
.GetMark(0);
198 pObj
= pMark
->GetMarkedSdrObj();
200 SdrInventor nInv
= pObj
->GetObjInventor();
201 sal_uInt16 nSdrObjKind
= pObj
->GetObjIdentifier();
203 if (nInv
== SdrInventor::Default
&& nSdrObjKind
== OBJ_OLE2
)
205 pOleObj
= static_cast<SdrOle2Obj
*>(pObj
);
207 else if (nInv
== SdrInventor::Default
&& nSdrObjKind
== OBJ_GRAF
)
209 pGrafObj
= static_cast<SdrGrafObj
*>(pObj
);
217 aVerbVector
.push_back( 0 );
218 m_pLbOLEAction
->InsertEntry( MnemonicGenerator::EraseAllMnemonicChars( SdResId( STR_EDIT_OBJ
) ) );
222 uno::Reference
< embed::XEmbeddedObject
> xObj
= pOleObj
->GetObjRef();
226 uno::Sequence
< embed::VerbDescriptor
> aVerbs
;
229 aVerbs
= xObj
->getSupportedVerbs();
231 catch ( embed::NeedsRunningStateException
& )
233 xObj
->changeState( embed::EmbedStates::RUNNING
);
234 aVerbs
= xObj
->getSupportedVerbs();
237 for( sal_Int32 i
=0; i
<aVerbs
.getLength(); i
++ )
239 embed::VerbDescriptor aVerb
= aVerbs
[i
];
240 if( aVerb
.VerbAttributes
& embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU
)
242 OUString
aTmp( aVerb
.VerbName
);
243 aVerbVector
.push_back( aVerb
.VerbID
);
244 m_pLbOLEAction
->InsertEntry( MnemonicGenerator::EraseAllMnemonicChars( aTmp
) );
250 maCurrentActions
.push_back( presentation::ClickAction_NONE
);
251 maCurrentActions
.push_back( presentation::ClickAction_PREVPAGE
);
252 maCurrentActions
.push_back( presentation::ClickAction_NEXTPAGE
);
253 maCurrentActions
.push_back( presentation::ClickAction_FIRSTPAGE
);
254 maCurrentActions
.push_back( presentation::ClickAction_LASTPAGE
);
255 maCurrentActions
.push_back( presentation::ClickAction_BOOKMARK
);
256 maCurrentActions
.push_back( presentation::ClickAction_DOCUMENT
);
257 maCurrentActions
.push_back( presentation::ClickAction_SOUND
);
258 if( bOLEAction
&& m_pLbOLEAction
->GetEntryCount() )
259 maCurrentActions
.push_back( presentation::ClickAction_VERB
);
260 maCurrentActions
.push_back( presentation::ClickAction_PROGRAM
);
261 maCurrentActions
.push_back( presentation::ClickAction_MACRO
);
262 maCurrentActions
.push_back( presentation::ClickAction_STOPPRESENTATION
);
264 // fill Action-Listbox
265 for (presentation::ClickAction
& rAction
: maCurrentActions
)
267 const char* pRId
= GetClickActionSdResId(rAction
);
268 m_pLbAction
->InsertEntry(SdResId(pRId
));
273 bool SdTPAction::FillItemSet( SfxItemSet
* rAttrs
)
275 bool bModified
= false;
276 presentation::ClickAction eCA
= presentation::ClickAction_NONE
;
278 if( m_pLbAction
->GetSelectedEntryCount() )
279 eCA
= GetActualClickAction();
281 if( m_pLbAction
->IsValueChangedFromSaved() )
283 rAttrs
->Put( SfxAllEnumItem( ATTR_ACTION
, static_cast<sal_uInt16
>(eCA
) ) );
287 rAttrs
->InvalidateItem( ATTR_ACTION
);
289 OUString aFileName
= GetEditText( true );
290 if( aFileName
.isEmpty() )
291 rAttrs
->InvalidateItem( ATTR_ACTION_FILENAME
);
294 if( mpDoc
&& mpDoc
->GetDocSh() && mpDoc
->GetDocSh()->GetMedium() )
296 OUString aBaseURL
= mpDoc
->GetDocSh()->GetMedium()->GetBaseURL();
297 if( eCA
== presentation::ClickAction_SOUND
||
298 eCA
== presentation::ClickAction_DOCUMENT
||
299 eCA
== presentation::ClickAction_PROGRAM
)
300 aFileName
= ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL
), aFileName
, URIHelper::GetMaybeFileHdl(), true, false,
301 INetURLObject::EncodeMechanism::WasEncoded
,
302 INetURLObject::DecodeMechanism::Unambiguous
);
304 rAttrs
->Put( SfxStringItem( ATTR_ACTION_FILENAME
, aFileName
) );
309 OSL_FAIL("sd::SdTPAction::FillItemSet(), I need a medium!");
316 void SdTPAction::Reset( const SfxItemSet
* rAttrs
)
318 presentation::ClickAction eCA
= presentation::ClickAction_NONE
;
322 if( rAttrs
->GetItemState( ATTR_ACTION
) != SfxItemState::DONTCARE
)
324 eCA
= static_cast<presentation::ClickAction
>(static_cast<const SfxAllEnumItem
&>( rAttrs
->
325 Get( ATTR_ACTION
) ).GetValue());
326 SetActualClickAction( eCA
);
329 m_pLbAction
->SetNoSelection();
332 if( rAttrs
->GetItemState( ATTR_ACTION_FILENAME
) != SfxItemState::DONTCARE
)
334 aFileName
= static_cast<const SfxStringItem
&>( rAttrs
->Get( ATTR_ACTION_FILENAME
) ).GetValue();
335 SetEditText( aFileName
);
340 case presentation::ClickAction_BOOKMARK
:
342 if( !m_pLbTree
->SelectEntry( aFileName
) )
343 m_pLbTree
->SelectAll( false );
347 case presentation::ClickAction_DOCUMENT
:
349 if( comphelper::string::getTokenCount(aFileName
, DOCUMENT_TOKEN
) == 2 )
350 m_pLbTreeDocument
->SelectEntry( aFileName
.getToken( 1, DOCUMENT_TOKEN
) );
357 ClickActionHdl( *m_pLbAction
);
359 m_pLbAction
->SaveValue();
360 m_pEdtSound
->SaveValue();
363 void SdTPAction::ActivatePage( const SfxItemSet
& )
367 DeactivateRC
SdTPAction::DeactivatePage( SfxItemSet
* pPageSet
)
370 FillItemSet( pPageSet
);
372 return DeactivateRC::LeavePage
;
375 VclPtr
<SfxTabPage
> SdTPAction::Create( TabPageParent pWindow
,
376 const SfxItemSet
& rAttrs
)
378 return VclPtr
<SdTPAction
>::Create( pWindow
.pParent
, rAttrs
);
381 void SdTPAction::UpdateTree()
383 if( !bTreeUpdated
&& mpDoc
&& mpDoc
->GetDocSh() && mpDoc
->GetDocSh()->GetMedium() )
385 //m_pLbTree->Clear();
386 m_pLbTree
->Fill( mpDoc
, true, mpDoc
->GetDocSh()->GetMedium()->GetName() );
391 void SdTPAction::OpenFileDialog()
393 // Soundpreview only for interaction with sound
394 presentation::ClickAction eCA
= GetActualClickAction();
395 bool bSound
= ( eCA
== presentation::ClickAction_SOUND
);
396 bool bPage
= ( eCA
== presentation::ClickAction_BOOKMARK
);
397 bool bDocument
= ( eCA
== presentation::ClickAction_DOCUMENT
||
398 eCA
== presentation::ClickAction_PROGRAM
);
399 bool bMacro
= ( eCA
== presentation::ClickAction_MACRO
);
403 // search in the TreeLB for the specified object
404 m_pLbTree
->SelectEntry( GetEditText() );
408 OUString
aFile( GetEditText() );
412 SdOpenSoundFileDialog
aFileDialog(GetFrameWeld());
414 if( !aFile
.isEmpty() )
415 aFileDialog
.SetPath( aFile
);
417 if( aFileDialog
.Execute() == ERRCODE_NONE
)
419 aFile
= aFileDialog
.GetPath();
420 SetEditText( aFile
);
425 // choose macro dialog
426 OUString aScriptURL
= SfxApplication::ChooseScript();
428 if ( !aScriptURL
.isEmpty() )
430 SetEditText( aScriptURL
);
435 sfx2::FileDialogHelper
aFileDialog(
436 ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION
,
437 FileDialogFlags::NONE
, GetFrameWeld());
439 if (bDocument
&& aFile
.isEmpty())
440 aFile
= SvtPathOptions().GetWorkPath();
442 aFileDialog
.SetDisplayDirectory( aFile
);
444 // The following is a workaround for #i4306#:
445 // The addition of the implicitly existing "all files"
446 // filter makes the (Windows system) open file dialog follow
447 // links on the desktop to directories.
448 aFileDialog
.AddFilter (
449 SfxResId(STR_SFX_FILTERNAME_ALL
),
452 if( aFileDialog
.Execute() == ERRCODE_NONE
)
454 aFile
= aFileDialog
.GetPath();
455 SetEditText( aFile
);
458 CheckFileHdl( *m_pEdtDocument
);
463 IMPL_LINK_NOARG(SdTPAction
, ClickSearchHdl
, Button
*, void)
468 IMPL_LINK_NOARG(SdTPAction
, ClickActionHdl
, ListBox
&, void)
470 presentation::ClickAction eCA
= GetActualClickAction();
472 // hide controls we don't need
475 case presentation::ClickAction_NONE
:
476 case presentation::ClickAction_INVISIBLE
:
477 case presentation::ClickAction_PREVPAGE
:
478 case presentation::ClickAction_NEXTPAGE
:
479 case presentation::ClickAction_FIRSTPAGE
:
480 case presentation::ClickAction_LASTPAGE
:
481 case presentation::ClickAction_STOPPRESENTATION
:
485 m_pLbTreeDocument
->Hide();
486 m_pLbOLEAction
->Hide();
490 m_pEdtBookmark
->Hide();
491 m_pEdtDocument
->Hide();
492 m_pEdtProgram
->Hide();
494 m_pBtnSearch
->Hide();
498 case presentation::ClickAction_SOUND
:
499 case presentation::ClickAction_PROGRAM
:
500 case presentation::ClickAction_MACRO
:
503 m_pLbTreeDocument
->Hide();
504 m_pLbOLEAction
->Hide();
506 m_pEdtDocument
->Hide();
508 if( eCA
== presentation::ClickAction_MACRO
)
511 m_pEdtProgram
->Hide();
513 else if( eCA
== presentation::ClickAction_PROGRAM
)
518 else if( eCA
== presentation::ClickAction_SOUND
)
520 m_pEdtProgram
->Hide();
527 case presentation::ClickAction_DOCUMENT
:
529 m_pLbOLEAction
->Hide();
532 m_pEdtProgram
->Hide();
534 m_pEdtBookmark
->Hide();
538 case presentation::ClickAction_BOOKMARK
:
539 m_pLbTreeDocument
->Hide();
540 m_pLbOLEAction
->Hide();
542 m_pEdtDocument
->Hide();
543 m_pEdtProgram
->Hide();
545 m_pBtnSearch
->Hide();
548 case presentation::ClickAction_VERB
:
550 m_pEdtDocument
->Hide();
551 m_pEdtProgram
->Hide();
552 m_pEdtBookmark
->Hide();
554 m_pBtnSearch
->Hide();
561 // show controls we do need
564 case presentation::ClickAction_NONE
:
565 case presentation::ClickAction_INVISIBLE
:
566 case presentation::ClickAction_PREVPAGE
:
567 case presentation::ClickAction_NEXTPAGE
:
568 case presentation::ClickAction_FIRSTPAGE
:
569 case presentation::ClickAction_LASTPAGE
:
570 case presentation::ClickAction_STOPPRESENTATION
:
574 case presentation::ClickAction_SOUND
:
577 m_pEdtSound
->Enable();
578 m_pBtnSearch
->Show();
579 m_pBtnSearch
->Enable();
580 m_pFrame
->set_label( SdResId( STR_EFFECTDLG_SOUND
) );
583 case presentation::ClickAction_PROGRAM
:
584 case presentation::ClickAction_MACRO
:
586 m_pBtnSearch
->Show();
587 m_pBtnSearch
->Enable();
588 if( eCA
== presentation::ClickAction_MACRO
)
591 m_pFrame
->set_label( SdResId( STR_EFFECTDLG_MACRO
) );
595 m_pEdtProgram
->Show();
596 m_pFrame
->set_label( SdResId( STR_EFFECTDLG_PROGRAM
) );
600 case presentation::ClickAction_DOCUMENT
:
602 m_pLbTreeDocument
->Show();
605 m_pEdtDocument
->Show();
606 m_pBtnSearch
->Show();
607 m_pBtnSearch
->Enable();
609 m_pFtTree
->SetText( SdResId( STR_EFFECTDLG_JUMP
) );
610 m_pFrame
->set_label( SdResId( STR_EFFECTDLG_DOCUMENT
) );
612 CheckFileHdl( *m_pEdtDocument
);
615 case presentation::ClickAction_VERB
:
617 m_pLbOLEAction
->Show();
619 m_pFtTree
->SetText( SdResId( STR_EFFECTDLG_ACTION
) );
622 case presentation::ClickAction_BOOKMARK
:
629 m_pEdtBookmark
->Show();
632 m_pFtTree
->SetText( SdResId( STR_EFFECTDLG_JUMP
) );
633 m_pFrame
->set_label( SdResId( STR_EFFECTDLG_PAGE_OBJECT
) );
640 IMPL_LINK_NOARG(SdTPAction
, SelectTreeHdl
, SvTreeListBox
*, void)
642 m_pEdtBookmark
->SetText( m_pLbTree
->GetSelectedEntry() );
645 IMPL_LINK_NOARG(SdTPAction
, CheckFileHdl
, Control
&, void)
647 OUString
aFile( GetEditText() );
649 if( aFile
!= aLastFile
)
651 // check if it is a valid draw file
652 SfxMedium
aMedium( aFile
,
653 StreamMode::READ
| StreamMode::NOCREATE
);
655 if( aMedium
.IsStorage() )
657 WaitObject
aWait( GetParentDialog() );
659 bool bHideTreeDocument
= true;
661 // is it a draw file?
662 // open with READ, otherwise the Storages might write into the file!
663 uno::Reference
< embed::XStorage
> xStorage
= aMedium
.GetStorage();
664 DBG_ASSERT( xStorage
.is(), "No storage!" );
666 uno::Reference
< container::XNameAccess
> xAccess( xStorage
, uno::UNO_QUERY
);
671 if (xAccess
->hasByName(pStarDrawXMLContent
) ||
672 xAccess
->hasByName(pStarDrawOldXMLContent
))
674 if (SdDrawDocument
* pBookmarkDoc
= mpDoc
->OpenBookmarkDoc(aFile
))
678 m_pLbTreeDocument
->Clear();
679 m_pLbTreeDocument
->Fill(pBookmarkDoc
, true, aFile
);
680 mpDoc
->CloseBookmarkDoc();
681 m_pLbTreeDocument
->Show();
682 bHideTreeDocument
= false;
691 if (bHideTreeDocument
)
692 m_pLbTreeDocument
->Hide();
696 m_pLbTreeDocument
->Hide();
700 presentation::ClickAction
SdTPAction::GetActualClickAction()
702 presentation::ClickAction eCA
= presentation::ClickAction_NONE
;
703 sal_Int32 nPos
= m_pLbAction
->GetSelectedEntryPos();
705 if (nPos
!= LISTBOX_ENTRY_NOTFOUND
&& static_cast<size_t>(nPos
) < maCurrentActions
.size())
706 eCA
= maCurrentActions
[ nPos
];
710 void SdTPAction::SetActualClickAction( presentation::ClickAction eCA
)
712 std::vector
<css::presentation::ClickAction
>::const_iterator pIter
=
713 std::find(maCurrentActions
.begin(),maCurrentActions
.end(),eCA
);
715 if ( pIter
!= maCurrentActions
.end() )
716 m_pLbAction
->SelectEntryPos( pIter
-maCurrentActions
.begin() );
719 void SdTPAction::SetEditText( OUString
const & rStr
)
721 presentation::ClickAction eCA
= GetActualClickAction();
722 OUString
aText(rStr
);
724 // possibly convert URI back to system path
727 case presentation::ClickAction_DOCUMENT
:
728 if( comphelper::string::getTokenCount(rStr
, DOCUMENT_TOKEN
) == 2 )
729 aText
= rStr
.getToken( 0, DOCUMENT_TOKEN
);
732 case presentation::ClickAction_SOUND
:
733 case presentation::ClickAction_PROGRAM
:
735 INetURLObject
aURL( aText
);
737 // try to convert to system path
738 OUString
aTmpStr(aURL
.getFSysPath(FSysStyle::Detect
));
740 if( !aTmpStr
.isEmpty() )
741 aText
= aTmpStr
; // was a system path
748 // set the string to the corresponding control
751 case presentation::ClickAction_SOUND
:
752 m_pEdtSound
->SetText(aText
);
754 case presentation::ClickAction_VERB
:
756 ::std::vector
< long >::iterator
aFound( ::std::find( aVerbVector
.begin(), aVerbVector
.end(), rStr
.toInt32() ) );
757 if( aFound
!= aVerbVector
.end() )
758 m_pLbOLEAction
->SelectEntryPos( static_cast< short >( aFound
- aVerbVector
.begin() ) );
761 case presentation::ClickAction_PROGRAM
:
762 m_pEdtProgram
->SetText( aText
);
764 case presentation::ClickAction_MACRO
:
766 m_pEdtMacro
->SetText( aText
);
769 case presentation::ClickAction_DOCUMENT
:
770 m_pEdtDocument
->SetText( aText
);
772 case presentation::ClickAction_BOOKMARK
:
773 m_pEdtBookmark
->SetText( aText
);
780 OUString
SdTPAction::GetEditText( bool bFullDocDestination
)
783 presentation::ClickAction eCA
= GetActualClickAction();
787 case presentation::ClickAction_SOUND
:
788 aStr
= m_pEdtSound
->GetText();
790 case presentation::ClickAction_VERB
:
792 const sal_Int32 nPos
= m_pLbOLEAction
->GetSelectedEntryPos();
793 if( static_cast<size_t>(nPos
) < aVerbVector
.size() )
794 aStr
= OUString::number( aVerbVector
[ nPos
] );
797 case presentation::ClickAction_DOCUMENT
:
798 aStr
= m_pEdtDocument
->GetText();
801 case presentation::ClickAction_PROGRAM
:
802 aStr
= m_pEdtProgram
->GetText();
805 case presentation::ClickAction_MACRO
:
807 return m_pEdtMacro
->GetText();
810 case presentation::ClickAction_BOOKMARK
:
811 return m_pEdtBookmark
->GetText();
818 INetURLObject
aURL( aStr
);
820 if( mpDoc
&& mpDoc
->GetDocSh() && mpDoc
->GetDocSh()->GetMedium() )
821 aBaseURL
= mpDoc
->GetDocSh()->GetMedium()->GetBaseURL();
823 if( !aStr
.isEmpty() && aURL
.GetProtocol() == INetProtocol::NotValid
)
824 aURL
= INetURLObject( ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL
), aStr
, URIHelper::GetMaybeFileHdl() ) );
826 // get adjusted file name
827 aStr
= aURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
829 if( bFullDocDestination
&&
830 eCA
== presentation::ClickAction_DOCUMENT
&&
831 m_pLbTreeDocument
->Control::IsVisible() &&
832 m_pLbTreeDocument
->GetSelectionCount() > 0 )
834 OUString
aTmpStr( m_pLbTreeDocument
->GetSelectedEntry() );
835 if( !aTmpStr
.isEmpty() )
837 aStr
+= OUStringLiteral1(DOCUMENT_TOKEN
) + aTmpStr
;
844 const char* SdTPAction::GetClickActionSdResId( presentation::ClickAction eCA
)
848 case presentation::ClickAction_NONE
: return STR_CLICK_ACTION_NONE
;
849 case presentation::ClickAction_PREVPAGE
: return STR_CLICK_ACTION_PREVPAGE
;
850 case presentation::ClickAction_NEXTPAGE
: return STR_CLICK_ACTION_NEXTPAGE
;
851 case presentation::ClickAction_FIRSTPAGE
: return STR_CLICK_ACTION_FIRSTPAGE
;
852 case presentation::ClickAction_LASTPAGE
: return STR_CLICK_ACTION_LASTPAGE
;
853 case presentation::ClickAction_BOOKMARK
: return STR_CLICK_ACTION_BOOKMARK
;
854 case presentation::ClickAction_DOCUMENT
: return STR_CLICK_ACTION_DOCUMENT
;
855 case presentation::ClickAction_PROGRAM
: return STR_CLICK_ACTION_PROGRAM
;
856 case presentation::ClickAction_MACRO
: return STR_CLICK_ACTION_MACRO
;
857 case presentation::ClickAction_SOUND
: return STR_CLICK_ACTION_SOUND
;
858 case presentation::ClickAction_VERB
: return STR_CLICK_ACTION_VERB
;
859 case presentation::ClickAction_STOPPRESENTATION
: return STR_CLICK_ACTION_STOPPRESENTATION
;
860 default: OSL_FAIL( "No StringResource for ClickAction available!" );
865 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */