summaryrefslogtreecommitdiff
path: root/svx/source/xoutdev/xtablend.cxx
diff options
context:
space:
mode:
authorChristian Lippka <cl@openoffice.org>2001-02-23 20:37:19 +0000
committerChristian Lippka <cl@openoffice.org>2001-02-23 20:37:19 +0000
commitb45b0a810a6348b6f6d44c27c6d70a62615ce48c (patch)
treea598c3edd42e2eb1c5c43112223bc26e90351daa /svx/source/xoutdev/xtablend.cxx
parent136ac3a455f1c94d938379061161e080ab60b224 (diff)
#83556# added xml support for XPropertyTables
Diffstat (limited to 'svx/source/xoutdev/xtablend.cxx')
-rw-r--r--svx/source/xoutdev/xtablend.cxx70
1 files changed, 47 insertions, 23 deletions
diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx
index cdef7ad290b5..1580512f5cfd 100644
--- a/svx/source/xoutdev/xtablend.cxx
+++ b/svx/source/xoutdev/xtablend.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xtablend.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: ka $ $Date: 2001-02-19 17:20:45 $
+ * last change: $Author: cl $ $Date: 2001-02-23 21:37:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,7 +61,19 @@
// include ---------------------------------------------------------------
-#pragma hdrstop
+#ifndef SVX_LIGHT
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+#ifndef _SVX_XPROPERTYTABLE_HXX
+#include "XPropertyTable.hxx"
+#endif
+
+#include "xmlxtexp.hxx"
+#include "xmlxtimp.hxx"
+
+#endif
#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
@@ -125,11 +137,14 @@
#define GLOBALOVERFLOW
+using namespace com::sun::star;
+using namespace rtl;
+
sal_Unicode const pszExtLineEnd[] = {'s','o','e'};
-sal_Unicode const pszChckLineEnd[] = {'S','O','E','L'};
-// Neuer Key, damit alte Version (3.00) nicht bei dem
-// Versuch abstuerzt, eine neue Tabelle zu laden.
-sal_Unicode const pszChckLineEnd0[] = {'S','O','E','0'};
+
+static char const aChckLEnd[] = { 0x04, 0x00, 'S','O','E','L'}; // < 5.2
+static char const aChckLEnd0[] = { 0x04, 0x00, 'S','O','E','0'}; // = 5.2
+static char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0
// --------------------
// class XLineEndTable
@@ -400,26 +415,30 @@ BOOL XLineEndList::Load()
if( !aURL.getExtension().Len() )
aURL.setExtension( String( pszExtLineEnd, 3 ) );
- SfxMedium aMedium( aURL.GetMainURL(), STREAM_READ | STREAM_NOCREATE, TRUE );
- SvStream* pStream = aMedium.GetInStream();
- if( !pStream )
- return( FALSE );
-
- String aCheck;
+ {
+ SfxMedium aMedium( aURL.GetMainURL(), STREAM_READ | STREAM_NOCREATE, TRUE );
+ SvStream* pStream = aMedium.GetInStream();
+ if( !pStream )
+ return( FALSE );
- // UNICODE: *pStream >> aCheck;
- pStream->ReadByteString(aCheck);
+ char aCheck[6];
+ pStream->Read( aCheck, 6 );
- // Handelt es sich um die gew'unschte Tabelle?
- if( aCheck == String(pszChckLineEnd, 4) ||
- aCheck == String(pszChckLineEnd0, 4) )
- {
- ImpRead( *pStream );
+ // Handelt es sich um die gew'unschte Tabelle?
+ if( memcmp( aCheck, aChckLEnd, sizeof( aChckLEnd ) ) == 0 ||
+ memcmp( aCheck, aChckLEnd0, sizeof( aChckLEnd0 ) ) == 0 )
+ {
+ ImpRead( *pStream );
+ return( pStream->GetError() == SVSTREAM_OK );
+ }
+ else if( memcmp( aCheck, aChckXML, sizeof( aChckXML ) ) != 0 )
+ {
+ return FALSE;
+ }
}
- else
- return( FALSE );
- return( pStream->GetError() == SVSTREAM_OK );
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXLineEndTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableImport::load( aURL.GetMainURL(), xTable );
}
#endif
return( FALSE );
@@ -443,6 +462,10 @@ BOOL XLineEndList::Save()
if( !aURL.getExtension().Len() )
aURL.setExtension( String( pszExtLineEnd, 3 ) );
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXLineEndTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableExportComponent::save( aURL.GetMainURL(), xTable );
+
+/*
SfxMedium aMedium( aURL.GetMainURL(), STREAM_WRITE | STREAM_TRUNC, TRUE );
aMedium.IsRemote();
@@ -459,6 +482,7 @@ BOOL XLineEndList::Save()
aMedium.Commit();
return( aMedium.GetError() == 0 );
+*/
#else
return FALSE;
#endif