[Libreoffice-commits] .: 2 commits - sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Mon Aug 29 21:19:37 PDT 2011
sc/inc/tablink.hxx | 41 +++++------
sc/source/filter/xml/XMLTableSourceContext.cxx | 15 +---
sc/source/ui/docshell/arealink.cxx | 17 ++--
sc/source/ui/docshell/docfunc.cxx | 11 +-
sc/source/ui/docshell/docsh4.cxx | 19 ++---
sc/source/ui/docshell/tablink.cxx | 93 ++++++++++++-------------
sc/source/ui/unoobj/cellsuno.cxx | 14 +--
sc/source/ui/unoobj/linkuno.cxx | 2
8 files changed, 109 insertions(+), 103 deletions(-)
New commits:
commit 711abf15b1391a143998fbc0ec8c5b9378ac62f7
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Tue Aug 30 00:18:55 2011 -0400
String / bool conversions for ScTableLink.
diff --git a/sc/inc/tablink.hxx b/sc/inc/tablink.hxx
index 4dba316..98f0422 100644
--- a/sc/inc/tablink.hxx
+++ b/sc/inc/tablink.hxx
@@ -42,13 +42,13 @@ class ScTableLink : public ::sfx2::SvBaseLink, public ScRefreshTimer
{
private:
TableLink_Impl* pImpl;
- String aFileName;
- String aFilterName;
- String aOptions;
- sal_Bool bInCreate;
- sal_Bool bInEdit;
- sal_Bool bAddUndo;
- sal_Bool bDoPaint;
+ rtl::OUString aFileName;
+ rtl::OUString aFilterName;
+ rtl::OUString aOptions;
+ bool bInCreate:1;
+ bool bInEdit:1;
+ bool bAddUndo:1;
+ bool bDoPaint:1;
public:
TYPEINFO();
@@ -65,13 +65,13 @@ public:
sal_Bool Refresh(const String& rNewFile, const String& rNewFilter,
const String* pNewOptions /* = NULL */, sal_uLong nNewRefresh );
- void SetInCreate(sal_Bool bSet) { bInCreate = bSet; }
- void SetAddUndo(sal_Bool bSet) { bAddUndo = bSet; }
- void SetPaint(sal_Bool bSet) { bDoPaint = bSet; }
+ void SetInCreate(bool bSet) { bInCreate = bSet; }
+ void SetAddUndo(bool bSet) { bAddUndo = bSet; }
+ void SetPaint(bool bSet) { bDoPaint = bSet; }
- const String& GetFileName() const { return aFileName; }
- const String& GetFilterName() const { return aFilterName; }
- const String& GetOptions() const { return aOptions; }
+ const rtl::OUString& GetFileName() const { return aFileName; }
+ const rtl::OUString& GetFilterName() const { return aFilterName; }
+ const rtl::OUString& GetOptions() const { return aOptions; }
sal_Bool IsUsed() const;
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index a72e439..386dde4 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -90,8 +90,8 @@ ScTableLink::ScTableLink(ScDocShell* pDocSh, const String& rFile,
aOptions(rOpt),
bInCreate( false ),
bInEdit( false ),
- bAddUndo( sal_True ),
- bDoPaint( sal_True )
+ bAddUndo( true ),
+ bDoPaint( true )
{
pImpl->m_pDocSh = pDocSh;
}
@@ -107,8 +107,8 @@ ScTableLink::ScTableLink(SfxObjectShell* pShell, const String& rFile,
aOptions(rOpt),
bInCreate( false ),
bInEdit( false ),
- bAddUndo( sal_True ),
- bDoPaint( sal_True )
+ bAddUndo( true ),
+ bDoPaint( true )
{
pImpl->m_pDocSh = static_cast< ScDocShell* >( pShell );
SetRefreshHandler( LINK( this, ScTableLink, RefreshHdl ) );
@@ -124,7 +124,7 @@ ScTableLink::~ScTableLink()
ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
SCTAB nCount = pDoc->GetTableCount();
for (SCTAB nTab=0; nTab<nCount; nTab++)
- if (pDoc->IsLinked(nTab) && pDoc->GetLinkDoc(nTab)==aFileName)
+ if (pDoc->IsLinked(nTab) && aFileName.equals(pDoc->GetLinkDoc(nTab)))
pDoc->SetLink( nTab, SC_LINK_NONE, aEmpty, aEmpty, aEmpty, aEmpty, 0 );
delete pImpl;
}
@@ -139,7 +139,7 @@ void ScTableLink::Edit( Window* pParent, const Link& rEndEditHdl )
if (pParent)
Application::SetDefDialogParent(pParent);
- bInEdit = sal_True;
+ bInEdit = true;
SvBaseLink::Edit( pParent, LINK( this, ScTableLink, TableEndEditHdl ) );
}
@@ -197,33 +197,33 @@ sal_Bool ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
if (!rNewFile.Len() || !rNewFilter.Len())
return false;
- String aNewUrl( ScGlobal::GetAbsDocName( rNewFile, pImpl->m_pDocSh ) );
- sal_Bool bNewUrlName = (aNewUrl != aFileName);
+ rtl::OUString aNewUrl = ScGlobal::GetAbsDocName(rNewFile, pImpl->m_pDocSh);
+ bool bNewUrlName = !aFileName.equals(aNewUrl);
const SfxFilter* pFilter = pImpl->m_pDocSh->GetFactory().GetFilterContainer()->GetFilter4FilterName(rNewFilter);
if (!pFilter)
return false;
ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
- pDoc->SetInLinkUpdate( sal_True );
+ pDoc->SetInLinkUpdate( true );
sal_Bool bUndo(pDoc->IsUndoEnabled());
// wenn neuer Filter ausgewaehlt wurde, Optionen vergessen
- if ( rNewFilter != aFilterName )
- aOptions.Erase();
+ if (!aFilterName.equals(rNewFilter))
+ aOptions = rtl::OUString();
if ( pNewOptions ) // Optionen hart angegeben?
aOptions = *pNewOptions;
// ItemSet immer anlegen, damit die DocShell die Optionen setzen kann
SfxItemSet* pSet = new SfxAllItemSet( SFX_APP()->GetPool() );
- if ( aOptions.Len() )
+ if (!aOptions.isEmpty())
pSet->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, aOptions ) );
SfxMedium* pMed = new SfxMedium(aNewUrl, STREAM_STD_READ, false, pFilter, pSet);
if ( bInEdit ) // only if using the edit dialog,
- pMed->UseInteractionHandler( sal_True ); // enable the filter options dialog
+ pMed->UseInteractionHandler(true); // enable the filter options dialog
// aRef->DoClose() will be called explicitly, but it is still more safe to use SfxObjectShellLock here
ScDocShell* pSrcShell = new ScDocShell(SFX_CREATE_MODE_INTERNAL);
@@ -238,7 +238,7 @@ sal_Bool ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
// Undo...
ScDocument* pUndoDoc = NULL;
- sal_Bool bFirst = sal_True;
+ sal_Bool bFirst = true;
if (bAddUndo && bUndo)
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
@@ -258,7 +258,7 @@ sal_Bool ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
for (SCTAB nTab=0; nTab<nCount; nTab++)
{
sal_uInt8 nMode = pDoc->GetLinkMode(nTab);
- if (nMode && pDoc->GetLinkDoc(nTab)==aFileName)
+ if (nMode && aFileName.equals(pDoc->GetLinkDoc(nTab)))
{
String aTabName = pDoc->GetLinkTab(nTab);
@@ -267,9 +267,9 @@ sal_Bool ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
if (bAddUndo && bUndo)
{
if (bFirst)
- pUndoDoc->InitUndo( pDoc, nTab, nTab, sal_True, sal_True );
+ pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
else
- pUndoDoc->AddUndoTab( nTab, nTab, sal_True, sal_True );
+ pUndoDoc->AddUndoTab( nTab, nTab, true, true );
bFirst = false;
ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab);
pDoc->CopyToDocument(aRange, IDF_ALL, false, pUndoDoc);
@@ -289,7 +289,7 @@ sal_Bool ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
{
pDoc->RenameTab( nTab,
ScGlobal::GetDocTabName( aNewUrl, aTabName ),
- false, sal_True ); // kein RefUpdate, kein ValidTabName
+ false, true ); // kein RefUpdate, kein ValidTabName
}
}
@@ -388,11 +388,11 @@ sal_Bool ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
pDoc->SetString( 1,2,nTab, aTabName );
}
- bNotFound = sal_True;
+ bNotFound = true;
}
- if ( bNewUrlName || rNewFilter != aFilterName ||
- aNewOpt != aOptions || pNewOptions ||
+ if ( bNewUrlName || !aFilterName.equals(rNewFilter) ||
+ !aOptions.equals(aNewOpt) || pNewOptions ||
nNewRefresh != GetRefreshDelay() )
pDoc->SetLink( nTab, nMode, aNewUrl, rNewFilter, aNewOpt,
aTabName, nNewRefresh );
@@ -403,9 +403,9 @@ sal_Bool ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
if ( bNewUrlName )
aFileName = aNewUrl;
- if ( rNewFilter != aFilterName )
+ if (!aFilterName.equals(rNewFilter))
aFilterName = rNewFilter;
- if ( aNewOpt != aOptions )
+ if (!aOptions.equals(aNewOpt))
aOptions = aNewOpt;
// aufraeumen
@@ -440,7 +440,7 @@ sal_Bool ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
aHint.SetSheetLink( aFileName );
pDoc->BroadcastUno( aHint );
- return sal_True;
+ return true;
}
IMPL_LINK( ScTableLink, RefreshHdl, ScTableLink*, EMPTYARG )
@@ -485,7 +485,7 @@ bool ScDocumentLoader::GetFilterName( const String& rFileName,
{
rFilter = pMed->GetFilter()->GetFilterName();
rOptions = GetOptions(*pMed);
- return sal_True;
+ return true;
}
}
pDocSh = SfxObjectShell::GetNext( *pDocSh, &aScType );
@@ -503,7 +503,7 @@ bool ScDocumentLoader::GetFilterName( const String& rFileName,
if ( pMedium->GetError() == ERRCODE_NONE )
{
if ( bWithInteraction )
- pMedium->UseInteractionHandler(sal_True); // #i73992# no longer called from GuessFilter
+ pMedium->UseInteractionHandler(true); // #i73992# no longer called from GuessFilter
SfxFilterMatcher aMatcher( String::CreateFromAscii("scalc") );
if( bWithContent )
@@ -554,7 +554,7 @@ ScDocumentLoader::ScDocumentLoader( const String& rFileName,
pMedium(0)
{
if ( !rFilterName.Len() )
- GetFilterName( rFileName, rFilterName, rOptions, sal_True, bWithInteraction );
+ GetFilterName( rFileName, rFilterName, rOptions, true, bWithInteraction );
const SfxFilter* pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( rFilterName );
@@ -568,7 +568,7 @@ ScDocumentLoader::ScDocumentLoader( const String& rFileName,
return ;
if ( bWithInteraction )
- pMedium->UseInteractionHandler( sal_True ); // to enable the filter options dialog
+ pMedium->UseInteractionHandler( true ); // to enable the filter options dialog
pDocShell = new ScDocShell( SFX_CREATE_MODE_INTERNAL );
aRef = pDocShell;
diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx
index 8cc27ff..1a64b92 100644
--- a/sc/source/ui/unoobj/linkuno.cxx
+++ b/sc/source/ui/unoobj/linkuno.cxx
@@ -137,7 +137,7 @@ ScTableLink* ScSheetLinkObj::GetLink_Impl() const
if (pBase->ISA(ScTableLink))
{
ScTableLink* pTabLink = (ScTableLink*)pBase;
- if ( pTabLink->GetFileName() == aFileName )
+ if ( pTabLink->GetFileName().equals(aFileName) )
return pTabLink;
}
}
commit 3c2a26c84e70fd996855181d319970e2230b2459
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Tue Aug 30 00:05:53 2011 -0400
More string conversion around ScDocumentLoader.
diff --git a/sc/inc/tablink.hxx b/sc/inc/tablink.hxx
index 5fd98df..4dba316 100644
--- a/sc/inc/tablink.hxx
+++ b/sc/inc/tablink.hxx
@@ -89,6 +89,10 @@ private:
SfxObjectShellRef aRef;
SfxMedium* pMedium;
+ static bool GetFilterName( const String& rFileName,
+ String& rFilter, String& rOptions,
+ bool bWithContent, bool bWithInteraction );
+
public:
ScDocumentLoader( const String& rFileName,
String& rFilterName, String& rOptions,
@@ -96,27 +100,24 @@ public:
~ScDocumentLoader();
ScDocument* GetDocument();
ScDocShell* GetDocShell() { return pDocShell; }
- sal_Bool IsError() const;
- String GetTitle() const;
+ bool IsError() const;
+ rtl::OUString GetTitle() const;
void ReleaseDocRef(); // without calling DoClose
- static String GetOptions( SfxMedium& rMedium );
+ static rtl::OUString GetOptions( SfxMedium& rMedium );
/** Returns the filter name and options from a file name.
@param bWithContent
true = Tries to detect the filter by looking at the file contents.
false = Detects filter by file name extension only (should be used in filter code only).
@return sal_True if a filter could be found, sal_False otherwise. */
- static sal_Bool GetFilterName( const String& rFileName,
- String& rFilter, String& rOptions,
- sal_Bool bWithContent, sal_Bool bWithInteraction );
static bool GetFilterName( const ::rtl::OUString& rFileName,
::rtl::OUString& rFilter, ::rtl::OUString& rOptions,
bool bWithContent, bool bWithInteraction );
- static void RemoveAppPrefix( String& rFilterName );
+ static void RemoveAppPrefix( rtl::OUString& rFilterName );
};
#endif
diff --git a/sc/source/filter/xml/XMLTableSourceContext.cxx b/sc/source/filter/xml/XMLTableSourceContext.cxx
index 8e55441..6877984 100644
--- a/sc/source/filter/xml/XMLTableSourceContext.cxx
+++ b/sc/source/filter/xml/XMLTableSourceContext.cxx
@@ -121,14 +121,9 @@ void ScXMLTableSourceContext::EndElement()
if (pDoc->RenameTab( GetScImport().GetTables().GetCurrentSheet(),
GetScImport().GetTables().GetCurrentSheetName(), false, sal_True))
{
- String aFileString(sLink);
- String aFilterString(sFilterName);
- String aOptString(sFilterOptions);
- String aSheetString(sTableName);
-
- aFileString = ScGlobal::GetAbsDocName( aFileString, pDoc->GetDocumentShell() );
- if ( !aFilterString.Len() )
- ScDocumentLoader::GetFilterName( aFileString, aFilterString, aOptString, false, false );
+ sLink = ScGlobal::GetAbsDocName( sLink, pDoc->GetDocumentShell() );
+ if (sFilterName.isEmpty())
+ ScDocumentLoader::GetFilterName( sLink, sFilterName, sFilterOptions, false, false );
sal_uInt8 nLinkMode = SC_LINK_NONE;
if ( nMode == sheet::SheetLinkMode_NORMAL )
@@ -137,8 +132,8 @@ void ScXMLTableSourceContext::EndElement()
nLinkMode = SC_LINK_VALUE;
pDoc->SetLink( GetScImport().GetTables().GetCurrentSheet(),
- nLinkMode, aFileString, aFilterString, aOptString,
- aSheetString, nRefresh );
+ nLinkMode, sLink, sFilterName, sFilterOptions,
+ sTableName, nRefresh );
}
}
}
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index a028a51..9928ea7 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -130,23 +130,28 @@ void ScAreaLink::Edit(Window* pParent, const Link& /* rEndEditHdl */ )
sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument()->GetLinkManager();
if (pLinkManager!=NULL)
{
- String aFile;
- String aFilter;
- String aArea;
- pLinkManager->GetDisplayNames( this,0,&aFile,&aArea,&aFilter);
+ String aTmp1;
+ String aTmp2;
+ String aTmp3;
+ pLinkManager->GetDisplayNames(this, NULL, &aTmp1, &aTmp2, &aTmp3);
+ rtl::OUString aFile = aTmp1;
+ rtl::OUString aArea = aTmp2;
+ rtl::OUString aFilter = aTmp3;
// the file dialog returns the filter name with the application prefix
// -> remove prefix
ScDocumentLoader::RemoveAppPrefix( aFilter );
// dialog doesn't set area, so keep old one
- if ( !aArea.Len() )
+ if (aArea.isEmpty())
{
aArea = aSourceArea;
// adjust in dialog:
String aNewLinkName;
- sfx2::MakeLnkName( aNewLinkName, NULL, aFile, aArea, &aFilter );
+ aTmp1 = aFilter;
+ sfx2::MakeLnkName(aNewLinkName, NULL, aFile, aArea, &aTmp1);
+ aFilter = aTmp1;
SetName( aNewLinkName );
}
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index cb79c50..7d2774b 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -4902,10 +4902,10 @@ sal_Bool ScDocFunc::InsertAreaLink( const String& rFile, const String& rFilter,
++nLinkPos;
}
- String aFilterName = rFilter;
- String aNewOptions = rOptions;
- if (!aFilterName.Len())
- ScDocumentLoader::GetFilterName( rFile, aFilterName, aNewOptions, sal_True, !bApi );
+ rtl::OUString aFilterName = rFilter;
+ rtl::OUString aNewOptions = rOptions;
+ if (aFilterName.isEmpty())
+ ScDocumentLoader::GetFilterName( rFile, aFilterName, aNewOptions, true, !bApi );
// remove application prefix from filter name here, so the filter options
// aren't reset when the filter name is changed in ScAreaLink::DataChanged
@@ -4913,7 +4913,8 @@ sal_Bool ScDocFunc::InsertAreaLink( const String& rFile, const String& rFilter,
ScAreaLink* pLink = new ScAreaLink( &rDocShell, rFile, aFilterName,
aNewOptions, rSource, rDestRange, nRefresh );
- pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, rFile, &aFilterName, &rSource );
+ String aTmp = aFilterName;
+ pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, rFile, &aTmp, &rSource );
// Undo fuer den leeren Link
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 5fe6de5..80034f0 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -713,30 +713,31 @@ void ScDocShell::Execute( SfxRequest& rReq )
pReqArgs->GetItemState( SID_FILE_NAME, sal_True, &pItem ) == SFX_ITEM_SET &&
pItem->ISA(SfxStringItem) )
{
- String aFileName = ((const SfxStringItem*)pItem)->GetValue();
+ rtl::OUString aFileName =
+ static_cast<const SfxStringItem*>(pItem)->GetValue();
- String aFilterName;
+ rtl::OUString aFilterName;
if ( pReqArgs->GetItemState( SID_FILTER_NAME, sal_True, &pItem ) == SFX_ITEM_SET &&
pItem->ISA(SfxStringItem) )
{
- aFilterName = ((const SfxStringItem*)pItem)->GetValue();
+ aFilterName = static_cast<const SfxStringItem*>(pItem)->GetValue();
}
- String aOptions;
+ rtl::OUString aOptions;
if ( pReqArgs->GetItemState( SID_FILE_FILTEROPTIONS, sal_True, &pItem ) == SFX_ITEM_SET &&
pItem->ISA(SfxStringItem) )
{
- aOptions = ((const SfxStringItem*)pItem)->GetValue();
+ aOptions = static_cast<const SfxStringItem*>(pItem)->GetValue();
}
short nVersion = 0;
if ( pReqArgs->GetItemState( SID_VERSION, sal_True, &pItem ) == SFX_ITEM_SET &&
pItem->ISA(SfxInt16Item) )
{
- nVersion = ((const SfxInt16Item*)pItem)->GetValue();
+ nVersion = static_cast<const SfxInt16Item*>(pItem)->GetValue();
}
// kein Filter angegeben -> Detection
- if ( !aFilterName.Len() )
- ScDocumentLoader::GetFilterName( aFileName, aFilterName, aOptions, sal_True, false );
+ if (aFilterName.isEmpty())
+ ScDocumentLoader::GetFilterName( aFileName, aFilterName, aOptions, true, false );
// filter name from dialog contains application prefix,
// GetFilter needs name without the prefix.
@@ -744,7 +745,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
const SfxFilter* pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( aFilterName );
SfxItemSet* pSet = new SfxAllItemSet( pApp->GetPool() );
- if ( aOptions.Len() )
+ if (!aOptions.isEmpty())
pSet->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, aOptions ) );
if ( nVersion != 0 )
pSet->Put( SfxInt16Item( SID_VERSION, nVersion ) );
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 9cfd9e8..a72e439 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -149,9 +149,11 @@ void ScTableLink::Edit( Window* pParent, const Link& rEndEditHdl )
sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument()->GetLinkManager();
if (pLinkManager!=NULL)
{
- String aFile;
- String aFilter;
- pLinkManager->GetDisplayNames( this,0,&aFile,NULL,&aFilter);
+ String aTmp1;
+ String aTmp2;
+ pLinkManager->GetDisplayNames(this, 0, &aTmp1, NULL, &aTmp2);
+ rtl::OUString aFile = aTmp1;
+ rtl::OUString aFilter = aTmp2;
// the file dialog returns the filter name with the application prefix
// -> remove prefix
@@ -458,19 +460,19 @@ IMPL_LINK( ScTableLink, TableEndEditHdl, ::sfx2::SvBaseLink*, pLink )
// === ScDocumentLoader ==================================================
-String ScDocumentLoader::GetOptions( SfxMedium& rMedium )
+rtl::OUString ScDocumentLoader::GetOptions( SfxMedium& rMedium )
{
SfxItemSet* pSet = rMedium.GetItemSet();
const SfxPoolItem* pItem;
- if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_FILE_FILTEROPTIONS, sal_True, &pItem ) )
+ if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_FILE_FILTEROPTIONS, true, &pItem ) )
return ((const SfxStringItem*)pItem)->GetValue();
return EMPTY_STRING;
}
-sal_Bool ScDocumentLoader::GetFilterName( const String& rFileName,
- String& rFilter, String& rOptions,
- sal_Bool bWithContent, sal_Bool bWithInteraction )
+bool ScDocumentLoader::GetFilterName( const String& rFileName,
+ String& rFilter, String& rOptions,
+ bool bWithContent, bool bWithInteraction )
{
TypeId aScType = TYPE(ScDocShell);
SfxObjectShell* pDocSh = SfxObjectShell::GetFirst( &aScType );
@@ -535,13 +537,14 @@ bool ScDocumentLoader::GetFilterName(
return bRet;
}
-void ScDocumentLoader::RemoveAppPrefix( String& rFilterName )
+void ScDocumentLoader::RemoveAppPrefix( rtl::OUString& rFilterName )
{
- String aAppPrefix = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( STRING_SCAPP ));
- aAppPrefix.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " ));
- xub_StrLen nPreLen = aAppPrefix.Len();
- if ( rFilterName.Copy(0,nPreLen) == aAppPrefix )
- rFilterName.Erase(0,nPreLen);
+ rtl::OUStringBuffer aAppPrefix;
+ aAppPrefix.appendAscii(STRING_SCAPP);
+ aAppPrefix.appendAscii(": ");
+ sal_Int32 nPreLen = aAppPrefix.getLength();
+ if (rFilterName.copy(0, nPreLen).equals(aAppPrefix.makeStringAndClear()))
+ rFilterName = rFilterName.copy(nPreLen);
}
ScDocumentLoader::ScDocumentLoader( const String& rFileName,
@@ -615,15 +618,15 @@ ScDocument* ScDocumentLoader::GetDocument()
return pDocShell ? pDocShell->GetDocument() : 0;
}
-sal_Bool ScDocumentLoader::IsError() const
+bool ScDocumentLoader::IsError() const
{
if ( pDocShell && pMedium )
return pMedium->GetError() != ERRCODE_NONE;
else
- return sal_True;
+ return true;
}
-String ScDocumentLoader::GetTitle() const
+rtl::OUString ScDocumentLoader::GetTitle() const
{
if ( pDocShell )
return pDocShell->GetTitle();
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index f6543d6..e44cea5 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -7694,14 +7694,14 @@ void SAL_CALL ScTableSheetObj::link( const rtl::OUString& aUrl, const rtl::OUStr
ScDocument* pDoc = pDocSh->GetDocument();
SCTAB nTab = GetTab_Impl();
- String aFileString (aUrl);
- String aFilterString (aFilterName);
- String aOptString (aFilterOptions);
- String aSheetString (aSheetName);
+ rtl::OUString aFileString = aUrl;
+ rtl::OUString aFilterString = aFilterName;
+ rtl::OUString aOptString = aFilterOptions;
+ rtl::OUString aSheetString = aSheetName;
aFileString = ScGlobal::GetAbsDocName( aFileString, pDocSh );
- if ( !aFilterString.Len() )
- ScDocumentLoader::GetFilterName( aFileString, aFilterString, aOptString, sal_True, false );
+ if (aFilterString.isEmpty())
+ ScDocumentLoader::GetFilterName( aFileString, aFilterString, aOptString, true, false );
// remove application prefix from filter name here, so the filter options
// aren't reset when the filter name is changed in ScTableLink::DataChanged
@@ -7736,7 +7736,7 @@ void SAL_CALL ScTableSheetObj::link( const rtl::OUString& aUrl, const rtl::OUStr
if (pBase->ISA(ScTableLink))
{
ScTableLink* pTabLink = (ScTableLink*)pBase;
- if ( pTabLink->GetFileName() == aFileString )
+ if ( aFileString.equals(pTabLink->GetFileName()) )
pTabLink->Update(); // inkl. Paint&Undo
//! Der Dateiname sollte nur einmal vorkommen (?)
More information about the Libreoffice-commits
mailing list