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( ScDocument* pDoc );
~ScAreaNameIterator() {} ~ScAreaNameIterator() {}
bool Next( rtl::OUString& rName, ScRange& rRange );
bool Next( String& rName, ScRange& rRange ); bool Next( String& rName, ScRange& rRange );
bool WasDBName() const { return !bFirstPass; } bool WasDBName() const { return !bFirstPass; }
}; };

View File

@@ -91,8 +91,8 @@ private:
public: public:
ScDocumentLoader( const String& rFileName, ScDocumentLoader( const String& rFileName,
String& rFilterName, String& rOptions, String& rFilterName, String& rOptions,
sal_uInt32 nRekCnt = 0, sal_Bool bWithInteraction = false ); sal_uInt32 nRekCnt = 0, bool bWithInteraction = false );
~ScDocumentLoader(); ~ScDocumentLoader();
ScDocument* GetDocument(); ScDocument* GetDocument();
ScDocShell* GetDocShell() { return pDocShell; } 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 ) bool ScAreaNameIterator::Next( String& rName, ScRange& rRange )
{ {
for (;;) for (;;)

View File

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

View File

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

View File

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