summaryrefslogtreecommitdiff
path: root/xmloff/source
diff options
context:
space:
mode:
authorDaniel Vogelheim <dvo@openoffice.org>2001-03-23 15:30:17 +0000
committerDaniel Vogelheim <dvo@openoffice.org>2001-03-23 15:30:17 +0000
commit6608709f94717d276255e25805eed64c6217ac87 (patch)
tree1c735383181a8b54e6fe4fa66955e46a2fdb1981 /xmloff/source
parent8fb37b3862dbdb4652d31258fd2b8558a3a8d295 (diff)
#84808# fixed: hidden text, hidden paragraph, conditional field now display
correctly on load (attributes added) fixed: update forced for certain fields on loading in organizer mode/styles only mode
Diffstat (limited to 'xmloff/source')
-rw-r--r--xmloff/source/text/txtflde.cxx19
-rw-r--r--xmloff/source/text/txtfldi.cxx232
2 files changed, 193 insertions, 58 deletions
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index f4d0836b6fca..532250a67685 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtflde.cxx,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: dvo $ $Date: 2001-03-22 13:06:55 $
+ * last change: $Author: dvo $ $Date: 2001-03-23 16:30:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -392,7 +392,7 @@ XMLTextFieldExport::XMLTextFieldExport( SvXMLExport& rExp,
RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.FieldMaster.")),
sPropertyContent(RTL_CONSTASCII_USTRINGPARAM("Content")),
sPropertyIsFixed(RTL_CONSTASCII_USTRINGPARAM("IsFixed")),
- sPropertyAuthorFullname(RTL_CONSTASCII_USTRINGPARAM("FullName")),
+ sPropertyFullName(RTL_CONSTASCII_USTRINGPARAM("FullName")),
sPropertyFieldSubType(RTL_CONSTASCII_USTRINGPARAM("UserDataType")),
sPropertyHint(RTL_CONSTASCII_USTRINGPARAM("Hint")),
sPropertyPlaceholder(RTL_CONSTASCII_USTRINGPARAM("PlaceHolder")),
@@ -459,6 +459,8 @@ XMLTextFieldExport::XMLTextFieldExport( SvXMLExport& rExp,
sPropertyDate(RTL_CONSTASCII_USTRINGPARAM("Date")),
sPropertyMeasureKind(RTL_CONSTASCII_USTRINGPARAM("Kind")),
sPropertyInstanceName(RTL_CONSTASCII_USTRINGPARAM("InstanceName")),
+ sPropertyIsHidden(RTL_CONSTASCII_USTRINGPARAM("IsHidden")),
+ sPropertyIsConditionTrue(RTL_CONSTASCII_USTRINGPARAM("IsConditionTrue")),
pCombinedCharactersPropertyState(pCombinedCharState)
{
SetExportOnlyUsedFieldDeclarations();
@@ -1466,6 +1468,9 @@ void XMLTextFieldExport::ExportFieldHelper(
GetStringProperty(sPropertyTrueContent, rPropSet));
ProcessString(sXML_string_value_if_false,
GetStringProperty(sPropertyFalseContent, rPropSet));
+ ProcessBoolean(sXML_current_value,
+ GetBoolProperty(sPropertyIsConditionTrue, rPropSet),
+ sal_False);
ExportElement(sXML_conditional_text, sPresentation);
break;
@@ -1474,12 +1479,18 @@ void XMLTextFieldExport::ExportFieldHelper(
GetStringProperty(sPropertyCondition, rPropSet));
ProcessString(sXML_string_value,
GetStringProperty(sPropertyContent, rPropSet));
+ ProcessBoolean(sXML_is_hidden,
+ GetBoolProperty(sPropertyIsHidden, rPropSet),
+ sal_False);
ExportElement(sXML_hidden_text, sPresentation);
break;
case FIELD_ID_HIDDEN_PARAGRAPH:
ProcessString(sXML_condition,
GetStringProperty(sPropertyCondition, rPropSet));
+ ProcessBoolean(sXML_is_hidden,
+ GetBoolProperty(sPropertyIsHidden, rPropSet),
+ sal_False);
DBG_ASSERT(sPresentation.equals(sEmpty),
"Unexpected presentation for hidden paragraph field");
ExportElement(sXML_hidden_paragraph);
@@ -2589,7 +2600,7 @@ const sal_Char* XMLTextFieldExport::MapAuthorFieldName(
const Reference<XPropertySet> & xPropSet)
{
// Initalen oder voller Name?
- return GetBoolProperty(sPropertyAuthorFullname, xPropSet)
+ return GetBoolProperty(sPropertyFullName, xPropSet)
? sXML_author_name : sXML_author_initials;
}
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 9df86538f2c3..b79a795a83c4 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtfldi.cxx,v $
*
- * $Revision: 1.22 $
+ * $Revision: 1.23 $
*
- * last change: $Author: mib $ $Date: 2001-03-19 09:41:43 $
+ * last change: $Author: dvo $ $Date: 2001-03-23 16:30:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -197,6 +197,10 @@
#include <com/sun/star/text/BibliographyDataField.hpp>
#endif
+#ifndef _COM_SUN_STAR_UTIL_XUPDATABLE_HPP_
+#include <com/sun/star/util/XUpdatable.hpp>
+#endif
+
#ifndef _RTL_USTRING
#include <rtl/ustring>
#endif
@@ -337,6 +341,8 @@ const sal_Char sAPI_representation[] = "Representation";
const sal_Char sAPI_date[] = "Date";
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_true[] = "TRUE";
@@ -398,6 +404,9 @@ static __FAR_DATA SvXMLTokenMapEntry aTextFieldAttrTokenMap[] =
{ XML_NAMESPACE_TEXT, sXML_annotation, XML_TOK_TEXTFIELD_ANNOTATION },
{ XML_NAMESPACE_SCRIPT, sXML_language, XML_TOK_TEXTFIELD_LANGUAGE },
{ XML_NAMESPACE_TEXT, sXML_kind, XML_TOK_TEXTFIELD_MEASURE_KIND },
+ { XML_NAMESPACE_TEXT, sXML_is_hidden, XML_TOK_TEXTFIELD_IS_HIDDEN },
+ { XML_NAMESPACE_TEXT, sXML_current_value,
+ XML_TOK_TEXTFIELD_CURRENT_VALUE },
XML_TOKEN_MAP_END
};
@@ -422,6 +431,7 @@ XMLTextFieldImportContext::XMLTextFieldImportContext(
sContentBuffer(),
rTextImportHelper(rHlp),
bValid(sal_False),
+ sIsFixed(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_fixed)),
sServicePrefix(RTL_CONSTASCII_USTRINGPARAM(
sAPI_textfield_prefix))
{
@@ -796,6 +806,22 @@ XMLTextFieldImportContext::CreateTextFieldImportContext(
}
+void XMLTextFieldImportContext::ForceUpdate(
+ const Reference<XPropertySet> & rPropertySet)
+{
+ // force update
+ Reference<XUpdatable> xUpdate(rPropertySet, UNO_QUERY);
+ if (xUpdate.is())
+ {
+ xUpdate->update();
+ }
+ else
+ {
+ DBG_ERROR("Expected XUpdatable support!");
+ }
+}
+
+
//
// XMLSenderFieldImportContext
@@ -896,20 +922,31 @@ void XMLSenderFieldImportContext::ProcessAttribute(
}
void XMLSenderFieldImportContext::PrepareField(
- const Reference<XPropertySet> & xPropSet)
+ const Reference<XPropertySet> & rPropSet)
{
// set members
Any aAny;
aAny <<= nSubType;
- xPropSet->setPropertyValue(sPropertyFieldSubType, aAny);
+ rPropSet->setPropertyValue(sPropertyFieldSubType, aAny);
+ // set fixed
aAny.setValue( &bFixed, ::getBooleanCppuType() );
- xPropSet->setPropertyValue(sPropertyFixed, aAny);
+ rPropSet->setPropertyValue(sPropertyFixed, aAny);
+ // set content if fixed
if (bFixed)
{
- aAny <<= GetContent();
- xPropSet->setPropertyValue(sPropertyContent, aAny);
+ // in organizer or styles-only mode: force update
+ if (GetImport().GetTextImport()->IsOrganizerMode() ||
+ GetImport().GetTextImport()->IsStylesOnlyMode() )
+ {
+ ForceUpdate(rPropSet);
+ }
+ else
+ {
+ aAny <<= GetContent();
+ rPropSet->setPropertyValue(sPropertyContent, aAny);
+ }
}
}
@@ -947,20 +984,30 @@ void XMLAuthorFieldImportContext::StartElement(
}
void XMLAuthorFieldImportContext::PrepareField(
- const Reference<XPropertySet> & xPropSet)
+ const Reference<XPropertySet> & rPropSet)
{
// set members
Any aAny;
aAny.setValue( &bAuthorFullName, ::getBooleanCppuType() );
- xPropSet->setPropertyValue(sPropertyAuthorFullName, aAny);
+ rPropSet->setPropertyValue(sPropertyAuthorFullName, aAny);
aAny.setValue( &bFixed, ::getBooleanCppuType() );
- xPropSet->setPropertyValue(sPropertyFixed, aAny);
+ rPropSet->setPropertyValue(sPropertyFixed, aAny);
+ // set content if fixed
if (bFixed)
{
- aAny <<= GetContent();
- xPropSet->setPropertyValue(sPropertyContent, aAny);
+ // organizer or styles-only mode: force update
+ if (GetImport().GetTextImport()->IsOrganizerMode() ||
+ GetImport().GetTextImport()->IsStylesOnlyMode() )
+ {
+ ForceUpdate(rPropSet);
+ }
+ else
+ {
+ aAny <<= GetContent();
+ rPropSet->setPropertyValue(sPropertyContent, aAny);
+ }
}
}
@@ -1313,48 +1360,62 @@ void XMLTimeFieldImportContext::ProcessAttribute(
}
void XMLTimeFieldImportContext::PrepareField(
- const Reference<XPropertySet> & xPropertySet)
+ const Reference<XPropertySet> & rPropertySet)
{
Any aAny;
// all properties are optional (except IsDate)
Reference<XPropertySetInfo> xPropertySetInfo(
- xPropertySet->getPropertySetInfo());
+ rPropertySet->getPropertySetInfo());
if (xPropertySetInfo->hasPropertyByName(sPropertyFixed))
{
aAny.setValue( &bFixed, ::getBooleanCppuType() );
- xPropertySet->setPropertyValue(sPropertyFixed, aAny);
+ rPropertySet->setPropertyValue(sPropertyFixed, aAny);
}
aAny.setValue( &bIsDate, ::getBooleanCppuType() );
- xPropertySet->setPropertyValue(sPropertyIsDate, aAny);
+ rPropertySet->setPropertyValue(sPropertyIsDate, aAny);
if (xPropertySetInfo->hasPropertyByName(sPropertyAdjust))
{
aAny <<= nAdjust;
- xPropertySet->setPropertyValue(sPropertyAdjust, aAny);
- }
-
- if (bFixed && bTimeOK &&
- xPropertySetInfo->hasPropertyByName(sPropertyDateTimeValue))
- {
- aAny <<= aDateTimeValue;
- xPropertySet->setPropertyValue(sPropertyDateTimeValue, aAny);
+ rPropertySet->setPropertyValue(sPropertyAdjust, aAny);
}
- if (bFixed && bTimeOK &&
- xPropertySetInfo->hasPropertyByName(sPropertyDateTime))
+ // set value
+ if (bFixed)
{
- aAny <<= aDateTimeValue;
- xPropertySet->setPropertyValue(sPropertyDateTime, aAny);
+ // organizer or styles-only mode: force update
+ if (GetImport().GetTextImport()->IsOrganizerMode() ||
+ GetImport().GetTextImport()->IsStylesOnlyMode() )
+ {
+ ForceUpdate(rPropertySet);
+ }
+ else
+ {
+ // normal mode: set value (if present)
+ if (bTimeOK)
+ {
+ if (xPropertySetInfo->hasPropertyByName(sPropertyDateTimeValue))
+ {
+ aAny <<= aDateTimeValue;
+ rPropertySet->setPropertyValue(sPropertyDateTimeValue,aAny);
+ }
+ else if (xPropertySetInfo->hasPropertyByName(sPropertyDateTime))
+ {
+ aAny <<= aDateTimeValue;
+ rPropertySet->setPropertyValue(sPropertyDateTime, aAny);
+ }
+ }
+ }
}
if (bFormatOK &&
xPropertySetInfo->hasPropertyByName(sPropertyNumberFormat))
{
aAny <<= nFormatKey;
- xPropertySet->setPropertyValue(sPropertyNumberFormat, aAny);
+ rPropertySet->setPropertyValue(sPropertyNumberFormat, aAny);
}
}
@@ -1722,26 +1783,40 @@ void XMLSimpleDocInfoImportContext::ProcessAttribute(
}
void XMLSimpleDocInfoImportContext::PrepareField(
- const Reference<XPropertySet> & xPropertySet)
+ const Reference<XPropertySet> & rPropertySet)
{
Any aAny;
aAny.setValue(&bFixed, ::getBooleanCppuType() );
- xPropertySet->setPropertyValue(sPropertyFixed, aAny);
+ rPropertySet->setPropertyValue(sPropertyFixed, aAny);
- // set Content (if not fixed) AND CurrentPresentation
- aAny <<= GetContent();
-
- if (bFixed && bHasAuthor)
+ // set Content and CurrentPresentation (if fixed)
+ if (bFixed)
{
- xPropertySet->setPropertyValue(sPropertyAuthor, aAny);
- }
+ // in organizer-mode or styles-only-mode, only force update
+ if (GetImport().GetTextImport()->IsOrganizerMode() ||
+ GetImport().GetTextImport()->IsStylesOnlyMode() )
+ {
+ ForceUpdate(rPropertySet);
+ }
+ else
+ {
+ // set content (author, if that's the name) and current
+ // presentation
+ aAny <<= GetContent();
- if (bFixed && bHasContent)
- {
- xPropertySet->setPropertyValue(sPropertyContent, aAny);
- }
+ if (bFixed && bHasAuthor)
+ {
+ rPropertySet->setPropertyValue(sPropertyAuthor, aAny);
+ }
- xPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
+ if (bFixed && bHasContent)
+ {
+ rPropertySet->setPropertyValue(sPropertyContent, aAny);
+ }
+
+ rPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
+ }
+ }
}
const sal_Char* XMLSimpleDocInfoImportContext::MapTokenToServiceName(
@@ -1840,20 +1915,28 @@ XMLRevisionDocInfoImportContext::XMLRevisionDocInfoImportContext(
}
void XMLRevisionDocInfoImportContext::PrepareField(
- const Reference<XPropertySet> & xPropertySet)
+ const Reference<XPropertySet> & rPropertySet)
{
- XMLSimpleDocInfoImportContext::PrepareField(xPropertySet);
+ XMLSimpleDocInfoImportContext::PrepareField(rPropertySet);
- // set revision number if fixed
+ // set revision number
+ // if fixed, if not in organizer-mode, if not in styles-only-mode
if (bFixed)
{
- sal_Int32 nTmp;
-
- if (SvXMLUnitConverter::convertNumber(nTmp, GetContent()))
+ if ( GetImport().GetTextImport()->IsOrganizerMode() ||
+ GetImport().GetTextImport()->IsStylesOnlyMode() )
{
- Any aAny;
- aAny <<= nTmp;
- xPropertySet->setPropertyValue(sPropertyRevision, aAny);
+ ForceUpdate(rPropertySet);
+ }
+ else
+ {
+ sal_Int32 nTmp;
+ if (SvXMLUnitConverter::convertNumber(nTmp, GetContent()))
+ {
+ Any aAny;
+ aAny <<= nTmp;
+ rPropertySet->setPropertyValue(sPropertyRevision, aAny);
+ }
}
}
}
@@ -2030,7 +2113,9 @@ XMLHiddenParagraphImportContext::XMLHiddenParagraphImportContext(
XMLTextFieldImportContext(rImport, rHlp, sAPI_hidden_paragraph,
nPrfx, sLocalName),
sPropertyCondition(RTL_CONSTASCII_USTRINGPARAM(sAPI_condition)),
- sCondition()
+ sPropertyIsHidden(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_hidden)),
+ sCondition(),
+ bIsHidden(sal_False)
{
}
@@ -2043,6 +2128,14 @@ void XMLHiddenParagraphImportContext::ProcessAttribute(
sCondition = sAttrValue;
bValid = sal_True;
}
+ else if (XML_TOK_TEXTFIELD_IS_HIDDEN == nAttrToken)
+ {
+ sal_Bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sAttrValue))
+ {
+ bIsHidden = bTmp;
+ }
+ }
}
void XMLHiddenParagraphImportContext::PrepareField(
@@ -2051,6 +2144,9 @@ void XMLHiddenParagraphImportContext::PrepareField(
Any aAny;
aAny <<= sCondition;
xPropertySet->setPropertyValue(sPropertyCondition, aAny);
+
+ aAny.setValue( &bIsHidden, ::getBooleanCppuType() );
+ xPropertySet->setPropertyValue(sPropertyIsHidden, aAny);
}
@@ -2069,12 +2165,14 @@ XMLConditionalTextImportContext::XMLConditionalTextImportContext(
sPropertyCondition(RTL_CONSTASCII_USTRINGPARAM(sAPI_condition)),
sPropertyTrueContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_true_content)),
sPropertyFalseContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_false_content)),
+ sPropertyIsConditionTrue(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_condition_true)),
sCondition(),
sTrueContent(),
sFalseContent(),
bConditionOK(sal_False),
bTrueOK(sal_False),
- bFalseOK(sal_False)
+ bFalseOK(sal_False),
+ bCurrentValue(sal_False)
{
}
@@ -2096,6 +2194,15 @@ void XMLConditionalTextImportContext::ProcessAttribute(
sTrueContent = sAttrValue;
bTrueOK = sal_True;
break;
+ case XML_TOK_TEXTFIELD_CURRENT_VALUE:
+ {
+ sal_Bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sAttrValue))
+ {
+ bCurrentValue = bTmp;
+ }
+ break;
+ }
}
bValid = bConditionOK && bFalseOK && bTrueOK;
@@ -2114,6 +2221,9 @@ void XMLConditionalTextImportContext::PrepareField(
aAny <<= sTrueContent;
xPropertySet->setPropertyValue(sPropertyTrueContent, aAny);
+
+ aAny.setValue( &bCurrentValue, ::getBooleanCppuType() );
+ xPropertySet->setPropertyValue(sPropertyIsConditionTrue, aAny);
}
@@ -2131,10 +2241,12 @@ XMLHiddenTextImportContext::XMLHiddenTextImportContext(
nPrfx, sLocalName),
sPropertyCondition(RTL_CONSTASCII_USTRINGPARAM(sAPI_condition)),
sPropertyContent(RTL_CONSTASCII_USTRINGPARAM(sAPI_content)),
+ sPropertyIsHidden(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_hidden)),
sCondition(),
sString(),
bConditionOK(sal_False),
- bStringOK(sal_False)
+ bStringOK(sal_False),
+ bIsHidden(sal_False)
{
}
@@ -2152,6 +2264,15 @@ void XMLHiddenTextImportContext::ProcessAttribute(
sString = sAttrValue;
bStringOK = sal_True;
break;
+ case XML_TOK_TEXTFIELD_IS_HIDDEN:
+ {
+ sal_Bool bTmp;
+ if (SvXMLUnitConverter::convertBool(bTmp, sAttrValue))
+ {
+ bIsHidden = bTmp;
+ }
+ break;
+ }
}
bValid = bConditionOK && bStringOK;
@@ -2167,6 +2288,9 @@ void XMLHiddenTextImportContext::PrepareField(
aAny <<= sString;
xPropertySet->setPropertyValue(sPropertyContent, aAny);
+
+ aAny.setValue( &bIsHidden, ::getBooleanCppuType() );
+ xPropertySet->setPropertyValue(sPropertyIsHidden, aAny);
}