-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "CAF_Tools.h"
#include "CAF_Application.h"
-#include <Basics_OCCTVersion.hxx>
-
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_Application.h>
#include <TDF_Delta.hxx>
#include <TDF_ListIteratorOfDeltaList.hxx>
-#include <TDocStd_Application.hxx>
-
+#include <TColStd_SequenceOfAsciiString.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx>
if ( res && app && !app->stdApp().IsNull() )
{
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
- TColStd_SequenceOfExtendedString formats;
- app->stdApp()->Formats( formats );
+ TColStd_SequenceOfAsciiString formats;
+ app->stdApp()->WritingFormats( formats );
+ if ( formats.IsEmpty() )
+ app->stdApp()->ReadingFormats( formats );
if ( !formats.IsEmpty() )
app->stdApp()->NewDocument( formats.First(), myStdDoc );
}
- catch ( Standard_Failure ) {
+ catch ( Standard_Failure& ) {
res = false;
}
}
bool status = false;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
-
-#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version
status = app->Open( CAF_Tools::toExtString( fname ), myStdDoc ) == PCDM_RS_OK;
-#else
- status = app->Open( CAF_Tools::toExtString( fname ), myStdDoc ) == CDF_RS_OK;
-#endif
}
- catch ( Standard_Failure ) {
+ catch ( Standard_Failure& ) {
status = false;
}
bool save = false;
if ( !stdDoc().IsNull() && stdDoc()->IsSaved() )
{
- QString path = QDir::convertSeparators( CAF_Tools::toQString( stdDoc()->GetPath() ) );
- save = path == QDir::convertSeparators( fname );
+ QString path = QDir::toNativeSeparators( CAF_Tools::toQString( stdDoc()->GetPath() ) );
+ save = path == QDir::toNativeSeparators( fname );
}
bool status = false;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
if ( save )
-#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version
status = app->Save( stdDoc() ) == PCDM_SS_OK;
-#else
- status = app->Save( stdDoc() ) == CDF_SS_OK;
-#endif
else
{
TCollection_ExtendedString format, path( CAF_Tools::toExtString( fname ) );
if ( format.Length() )
stdDoc()->ChangeStorageFormat( format );
-#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version
status = app->SaveAs( stdDoc(), path ) == PCDM_SS_OK;
-#else
- status = app->SaveAs( stdDoc(), path ) == CDF_SS_OK;
-#endif
}
}
- catch ( Standard_Failure ) {
+ catch ( Standard_Failure& ) {
status = false;
}
bool res = true;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
if ( myStdDoc->HasOpenCommand() )
myStdDoc->AbortCommand();
myStdDoc->OpenCommand();
}
- catch ( Standard_Failure ) {
+ catch ( Standard_Failure& ) {
res = false;
}
bool res = true;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
myStdDoc->AbortCommand();
update();
}
- catch ( Standard_Failure ) {
+ catch ( Standard_Failure& ) {
res = false;
}
return res;
bool res = true;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
myStdDoc->CommitCommand();
if ( canUndo() )
d->SetName( CAF_Tools::toExtString( name ) );
}
}
- catch ( Standard_Failure ) {
+ catch ( Standard_Failure& ) {
res = false;
}
return res;
return false;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
myStdDoc->Undo();
undoModified(); /* decrement modification counter */
}
- catch ( Standard_Failure ) {
+ catch ( Standard_Failure& ) {
SUIT_MessageBox::critical(application()->desktop(), tr( "ERR_ERROR" ),
tr( "ERR_DOC_UNDO" ));
return false;
return false;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
myStdDoc->Redo();
doModified(); /* increment modification counter */
}
- catch ( Standard_Failure ) {
+ catch ( Standard_Failure& ) {
SUIT_MessageBox::critical( application()->desktop(), tr( "ERR_ERROR" ),
tr( "ERR_DOC_REDO" ) );
return false;