convert sw/source/ui/uno/*.cxx from String to OUString

Change-Id: I3726ae7496e66f0e0d9b6be1ada1766c7fd496db
This commit is contained in:
Noel Grandin
2013-10-11 15:29:31 +02:00
parent 784634377e
commit dd7acb3d76
6 changed files with 80 additions and 81 deletions

View File

@@ -49,7 +49,7 @@ sal_uLong SwFilterDetect::DetectFilter( SfxMedium& rMedium, const SfxFilter** pp
if( *ppFilter )
{
// verify the given filter
String aPrefFlt = (*ppFilter)->GetUserData();
OUString aPrefFlt = (*ppFilter)->GetUserData();
// detection for TextFilter needs an additional checking
sal_Bool bDetected = SwIoSystem::IsFileFilter(rMedium, aPrefFlt);
@@ -57,7 +57,7 @@ sal_uLong SwFilterDetect::DetectFilter( SfxMedium& rMedium, const SfxFilter** pp
}
// mba: without preselection there is no PrefFlt
String aPrefFlt;
OUString aPrefFlt;
const SfxFilter* pTmp = SwIoSystem::GetFileFilter( rMedium.GetPhysicalName(), aPrefFlt, &rMedium );
if( !pTmp )
return ERRCODE_ABORT;

View File

@@ -80,10 +80,10 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
Reference< XInputStream > xStream;
Reference< XContent > xContent;
Reference< XInteractionHandler > xInteraction;
String aURL;
OUString aURL;
OUString sTemp;
String aTypeName; // a name describing the type (from MediaDescriptor, usually from flat detection)
String aPreselectedFilterName; // a name describing the filter to use (from MediaDescriptor, usually from UI action)
OUString aTypeName; // a name describing the type (from MediaDescriptor, usually from flat detection)
OUString aPreselectedFilterName; // a name describing the filter to use (from MediaDescriptor, usually from UI action)
OUString aDocumentTitle; // interesting only if set in this method
@@ -115,7 +115,7 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
lDescriptor[nProperty].Value >>= sTemp;
aURL = sTemp;
}
else if( !aURL.Len() && lDescriptor[nProperty].Name == "FileName" )
else if( aURL.isEmpty() && lDescriptor[nProperty].Name == "FileName" )
{
lDescriptor[nProperty].Value >>= sTemp;
aURL = sTemp;
@@ -164,14 +164,13 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
bWasReadOnly = pItem && pItem->GetValue();
const SfxFilter* pFilter = 0;
String aPrefix = OUString("private:factory/");
if( aURL.Match( aPrefix ) == aPrefix.Len() )
OUString aPrefix = "private:factory/";
if( aURL.startsWith( aPrefix ) )
{
if( SvtModuleOptions().IsWriter() )
{
String aPattern( aPrefix );
aPattern += OUString("swriter");
if ( aURL.Match( aPattern ) >= aPattern.Len() )
OUString aPattern = aPrefix + "swriter";
if ( aURL.startsWith( aPattern ) )
return aTypeName;
}
}
@@ -224,8 +223,8 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
try
{
const SfxFilter* pPreFilter = aPreselectedFilterName.Len() ?
SfxFilterMatcher().GetFilter4FilterName( aPreselectedFilterName ) : aTypeName.Len() ?
const SfxFilter* pPreFilter = !aPreselectedFilterName.isEmpty() ?
SfxFilterMatcher().GetFilter4FilterName( aPreselectedFilterName ) : !aTypeName.isEmpty() ?
SfxFilterMatcher(OUString("swriter")).GetFilter4EA( aTypeName ) : 0;
if (!pPreFilter)
pPreFilter = SfxFilterMatcher(OUString("sweb")).GetFilter4EA( aTypeName );
@@ -249,7 +248,7 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
// repairing is done only if this type is requested from outside
// we don't do any type detection on broken packages (f.e. because it might be impossible), so any requested
// type will be accepted if the user allows to repair the file
if ( ( aWrap.TargetException >>= aZipException ) && ( aTypeName.Len() || aPreselectedFilterName.Len() ) )
if ( ( aWrap.TargetException >>= aZipException ) && ( !aTypeName.isEmpty() || !aPreselectedFilterName.isEmpty() ) )
{
if ( xInteraction.is() )
{
@@ -287,8 +286,8 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
if ( !bRepairAllowed )
{
aTypeName.Erase();
aPreselectedFilterName.Erase();
aTypeName = "";
aPreselectedFilterName = "";
}
}
}
@@ -298,8 +297,8 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
}
catch (const Exception&)
{
aTypeName.Erase();
aPreselectedFilterName.Erase();
aTypeName = "";
aPreselectedFilterName = "";
}
}
}
@@ -308,7 +307,7 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
aMedium.GetInStream();
if ( aMedium.GetErrorCode() == ERRCODE_NONE )
{
if ( aPreselectedFilterName.Len() )
if ( !aPreselectedFilterName.isEmpty() )
pFilter = SfxFilter::GetFilterByName( aPreselectedFilterName );
else
pFilter = SfxFilterMatcher().GetFilter4EA( aTypeName );
@@ -341,7 +340,7 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
if ( pFilter )
aTypeName = pFilter->GetTypeName();
else
aTypeName.Erase();
aTypeName = "";
}
}
}

View File

@@ -143,8 +143,8 @@ uno::Sequence< OUString > SwXAutoTextContainer::getElementNames(void) throw( uno
for ( sal_uInt16 i = 0; i < nCount; i++ )
{
// The names will be passed without a path extension.
String sGroupName(pGlossaries->GetGroupName(i));
pArr[i] = sGroupName.GetToken(0, GLOS_DELIM);
OUString sGroupName(pGlossaries->GetGroupName(i));
pArr[i] = sGroupName.getToken(0, GLOS_DELIM);
}
return aGroupNames;
}
@@ -153,8 +153,8 @@ sal_Bool SwXAutoTextContainer::hasByName(const OUString& Name)
throw( uno::RuntimeException )
{
SolarMutexGuard aGuard;
String sGroupName( pGlossaries->GetCompleteGroupName( Name ) );
if(sGroupName.Len())
OUString sGroupName( pGlossaries->GetCompleteGroupName( Name ) );
if(!sGroupName.isEmpty())
return sal_True;
return sal_False;
}
@@ -206,8 +206,8 @@ void SwXAutoTextContainer::removeByName(const OUString& aGroupName)
{
SolarMutexGuard aGuard;
// At first find the name with path extension
String sGroupName = pGlossaries->GetCompleteGroupName( aGroupName );
if(!sGroupName.Len())
OUString sGroupName = pGlossaries->GetCompleteGroupName( aGroupName );
if(sGroupName.isEmpty())
throw container::NoSuchElementException();
pGlossaries->DelGroupDoc(sGroupName);
}
@@ -372,8 +372,8 @@ uno::Reference< text::XAutoTextEntry > SwXAutoTextGroup::insertNewByName(const
throw uno::RuntimeException();
SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0;
String sShortName(aName);
String sLongName(aTitle);
OUString sShortName(aName);
OUString sLongName(aTitle);
if(pGlosGroup && !pGlosGroup->GetError())
{
uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
@@ -387,8 +387,8 @@ uno::Reference< text::XAutoTextEntry > SwXAutoTextGroup::insertNewByName(const
OTextCursorHelper::getUnoTunnelId()));
}
String sOnlyTxt;
String* pOnlyTxt = 0;
OUString sOnlyTxt;
OUString* pOnlyTxt = 0;
bool bNoAttr = !pxCursor && !pxRange;
if(bNoAttr)
{

View File

@@ -132,7 +132,7 @@ static CloseResult CloseModelAndDocSh(
static bool LoadFromURL_impl(
Reference< frame::XModel > &rxModel,
SfxObjectShellRef &rxDocSh,
const String &rURL,
const OUString &rURL,
bool bClose )
throw (RuntimeException)
{
@@ -191,12 +191,12 @@ namespace
::osl::Mutex m_aMutex;
Reference< util::XCloseable > m_xDocument;
Timer m_aDeleteTimer;
String m_sTemporaryFile;
OUString m_sTemporaryFile;
sal_Int32 m_nPendingDeleteAttempts;
public:
DelayedFileDeletion( const Reference< XModel >& _rxModel,
const String& _rTemporaryFile );
const OUString& _rTemporaryFile );
protected:
~DelayedFileDeletion( );
@@ -217,7 +217,7 @@ namespace
DelayedFileDeletion& operator=( const DelayedFileDeletion& ); // never implemented
};
DelayedFileDeletion::DelayedFileDeletion( const Reference< XModel >& _rxModel, const String& _rTemporaryFile )
DelayedFileDeletion::DelayedFileDeletion( const Reference< XModel >& _rxModel, const OUString& _rTemporaryFile )
:
m_xDocument( _rxModel, UNO_QUERY )
,m_sTemporaryFile( _rTemporaryFile )
@@ -337,10 +337,10 @@ namespace
static bool DeleteTmpFile_Impl(
Reference< frame::XModel > &rxModel,
SfxObjectShellRef &rxDocSh,
const String &rTmpFileURL )
const OUString &rTmpFileURL )
{
bool bRes = false;
if (rTmpFileURL.Len())
if (!rTmpFileURL.isEmpty())
{
bool bDelete = true;
if ( eVetoed == CloseModelAndDocSh( rxModel, rxDocSh ) )
@@ -703,18 +703,18 @@ uno::Any SAL_CALL SwXMailMerge::execute(
}
aURLObj.SetSmartURL( aCurOutputURL );
String aPath = aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI );
OUString aPath = aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI );
String aDelim = OUString(INET_PATH_TOKEN);
if (aPath.Len() >= aDelim.Len() &&
aPath.Copy( aPath.Len()-aDelim.Len() ).CompareTo( aDelim ) != COMPARE_EQUAL)
OUString aDelim = OUString(INET_PATH_TOKEN);
if (aPath.getLength() >= aDelim.getLength() &&
aPath.copy( aPath.getLength() - aDelim.getLength() ) == aDelim)
aPath += aDelim;
if (bCurFileNameFromColumn)
pMgr->SetEMailColumn( aCurFileNamePrefix );
else
{
aPath += String( aCurFileNamePrefix );
pMgr->SetEMailColumn( String() );
aPath += aCurFileNamePrefix;
pMgr->SetEMailColumn( OUString() );
}
pMgr->SetSubject( aPath );
if(MailMergeType::FILE == nCurOutputType)

View File

@@ -188,7 +188,7 @@ static SwPrintUIOptions * lcl_GetPrintUIOptions(
return new SwPrintUIOptions( nCurrentPage, bWebDoc, bSwSrcView, bHasSelection, bHasPostIts, rPrintData );
}
static SwTxtFmtColl *lcl_GetParaStyle(const String& rCollName, SwDoc* pDoc)
static SwTxtFmtColl *lcl_GetParaStyle(const OUString& rCollName, SwDoc* pDoc)
{
SwTxtFmtColl* pColl = pDoc->FindTxtFmtCollByName( rCollName );
if( !pColl )
@@ -1038,10 +1038,10 @@ static sal_uInt32 lcl_Any_To_ULONG(const Any& rValue, sal_Bool& bException)
return nRet;
}
static String lcl_CreateOutlineString( sal_uInt16 nIndex,
static OUString lcl_CreateOutlineString( sal_uInt16 nIndex,
const SwOutlineNodes& rOutlineNodes, const SwNumRule* pOutlRule)
{
String sEntry;
OUString sEntry;
const SwTxtNode * pTxtNd = rOutlineNodes[ nIndex ]->GetTxtNode();
SwNumberTree::tNumberVector aNumVector = pTxtNd->GetNumberVector();
if( pOutlRule && pTxtNd->GetNumRule())
@@ -1053,7 +1053,7 @@ static String lcl_CreateOutlineString( sal_uInt16 nIndex,
nVal ++;
nVal -= pOutlRule->Get(nLevel).GetStart();
sEntry += OUString::number( nVal );
sEntry += '.';
sEntry += ".";
}
sEntry += rOutlineNodes[ nIndex ]->
GetTxtNode()->GetExpandTxt( 0, STRING_LEN, sal_False );
@@ -1075,47 +1075,47 @@ void SwXTextDocument::setPagePrintSettings(const Sequence< beans::PropertyValue
int nCount = aSettings.getLength();
for(int i = 0; i < nCount; i++)
{
String sName = pProperties[i].Name;
OUString sName = pProperties[i].Name;
const Any& rVal = pProperties[i].Value;
sal_Bool bException;
sal_uInt32 nVal = lcl_Any_To_ULONG(rVal, bException);
if( COMPARE_EQUAL == sName.CompareToAscii("PageRows" ) )
if( sName.equalsAscii("PageRows" ) )
{
if(!nVal || nVal > 0xff)
throw RuntimeException();
aData.SetRow((sal_uInt8)nVal);
}
else if(COMPARE_EQUAL == sName.CompareToAscii("PageColumns"))
else if(sName.equalsAscii("PageColumns"))
{
if(!nVal || nVal > 0xff)
throw RuntimeException();
aData.SetCol((sal_uInt8)nVal);
}
else if(COMPARE_EQUAL == sName.CompareToAscii("LeftMargin"))
else if(sName.equalsAscii("LeftMargin"))
{
aData.SetLeftSpace(MM100_TO_TWIP_UNSIGNED(nVal));
}
else if(COMPARE_EQUAL == sName.CompareToAscii("RightMargin"))
else if(sName.equalsAscii("RightMargin"))
{
aData.SetRightSpace(MM100_TO_TWIP_UNSIGNED(nVal));
}
else if(COMPARE_EQUAL == sName.CompareToAscii("TopMargin"))
else if(sName.equalsAscii("TopMargin"))
{
aData.SetTopSpace(MM100_TO_TWIP_UNSIGNED(nVal));
}
else if(COMPARE_EQUAL == sName.CompareToAscii("BottomMargin"))
else if(sName.equalsAscii("BottomMargin"))
{
aData.SetBottomSpace(MM100_TO_TWIP_UNSIGNED(nVal));
}
else if(COMPARE_EQUAL == sName.CompareToAscii("HoriMargin"))
else if(sName.equalsAscii("HoriMargin"))
{
aData.SetHorzSpace(MM100_TO_TWIP_UNSIGNED(nVal));
}
else if(COMPARE_EQUAL == sName.CompareToAscii("VertMargin"))
else if(sName.equalsAscii("VertMargin"))
{
aData.SetVertSpace(MM100_TO_TWIP_UNSIGNED(nVal));
}
else if(COMPARE_EQUAL == sName.CompareToAscii("IsLandscape"))
else if(sName.equalsAscii("IsLandscape"))
{
bException = (::getBooleanCppuType() != rVal.getValueType());
aData.SetLandscape(*(sal_Bool*)rVal.getValue());
@@ -3348,13 +3348,13 @@ uno::Sequence< lang::Locale > SAL_CALL SwXTextDocument::getDocumentLanguages(
SwXLinkTargetSupplier::SwXLinkTargetSupplier(SwXTextDocument& rxDoc) :
pxDoc(&rxDoc)
{
sTables = String(SW_RES(STR_CONTENT_TYPE_TABLE));
sFrames = String(SW_RES(STR_CONTENT_TYPE_FRAME));
sGraphics = String(SW_RES(STR_CONTENT_TYPE_GRAPHIC));
sOLEs = String(SW_RES(STR_CONTENT_TYPE_OLE));
sSections = String(SW_RES(STR_CONTENT_TYPE_REGION));
sOutlines = String(SW_RES(STR_CONTENT_TYPE_OUTLINE));
sBookmarks = String(SW_RES(STR_CONTENT_TYPE_BOOKMARK));
sTables = SW_RES(STR_CONTENT_TYPE_TABLE);
sFrames = SW_RES(STR_CONTENT_TYPE_FRAME);
sGraphics = SW_RES(STR_CONTENT_TYPE_GRAPHIC);
sOLEs = SW_RES(STR_CONTENT_TYPE_OLE);
sSections = SW_RES(STR_CONTENT_TYPE_REGION);
sOutlines = SW_RES(STR_CONTENT_TYPE_OUTLINE);
sBookmarks = SW_RES(STR_CONTENT_TYPE_BOOKMARK);
}
SwXLinkTargetSupplier::~SwXLinkTargetSupplier()
@@ -3367,8 +3367,8 @@ Any SwXLinkTargetSupplier::getByName(const OUString& rName)
Any aRet;
if(!pxDoc)
throw RuntimeException();
String sToCompare(rName);
String sSuffix = OUString('|');
OUString sToCompare(rName);
OUString sSuffix("|");
if(sToCompare == sTables)
{
sSuffix += "table";
@@ -3420,7 +3420,7 @@ Any SwXLinkTargetSupplier::getByName(const OUString& rName)
}
else if(sToCompare == sBookmarks)
{
sSuffix.Erase();
sSuffix = "";
Reference< XNameAccess > xBkms = new SwXLinkNameAccessWrapper(
pxDoc->getBookmarks(), sToCompare, sSuffix );
Reference< XPropertySet > xRet(xBkms, UNO_QUERY);
@@ -3449,7 +3449,7 @@ Sequence< OUString > SwXLinkTargetSupplier::getElementNames(void)
sal_Bool SwXLinkTargetSupplier::hasByName(const OUString& rName)
throw( RuntimeException )
{
String sToCompare(rName);
OUString sToCompare(rName);
if( sToCompare == sTables ||
sToCompare == sFrames ||
sToCompare == sGraphics||
@@ -3523,17 +3523,17 @@ Any SwXLinkNameAccessWrapper::getByName(const OUString& rName)
Any aRet;
bool bFound = false;
//cut link extension and call the real NameAccess
String sParam = rName;
String sSuffix(sLinkSuffix);
if(sParam.Len() > sSuffix.Len() )
OUString sParam = rName;
OUString sSuffix(sLinkSuffix);
if(sParam.getLength() > sSuffix.getLength() )
{
String sCmp = sParam.Copy(sParam.Len() - sSuffix.Len(),
sSuffix.Len());
OUString sCmp = sParam.copy(sParam.getLength() - sSuffix.getLength(),
sSuffix.getLength());
if(sCmp == sSuffix)
{
if(pxDoc)
{
sParam = sParam.Copy(0, sParam.Len() - sSuffix.Len());
sParam = sParam.copy(0, sParam.getLength() - sSuffix.getLength());
if(!pxDoc->GetDocShell())
throw RuntimeException();
SwDoc* pDoc = pxDoc->GetDocShell()->GetDoc();
@@ -3554,7 +3554,7 @@ Any SwXLinkNameAccessWrapper::getByName(const OUString& rName)
}
else
{
aRet = xRealAccess->getByName(sParam.Copy(0, sParam.Len() - sSuffix.Len()));
aRet = xRealAccess->getByName(sParam.copy(0, sParam.getLength() - sSuffix.getLength()));
Reference< XInterface > xInt;
if(!(aRet >>= xInt))
throw RuntimeException();
@@ -3583,12 +3583,12 @@ Sequence< OUString > SwXLinkNameAccessWrapper::getElementNames(void)
sal_uInt16 nOutlineCount = rOutlineNodes.size();
aRet.realloc(nOutlineCount);
OUString* pResArr = aRet.getArray();
String sSuffix = OUString('|');
OUString sSuffix("|");
sSuffix += OUString::createFromAscii("outline");
const SwNumRule* pOutlRule = pDoc->GetOutlineNumRule();
for (sal_uInt16 i = 0; i < nOutlineCount; ++i)
{
String sEntry = lcl_CreateOutlineString(i, rOutlineNodes, pOutlRule);
OUString sEntry = lcl_CreateOutlineString(i, rOutlineNodes, pOutlRule);
sEntry += sSuffix;
pResArr[i] = sEntry;
}
@@ -3611,14 +3611,14 @@ sal_Bool SwXLinkNameAccessWrapper::hasByName(const OUString& rName)
throw( RuntimeException )
{
sal_Bool bRet = sal_False;
String sParam(rName);
if(sParam.Len() > sLinkSuffix.getLength() )
OUString sParam(rName);
if(sParam.getLength() > sLinkSuffix.getLength() )
{
String sCmp = sParam.Copy(sParam.Len() - sLinkSuffix.getLength(),
OUString sCmp = sParam.copy(sParam.getLength() - sLinkSuffix.getLength(),
sLinkSuffix.getLength());
if(sCmp == sLinkSuffix)
{
sParam = sParam.Copy(0, sParam.Len() - sLinkSuffix.getLength());
sParam = sParam.copy(0, sParam.getLength() - sLinkSuffix.getLength());
if(pxDoc)
{
if(!pxDoc->GetDocShell())

View File

@@ -556,7 +556,7 @@ Sequence< Sequence< PropertyValue > > SwXTextView::getRubyList( sal_Bool /*bAuto
{
const SwRubyListEntry* pEntry = &aList[n];
const String& rEntryText = pEntry->GetText();
const OUString& rEntryText = pEntry->GetText();
const SwFmtRuby& rAttr = pEntry->GetRubyAttr();
pRet[n].realloc(5);