diff options
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/document.cxx | 27 | ||||
-rw-r--r-- | starmath/source/makefile.mk | 8 | ||||
-rw-r--r-- | starmath/source/symbol.cxx | 65 |
3 files changed, 38 insertions, 62 deletions
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 5b46217ccd97..0e926b26554b 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -2,9 +2,9 @@ * * $RCSfile: document.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: tl $ $Date: 2000-11-03 13:50:12 $ + * last change: $Author: jp $ $Date: 2000-11-08 14:49:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -104,6 +104,9 @@ #ifndef SVTOOLS_URIHELPER_HXX #include <svtools/urihelper.hxx> #endif +#ifndef _SVTOOLS_FSTATHELPER_HXX +#include <svtools/fstathelper.hxx> +#endif #ifndef _SFXDISPATCH_HXX //autogen #include <sfx2/dispatch.hxx> #endif @@ -261,23 +264,11 @@ void SmDocShell::SFX_NOTIFY(SfxBroadcaster&, const TypeId&, void SmDocShell::LoadSymbols() { SmModule *pp = SM_MOD1(); - String sURL(pp->GetConfig()->GetSymbolFile()); - BOOL bExist = FALSE; - INetURLObject aURLObj; - aURLObj.SetSmartProtocol( INET_PROT_FILE ); - aURLObj.SetSmartURL(sURL); - try - { - if(aURLObj.GetProtocol() == INET_PROT_FILE) - bExist = ::ucb::Content( aURLObj.GetMainURL(), - uno::Reference< XCommandEnvironment >()).isDocument(); - } - catch(...){} - if(!bExist) + String sURL( pp->GetConfig()->GetSymbolFile() ); + sURL = SFX_INIMANAGER()->SubstPathVars( sURL ); + if( !FStatHelper::IsDocument( sURL ) ) SFX_INIMANAGER()->SearchFile( sURL, SFX_KEY_USERCONFIG_PATH ); - - sURL = URIHelper::SmartRelToAbs(sURL); - pp->GetSymSetManager()->Load(sURL); + pp->GetSymSetManager()->Load( sURL ); } const String &SmDocShell::GetTitle() const diff --git a/starmath/source/makefile.mk b/starmath/source/makefile.mk index fed1043b88d0..a391729dd6de 100644 --- a/starmath/source/makefile.mk +++ b/starmath/source/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1.1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $ +# last change: $Author: jp $ $Date: 2000-11-08 14:49:23 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -116,10 +116,8 @@ SLOFILES = \ $(SLO)$/xchar.obj EXCEPTIONSFILES = \ - $(SLO)$/document.obj \ $(SLO)$/frmload.obj \ - $(SLO)$/symbol.obj \ - $(SLO)$/unomodel.obj + $(SLO)$/unomodel.obj LIB2TARGET = $(SLB)$/ysm.lib diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx index fb1f83950e37..342bce249bc1 100644 --- a/starmath/source/symbol.cxx +++ b/starmath/source/symbol.cxx @@ -2,9 +2,9 @@ * * $RCSfile: symbol.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: tl $ $Date: 2000-11-03 13:50:12 $ + * last change: $Author: jp $ $Date: 2000-11-08 14:49:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -413,15 +413,13 @@ void SmSymSetManager::FillHashTable() void SmSymSetManager::Init() { - SfxModule *p = SM_MOD1(); - SmModule *pp = (SmModule *) p; + SmModule *pp = SM_MOD1(); StartListening(*pp->GetConfig()); } void SmSymSetManager::Exit() { - SfxModule *p = SM_MOD1(); - SmModule *pp = (SmModule *) p; + SmModule *pp = SM_MOD1(); EndListening(*pp->GetConfig()); } @@ -537,9 +535,9 @@ SmSym *SmSymSetManager::GetSymbol(const String& rSymbolName) return p; } -void SmSymSetManager::Load(const String &rURL) +void SmSymSetManager::Load( const String &rURL ) { - if (aStreamName != rURL) + if( aStreamName != rURL ) { for (int i = 0; i< NoSymbolSets; i++) delete SymbolSets.Get(i); @@ -549,42 +547,32 @@ void SmSymSetManager::Load(const String &rURL) aStreamName = rURL; - BOOL bExist = FALSE; - try + // get stream to use + SfxMedium aMedium( aStreamName, + STREAM_READ | STREAM_SHARE_DENYWRITE, FALSE ); + aMedium.SetTransferPriority( SFX_TFPRIO_SYNCHRON ); + SvStream *pStream = aMedium.GetInStream(); + + if( pStream && !pStream->GetError() ) { - bExist = ::ucb::Content( aStreamName, uno::Reference< XCommandEnvironment >()).isDocument(); + *pStream >> *this; + Modified = FALSE; } - catch(...){} - if (bExist) + else { - // get stream to use - SfxMedium aMedium( aStreamName, - STREAM_READ | STREAM_SHARE_DENYWRITE, FALSE ); - aMedium.SetTransferPriority( SFX_TFPRIO_SYNCHRON ); - SvStream *pStream = aMedium.GetInStream(); + SmModule *pp = SM_MOD1(); - if (pStream) + if ( pp->GetConfig()->IsWarnNoSymbols() ) { - *pStream >> *this; + ErrorBox aErrorBox( NULL, SmResId( RID_READSYMBOLERROR ) ); + String aString( aErrorBox.GetMessText() ); + aString.SearchAndReplaceAscii( "%FILE%", aStreamName ); + aErrorBox.SetMessText( aString ); + aErrorBox.Execute(); + Modified = FALSE; - return; + pp->GetConfig()->SetWarnNoSymbols(FALSE); } - aMedium.Commit(); - } - - SfxModule *p = SM_MOD1(); - SmModule *pp = (SmModule *) p; - - if ( pp->GetConfig()->IsWarnNoSymbols() ) - { - ErrorBox aErrorBox( NULL, SmResId( RID_READSYMBOLERROR ) ); - String aString( aErrorBox.GetMessText() ); - aString.SearchAndReplaceAscii( "%FILE%", aStreamName ); - aErrorBox.SetMessText( aString ); - aErrorBox.Execute(); - - Modified = FALSE; - pp->GetConfig()->SetWarnNoSymbols(FALSE); } } } @@ -595,10 +583,9 @@ void SmSymSetManager::Save() { SfxMedium aMedium( aStreamName, STREAM_WRITE | STREAM_TRUNC | STREAM_SHARE_DENYALL, FALSE ); - aMedium.CreateTempFile(); // use temp file to write to... SvStream *pStream = aMedium.GetOutStream(); - if (pStream) + if( pStream && !pStream->GetError() ) { *pStream << *this; Modified = FALSE; |