String to rtl::OUString.

This commit is contained in:
Kohei Yoshida 2011-08-29 21:25:37 -04:00
parent 63e3fb4417
commit c6d99ac2e3
6 changed files with 44 additions and 33 deletions

View file

@ -317,6 +317,7 @@ public:
ScAreaNameIterator( ScDocument* pDoc );
~ScAreaNameIterator() {}
bool Next( rtl::OUString& rName, ScRange& rRange );
bool Next( String& rName, ScRange& rRange );
bool WasDBName() const { return !bFirstPass; }
};

View file

@ -91,8 +91,8 @@ private:
public:
ScDocumentLoader( const String& rFileName,
String& rFilterName, String& rOptions,
sal_uInt32 nRekCnt = 0, sal_Bool bWithInteraction = false );
String& rFilterName, String& rOptions,
sal_uInt32 nRekCnt = 0, bool bWithInteraction = false );
~ScDocumentLoader();
ScDocument* GetDocument();
ScDocShell* GetDocShell() { return pDocShell; }

View file

@ -1057,6 +1057,16 @@ ScAreaNameIterator::ScAreaNameIterator( ScDocument* pDoc ) :
}
}
bool ScAreaNameIterator::Next( rtl::OUString& rName, ScRange& rRange )
{
// Just a wrapper for rtl::OUString for now. It should replace the method
// below eventually.
String aTmp;
bool bRet = Next(aTmp, rRange);
rName = aTmp;
return bRet;
}
bool ScAreaNameIterator::Next( String& rName, ScRange& rRange )
{
for (;;)

View file

@ -546,7 +546,7 @@ void ScDocumentLoader::RemoveAppPrefix( String& rFilterName )
ScDocumentLoader::ScDocumentLoader( const String& rFileName,
String& rFilterName, String& rOptions,
sal_uInt32 nRekCnt, sal_Bool bWithInteraction ) :
sal_uInt32 nRekCnt, bool bWithInteraction ) :
pDocShell(0),
pMedium(0)
{

View file

@ -89,10 +89,10 @@ public:
virtual short Execute(); // overwritten to set dialog parent
String GetURL();
String GetFilter(); // may be empty
String GetOptions(); // filter options
String GetSource(); // separated by ";"
rtl::OUString GetURL();
rtl::OUString GetFilter(); // may be empty
rtl::OUString GetOptions(); // filter options
rtl::OUString GetSource(); // separated by ";"
sal_uLong GetRefresh(); // 0 if disabled
};

View file

