diff options
author | Daniel Vogelheim <dvo@openoffice.org> | 2001-10-25 11:37:12 +0000 |
---|---|---|
committer | Daniel Vogelheim <dvo@openoffice.org> | 2001-10-25 11:37:12 +0000 |
commit | 8dea1b9e0e01ce78a5c761559608b196616237d0 (patch) | |
tree | 75779e6b63666c538ba5e7e035f8b22be8ff407e | |
parent | 77ab6c56b222123b3dd7fe6a043529c3d09b362e (diff) |
#93291# TableCalc field implemented
-rw-r--r-- | xmloff/inc/txtflde.hxx | 6 | ||||
-rw-r--r-- | xmloff/inc/txtvfldi.hxx | 47 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/text/txtflde.cxx | 28 | ||||
-rw-r--r-- | xmloff/source/text/txtfldi.cxx | 9 | ||||
-rw-r--r-- | xmloff/source/text/txtimp.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/text/txtvfldi.cxx | 73 |
7 files changed, 159 insertions, 15 deletions
diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx index f9739e360474..5828a48a8a17 100644 --- a/xmloff/inc/txtflde.hxx +++ b/xmloff/inc/txtflde.hxx @@ -2,9 +2,9 @@ * * $RCSfile: txtflde.hxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: dvo $ $Date: 2001-08-02 18:51:32 $ + * last change: $Author: dvo $ $Date: 2001-10-25 12:37:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -190,6 +190,8 @@ enum FieldIdEnum { FIELD_ID_MEASURE, // for measure shapes + FIELD_ID_TABLE_FORMULA, // DEPRECATED: table formulas (Writer 2.0) + FIELD_ID_UNKNOWN // invalid or unknown field type! }; diff --git a/xmloff/inc/txtvfldi.hxx b/xmloff/inc/txtvfldi.hxx index def0ef72a486..5bdc609bf0fc 100644 --- a/xmloff/inc/txtvfldi.hxx +++ b/xmloff/inc/txtvfldi.hxx @@ -2,9 +2,9 @@ * * $RCSfile: txtvfldi.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dvo $ $Date: 2001-06-29 21:07:26 $ + * last change: $Author: dvo $ $Date: 2001-10-25 12:37:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -557,7 +557,7 @@ public: ::com::sun::star::xml::sax::XAttributeList> & xAttrList, enum VarType eVarType); /// variable type - /// get field master for name and rename if appropriate [TODO: rename] + /// get field master for name and rename if appropriate static sal_Bool FindFieldMaster(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> & xMaster, SvXMLImport& rImport, @@ -567,6 +567,47 @@ public: }; + +/** import table formula fields (deprecated; for Writer 2.0 compatibility) */ +class XMLTableFormulaImportContext : public XMLTextFieldImportContext +{ + const ::rtl::OUString sPropertyNumberFormat; + const ::rtl::OUString sPropertyContent; + const ::rtl::OUString sPropertyIsShowFormula; + const ::rtl::OUString sPropertyCurrentPresentation; + + XMLValueImportHelper aValueHelper; + + ::rtl::OUString sFormula; + sal_Bool bFormulaOK; + + sal_Bool bIsShowFormula; + +public: + + TYPEINFO(); + + XMLTableFormulaImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp, /// text import helper + sal_uInt16 nPrfx, /// namespace prefix + const ::rtl::OUString& rLocalName); /// element name w/o prefix + virtual ~XMLTableFormulaImportContext(); + +protected: + + /// process attribute values + virtual void ProcessAttribute( sal_uInt16 nAttrToken, + const ::rtl::OUString& sAttrValue ); + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & xPropertySet); +}; + + + /** import database display fields (<text:database-display>) */ class XMLDatabaseDisplayImportContext : public XMLDatabaseFieldImportContext { diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 2862f6e7569f..f0ca02c13b17 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmltoken.cxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.24 $ * - * last change: $Author: bm $ $Date: 2001-10-23 09:59:47 $ + * last change: $Author: dvo $ $Date: 2001-10-25 12:37:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2077,6 +2077,8 @@ namespace xmloff { namespace token { TOKEN( "column-mapping" ), // XML_COLUMN_MAPPING TOKEN( "row-mapping" ), // XML_ROW_MAPPING + TOKEN( "table-formula" ), // XML_TABLE_FORMULA + { 0, NULL, NULL } // XML_TOKEN_END }; diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 823abf44b631..f120de0f758f 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtflde.cxx,v $ * - * $Revision: 1.35 $ + * $Revision: 1.36 $ * - * last change: $Author: dvo $ $Date: 2001-09-24 13:40:55 $ + * last change: $Author: dvo $ $Date: 2001-10-25 12:37:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -288,6 +288,7 @@ static sal_Char __READONLY_DATA FIELD_SERVICE_SCRIPT[] = "Script"; static sal_Char __READONLY_DATA FIELD_SERVICE_ANNOTATION[] = "Annotation"; static sal_Char __READONLY_DATA FIELD_SERVICE_COMBINED_CHARACTERS[] = "CombinedCharacters"; static sal_Char __READONLY_DATA FIELD_SERVICE_MEASURE[] = "Measure"; +static sal_Char __READONLY_DATA FIELD_SERVICE_TABLE_FORMULA[] = "TableFormula"; SvXMLEnumStringMapEntry __READONLY_DATA aFieldServiceNameMapping[] = @@ -362,6 +363,8 @@ SvXMLEnumStringMapEntry __READONLY_DATA aFieldServiceNameMapping[] = ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_URL, FIELD_ID_URL ), ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_MEASURE, FIELD_ID_MEASURE ), + // deprecated fields + ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_TABLE_FORMULA, FIELD_ID_TABLE_FORMULA ), ENUM_STRING_MAP_END() }; @@ -702,6 +705,7 @@ enum FieldIdEnum XMLTextFieldExport::MapFieldName( case FIELD_ID_SHEET_NAME: case FIELD_ID_MEASURE: case FIELD_ID_URL: + case FIELD_ID_TABLE_FORMULA: ; // these field IDs are final break; @@ -745,6 +749,12 @@ sal_Bool XMLTextFieldExport::IsStringField( return 5100 == GetIntProperty(sPropertyNumberFormat, xPropSet); break; + case FIELD_ID_TABLE_FORMULA: + // legacy field: always a number field (because it always has + // a number format) + return sal_False; + break; + case FIELD_ID_COUNT_PAGES: case FIELD_ID_COUNT_PARAGRAPHS: case FIELD_ID_COUNT_WORDS: @@ -918,6 +928,7 @@ void XMLTextFieldExport::ExportFieldAutoStyle( case FIELD_ID_VARIABLE_INPUT: case FIELD_ID_USER_GET: case FIELD_ID_EXPRESSION: + case FIELD_ID_TABLE_FORMULA: // register number format, if this is a numeric field if (! IsStringField(nToken, xPropSet)) { @@ -1704,6 +1715,19 @@ void XMLTextFieldExport::ExportFieldHelper( break; } + case FIELD_ID_TABLE_FORMULA: + ProcessString( XML_FORMULA, + GetStringProperty(sPropertyContent, rPropSet) ); + ProcessDisplay( sal_True, + GetBoolProperty(sPropertyIsShowFormula, rPropSet), + sal_True ); + ProcessValueAndType( sal_False, + GetIntProperty(sPropertyNumberFormat, rPropSet), + sEmpty, sEmpty, + 0.0f, sal_False, sal_False, sal_True, sal_False ); + ExportElement( XML_TABLE_FORMULA, sPresentation ); + break; + case FIELD_ID_UNKNOWN: default: DBG_ERROR("unkown field type encountered!"); diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index 4b96bdeec036..72480ca37505 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtfldi.cxx,v $ * - * $Revision: 1.34 $ + * $Revision: 1.35 $ * - * last change: $Author: thb $ $Date: 2001-09-20 07:59:20 $ + * last change: $Author: dvo $ $Date: 2001-10-25 12:37:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -799,6 +799,11 @@ XMLTextFieldImportContext::CreateTextFieldImportContext( nPrefix, rName ); break; + case XML_TOK_TEXT_TABLE_FORMULA: + pContext = new XMLTableFormulaImportContext( rImport, rHlp, + nPrefix, rName ); + break; + default: // ignore! May not even be a textfield. // (Reminder: This method is called inside default:-branch) diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 34c61e73c9b1..66664afedc67 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtimp.cxx,v $ * - * $Revision: 1.87 $ + * $Revision: 1.88 $ * - * last change: $Author: mib $ $Date: 2001-10-22 09:42:52 $ + * last change: $Author: dvo $ $Date: 2001-10-25 12:37:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -432,6 +432,7 @@ static __FAR_DATA SvXMLTokenMapEntry aTextPElemTokenMap[] = XML_TOK_TEXT_BIBLIOGRAPHY_MARK }, { XML_NAMESPACE_OFFICE, XML_ANNOTATION, XML_TOK_TEXT_ANNOTATION }, { XML_NAMESPACE_TEXT, XML_SCRIPT, XML_TOK_TEXT_SCRIPT }, + { XML_NAMESPACE_TEXT, XML_TABLE_FORMULA, XML_TOK_TEXT_TABLE_FORMULA }, // Calc fields { XML_NAMESPACE_TEXT, XML_SHEET_NAME, XML_TOK_TEXT_SHEET_NAME }, diff --git a/xmloff/source/text/txtvfldi.cxx b/xmloff/source/text/txtvfldi.cxx index e8566ed79146..30200f9ffca8 100644 --- a/xmloff/source/text/txtvfldi.cxx +++ b/xmloff/source/text/txtvfldi.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtvfldi.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: dvo $ $Date: 2001-10-17 10:28:43 $ + * last change: $Author: dvo $ $Date: 2001-10-25 12:37:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -153,6 +153,7 @@ static const sal_Char sAPI_input_user[] = "InputUser"; static const sal_Char sAPI_get_expression[] = "GetExpression"; static const sal_Char sAPI_set_expression[] = "SetExpression"; static const sal_Char sAPI_user[] = "User"; +static const sal_Char sAPI_table_formula[] = "TableFormula"; static const sal_Char sAPI_database[] = "com.sun.star.text.TextField.Database"; static const sal_Char sAPI_fieldmaster_database[] = "com.sun.star.text.FieldMaster.Database"; @@ -740,6 +741,74 @@ void XMLTextInputFieldImportContext::PrepareField( } +// +// table formula field +// + +TYPEINIT1( XMLTableFormulaImportContext, XMLTextFieldImportContext ); + +XMLTableFormulaImportContext::XMLTableFormulaImportContext( + SvXMLImport& rImport, + XMLTextImportHelper& rHlp, + sal_uInt16 nPrfx, + const OUString& rLocalName) : + XMLTextFieldImportContext(rImport, rHlp, sAPI_table_formula, + nPrfx, rLocalName), + sPropertyIsShowFormula(RTL_CONSTASCII_USTRINGPARAM("IsShowFormula")), + sPropertyCurrentPresentation( + RTL_CONSTASCII_USTRINGPARAM("CurrentPresentation")), + aValueHelper(rImport, rHlp, sal_False, sal_True, sal_False, sal_True), + sFormula(), + bIsShowFormula(sal_False) +{ +} + +XMLTableFormulaImportContext::~XMLTableFormulaImportContext() +{ +} + +void XMLTableFormulaImportContext::ProcessAttribute( + sal_uInt16 nAttrToken, + const OUString& sAttrValue ) +{ + switch (nAttrToken) + { + case XML_TOK_TEXTFIELD_FORMULA: + aValueHelper.ProcessAttribute( nAttrToken, sAttrValue ); + bValid = sal_True; // we need a formula! + break; + + case XML_TOK_TEXTFIELD_DATA_STYLE_NAME: + aValueHelper.ProcessAttribute( nAttrToken, sAttrValue ); + break; + case XML_TOK_TEXTFIELD_DISPLAY: + if ( sAttrValue.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("formula")) ) + bIsShowFormula = sal_True; + break; + default: + // unknown attribute -> ignore + break; + } +} + +void XMLTableFormulaImportContext::PrepareField( + const Reference<XPropertySet> & xPropertySet) +{ + // set format and formula + aValueHelper.PrepareField( xPropertySet ); + + Any aAny; + + // set 'show formula' and presentation + aAny.setValue( &bIsShowFormula, ::getBooleanCppuType() ); + xPropertySet->setPropertyValue( sPropertyIsShowFormula, aAny ); + + aAny <<= GetContent(); + xPropertySet->setPropertyValue( sPropertyCurrentPresentation, aAny ); +} + + // // variable declarations |