[Libreoffice-commits] .: 6 commits - sal/inc sal/rtl sal/util sw/source
Lubos Lunak
llunak at kemper.freedesktop.org
Mon Mar 5 04:29:19 PST 2012
sal/inc/rtl/ustring.h | 10 ++
sal/inc/rtl/ustring.hxx | 125 +++++++++++++++++++++++++--
sal/rtl/source/ustring.cxx | 43 +++++++--
sal/util/sal.map | 1
sw/source/filter/ww8/docxattributeoutput.cxx | 12 +-
sw/source/filter/ww8/docxexport.cxx | 78 ++++++++--------
sw/source/filter/ww8/docxexportfilter.cxx | 6 -
sw/source/filter/ww8/hash_wrap.hxx | 4
sw/source/filter/ww8/rtfattributeoutput.cxx | 38 ++++----
sw/source/filter/ww8/rtfexportfilter.cxx | 4
sw/source/filter/ww8/rtfimportfilter.cxx | 6 -
sw/source/filter/ww8/rtfsdrexport.cxx | 2
sw/source/filter/ww8/sortedarray.hxx | 4
sw/source/filter/ww8/writerwordglue.cxx | 2
sw/source/filter/ww8/wrtw8nds.cxx | 54 +++++------
sw/source/filter/ww8/wrtww8.cxx | 60 ++++++------
sw/source/filter/ww8/wrtww8gr.cxx | 5 -
sw/source/filter/ww8/ww8par.cxx | 23 ++--
sw/source/filter/ww8/ww8par3.cxx | 22 ++--
sw/source/filter/ww8/ww8par5.cxx | 28 ++----
sw/source/filter/ww8/ww8toolbar.cxx | 38 ++++----
21 files changed, 351 insertions(+), 214 deletions(-)
New commits:
commit 9db31fc5669abd1e1f8db5e9267c91423b36f223
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Tue Feb 28 13:09:46 2012 +0100
rtl_uString_newFromAscii_WithLength() and use it in OUString
diff --git a/sal/inc/rtl/ustring.h b/sal/inc/rtl/ustring.h
index 03f145b..80703f8 100644
--- a/sal/inc/rtl/ustring.h
+++ b/sal/inc/rtl/ustring.h
@@ -1243,6 +1243,16 @@ SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromStr_WithLength(
SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromAscii(
rtl_uString ** newStr, const sal_Char * value ) SAL_THROW_EXTERN_C();
+/** Allocate a new string that contains a copy of a character array.
+
+ This is equivalent to rtl_uString_newFromAscii(), except that
+ length of the character array is explicitly passed to the function.
+
+ @since 3.6
+ */
+SAL_DLLPUBLIC void SAL_CALL rtl_uString_newFromAscii_WithLength(
+ rtl_uString ** newStr, const sal_Char * value, sal_Int32 len ) SAL_THROW_EXTERN_C();
+
/** Allocate a new string from an array of Unicode code points.
@param newString
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index b74cd37..151e0a2 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -184,7 +184,7 @@ public:
OUString( const char (&literal)[ N ] )
{
pData = 0;
- rtl_string2UString( &pData, literal, N - 1, RTL_TEXTENCODING_ASCII_US, 0 );
+ rtl_uString_newFromAscii_WithLength( &pData, literal, N - 1 );
if (pData == 0) {
#if defined EXCEPTIONS_OFF
SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF");
@@ -338,7 +338,7 @@ public:
template< int N >
OUString& operator=( const char (&literal)[ N ] )
{
- rtl_string2UString( &pData, literal, N - 1, RTL_TEXTENCODING_ASCII_US, 0 );
+ rtl_uString_newFromAscii_WithLength( &pData, literal, N - 1 );
if (pData == 0) {
#if defined EXCEPTIONS_OFF
SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF");
diff --git a/sal/rtl/source/ustring.cxx b/sal/rtl/source/ustring.cxx
index 7c99758..763d9c5 100644
--- a/sal/rtl/source/ustring.cxx
+++ b/sal/rtl/source/ustring.cxx
@@ -471,6 +471,14 @@ void SAL_CALL rtl_uString_newFromAscii( rtl_uString** ppThis,
else
nLen = 0;
+ rtl_uString_newFromAscii_WithLength( ppThis, pCharStr, nLen );
+}
+
+void SAL_CALL rtl_uString_newFromAscii_WithLength( rtl_uString** ppThis,
+ const sal_Char* pCharStr,
+ sal_Int32 nLen )
+ SAL_THROW_EXTERN_C()
+{
if ( !nLen )
{
IMPL_RTL_STRINGNAME( new )( ppThis );
@@ -489,7 +497,7 @@ void SAL_CALL rtl_uString_newFromAscii( rtl_uString** ppThis,
{
/* Check ASCII range */
SAL_WARN_IF( ((unsigned char)*pCharStr) > 127, "rtl.string",
- "rtl_uString_newFromAscii - Found char > 127" );
+ "rtl_uString_newFromAscii_WithLength - Found char > 127" );
*pBuffer = *pCharStr;
pBuffer++;
diff --git a/sal/util/sal.map b/sal/util/sal.map
index d6c3ab1..5ee60b9 100644
--- a/sal/util/sal.map
+++ b/sal/util/sal.map
@@ -305,6 +305,7 @@ UDK_3_0_0 {
rtl_uString_newFromStr;
rtl_uString_newFromStr_WithLength;
rtl_uString_newFromAscii;
+ rtl_uString_newFromAscii_WithLength;
rtl_uString_newFromString;
rtl_uString_newReplace;
rtl_uString_newReplaceStrAt;
commit 282e96fb345761edb9015e8066189c3cbe5b8396
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Mon Mar 5 12:20:00 2012 +0100
remove RTL_CONSTASCII_USTRINGPARAM usage
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 18ade46..1b1de4f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -649,11 +649,11 @@ void DocxAttributeOutput::WriteFFData( const FieldInfos& rInfos )
rtl::OUString sName, sHelp, sToolTip, sSelected;
FieldMarkParamsHelper params( rFieldmark );
- params.extractParam( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMDROPDOWN_LISTENTRY) ), vListEntries );
+ params.extractParam( ODF_FORMDROPDOWN_LISTENTRY, vListEntries );
sName = params.getName();
sal_Int32 nSelectedIndex = 0;
- if ( params.extractParam( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMDROPDOWN_RESULT) ), nSelectedIndex ) )
+ if ( params.extractParam( ODF_FORMDROPDOWN_RESULT, nSelectedIndex ) )
{
if (nSelectedIndex < vListEntries.getLength() )
sSelected = vListEntries[ nSelectedIndex ];
@@ -667,7 +667,7 @@ void DocxAttributeOutput::WriteFFData( const FieldInfos& rInfos )
bool bChecked = false;
FieldMarkParamsHelper params( rFieldmark );
- params.extractParam( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_FORMCHECKBOX_NAME ) ), sName );
+ params.extractParam( ODF_FORMCHECKBOX_NAME, sName );
const sw::mark::ICheckboxFieldmark* pCheckboxFm = dynamic_cast<const sw::mark::ICheckboxFieldmark*>(&rFieldmark);
if ( pCheckboxFm && pCheckboxFm->IsChecked() )
@@ -1102,7 +1102,7 @@ void DocxAttributeOutput::StartRuby( const SwTxtNode& rNode, xub_StrLen nPos, co
rNode.GetLang( nPos ) ) );
OUString sLang( aLocale.Language );
if ( !aLocale.Country.isEmpty() )
- sLang += OUString(RTL_CONSTASCII_USTRINGPARAM( "-" )) + OUString( aLocale.Country );
+ sLang += OUString( "-" ) + OUString( aLocale.Country );
m_pSerializer->singleElementNS( XML_w, XML_lid,
FSNS( XML_w, XML_val ),
OUStringToOString( sLang, RTL_TEXTENCODING_UTF8 ).getStr( ), FSEND );
@@ -2229,7 +2229,7 @@ bool DocxAttributeOutput::WriteOLEChart( const SdrObject* pSdrObj, const Size& r
{
uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
if( xPropSet.is() )
- xChartDoc.set( xPropSet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Model")) ), uno::UNO_QUERY );
+ xChartDoc.set( xPropSet->getPropertyValue( "Model" ), uno::UNO_QUERY );
}
if( xChartDoc.is() )
@@ -2254,7 +2254,7 @@ bool DocxAttributeOutput::WriteOLEChart( const SdrObject* pSdrObj, const Size& r
// should get the unique id
sal_Int32 nID = 1;
- OUString sName(RTL_CONSTASCII_USTRINGPARAM("Object 1"));
+ OUString sName("Object 1");
uno::Reference< container::XNamed > xNamed( xShape, uno::UNO_QUERY );
if( xNamed.is() )
sName = xNamed->getName();
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 6d8930c..5f7c6da 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -80,8 +80,6 @@ using rtl::OUStringBuffer;
using sw::mark::IMark;
-#define S( x ) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )
-
AttributeOutputBase& DocxExport::AttrOutput() const
{
return *m_pAttrOutput;
@@ -313,7 +311,7 @@ rtl::OString DocxExport::OutputChart( uno::Reference< frame::XModel >& xModel, s
.makeStringAndClear();
OUString sId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
- S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" ),
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",
aFileName );
aFileName = rtl::OUStringBuffer()
@@ -324,7 +322,7 @@ rtl::OString DocxExport::OutputChart( uno::Reference< frame::XModel >& xModel, s
::sax_fastparser::FSHelperPtr pChartFS =
m_pFilter->openFragmentStreamWithSerializer( aFileName,
- S( "application/vnd.openxmlformats-officedocument.drawingml.chart" ) );
+ "application/vnd.openxmlformats-officedocument.drawingml.chart" );
oox::drawingml::ChartExport aChartExport( XML_w, pChartFS, xModel, m_pFilter, oox::drawingml::DrawingML::DOCUMENT_DOCX );
aChartExport.ExportContent();
@@ -459,12 +457,12 @@ void DocxExport::InitStyles()
// setup word/styles.xml and the relations + content type
m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
- S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" ),
- S( "styles.xml" ) );
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",
+ "styles.xml" );
::sax_fastparser::FSHelperPtr pStylesFS =
- m_pFilter->openFragmentStreamWithSerializer( S( "word/styles.xml" ),
- S( "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" ) );
+ m_pFilter->openFragmentStreamWithSerializer( "word/styles.xml",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" );
// switch the serializer to redirect the output to word/styles.xml
m_pAttrOutput->SetSerializer( pStylesFS );
@@ -482,12 +480,12 @@ void DocxExport::WriteFootnotesEndnotes()
{
// setup word/styles.xml and the relations + content type
m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
- S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" ),
- S( "footnotes.xml" ) );
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",
+ "footnotes.xml" );
::sax_fastparser::FSHelperPtr pFootnotesFS =
- m_pFilter->openFragmentStreamWithSerializer( S( "word/footnotes.xml" ),
- S( "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" ) );
+ m_pFilter->openFragmentStreamWithSerializer( "word/footnotes.xml",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" );
// switch the serializer to redirect the output to word/footnotes.xml
m_pAttrOutput->SetSerializer( pFootnotesFS );
@@ -503,12 +501,12 @@ void DocxExport::WriteFootnotesEndnotes()
{
// setup word/styles.xml and the relations + content type
m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
- S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" ),
- S( "endnotes.xml" ) );
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",
+ "endnotes.xml" );
::sax_fastparser::FSHelperPtr pEndnotesFS =
- m_pFilter->openFragmentStreamWithSerializer( S( "word/endnotes.xml" ),
- S( "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" ) );
+ m_pFilter->openFragmentStreamWithSerializer( "word/endnotes.xml",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" );
// switch the serializer to redirect the output to word/endnotes.xml
m_pAttrOutput->SetSerializer( pEndnotesFS );
@@ -526,12 +524,12 @@ void DocxExport::WritePostitFields()
if ( m_pAttrOutput->HasPostitFields() )
{
m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
- S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" ),
- S( "comments.xml" ) );
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",
+ "comments.xml" );
::sax_fastparser::FSHelperPtr pPostitFS =
- m_pFilter->openFragmentStreamWithSerializer( S( "word/comments.xml" ),
- S( "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" ) );
+ m_pFilter->openFragmentStreamWithSerializer( "word/comments.xml",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" );
pPostitFS->startElementNS( XML_w, XML_comments, MainXmlNamespaces( pPostitFS ));
m_pAttrOutput->SetSerializer( pPostitFS );
@@ -547,11 +545,11 @@ void DocxExport::WriteNumbering()
return; // no numbering is used
m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
- S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" ),
- S( "numbering.xml" ) );
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",
+ "numbering.xml" );
- ::sax_fastparser::FSHelperPtr pNumberingFS = m_pFilter->openFragmentStreamWithSerializer( S( "word/numbering.xml" ),
- S( "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" ) );
+ ::sax_fastparser::FSHelperPtr pNumberingFS = m_pFilter->openFragmentStreamWithSerializer( "word/numbering.xml",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" );
// switch the serializer to redirect the output to word/nubering.xml
m_pAttrOutput->SetSerializer( pNumberingFS );
@@ -582,11 +580,11 @@ void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char*
.makeStringAndClear() );
aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
- S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" ),
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",
aName );
pFS = m_pFilter->openFragmentStreamWithSerializer( OUStringBuffer().appendAscii(RTL_CONSTASCII_STRINGPARAM("word/")).append( aName ).makeStringAndClear(),
- S( "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" ) );
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" );
pFS->startElementNS( XML_w, XML_hdr, MainXmlNamespaces( pFS ));
}
@@ -595,11 +593,11 @@ void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char*
OUString aName( OUStringBuffer().appendAscii(RTL_CONSTASCII_STRINGPARAM("footer")).append( ++m_nFooters ).appendAscii(RTL_CONSTASCII_STRINGPARAM(".xml")).makeStringAndClear() );
aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
- S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" ),
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",
aName );
pFS = m_pFilter->openFragmentStreamWithSerializer( OUStringBuffer().appendAscii(RTL_CONSTASCII_STRINGPARAM("word/")).append( aName ).makeStringAndClear(),
- S( "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" ) );
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" );
pFS->startElementNS( XML_w, XML_ftr, MainXmlNamespaces( pFS ));
}
@@ -636,12 +634,12 @@ void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char*
void DocxExport::WriteFonts()
{
m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
- S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" ),
- S( "fontTable.xml" ) );
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",
+ "fontTable.xml" );
::sax_fastparser::FSHelperPtr pFS = m_pFilter->openFragmentStreamWithSerializer(
- S( "word/fontTable.xml" ),
- S( "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" ) );
+ "word/fontTable.xml",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" );
pFS->startElementNS( XML_w, XML_fonts,
FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
@@ -681,12 +679,12 @@ void DocxExport::WriteSettings()
return;
m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
- S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" ),
- S( "settings.xml" ) );
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",
+ "settings.xml" );
::sax_fastparser::FSHelperPtr pFS = m_pFilter->openFragmentStreamWithSerializer(
- S( "word/settings.xml" ),
- S( "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" ) );
+ "word/settings.xml",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" );
pFS->startElementNS( XML_w, XML_settings,
FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
@@ -812,12 +810,12 @@ DocxExport::DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument, SwPaM *pCur
WriteProperties( );
// relations for the document
- m_pFilter->addRelation( S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" ),
- S( "word/document.xml" ) );
+ m_pFilter->addRelation( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",
+ "word/document.xml" );
// the actual document
- m_pDocumentFS = m_pFilter->openFragmentStreamWithSerializer( S( "word/document.xml" ),
- S( "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" ) );
+ m_pDocumentFS = m_pFilter->openFragmentStreamWithSerializer( "word/document.xml",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" );
// the DrawingML access
m_pDrawingML = new oox::drawingml::DrawingML( m_pDocumentFS, m_pFilter, oox::drawingml::DrawingML::DOCUMENT_DOCX );
diff --git a/sw/source/filter/ww8/docxexportfilter.cxx b/sw/source/filter/ww8/docxexportfilter.cxx
index a780c5c..83bc819 100644
--- a/sw/source/filter/ww8/docxexportfilter.cxx
+++ b/sw/source/filter/ww8/docxexportfilter.cxx
@@ -42,8 +42,6 @@ using namespace ::comphelper;
using namespace ::com::sun::star;
using ::rtl::OUString;
-#define S( x ) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )
-
DocxExportFilter::DocxExportFilter( const uno::Reference< uno::XComponentContext >& xContext )
: oox::core::XmlFilterBase( xContext )
{
@@ -107,7 +105,7 @@ bool DocxExportFilter::exportDocument()
OUString DocxExport_getImplementationName()
{
- return OUString( RTL_CONSTASCII_USTRINGPARAM( IMPL_NAME ) );
+ return OUString( IMPL_NAME );
}
OUString DocxExportFilter::implGetImplementationName() const
@@ -117,7 +115,7 @@ OUString DocxExportFilter::implGetImplementationName() const
uno::Sequence< OUString > SAL_CALL DocxExport_getSupportedServiceNames() throw()
{
- const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.ExportFilter" ) );
+ const OUString aServiceName( "com.sun.star.document.ExportFilter" );
const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
return aSeq;
}
diff --git a/sw/source/filter/ww8/hash_wrap.hxx b/sw/source/filter/ww8/hash_wrap.hxx
index a27d1b0..8031cf0 100644
--- a/sw/source/filter/ww8/hash_wrap.hxx
+++ b/sw/source/filter/ww8/hash_wrap.hxx
@@ -83,12 +83,12 @@ namespace ww
{
if (!bBroken)
{
- sError = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ sError =
"WW8: Duplicate in list, almost certainly don't "
"want that!\n"
"(You will not see this message again unless you "
"restart)\n"
- "Extra entries are...\n"));
+ "Extra entries are...\n";
bBroken=true;
}
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index b9afd1b..87b4ebc 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1592,7 +1592,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
uno::Reference<beans::XPropertySet> xPropSet(xControlModel, uno::UNO_QUERY);
uno::Reference<beans::XPropertySetInfo> xPropSetInfo = xPropSet->getPropertySetInfo();
OUString sName;
- if (xInfo->supportsService(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.CheckBox"))))
+ if (xInfo->supportsService("com.sun.star.form.component.CheckBox"))
{
m_aRun->append(OUStringToOString(OUString(FieldString(ww::eFORMCHECKBOX)), m_rExport.eCurrentEncoding));
@@ -1602,7 +1602,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFHPS "20");
OUString aStr;
- sName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name"));
+ sName = "Name";
if (xPropSetInfo->hasPropertyByName(sName))
{
xPropSet->getPropertyValue(sName) >>= aStr;
@@ -1611,7 +1611,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_aRun->append('}');
}
- sName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HelpText"));
+ sName = "HelpText";
if (xPropSetInfo->hasPropertyByName(sName))
{
xPropSet->getPropertyValue(sName) >>= aStr;
@@ -1621,7 +1621,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_aRun->append('}');
}
- sName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HelpF1Text"));
+ sName = "HelpF1Text";
if (xPropSetInfo->hasPropertyByName(sName))
{
xPropSet->getPropertyValue(sName) >>= aStr;
@@ -1632,10 +1632,10 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
}
sal_Int16 nTemp = 0;
- xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultState"))) >>= nTemp;
+ xPropSet->getPropertyValue("DefaultState") >>= nTemp;
m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFDEFRES);
m_aRun->append((sal_Int32)nTemp);
- xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("State"))) >>= nTemp;
+ xPropSet->getPropertyValue("State") >>= nTemp;
m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFRES);
m_aRun->append((sal_Int32)nTemp);
@@ -1644,7 +1644,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
// field result is empty, ffres already contains the form result
m_aRun->append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
}
- else if (xInfo->supportsService(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.TextField"))))
+ else if (xInfo->supportsService("com.sun.star.form.component.TextField"))
{
OStringBuffer aBuf;
OString aStr;
@@ -1654,12 +1654,12 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_aRun->append(OUStringToOString(OUString(FieldString(ww::eFORMTEXT)), m_rExport.eCurrentEncoding));
m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_DATAFIELD " ");
for (int i = 0; i < 8; i++) aBuf.append((sal_Char)0x00);
- xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name"))) >>= aTmp;
+ xPropSet->getPropertyValue("Name") >>= aTmp;
aStr = OUStringToOString(aTmp, m_rExport.eCurrentEncoding);
aBuf.append((sal_Char)aStr.getLength());
aBuf.append(aStr);
aBuf.append((sal_Char)0x00);
- xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultText"))) >>= aTmp;
+ xPropSet->getPropertyValue("DefaultText") >>= aTmp;
aStr = OUStringToOString(aTmp, m_rExport.eCurrentEncoding);
aBuf.append((sal_Char)aStr.getLength());
aBuf.append(aStr);
@@ -1670,11 +1670,11 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_aRun->append(m_rExport.OutHex(*pStr, 2));
m_aRun->append('}');
m_aRun->append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
- xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text"))) >>= aTmp;
+ xPropSet->getPropertyValue("Text") >>= aTmp;
m_aRun->append(OUStringToOString(aTmp, m_rExport.eCurrentEncoding));
m_aRun->append('}');
m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{");
- sName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HelpText"));
+ sName = "HelpText";
if (xPropSetInfo->hasPropertyByName(sName))
{
xPropSet->getPropertyValue(sName) >>= aTmp;
@@ -1684,7 +1684,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_aRun->append('}');
}
- sName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HelpF1Text"));
+ sName = "HelpF1Text";
if (xPropSetInfo->hasPropertyByName(sName))
{
xPropSet->getPropertyValue(sName) >>= aTmp;
@@ -1695,7 +1695,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
}
m_aRun->append("}");
}
- else if (xInfo->supportsService(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.ListBox"))))
+ else if (xInfo->supportsService("com.sun.star.form.component.ListBox"))
{
OUString aStr;
uno::Sequence<sal_Int16> aIntSeq;
@@ -1706,7 +1706,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFTYPE "2"); // 2 = list
m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX);
- xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultSelection"))) >>= aIntSeq;
+ xPropSet->getPropertyValue("DefaultSelection") >>= aIntSeq;
if( aIntSeq.getLength() )
{
m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFDEFRES);
@@ -1714,7 +1714,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_aRun->append((sal_Int32)aIntSeq[0]);
}
- xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SelectedItems"))) >>= aIntSeq;
+ xPropSet->getPropertyValue("SelectedItems") >>= aIntSeq;
if( aIntSeq.getLength() )
{
m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFRES);
@@ -1722,7 +1722,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_aRun->append((sal_Int32)aIntSeq[0]);
}
- sName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name"));
+ sName = "Name";
if (xPropSetInfo->hasPropertyByName(sName))
{
xPropSet->getPropertyValue(sName) >>= aStr;
@@ -1731,7 +1731,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_aRun->append('}');
}
- sName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HelpText"));
+ sName = "HelpText";
if (xPropSetInfo->hasPropertyByName(sName))
{
xPropSet->getPropertyValue(sName) >>= aStr;
@@ -1741,7 +1741,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_aRun->append('}');
}
- sName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HelpF1Text"));
+ sName = "HelpF1Text";
if (xPropSetInfo->hasPropertyByName(sName))
{
xPropSet->getPropertyValue(sName) >>= aStr;
@@ -1752,7 +1752,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
}
- xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StringItemList"))) >>= aStrSeq;
+ xPropSet->getPropertyValue("StringItemList") >>= aStrSeq;
sal_uInt32 nListItems = aStrSeq.getLength();
for (sal_uInt32 i = 0; i < nListItems; i++)
m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFL " ")
diff --git a/sw/source/filter/ww8/rtfexportfilter.cxx b/sw/source/filter/ww8/rtfexportfilter.cxx
index b417f30..72bec50 100644
--- a/sw/source/filter/ww8/rtfexportfilter.cxx
+++ b/sw/source/filter/ww8/rtfexportfilter.cxx
@@ -123,12 +123,12 @@ void RtfExportFilter::setSourceDocument( const uno::Reference< lang::XComponent
OUString RtfExport_getImplementationName()
{
- return OUString( RTL_CONSTASCII_USTRINGPARAM( IMPL_NAME_RTFEXPORT ) );
+ return OUString( IMPL_NAME_RTFEXPORT );
}
uno::Sequence< OUString > SAL_CALL RtfExport_getSupportedServiceNames() throw()
{
- const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.ExportFilter" ) );
+ const OUString aServiceName( "com.sun.star.document.ExportFilter" );
const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
return aSeq;
}
diff --git a/sw/source/filter/ww8/rtfimportfilter.cxx b/sw/source/filter/ww8/rtfimportfilter.cxx
index e3b553b..284e645 100644
--- a/sw/source/filter/ww8/rtfimportfilter.cxx
+++ b/sw/source/filter/ww8/rtfimportfilter.cxx
@@ -84,7 +84,7 @@ sal_Bool RtfImportFilter::filter( const uno::Sequence< beans::PropertyValue >& a
OUString sTemp;
for ( sal_Int32 i = 0; i < aDescriptor.getLength(); i++ )
{
- if( aDescriptor[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("URL")) )
+ if( aDescriptor[i].Name == "URL" )
{
aDescriptor[i].Value >>= sTemp;
aURL = sTemp;
@@ -114,12 +114,12 @@ void RtfImportFilter::setTargetDocument( const uno::Reference< lang::XComponent
OUString RtfImport_getImplementationName()
{
- return OUString( RTL_CONSTASCII_USTRINGPARAM( IMPL_NAME_RTFIMPORT ) );
+ return OUString( IMPL_NAME_RTFIMPORT );
}
uno::Sequence< OUString > SAL_CALL RtfImport_getSupportedServiceNames() throw()
{
- const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.ImportFilter" ) );
+ const OUString aServiceName( "com.sun.star.document.ImportFilter" );
const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
return aSeq;
}
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index 3ea0613..0916342 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -432,7 +432,7 @@ void RtfSdrExport::impl_writeGraphic()
uno::Reference<drawing::XShape> xShape = GetXShapeForSdrObject(const_cast<SdrObject*>(m_pSdrObject));
uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
OUString sGraphicURL;
- xPropertySet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL"))) >>= sGraphicURL;
+ xPropertySet->getPropertyValue("GraphicURL") >>= sGraphicURL;
OString aURLBS(OUStringToOString(sGraphicURL, RTL_TEXTENCODING_UTF8));
const char aURLBegin[] = "vnd.sun.star.GraphicObject:";
Graphic aGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic();
diff --git a/sw/source/filter/ww8/sortedarray.hxx b/sw/source/filter/ww8/sortedarray.hxx
index 3beca59..7a559b5 100644
--- a/sw/source/filter/ww8/sortedarray.hxx
+++ b/sw/source/filter/ww8/sortedarray.hxx
@@ -80,12 +80,12 @@ namespace ww
{
if (!bBroken)
{
- sError = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ sError =
"WW8: Duplicate in list, almost certainly don't "
"want that!\n"
"(You will not see this message again unless you "
"restart)\n"
- "Extra entries are...\n"));
+ "Extra entries are...\n";
bBroken=true;
}
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index 3b289d9..de82476 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -774,7 +774,7 @@ namespace sw
SwapQuotesInField(rParams);
// Force to Japanese when finding one of 'geaE'
- rtl::OUString sJChars(RTL_CONSTASCII_USTRINGPARAM("geE"));
+ rtl::OUString sJChars( "geE" );
bool bForceJapanese = ( STRING_NOTFOUND != rParams.SearchChar( sJChars.getStr() ) );
if ( bForceJapanese )
{
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 998197d..53f95ad 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -122,17 +122,17 @@ static String lcl_getFieldCode( const IFieldmark* pFieldmark ) {
if ( !pFieldmark) {
return String();
- } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ) {
+ } else if ( pFieldmark->GetFieldname( ) == ODF_FORMTEXT ) {
return String::CreateFromAscii(" FORMTEXT ");
- } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMDROPDOWN ) ) ) {
+ } else if ( pFieldmark->GetFieldname( ) == ODF_FORMDROPDOWN ) {
return String::CreateFromAscii(" FORMDROPDOWN ");
- } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMCHECKBOX ) ) ) {
+ } else if ( pFieldmark->GetFieldname( ) == ODF_FORMCHECKBOX ) {
return String::CreateFromAscii(" FORMCHECKBOX ");
- } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_TOC ) ) ) {
+ } else if ( pFieldmark->GetFieldname( ) == ODF_TOC ) {
return String::CreateFromAscii(" TOC ");
- } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_HYPERLINK ) ) ) {
+ } else if ( pFieldmark->GetFieldname( ) == ODF_HYPERLINK ) {
return String::CreateFromAscii(" HYPERLINK ");
- } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_PAGEREF ) ) ) {
+ } else if ( pFieldmark->GetFieldname( ) == ODF_PAGEREF ) {
return String::CreateFromAscii(" PAGEREF ");
} else {
return pFieldmark->GetFieldname();
@@ -143,17 +143,17 @@ ww::eField lcl_getFieldId( const IFieldmark* pFieldmark ) {
OSL_ENSURE(pFieldmark!=NULL, "where is my fieldmark???");
if ( !pFieldmark ) {
return ww::eUNKNOWN;
- } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ) {
+ } else if ( pFieldmark->GetFieldname( ) == ODF_FORMTEXT ) {
return ww::eFORMTEXT;
- } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMDROPDOWN ) ) ) {
+ } else if ( pFieldmark->GetFieldname( ) == ODF_FORMDROPDOWN ) {
return ww::eFORMDROPDOWN;
- } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMCHECKBOX ) ) ) {
+ } else if ( pFieldmark->GetFieldname( ) == ODF_FORMCHECKBOX ) {
return ww::eFORMCHECKBOX;
- } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_TOC ) ) ) {
+ } else if ( pFieldmark->GetFieldname( ) == ODF_TOC ) {
return ww::eTOC;
- } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_HYPERLINK ) ) ) {
+ } else if ( pFieldmark->GetFieldname( ) == ODF_HYPERLINK ) {
return ww::eHYPERLINK;
- } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_PAGEREF ) ) ) {
+ } else if ( pFieldmark->GetFieldname( ) == ODF_PAGEREF ) {
return ww::ePAGEREF;
} else {
return ww::eUNKNOWN;
@@ -1839,14 +1839,13 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
- if ( pFieldmark && pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) )
+ if ( pFieldmark && pFieldmark->GetFieldname() == ODF_FORMTEXT )
AppendBookmark( pFieldmark->GetName(), false );
ww::eField eFieldId = lcl_getFieldId( pFieldmark );
String sCode = lcl_getFieldCode( pFieldmark );
- if ( pFieldmark && pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_UNHANDLED ) ) )
+ if ( pFieldmark && pFieldmark->GetFieldname() == ODF_UNHANDLED )
{
- IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_ID_PARAM )) );
+ IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find( ODF_ID_PARAM );
if ( it != pFieldmark->GetParameters()->end() )
{
rtl::OUString sFieldId;
@@ -1854,8 +1853,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
eFieldId = (ww::eField)sFieldId.toInt32();
}
- it = pFieldmark->GetParameters()->find(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_CODE_PARAM )) );
+ it = pFieldmark->GetParameters()->find( ODF_CODE_PARAM );
if ( it != pFieldmark->GetParameters()->end() )
{
rtl::OUString sOUCode;
@@ -1864,17 +1862,16 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
}
}
OutputField( NULL, eFieldId, sCode, WRITEFIELD_START | WRITEFIELD_CMD_START );
- if ( pFieldmark && pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) )
+ if ( pFieldmark && pFieldmark->GetFieldname( ) == ODF_FORMTEXT )
WriteFormData( *pFieldmark );
- else if ( pFieldmark && pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_HYPERLINK ) ) )
+ else if ( pFieldmark && pFieldmark->GetFieldname( ) == ODF_HYPERLINK )
WriteHyperlinkData( *pFieldmark );
OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CMD_END );
- if ( pFieldmark && pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_UNHANDLED ) ) )
+ if ( pFieldmark && pFieldmark->GetFieldname() == ODF_UNHANDLED )
{
// Check for the presence of a linked OLE object
- IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_OLE_PARAM )) );
+ IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find( ODF_OLE_PARAM );
if ( it != pFieldmark->GetParameters()->end() )
{
rtl::OUString sOleId;
@@ -1892,10 +1889,9 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDEND??" );
ww::eField eFieldId = lcl_getFieldId( pFieldmark );
- if ( pFieldmark && pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_UNHANDLED ) ) )
+ if ( pFieldmark && pFieldmark->GetFieldname() == ODF_UNHANDLED )
{
- IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_ID_PARAM )) );
+ IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find( ODF_ID_PARAM );
if ( it != pFieldmark->GetParameters()->end() )
{
rtl::OUString sFieldId;
@@ -1905,7 +1901,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
}
OutputField( NULL, eFieldId, String(), WRITEFIELD_CLOSE );
- if ( pFieldmark && pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) )
+ if ( pFieldmark && pFieldmark->GetFieldname() == ODF_FORMTEXT )
AppendBookmark( pFieldmark->GetName(), false );
}
else if ( ch == CH_TXT_ATR_FORMELEMENT )
@@ -1914,8 +1910,8 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
- bool isDropdownOrCheckbox = pFieldmark && (pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMDROPDOWN ) ) ||
- pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMCHECKBOX ) ));
+ bool isDropdownOrCheckbox = pFieldmark && (pFieldmark->GetFieldname( ) == ODF_FORMDROPDOWN ||
+ pFieldmark->GetFieldname( ) == ODF_FORMCHECKBOX );
if ( isDropdownOrCheckbox )
AppendBookmark( pFieldmark->GetName(), 0 );
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index d7170af..048a547 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3464,21 +3464,21 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark )
const ::sw::mark::ICheckboxFieldmark* pAsCheckbox = dynamic_cast< const ::sw::mark::ICheckboxFieldmark* >( pFieldmark );
- OSL_ENSURE(rFieldmark.GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ||
- rFieldmark.GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMDROPDOWN ) ) ||
- rFieldmark.GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMCHECKBOX ) ), "Unknown field type!!!");
- if ( ! ( rFieldmark.GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ||
- rFieldmark.GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMDROPDOWN ) ) ||
- rFieldmark.GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMCHECKBOX ) ) ) )
+ OSL_ENSURE(rFieldmark.GetFieldname() == ODF_FORMTEXT ||
+ rFieldmark.GetFieldname() == ODF_FORMDROPDOWN ||
+ rFieldmark.GetFieldname() == ODF_FORMCHECKBOX, "Unknown field type!!!");
+ if ( ! ( rFieldmark.GetFieldname() == ODF_FORMTEXT ||
+ rFieldmark.GetFieldname() == ODF_FORMDROPDOWN ||
+ rFieldmark.GetFieldname() == ODF_FORMCHECKBOX ) )
return;
int type = 0; // TextFieldmark
if ( pAsCheckbox )
type = 1;
- if ( rFieldmark.GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMDROPDOWN ) ) )
+ if ( rFieldmark.GetFieldname() == ODF_FORMDROPDOWN )
type=2;
- ::sw::mark::IFieldmark::parameter_map_t::const_iterator pNameParameter = rFieldmark.GetParameters()->find(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")));
+ ::sw::mark::IFieldmark::parameter_map_t::const_iterator pNameParameter = rFieldmark.GetParameters()->find("name");
::rtl::OUString ffname;
if(pNameParameter != rFieldmark.GetParameters()->end())
pNameParameter->second >>= ffname;
@@ -3518,7 +3518,7 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark )
ffres = 1;
else if ( type == 2 )
{
- ::sw::mark::IFieldmark::parameter_map_t::const_iterator pResParameter = rFieldmark.GetParameters()->find(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMDROPDOWN_RESULT)));
+ ::sw::mark::IFieldmark::parameter_map_t::const_iterator pResParameter = rFieldmark.GetParameters()->find(ODF_FORMDROPDOWN_RESULT);
if(pResParameter != rFieldmark.GetParameters()->end())
pResParameter->second >>= ffres;
else
@@ -3531,7 +3531,7 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark )
{
aFldHeader.bits |= 0x8000; // ffhaslistbox
const ::sw::mark::IFieldmark::parameter_map_t* const pParameters = rFieldmark.GetParameters();
- ::sw::mark::IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMDROPDOWN_LISTENTRY)));
+ ::sw::mark::IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(ODF_FORMDROPDOWN_LISTENTRY);
if(pListEntries != pParameters->end())
{
uno::Sequence< ::rtl::OUString > vListEntries;
@@ -3769,26 +3769,26 @@ const NfKeywordTable & MSWordExportBase::GetNfKeywordTable()
{
pKeyMap.reset(new NfKeywordTable);
NfKeywordTable & rKeywordTable = *pKeyMap;
- rKeywordTable[NF_KEY_D] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("d"));
- rKeywordTable[NF_KEY_DD] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dd"));
- rKeywordTable[NF_KEY_DDD] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ddd"));
- rKeywordTable[NF_KEY_DDDD] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dddd"));
- rKeywordTable[NF_KEY_M] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("M"));
- rKeywordTable[NF_KEY_MM] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MM"));
- rKeywordTable[NF_KEY_MMM] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MMM"));
- rKeywordTable[NF_KEY_MMMM] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MMMM"));
- rKeywordTable[NF_KEY_NN] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ddd"));
- rKeywordTable[NF_KEY_NNN] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dddd"));
- rKeywordTable[NF_KEY_NNNN] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dddd"));
- rKeywordTable[NF_KEY_YY] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("yy"));
- rKeywordTable[NF_KEY_YYYY] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("yyyy"));
- rKeywordTable[NF_KEY_H] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("H"));
- rKeywordTable[NF_KEY_HH] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HH"));
- rKeywordTable[NF_KEY_MI] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("m"));
- rKeywordTable[NF_KEY_MMI] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("mm"));
- rKeywordTable[NF_KEY_S] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("s"));
- rKeywordTable[NF_KEY_SS] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ss"));
- rKeywordTable[NF_KEY_AMPM] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AM/PM"));
+ rKeywordTable[NF_KEY_D] = "d";
+ rKeywordTable[NF_KEY_DD] = "dd";
+ rKeywordTable[NF_KEY_DDD] = "ddd";
+ rKeywordTable[NF_KEY_DDDD] = "dddd";
+ rKeywordTable[NF_KEY_M] = "M";
+ rKeywordTable[NF_KEY_MM] = "MM";
+ rKeywordTable[NF_KEY_MMM] = "MMM";
+ rKeywordTable[NF_KEY_MMMM] = "MMMM";
+ rKeywordTable[NF_KEY_NN] = "ddd";
+ rKeywordTable[NF_KEY_NNN] = "dddd";
+ rKeywordTable[NF_KEY_NNNN] = "dddd";
+ rKeywordTable[NF_KEY_YY] = "yy";
+ rKeywordTable[NF_KEY_YYYY] = "yyyy";
+ rKeywordTable[NF_KEY_H] = "H";
+ rKeywordTable[NF_KEY_HH] = "HH";
+ rKeywordTable[NF_KEY_MI] = "m";
+ rKeywordTable[NF_KEY_MMI] = "mm";
+ rKeywordTable[NF_KEY_S] = "s";
+ rKeywordTable[NF_KEY_SS] = "ss";
+ rKeywordTable[NF_KEY_AMPM] = "AM/PM";
}
return *pKeyMap;
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index b1d7bca..6524abc 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -274,7 +274,7 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode )
GetOLEExp().ExportOLEObject( aObjRef, *xOleStg );
if ( nAspect == embed::Aspects::MSOLE_ICON )
{
- ::rtl::OUString aObjInfo( RTL_CONSTASCII_USTRINGPARAM( "\3ObjInfo" ) );
+ ::rtl::OUString aObjInfo( "\3ObjInfo" );
if ( !xOleStg->IsStream( aObjInfo ) )
{
const sal_uInt8 pObjInfoData[] = { 0x40, 0x00, 0x03, 0x00 };
@@ -353,8 +353,7 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode )
void WW8Export::OutputLinkedOLE( const rtl::OUString& rOleId )
{
uno::Reference< embed::XStorage > xDocStg = pDoc->GetDocStorage();
- uno::Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OLELinks")), embed::ElementModes::READ );
+ uno::Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement( "OLELinks", embed::ElementModes::READ );
SotStorageRef xObjSrc = SotStorage::OpenOLEStorage( xOleStg, rOleId, STREAM_READ );
SotStorageRef xObjStg = GetWriter().GetStorage().OpenSotStorage(
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 84d3752..7f7354f 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -216,13 +216,13 @@ bool BasicProjImportHelper::import( const uno::Reference< io::XInputStream >& rx
rtl::OUString BasicProjImportHelper::getProjectName()
{
- rtl::OUString sProjName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
+ rtl::OUString sProjName( "Standard" );
uno::Reference< beans::XPropertySet > xProps( mrDocShell.GetModel(), uno::UNO_QUERY );
if ( xProps.is() )
{
try
{
- uno::Reference< script::vba::XVBACompatibility > xVBA( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicLibraries" ) ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< script::vba::XVBACompatibility > xVBA( xProps->getPropertyValue( "BasicLibraries" ), uno::UNO_QUERY_THROW );
sProjName = xVBA->getProjectName();
}
@@ -771,7 +771,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt,
{
fExtraTextRotation /= 100.0;
SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
- const rtl::OUString sTextRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextRotateAngle" ) );
+ const rtl::OUString sTextRotateAngle( "TextRotateAngle" );
com::sun::star::beans::PropertyValue aPropVal;
aPropVal.Name = sTextRotateAngle;
aPropVal.Value <<= fExtraTextRotation;
@@ -1590,10 +1590,9 @@ void SwWW8ImplReader::ImportDop()
sal_Bool bValue = false;
if (xInfo.is())
{
- if (xInfo->hasPropertyByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ApplyFormDesignMode"))))
+ if (xInfo->hasPropertyByName("ApplyFormDesignMode"))
{
- xDocProps->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ApplyFormDesignMode")),
- cppu::bool2any(bValue));
+ xDocProps->setPropertyValue("ApplyFormDesignMode", cppu::bool2any(bValue));
}
}
}
@@ -4307,7 +4306,7 @@ bool SwWW8ImplReader::ReadGlobalTemplateSettings( const rtl::OUString& sCreatedF
uno::Sequence< rtl::OUString > sGlobalTemplates;
// first get the autoload addins in the directory STARTUP
- uno::Reference< ucb::XSimpleFileAccess > xSFA( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ), uno::UNO_QUERY_THROW );
+ uno::Reference< ucb::XSimpleFileAccess > xSFA( ::comphelper::getProcessServiceFactory()->createInstance( "com.sun.star.ucb.SimpleFileAccess" ), uno::UNO_QUERY_THROW );
if( xSFA->isFolder( aAddinPath ) )
sGlobalTemplates = xSFA->getFolderContents( aAddinPath, sal_False );
@@ -4334,7 +4333,7 @@ bool SwWW8ImplReader::ReadGlobalTemplateSettings( const rtl::OUString& sCreatedF
aBasicImporter.import( mpDocShell->GetMedium()->GetInputStream() );
lcl_createTemplateToProjectEntry( xPrjNameCache, aURL, aBasicImporter.getProjectName() );
// Read toolbars & menus
- SvStorageStreamRef refMainStream = rRoot->OpenSotStream( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WordDocument") ) );
+ SvStorageStreamRef refMainStream = rRoot->OpenSotStream( String::CreateFromAscii( "WordDocument" ));
refMainStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
WW8Fib aWwFib( *refMainStream, 8 );
SvStorageStreamRef xTableStream = rRoot->OpenSotStream(String::CreateFromAscii( aWwFib.fWhichTblStm ? SL::a1Table : SL::a0Table), STREAM_STD_READ);
@@ -4598,7 +4597,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
uno::Reference< container::XNameContainer > xPrjNameCache;
uno::Reference< lang::XMultiServiceFactory> xSF(mpDocShell->GetModel(), uno::UNO_QUERY);
if ( xSF.is() )
- xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY );
+ xPrjNameCache.set( xSF->createInstance( "ooo.vba.VBAProjectNameProvider" ), uno::UNO_QUERY );
// Read Global templates
ReadGlobalTemplateSettings( sCreatedFrom, xPrjNameCache );
@@ -4607,7 +4606,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
uno::Any aGlobs;
uno::Sequence< uno::Any > aArgs(1);
aArgs[ 0 ] <<= mpDocShell->GetModel();
- aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Globals")), aArgs );
+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( "ooo.vba.word.Globals", aArgs );
BasicManager *pBasicMan = mpDocShell->GetBasicManager();
if (pBasicMan)
pBasicMan->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
@@ -5465,9 +5464,7 @@ sal_uLong WW8Reader::OpenMainStream( SvStorageStreamRef& rRef, sal_uInt16& rBuff
{
sal_uLong nRet = ERR_SWG_READ_ERROR;
OSL_ENSURE( pStg, "wo ist mein Storage?" );
- rRef = pStg->OpenSotStream(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WordDocument")),
- STREAM_READ | STREAM_SHARE_DENYALL);
+ rRef = pStg->OpenSotStream( String::CreateFromAscii( "WordDocument" ), STREAM_READ | STREAM_SHARE_DENYALL);
if( rRef.Is() )
{
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 3ac1645..f6bed3c 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -168,9 +168,9 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, String& rStr )
if (aBookmarkName.Len()>0) {
maFieldStack.back().SetBookmarkName(aBookmarkName);
- maFieldStack.back().SetBookmarkType(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMTEXT)));
- maFieldStack.back().getParameters()[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Description"))] = uno::makeAny(::rtl::OUString(aFormula.sToolTip));
- maFieldStack.back().getParameters()[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name"))] = uno::makeAny(::rtl::OUString(aFormula.sTitle));
+ maFieldStack.back().SetBookmarkType(ODF_FORMTEXT);
+ maFieldStack.back().getParameters()["Description"] = uno::makeAny(::rtl::OUString(aFormula.sToolTip));
+ maFieldStack.back().getParameters()["Name"] = uno::makeAny(::rtl::OUString(aFormula.sTitle));
}
return FLD_TEXT;
}
@@ -217,14 +217,13 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, String& rStr )
{
IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess( );
IFieldmark* pFieldmark = dynamic_cast<IFieldmark*>( pMarksAccess->makeNoTextFieldBookmark(
- *pPaM, aBookmarkName,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_FORMCHECKBOX )) ) );
+ *pPaM, aBookmarkName, ODF_FORMCHECKBOX ) );
OSL_ENSURE(pFieldmark!=NULL, "hmmm; why was the bookmark not created?");
if (pFieldmark!=NULL) {
IFieldmark::parameter_map_t* const pParameters = pFieldmark->GetParameters();
ICheckboxFieldmark* pCheckboxFm = dynamic_cast<ICheckboxFieldmark*>(pFieldmark);
- (*pParameters)[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMCHECKBOX_NAME))] = uno::makeAny(::rtl::OUString(aFormula.sTitle));
- (*pParameters)[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMCHECKBOX_HELPTEXT))] = uno::makeAny(::rtl::OUString(aFormula.sToolTip));
+ (*pParameters)[ODF_FORMCHECKBOX_NAME] = uno::makeAny(::rtl::OUString(aFormula.sTitle));
+ (*pParameters)[ODF_FORMCHECKBOX_HELPTEXT] = uno::makeAny(::rtl::OUString(aFormula.sToolTip));
if(pCheckboxFm)
pCheckboxFm->SetChecked(aFormula.nChecked);
@@ -291,16 +290,15 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* pF, String& rStr)
{
IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess( );
IFieldmark *pFieldmark = dynamic_cast<IFieldmark*>(
- pMarksAccess->makeNoTextFieldBookmark( *pPaM, aBookmarkName,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_FORMDROPDOWN )) ) );
+ pMarksAccess->makeNoTextFieldBookmark( *pPaM, aBookmarkName, ODF_FORMDROPDOWN ) );
OSL_ENSURE(pFieldmark!=NULL, "hmmm; why was the bookmark not created?");
if ( pFieldmark != NULL )
{
uno::Sequence< ::rtl::OUString > vListEntries(aFormula.maListEntries.size());
::std::copy(aFormula.maListEntries.begin(), aFormula.maListEntries.end(), ::comphelper::stl_begin(vListEntries));
- (*pFieldmark->GetParameters())[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMDROPDOWN_LISTENTRY))] = uno::makeAny(vListEntries);
+ (*pFieldmark->GetParameters())[ODF_FORMDROPDOWN_LISTENTRY] = uno::makeAny(vListEntries);
sal_Int32 nIndex = aFormula.fDropdownIndex < aFormula.maListEntries.size() ? aFormula.fDropdownIndex : 0;
- (*pFieldmark->GetParameters())[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMDROPDOWN_RESULT))] = uno::makeAny(nIndex);
+ (*pFieldmark->GetParameters())[ODF_FORMDROPDOWN_RESULT] = uno::makeAny(nIndex);
// set field data here...
}
}
@@ -2185,7 +2183,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich,
{
if ( iRes != 25 )
nChecked = iRes;
- sDefault = ( wDef == 0 ) ? rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("0") ) : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("1") );
+ sDefault = ( wDef == 0 ) ? "0" : "1";
}
}
// xstzTextFormat
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index b5fcd56..0a24803 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -694,7 +694,7 @@ sal_uInt16 SwWW8ImplReader::End_Field()
SwPaM aFldPam( maFieldStack.back().GetPtNode(), maFieldStack.back().GetPtCntnt(), aEndPos.nNode, aEndPos.nContent.GetIndex());
IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess( );
IFieldmark *pFieldmark = dynamic_cast<IFieldmark*>( pMarksAccess->makeFieldBookmark(
- aFldPam, maFieldStack.back().GetBookmarkName(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMTEXT )) ) );
+ aFldPam, maFieldStack.back().GetBookmarkName(), ODF_FORMTEXT ) );
OSL_ENSURE(pFieldmark!=NULL, "hmmm; why was the bookmark not created?");
if (pFieldmark!=NULL) {
const IFieldmark::parameter_map_t& pParametersToAdd = maFieldStack.back().getParameters();
@@ -744,7 +744,7 @@ sal_uInt16 SwWW8ImplReader::End_Field()
IFieldmark* pFieldmark = pMarksAccess->makeFieldBookmark(
aFldPam,
maFieldStack.back().GetBookmarkName(),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_UNHANDLED )) );
+ ODF_UNHANDLED );
if ( pFieldmark )
{
const IFieldmark::parameter_map_t& pParametersToAdd = maFieldStack.back().getParameters();
@@ -752,11 +752,11 @@ sal_uInt16 SwWW8ImplReader::End_Field()
rtl::OUString sFieldId = rtl::OUString::valueOf( sal_Int32( maFieldStack.back().mnFieldId ) );
pFieldmark->GetParameters()->insert(
std::pair< rtl::OUString, uno::Any > (
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_ID_PARAM )),
+ ODF_ID_PARAM,
uno::makeAny( sFieldId ) ) );
pFieldmark->GetParameters()->insert(
std::pair< rtl::OUString, uno::Any > (
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_CODE_PARAM )),
+ ODF_CODE_PARAM,
uno::makeAny( aCode ) ) );
if ( maFieldStack.back().mnObjLocFc > 0 )
@@ -773,7 +773,7 @@ sal_uInt16 SwWW8ImplReader::End_Field()
if (xDocStg.is())
{
uno::Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OLELinks")), embed::ElementModes::WRITE );
+ "OLELinks", embed::ElementModes::WRITE );
SotStorageRef xObjDst = SotStorage::OpenOLEStorage( xOleStg, sOleId );
if ( xObjDst.Is() )
@@ -792,8 +792,7 @@ sal_uInt16 SwWW8ImplReader::End_Field()
// Store the OLE Id as a parameter
pFieldmark->GetParameters()->insert(
std::pair< rtl::OUString, uno::Any >(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_OLE_PARAM )),
- uno::makeAny( rtl::OUString( sOleId ) ) ) );
+ ODF_OLE_PARAM, uno::makeAny( rtl::OUString( sOleId ) ) ) );
}
}
@@ -2221,9 +2220,9 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, String& rStr )
#if defined(WW_NATIVE_TOC)
if (1) {
- ::rtl::OUString aBookmarkName=(RTL_CONSTASCII_USTRINGPARAM("_REF"));
+ ::rtl::OUString aBookmarkName("_REF");
maFieldStack.back().SetBookmarkName(aBookmarkName);
- maFieldStack.back().SetBookmarkType(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_PAGEREF)));
+ maFieldStack.back().SetBookmarkType(ODF_PAGEREF);
maFieldStack.back().AddParam(rtl::OUString(), sName);
return FLD_TEXT;
}
@@ -2319,8 +2318,7 @@ bool CanUseRemoteLink(const String &rGrfName)
ucb::XCommandEnvironment >() );
rtl::OUString aTitle;
- aCnt.getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title")))
- >>= aTitle;
+ aCnt.getPropertyValue("Title") >>= aTitle;
bUseRemote = !aTitle.isEmpty();
}
catch ( ... )
@@ -2930,9 +2928,9 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
{
#if defined(WW_NATIVE_TOC)
if (1) {
- ::rtl::OUString aBookmarkName=(RTL_CONSTASCII_USTRINGPARAM("_TOC"));
+ ::rtl::OUString aBookmarkName("_TOC");
maFieldStack.back().SetBookmarkName(aBookmarkName);
- maFieldStack.back().SetBookmarkType(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_TOC)));
+ maFieldStack.back().SetBookmarkType(ODF_TOC);
return FLD_TEXT;
}
#endif
@@ -3453,9 +3451,9 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, String& rStr )
{
#if defined(WW_NATIVE_TOC)
if (1) {
- ::rtl::OUString aBookmarkName=(RTL_CONSTASCII_USTRINGPARAM("_HYPERLINK"));
+ ::rtl::OUString aBookmarkName("_HYPERLINK");
maFieldStack.back().SetBookmarkName(aBookmarkName);
- maFieldStack.back().SetBookmarkType(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_HYPERLINK)));
+ maFieldStack.back().SetBookmarkType(ODF_HYPERLINK);
return FLD_TEXT;
}
#endif
diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
index 3247217..0b668fa 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -64,12 +64,12 @@ MSOWordCommandConvertor::MSOWordCommandConvertor()
{
// mso command id to ooo command string
// #FIXME and *HUNDREDS* of id's to added here
- msoToOOcmd[ 0x20b ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:CloseDoc") );
- msoToOOcmd[ 0x50 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Open") );
+ msoToOOcmd[ 0x20b ] = ".uno:CloseDoc";
+ msoToOOcmd[ 0x50 ] = ".uno:Open";
// mso tcid to ooo command string
// #FIXME and *HUNDREDS* of id's to added here
- tcidToOOcmd[ 0x9d9 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Print") );
+ tcidToOOcmd[ 0x9d9 ] = ".uno:Print";
}
rtl::OUString MSOWordCommandConvertor::MSOCommandToOOCommand( sal_Int16 key )
@@ -241,8 +241,8 @@ bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
try
{
uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
- CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) );
+ uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ), uno::UNO_QUERY_THROW );
+ CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( "com.sun.star.text.TextDocument" ) );
helper.setMSOCommandMap( new MSOWordCommandConvertor() );
if ( !(*it).ImportCustomToolBar( *this, helper ) )
@@ -342,9 +342,9 @@ bool Customization::ImportMenu( CTBWrapper& rWrapper, CustomToolBarImportHelper&
if ( pCust )
{
// currently only support built-in menu
- rtl::OUString sMenuBar( RTL_CONSTASCII_USTRINGPARAM("private:resource/menubar/") );
+ rtl::OUString sMenuBar( "private:resource/menubar/" );
- sMenuBar = sMenuBar.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("menubar") ) );
+ sMenuBar = sMenuBar.concat( "menubar" );
// Get menu name
TBC* pTBC = pWrapper->GetTBCAtOffset( it->TBCStreamOffset() );
if ( !pTBC )
@@ -371,16 +371,16 @@ bool Customization::ImportMenu( CTBWrapper& rWrapper, CustomToolBarImportHelper&
uno::Reference< lang::XSingleComponentFactory > xSCF( xIndexContainer, uno::UNO_QUERY_THROW );
uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- uno::Reference< uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
+ uno::Reference< uno::XComponentContext > xContext( xProps->getPropertyValue( "DefaultContext" ), uno::UNO_QUERY_THROW );
// create the popup menu
uno::Sequence< beans::PropertyValue > aPopupMenu( 4 );
- aPopupMenu[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
- aPopupMenu[0].Value = uno::makeAny( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("vnd.openoffice.org:") ) + sMenuName );
- aPopupMenu[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Label") );
+ aPopupMenu[0].Name = "CommandURL";
+ aPopupMenu[0].Value = uno::makeAny( rtl::OUString( "vnd.openoffice.org:" ) + sMenuName );
+ aPopupMenu[1].Name = "Label";
aPopupMenu[1].Value <<= sMenuName;
- aPopupMenu[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type" ) );
+ aPopupMenu[2].Name = "Type";
aPopupMenu[2].Value <<= sal_Int32( 0 );
- aPopupMenu[3].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ItemDescriptorContainer") );
+ aPopupMenu[3].Name = "ItemDescriptorContainer";
uno::Reference< container::XIndexContainer > xMenuContainer( xSCF->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW );
aPopupMenu[3].Value <<= xMenuContainer;
if ( pCust->customizationDataCTB.get() && !pCust->customizationDataCTB->ImportMenuTB( rWrapper, xMenuContainer, helper ) )
@@ -565,7 +565,7 @@ CTB::Print( FILE* fp )
bool CTB::ImportCustomToolBar( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
{
- static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) );
+ static rtl::OUString sToolbarPrefix( "private:resource/toolbar/custom_" );
bool bRes = false;
try
{
@@ -577,7 +577,7 @@ bool CTB::ImportCustomToolBar( CTBWrapper& rWrapper, CustomToolBarImportHelper&
uno::Reference< beans::XPropertySet > xProps( xIndexContainer, uno::UNO_QUERY_THROW );
// set UI name for toolbar
- xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ), uno::makeAny( name.getString() ) );
+ xProps->setPropertyValue( "UIName", uno::makeAny( name.getString() ) );
rtl::OUString sToolBarName = sToolbarPrefix.concat( name.getString() );
for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
@@ -711,7 +711,7 @@ TBC::ImportToolBarControl( CTBWrapper& rWrapper, const css::uno::Reference< css:
{
beans::PropertyValue aProp;
- aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
+ aProp.Name = "CommandURL";
aProp.Value <<= sCommand;
props.push_back( aProp );
}
@@ -733,7 +733,7 @@ TBC::ImportToolBarControl( CTBWrapper& rWrapper, const css::uno::Reference< css:
{
uno::Reference< container::XIndexContainer > xMenuDesc;
uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- xMenuDesc.set( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.IndexedPropertyValues" ) ) ), uno::UNO_QUERY_THROW );
+ xMenuDesc.set( xMSF->createInstance( "com.sun.star.document.IndexedPropertyValues" ), uno::UNO_QUERY_THROW );
if ( !pCustTB->ImportMenuTB( rWrapper,xMenuDesc, helper ) )
return false;
if ( !bIsMenuBar )
@@ -744,7 +744,7 @@ TBC::ImportToolBarControl( CTBWrapper& rWrapper, const css::uno::Reference< css:
else
{
beans::PropertyValue aProp;
- aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ItemDescriptorContainer") );
+ aProp.Name = "ItemDescriptorContainer";
aProp.Value <<= xMenuDesc;
props.push_back( aProp );
}
@@ -755,7 +755,7 @@ TBC::ImportToolBarControl( CTBWrapper& rWrapper, const css::uno::Reference< css:
{
// insert spacer
uno::Sequence< beans::PropertyValue > sProps( 1 );
- sProps[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type") );
+ sProps[ 0 ].Name = "Type";
sProps[ 0 ].Value = uno::makeAny( ui::ItemType::SEPARATOR_LINE );
toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
}
commit 40212a207cce0ddebea6f7edd9dcf4df8f9eff4a
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Tue Feb 28 11:39:48 2012 +0100
optimized OUString operators =,==,!= for string literals
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index 30c9576..b74cd37 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -323,6 +323,40 @@ public:
}
/**
+ Assign a new string from an 8-Bit string literal that is expected to contain only
+ characters in the ASCII set (i.e. first 128 characters). This operator
+ allows an efficient and convenient way to assign OUString
+ instances from ASCII literals. When assigning strings from data that
+ is not pure ASCII, it needs to be converted to OUString by explicitly
+ providing the encoding to use for the conversion.
+
+ @param literal the 8-bit ASCII string literal
+
+ @exception std::bad_alloc is thrown if an out-of-memory condition occurs
+ @since 3.6
+ */
+ template< int N >
+ OUString& operator=( const char (&literal)[ N ] )
+ {
+ rtl_string2UString( &pData, literal, N - 1, RTL_TEXTENCODING_ASCII_US, 0 );
+ if (pData == 0) {
+#if defined EXCEPTIONS_OFF
+ SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF");
+#else
+ throw std::bad_alloc();
+#endif
+ }
+ return *this;
+ }
+
+ /**
+ * It is an error to call this overload. Strings cannot be directly assigned non-const char[].
+ * @internal
+ */
+ template< int N >
+ OUString& operator=( char (&value)[ N ] ); // intentionally not implemented
+
+ /**
Append a string to this string.
@param str a OUString.
@@ -870,6 +904,79 @@ public:
{ return rStr1.compareTo( rStr2 ) >= 0; }
/**
+ * Compare string to an ASCII string literal.
+ *
+ * This operator is equal to calling equalsAsciiL().
+ *
+ * @since 3.6
+ */
+ template< int N >
+ friend inline bool operator==( const OUString& string, const char (&literal)[ N ] )
+ {
+ return string.equalsAsciiL( literal, N - 1 );
+ }
+ /**
+ * Compare string to an ASCII string literal.
+ *
+ * This operator is equal to calling equalsAsciiL().
+ *
+ * @since 3.6
+ */
+ template< int N >
+ friend inline bool operator==( const char (&literal)[ N ], const OUString& string )
+ {
+ return string.equalsAsciiL( literal, N - 1 );
+ }
+ /**
+ * Compare string to an ASCII string literal.
+ *
+ * This operator is equal to calling equalsAsciiL().
+ *
+ * @since 3.6
+ */
+ template< int N >
+ friend inline bool operator!=( const OUString& string, const char (&literal)[ N ] )
+ {
+ return !string.equalsAsciiL( literal, N - 1 );
+ }
+ /**
+ * Compare string to an ASCII string literal.
+ *
+ * This operator is equal to calling equalsAsciiL().
+ *
+ * @since 3.6
+ */
+ template< int N >
+ friend inline bool operator!=( const char (&literal)[ N ], const OUString& string )
+ {
+ return !string.equalsAsciiL( literal, N - 1 );
+ }
+ /**
+ * It is an error to call this overload. Strings cannot be directly assigned non-const char[].
+ * @internal
+ */
+ template< int N >
+ friend inline bool operator==( const OUString& string, char (&literal)[ N ] ); // not implemented
+ /**
+ * It is an error to call this overload. Strings cannot be directly assigned non-const char[].
+ * @internal
+ */
+ template< int N >
+ friend inline bool operator==( char (&literal)[ N ], const OUString& string ); // not implemented
+ /**
+ * It is an error to call this overload. Strings cannot be directly assigned non-const char[].
+ * @internal
+ */
+ template< int N >
+ friend inline bool operator!=( const OUString& string, char (&literal)[ N ] ); // not implemented
+ /**
+ * It is an error to call this overload. Strings cannot be directly assigned non-const char[].
+ * @internal
+ */
+ template< int N >
+ friend inline bool operator!=( char (&literal)[ N ], const OUString& string ); // not implemented
+
+ /**
Returns a hashcode for this string.
@return a hash code value for this object.
commit 9076962550a9b063d3f0ca5daefc99f95b542143
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Tue Feb 28 11:38:59 2012 +0100
check that *ascii* string functions are really passed only ASCII
diff --git a/sal/rtl/source/ustring.cxx b/sal/rtl/source/ustring.cxx
index d7f8a96..7c99758 100644
--- a/sal/rtl/source/ustring.cxx
+++ b/sal/rtl/source/ustring.cxx
@@ -175,6 +175,9 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_compare( const sal_Unicode* pStr1,
((sal_Int32)((unsigned char)(*pStr2)))) == 0) &&
*pStr2 )
{
+ /* Check ASCII range */
+ SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ "rtl_ustr_ascii_compare - Found char > 127" );
pStr1++;
pStr2++;
}
@@ -194,6 +197,9 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_compare_WithLength( const sal_Unicode* pStr1,
((sal_Int32)((unsigned char)(*pStr2)))) == 0) &&
nStr1Len && *pStr2 )
{
+ /* Check ASCII range */
+ SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ "rtl_ustr_ascii_compare_WithLength - Found char > 127" );
pStr1++;
pStr2++;
nStr1Len--;
@@ -216,7 +222,8 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_shortenedCompare_WithLength( const sal_Unicode
(pStr1 < pStr1End) && *pStr2 )
{
/* Check ASCII range */
- OSL_ENSURE( (*pStr2 & 0x80) == 0, "Found ASCII char > 127");
+ SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ "rtl_ustr_ascii_shortenedCompare_WithLength - Found char > 127" );
nRet = ((sal_Int32)*pStr1)-
((sal_Int32)(unsigned char)*pStr2);
@@ -259,6 +266,9 @@ sal_Int32 SAL_CALL rtl_ustr_asciil_reverseCompare_WithLength( const sal_Unicode*
sal_Int32 nRet;
while ( (pStr1 < pStr1Run) && (pStr2 < pStr2Run) )
{
+ /* Check ASCII range */
+ SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ "rtl_ustr_asciil_reverseCompare_WithLength - Found char > 127" );
pStr1Run--;
pStr2Run--;
nRet = ((sal_Int32)*pStr1Run)-((sal_Int32)*pStr2Run);
@@ -280,6 +290,9 @@ sal_Bool SAL_CALL rtl_ustr_asciil_reverseEquals_WithLength( const sal_Unicode* p
const sal_Char* pStr2Run = pStr2+nStrLen;
while ( pStr1 < pStr1Run )
{
+ /* Check ASCII range */
+ SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ "rtl_ustr_asciil_reverseEquals_WithLength - Found char > 127" );
pStr1Run--;
pStr2Run--;
if( *pStr1Run != (sal_Unicode)*pStr2Run )
@@ -300,6 +313,9 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase( const sal_Unicode* pSt
sal_Int32 c2;
do
{
+ /* Check ASCII range */
+ SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ "rtl_ustr_ascii_compareIgnoreAsciiCase - Found char > 127" );
/* If character between 'A' and 'Z', than convert it to lowercase */
c1 = (sal_Int32)*pStr1;
c2 = (sal_Int32)((unsigned char)*pStr2);
@@ -331,6 +347,9 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( const sal_U
sal_Int32 c2;
do
{
+ /* Check ASCII range */
+ SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ "rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength - Found char > 127" );
if ( !nStr1Len )
return *pStr2 == '\0' ? 0 : -1;
@@ -361,6 +380,9 @@ sal_Int32 rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
sal_Int32 i;
sal_Int32 len = firstLen < secondLen ? firstLen : secondLen;
for (i = 0; i < len; ++i) {
+ /* Check ASCII range */
+ SAL_WARN_IF( ((unsigned char)*second) > 127, "rtl.string",
+ "rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths - Found char > 127" );
sal_Int32 c1 = *first++;
sal_Int32 c2 = (unsigned char) *second++;
sal_Int32 d;
@@ -394,7 +416,8 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( co
(pStr1 < pStr1End) && *pStr2 )
{
/* Check ASCII range */
- OSL_ENSURE( (*pStr2 & 0x80) == 0, "Found ASCII char > 127");
+ SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ "rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength - Found char > 127" );
/* If character between 'A' and 'Z', than convert it to lowercase */
c1 = (sal_Int32)*pStr1;
@@ -465,8 +488,8 @@ void SAL_CALL rtl_uString_newFromAscii( rtl_uString** ppThis,
do
{
/* Check ASCII range */
- OSL_ENSURE( ((unsigned char)*pCharStr) <= 127,
- "rtl_uString_newFromAscii() - Found ASCII char > 127" );
+ SAL_WARN_IF( ((unsigned char)*pCharStr) > 127, "rtl.string",
+ "rtl_uString_newFromAscii - Found char > 127" );
*pBuffer = *pCharStr;
pBuffer++;
@@ -648,7 +671,7 @@ static void rtl_string2UString_status( rtl_uString** ppThis,
do
{
/* Check ASCII range */
- OSL_ENSURE( ((unsigned char)*pStr) <= 127,
+ SAL_WARN_IF( ((unsigned char)*pStr) > 127, "rtl.string",
"rtl_string2UString_status() - UTF8 test encoding is wrong" );
*pBuffer = *pStr;
@@ -872,7 +895,7 @@ void SAL_CALL rtl_uString_internConvert( rtl_uString ** newStr,
for (i = 0; i < len; i++)
{
/* Check ASCII range */
- OSL_ENSURE( ((unsigned char)str[i]) <= 127,
+ SAL_WARN_IF( ((unsigned char)str[i]) > 127, "rtl.string",
"rtl_ustring_internConvert() - Found char > 127 and RTL_TEXTENCODING_ASCII_US is specified" );
pScratch->buffer[i] = str[i];
}
commit a59f65831224cb957ffb344b76a77d589fb93fd5
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Mon Feb 27 19:08:01 2012 +0100
add @since to new OUString ctors
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index 8a3184b..30c9576 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -178,6 +178,7 @@ public:
@param literal the 8-bit ASCII string literal
@exception std::bad_alloc is thrown if an out-of-memory condition occurs
+ @since 3.6
*/
template< int N >
OUString( const char (&literal)[ N ] )
@@ -202,6 +203,7 @@ public:
* It is an error to try to call this overload.
*
* @internal
+ * @since 3.6
*/
template< int N >
OUString( char (&value)[ N ] )
commit 8025d89840c96a7556c8113800aee034845174b7
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Mon Feb 27 18:30:07 2012 +0100
assume string literals to be ASCII-only, rather than UTF-8
ASCII-only handling is much more efficient, and some functionality
like comparison has optimized variants for ASCII
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index 27eb865..8a3184b 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -168,12 +168,14 @@ public:
}
/**
- New string from an 8-Bit string literal that is expected to be in UTF-8
- (or its subset, ASCII). All string literals in the codebase are
- assumed to be only UTF-8/ASCII, so this constructor allows an efficient
- and convenient way to create OUString instances from literals.
+ New string from an 8-Bit string literal that is expected to contain only
+ characters in the ASCII set (i.e. first 128 characters). This constructor
+ allows an efficient and convenient way to create OUString
+ instances from ASCII literals. When creating strings from data that
+ is not pure ASCII, it needs to be converted to OUString by explicitly
+ providing the encoding to use for the conversion.
- @param literal the 8-bit string literal
+ @param literal the 8-bit ASCII string literal
@exception std::bad_alloc is thrown if an out-of-memory condition occurs
*/
@@ -181,7 +183,7 @@ public:
OUString( const char (&literal)[ N ] )
{
pData = 0;
- rtl_string2UString( &pData, literal, N - 1, RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS );
+ rtl_string2UString( &pData, literal, N - 1, RTL_TEXTENCODING_ASCII_US, 0 );
if (pData == 0) {
#if defined EXCEPTIONS_OFF
SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF");
@@ -195,7 +197,7 @@ public:
* This overload exists only to avoid creating instances directly from (non-const) char[],
* which would otherwise be picked up by the optimized const char[] constructor.
* Since the non-const array cannot be guaranteed to contain characters in the expected
- * UTF-8/ASCII encoding, this needs to be prevented.
+ * ASCII encoding, this needs to be prevented.
*
* It is an error to try to call this overload.
*
More information about the Libreoffice-commits
mailing list