diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx index da0a7c7b2ae5..b2f5866a83c2 100644 --- a/xmloff/inc/txtfldi.hxx +++ b/xmloff/inc/txtfldi.hxx @@ -2,9 +2,9 @@ * * $RCSfile: txtfldi.hxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: dvo $ $Date: 2002-06-11 12:23:54 $ + * last change: $Author: dvo $ $Date: 2002-06-11 13:23:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -522,10 +522,14 @@ class XMLDatabaseFieldImportContext : public XMLTextFieldImportContext { const ::rtl::OUString sPropertyDatabaseName; const ::rtl::OUString sPropertyTableName; + const ::rtl::OUString sPropertyDataCommandType; ::rtl::OUString sDatabaseName; ::rtl::OUString sTableName; + sal_Int16 nCommandType; + sal_Bool bCommandTypeOK; + protected: sal_Bool bDatabaseOK; sal_Bool bTableOK; diff --git a/xmloff/inc/txtvfldi.hxx b/xmloff/inc/txtvfldi.hxx index dc21db29ddf4..94af28082f8c 100644 --- a/xmloff/inc/txtvfldi.hxx +++ b/xmloff/inc/txtvfldi.hxx @@ -2,9 +2,9 @@ * * $RCSfile: txtvfldi.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: dvo $ $Date: 2002-06-11 12:23:54 $ + * last change: $Author: dvo $ $Date: 2002-06-11 13:23:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -614,14 +614,11 @@ class XMLDatabaseDisplayImportContext : public XMLDatabaseFieldImportContext const ::rtl::OUString sPropertyColumnName; const ::rtl::OUString sPropertyDatabaseFormat; const ::rtl::OUString sPropertyCurrentPresentation; - const ::rtl::OUString sPropertyDataCommandType; XMLValueImportHelper aValueHelper; ::rtl::OUString sColumnName; - sal_Int16 nCommandType; sal_Bool bColumnOK; - sal_Bool bCommandTypeOK; public: diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 8f9a7c5316ca..0346fce09a8a 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtflde.cxx,v $ * - * $Revision: 1.43 $ + * $Revision: 1.44 $ * - * last change: $Author: dvo $ $Date: 2002-06-11 12:23:55 $ + * last change: $Author: dvo $ $Date: 2002-06-11 13:23:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1369,6 +1369,8 @@ void XMLTextFieldExport::ExportFieldHelper( GetStringProperty(sPropertyDataBaseName, rPropSet)); ProcessString(XML_TABLE_NAME, GetStringProperty(sPropertyDataTableName, rPropSet)); + ProcessCommandType( + GetInt16Property(sPropertyDataCommandType, rPropSet)); ExportElement(XML_DATABASE_NAME, sPresentation); break; @@ -1377,6 +1379,8 @@ void XMLTextFieldExport::ExportFieldHelper( GetStringProperty(sPropertyDataBaseName, rPropSet)); ProcessString(XML_TABLE_NAME, GetStringProperty(sPropertyDataTableName, rPropSet)); + ProcessCommandType( + GetInt16Property(sPropertyDataCommandType, rPropSet)); ProcessNumberingType( GetInt16Property(sPropertyNumberingType,rPropSet)); ProcessInteger(XML_VALUE, @@ -1389,6 +1393,8 @@ void XMLTextFieldExport::ExportFieldHelper( GetStringProperty(sPropertyDataBaseName, rPropSet)); ProcessString(XML_TABLE_NAME, GetStringProperty(sPropertyDataTableName, rPropSet)); + ProcessCommandType( + GetInt16Property(sPropertyDataCommandType, rPropSet)); ProcessString(XML_CONDITION, GetStringProperty(sPropertyCondition, rPropSet)); DBG_ASSERT(sPresentation.equals(sEmpty), @@ -1401,6 +1407,8 @@ void XMLTextFieldExport::ExportFieldHelper( GetStringProperty(sPropertyDataBaseName, rPropSet)); ProcessString(XML_TABLE_NAME, GetStringProperty(sPropertyDataTableName, rPropSet)); + ProcessCommandType( + GetInt16Property(sPropertyDataCommandType, rPropSet)); ProcessString(XML_CONDITION, GetStringProperty(sPropertyCondition, rPropSet)); ProcessInteger(XML_ROW_NUMBER, @@ -1418,10 +1426,10 @@ void XMLTextFieldExport::ExportFieldHelper( GetStringProperty(sPropertyDataBaseName, xMaster)); ProcessString(XML_TABLE_NAME, GetStringProperty(sPropertyDataTableName, xMaster)); - ProcessString(XML_COLUMN_NAME, - GetStringProperty(sPropertyDataColumnName, xMaster)); ProcessCommandType( GetInt16Property(sPropertyDataCommandType, xMaster)); + ProcessString(XML_COLUMN_NAME, + GetStringProperty(sPropertyDataColumnName, xMaster)); // export number format if available (happens only for numbers!) if (!GetBoolProperty(sPropertyIsDataBaseFormat, rPropSet)) { diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index 65aeb920fcf9..5e5369aab50e 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtfldi.cxx,v $ * - * $Revision: 1.40 $ + * $Revision: 1.41 $ * - * last change: $Author: dvo $ $Date: 2002-06-11 12:23:55 $ + * last change: $Author: dvo $ $Date: 2002-06-11 13:23:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -205,6 +205,10 @@ #include #endif +#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_ +#include +#endif + #ifndef _RTL_USTRING #include #endif @@ -347,6 +351,7 @@ const sal_Char sAPI_url_content[] = "URLContent"; const sal_Char sAPI_script_type[] = "ScriptType"; const sal_Char sAPI_is_hidden[] = "IsHidden"; const sal_Char sAPI_is_condition_true[] = "IsConditionTrue"; +const sal_Char sAPI_data_command_type[] = "DataCommandType"; const sal_Char sAPI_true[] = "TRUE"; @@ -1517,9 +1522,13 @@ XMLDatabaseFieldImportContext::XMLDatabaseFieldImportContext( sPropertyDatabaseName( RTL_CONSTASCII_USTRINGPARAM(sAPI_data_base_name)), sPropertyTableName(RTL_CONSTASCII_USTRINGPARAM(sAPI_data_table_name)), + sPropertyDataCommandType( + RTL_CONSTASCII_USTRINGPARAM(sAPI_data_command_type)), sDatabaseName(), sTableName(), + nCommandType( sdb::CommandType::TABLE ), bDatabaseOK(sal_False), + bCommandTypeOK(sal_False), bTableOK(sal_False) { } @@ -1537,6 +1546,23 @@ void XMLDatabaseFieldImportContext::ProcessAttribute( sTableName = sAttrValue; bTableOK = sal_True; break; + case XML_TOK_TEXTFIELD_COMMAND_TYPE: + if( IsXMLToken( sAttrValue, XML_TABLE ) ) + { + nCommandType = sdb::CommandType::TABLE; + bCommandTypeOK = sal_True; + } + else if( IsXMLToken( sAttrValue, XML_QUERY ) ) + { + nCommandType = sdb::CommandType::QUERY; + bCommandTypeOK = sal_True; + } + else if( IsXMLToken( sAttrValue, XML_COMMAND ) ) + { + nCommandType = sdb::CommandType::COMMAND; + bCommandTypeOK = sal_True; + } + break; } } @@ -1550,6 +1576,14 @@ void XMLDatabaseFieldImportContext::PrepareField( aAny <<= sDatabaseName; xPropertySet->setPropertyValue(sPropertyDatabaseName, aAny); + + // #99980# load/save command type for all fields; also load + // old documents without command type + if( bCommandTypeOK ) + { + aAny <<= nCommandType; + xPropertySet->setPropertyValue( sPropertyDataCommandType, aAny ); + } } diff --git a/xmloff/source/text/txtvfldi.cxx b/xmloff/source/text/txtvfldi.cxx index b500b00aad6d..5f30882a31f5 100644 --- a/xmloff/source/text/txtvfldi.cxx +++ b/xmloff/source/text/txtvfldi.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtvfldi.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: dvo $ $Date: 2002-06-11 12:23:55 $ + * last change: $Author: dvo $ $Date: 2002-06-11 13:23:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -136,10 +136,6 @@ #include #endif -#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_ -#include -#endif - #ifndef _RTL_USTRING #include #endif @@ -180,7 +176,7 @@ static const sal_Char sAPI_data_column_name[] = "DataColumnName"; static const sal_Char sAPI_is_data_base_format[] = "DataBaseFormat"; static const sal_Char sAPI_current_presentation[] = "CurrentPresentation"; static const sal_Char sAPI_sequence_value[] = "SequenceValue"; -static const sal_Char sAPI_data_command_type[] = "DataCommandType"; + using namespace ::rtl; using namespace ::com::sun::star; @@ -1156,17 +1152,13 @@ XMLDatabaseDisplayImportContext::XMLDatabaseDisplayImportContext( nPrfx, rLocalName), aValueHelper(rImport, rHlp, sal_False, sal_True, sal_False, sal_False), sColumnName(), - nCommandType( sdb::CommandType::TABLE ), bColumnOK(sal_False), - bCommandTypeOK(sal_False), sPropertyColumnName( RTL_CONSTASCII_USTRINGPARAM(sAPI_data_column_name)), sPropertyDatabaseFormat( RTL_CONSTASCII_USTRINGPARAM(sAPI_is_data_base_format)), sPropertyCurrentPresentation( - RTL_CONSTASCII_USTRINGPARAM(sAPI_current_presentation)), - sPropertyDataCommandType( - RTL_CONSTASCII_USTRINGPARAM(sAPI_data_command_type)) + RTL_CONSTASCII_USTRINGPARAM(sAPI_current_presentation)) { } @@ -1179,25 +1171,9 @@ void XMLDatabaseDisplayImportContext::ProcessAttribute( sColumnName = sAttrValue; bColumnOK = sal_True; break; - case XML_TOK_TEXTFIELD_COMMAND_TYPE: - if( IsXMLToken( sAttrValue, XML_TABLE ) ) - { - nCommandType = sdb::CommandType::TABLE; - bCommandTypeOK = sal_True; - } - else if( IsXMLToken( sAttrValue, XML_QUERY ) ) - { - nCommandType = sdb::CommandType::QUERY; - bCommandTypeOK = sal_True; - } - else if( IsXMLToken( sAttrValue, XML_COMMAND ) ) - { - nCommandType = sdb::CommandType::COMMAND; - bCommandTypeOK = sal_True; - } - break; case XML_TOK_TEXTFIELD_DATABASE_NAME: case XML_TOK_TEXTFIELD_TABLE_NAME: + case XML_TOK_TEXTFIELD_COMMAND_TYPE: // handled by super class XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken, sAttrValue); @@ -1233,13 +1209,6 @@ void XMLDatabaseDisplayImportContext::EndElement() aAny <<= sColumnName; xMaster->setPropertyValue(sPropertyColumnName, aAny); - // #99980# also read command type; must still read old files - if( bCommandTypeOK ) - { - aAny <<= nCommandType; - xMaster->setPropertyValue( sPropertyDataCommandType, aAny ); - } - // fieldmaster takes database, table and column name XMLDatabaseFieldImportContext::PrepareField(xMaster);