diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-05-25 11:23:18 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-06-01 19:32:06 +0200 |
commit | dee853844d0be44d7f26925aad7b71c7dd55dcb5 (patch) | |
tree | b62062cdd956634597d546dab8265762df4b8ec9 /sw | |
parent | f0d05ed0358fa41b6d67caa51c07aaf9d1520841 (diff) |
OUString: avoid unnecessary conversions and buffers
Change-Id: I5537b089b15987564004cf46dfe53e34576ebca5
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/unocore/unoparagraph.cxx | 33 | ||||
-rw-r--r-- | sw/source/core/unocore/unoredline.cxx | 28 |
2 files changed, 23 insertions, 38 deletions
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index da5eed08c2dd..aa13240304f1 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -131,8 +131,7 @@ public: SwTxtNode & GetTxtNodeOrThrow() { SwTxtNode *const pTxtNode( GetTxtNode() ); if (!pTxtNode) { - throw uno::RuntimeException(OUString( - "SwXParagraph: disposed or invalid"), 0); + throw uno::RuntimeException("SwXParagraph: disposed or invalid", 0); } return *pTxtNode; } @@ -387,15 +386,13 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, if (!pEntry) { throw beans::UnknownPropertyException( - OUString("Unknown property: ") - + pPropertyNames[nProp], + "Unknown property: " + pPropertyNames[nProp], static_cast< cppu::OWeakObject * >(&m_rThis)); } if (pEntry->nFlags & beans::PropertyAttribute::READONLY) { throw beans::PropertyVetoException( - OUString("Property is read-only: ") - + pPropertyNames[nProp], + "Property is read-only: " + pPropertyNames[nProp], static_cast< cppu::OWeakObject * >(&m_rThis)); } aValues[nProp].Name = pPropertyNames[nProp]; @@ -448,8 +445,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, if (!pEntry) { throw beans::UnknownPropertyException( - OUString("Unknown property: ") - + pPropertyNames[nProp], + "Unknown property: " + pPropertyNames[nProp], static_cast< cppu::OWeakObject * >(&m_rThis)); } if (! ::sw::GetDefaultTextContentValue( @@ -482,14 +478,12 @@ throw (uno::RuntimeException, std::exception) } catch (beans::UnknownPropertyException &) { - throw uno::RuntimeException(OUString( - "Unknown property exception caught"), + throw uno::RuntimeException("Unknown property exception caught", static_cast<cppu::OWeakObject *>(this)); } catch (lang::WrappedTargetException &) { - throw uno::RuntimeException(OUString( - "WrappedTargetException caught"), + throw uno::RuntimeException("WrappedTargetException caught", static_cast<cppu::OWeakObject *>(this)); } @@ -910,8 +904,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) if (!pEntry) { throw beans::UnknownPropertyException( - OUString("Unknown property: ") - + rPropertyName, + "Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject *>(this)); } bool bDummy = false; @@ -944,8 +937,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) if (!pEntry) { throw beans::UnknownPropertyException( - OUString("Unknown property: ") - + *pNames, + "Unknown property: " + *pNames, static_cast<cppu::OWeakObject *>(this)); } @@ -987,16 +979,14 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) if (!pEntry) { throw beans::UnknownPropertyException( - OUString("Unknown property: ") - + rPropertyName, + "Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject *>(this)); } if (pEntry->nFlags & beans::PropertyAttribute::READONLY) { throw uno::RuntimeException( - OUString("Property is read-only: ") - + rPropertyName, + "Property is read-only: " + rPropertyName, static_cast<cppu::OWeakObject *>(this)); } @@ -1057,8 +1047,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, if (!pEntry) { throw beans::UnknownPropertyException( - OUString("Unknown property: ") - + rPropertyName, + "Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject *>(this)); } diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx index d66263a9028b..b1ea530adbf3 100644 --- a/sw/source/core/unocore/unoredline.cxx +++ b/sw/source/core/unocore/unoredline.cxx @@ -20,7 +20,6 @@ #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/text/XTextTable.hpp> -#include <rtl/ustrbuf.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <comphelper/servicehelper.hxx> @@ -132,9 +131,9 @@ uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursor(void) // no content node outside of a table could be found, and therefore we // except. uno::RuntimeException aExcept; - aExcept.Message = OUString( + aExcept.Message = "No content node found that is inside this change section " - "but outside of a table" ); + "but outside of a table"; throw aExcept; } @@ -226,11 +225,11 @@ static uno::Sequence<beans::PropertyValue> lcl_GetSuccessorProperties(const SwRa pValues[0].Name = UNO_NAME_REDLINE_AUTHOR; // GetAuthorString(n) walks the SwRedlineData* chain; // here we always need element 1 - pValues[0].Value <<= OUString(rRedline.GetAuthorString(1)); + pValues[0].Value <<= rRedline.GetAuthorString(1); pValues[1].Name = UNO_NAME_REDLINE_DATE_TIME; pValues[1].Value <<= lcl_DateTimeToUno(pNext->GetTimeStamp()); pValues[2].Name = UNO_NAME_REDLINE_COMMENT; - pValues[2].Value <<= OUString(pNext->GetComment()); + pValues[2].Value <<= pNext->GetComment(); pValues[3].Name = UNO_NAME_REDLINE_TYPE; pValues[3].Value <<= lcl_RedlineTypeToOUString(pNext->GetType()); } @@ -293,13 +292,13 @@ uno::Any SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, co { uno::Any aRet; if(rPropertyName == UNO_NAME_REDLINE_AUTHOR) - aRet <<= OUString(rRedline.GetAuthorString()); + aRet <<= rRedline.GetAuthorString(); else if(rPropertyName == UNO_NAME_REDLINE_DATE_TIME) { aRet <<= lcl_DateTimeToUno(rRedline.GetTimeStamp()); } else if(rPropertyName == UNO_NAME_REDLINE_COMMENT) - aRet <<= OUString(rRedline.GetComment()); + aRet <<= rRedline.GetComment(); else if(rPropertyName == UNO_NAME_REDLINE_TYPE) { aRet <<= lcl_RedlineTypeToOUString(rRedline.GetType()); @@ -311,9 +310,8 @@ uno::Any SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, co } else if (rPropertyName == UNO_NAME_REDLINE_IDENTIFIER) { - OUStringBuffer sBuf; - sBuf.append( sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) ); - aRet <<= sBuf.makeStringAndClear(); + aRet <<= OUString::number( + sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) ); } else if (rPropertyName == UNO_NAME_IS_IN_HEADER_FOOTER) { @@ -336,20 +334,18 @@ uno::Sequence< beans::PropertyValue > SwXRedlinePortion::CreateRedlineProperties const SwRedlineData* pNext = rRedline.GetRedlineData().Next(); beans::PropertyValue* pRet = aRet.getArray(); - OUStringBuffer sRedlineIdBuf; - sRedlineIdBuf.append( sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) ); - sal_Int32 nPropIdx = 0; pRet[nPropIdx].Name = UNO_NAME_REDLINE_AUTHOR; - pRet[nPropIdx++].Value <<= OUString(rRedline.GetAuthorString()); + pRet[nPropIdx++].Value <<= rRedline.GetAuthorString(); pRet[nPropIdx].Name = UNO_NAME_REDLINE_DATE_TIME; pRet[nPropIdx++].Value <<= lcl_DateTimeToUno(rRedline.GetTimeStamp()); pRet[nPropIdx].Name = UNO_NAME_REDLINE_COMMENT; - pRet[nPropIdx++].Value <<= OUString(rRedline.GetComment()); + pRet[nPropIdx++].Value <<= rRedline.GetComment(); pRet[nPropIdx].Name = UNO_NAME_REDLINE_TYPE; pRet[nPropIdx++].Value <<= lcl_RedlineTypeToOUString(rRedline.GetType()); pRet[nPropIdx].Name = UNO_NAME_REDLINE_IDENTIFIER; - pRet[nPropIdx++].Value <<= sRedlineIdBuf.makeStringAndClear(); + pRet[nPropIdx++].Value <<= OUString::number( + sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) ); pRet[nPropIdx].Name = UNO_NAME_IS_COLLAPSED; sal_Bool bTmp = !rRedline.HasMark(); pRet[nPropIdx++].Value.setValue(&bTmp, ::getBooleanCppuType()) ; |