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