@ -121,27 +121,27 @@ IMPL_LINK( ScLinkedAreaDlg, BrowseHdl, PushButton*, EMPTYARG )
IMPL_LINK( ScLinkedAreaDlg, FileHdl, ComboBox*, EMPTYARG )
{
String aEntered = aCbUrl.GetURL();
rtl::OUString aEntered = aCbUrl.GetURL();
if (pSourceShell)
{
SfxMedium* pMed = pSourceShell->GetMedium();
if ( pMed->GetName() == aEntered )
if ( aEntered.equals(pMed->GetName()) )
{
// already loaded - nothing to do
return 0;
}
}
String aFilter;
String aOptions;
rtl::OUString aFilter;
rtl::OUString aOptions;
// get filter name by looking at the file content (bWithContent = TRUE)
// Break operation if any error occurred inside.
if (!ScDocumentLoader::GetFilterName( aEntered, aFilter, aOptions, true, true ))
return 0;
// #i53241# replace HTML filter with DataQuery filter
if( aFilter.EqualsAscii( FILTERNAME_HTML ) )
aFilter.AssignAscii( FILTERNAME_QUERY );
if (aFilter.equalsAscii(FILTERNAME_HTML))
aFilter = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(FILTERNAME_QUERY));
LoadDocument( aEntered, aFilter, aOptions );
@ -169,7 +169,7 @@ void ScLinkedAreaDlg::LoadDocument( const String& rFile, const String& rFilter,
SfxErrorContext aEc( ERRCTX_SFX_OPENDOC, rFile );
ScDocumentLoader aLoader( rFile, aNewFilter, aNewOptions, 0, sal_True ); // with interaction
ScDocumentLoader aLoader( rFile, aNewFilter, aNewOptions, 0, true ); // with interaction
pSourceShell = aLoader.GetDocShell();
if ( pSourceShell )
{
@ -205,7 +205,7 @@ void ScLinkedAreaDlg::InitFromOldLink( const String& rFile, const String& rFilte
aLbRanges.SelectEntry( aRange );
}
sal_Bool bDoRefresh = ( nRefresh != 0 );
bool bDoRefresh = (nRefresh != 0);
aBtnReload.Check( bDoRefresh );
if (bDoRefresh)
aNfDelay.SetValue( nRefresh );
@ -236,11 +236,11 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg
WaitObject aWait( this );
// replace HTML filter with DataQuery filter
const String aHTMLFilterName( RTL_CONSTASCII_USTRINGPARAM( FILTERNAME_HTML ) );
const String aWebQFilterName( RTL_CONSTASCII_USTRINGPARAM( FILTERNAME_QUERY ) );
const rtl::OUString aHTMLFilterName( RTL_CONSTASCII_USTRINGPARAM( FILTERNAME_HTML ) );
const rtl::OUString aWebQFilterName( RTL_CONSTASCII_USTRINGPARAM( FILTERNAME_QUERY ) );
const SfxFilter* pFilter = pMed->GetFilter();
if( pFilter && (pFilter->GetFilterName() == aHTMLFilterName) )
if (pFilter && aHTMLFilterName.equals(pFilter->GetFilterName()))
{
const SfxFilter* pNewFilter =
ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( aWebQFilterName );
@ -288,19 +288,19 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg
void ScLinkedAreaDlg::UpdateSourceRanges()
{
aLbRanges.SetUpdateMode( false );
aLbRanges.SetUpdateMode(false);
aLbRanges.Clear();
if ( pSourceShell )
{
ScAreaNameIterator aIter( pSourceShell->GetDocument() );
ScRange aDummy;
String aName;
rtl::OUString aName;
while ( aIter.Next( aName, aDummy ) )
aLbRanges.InsertEntry( aName );
}
aLbRanges.SetUpdateMode( sal_True );
aLbRanges.SetUpdateMode(true);
if ( aLbRanges.GetEntryCount() == 1 )
aLbRanges.SelectEntryPos(0);
@ -308,15 +308,15 @@ void ScLinkedAreaDlg::UpdateSourceRanges()
void ScLinkedAreaDlg::UpdateEnable()
{
sal_Bool bEnable = ( pSourceShell && aLbRanges.GetSelectEntryCount() );
bool bEnable = ( pSourceShell && aLbRanges.GetSelectEntryCount() );
aBtnOk.Enable( bEnable );
sal_Bool bReload = aBtnReload.IsChecked();
bool bReload = aBtnReload.IsChecked();
aNfDelay.Enable( bReload );
aFtSeconds.Enable( bReload );
}
String ScLinkedAreaDlg::GetURL()
rtl::OUString ScLinkedAreaDlg::GetURL()
{
if (pSourceShell)
{
@ -326,37 +326,37 @@ String ScLinkedAreaDlg::GetURL()
return EMPTY_STRING;
}
String ScLinkedAreaDlg::GetFilter()
rtl::OUString ScLinkedAreaDlg::GetFilter()
{
if (pSourceShell)
{
SfxMedium* pMed = pSourceShell->GetMedium();
return pMed->GetFilter()->GetFilterName();
}
return EMPTY_STRING;
return rtl::OUString();
}
String ScLinkedAreaDlg::GetOptions()
rtl::OUString ScLinkedAreaDlg::GetOptions()
{
if (pSourceShell)
{
SfxMedium* pMed = pSourceShell->GetMedium();
return ScDocumentLoader::GetOptions( *pMed );
}
return EMPTY_STRING;
return rtl::OUString();
}
String ScLinkedAreaDlg::GetSource()
rtl::OUString ScLinkedAreaDlg::GetSource()
{
String aSource;
rtl::OUStringBuffer aBuf;
sal_uInt16 nCount = aLbRanges.GetSelectEntryCount();
for (sal_uInt16 i=0; i<nCount; i++)
{
if (i > 0)
aSource.Append( (sal_Unicode) ';' );
aSource.Append( aLbRanges.GetSelectEntry( i ) );
aBuf.append(sal_Unicode(';'));
aBuf.append(aLbRanges.GetSelectEntry(i));
}
return aSource;
return aBuf.makeStringAndClear();
}
sal_uLong ScLinkedAreaDlg::GetRefresh()