Kaydet (Commit) 109fe67c authored tarafından th's avatar th

rtl-string-changes

üst d57b4a3b
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: xmlmetae.cxx,v $ * $RCSfile: xmlmetae.cxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: nn $ $Date: 2001-02-23 19:15:11 $ * last change: $Author: th $ $Date: 2001-05-11 10:44:20 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -338,7 +338,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap ) ...@@ -338,7 +338,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap )
SimpleStringElement( ::rtl::OUString::createFromAscii(PROP_AUTHOR), SimpleStringElement( ::rtl::OUString::createFromAscii(PROP_AUTHOR),
XML_NAMESPACE_META, sXML_initial_creator ); XML_NAMESPACE_META, sXML_initial_creator );
SimpleDateTimeElement( ::rtl::OUString::createFromAscii(PROP_CREATIONDATE), SimpleDateTimeElement( ::rtl::OUString::createFromAscii(PROP_CREATIONDATE),
XML_NAMESPACE_META, sXML_creation_date ); XML_NAMESPACE_META, sXML_creation_date );
// modified... // modified...
SimpleStringElement( ::rtl::OUString::createFromAscii(PROP_MODIFIEDBY), SimpleStringElement( ::rtl::OUString::createFromAscii(PROP_MODIFIEDBY),
...@@ -350,7 +350,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap ) ...@@ -350,7 +350,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap )
SimpleStringElement( ::rtl::OUString::createFromAscii(PROP_PRINTEDBY), SimpleStringElement( ::rtl::OUString::createFromAscii(PROP_PRINTEDBY),
XML_NAMESPACE_META, sXML_printed_by ); XML_NAMESPACE_META, sXML_printed_by );
SimpleDateTimeElement( ::rtl::OUString::createFromAscii(PROP_PRINTDATE), SimpleDateTimeElement( ::rtl::OUString::createFromAscii(PROP_PRINTDATE),
XML_NAMESPACE_META, sXML_print_date ); XML_NAMESPACE_META, sXML_print_date );
// keywords // keywords
// service DocumentInfo contains keywords in a single string, comma separated. // service DocumentInfo contains keywords in a single string, comma separated.
...@@ -358,16 +358,16 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap ) ...@@ -358,16 +358,16 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap )
::rtl::OUString::createFromAscii(PROP_KEYWORDS) ); ::rtl::OUString::createFromAscii(PROP_KEYWORDS) );
rtl::OUString sKeywords; rtl::OUString sKeywords;
aPropVal >>= sKeywords; aPropVal >>= sKeywords;
sal_Int32 nKWCount = sKeywords.getTokenCount( ',' ); if ( sKeywords.getLength() )
if ( sKeywords.getLength() && nKWCount )
{ {
sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_META, sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_META,
::rtl::OUString::createFromAscii(sXML_keywords) ); ::rtl::OUString::createFromAscii(sXML_keywords) );
xHandler->ignorableWhitespace( sWS ); xHandler->ignorableWhitespace( sWS );
xHandler->startElement( sElem, xAttrList ); xHandler->startElement( sElem, xAttrList );
for (sal_Int32 nKW=0; nKW<nKWCount; nKW++) sal_int32 nTokenIndex = 0;
do
{ {
rtl::OUString sKeyword = sKeywords.getToken( nKW, ',' ).trim(); rtl::OUString sKeyword = sKeywords.getToken( 0, ',', nTokenIndex ).trim();
sSubElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_META, sSubElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_META,
::rtl::OUString::createFromAscii(sXML_keyword) ); ::rtl::OUString::createFromAscii(sXML_keyword) );
...@@ -376,6 +376,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap ) ...@@ -376,6 +376,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap )
xHandler->characters( sKeyword ); xHandler->characters( sKeyword );
xHandler->endElement( sSubElem ); xHandler->endElement( sSubElem );
} }
while ( nTokenIndex >= 0 );
xHandler->ignorableWhitespace( sWS ); xHandler->ignorableWhitespace( sWS );
xHandler->endElement( sElem ); xHandler->endElement( sElem );
} }
...@@ -451,7 +452,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap ) ...@@ -451,7 +452,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap )
::rtl::OUString::createFromAscii(PROP_DEFAULTTARGET) ); ::rtl::OUString::createFromAscii(PROP_DEFAULTTARGET) );
rtl::OUString sDefTarget; rtl::OUString sDefTarget;
aPropVal >>= sDefTarget; aPropVal >>= sDefTarget;
if ( sDefTarget.len() ) if ( sDefTarget.getLength() )
{ {
sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_OFFICE, sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_OFFICE,
::rtl::OUString::createFromAscii(sXML_target_frame_name) ); ::rtl::OUString::createFromAscii(sXML_target_frame_name) );
...@@ -488,7 +489,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap ) ...@@ -488,7 +489,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap )
::rtl::OUString::createFromAscii(PROP_RELOADURL) ); ::rtl::OUString::createFromAscii(PROP_RELOADURL) );
rtl::OUString sReloadURL; rtl::OUString sReloadURL;
aPropVal >>= sReloadURL; aPropVal >>= sReloadURL;
if ( sReloadURL.len() ) if ( sReloadURL.getLength() )
{ {
sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_XLINK, sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_XLINK,
::rtl::OUString::createFromAscii(sXML_href) ); ::rtl::OUString::createFromAscii(sXML_href) );
...@@ -524,7 +525,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap ) ...@@ -524,7 +525,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap )
::rtl::OUString::createFromAscii(PROP_TEMPLATEURL) ); ::rtl::OUString::createFromAscii(PROP_TEMPLATEURL) );
rtl::OUString sTplPath; rtl::OUString sTplPath;
aPropVal >>= sTplPath; aPropVal >>= sTplPath;
if ( sTplPath.len() ) if ( sTplPath.getLength() )
{ {
sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_XLINK, sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_XLINK,
::rtl::OUString::createFromAscii(sXML_type) ); ::rtl::OUString::createFromAscii(sXML_type) );
...@@ -551,7 +552,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap ) ...@@ -551,7 +552,7 @@ void SfxXMLMetaExport::Export( const SvXMLNamespaceMap& rNamespaceMap )
::rtl::OUString::createFromAscii(PROP_TEMPLATENAME) ); ::rtl::OUString::createFromAscii(PROP_TEMPLATENAME) );
rtl::OUString sTplName; rtl::OUString sTplName;
aPropVal >>= sTplName; aPropVal >>= sTplName;
if ( sTplName.len() ) if ( sTplName.getLength() )
{ {
sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_XLINK, sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_XLINK,
::rtl::OUString::createFromAscii(sXML_title) ); ::rtl::OUString::createFromAscii(sXML_title) );
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: xmlmetai.cxx,v $ * $RCSfile: xmlmetai.cxx,v $
* *
* $Revision: 1.2 $ * $Revision: 1.3 $
* *
* last change: $Author: sab $ $Date: 2000-11-16 18:19:02 $ * last change: $Author: th $ $Date: 2001-05-11 10:48:38 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -269,35 +269,52 @@ sal_Bool SfxXMLMetaElementContext::ParseISODateTimeString( ...@@ -269,35 +269,52 @@ sal_Bool SfxXMLMetaElementContext::ParseISODateTimeString(
sal_Int32 nMin = 0; sal_Int32 nMin = 0;
sal_Int32 nSec = 0; sal_Int32 nSec = 0;
sal_Int32 nDateTokens = aDateStr.getTokenCount('-'); const sal_Uniocde* pStr;
pStr = aDateStr.getStr();
sal_Int32 nDateTokens = 1;
while ( *pStr )
{
if ( *pStr == '-' )
nDateTokens++;
pStr++;
}
if ( nDateTokens > 3 || aDateStr.getLength() == 0 ) if ( nDateTokens > 3 || aDateStr.getLength() == 0 )
bSuccess = sal_False; bSuccess = sal_False;
else else
{ {
if ( !lcl_GetNumber( aDateStr.getToken( 0, '-' ), nYear, 9999 ) ) sal_int32 n = 0;
if ( !lcl_GetNumber( aDateStr.getToken( 0, '-', n ), nYear, 9999 ) )
bSuccess = sal_False; bSuccess = sal_False;
if ( nDateTokens >= 2 ) if ( nDateTokens >= 2 )
if ( !lcl_GetNumber( aDateStr.getToken( 1, '-' ), nMonth, 12 ) ) if ( !lcl_GetNumber( aDateStr.getToken( 0, '-', n ), nMonth, 12 ) )
bSuccess = sal_False; bSuccess = sal_False;
if ( nDateTokens >= 3 ) if ( nDateTokens >= 3 )
if ( !lcl_GetNumber( aDateStr.getToken( 2, '-' ), nDay, 31 ) ) if ( !lcl_GetNumber( aDateStr.getToken( 0, '-', n ), nDay, 31 ) )
bSuccess = sal_False; bSuccess = sal_False;
} }
if ( aTimeStr.getLength() > 0 ) // time is optional if ( aTimeStr.getLength() > 0 ) // time is optional
{ {
sal_Int32 nTimeTokens = aTimeStr.getTokenCount(':'); pStr = aTimeStr.getStr();
sal_Int32 nTimeTokens = 1;
while ( *pStr )
{
if ( *pStr == ':' )
nTimeTokens++;
pStr++;
}
if ( nTimeTokens > 3 ) if ( nTimeTokens > 3 )
bSuccess = sal_False; bSuccess = sal_False;
else else
{ {
if ( !lcl_GetNumber( aTimeStr.getToken( 0, ':' ), nHour, 23 ) ) sal_int32 n = 0;
if ( !lcl_GetNumber( aTimeStr.getToken( 0, ':', n ), nHour, 23 ) )
bSuccess = sal_False; bSuccess = sal_False;
if ( nTimeTokens >= 2 ) if ( nTimeTokens >= 2 )
if ( !lcl_GetNumber( aTimeStr.getToken( 1, ':' ), nMin, 59 ) ) if ( !lcl_GetNumber( aTimeStr.getToken( 0, ':', n ), nMin, 59 ) )
bSuccess = sal_False; bSuccess = sal_False;
if ( nTimeTokens >= 3 ) if ( nTimeTokens >= 3 )
if ( !lcl_GetNumber( aTimeStr.getToken( 2, ':' ), nSec, 59 ) ) if ( !lcl_GetNumber( aTimeStr.getToken( 0, ':', n ), nSec, 59 ) )
bSuccess = sal_False; bSuccess = sal_False;
} }
} }
...@@ -311,7 +328,7 @@ sal_Bool SfxXMLMetaElementContext::ParseISODateTimeString( ...@@ -311,7 +328,7 @@ sal_Bool SfxXMLMetaElementContext::ParseISODateTimeString(
sal_Bool SfxXMLMetaElementContext::ParseISODurationString( sal_Bool SfxXMLMetaElementContext::ParseISODurationString(
const rtl::OUString& rString, Time& rTime ) const rtl::OUString& rString, Time& rTime )
{ {
rtl::OUString aTrimmed = rString.trim().toUpperCase(); rtl::OUString aTrimmed = rString.trim().toAsciiUpperCase();
const sal_Unicode* pStr = aTrimmed.getStr(); const sal_Unicode* pStr = aTrimmed.getStr();
if ( *(pStr++) != sal_Unicode('P') ) // duration must start with "P" if ( *(pStr++) != sal_Unicode('P') ) // duration must start with "P"
...@@ -786,7 +803,7 @@ void SfxXMLMetaContext::AddUserField( const rtl::OUString& rName, const rtl::OUS ...@@ -786,7 +803,7 @@ void SfxXMLMetaContext::AddUserField( const rtl::OUString& rName, const rtl::OUS
if ( xDocInfo.is() && nUserKeys < xDocInfo->getUserFieldCount() ) if ( xDocInfo.is() && nUserKeys < xDocInfo->getUserFieldCount() )
{ {
// keep default name if none is there // keep default name if none is there
if ( rName.len() ) if ( rName.getLength() )
xDocInfo->setUserFieldName( nUserKeys, rName ); xDocInfo->setUserFieldName( nUserKeys, rName );
xDocInfo->setUserFieldValue( nUserKeys, rContent ); xDocInfo->setUserFieldValue( nUserKeys, rContent );
++nUserKeys; ++nUserKeys;
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: PageMasterImportContext.cxx,v $ * $RCSfile: PageMasterImportContext.cxx,v $
* *
* $Revision: 1.6 $ * $Revision: 1.7 $
* *
* last change: $Author: cl $ $Date: 2001-01-16 16:36:55 $ * last change: $Author: th $ $Date: 2001-05-11 10:50:21 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -214,7 +214,7 @@ void PageStyleContext::FillPropertySet( ...@@ -214,7 +214,7 @@ void PageStyleContext::FillPropertySet(
const uno::Reference<beans::XPropertySet > & rPropSet ) const uno::Reference<beans::XPropertySet > & rPropSet )
{ {
XMLPropStyleContext::FillPropertySet(rPropSet); XMLPropStyleContext::FillPropertySet(rPropSet);
if (sPageUsage.len()) if (sPageUsage.getLength())
{ {
uno::Any aPageUsage; uno::Any aPageUsage;
XMLPMPropHdl_PageStyleLayout aPageUsageHdl; XMLPMPropHdl_PageStyleLayout aPageUsageHdl;
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: PageMasterPropHdl.cxx,v $ * $RCSfile: PageMasterPropHdl.cxx,v $
* *
* $Revision: 1.5 $ * $Revision: 1.6 $
* *
* last change: $Author: mib $ $Date: 2001-03-19 09:40:43 $ * last change: $Author: th $ $Date: 2001-05-11 10:52:52 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -364,11 +364,14 @@ sal_Bool XMLPMPropHdl_Print::importXML( ...@@ -364,11 +364,14 @@ sal_Bool XMLPMPropHdl_Print::importXML(
const SvXMLUnitConverter& rUnitConverter ) const const SvXMLUnitConverter& rUnitConverter ) const
{ {
sal_Unicode cToken = ' '; sal_Unicode cToken = ' ';
sal_Int32 nCount = rStrImpValue.getTokenCount( cToken ); sal_Int32 nTokenIndex = 0;
sal_Bool bFound = sal_False; sal_Bool bFound = sal_False;
for( sal_Int32 nIndex = 0; (nIndex < nCount) && !bFound; nIndex++ ) do
bFound = (sAttrValue == rStrImpValue.getToken( nIndex, cToken )); {
bFound = (sAttrValue == rStrImpValue.getToken( 0, cToken, nTokenIndex ));
}
while ( (nTokenIndex >= 0) && !bFound );
setBOOL( rValue, bFound ); setBOOL( rValue, bFound );
return sal_True; return sal_True;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment