diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2006-08-01 08:21:06 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2006-08-01 08:21:06 +0000 |
commit | e704ca5b03b85951b5cd82f26ff425d3acabd41a (patch) | |
tree | 006cbc6ecebf685a661c68e69126d8d89e5f26e4 /sd/source/ui/dlg/tpaction.cxx | |
parent | 9ba93f6a056273765c01e4d33d8ae9101437657d (diff) |
INTEGRATION: CWS impress99 (1.35.8); FILE MERGED
2006/07/21 11:53:46 cl 1.35.8.1: #138051# added some null pointer checks
Diffstat (limited to 'sd/source/ui/dlg/tpaction.cxx')
-rw-r--r-- | sd/source/ui/dlg/tpaction.cxx | 64 |
1 files changed, 40 insertions, 24 deletions
diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx index 788de0b21c0f..eefa09805b5f 100644 --- a/sd/source/ui/dlg/tpaction.cxx +++ b/sd/source/ui/dlg/tpaction.cxx @@ -4,9 +4,9 @@ * * $RCSfile: tpaction.cxx,v $ * - * $Revision: 1.36 $ + * $Revision: 1.37 $ * - * last change: $Author: rt $ $Date: 2006-07-25 11:31:09 $ + * last change: $Author: ihi $ $Date: 2006-08-01 09:21:06 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -266,16 +266,22 @@ void SdTPAction::SetView( const ::sd::View* pSdView ) pView = pSdView; // Holen der ColorTable und Fuellen der ListBox - ::sd::DrawDocShell* pDocSh = - static_cast<const ::sd::View*>(pView)->GetDocSh(); - pDoc = pDocSh->GetDoc(); - SfxViewFrame* pFrame = pDocSh->GetViewShell()->GetViewFrame(); - aLbTree.SetViewFrame( pFrame ); - aLbTreeDocument.SetViewFrame( pFrame ); - - SvxColorTableItem aItem( *(const SvxColorTableItem*)( pDocSh->GetItem( SID_COLOR_TABLE ) ) ); - pColTab = aItem.GetColorTable(); - DBG_ASSERT( pColTab, "Keine Farbtabelle vorhanden!" ); + ::sd::DrawDocShell* pDocSh = static_cast<const ::sd::View*>(pView)->GetDocSh(); + if( pDocSh && pDocSh->GetViewShell() ) + { + pDoc = pDocSh->GetDoc(); + SfxViewFrame* pFrame = pDocSh->GetViewShell()->GetViewFrame(); + aLbTree.SetViewFrame( pFrame ); + aLbTreeDocument.SetViewFrame( pFrame ); + + SvxColorTableItem aItem( *(const SvxColorTableItem*)( pDocSh->GetItem( SID_COLOR_TABLE ) ) ); + pColTab = aItem.GetColorTable(); + DBG_ASSERT( pColTab, "Keine Farbtabelle vorhanden!" ); + } + else + { + DBG_ERROR("sd::SdTPAction::SetView(), no docshell or viewshell?"); + } } // ----------------------------------------------------------------------- @@ -400,16 +406,23 @@ BOOL SdTPAction::FillItemSet( SfxItemSet& rAttrs ) rAttrs.InvalidateItem( ATTR_ACTION_FILENAME ); else { - String aBaseURL = pDoc->GetDocSh()->GetMedium()->GetBaseURL(); - if( eCA == presentation::ClickAction_SOUND || - eCA == presentation::ClickAction_DOCUMENT || - eCA == presentation::ClickAction_PROGRAM ) - aFileName = ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), aFileName, URIHelper::GetMaybeFileHdl(), true, false, - INetURLObject::WAS_ENCODED, - INetURLObject::DECODE_UNAMBIGUOUS ); - - rAttrs.Put( SfxStringItem( ATTR_ACTION_FILENAME, aFileName ) ); - bModified = TRUE; + if( pDoc && pDoc->GetDocSh() && pDoc->GetDocSh()->GetMedium() ) + { + String aBaseURL = pDoc->GetDocSh()->GetMedium()->GetBaseURL(); + if( eCA == presentation::ClickAction_SOUND || + eCA == presentation::ClickAction_DOCUMENT || + eCA == presentation::ClickAction_PROGRAM ) + aFileName = ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), aFileName, URIHelper::GetMaybeFileHdl(), true, false, + INetURLObject::WAS_ENCODED, + INetURLObject::DECODE_UNAMBIGUOUS ); + + rAttrs.Put( SfxStringItem( ATTR_ACTION_FILENAME, aFileName ) ); + bModified = TRUE; + } + else + { + DBG_ERROR("sd::SdTPAction::FillItemSet(), I need a medium!"); + } } return( bModified ); @@ -499,7 +512,7 @@ USHORT* SdTPAction::GetRanges() void SdTPAction::UpdateTree() { - if( !bTreeUpdated ) + if( !bTreeUpdated && pDoc && pDoc->GetDocSh() && pDoc->GetDocSh()->GetMedium() ) { //aLbTree.Clear(); aLbTree.Fill( pDoc, TRUE, pDoc->GetDocSh()->GetMedium()->GetName() ); @@ -976,7 +989,10 @@ String SdTPAction::GetEditText( BOOL bFullDocDestination ) // validate file URI INetURLObject aURL( aStr ); - String aBaseURL = pDoc->GetDocSh()->GetMedium()->GetBaseURL(); + String aBaseURL; + if( pDoc && pDoc->GetDocSh() && pDoc->GetDocSh()->GetMedium() ) + aBaseURL = pDoc->GetDocSh()->GetMedium()->GetBaseURL(); + if( aStr.Len() && aURL.GetProtocol() == INET_PROT_NOT_VALID ) aURL = INetURLObject( ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), aStr, URIHelper::GetMaybeFileHdl(), true, false ) ); |