summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vogelheim <dvo@openoffice.org>2000-11-10 10:51:18 +0000
committerDaniel Vogelheim <dvo@openoffice.org>2000-11-10 10:51:18 +0000
commit143d6d9c7d89bfc177d8bcc3a2a7a37dce146187 (patch)
tree32aa9b2929075a6f4bcea97f4873845e31d75e62
parent1fe7aa093fb75bf1f20698a3d5f95b98610e2669 (diff)
- fixed: page number export in non-Writer apps
- added: Bibliography field stub (not yet implemented) - changed: map-methods now static, so they may be reused elsewhere - fixed: sal_Bool comparison
-rw-r--r--xmloff/inc/txtflde.hxx41
-rw-r--r--xmloff/source/text/txtflde.cxx29
2 files changed, 45 insertions, 25 deletions
diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx
index bd07d2e6a8cb..607f588fda0c 100644
--- a/xmloff/inc/txtflde.hxx
+++ b/xmloff/inc/txtflde.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtflde.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: dvo $ $Date: 2000-11-02 15:51:17 $
+ * last change: $Author: dvo $ $Date: 2000-11-10 11:51:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -154,6 +154,8 @@ enum FieldIdEnum {
FIELD_ID_REF_ENDNOTE, // get reference field (endnote)
FIELD_ID_DDE, // DDE field
+ FIELD_ID_BIBLIOGRAPHY, // bibliography index entry
+
FIELD_ID_SHEET_NAME, // name of current (spread-)sheet
FIELD_ID_URL, // URL field (only Calc, Draw, Impress)
@@ -194,6 +196,24 @@ public:
/// to be called once at beginning of document body.
void ExportFieldDeclarations();
+ // determine element or attribute names
+ // (public, because they may be useful in related XML export classes)
+ static const sal_Char* MapPlaceholderType(sal_uInt16 nType);
+ static const sal_Char* MapTemplateDisplayFormat(sal_Int16 nType);
+ static const sal_Char* MapChapterDisplayFormat(sal_Int16 nType);
+ static const sal_Char* MapFilenameDisplayFormat(sal_Int16 nType);
+ static const sal_Char* MapDocInfoFieldName(enum FieldIdEnum nToken);
+ static const sal_Char* MapReferenceSource(sal_Int16 nType);
+ static const sal_Char* MapReferenceType(sal_Int16 nType);
+ static const sal_Char* MapCountFieldName(sal_Int16 nToken);
+ const sal_Char* MapPageNumberName(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet> & xPropSet,
+ sal_Int32& nOffset); /// also adjust page offset
+ const sal_Char* MapAuthorFieldName(const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & xPropSet);
+ const sal_Char* MapSenderFieldName(const ::com::sun::star::uno::Reference <
+ ::com::sun::star::beans::XPropertySet > & xPropSet);
+
protected:
SvXMLExport& GetExport() { return rExport; }
@@ -308,23 +328,6 @@ protected:
::com::sun::star::beans::XPropertySet> & xField);
- // determine element name from field properties
- const sal_Char* MapAuthorFieldName(const ::com::sun::star::uno::Reference <
- ::com::sun::star::beans::XPropertySet > & xPropSet);
- const sal_Char* MapSenderFieldName(const ::com::sun::star::uno::Reference <
- ::com::sun::star::beans::XPropertySet > & xPropSet);
- const sal_Char* MapPlaceholderType(sal_uInt16 nType);
- const sal_Char* MapTemplateDisplayFormat(sal_Int16 nType);
- const sal_Char* MapChapterDisplayFormat(sal_Int16 nType);
- const sal_Char* MapFilenameDisplayFormat(sal_Int16 nType);
- const sal_Char* MapDocInfoFieldName(enum FieldIdEnum nToken);
- const sal_Char* MapReferenceSource(sal_Int16 nType);
- const sal_Char* MapReferenceType(sal_Int16 nType);
- const sal_Char* MapPageNumberName(const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet> & xPropSet,
- sal_Int32& nOffset); /// also adjust page offset
- const sal_Char* MapCountFieldName(sal_Int16 nToken);
-
/// get field ID from XTextField (and it's Property-Set)
enum FieldIdEnum GetFieldID(const ::com::sun::star::uno::Reference <
::com::sun::star::text::XTextField > & rTextField,
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 0ba52094ad5d..bdf19e6e0ffe 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtflde.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: dvo $ $Date: 2000-11-08 14:35:52 $
+ * last change: $Author: dvo $ $Date: 2000-11-10 11:51:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -262,6 +262,7 @@ static sal_Char __READONLY_DATA FIELD_SERVICE_MACRO[] = "Macro";
static sal_Char __READONLY_DATA FIELD_SERVICE_GET_REFERENCE[] = "GetReference";
static sal_Char __READONLY_DATA FIELD_SERVICE_DDE[] = "DDE";
static sal_Char __READONLY_DATA FIELD_SERVICE_URL[] = "URL";
+static sal_Char __READONLY_DATA FIELD_SERVICE_BIBLIOGRAPHY[] = "Bibliography";
SvXMLEnumMapEntry __READONLY_DATA aFieldServiceNameMapping[] =
@@ -324,6 +325,8 @@ SvXMLEnumMapEntry __READONLY_DATA aFieldServiceNameMapping[] =
{ FIELD_SERVICE_GET_REFERENCE, FIELD_ID_REF_REFERENCE },
{ FIELD_SERVICE_DDE, FIELD_ID_DDE },
+ { FIELD_SERVICE_BIBLIOGRAPHY, FIELD_ID_BIBLIOGRAPHY },
+
// non-writer fields
{ FIELD_SERVICE_SHEET_NAME, FIELD_ID_SHEET_NAME },
{ FIELD_SERVICE_URL, FIELD_ID_URL },
@@ -544,10 +547,15 @@ enum FieldIdEnum XMLTextFieldExport::MapFieldName(
break;
case FIELD_ID_PAGENUMBER:
- if (NumberingType::CHAR_SPECIAL == GetIntProperty(
- sPropertyNumberingType, xPropSet))
+ // NumberingType not available in non-Writer apps
+ if (xPropSet->getPropertySetInfo()->
+ hasPropertyByName(sPropertyNumberingType))
{
- nToken = FIELD_ID_PAGESTRING;
+ if (NumberingType::CHAR_SPECIAL == GetIntProperty(
+ sPropertyNumberingType, xPropSet))
+ {
+ nToken = FIELD_ID_PAGESTRING;
+ }
}
break;
@@ -596,6 +604,7 @@ enum FieldIdEnum XMLTextFieldExport::MapFieldName(
}
break;
+ case FIELD_ID_BIBLIOGRAPHY:
case FIELD_ID_DDE:
case FIELD_ID_MACRO:
case FIELD_ID_REFPAGE_SET:
@@ -708,6 +717,7 @@ sal_Bool XMLTextFieldExport::IsStringField(
// always number
return sal_False;
+ case FIELD_ID_BIBLIOGRAPHY:
case FIELD_ID_DDE:
case FIELD_ID_REF_REFERENCE:
case FIELD_ID_REF_SEQUENCE:
@@ -809,6 +819,7 @@ void XMLTextFieldExport::ExportFieldAutoStyle(
}
break;
+ case FIELD_ID_BIBLIOGRAPHY:
case FIELD_ID_DDE:
case FIELD_ID_REF_REFERENCE:
case FIELD_ID_REF_SEQUENCE:
@@ -1433,6 +1444,11 @@ void XMLTextFieldExport::ExportField(const Reference<XTextField> & rTextField )
break;
}
+ case FIELD_ID_BIBLIOGRAPHY:
+ // TODO: API missing
+ DBG_ERROR("not implemeted; API is missing.");
+ break;
+
case FIELD_ID_UNKNOWN:
default:
DBG_ERROR("unkown field type encountered!");
@@ -1847,7 +1863,8 @@ void XMLTextFieldExport::ProcessBoolean(const sal_Char* pXmlName,
}
// write attribute (if different than default)
- if (bBool != bDefault) {
+ // negate to force 0/1 values (and make sal_Bool comparable)
+ if ((!bBool) != (!bDefault)) {
GetExport().AddAttributeASCII(XML_NAMESPACE_TEXT,
pXmlName,
(bBool ? sXML_true : sXML_false) );