summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSascha Ballach <sab@openoffice.org>2001-04-03 05:06:30 +0000
committerSascha Ballach <sab@openoffice.org>2001-04-03 05:06:30 +0000
commit3c893d1c761aacfc7eefd4b37a7fd588014816c0 (patch)
tree3230eb28872eb16fe633deb7404d15ca9148a3ba /sc
parent2b9f61d28794147fffc6d723978ebfb74aa83850 (diff)
#85616#; add the new settings of database range sort
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/xml/XMLExportDatabaseRanges.cxx44
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx7
-rw-r--r--sc/source/filter/xml/xmlimprt.hxx9
-rw-r--r--sc/source/filter/xml/xmlsorti.cxx75
-rw-r--r--sc/source/filter/xml/xmlsorti.hxx7
5 files changed, 101 insertions, 41 deletions
diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
index 83a1e6d09ffd..5b317a999b76 100644
--- a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
+++ b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLExportDatabaseRanges.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: aw $ $Date: 2001-02-27 14:27:40 $
+ * last change: $Author: sab $ $Date: 2001-04-03 06:06:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -480,50 +480,62 @@ void ScXMLExportDatabaseRanges::WriteFilterDescriptor(const uno::Reference <shee
void ScXMLExportDatabaseRanges::WriteSortDescriptor(const uno::Sequence <beans::PropertyValue> aSortProperties)
{
uno::Sequence <util::SortField> aSortFields;
- sal_Bool bBindFormatsToContent = sal_True;
- sal_Bool bCopyOutputData = sal_False;
- sal_Bool bIsCaseSensitive = sal_False;
- sal_Bool bIsUserListEnabled = sal_False;
+ sal_Bool bBindFormatsToContent (sal_True);
+ sal_Bool bCopyOutputData (sal_False);
+ sal_Bool bIsCaseSensitive (sal_False);
+ sal_Bool bIsUserListEnabled (sal_False);
table::CellAddress aOutputPosition;
sal_Int32 nUserListIndex;
+ lang::Locale aCollatorLocale;
+ rtl::OUString sCollatorAlgorithm;
sal_Int32 nProperties = aSortProperties.getLength();
for (sal_Int32 i = 0; i < nProperties; i++)
{
- if (aSortProperties[i].Name == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_BINDFMT)))
+ if (aSortProperties[i].Name.compareToAscii(SC_UNONAME_BINDFMT) == 0)
{
uno::Any aBindFormatsToContent = aSortProperties[i].Value;
aBindFormatsToContent >>= bBindFormatsToContent;
}
- else if (aSortProperties[i].Name == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_COPYOUT)))
+ else if (aSortProperties[i].Name.compareToAscii(SC_UNONAME_COPYOUT) == 0)
{
uno::Any aCopyOutputData = aSortProperties[i].Value;
aCopyOutputData >>= bCopyOutputData;
}
- else if (aSortProperties[i].Name == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_ISCASE)))
+ else if (aSortProperties[i].Name.compareToAscii(SC_UNONAME_ISCASE) == 0)
{
uno::Any aIsCaseSensitive = aSortProperties[i].Value;
aIsCaseSensitive >>= bIsCaseSensitive;
}
- else if (aSortProperties[i].Name == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_ISULIST)))
+ else if (aSortProperties[i].Name.compareToAscii(SC_UNONAME_ISULIST) == 0)
{
uno::Any aIsUserListEnabled = aSortProperties[i].Value;
aIsUserListEnabled >>= bIsUserListEnabled;
}
- else if (aSortProperties[i].Name == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_OUTPOS)))
+ else if (aSortProperties[i].Name.compareToAscii(SC_UNONAME_OUTPOS) == 0)
{
uno::Any aTempOutputPosition = aSortProperties[i].Value;
aTempOutputPosition >>= aOutputPosition;
}
- else if (aSortProperties[i].Name == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_UINDEX)))
+ else if (aSortProperties[i].Name.compareToAscii(SC_UNONAME_UINDEX) == 0)
{
uno::Any aUserListIndex = aSortProperties[i].Value;
aUserListIndex >>= nUserListIndex;
}
- else if (aSortProperties[i].Name == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_SORTFLD)))
+ else if (aSortProperties[i].Name.compareToAscii(SC_UNONAME_SORTFLD) == 0)
{
uno::Any aTempSortFields = aSortProperties[i].Value;
aTempSortFields >>= aSortFields;
}
+ else if (aSortProperties[i].Name.compareToAscii(SC_UNONAME_COLLLOC) == 0)
+ {
+ uno::Any aTemp = aSortProperties[i].Value;
+ aTemp >>= aCollatorLocale;
+ }
+ else if (aSortProperties[i].Name.compareToAscii(SC_UNONAME_COLLALG) == 0)
+ {
+ uno::Any aTemp = aSortProperties[i].Value;
+ aTemp >>= sCollatorAlgorithm;
+ }
}
sal_Int32 nSortFields = aSortFields.getLength();
if (nSortFields > 0)
@@ -538,6 +550,12 @@ void ScXMLExportDatabaseRanges::WriteSortDescriptor(const uno::Sequence <beans::
}
if (bIsCaseSensitive)
rExport.AddAttributeASCII(XML_NAMESPACE_TABLE, sXML_case_sensitive, sXML_true);
+ if (aCollatorLocale.Language.getLength())
+ rExport.AddAttribute(XML_NAMESPACE_TABLE, sXML_language, aCollatorLocale.Language);
+ if (aCollatorLocale.Country.getLength())
+ rExport.AddAttribute(XML_NAMESPACE_TABLE, sXML_country, aCollatorLocale.Country);
+ if (sCollatorAlgorithm.getLength())
+ rExport.AddAttribute(XML_NAMESPACE_TABLE, sXML_algorithm, sCollatorAlgorithm);
SvXMLElementExport aElemS(rExport, XML_NAMESPACE_TABLE, sXML_sort, sal_True, sal_True);
rExport.CheckAttrList();
for (i = 0; i < nSortFields; i++)
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index a04d6f72d1a0..0cf296c0131b 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlimprt.cxx,v $
*
- * $Revision: 1.48 $
+ * $Revision: 1.49 $
*
- * last change: $Author: sab $ $Date: 2001-03-29 10:51:36 $
+ * last change: $Author: sab $ $Date: 2001-04-03 06:06:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -632,6 +632,9 @@ static __FAR_DATA SvXMLTokenMapEntry aSortAttrTokenMap[] =
{ XML_NAMESPACE_TABLE, sXML_bind_styles_to_content, XML_TOK_SORT_ATTR_BIND_STYLES_TO_CONTENT },
{ XML_NAMESPACE_TABLE, sXML_target_range_address, XML_TOK_SORT_ATTR_TARGET_RANGE_ADDRESS },
{ XML_NAMESPACE_TABLE, sXML_case_sensitive, XML_TOK_SORT_ATTR_CASE_SENSITIVE },
+ { XML_NAMESPACE_TABLE, sXML_language, XML_TOK_SORT_ATTR_LANGUAGE },
+ { XML_NAMESPACE_TABLE, sXML_country, XML_TOK_SORT_ATTR_COUNTRY },
+ { XML_NAMESPACE_TABLE, sXML_algorithm, XML_TOK_SORT_ATTR_ALGORITHM },
XML_TOKEN_MAP_END
};
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index 243ea65f3994..21b2734c25d1 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlimprt.hxx,v $
*
- * $Revision: 1.43 $
+ * $Revision: 1.44 $
*
- * last change: $Author: sab $ $Date: 2001-03-22 17:56:54 $
+ * last change: $Author: sab $ $Date: 2001-04-03 06:06:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -452,7 +452,10 @@ enum ScXMLSortAttrTokens
{
XML_TOK_SORT_ATTR_BIND_STYLES_TO_CONTENT,
XML_TOK_SORT_ATTR_TARGET_RANGE_ADDRESS,
- XML_TOK_SORT_ATTR_CASE_SENSITIVE
+ XML_TOK_SORT_ATTR_CASE_SENSITIVE,
+ XML_TOK_SORT_ATTR_LANGUAGE,
+ XML_TOK_SORT_ATTR_COUNTRY,
+ XML_TOK_SORT_ATTR_ALGORITHM
};
enum ScXMLSortSortByAttrTokens
diff --git a/sc/source/filter/xml/xmlsorti.cxx b/sc/source/filter/xml/xmlsorti.cxx
index 68bfd88246a6..6856b951842e 100644
--- a/sc/source/filter/xml/xmlsorti.cxx
+++ b/sc/source/filter/xml/xmlsorti.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlsorti.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: nn $ $Date: 2001-03-16 14:26:52 $
+ * last change: $Author: sab $ $Date: 2001-04-03 06:06:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,6 +77,9 @@
#ifndef _SC_XMLCONVERTER_HXX
#include "XMLConverter.hxx"
#endif
+#ifndef SC_UNONAMES_HXX
+#include "unonames.hxx"
+#endif
#include <xmloff/xmltkmap.hxx>
#include <xmloff/nmspmap.hxx>
@@ -86,13 +89,6 @@
#endif
#define SC_USERLIST "UserList"
-#define SC_BINDFORMATSTOCONTENT "BindFormatstoContent"
-#define SC_COPYOUTPUTDATA "CopyOutputData"
-#define SC_ISCASESENSITIVE "IsCaseSensitive"
-#define SC_ISUSERLISTENABLED "IsUserListEnabled"
-#define SC_OUTPUTPOSITION "OutputPosition"
-#define SC_USERLISTINDEX "UserListIndex"
-#define SC_SORTFIELDS "SortFields"
using namespace com::sun::star;
@@ -108,6 +104,9 @@ ScXMLSortContext::ScXMLSortContext( ScXMLImport& rImport,
bBindFormatsToContent(sal_True),
bIsCaseSensitive(sal_False),
bCopyOutputData(sal_False),
+ sCountry(),
+ sLanguage(),
+ sAlgorithm(),
SvXMLImportContext( rImport, nPrfx, rLName )
{
pDatabaseRangeContext = pTempDatabaseRangeContext;
@@ -144,10 +143,19 @@ ScXMLSortContext::ScXMLSortContext( ScXMLImport& rImport,
break;
case XML_TOK_SORT_ATTR_CASE_SENSITIVE :
{
- if (sValue.compareToAscii(sXML_false) == 0)
- bIsCaseSensitive = sal_False;
+ if (sValue.compareToAscii(sXML_true) == 0)
+ bIsCaseSensitive = sal_True;
}
break;
+ case XML_TOK_SORT_ATTR_LANGUAGE :
+ sLanguage = sValue;
+ break;
+ case XML_TOK_SORT_ATTR_COUNTRY :
+ sCountry = sValue;
+ break;
+ case XML_TOK_SORT_ATTR_ALGORITHM :
+ sCountry = sAlgorithm;
+ break;
}
}
}
@@ -182,37 +190,62 @@ SvXMLImportContext *ScXMLSortContext::CreateChildContext( USHORT nPrefix,
void ScXMLSortContext::EndElement()
{
- uno::Sequence <beans::PropertyValue> aSortDescriptor(7);
+ sal_Int32 nLangLength(sLanguage.getLength());
+ sal_Int32 nCountryLength(sCountry.getLength());
+ sal_Int32 nAlgoLength(sAlgorithm.getLength());
+ sal_uInt8 i (0);
+ if (nLangLength || nCountryLength)
+ i++;
+ if (nAlgoLength)
+ i++;
+ uno::Sequence <beans::PropertyValue> aSortDescriptor(7 + i);
uno::Any aTemp;
beans::PropertyValue aPropertyValue;
aTemp = ::cppu::bool2any(bBindFormatsToContent);
- aPropertyValue.Name = rtl::OUString::createFromAscii(SC_BINDFORMATSTOCONTENT);
+ aPropertyValue.Name = rtl::OUString::createFromAscii(SC_UNONAME_BINDFMT);
aPropertyValue.Value = aTemp;
aSortDescriptor[0] = aPropertyValue;
aTemp = ::cppu::bool2any(bCopyOutputData);
- aPropertyValue.Name = rtl::OUString::createFromAscii(SC_COPYOUTPUTDATA);
+ aPropertyValue.Name = rtl::OUString::createFromAscii(SC_UNONAME_COPYOUT);
aPropertyValue.Value = aTemp;
aSortDescriptor[1] = aPropertyValue;
aTemp = ::cppu::bool2any(bIsCaseSensitive);
- aPropertyValue.Name = rtl::OUString::createFromAscii(SC_ISCASESENSITIVE);
+ aPropertyValue.Name = rtl::OUString::createFromAscii(SC_UNONAME_ISCASE);
aPropertyValue.Value = aTemp;
aSortDescriptor[2] = aPropertyValue;
aTemp = ::cppu::bool2any(bEnabledUserList);
- aPropertyValue.Name = rtl::OUString::createFromAscii(SC_ISUSERLISTENABLED);
+ aPropertyValue.Name = rtl::OUString::createFromAscii(SC_UNONAME_ISULIST);
aPropertyValue.Value = aTemp;
aSortDescriptor[3] = aPropertyValue;
- aTemp <<= nUserListIndex;
- aPropertyValue.Name = rtl::OUString::createFromAscii(SC_USERLISTINDEX);
+ aTemp <<= aOutputPosition;
+ aPropertyValue.Name = rtl::OUString::createFromAscii(SC_UNONAME_OUTPOS);
aPropertyValue.Value = aTemp;
aSortDescriptor[4] = aPropertyValue;
- aTemp <<= aOutputPosition;
- aPropertyValue.Name = rtl::OUString::createFromAscii(SC_OUTPUTPOSITION);
+ aTemp <<= nUserListIndex;
+ aPropertyValue.Name = rtl::OUString::createFromAscii(SC_UNONAME_UINDEX);
aPropertyValue.Value = aTemp;
aSortDescriptor[5] = aPropertyValue;
aTemp <<= aSortFields;
- aPropertyValue.Name = rtl::OUString::createFromAscii(SC_SORTFIELDS);
+ aPropertyValue.Name = rtl::OUString::createFromAscii(SC_UNONAME_SORTFLD);
aPropertyValue.Value = aTemp;
aSortDescriptor[6] = aPropertyValue;
+ if (nLangLength || nCountryLength)
+ {
+ lang::Locale aLocale;
+ aLocale.Language = sLanguage;
+ aLocale.Country = sCountry;
+ aTemp <<= aLocale;
+ aPropertyValue.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_COLLLOC));
+ aPropertyValue.Value = aTemp;
+ aSortDescriptor[7] = aPropertyValue;
+ }
+ if (nAlgoLength)
+ {
+ aTemp <<= sAlgorithm;
+ aPropertyValue.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_COLLALG));
+ aPropertyValue.Value = aTemp;
+ aSortDescriptor[6 + i] = aPropertyValue;
+ }
pDatabaseRangeContext->SetSortSequence(aSortDescriptor);
}
diff --git a/sc/source/filter/xml/xmlsorti.hxx b/sc/source/filter/xml/xmlsorti.hxx
index a11289d50676..6ffcfa418094 100644
--- a/sc/source/filter/xml/xmlsorti.hxx
+++ b/sc/source/filter/xml/xmlsorti.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlsorti.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: nn $ $Date: 2001-03-16 14:16:31 $
+ * last change: $Author: sab $ $Date: 2001-04-03 06:06:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -84,6 +84,9 @@ class ScXMLSortContext : public SvXMLImportContext
com::sun::star::uno::Sequence <com::sun::star::util::SortField> aSortFields;
com::sun::star::table::CellAddress aOutputPosition;
+ rtl::OUString sCountry;
+ rtl::OUString sLanguage;
+ rtl::OUString sAlgorithm;
sal_Int16 nUserListIndex;
sal_Bool bCopyOutputData : 1;
sal_Bool bBindFormatsToContent : 1;