1*5b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5b190011SAndrew Rist * distributed with this work for additional information 6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance 9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5b190011SAndrew Rist * software distributed under the License is distributed on an 15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the 17*5b190011SAndrew Rist * specific language governing permissions and limitations 18*5b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*5b190011SAndrew Rist *************************************************************/ 21*5b190011SAndrew Rist 22*5b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifdef SD_DLLIMPLEMENTATION 28cdf0e10cSrcweir #undef SD_DLLIMPLEMENTATION 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <svx/svxids.hrc> 32cdf0e10cSrcweir #include <com/sun/star/presentation/AnimationEffect.hpp> 33cdf0e10cSrcweir #include <com/sun/star/presentation/ClickAction.hpp> 34cdf0e10cSrcweir #include <com/sun/star/presentation/AnimationSpeed.hpp> 35cdf0e10cSrcweir #ifndef _COM_SUN_STAR_EMBED_VERBDESCR_HPP_ 36cdf0e10cSrcweir #include <com/sun/star/embed/VerbDescriptor.hpp> 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir #include <com/sun/star/embed/EmbedStates.hpp> 39cdf0e10cSrcweir #include <com/sun/star/uri/XUriReferenceFactory.hpp> 40cdf0e10cSrcweir #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> 41cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 42cdf0e10cSrcweir #include <com/sun/star/embed/VerbAttributes.hpp> 43cdf0e10cSrcweir 44cdf0e10cSrcweir #include "sdattr.hxx" 45cdf0e10cSrcweir #include <sfx2/sfxresid.hxx> 46cdf0e10cSrcweir 47cdf0e10cSrcweir #include <vcl/waitobj.hxx> 48cdf0e10cSrcweir #include <osl/file.hxx> 49cdf0e10cSrcweir #include <sfx2/app.hxx> 50cdf0e10cSrcweir #include <unotools/pathoptions.hxx> 51cdf0e10cSrcweir #include <svx/svdpagv.hxx> 52cdf0e10cSrcweir #include <unotools/localfilehelper.hxx> 53cdf0e10cSrcweir #include <svl/aeitem.hxx> 54cdf0e10cSrcweir #include <editeng/colritem.hxx> 55cdf0e10cSrcweir #include <svx/svdoole2.hxx> 56cdf0e10cSrcweir #include <sfx2/docfile.hxx> 57cdf0e10cSrcweir #include <sot/storage.hxx> 58cdf0e10cSrcweir #include <basic/sbmeth.hxx> 59cdf0e10cSrcweir #include <basic/sbmod.hxx> 60cdf0e10cSrcweir #include <basic/sbstar.hxx> 61cdf0e10cSrcweir #include <svx/xtable.hxx> 62cdf0e10cSrcweir #include <vcl/svapp.hxx> 63cdf0e10cSrcweir #include <vcl/mnemonic.hxx> 64cdf0e10cSrcweir #include <svl/urihelper.hxx> 65cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx> 66cdf0e10cSrcweir #include <svx/drawitem.hxx> 67cdf0e10cSrcweir #include "View.hxx" 68cdf0e10cSrcweir #include "sdresid.hxx" 69cdf0e10cSrcweir #include "tpaction.hxx" 70cdf0e10cSrcweir #include "tpaction.hrc" 71cdf0e10cSrcweir #include "strmname.h" 72cdf0e10cSrcweir #include "ViewShell.hxx" 73cdf0e10cSrcweir #include "drawdoc.hxx" 74cdf0e10cSrcweir #include "DrawDocShell.hxx" 75cdf0e10cSrcweir #include "strings.hrc" 76cdf0e10cSrcweir #include "res_bmp.hrc" 77cdf0e10cSrcweir #include "filedlg.hxx" 78cdf0e10cSrcweir 79cdf0e10cSrcweir #include <algorithm> 80cdf0e10cSrcweir 81cdf0e10cSrcweir using namespace ::com::sun::star; 82cdf0e10cSrcweir using namespace com::sun::star::uno; 83cdf0e10cSrcweir using namespace com::sun::star::lang; 84cdf0e10cSrcweir 85cdf0e10cSrcweir #define DOCUMENT_TOKEN (sal_Unicode('#')) 86cdf0e10cSrcweir 87cdf0e10cSrcweir /************************************************************************* 88cdf0e10cSrcweir |* 89cdf0e10cSrcweir |* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu 90cdf0e10cSrcweir |* 91cdf0e10cSrcweir \************************************************************************/ 92cdf0e10cSrcweir 93cdf0e10cSrcweir SdActionDlg::SdActionDlg ( 94cdf0e10cSrcweir ::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView ) : 95cdf0e10cSrcweir SfxSingleTabDialog ( pParent, *pAttr, TP_ANIMATION_ACTION ), 96cdf0e10cSrcweir rOutAttrs ( *pAttr ) 97cdf0e10cSrcweir { 98cdf0e10cSrcweir // FreeResource(); 99cdf0e10cSrcweir SfxTabPage* pNewPage = SdTPAction::Create( this, rOutAttrs ); 100cdf0e10cSrcweir DBG_ASSERT( pNewPage, "Seite konnte nicht erzeugt werden"); 101cdf0e10cSrcweir 102cdf0e10cSrcweir // Ehemals in PageCreated 103cdf0e10cSrcweir ( (SdTPAction*) pNewPage )->SetView( pView ); 104cdf0e10cSrcweir ( (SdTPAction*) pNewPage )->Construct(); 105cdf0e10cSrcweir 106cdf0e10cSrcweir SetTabPage( pNewPage ); 107cdf0e10cSrcweir 108cdf0e10cSrcweir String aStr( pNewPage->GetText() ); 109cdf0e10cSrcweir if( aStr.Len() ) 110cdf0e10cSrcweir SetText( aStr ); 111cdf0e10cSrcweir } 112cdf0e10cSrcweir 113cdf0e10cSrcweir 114cdf0e10cSrcweir /************************************************************************* 115cdf0e10cSrcweir |* 116cdf0e10cSrcweir |* Action-TabPage 117cdf0e10cSrcweir |* 118cdf0e10cSrcweir \************************************************************************/ 119cdf0e10cSrcweir 120cdf0e10cSrcweir SdTPAction::SdTPAction( Window* pWindow, const SfxItemSet& rInAttrs ) : 121cdf0e10cSrcweir SfxTabPage ( pWindow, SdResId( TP_ANIMATION ), rInAttrs ), 122cdf0e10cSrcweir 123cdf0e10cSrcweir aFtAction ( this, SdResId( FT_ACTION ) ), 124cdf0e10cSrcweir aLbAction ( this, SdResId( LB_ACTION ) ), 125cdf0e10cSrcweir aFtTree ( this, SdResId( FT_TREE ) ), 126cdf0e10cSrcweir aLbTree ( this, SdResId( LB_TREE ) ), 127cdf0e10cSrcweir aLbTreeDocument ( this, SdResId( LB_TREE_DOCUMENT ) ), 128cdf0e10cSrcweir aLbOLEAction ( this, SdResId( LB_OLE_ACTION ) ), 129cdf0e10cSrcweir aFlSeparator ( this, SdResId( FL_SEPARATOR ) ), 130cdf0e10cSrcweir aEdtSound ( this, SdResId( EDT_SOUND ) ), 131cdf0e10cSrcweir aEdtBookmark ( this, SdResId( EDT_BOOKMARK ) ), 132cdf0e10cSrcweir aEdtDocument ( this, SdResId( EDT_DOCUMENT ) ), 133cdf0e10cSrcweir aEdtProgram ( this, SdResId( EDT_PROGRAM ) ), 134cdf0e10cSrcweir aEdtMacro ( this, SdResId( EDT_MACRO ) ), 135cdf0e10cSrcweir aBtnSearch ( this, SdResId( BTN_SEARCH ) ), 136cdf0e10cSrcweir aBtnSeek ( this, SdResId( BTN_SEEK ) ), 137cdf0e10cSrcweir 138cdf0e10cSrcweir rOutAttrs ( rInAttrs ), 139cdf0e10cSrcweir mpView ( NULL ), 140cdf0e10cSrcweir mpDoc ( NULL ), 141cdf0e10cSrcweir bTreeUpdated ( sal_False ) 142cdf0e10cSrcweir { 143cdf0e10cSrcweir aEdtSound.SetAccessibleName(String(SdResId(STR_PATHNAME))); 144cdf0e10cSrcweir aBtnSeek.SetAccessibleRelationMemberOf( &aFlSeparator ); 145cdf0e10cSrcweir 146cdf0e10cSrcweir FreeResource(); 147cdf0e10cSrcweir 148cdf0e10cSrcweir aBtnSearch.SetClickHdl( LINK( this, SdTPAction, ClickSearchHdl ) ); 149cdf0e10cSrcweir aBtnSeek.SetClickHdl( LINK( this, SdTPAction, ClickSearchHdl ) ); 150cdf0e10cSrcweir 151cdf0e10cSrcweir // diese Page braucht ExchangeSupport 152cdf0e10cSrcweir SetExchangeSupport(); 153cdf0e10cSrcweir 154cdf0e10cSrcweir aLbAction.SetSelectHdl( LINK( this, SdTPAction, ClickActionHdl ) ); 155cdf0e10cSrcweir aLbTree.SetSelectHdl( LINK( this, SdTPAction, SelectTreeHdl ) ); 156cdf0e10cSrcweir aEdtDocument.SetLoseFocusHdl( LINK( this, SdTPAction, CheckFileHdl ) ); 157cdf0e10cSrcweir aEdtMacro.SetLoseFocusHdl( LINK( this, SdTPAction, CheckFileHdl ) ); 158cdf0e10cSrcweir 159cdf0e10cSrcweir // Controls enablen 160cdf0e10cSrcweir aFtAction.Show(); 161cdf0e10cSrcweir aLbAction.Show(); 162cdf0e10cSrcweir 163cdf0e10cSrcweir ClickActionHdl( this ); 164cdf0e10cSrcweir } 165cdf0e10cSrcweir 166cdf0e10cSrcweir // ----------------------------------------------------------------------- 167cdf0e10cSrcweir 168cdf0e10cSrcweir SdTPAction::~SdTPAction() 169cdf0e10cSrcweir { 170cdf0e10cSrcweir delete pCurrentActions; 171cdf0e10cSrcweir } 172cdf0e10cSrcweir 173cdf0e10cSrcweir // ----------------------------------------------------------------------- 174cdf0e10cSrcweir 175cdf0e10cSrcweir void SdTPAction::SetView( const ::sd::View* pSdView ) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir mpView = pSdView; 178cdf0e10cSrcweir 179cdf0e10cSrcweir // Holen der ColorTable und Fuellen der ListBox 180cdf0e10cSrcweir ::sd::DrawDocShell* pDocSh = static_cast<const ::sd::View*>(mpView)->GetDocSh(); 181cdf0e10cSrcweir if( pDocSh && pDocSh->GetViewShell() ) 182cdf0e10cSrcweir { 183cdf0e10cSrcweir mpDoc = pDocSh->GetDoc(); 184cdf0e10cSrcweir SfxViewFrame* pFrame = pDocSh->GetViewShell()->GetViewFrame(); 185cdf0e10cSrcweir aLbTree.SetViewFrame( pFrame ); 186cdf0e10cSrcweir aLbTreeDocument.SetViewFrame( pFrame ); 187cdf0e10cSrcweir 188cdf0e10cSrcweir SvxColorTableItem aItem( *(const SvxColorTableItem*)( pDocSh->GetItem( SID_COLOR_TABLE ) ) ); 189cdf0e10cSrcweir pColTab = aItem.GetColorTable(); 190cdf0e10cSrcweir DBG_ASSERT( pColTab, "Keine Farbtabelle vorhanden!" ); 191cdf0e10cSrcweir } 192cdf0e10cSrcweir else 193cdf0e10cSrcweir { 194cdf0e10cSrcweir DBG_ERROR("sd::SdTPAction::SetView(), no docshell or viewshell?"); 195cdf0e10cSrcweir } 196cdf0e10cSrcweir } 197cdf0e10cSrcweir 198cdf0e10cSrcweir // ----------------------------------------------------------------------- 199cdf0e10cSrcweir 200cdf0e10cSrcweir void SdTPAction::Construct() 201cdf0e10cSrcweir { 202cdf0e10cSrcweir // OLE-Actionlistbox auffuellen 203cdf0e10cSrcweir SdrOle2Obj* pOleObj = NULL; 204cdf0e10cSrcweir SdrGrafObj* pGrafObj = NULL; 205cdf0e10cSrcweir sal_Bool bOLEAction = sal_False; 206cdf0e10cSrcweir 207cdf0e10cSrcweir if ( mpView->AreObjectsMarked() ) 208cdf0e10cSrcweir { 209cdf0e10cSrcweir const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 210cdf0e10cSrcweir SdrObject* pObj; 211cdf0e10cSrcweir 212cdf0e10cSrcweir if (rMarkList.GetMarkCount() == 1) 213cdf0e10cSrcweir { 214cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0); 215cdf0e10cSrcweir pObj = pMark->GetMarkedSdrObj(); 216cdf0e10cSrcweir 217cdf0e10cSrcweir sal_uInt32 nInv = pObj->GetObjInventor(); 218cdf0e10cSrcweir sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); 219cdf0e10cSrcweir 220cdf0e10cSrcweir if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2) 221cdf0e10cSrcweir { 222cdf0e10cSrcweir pOleObj = (SdrOle2Obj*) pObj; 223cdf0e10cSrcweir } 224cdf0e10cSrcweir else if (nInv == SdrInventor && nSdrObjKind == OBJ_GRAF) 225cdf0e10cSrcweir { 226cdf0e10cSrcweir pGrafObj = (SdrGrafObj*) pObj; 227cdf0e10cSrcweir } 228cdf0e10cSrcweir // // VCXControl ? 229cdf0e10cSrcweir // else if( pObj->IsA( TYPE( VCSbxDrawObject ) ) ) 230cdf0e10cSrcweir // { 231cdf0e10cSrcweir // bDisableAll = sal_True; 232cdf0e10cSrcweir // } 233cdf0e10cSrcweir } 234cdf0e10cSrcweir } 235cdf0e10cSrcweir if( pGrafObj ) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir bOLEAction = sal_True; 238cdf0e10cSrcweir 239cdf0e10cSrcweir aVerbVector.push_back( 0 ); 240cdf0e10cSrcweir aLbOLEAction.InsertEntry( MnemonicGenerator::EraseAllMnemonicChars( String( SdResId( STR_EDIT_OBJ ) ) ) ); 241cdf0e10cSrcweir } 242cdf0e10cSrcweir else if( pOleObj ) 243cdf0e10cSrcweir { 244cdf0e10cSrcweir uno::Reference < embed::XEmbeddedObject > xObj = pOleObj->GetObjRef(); 245cdf0e10cSrcweir if ( xObj.is() ) 246cdf0e10cSrcweir { 247cdf0e10cSrcweir bOLEAction = sal_True; 248cdf0e10cSrcweir uno::Sequence < embed::VerbDescriptor > aVerbs; 249cdf0e10cSrcweir try 250cdf0e10cSrcweir { 251cdf0e10cSrcweir aVerbs = xObj->getSupportedVerbs(); 252cdf0e10cSrcweir } 253cdf0e10cSrcweir catch ( embed::NeedsRunningStateException& ) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir xObj->changeState( embed::EmbedStates::RUNNING ); 256cdf0e10cSrcweir aVerbs = xObj->getSupportedVerbs(); 257cdf0e10cSrcweir } 258cdf0e10cSrcweir 259cdf0e10cSrcweir for( sal_Int32 i=0; i<aVerbs.getLength(); i++ ) 260cdf0e10cSrcweir { 261cdf0e10cSrcweir embed::VerbDescriptor aVerb = aVerbs[i]; 262cdf0e10cSrcweir if( aVerb.VerbAttributes & embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU ) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir String aTmp( aVerb.VerbName ); 265cdf0e10cSrcweir aVerbVector.push_back( aVerb.VerbID ); 266cdf0e10cSrcweir aLbOLEAction.InsertEntry( MnemonicGenerator::EraseAllMnemonicChars( aTmp ) ); 267cdf0e10cSrcweir } 268cdf0e10cSrcweir } 269cdf0e10cSrcweir } 270cdf0e10cSrcweir } 271cdf0e10cSrcweir 272cdf0e10cSrcweir pCurrentActions = new List; 273cdf0e10cSrcweir pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_NONE, LIST_APPEND); 274cdf0e10cSrcweir pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_PREVPAGE, LIST_APPEND); 275cdf0e10cSrcweir pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_NEXTPAGE, LIST_APPEND); 276cdf0e10cSrcweir pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_FIRSTPAGE, LIST_APPEND); 277cdf0e10cSrcweir pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_LASTPAGE, LIST_APPEND); 278cdf0e10cSrcweir pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_BOOKMARK, LIST_APPEND); 279cdf0e10cSrcweir pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_DOCUMENT, LIST_APPEND); 280cdf0e10cSrcweir pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_SOUND, LIST_APPEND); 281cdf0e10cSrcweir if( bOLEAction && aLbOLEAction.GetEntryCount() ) 282cdf0e10cSrcweir pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_VERB, LIST_APPEND ); 283cdf0e10cSrcweir pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_PROGRAM, LIST_APPEND); 284cdf0e10cSrcweir pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_MACRO, LIST_APPEND); 285cdf0e10cSrcweir pCurrentActions->Insert((void*)(sal_uIntPtr)presentation::ClickAction_STOPPRESENTATION, LIST_APPEND); 286cdf0e10cSrcweir 287cdf0e10cSrcweir // Action-Listbox fuellen 288cdf0e10cSrcweir for (sal_uLong nAction = 0; nAction < pCurrentActions->Count(); nAction++) 289cdf0e10cSrcweir { 290cdf0e10cSrcweir sal_uInt16 nRId = GetClickActionSdResId((presentation::ClickAction)(sal_uLong)pCurrentActions->GetObject(nAction)); 291cdf0e10cSrcweir aLbAction.InsertEntry( String( SdResId( nRId ) ) ); 292cdf0e10cSrcweir } 293cdf0e10cSrcweir 294cdf0e10cSrcweir } 295cdf0e10cSrcweir 296cdf0e10cSrcweir // ----------------------------------------------------------------------- 297cdf0e10cSrcweir 298cdf0e10cSrcweir sal_Bool SdTPAction::FillItemSet( SfxItemSet& rAttrs ) 299cdf0e10cSrcweir { 300cdf0e10cSrcweir sal_Bool bModified = sal_False; 301cdf0e10cSrcweir presentation::ClickAction eCA = presentation::ClickAction_NONE; 302cdf0e10cSrcweir 303cdf0e10cSrcweir if( aLbAction.GetSelectEntryCount() ) 304cdf0e10cSrcweir eCA = GetActualClickAction(); 305cdf0e10cSrcweir 306cdf0e10cSrcweir if( aLbAction.GetSavedValue() != aLbAction.GetSelectEntryPos() ) 307cdf0e10cSrcweir { 308cdf0e10cSrcweir rAttrs.Put( SfxAllEnumItem( ATTR_ACTION, (sal_uInt16)eCA ) ); 309cdf0e10cSrcweir bModified = sal_True; 310cdf0e10cSrcweir } 311cdf0e10cSrcweir else 312cdf0e10cSrcweir rAttrs.InvalidateItem( ATTR_ACTION ); 313cdf0e10cSrcweir 314cdf0e10cSrcweir String aFileName = GetEditText( sal_True ); 315cdf0e10cSrcweir if( aFileName.Len() == 0 ) 316cdf0e10cSrcweir rAttrs.InvalidateItem( ATTR_ACTION_FILENAME ); 317cdf0e10cSrcweir else 318cdf0e10cSrcweir { 319cdf0e10cSrcweir if( mpDoc && mpDoc->GetDocSh() && mpDoc->GetDocSh()->GetMedium() ) 320cdf0e10cSrcweir { 321cdf0e10cSrcweir String aBaseURL = mpDoc->GetDocSh()->GetMedium()->GetBaseURL(); 322cdf0e10cSrcweir if( eCA == presentation::ClickAction_SOUND || 323cdf0e10cSrcweir eCA == presentation::ClickAction_DOCUMENT || 324cdf0e10cSrcweir eCA == presentation::ClickAction_PROGRAM ) 325cdf0e10cSrcweir aFileName = ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), aFileName, URIHelper::GetMaybeFileHdl(), true, false, 326cdf0e10cSrcweir INetURLObject::WAS_ENCODED, 327cdf0e10cSrcweir INetURLObject::DECODE_UNAMBIGUOUS ); 328cdf0e10cSrcweir 329cdf0e10cSrcweir rAttrs.Put( SfxStringItem( ATTR_ACTION_FILENAME, aFileName ) ); 330cdf0e10cSrcweir bModified = sal_True; 331cdf0e10cSrcweir } 332cdf0e10cSrcweir else 333cdf0e10cSrcweir { 334cdf0e10cSrcweir DBG_ERROR("sd::SdTPAction::FillItemSet(), I need a medium!"); 335cdf0e10cSrcweir } 336cdf0e10cSrcweir } 337cdf0e10cSrcweir 338cdf0e10cSrcweir return( bModified ); 339cdf0e10cSrcweir } 340cdf0e10cSrcweir 341cdf0e10cSrcweir //------------------------------------------------------------------------ 342cdf0e10cSrcweir 343cdf0e10cSrcweir void SdTPAction::Reset( const SfxItemSet& rAttrs ) 344cdf0e10cSrcweir { 345cdf0e10cSrcweir presentation::ClickAction eCA = presentation::ClickAction_NONE; 346cdf0e10cSrcweir String aFileName; 347cdf0e10cSrcweir 348cdf0e10cSrcweir // aLbAction 349cdf0e10cSrcweir if( rAttrs.GetItemState( ATTR_ACTION ) != SFX_ITEM_DONTCARE ) 350cdf0e10cSrcweir { 351cdf0e10cSrcweir eCA = (presentation::ClickAction) ( ( const SfxAllEnumItem& ) rAttrs. 352cdf0e10cSrcweir Get( ATTR_ACTION ) ).GetValue(); 353cdf0e10cSrcweir SetActualClickAction( eCA ); 354cdf0e10cSrcweir } 355cdf0e10cSrcweir else 356cdf0e10cSrcweir aLbAction.SetNoSelection(); 357cdf0e10cSrcweir 358cdf0e10cSrcweir // aEdtSound 359cdf0e10cSrcweir if( rAttrs.GetItemState( ATTR_ACTION_FILENAME ) != SFX_ITEM_DONTCARE ) 360cdf0e10cSrcweir { 361cdf0e10cSrcweir aFileName = ( ( const SfxStringItem& ) rAttrs.Get( ATTR_ACTION_FILENAME ) ).GetValue(); 362cdf0e10cSrcweir SetEditText( aFileName ); 363cdf0e10cSrcweir } 364cdf0e10cSrcweir 365cdf0e10cSrcweir switch( eCA ) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK: 368cdf0e10cSrcweir { 369cdf0e10cSrcweir if( !aLbTree.SelectEntry( aFileName ) ) 370cdf0e10cSrcweir aLbTree.SelectAll( sal_False ); 371cdf0e10cSrcweir } 372cdf0e10cSrcweir break; 373cdf0e10cSrcweir 374cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT: 375cdf0e10cSrcweir { 376cdf0e10cSrcweir if( aFileName.GetTokenCount( DOCUMENT_TOKEN ) == 2 ) 377cdf0e10cSrcweir aLbTreeDocument.SelectEntry( aFileName.GetToken( 1, DOCUMENT_TOKEN ) ); 378cdf0e10cSrcweir } 379cdf0e10cSrcweir break; 380cdf0e10cSrcweir 381cdf0e10cSrcweir default: 382cdf0e10cSrcweir break; 383cdf0e10cSrcweir } 384cdf0e10cSrcweir ClickActionHdl( this ); 385cdf0e10cSrcweir 386cdf0e10cSrcweir aLbAction.SaveValue(); 387cdf0e10cSrcweir aEdtSound.SaveValue(); 388cdf0e10cSrcweir } 389cdf0e10cSrcweir 390cdf0e10cSrcweir // ----------------------------------------------------------------------- 391cdf0e10cSrcweir 392cdf0e10cSrcweir void SdTPAction::ActivatePage( const SfxItemSet& ) 393cdf0e10cSrcweir { 394cdf0e10cSrcweir } 395cdf0e10cSrcweir 396cdf0e10cSrcweir // ----------------------------------------------------------------------- 397cdf0e10cSrcweir 398cdf0e10cSrcweir int SdTPAction::DeactivatePage( SfxItemSet* pPageSet ) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir if( pPageSet ) 401cdf0e10cSrcweir FillItemSet( *pPageSet ); 402cdf0e10cSrcweir 403cdf0e10cSrcweir return( LEAVE_PAGE ); 404cdf0e10cSrcweir } 405cdf0e10cSrcweir 406cdf0e10cSrcweir // ----------------------------------------------------------------------- 407cdf0e10cSrcweir 408cdf0e10cSrcweir SfxTabPage* SdTPAction::Create( Window* pWindow, 409cdf0e10cSrcweir const SfxItemSet& rAttrs ) 410cdf0e10cSrcweir { 411cdf0e10cSrcweir return( new SdTPAction( pWindow, rAttrs ) ); 412cdf0e10cSrcweir } 413cdf0e10cSrcweir 414cdf0e10cSrcweir //------------------------------------------------------------------------ 415cdf0e10cSrcweir 416cdf0e10cSrcweir void SdTPAction::UpdateTree() 417cdf0e10cSrcweir { 418cdf0e10cSrcweir if( !bTreeUpdated && mpDoc && mpDoc->GetDocSh() && mpDoc->GetDocSh()->GetMedium() ) 419cdf0e10cSrcweir { 420cdf0e10cSrcweir //aLbTree.Clear(); 421cdf0e10cSrcweir aLbTree.Fill( mpDoc, sal_True, mpDoc->GetDocSh()->GetMedium()->GetName() ); 422cdf0e10cSrcweir bTreeUpdated = sal_True; 423cdf0e10cSrcweir } 424cdf0e10cSrcweir } 425cdf0e10cSrcweir 426cdf0e10cSrcweir //------------------------------------------------------------------------ 427cdf0e10cSrcweir 428cdf0e10cSrcweir void SdTPAction::OpenFileDialog() 429cdf0e10cSrcweir { 430cdf0e10cSrcweir // Soundpreview nur fuer Interaktionen mit Sound 431cdf0e10cSrcweir presentation::ClickAction eCA = GetActualClickAction(); 432cdf0e10cSrcweir sal_Bool bSound = ( eCA == presentation::ClickAction_SOUND ); 433cdf0e10cSrcweir sal_Bool bPage = ( eCA == presentation::ClickAction_BOOKMARK ); 434cdf0e10cSrcweir sal_Bool bDocument = ( eCA == presentation::ClickAction_DOCUMENT || 435cdf0e10cSrcweir eCA == presentation::ClickAction_PROGRAM ); 436cdf0e10cSrcweir sal_Bool bMacro = ( eCA == presentation::ClickAction_MACRO ); 437cdf0e10cSrcweir 438cdf0e10cSrcweir if( bPage ) 439cdf0e10cSrcweir { 440cdf0e10cSrcweir // Es wird in der TreeLB nach dem eingegebenen Objekt gesucht 441cdf0e10cSrcweir aLbTree.SelectEntry( GetEditText() ); 442cdf0e10cSrcweir } 443cdf0e10cSrcweir else 444cdf0e10cSrcweir { 445cdf0e10cSrcweir String aFile( GetEditText() ); 446cdf0e10cSrcweir 447cdf0e10cSrcweir if (bSound) 448cdf0e10cSrcweir { 449cdf0e10cSrcweir SdOpenSoundFileDialog aFileDialog; 450cdf0e10cSrcweir 451cdf0e10cSrcweir if( !aFile.Len() ) 452cdf0e10cSrcweir aFile = SvtPathOptions().GetGraphicPath(); 453cdf0e10cSrcweir 454cdf0e10cSrcweir aFileDialog.SetPath( aFile ); 455cdf0e10cSrcweir 456cdf0e10cSrcweir if( aFileDialog.Execute() == ERRCODE_NONE ) 457cdf0e10cSrcweir { 458cdf0e10cSrcweir aFile = aFileDialog.GetPath(); 459cdf0e10cSrcweir SetEditText( aFile ); 460cdf0e10cSrcweir } 461cdf0e10cSrcweir } 462cdf0e10cSrcweir else if (bMacro) 463cdf0e10cSrcweir { 464cdf0e10cSrcweir Window* pOldWin = Application::GetDefDialogParent(); 465cdf0e10cSrcweir Application::SetDefDialogParent( this ); 466cdf0e10cSrcweir 467cdf0e10cSrcweir // choose macro dialog 468cdf0e10cSrcweir ::rtl::OUString aScriptURL = SfxApplication::ChooseScript(); 469cdf0e10cSrcweir 470cdf0e10cSrcweir if ( aScriptURL.getLength() != 0 ) 471cdf0e10cSrcweir { 472cdf0e10cSrcweir SetEditText( aScriptURL ); 473cdf0e10cSrcweir } 474cdf0e10cSrcweir 475cdf0e10cSrcweir Application::SetDefDialogParent( pOldWin ); 476cdf0e10cSrcweir } 477cdf0e10cSrcweir else 478cdf0e10cSrcweir { 479cdf0e10cSrcweir sfx2::FileDialogHelper aFileDialog(WB_OPEN | WB_3DLOOK | WB_STDMODAL ); 480cdf0e10cSrcweir 481cdf0e10cSrcweir if (bDocument && !aFile.Len()) 482cdf0e10cSrcweir aFile = SvtPathOptions().GetWorkPath(); 483cdf0e10cSrcweir 484cdf0e10cSrcweir aFileDialog.SetDisplayDirectory( aFile ); 485cdf0e10cSrcweir 486cdf0e10cSrcweir // The following is a fix for #1008001# and a workarround for 487cdf0e10cSrcweir // #i4306#: The addition of the implicitely existing "all files" 488cdf0e10cSrcweir // filter makes the (Windows system) open file dialog follow 489cdf0e10cSrcweir // links on the desktop to directories. 490cdf0e10cSrcweir aFileDialog.AddFilter ( 491cdf0e10cSrcweir String (SfxResId (STR_SFX_FILTERNAME_ALL)), 492cdf0e10cSrcweir String (RTL_CONSTASCII_USTRINGPARAM("*.*"))); 493cdf0e10cSrcweir 494cdf0e10cSrcweir 495cdf0e10cSrcweir if( aFileDialog.Execute() == ERRCODE_NONE ) 496cdf0e10cSrcweir { 497cdf0e10cSrcweir aFile = aFileDialog.GetPath(); 498cdf0e10cSrcweir SetEditText( aFile ); 499cdf0e10cSrcweir } 500cdf0e10cSrcweir if( bDocument ) 501cdf0e10cSrcweir CheckFileHdl( NULL ); 502cdf0e10cSrcweir } 503cdf0e10cSrcweir } 504cdf0e10cSrcweir } 505cdf0e10cSrcweir 506cdf0e10cSrcweir //------------------------------------------------------------------------ 507cdf0e10cSrcweir 508cdf0e10cSrcweir IMPL_LINK( SdTPAction, ClickSearchHdl, void *, EMPTYARG ) 509cdf0e10cSrcweir { 510cdf0e10cSrcweir OpenFileDialog(); 511cdf0e10cSrcweir 512cdf0e10cSrcweir return( 0L ); 513cdf0e10cSrcweir } 514cdf0e10cSrcweir 515cdf0e10cSrcweir //------------------------------------------------------------------------ 516cdf0e10cSrcweir 517cdf0e10cSrcweir IMPL_LINK( SdTPAction, ClickActionHdl, void *, EMPTYARG ) 518cdf0e10cSrcweir { 519cdf0e10cSrcweir presentation::ClickAction eCA = GetActualClickAction(); 520cdf0e10cSrcweir 521cdf0e10cSrcweir // hide controls we don't need 522cdf0e10cSrcweir switch( eCA ) 523cdf0e10cSrcweir { 524cdf0e10cSrcweir case presentation::ClickAction_NONE: 525cdf0e10cSrcweir case presentation::ClickAction_INVISIBLE: 526cdf0e10cSrcweir case presentation::ClickAction_PREVPAGE: 527cdf0e10cSrcweir case presentation::ClickAction_NEXTPAGE: 528cdf0e10cSrcweir case presentation::ClickAction_FIRSTPAGE: 529cdf0e10cSrcweir case presentation::ClickAction_LASTPAGE: 530cdf0e10cSrcweir case presentation::ClickAction_STOPPRESENTATION: 531cdf0e10cSrcweir default: 532cdf0e10cSrcweir aFtTree.Hide(); 533cdf0e10cSrcweir aLbTree.Hide(); 534cdf0e10cSrcweir aLbTreeDocument.Hide(); 535cdf0e10cSrcweir aLbOLEAction.Hide(); 536cdf0e10cSrcweir 537cdf0e10cSrcweir aFlSeparator.Hide(); 538cdf0e10cSrcweir aEdtSound.Hide(); 539cdf0e10cSrcweir aEdtBookmark.Hide(); 540cdf0e10cSrcweir aEdtDocument.Hide(); 541cdf0e10cSrcweir aEdtProgram.Hide(); 542cdf0e10cSrcweir aEdtMacro.Hide(); 543cdf0e10cSrcweir aBtnSearch.Hide(); 544cdf0e10cSrcweir aBtnSeek.Hide(); 545cdf0e10cSrcweir break; 546cdf0e10cSrcweir 547cdf0e10cSrcweir case presentation::ClickAction_SOUND: 548cdf0e10cSrcweir case presentation::ClickAction_PROGRAM: 549cdf0e10cSrcweir case presentation::ClickAction_MACRO: 550cdf0e10cSrcweir aFtTree.Hide(); 551cdf0e10cSrcweir aLbTree.Hide(); 552cdf0e10cSrcweir aLbTreeDocument.Hide(); 553cdf0e10cSrcweir aLbOLEAction.Hide(); 554cdf0e10cSrcweir 555cdf0e10cSrcweir aEdtDocument.Hide(); 556cdf0e10cSrcweir 557cdf0e10cSrcweir if( eCA == presentation::ClickAction_MACRO ) 558cdf0e10cSrcweir { 559cdf0e10cSrcweir aEdtSound.Hide(); 560cdf0e10cSrcweir aEdtProgram.Hide(); 561cdf0e10cSrcweir } 562cdf0e10cSrcweir else if( eCA == presentation::ClickAction_PROGRAM ) 563cdf0e10cSrcweir { 564cdf0e10cSrcweir aEdtSound.Hide(); 565cdf0e10cSrcweir aEdtMacro.Hide(); 566cdf0e10cSrcweir } 567cdf0e10cSrcweir else if( eCA == presentation::ClickAction_SOUND ) 568cdf0e10cSrcweir { 569cdf0e10cSrcweir aEdtProgram.Hide(); 570cdf0e10cSrcweir aEdtMacro.Hide(); 571cdf0e10cSrcweir } 572cdf0e10cSrcweir 573cdf0e10cSrcweir aBtnSeek.Hide(); 574cdf0e10cSrcweir break; 575cdf0e10cSrcweir 576cdf0e10cSrcweir 577cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT: 578cdf0e10cSrcweir aLbTree.Hide(); 579cdf0e10cSrcweir aLbOLEAction.Hide(); 580cdf0e10cSrcweir 581cdf0e10cSrcweir aEdtSound.Hide(); 582cdf0e10cSrcweir aEdtProgram.Hide(); 583cdf0e10cSrcweir aEdtMacro.Hide(); 584cdf0e10cSrcweir aEdtBookmark.Hide(); 585cdf0e10cSrcweir aBtnSeek.Hide(); 586cdf0e10cSrcweir break; 587cdf0e10cSrcweir 588cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK: 589cdf0e10cSrcweir aLbTreeDocument.Hide(); 590cdf0e10cSrcweir aLbOLEAction.Hide(); 591cdf0e10cSrcweir aEdtSound.Hide(); 592cdf0e10cSrcweir aEdtDocument.Hide(); 593cdf0e10cSrcweir aEdtProgram.Hide(); 594cdf0e10cSrcweir aEdtMacro.Hide(); 595cdf0e10cSrcweir aBtnSearch.Hide(); 596cdf0e10cSrcweir break; 597cdf0e10cSrcweir 598cdf0e10cSrcweir case presentation::ClickAction_VERB: 599cdf0e10cSrcweir aLbTree.Hide(); 600cdf0e10cSrcweir aEdtDocument.Hide(); 601cdf0e10cSrcweir aEdtProgram.Hide(); 602cdf0e10cSrcweir aEdtBookmark.Hide(); 603cdf0e10cSrcweir aEdtMacro.Hide(); 604cdf0e10cSrcweir aBtnSearch.Hide(); 605cdf0e10cSrcweir aFlSeparator.Hide(); 606cdf0e10cSrcweir aEdtSound.Hide(); 607cdf0e10cSrcweir aBtnSeek.Hide(); 608cdf0e10cSrcweir break; 609cdf0e10cSrcweir } 610cdf0e10cSrcweir 611cdf0e10cSrcweir // show controls we do need 612cdf0e10cSrcweir switch( eCA ) 613cdf0e10cSrcweir { 614cdf0e10cSrcweir case presentation::ClickAction_NONE: 615cdf0e10cSrcweir case presentation::ClickAction_INVISIBLE: 616cdf0e10cSrcweir case presentation::ClickAction_PREVPAGE: 617cdf0e10cSrcweir case presentation::ClickAction_NEXTPAGE: 618cdf0e10cSrcweir case presentation::ClickAction_FIRSTPAGE: 619cdf0e10cSrcweir case presentation::ClickAction_LASTPAGE: 620cdf0e10cSrcweir case presentation::ClickAction_STOPPRESENTATION: 621cdf0e10cSrcweir // none 622cdf0e10cSrcweir break; 623cdf0e10cSrcweir 624cdf0e10cSrcweir case presentation::ClickAction_SOUND: 625cdf0e10cSrcweir aFlSeparator.Show(); 626cdf0e10cSrcweir aEdtSound.Show(); 627cdf0e10cSrcweir aEdtSound.Enable(); 628cdf0e10cSrcweir aBtnSearch.Show(); 629cdf0e10cSrcweir aBtnSearch.Enable(); 630cdf0e10cSrcweir aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_SOUND ) ) ); 631cdf0e10cSrcweir break; 632cdf0e10cSrcweir 633cdf0e10cSrcweir case presentation::ClickAction_PROGRAM: 634cdf0e10cSrcweir case presentation::ClickAction_MACRO: 635cdf0e10cSrcweir aFlSeparator.Show(); 636cdf0e10cSrcweir aBtnSearch.Show(); 637cdf0e10cSrcweir aBtnSearch.Enable(); 638cdf0e10cSrcweir if( eCA == presentation::ClickAction_MACRO ) 639cdf0e10cSrcweir { 640cdf0e10cSrcweir aEdtMacro.Show(); 641cdf0e10cSrcweir aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_MACRO ) ) ); 642cdf0e10cSrcweir } 643cdf0e10cSrcweir else 644cdf0e10cSrcweir { 645cdf0e10cSrcweir aEdtProgram.Show(); 646cdf0e10cSrcweir aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_PROGRAM ) ) ); 647cdf0e10cSrcweir } 648cdf0e10cSrcweir break; 649cdf0e10cSrcweir 650cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT: 651cdf0e10cSrcweir aFtTree.Show(); 652cdf0e10cSrcweir aLbTreeDocument.Show(); 653cdf0e10cSrcweir 654cdf0e10cSrcweir aFlSeparator.Show(); 655cdf0e10cSrcweir aEdtDocument.Show(); 656cdf0e10cSrcweir aBtnSearch.Show(); 657cdf0e10cSrcweir aBtnSearch.Enable(); 658cdf0e10cSrcweir 659cdf0e10cSrcweir aFtTree.SetText( String( SdResId( STR_EFFECTDLG_JUMP ) ) ); 660cdf0e10cSrcweir aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_DOCUMENT ) ) ); 661cdf0e10cSrcweir 662cdf0e10cSrcweir CheckFileHdl( NULL ); 663cdf0e10cSrcweir break; 664cdf0e10cSrcweir 665cdf0e10cSrcweir case presentation::ClickAction_VERB: 666cdf0e10cSrcweir aFtTree.Show(); 667cdf0e10cSrcweir aLbOLEAction.Show(); 668cdf0e10cSrcweir 669cdf0e10cSrcweir aFtTree.SetText( String( SdResId( STR_EFFECTDLG_ACTION ) ) ); 670cdf0e10cSrcweir break; 671cdf0e10cSrcweir 672cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK: 673cdf0e10cSrcweir UpdateTree(); 674cdf0e10cSrcweir 675cdf0e10cSrcweir aFtTree.Show(); 676cdf0e10cSrcweir aLbTree.Show(); 677cdf0e10cSrcweir 678cdf0e10cSrcweir aFlSeparator.Show(); 679cdf0e10cSrcweir aEdtBookmark.Show(); 680cdf0e10cSrcweir aBtnSeek.Show(); 681cdf0e10cSrcweir 682cdf0e10cSrcweir aFtTree.SetText( String( SdResId( STR_EFFECTDLG_JUMP ) ) ); 683cdf0e10cSrcweir aFlSeparator.SetText( String( SdResId( STR_EFFECTDLG_PAGE_OBJECT ) ) ); 684cdf0e10cSrcweir break; 685cdf0e10cSrcweir default: 686cdf0e10cSrcweir break; 687cdf0e10cSrcweir } 688cdf0e10cSrcweir 689cdf0e10cSrcweir return( 0L ); 690cdf0e10cSrcweir } 691cdf0e10cSrcweir 692cdf0e10cSrcweir //------------------------------------------------------------------------ 693cdf0e10cSrcweir 694cdf0e10cSrcweir IMPL_LINK( SdTPAction, SelectTreeHdl, void *, EMPTYARG ) 695cdf0e10cSrcweir { 696cdf0e10cSrcweir aEdtBookmark.SetText( aLbTree.GetSelectEntry() ); 697cdf0e10cSrcweir return( 0L ); 698cdf0e10cSrcweir } 699cdf0e10cSrcweir 700cdf0e10cSrcweir //------------------------------------------------------------------------ 701cdf0e10cSrcweir 702cdf0e10cSrcweir IMPL_LINK( SdTPAction, CheckFileHdl, void *, EMPTYARG ) 703cdf0e10cSrcweir { 704cdf0e10cSrcweir String aFile( GetEditText() ); 705cdf0e10cSrcweir 706cdf0e10cSrcweir if( aFile != aLastFile ) 707cdf0e10cSrcweir { 708cdf0e10cSrcweir // Ueberpruefen, ob es eine gueltige Draw-Datei ist 709cdf0e10cSrcweir SfxMedium aMedium( aFile, 710cdf0e10cSrcweir STREAM_READ | STREAM_NOCREATE, 711cdf0e10cSrcweir sal_True ); // Download 712cdf0e10cSrcweir 713cdf0e10cSrcweir if( aMedium.IsStorage() ) 714cdf0e10cSrcweir { 715cdf0e10cSrcweir WaitObject aWait( GetParent()->GetParent() ); 716cdf0e10cSrcweir 717cdf0e10cSrcweir // ist es eine Draw-Datei? 718cdf0e10cSrcweir // mit READ oeffnen, sonst schreiben die Storages evtl. in die Datei! 719cdf0e10cSrcweir uno::Reference < embed::XStorage > xStorage = aMedium.GetStorage(); 720cdf0e10cSrcweir DBG_ASSERT( xStorage.is(), "Kein Storage!" ); 721cdf0e10cSrcweir 722cdf0e10cSrcweir uno::Reference < container::XNameAccess > xAccess( xStorage, uno::UNO_QUERY ); 723cdf0e10cSrcweir if( xAccess.is() && 724cdf0e10cSrcweir ( xAccess->hasByName( pStarDrawXMLContent ) || 725cdf0e10cSrcweir xAccess->hasByName( pStarDrawOldXMLContent ) ) ) 726cdf0e10cSrcweir { 727cdf0e10cSrcweir SdDrawDocument* pBookmarkDoc = mpDoc->OpenBookmarkDoc( aFile ); 728cdf0e10cSrcweir if( pBookmarkDoc ) 729cdf0e10cSrcweir { 730cdf0e10cSrcweir aLastFile = aFile; 731cdf0e10cSrcweir 732cdf0e10cSrcweir aLbTreeDocument.Clear(); 733cdf0e10cSrcweir aLbTreeDocument.Fill( pBookmarkDoc, sal_True, aFile ); 734cdf0e10cSrcweir mpDoc->CloseBookmarkDoc(); 735cdf0e10cSrcweir aLbTreeDocument.Show(); 736cdf0e10cSrcweir } 737cdf0e10cSrcweir else 738cdf0e10cSrcweir aLbTreeDocument.Hide(); 739cdf0e10cSrcweir } 740cdf0e10cSrcweir else 741cdf0e10cSrcweir aLbTreeDocument.Hide(); 742cdf0e10cSrcweir 743cdf0e10cSrcweir } 744cdf0e10cSrcweir else 745cdf0e10cSrcweir aLbTreeDocument.Hide(); 746cdf0e10cSrcweir } 747cdf0e10cSrcweir 748cdf0e10cSrcweir return( 0L ); 749cdf0e10cSrcweir } 750cdf0e10cSrcweir 751cdf0e10cSrcweir //------------------------------------------------------------------------ 752cdf0e10cSrcweir 753cdf0e10cSrcweir presentation::ClickAction SdTPAction::GetActualClickAction() 754cdf0e10cSrcweir { 755cdf0e10cSrcweir presentation::ClickAction eCA = presentation::ClickAction_NONE; 756cdf0e10cSrcweir sal_uInt16 nPos = aLbAction.GetSelectEntryPos(); 757cdf0e10cSrcweir 758cdf0e10cSrcweir if (nPos != LISTBOX_ENTRY_NOTFOUND) 759cdf0e10cSrcweir eCA = (presentation::ClickAction)(sal_uLong)pCurrentActions->GetObject((sal_uLong)nPos); 760cdf0e10cSrcweir return( eCA ); 761cdf0e10cSrcweir } 762cdf0e10cSrcweir 763cdf0e10cSrcweir //------------------------------------------------------------------------ 764cdf0e10cSrcweir 765cdf0e10cSrcweir void SdTPAction::SetActualClickAction( presentation::ClickAction eCA ) 766cdf0e10cSrcweir { 767cdf0e10cSrcweir sal_uInt16 nPos = (sal_uInt16)pCurrentActions->GetPos((void*)(sal_uLong)eCA); 768cdf0e10cSrcweir DBG_ASSERT(nPos != 0xffff, "unbekannte Interaktion"); 769cdf0e10cSrcweir aLbAction.SelectEntryPos(nPos); 770cdf0e10cSrcweir } 771cdf0e10cSrcweir 772cdf0e10cSrcweir //------------------------------------------------------------------------ 773cdf0e10cSrcweir 774cdf0e10cSrcweir void SdTPAction::SetEditText( String const & rStr ) 775cdf0e10cSrcweir { 776cdf0e10cSrcweir presentation::ClickAction eCA = GetActualClickAction(); 777cdf0e10cSrcweir String aText(rStr); 778cdf0e10cSrcweir 779cdf0e10cSrcweir // possibly convert URI back to system path 780cdf0e10cSrcweir switch( eCA ) 781cdf0e10cSrcweir { 782cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT: 783cdf0e10cSrcweir if( rStr.GetTokenCount( DOCUMENT_TOKEN ) == 2 ) 784cdf0e10cSrcweir aText = rStr.GetToken( 0, DOCUMENT_TOKEN ); 785cdf0e10cSrcweir 786cdf0e10cSrcweir // fallthrough inteded 787cdf0e10cSrcweir case presentation::ClickAction_SOUND: 788cdf0e10cSrcweir case presentation::ClickAction_PROGRAM: 789cdf0e10cSrcweir { 790cdf0e10cSrcweir INetURLObject aURL( aText ); 791cdf0e10cSrcweir 792cdf0e10cSrcweir // try to convert to system path 793cdf0e10cSrcweir String aTmpStr(aURL.getFSysPath(INetURLObject::FSYS_DETECT)); 794cdf0e10cSrcweir 795cdf0e10cSrcweir if( aTmpStr.Len() ) 796cdf0e10cSrcweir aText = aTmpStr; // was a system path 797cdf0e10cSrcweir } 798cdf0e10cSrcweir break; 799cdf0e10cSrcweir default: 800cdf0e10cSrcweir break; 801cdf0e10cSrcweir } 802cdf0e10cSrcweir 803cdf0e10cSrcweir // set the string to the corresponding control 804cdf0e10cSrcweir switch( eCA ) 805cdf0e10cSrcweir { 806cdf0e10cSrcweir case presentation::ClickAction_SOUND: 807cdf0e10cSrcweir aEdtSound.SetText(aText ); 808cdf0e10cSrcweir break; 809cdf0e10cSrcweir case presentation::ClickAction_VERB: 810cdf0e10cSrcweir { 811cdf0e10cSrcweir ::std::vector< long >::iterator aFound( ::std::find( aVerbVector.begin(), aVerbVector.end(), rStr.ToInt32() ) ); 812cdf0e10cSrcweir if( aFound != aVerbVector.end() ) 813cdf0e10cSrcweir aLbOLEAction.SelectEntryPos( static_cast< short >( aFound - aVerbVector.begin() ) ); 814cdf0e10cSrcweir } 815cdf0e10cSrcweir break; 816cdf0e10cSrcweir case presentation::ClickAction_PROGRAM: 817cdf0e10cSrcweir aEdtProgram.SetText( aText ); 818cdf0e10cSrcweir break; 819cdf0e10cSrcweir case presentation::ClickAction_MACRO: 820cdf0e10cSrcweir { 821cdf0e10cSrcweir aEdtMacro.SetText( aText ); 822cdf0e10cSrcweir } 823cdf0e10cSrcweir break; 824cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT: 825cdf0e10cSrcweir aEdtDocument.SetText( aText ); 826cdf0e10cSrcweir break; 827cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK: 828cdf0e10cSrcweir aEdtBookmark.SetText( aText ); 829cdf0e10cSrcweir break; 830cdf0e10cSrcweir default: 831cdf0e10cSrcweir break; 832cdf0e10cSrcweir } 833cdf0e10cSrcweir } 834cdf0e10cSrcweir 835cdf0e10cSrcweir //------------------------------------------------------------------------ 836cdf0e10cSrcweir 837cdf0e10cSrcweir String SdTPAction::GetEditText( sal_Bool bFullDocDestination ) 838cdf0e10cSrcweir { 839cdf0e10cSrcweir String aStr; 840cdf0e10cSrcweir presentation::ClickAction eCA = GetActualClickAction(); 841cdf0e10cSrcweir 842cdf0e10cSrcweir switch( eCA ) 843cdf0e10cSrcweir { 844cdf0e10cSrcweir case presentation::ClickAction_SOUND: 845cdf0e10cSrcweir aStr = aEdtSound.GetText(); 846cdf0e10cSrcweir break; 847cdf0e10cSrcweir case presentation::ClickAction_VERB: 848cdf0e10cSrcweir { 849cdf0e10cSrcweir const sal_uInt16 nPos = aLbOLEAction.GetSelectEntryPos(); 850cdf0e10cSrcweir if( nPos < aVerbVector.size() ) 851cdf0e10cSrcweir aStr = UniString::CreateFromInt32( aVerbVector[ nPos ] ); 852cdf0e10cSrcweir return aStr; 853cdf0e10cSrcweir } 854cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT: 855cdf0e10cSrcweir aStr = aEdtDocument.GetText(); 856cdf0e10cSrcweir break; 857cdf0e10cSrcweir 858cdf0e10cSrcweir case presentation::ClickAction_PROGRAM: 859cdf0e10cSrcweir aStr = aEdtProgram.GetText(); 860cdf0e10cSrcweir break; 861cdf0e10cSrcweir 862cdf0e10cSrcweir case presentation::ClickAction_MACRO: 863cdf0e10cSrcweir { 864cdf0e10cSrcweir return aEdtMacro.GetText(); 865cdf0e10cSrcweir } 866cdf0e10cSrcweir 867cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK: 868cdf0e10cSrcweir return( aEdtBookmark.GetText() ); 869cdf0e10cSrcweir 870cdf0e10cSrcweir default: 871cdf0e10cSrcweir break; 872cdf0e10cSrcweir } 873cdf0e10cSrcweir 874cdf0e10cSrcweir // validate file URI 875cdf0e10cSrcweir INetURLObject aURL( aStr ); 876cdf0e10cSrcweir String aBaseURL; 877cdf0e10cSrcweir if( mpDoc && mpDoc->GetDocSh() && mpDoc->GetDocSh()->GetMedium() ) 878cdf0e10cSrcweir aBaseURL = mpDoc->GetDocSh()->GetMedium()->GetBaseURL(); 879cdf0e10cSrcweir 880cdf0e10cSrcweir if( aStr.Len() && aURL.GetProtocol() == INET_PROT_NOT_VALID ) 881cdf0e10cSrcweir aURL = INetURLObject( ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), aStr, URIHelper::GetMaybeFileHdl(), true, false ) ); 882cdf0e10cSrcweir 883cdf0e10cSrcweir // get adjusted file name 884cdf0e10cSrcweir aStr = aURL.GetMainURL( INetURLObject::NO_DECODE ); 885cdf0e10cSrcweir 886cdf0e10cSrcweir if( bFullDocDestination && 887cdf0e10cSrcweir eCA == presentation::ClickAction_DOCUMENT && 888cdf0e10cSrcweir aLbTreeDocument.Control::IsVisible() && 889cdf0e10cSrcweir aLbTreeDocument.GetSelectionCount() > 0 ) 890cdf0e10cSrcweir { 891cdf0e10cSrcweir String aTmpStr( aLbTreeDocument.GetSelectEntry() ); 892cdf0e10cSrcweir if( aTmpStr.Len() ) 893cdf0e10cSrcweir { 894cdf0e10cSrcweir aStr.Append( DOCUMENT_TOKEN ); 895cdf0e10cSrcweir aStr.Append( aTmpStr ); 896cdf0e10cSrcweir } 897cdf0e10cSrcweir } 898cdf0e10cSrcweir 899cdf0e10cSrcweir return( aStr ); 900cdf0e10cSrcweir } 901cdf0e10cSrcweir 902cdf0e10cSrcweir //------------------------------------------------------------------------ 903cdf0e10cSrcweir 904cdf0e10cSrcweir sal_uInt16 SdTPAction::GetClickActionSdResId( presentation::ClickAction eCA ) 905cdf0e10cSrcweir { 906cdf0e10cSrcweir switch( eCA ) 907cdf0e10cSrcweir { 908cdf0e10cSrcweir case presentation::ClickAction_NONE: return STR_CLICK_ACTION_NONE; 909cdf0e10cSrcweir case presentation::ClickAction_PREVPAGE: return STR_CLICK_ACTION_PREVPAGE; 910cdf0e10cSrcweir case presentation::ClickAction_NEXTPAGE: return STR_CLICK_ACTION_NEXTPAGE; 911cdf0e10cSrcweir case presentation::ClickAction_FIRSTPAGE: return STR_CLICK_ACTION_FIRSTPAGE; 912cdf0e10cSrcweir case presentation::ClickAction_LASTPAGE: return STR_CLICK_ACTION_LASTPAGE; 913cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK: return STR_CLICK_ACTION_BOOKMARK; 914cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT: return STR_CLICK_ACTION_DOCUMENT; 915cdf0e10cSrcweir case presentation::ClickAction_PROGRAM: return STR_CLICK_ACTION_PROGRAM; 916cdf0e10cSrcweir case presentation::ClickAction_MACRO: return STR_CLICK_ACTION_MACRO; 917cdf0e10cSrcweir case presentation::ClickAction_SOUND: return STR_CLICK_ACTION_SOUND; 918cdf0e10cSrcweir case presentation::ClickAction_VERB: return STR_CLICK_ACTION_VERB; 919cdf0e10cSrcweir case presentation::ClickAction_STOPPRESENTATION: return STR_CLICK_ACTION_STOPPRESENTATION; 920cdf0e10cSrcweir default: DBG_ERROR( "Keine StringResource fuer ClickAction vorhanden!" ); 921cdf0e10cSrcweir } 922cdf0e10cSrcweir return( 0 ); 923cdf0e10cSrcweir } 924cdf0e10cSrcweir 925