summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/swerror.h12
-rw-r--r--sw/source/filter/xml/swxml.cxx81
-rw-r--r--sw/source/filter/xml/wrtxml.cxx130
-rw-r--r--sw/source/filter/xml/wrtxml.hxx8
-rw-r--r--sw/source/ui/app/error.src24
5 files changed, 187 insertions, 68 deletions
diff --git a/sw/inc/swerror.h b/sw/inc/swerror.h
index 3665609242fc..fbc872cb1489 100644
--- a/sw/inc/swerror.h
+++ b/sw/inc/swerror.h
@@ -2,9 +2,9 @@
*
* $RCSfile: swerror.h,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:14:28 $
+ * last change: $Author: mib $ $Date: 2001-05-07 05:57:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -95,12 +95,15 @@
#define ERR_SWG_NEW_VERSION (ERROR_SW_READ_BASE | 13)
#define ERR_WW8_NO_WW8_FILE_ERR (ERROR_SW_READ_BASE | 14)
+#define ERR_FORMAT_FILE_ROWCOL (ERROR_SW_READ_BASE | 15)
+
// Export Fehler
#define ERR_SWG_WRITE_ERROR (ERROR_SW_WRITE_BASE | 30 )
#define ERR_SWG_OLD_GLOSSARY (ERROR_SW_WRITE_BASE | 31 )
#define ERR_SWG_CANNOT_WRITE (ERROR_SW_WRITE_BASE | 32 )
#define ERR_W4W_READ_TMP_ERROR (ERROR_SW_WRITE_BASE | 33 )
#define ERR_SWG_LARGE_DOC_ERROR (ERROR_SW_WRITE_BASE | 34 )
+#define ERR_WRITE_ERROR_FILE (ERROR_SW_WRITE_BASE | 35 )
// Import/Export Fehler
#define ERR_SWG_INTERNAL_ERROR (ERROR_SW_BASE | 50 )
@@ -123,6 +126,7 @@
// Import - Warnings
#define WARN_SWG_NO_DRAWINGS (WARN_SW_READ_BASE | 70 )
#define WARN_WW6_FASTSAVE_ERR (WARN_SW_READ_BASE | 71 )
+// continued below
// Import & Export - Warnings
#define WARN_SWG_FEATURES_LOST (WARN_SW_BASE | 72 )
@@ -131,6 +135,10 @@
// Export warnings
#define WARN_SWG_HTML_NO_MACROS (WARN_SW_WRITE_BASE |75)
+#define WARN_WRITE_ERROR_FILE (WARN_SW_WRITE_BASE |76)
+
+// More Import - Warnings
+#define WARN_FORMAT_FILE_ROWCOL (WARN_SW_READ_BASE | 77)
#ifndef __RSC
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 4477d413d603..0959c038f1ee 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: swxml.cxx,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: dvo $ $Date: 2001-05-02 16:26:26 $
+ * last change: $Author: mib $ $Date: 2001-05-07 06:01:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -158,10 +158,12 @@ int XMLReader::GetReaderType()
sal_Int32 ReadThroughComponent(
Reference<io::XInputStream> xInputStream,
Reference<XComponent> xModelComponent,
+ const String& rStreamName,
Reference<lang::XMultiServiceFactory> & rFactory,
const sal_Char* pFilterName,
Sequence<Any> rFilterArguments,
const OUString& rName,
+ sal_Bool bMustBeSuccessfull,
// parameters for special modes
sal_Bool bBlockMode,
@@ -240,25 +242,49 @@ sal_Int32 ReadThroughComponent(
}
catch( xml::sax::SAXParseException& r )
{
+#ifdef DEBUG
+ ByteString aError( "SAX parse exception catched while importing:\n" );
+ aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
+ DBG_ERROR( aError.GetBuffer() );
+#endif
+
String sErr( String::CreateFromInt32( r.LineNumber ));
sErr += ',';
sErr += String::CreateFromInt32( r.ColumnNumber );
- return *new StringErrorInfo( ERR_FORMAT_ROWCOL, sErr,
- ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR );
+ if( rStreamName.Len() )
+ return *new TwoStringErrorInfo( ERR_FORMAT_FILE_ROWCOL, rStreamName, sErr,
+ ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR );
+ else
+ return *new StringErrorInfo( ERR_FORMAT_ROWCOL, sErr,
+ ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR );
}
-// catch( xml::sax::SAXParseException& r )
-// {
-// return ERR_SWG_READ_ERROR;
-// }
- catch( xml::sax::SAXException& )
+ catch( xml::sax::SAXException& r )
{
+#ifdef DEBUG
+ ByteString aError( "SAX exception catched while importing:\n" );
+ aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
+ DBG_ERROR( aError.GetBuffer() );
+#endif
return ERR_SWG_READ_ERROR;
}
- catch( io::IOException& )
+ catch( io::IOException& r )
{
+#ifdef DEBUG
+ ByteString aError( "IO exception catched while importing:\n" );
+ aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
+ DBG_ERROR( aError.GetBuffer() );
+#endif
return ERR_SWG_READ_ERROR;
}
+ catch( uno::Exception& r )
+ {
+#ifdef DEBUG
+ ByteString aError( "uno exception catched while importing:\n" );
+ aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
+ DBG_ERROR( aError.GetBuffer() );
+#endif
+ }
// success!
return 0;
@@ -274,6 +300,7 @@ sal_Int32 ReadThroughComponent(
const sal_Char* pFilterName,
Sequence<Any> rFilterArguments,
const OUString& rName,
+ sal_Bool bMustBeSuccessfull,
// parameters for special modes
sal_Bool bBlockMode,
@@ -312,8 +339,9 @@ sal_Int32 ReadThroughComponent(
// read from the stream
return ReadThroughComponent(
- xInputStream, xModelComponent, rFactory, pFilterName, rFilterArguments,
- rName, bBlockMode, rInsertTextRange, bFormatsOnly,
+ xInputStream, xModelComponent, sStreamName, rFactory,
+ pFilterName, rFilterArguments,
+ rName, bMustBeSuccessfull, bBlockMode, rInsertTextRange, bFormatsOnly,
nStyleFamilyMask, bMergeStyles, bOrganizerMode );
}
@@ -533,19 +561,21 @@ sal_uInt32 XMLReader::Read( SwDoc &rDoc, SwPaM &rPaM, const String & rName )
if ( NULL != pStorage )
{
+ sal_uInt32 nWarn = 0;
+ sal_uInt32 nWarn2 = 0;
// read storage streams
if( !IsOrganizerMode() )
- ReadThroughComponent(
+ nWarn = ReadThroughComponent(
pStorage, xModelComp, "meta.xml", "Meta.xml", xServiceFactory,
"com.sun.star.comp.Writer.XMLMetaImporter",
- aEmptyArgs, rName, IsBlockMode(), xInsertTextRange,
+ aEmptyArgs, rName, sal_False, IsBlockMode(), xInsertTextRange,
aOpt.IsFmtsOnly(), nStyleFamilyMask, !aOpt.IsMerge(),
sal_False );
- ReadThroughComponent(
+ nWarn2 = ReadThroughComponent(
pStorage, xModelComp, "settings.xml", NULL, xServiceFactory,
"com.sun.star.comp.Writer.XMLSettingsImporter",
- aFilterArgs, rName, IsBlockMode(), xInsertTextRange,
+ aFilterArgs, rName, sal_False, IsBlockMode(), xInsertTextRange,
aOpt.IsFmtsOnly(), nStyleFamilyMask, !aOpt.IsMerge(),
IsOrganizerMode() );
@@ -554,20 +584,27 @@ sal_uInt32 XMLReader::Read( SwDoc &rDoc, SwPaM &rPaM, const String & rName )
aAny.setValue( &bTmp, ::getBooleanCppuType() );
xInfoSet->setPropertyValue( sShowChanges, aAny );
- ReadThroughComponent(
+ nRet = ReadThroughComponent(
pStorage, xModelComp, "styles.xml", NULL, xServiceFactory,
"com.sun.star.comp.Writer.XMLStylesImporter",
- aFilterArgs, rName, IsBlockMode(), xInsertTextRange,
+ aFilterArgs, rName, sal_True, IsBlockMode(), xInsertTextRange,
aOpt.IsFmtsOnly(), nStyleFamilyMask, !aOpt.IsMerge(),
IsOrganizerMode() );
- if( !IsOrganizerMode() )
+ if( !nRet && !IsOrganizerMode() )
nRet = ReadThroughComponent(
pStorage, xModelComp, "content.xml", "Content.xml", xServiceFactory,
"com.sun.star.comp.Writer.XMLContentImporter",
- aFilterArgs, rName, IsBlockMode(), xInsertTextRange,
+ aFilterArgs, rName, sal_True, IsBlockMode(), xInsertTextRange,
aOpt.IsFmtsOnly(), nStyleFamilyMask, !aOpt.IsMerge(),
sal_False );
+ if( !nRet )
+ {
+ if( nWarn )
+ nRet = nWarn;
+ else if( nWarn2 )
+ nRet = nWarn2;
+ }
}
else
{
@@ -582,9 +619,9 @@ sal_uInt32 XMLReader::Read( SwDoc &rDoc, SwPaM &rPaM, const String & rName )
}
nRet = ReadThroughComponent(
- xInputStream, xModelComp, xServiceFactory,
+ xInputStream, xModelComp, aEmptyStr, xServiceFactory,
"com.sun.star.comp.Writer.XMLImporter",
- aFilterArgs, rName, IsBlockMode(), xInsertTextRange,
+ aFilterArgs, rName, sal_True, IsBlockMode(), xInsertTextRange,
aOpt.IsFmtsOnly(), nStyleFamilyMask, !aOpt.IsMerge(),
IsOrganizerMode() );
}
diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx
index 6c48258b7967..0276c658fdb9 100644
--- a/sw/source/filter/xml/wrtxml.cxx
+++ b/sw/source/filter/xml/wrtxml.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtxml.cxx,v $
*
- * $Revision: 1.27 $
+ * $Revision: 1.28 $
*
- * last change: $Author: dvo $ $Date: 2001-05-03 15:49:03 $
+ * last change: $Author: mib $ $Date: 2001-05-07 06:01:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -282,41 +282,73 @@ sal_uInt32 SwXMLWriter::_Write()
}
// export sub streams for package, else full stream into a file
+ sal_Bool bWarn = sal_False, bErr = sal_False;
+ String sWarnFile, sErrFile;
+
if (NULL != pStg)
{
if( !bOrganizerMode &&
SFX_CREATE_MODE_EMBEDDED != pDoc->GetDocShell()->GetCreateMode() )
- WriteThroughComponent(
- xModelComp, "meta.xml", xServiceFactory,
- "com.sun.star.comp.Writer.XMLMetaExporter",
- aEmptyArgs, aProps, sal_True );
-
- WriteThroughComponent(
- xModelComp, "styles.xml", xServiceFactory,
- "com.sun.star.comp.Writer.XMLStylesExporter",
- aFilterArgs, aProps, sal_False );
-
- WriteThroughComponent(
- xModelComp, "settings.xml", xServiceFactory,
- "com.sun.star.comp.Writer.XMLSettingsExporter",
- aFilterArgs, aProps, sal_False );
-
- if( !bOrganizerMode )
- WriteThroughComponent(
- xModelComp, "content.xml", xServiceFactory,
- "com.sun.star.comp.Writer.XMLContentExporter",
- aFilterArgs, aProps, sal_False );
+ {
+ if( !WriteThroughComponent(
+ xModelComp, "meta.xml", xServiceFactory,
+ "com.sun.star.comp.Writer.XMLMetaExporter",
+ aEmptyArgs, aProps, sal_True ) )
+ {
+ bWarn = sal_True;
+ sWarnFile = String( RTL_CONSTASCII_STRINGPARAM("meta.xml"),
+ RTL_TEXTENCODING_ASCII_US );
+ }
+ }
+
+ if( !WriteThroughComponent(
+ xModelComp, "styles.xml", xServiceFactory,
+ "com.sun.star.comp.Writer.XMLStylesExporter",
+ aFilterArgs, aProps, sal_False ) )
+ {
+ bErr = sal_True;
+ sErrFile = String( RTL_CONSTASCII_STRINGPARAM("styles.xml"),
+ RTL_TEXTENCODING_ASCII_US );
+ }
+ if( !bErr )
+ {
+ if( !WriteThroughComponent(
+ xModelComp, "settings.xml", xServiceFactory,
+ "com.sun.star.comp.Writer.XMLSettingsExporter",
+ aFilterArgs, aProps, sal_False ) )
+ {
+ if( !bWarn )
+ {
+ bWarn = sal_True;
+ sWarnFile = String( RTL_CONSTASCII_STRINGPARAM("settings.xml"),
+ RTL_TEXTENCODING_ASCII_US );
+ }
+ }
+ }
+
+ if( !bOrganizerMode && !bErr )
+ {
+ if( !WriteThroughComponent(
+ xModelComp, "content.xml", xServiceFactory,
+ "com.sun.star.comp.Writer.XMLContentExporter",
+ aFilterArgs, aProps, sal_False ) )
+ {
+ bErr = sal_True;
+ sErrFile = String( RTL_CONSTASCII_STRINGPARAM("content.xml"),
+ RTL_TEXTENCODING_ASCII_US );
+ }
+ }
}
else
{
// create single stream and do full export
Reference<io::XOutputStream> xOut =
new utl::OOutputStreamWrapper( *pStrm );
- WriteThroughComponent(
- xOut, xModelComp, xServiceFactory,
- "com.sun.star.comp.Writer.XMLExporter",
- aEmptyArgs, aProps );
+ bErr = !WriteThroughComponent(
+ xOut, xModelComp, xServiceFactory,
+ "com.sun.star.comp.Writer.XMLExporter",
+ aEmptyArgs, aProps );
}
if( pGraphicHelper )
@@ -332,8 +364,26 @@ sal_uInt32 SwXMLWriter::_Write()
xStatusIndicator->end();
}
+ if( bErr )
+ {
+ if( sErrFile.Len() )
+ return *new StringErrorInfo( ERR_WRITE_ERROR_FILE, sErrFile,
+ ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR );
+ else
+ return ERR_SWG_WRITE_ERROR;
+ }
+ else if( bWarn )
+ {
+ if( sWarnFile.Len() )
+ return *new StringErrorInfo( WARN_WRITE_ERROR_FILE, sWarnFile,
+ ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR );
+ else
+ return WARN_SWG_FEATURES_LOST;
+ }
+
return 0;
}
+
sal_uInt32 SwXMLWriter::WriteStream()
{
return _Write();
@@ -357,7 +407,7 @@ sal_Bool SwXMLWriter::IsStgWriter() const
return !bPlain;
}
-sal_uInt32 SwXMLWriter::WriteThroughComponent(
+sal_Bool SwXMLWriter::WriteThroughComponent(
const Reference<XComponent> & xComponent,
const sal_Char* pStreamName,
const Reference<lang::XMultiServiceFactory> & rFactory,
@@ -379,7 +429,7 @@ sal_uInt32 SwXMLWriter::WriteThroughComponent(
STREAM_WRITE | STREAM_SHARE_DENYWRITE );
DBG_ASSERT(xDocStream.Is(), "Can't create output stream in package!");
if (! xDocStream.Is())
- return ERR_SWG_WRITE_ERROR;
+ return sal_False;
xDocStream->SetSize( 0 );
@@ -396,6 +446,7 @@ sal_uInt32 SwXMLWriter::WriteThroughComponent(
aAny.setValue( &bFalse, ::getBooleanCppuType() );
xDocStream->SetProperty( aPropName, aAny );
}
+#if SUPD > 630
else
{
aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("Encrypted") );
@@ -403,6 +454,7 @@ sal_uInt32 SwXMLWriter::WriteThroughComponent(
aAny.setValue( &bTrue, ::getBooleanCppuType() );
xDocStream->SetProperty( aPropName, aAny );
}
+#endif
// set buffer and create outputstream
@@ -410,19 +462,19 @@ sal_uInt32 SwXMLWriter::WriteThroughComponent(
xOutputStream = new utl::OOutputStreamWrapper( *xDocStream );
// write the stuff
- sal_Int32 nRet = WriteThroughComponent(
+ sal_Bool bRet = WriteThroughComponent(
xOutputStream, xComponent, rFactory,
pServiceName, rArguments, rMediaDesc );
// finally, commit stream.
- if( 0 == nRet )
+ if( bRet )
xDocStream->Commit();
- return nRet;
+ return bRet;
}
-sal_uInt32 SwXMLWriter::WriteThroughComponent(
+sal_Bool SwXMLWriter::WriteThroughComponent(
const Reference<io::XOutputStream> & xOutputStream,
const Reference<XComponent> & xComponent,
const Reference<XMultiServiceFactory> & rFactory,
@@ -442,7 +494,7 @@ sal_uInt32 SwXMLWriter::WriteThroughComponent(
UNO_QUERY );
ASSERT( xSaxWriter.is(), "can't instantiate XML writer" );
if(!xSaxWriter.is())
- return ERR_SWG_WRITE_ERROR;
+ return sal_False;
// connect XML writer to output stream
xSaxWriter->setOutputStream( xOutputStream );
@@ -461,7 +513,7 @@ sal_uInt32 SwXMLWriter::WriteThroughComponent(
ASSERT( xExporter.is(),
"can't instantiate export filter component" );
if( !xExporter.is() )
- return ERR_SWG_WRITE_ERROR;
+ return sal_False;
// set block mode (if appropriate)
if( bBlock )
@@ -482,9 +534,7 @@ sal_uInt32 SwXMLWriter::WriteThroughComponent(
// filter!
Reference<XFilter> xFilter( xExporter, UNO_QUERY );
- xFilter->filter( rMediaDesc );
-
- return 0;
+ return xFilter->filter( rMediaDesc );
}
@@ -501,11 +551,15 @@ void GetXMLWriter( const String& rName, WriterRef& xRet )
Source Code Control System - Header
- $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/wrtxml.cxx,v 1.27 2001-05-03 15:49:03 dvo Exp $
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/wrtxml.cxx,v 1.28 2001-05-07 06:01:50 mib Exp $
Source Code Control System - Update
$Log: not supported by cvs2svn $
+ Revision 1.27 2001/05/03 15:49:03 dvo
+ - support for encrypting streams added
+ - turned functions into private methods
+
Revision 1.26 2001/04/30 14:13:15 mib
Don't export doc info in OLE objects
diff --git a/sw/source/filter/xml/wrtxml.hxx b/sw/source/filter/xml/wrtxml.hxx
index 1aeae5fde7d1..a86491076906 100644
--- a/sw/source/filter/xml/wrtxml.hxx
+++ b/sw/source/filter/xml/wrtxml.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtxml.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: dvo $ $Date: 2001-05-03 15:49:03 $
+ * last change: $Author: mib $ $Date: 2001-05-07 06:01:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -104,7 +104,7 @@ private:
// helper methods to write XML streams
/// write a single XML stream into the package
- sal_uInt32 WriteThroughComponent(
+ sal_Bool WriteThroughComponent(
/// the component we export
const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XComponent> & xComponent,
@@ -123,7 +123,7 @@ private:
/// write a single output stream
/// (to be called either directly or by WriteThroughComponent(...))
- sal_uInt32 WriteThroughComponent(
+ sal_Bool WriteThroughComponent(
const ::com::sun::star::uno::Reference<
::com::sun::star::io::XOutputStream> & xOutputStream,
const ::com::sun::star::uno::Reference<
diff --git a/sw/source/ui/app/error.src b/sw/source/ui/app/error.src
index 617fb109fa7e..519c4f5e36b3 100644
--- a/sw/source/ui/app/error.src
+++ b/sw/source/ui/app/error.src
@@ -2,9 +2,9 @@
*
* $RCSfile: error.src,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: kz $ $Date: 2001-05-04 20:33:18 $
+ * last change: $Author: mib $ $Date: 2001-05-07 06:00:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -540,6 +540,11 @@ Resource RID_SW_ERRHDL
TEXT[ arabic ] = " WinWord97";
TEXT[ catalan ] = "El archivo no es de WinWord97";
};
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_FORMAT_FILE_ROWCOL )
+ {
+ TEXT = "Formatfehler in Teildokument $(ARG1) an Position $(ARG2)(Zeile,Spalte) in der Datei entdeckt" ;
+ TEXT [ English ] = "File format error in sub-document $(ARG1) at $(ARG2)(row,col)" ;
+ };
// Export-Errors
String ERR_CODE ( ERRCODE_CLASS_WRITE , ERR_SWG_WRITE_ERROR )
{
@@ -670,6 +675,11 @@ Resource RID_SW_ERRHDL
Text[ language_user1 ] = " ";
Text[ catalan ] = "El documento sobrepasa el tamao posible 3.1/4.0 de documento";
};
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , ERR_WRITE_ERROR_FILE )
+ {
+ TEXT = "Fehler beim Schreiben des Teildokuments $(ARG1)" ;
+ TEXT [ English ] = "Error in writing sub-document $(ARG1)" ;
+ };
// Import-/Export-Errors
String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SWG_INTERNAL_ERROR )
{
@@ -1304,6 +1314,16 @@ Resource RID_SW_ERRHDL
Text[ language_user1 ] = " ";
Text[ catalan ] = "El documento HTML contiene macros %PRODUCTNAME Basic.\nNo se guardaron con la configuracin actual de exportacin.";
};
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , WARN_WRITE_ERROR_FILE )
+ {
+ TEXT = "Fehler beim Schreiben des Teildokuments $(ARG1)" ;
+ TEXT [ English ] = "Error in writing sub-document $(ARG1)" ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , WARN_FORMAT_FILE_ROWCOL )
+ {
+ TEXT = "Formatfehler in Teildokument $(ARG1) an Position $(ARG2)(Zeile,Spalte) in der Datei entdeckt" ;
+ TEXT [ English ] = "File format error in sub-document $(ARG1) at $(ARG2)(row,col)" ;
+ };
};