#99980# load/save data command type for all database fields

This commit is contained in:
Daniel Vogelheim 2002-06-11 12:23:40 +00:00
parent 94c1c97b46
commit 3aa1ca0735
5 changed files with 61 additions and 49 deletions

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: txtfldi.hxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -522,10 +522,14 @@ class XMLDatabaseFieldImportContext : public XMLTextFieldImportContext
{ {
const ::rtl::OUString sPropertyDatabaseName; const ::rtl::OUString sPropertyDatabaseName;
const ::rtl::OUString sPropertyTableName; const ::rtl::OUString sPropertyTableName;
const ::rtl::OUString sPropertyDataCommandType;
::rtl::OUString sDatabaseName; ::rtl::OUString sDatabaseName;
::rtl::OUString sTableName; ::rtl::OUString sTableName;
sal_Int16 nCommandType;
sal_Bool bCommandTypeOK;
protected: protected:
sal_Bool bDatabaseOK; sal_Bool bDatabaseOK;
sal_Bool bTableOK; sal_Bool bTableOK;

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: txtvfldi.hxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -614,14 +614,11 @@ class XMLDatabaseDisplayImportContext : public XMLDatabaseFieldImportContext
const ::rtl::OUString sPropertyColumnName; const ::rtl::OUString sPropertyColumnName;
const ::rtl::OUString sPropertyDatabaseFormat; const ::rtl::OUString sPropertyDatabaseFormat;
const ::rtl::OUString sPropertyCurrentPresentation; const ::rtl::OUString sPropertyCurrentPresentation;
const ::rtl::OUString sPropertyDataCommandType;
XMLValueImportHelper aValueHelper; XMLValueImportHelper aValueHelper;
::rtl::OUString sColumnName; ::rtl::OUString sColumnName;
sal_Int16 nCommandType;
sal_Bool bColumnOK; sal_Bool bColumnOK;
sal_Bool bCommandTypeOK;
public: public:

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: txtflde.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -1369,6 +1369,8 @@ void XMLTextFieldExport::ExportFieldHelper(
GetStringProperty(sPropertyDataBaseName, rPropSet)); GetStringProperty(sPropertyDataBaseName, rPropSet));
ProcessString(XML_TABLE_NAME, ProcessString(XML_TABLE_NAME,
GetStringProperty(sPropertyDataTableName, rPropSet)); GetStringProperty(sPropertyDataTableName, rPropSet));
ProcessCommandType(
GetInt16Property(sPropertyDataCommandType, rPropSet));
ExportElement(XML_DATABASE_NAME, sPresentation); ExportElement(XML_DATABASE_NAME, sPresentation);
break; break;
@ -1377,6 +1379,8 @@ void XMLTextFieldExport::ExportFieldHelper(
GetStringProperty(sPropertyDataBaseName, rPropSet)); GetStringProperty(sPropertyDataBaseName, rPropSet));
ProcessString(XML_TABLE_NAME, ProcessString(XML_TABLE_NAME,
GetStringProperty(sPropertyDataTableName, rPropSet)); GetStringProperty(sPropertyDataTableName, rPropSet));
ProcessCommandType(
GetInt16Property(sPropertyDataCommandType, rPropSet));
ProcessNumberingType( ProcessNumberingType(
GetInt16Property(sPropertyNumberingType,rPropSet)); GetInt16Property(sPropertyNumberingType,rPropSet));
ProcessInteger(XML_VALUE, ProcessInteger(XML_VALUE,
@ -1389,6 +1393,8 @@ void XMLTextFieldExport::ExportFieldHelper(
GetStringProperty(sPropertyDataBaseName, rPropSet)); GetStringProperty(sPropertyDataBaseName, rPropSet));
ProcessString(XML_TABLE_NAME, ProcessString(XML_TABLE_NAME,
GetStringProperty(sPropertyDataTableName, rPropSet)); GetStringProperty(sPropertyDataTableName, rPropSet));
ProcessCommandType(
GetInt16Property(sPropertyDataCommandType, rPropSet));
ProcessString(XML_CONDITION, ProcessString(XML_CONDITION,
GetStringProperty(sPropertyCondition, rPropSet)); GetStringProperty(sPropertyCondition, rPropSet));
DBG_ASSERT(sPresentation.equals(sEmpty), DBG_ASSERT(sPresentation.equals(sEmpty),
@ -1401,6 +1407,8 @@ void XMLTextFieldExport::ExportFieldHelper(
GetStringProperty(sPropertyDataBaseName, rPropSet)); GetStringProperty(sPropertyDataBaseName, rPropSet));
ProcessString(XML_TABLE_NAME, ProcessString(XML_TABLE_NAME,
GetStringProperty(sPropertyDataTableName, rPropSet)); GetStringProperty(sPropertyDataTableName, rPropSet));
ProcessCommandType(
GetInt16Property(sPropertyDataCommandType, rPropSet));
ProcessString(XML_CONDITION, ProcessString(XML_CONDITION,
GetStringProperty(sPropertyCondition, rPropSet)); GetStringProperty(sPropertyCondition, rPropSet));
ProcessInteger(XML_ROW_NUMBER, ProcessInteger(XML_ROW_NUMBER,
@ -1418,10 +1426,10 @@ void XMLTextFieldExport::ExportFieldHelper(
GetStringProperty(sPropertyDataBaseName, xMaster)); GetStringProperty(sPropertyDataBaseName, xMaster));
ProcessString(XML_TABLE_NAME, ProcessString(XML_TABLE_NAME,
GetStringProperty(sPropertyDataTableName, xMaster)); GetStringProperty(sPropertyDataTableName, xMaster));
ProcessString(XML_COLUMN_NAME,
GetStringProperty(sPropertyDataColumnName, xMaster));
ProcessCommandType( ProcessCommandType(
GetInt16Property(sPropertyDataCommandType, xMaster)); GetInt16Property(sPropertyDataCommandType, xMaster));
ProcessString(XML_COLUMN_NAME,
GetStringProperty(sPropertyDataColumnName, xMaster));
// export number format if available (happens only for numbers!) // export number format if available (happens only for numbers!)
if (!GetBoolProperty(sPropertyIsDataBaseFormat, rPropSet)) if (!GetBoolProperty(sPropertyIsDataBaseFormat, rPropSet))
{ {

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: txtfldi.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -205,6 +205,10 @@
#include <com/sun/star/util/XUpdatable.hpp> #include <com/sun/star/util/XUpdatable.hpp>
#endif #endif
#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
#include <com/sun/star/sdb/CommandType.hpp>
#endif
#ifndef _RTL_USTRING #ifndef _RTL_USTRING
#include <rtl/ustring> #include <rtl/ustring>
#endif #endif
@ -347,6 +351,7 @@ const sal_Char sAPI_url_content[] = "URLContent";
const sal_Char sAPI_script_type[] = "ScriptType"; const sal_Char sAPI_script_type[] = "ScriptType";
const sal_Char sAPI_is_hidden[] = "IsHidden"; const sal_Char sAPI_is_hidden[] = "IsHidden";
const sal_Char sAPI_is_condition_true[] = "IsConditionTrue"; const sal_Char sAPI_is_condition_true[] = "IsConditionTrue";
const sal_Char sAPI_data_command_type[] = "DataCommandType";
const sal_Char sAPI_true[] = "TRUE"; const sal_Char sAPI_true[] = "TRUE";
@ -1517,9 +1522,13 @@ XMLDatabaseFieldImportContext::XMLDatabaseFieldImportContext(
sPropertyDatabaseName( sPropertyDatabaseName(
RTL_CONSTASCII_USTRINGPARAM(sAPI_data_base_name)), RTL_CONSTASCII_USTRINGPARAM(sAPI_data_base_name)),
sPropertyTableName(RTL_CONSTASCII_USTRINGPARAM(sAPI_data_table_name)), sPropertyTableName(RTL_CONSTASCII_USTRINGPARAM(sAPI_data_table_name)),
sPropertyDataCommandType(
RTL_CONSTASCII_USTRINGPARAM(sAPI_data_command_type)),
sDatabaseName(), sDatabaseName(),
sTableName(), sTableName(),
nCommandType( sdb::CommandType::TABLE ),
bDatabaseOK(sal_False), bDatabaseOK(sal_False),
bCommandTypeOK(sal_False),
bTableOK(sal_False) bTableOK(sal_False)
{ {
} }
@ -1537,6 +1546,23 @@ void XMLDatabaseFieldImportContext::ProcessAttribute(
sTableName = sAttrValue; sTableName = sAttrValue;
bTableOK = sal_True; bTableOK = sal_True;
break; 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; aAny <<= sDatabaseName;
xPropertySet->setPropertyValue(sPropertyDatabaseName, aAny); 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 );
}
} }

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: txtvfldi.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -136,10 +136,6 @@
#include <com/sun/star/xml/sax/XAttributeList.hpp> #include <com/sun/star/xml/sax/XAttributeList.hpp>
#endif #endif
#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
#include <com/sun/star/sdb/CommandType.hpp>
#endif
#ifndef _RTL_USTRING #ifndef _RTL_USTRING
#include <rtl/ustring> #include <rtl/ustring>
#endif #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_is_data_base_format[] = "DataBaseFormat";
static const sal_Char sAPI_current_presentation[] = "CurrentPresentation"; static const sal_Char sAPI_current_presentation[] = "CurrentPresentation";
static const sal_Char sAPI_sequence_value[] = "SequenceValue"; static const sal_Char sAPI_sequence_value[] = "SequenceValue";
static const sal_Char sAPI_data_command_type[] = "DataCommandType";
using namespace ::rtl; using namespace ::rtl;
using namespace ::com::sun::star; using namespace ::com::sun::star;
@ -1156,17 +1152,13 @@ XMLDatabaseDisplayImportContext::XMLDatabaseDisplayImportContext(
nPrfx, rLocalName), nPrfx, rLocalName),
aValueHelper(rImport, rHlp, sal_False, sal_True, sal_False, sal_False), aValueHelper(rImport, rHlp, sal_False, sal_True, sal_False, sal_False),
sColumnName(), sColumnName(),
nCommandType( sdb::CommandType::TABLE ),
bColumnOK(sal_False), bColumnOK(sal_False),
bCommandTypeOK(sal_False),
sPropertyColumnName( sPropertyColumnName(
RTL_CONSTASCII_USTRINGPARAM(sAPI_data_column_name)), RTL_CONSTASCII_USTRINGPARAM(sAPI_data_column_name)),
sPropertyDatabaseFormat( sPropertyDatabaseFormat(
RTL_CONSTASCII_USTRINGPARAM(sAPI_is_data_base_format)), RTL_CONSTASCII_USTRINGPARAM(sAPI_is_data_base_format)),
sPropertyCurrentPresentation( sPropertyCurrentPresentation(
RTL_CONSTASCII_USTRINGPARAM(sAPI_current_presentation)), RTL_CONSTASCII_USTRINGPARAM(sAPI_current_presentation))
sPropertyDataCommandType(
RTL_CONSTASCII_USTRINGPARAM(sAPI_data_command_type))
{ {
} }
@ -1179,25 +1171,9 @@ void XMLDatabaseDisplayImportContext::ProcessAttribute(
sColumnName = sAttrValue; sColumnName = sAttrValue;
bColumnOK = sal_True; bColumnOK = sal_True;
break; 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_DATABASE_NAME:
case XML_TOK_TEXTFIELD_TABLE_NAME: case XML_TOK_TEXTFIELD_TABLE_NAME:
case XML_TOK_TEXTFIELD_COMMAND_TYPE:
// handled by super class // handled by super class
XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken, XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken,
sAttrValue); sAttrValue);
@ -1233,13 +1209,6 @@ void XMLDatabaseDisplayImportContext::EndElement()
aAny <<= sColumnName; aAny <<= sColumnName;
xMaster->setPropertyValue(sPropertyColumnName, aAny); 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 // fieldmaster takes database, table and column name
XMLDatabaseFieldImportContext::PrepareField(xMaster); XMLDatabaseFieldImportContext::PrepareField(xMaster);