summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSascha Ballach <sab@openoffice.org>2001-05-08 06:41:45 +0000
committerSascha Ballach <sab@openoffice.org>2001-05-08 06:41:45 +0000
commit893887ee94a576687b8bff50168fb2e66f6e9426 (patch)
tree71b904441a342048d26fc90f14bc7da872be7bb8 /sc
parent4050789fd97180d519730e9984b0d22f84c01d2f (diff)
remove some calls of setPropertyValue
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx47
-rw-r--r--sc/source/filter/xml/xmlstyle.cxx6
-rw-r--r--sc/source/filter/xml/xmlstyle.hxx7
-rw-r--r--sc/source/filter/xml/xmlstyli.cxx124
-rw-r--r--sc/source/filter/xml/xmlstyli.hxx11
5 files changed, 130 insertions, 65 deletions
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index d8e01e16aeda..f34d0928e140 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlcelli.cxx,v $
*
- * $Revision: 1.39 $
+ * $Revision: 1.40 $
*
- * last change: $Author: dr $ $Date: 2001-04-05 11:07:43 $
+ * last change: $Author: sab $ $Date: 2001-05-08 07:41:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -303,28 +303,33 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
sal_Int16 ScXMLTableRowCellContext::GetCellType(const rtl::OUString& sOUValue) const
{
- if (sOUValue.equals(GetScImport().sSC_float))
- return util::NumberFormat::NUMBER;
- else
- if (sOUValue.equals(GetScImport().sSC_string))
- return util::NumberFormat::TEXT;
+ if (sOUValue.getLength())
+ {
+ if (sOUValue.equals(GetScImport().sSC_float))
+ return util::NumberFormat::NUMBER;
else
- if (sOUValue.equals(GetScImport().sSC_time))
- return util::NumberFormat::TIME;
+ if (sOUValue.equals(GetScImport().sSC_string))
+ return util::NumberFormat::TEXT;
else
- if (sOUValue.equals(GetScImport().sSC_date))
- return util::NumberFormat::DATETIME;
+ if (sOUValue.equals(GetScImport().sSC_time))
+ return util::NumberFormat::TIME;
else
- if (sOUValue.equals(GetScImport().sSC_percentage))
- return util::NumberFormat::PERCENT;
+ if (sOUValue.equals(GetScImport().sSC_date))
+ return util::NumberFormat::DATETIME;
else
- if (sOUValue.equals(GetScImport().sSC_currency))
- return util::NumberFormat::CURRENCY;
+ if (sOUValue.equals(GetScImport().sSC_percentage))
+ return util::NumberFormat::PERCENT;
else
- if (sOUValue.equals(GetScImport().sSC_boolean))
- return util::NumberFormat::LOGICAL;
+ if (sOUValue.equals(GetScImport().sSC_currency))
+ return util::NumberFormat::CURRENCY;
else
- return 0;
+ if (sOUValue.equals(GetScImport().sSC_boolean))
+ return util::NumberFormat::LOGICAL;
+ else
+ return 0;
+ }
+ else
+ return util::NumberFormat::TEXT;
}
ScXMLTableRowCellContext::~ScXMLTableRowCellContext()
@@ -843,7 +848,8 @@ void ScXMLTableRowCellContext::SetCellProperties(const uno::Reference<table::XCe
rtl::OUString sParentName = pStyle->GetParent();
uno::Any aStyleName;
aStyleName <<= sParentName;
- xProperties->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLSTYL)), aStyleName);
+ //xProperties->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLSTYL)), aStyleName);
+ pStyle->AddProperty(CTF_SC_CELLSTYLE, aStyleName);
pStyle->FillPropertySet(xProperties);
}
else
@@ -871,7 +877,8 @@ void ScXMLTableRowCellContext::SetCellProperties(const uno::Reference<table::XCe
rtl::OUString sParentName = pStyle->GetParent();
uno::Any aStyleName;
aStyleName <<= sParentName;
- xProperties->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLSTYL)), aStyleName);
+ //xProperties->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLSTYL)), aStyleName);
+ pStyle->AddProperty(CTF_SC_CELLSTYLE, aStyleName);
pStyle->FillPropertySet(xProperties);
}
else
diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx
index 8e3b80b8a10e..490c8b1b5dd1 100644
--- a/sc/source/filter/xml/xmlstyle.cxx
+++ b/sc/source/filter/xml/xmlstyle.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlstyle.cxx,v $
*
- * $Revision: 1.28 $
+ * $Revision: 1.29 $
*
- * last change: $Author: sab $ $Date: 2001-03-29 15:35:20 $
+ * last change: $Author: sab $ $Date: 2001-05-08 07:41:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -130,6 +130,8 @@ const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
{ "CellBackColor", XML_NAMESPACE_FO, sXML_background_color, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 },
{ "CellProtection", XML_NAMESPACE_STYLE, sXML_cell_protect, XML_SC_TYPE_CELLPROTECTION|MID_FLAG_MERGE_PROPERTY, 0 },
{ "CellProtection", XML_NAMESPACE_STYLE, sXML_print_content, XML_SC_TYPE_PRINTCONTENT|MID_FLAG_MERGE_PROPERTY, 0 },
+ { "CellStyle", XML_NAMESPACE_STYLE, sXML_style, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_CELLSTYLE },
+ { "ConditionalFormat", XML_NAMESPACE_STYLE, sXML_map, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_IMPORT_MAP },
{ "ConditionalFormatXML", XML_NAMESPACE_STYLE, sXML_map, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MAP },
{ "HoriJustify", XML_NAMESPACE_FO, sXML_text_align, XML_SC_TYPE_HORIJUSTIFY|MID_FLAG_MERGE_PROPERTY, 0 },
{ "HoriJustify", XML_NAMESPACE_STYLE, sXML_text_align_source, XML_SC_TYPE_HORIJUSTIFYSOURCE|MID_FLAG_MERGE_PROPERTY, 0 },
diff --git a/sc/source/filter/xml/xmlstyle.hxx b/sc/source/filter/xml/xmlstyle.hxx
index 68e58f588426..24655d6351b4 100644
--- a/sc/source/filter/xml/xmlstyle.hxx
+++ b/sc/source/filter/xml/xmlstyle.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlstyle.hxx,v $
*
- * $Revision: 1.17 $
+ * $Revision: 1.18 $
*
- * last change: $Author: nn $ $Date: 2001-03-16 14:16:31 $
+ * last change: $Author: sab $ $Date: 2001-05-08 07:41:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -109,7 +109,6 @@ extern const XMLPropertyMapEntry aXMLScTableStylesProperties[];
#define XML_SC_TYPE_BORDERBOTTOM (XML_SC_TYPES_START + 12)
#define XML_SC_TYPE_VERTJUSTIFY (XML_SC_TYPES_START + 13)
#define XML_SC_ISTEXTWRAPPED (XML_SC_TYPES_START + 14)
-//#define XML_SC_TYPE_NUMBERFORMAT (XML_SC_TYPES_START + 14)
#define CTF_SC_HORIJUSTIFY (XML_SC_CTF_START + 1)
#define CTF_SC_HORIJUSTIFY_SOURCE (XML_SC_CTF_START + 2)
@@ -132,6 +131,8 @@ extern const XMLPropertyMapEntry aXMLScTableStylesProperties[];
#define CTF_SC_MAP (XML_SC_CTF_START + 19)
#define CTF_SC_PARAINDENT (XML_SC_CTF_START + 20)
#define CTF_SC_OLDTEXTBACKGROUND (XML_SC_CTF_START + 21)
+#define CTF_SC_IMPORT_MAP (XML_SC_CTF_START + 22)
+#define CTF_SC_CELLSTYLE (XML_SC_CTF_START + 23)
#define CTF_SC_ROWHEIGHT (XML_SC_CTF_START + 50)
#define CTF_SC_ROWOPTIMALHEIGHT (XML_SC_CTF_START + 51)
diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx
index eeb4ae559c57..fe57aff17991 100644
--- a/sc/source/filter/xml/xmlstyli.cxx
+++ b/sc/source/filter/xml/xmlstyli.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlstyli.cxx,v $
*
- * $Revision: 1.33 $
+ * $Revision: 1.34 $
*
- * last change: $Author: sab $ $Date: 2001-03-30 14:11:04 $
+ * last change: $Author: sab $ $Date: 2001-05-08 07:41:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -120,7 +120,7 @@
#include "docuno.hxx"
#include "unonames.hxx"
-#define SC_NUMBERFORMAT "NumberFormat"
+//#define SC_NUMBERFORMAT "NumberFormat"
#define SC_CONDITIONALFORMAT "ConditionalFormat"
#define XML_LINE_LEFT 0
@@ -592,39 +592,45 @@ SvXMLImportContext *XMLTableStyleContext::CreateChildContext(
void XMLTableStyleContext::FillPropertySet(
const Reference< XPropertySet > & rPropSet )
{
- XMLPropStyleContext::FillPropertySet(rPropSet);
if (!IsDefaultStyle())
{
- if (sDataStyleName.getLength())
+ if (GetFamily() == XML_STYLE_FAMILY_TABLE_CELL)
{
- SvXMLNumFormatContext* pStyle = (SvXMLNumFormatContext *)pStyles->FindStyleChildContext(
- XML_STYLE_FAMILY_DATA_STYLE, sDataStyleName, sal_True);
- if (!pStyle)
+ if (sDataStyleName.getLength())
{
- XMLTableStylesContext* pMyStyles = (XMLTableStylesContext *)GetScImport().GetStyles();
- pStyle = (SvXMLNumFormatContext *)pMyStyles->
- FindStyleChildContext(XML_STYLE_FAMILY_DATA_STYLE, sDataStyleName, sal_True);
- }
- if (pStyle)
- {
- uno::Any aNumberFormat;
- sal_Int32 nNumberFormat = pStyle->GetKey();
- aNumberFormat <<= nNumberFormat;
- rPropSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_NUMBERFORMAT)), aNumberFormat);
+ SvXMLNumFormatContext* pStyle = (SvXMLNumFormatContext *)pStyles->FindStyleChildContext(
+ XML_STYLE_FAMILY_DATA_STYLE, sDataStyleName, sal_True);
+ if (!pStyle)
+ {
+ XMLTableStylesContext* pMyStyles = (XMLTableStylesContext *)GetScImport().GetStyles();
+ pStyle = (SvXMLNumFormatContext *)pMyStyles->
+ FindStyleChildContext(XML_STYLE_FAMILY_DATA_STYLE, sDataStyleName, sal_True);
+ }
+ if (pStyle)
+ {
+ uno::Any aNumberFormat;
+ sal_Int32 nNumberFormat = pStyle->GetKey();
+ aNumberFormat <<= nNumberFormat;
+ //rPropSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_NUMBERFORMAT)), aNumberFormat);
+ AddProperty(CTF_SC_NUMBERFORMAT, aNumberFormat);
+ }
}
- }
- if (aMaps.size() > 0)
- {
- std::vector<ScXMLMapContent>::iterator aItr = aMaps.begin();
- while(aItr != aMaps.end())
+ if (aMaps.size() > 0)
{
- uno::Any aConditionalFormat = rPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_CONDITIONALFORMAT)));
- rPropSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_CONDITIONALFORMAT)),
- GetConditionalFormat(aConditionalFormat, aItr->sCondition, aItr->sApplyStyle, aItr->sBaseCell));
- aItr++;
+ std::vector<ScXMLMapContent>::iterator aItr = aMaps.begin();
+ while(aItr != aMaps.end())
+ {
+ uno::Any aConditionalFormat = rPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_CONDITIONALFORMAT)));
+ /*rPropSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_CONDITIONALFORMAT)),
+ GetConditionalFormat(aConditionalFormat, aItr->sCondition, aItr->sApplyStyle, aItr->sBaseCell));*/
+ AddProperty(CTF_SC_IMPORT_MAP,
+ GetConditionalFormat(aConditionalFormat, aItr->sCondition, aItr->sApplyStyle, aItr->sBaseCell));
+ aItr++;
+ }
}
}
}
+ XMLPropStyleContext::FillPropertySet(rPropSet);
}
void XMLTableStyleContext::SetDefaults()
@@ -649,23 +655,34 @@ void XMLTableStyleContext::Finish( sal_Bool bOverwrite )
if( !xStyle.is() )
return;
- Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
- Reference< XPropertySetInfo > xPropSetInfo =
- xPropSet->getPropertySetInfo();
- if( (xPropSetInfo->hasPropertyByName( sNumberFormat )) && sDataStyleName.getLength() )
+ if (GetFamily() == XML_STYLE_FAMILY_TABLE_CELL)
{
- Any aAny;
- SvXMLNumFormatContext* pStyle = (SvXMLNumFormatContext *)pStyles->FindStyleChildContext(
- XML_STYLE_FAMILY_DATA_STYLE, sDataStyleName, sal_True);
- if (pStyle)
+ Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( (xPropSetInfo->hasPropertyByName( sNumberFormat )) && sDataStyleName.getLength() )
{
- sal_Int32 nNumberFormat = pStyle->GetKey();
- aAny <<= nNumberFormat;
- xPropSet->setPropertyValue( sNumberFormat, aAny );
+ Any aAny;
+ SvXMLNumFormatContext* pStyle = (SvXMLNumFormatContext *)pStyles->FindStyleChildContext(
+ XML_STYLE_FAMILY_DATA_STYLE, sDataStyleName, sal_True);
+ if (pStyle)
+ {
+ sal_Int32 nNumberFormat = pStyle->GetKey();
+ aAny <<= nNumberFormat;
+ xPropSet->setPropertyValue( sNumberFormat, aAny );
+ }
}
}
}
+void XMLTableStyleContext::AddProperty(const sal_Int16 nContextID, const uno::Any& rValue)
+{
+ sal_Int32 nIndex(static_cast<XMLTableStylesContext *>(pStyles)->GetIndex(nContextID));
+ DBG_ASSERT(nIndex != -1, "Property not found in Map");
+ XMLPropertyState aPropState(nIndex, rValue);
+ GetProperties().push_back(aPropState); // has to be insertes in a sort order later
+}
+
// ----------------------------------------------------------------------------
SvXMLStyleContext *XMLTableStylesContext::CreateStyleStyleChildContext(
@@ -727,6 +744,9 @@ XMLTableStylesContext::XMLTableStylesContext( SvXMLImport& rImport,
sColumnStyleServiceName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME ))),
sRowStyleServiceName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME ))),
sTableStyleServiceName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME ))),
+ nNumberFormatIndex(-1),
+ nConditionalFormatIndex(-1),
+ nCellStyleIndex(-1),
bAutoStyles(bTempAutoStyles)
{
}
@@ -918,6 +938,34 @@ OUString XMLTableStylesContext::GetServiceName( sal_uInt16 nFamily ) const
return sServiceName;
}
+sal_Int32 XMLTableStylesContext::GetIndex(const sal_Int16 nContextID)
+{
+ if (nContextID == CTF_SC_CELLSTYLE)
+ {
+ if (nCellStyleIndex == -1)
+ nCellStyleIndex =
+ GetImportPropertyMapper(XML_STYLE_FAMILY_TABLE_CELL)->getPropertySetMapper()->FindEntryIndex(nContextID);
+ return nCellStyleIndex;
+ }
+ else if (nContextID == CTF_SC_NUMBERFORMAT)
+ {
+ if (nNumberFormatIndex == -1)
+ nNumberFormatIndex =
+ GetImportPropertyMapper(XML_STYLE_FAMILY_TABLE_CELL)->getPropertySetMapper()->FindEntryIndex(nContextID);
+ return nNumberFormatIndex;
+ }
+ else if (nContextID == CTF_SC_IMPORT_MAP)
+ {
+ if (nConditionalFormatIndex == -1)
+ nConditionalFormatIndex =
+ GetImportPropertyMapper(XML_STYLE_FAMILY_TABLE_CELL)->getPropertySetMapper()->FindEntryIndex(nContextID);
+ return nConditionalFormatIndex;
+ }
+ else
+ return -1;
+}
+
+// ---------------------------------------------------------------------------
TYPEINIT1( ScXMLMasterStylesContext, SvXMLStylesContext );
sal_Bool ScXMLMasterStylesContext::InsertStyleFamily( sal_uInt16 ) const
diff --git a/sc/source/filter/xml/xmlstyli.hxx b/sc/source/filter/xml/xmlstyli.hxx
index 49760a4fd3ff..1b808cee4a9e 100644
--- a/sc/source/filter/xml/xmlstyli.hxx
+++ b/sc/source/filter/xml/xmlstyli.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlstyli.hxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: sab $ $Date: 2001-03-02 17:28:42 $
+ * last change: $Author: sab $ $Date: 2001-05-08 07:41:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -194,6 +194,8 @@ public:
virtual void SetDefaults();
virtual void Finish( sal_Bool bOverwrite );
+
+ void AddProperty(sal_Int16 nContextID, const com::sun::star::uno::Any& aValue);
};
class XMLTableStylesContext : public SvXMLStylesContext
@@ -210,6 +212,9 @@ class XMLTableStylesContext : public SvXMLStylesContext
const ::rtl::OUString sColumnStyleServiceName;
const ::rtl::OUString sRowStyleServiceName;
const ::rtl::OUString sTableStyleServiceName;
+ sal_Int32 nNumberFormatIndex;
+ sal_Int32 nConditionalFormatIndex;
+ sal_Int32 nCellStyleIndex;
sal_Bool bAutoStyles : 1;
UniReference < SvXMLImportPropertyMapper > xCellImpPropMapper;
@@ -259,6 +264,8 @@ public:
::com::sun::star::container::XNameContainer >
GetStylesContainer( sal_uInt16 nFamily ) const;
virtual ::rtl::OUString GetServiceName( sal_uInt16 nFamily ) const;
+
+ sal_Int32 GetIndex(const sal_Int16 nContextID);
};
class ScXMLMasterStylesContext : public SvXMLStylesContext