Kaydet (Commit) bdc374ea authored tarafından Gergő Mocsi's avatar Gergő Mocsi Kaydeden (comit) Thomas Arnhold

fdo#38838, String to OUString in dbaccess

Replaced String with OUString in module dbaccess/ui/app , and also removed RTL_CONSTASCII_USTRINGPARAM deprecated macro.

Conflicts:
	dbaccess/source/ui/app/AppControllerDnD.cxx
	dbaccess/source/ui/app/AppControllerGen.cxx
	dbaccess/source/ui/app/AppDetailPageHelper.cxx
	dbaccess/source/ui/browser/unodatbr.cxx

Change-Id: Ie385d44c328fb3f919d53a604d51640a334a1013
Reviewed-on: https://gerrit.libreoffice.org/2386Reviewed-by: 's avatarThomas Arnhold <thomas@arnhold.org>
Tested-by: 's avatarThomas Arnhold <thomas@arnhold.org>
üst 59bc10eb
...@@ -59,7 +59,7 @@ namespace dbaccess ...@@ -59,7 +59,7 @@ namespace dbaccess
public: public:
/** loads the string with the specified resource id /** loads the string with the specified resource id
*/ */
static ::rtl::OUString loadString(sal_uInt16 _nResId); static OUString loadString(sal_uInt16 _nResId);
/** loads a string from the resource file, substituting a placeholder with a given string /** loads a string from the resource file, substituting a placeholder with a given string
...@@ -70,10 +70,10 @@ namespace dbaccess ...@@ -70,10 +70,10 @@ namespace dbaccess
@param _rReplace @param _rReplace
the string which should substitute the placeholder the string which should substitute the placeholder
*/ */
static ::rtl::OUString loadString( static OUString loadString(
sal_uInt16 _nResId, sal_uInt16 _nResId,
const sal_Char* _pPlaceholderAscii, const sal_Char* _pPlaceholderAscii,
const ::rtl::OUString& _rReplace const OUString& _rReplace
); );
/** loads a string from the resource file, substituting two placeholders with given strings /** loads a string from the resource file, substituting two placeholders with given strings
...@@ -89,12 +89,12 @@ namespace dbaccess ...@@ -89,12 +89,12 @@ namespace dbaccess
@param _rReplace2 @param _rReplace2
the string which should substitute the second placeholder the string which should substitute the second placeholder
*/ */
static ::rtl::OUString loadString( static OUString loadString(
sal_uInt16 _nResId, sal_uInt16 _nResId,
const sal_Char* _pPlaceholderAscii1, const sal_Char* _pPlaceholderAscii1,
const ::rtl::OUString& _rReplace1, const OUString& _rReplace1,
const sal_Char* _pPlaceholderAscii2, const sal_Char* _pPlaceholderAscii2,
const ::rtl::OUString& _rReplace2 const OUString& _rReplace2
); );
}; };
......
...@@ -56,32 +56,31 @@ namespace dbaccess ...@@ -56,32 +56,31 @@ namespace dbaccess
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
::rtl::OUString ResourceManager::loadString(sal_uInt16 _nResId) OUString ResourceManager::loadString(sal_uInt16 _nResId)
{ {
::rtl::OUString sReturn; OUString sReturn;
ensureImplExists(); ensureImplExists();
if (m_pImpl) if (m_pImpl)
sReturn = String(ResId(_nResId,*m_pImpl)); sReturn = OUString(ResId(_nResId,*m_pImpl));
return sReturn; return sReturn;
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
::rtl::OUString ResourceManager::loadString( sal_uInt16 _nResId, const sal_Char* _pPlaceholderAscii, const ::rtl::OUString& _rReplace ) OUString ResourceManager::loadString( sal_uInt16 _nResId, const sal_Char* _pPlaceholderAscii, const OUString& _rReplace )
{ {
String sString( loadString( _nResId ) ); OUString sString( loadString( _nResId ) );
sString.SearchAndReplaceAscii( _pPlaceholderAscii, _rReplace ); return sString.replaceFirst( OUString::createFromAscii(_pPlaceholderAscii), _rReplace );
return sString;
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
::rtl::OUString ResourceManager::loadString( sal_uInt16 _nResId, const sal_Char* _pPlaceholderAscii1, const ::rtl::OUString& _rReplace1, OUString ResourceManager::loadString( sal_uInt16 _nResId, const sal_Char* _pPlaceholderAscii1, const OUString& _rReplace1,
const sal_Char* _pPlaceholderAscii2, const ::rtl::OUString& _rReplace2 ) const sal_Char* _pPlaceholderAscii2, const OUString& _rReplace2 )
{ {
String sString( loadString( _nResId ) ); OUString sString( loadString( _nResId ) );
sString.SearchAndReplaceAscii( _pPlaceholderAscii1, _rReplace1 ); sString = sString.replaceFirst( OUString::createFromAscii(_pPlaceholderAscii1), _rReplace1 );
sString.SearchAndReplaceAscii( _pPlaceholderAscii2, _rReplace2 ); sString = sString.replaceFirst( OUString::createFromAscii(_pPlaceholderAscii2), _rReplace2 );
return sString; return sString;
} }
......
...@@ -2437,7 +2437,7 @@ Any OApplicationController::getCurrentSelection( Control& _rControl ) const ...@@ -2437,7 +2437,7 @@ Any OApplicationController::getCurrentSelection( Control& _rControl ) const
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
sal_Bool OApplicationController::requestQuickHelp( const SvTreeListEntry* /*_pEntry*/, String& /*_rText*/ ) const sal_Bool OApplicationController::requestQuickHelp( const SvTreeListEntry* /*_pEntry*/, OUString& /*_rText*/ ) const
{ {
return sal_False; return sal_False;
} }
...@@ -2930,7 +2930,7 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer ...@@ -2930,7 +2930,7 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer
case DatabaseObjectContainer::REPORTS: case DatabaseObjectContainer::REPORTS:
if ( eSelectedCategory != E_NONE ) if ( eSelectedCategory != E_NONE )
throw IllegalArgumentException( throw IllegalArgumentException(
String(ModuleRes(RID_STR_NO_DIFF_CAT)), OUString(ModuleRes(RID_STR_NO_DIFF_CAT)),
*this, sal_Int16( pObject - aSelectedObjects.getConstArray() ) ); *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ) );
eSelectedCategory = eSelectedCategory =
( pObject->Type == DatabaseObjectContainer::TABLES ) ? E_TABLE ( pObject->Type == DatabaseObjectContainer::TABLES ) ? E_TABLE
...@@ -2945,7 +2945,7 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer ...@@ -2945,7 +2945,7 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer
{ {
OUString sMessage( OUString sMessage(
OUString( OUString(
String(ModuleRes(RID_STR_UNSUPPORTED_OBJECT_TYPE))). OUString(ModuleRes(RID_STR_UNSUPPORTED_OBJECT_TYPE))).
replaceFirst("$type$", OUString::valueOf(sal_Int32(pObject->Type)))); replaceFirst("$type$", OUString::valueOf(sal_Int32(pObject->Type))));
throw IllegalArgumentException(sMessage, *this, sal_Int16( pObject - aSelectedObjects.getConstArray() )); throw IllegalArgumentException(sMessage, *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ));
} }
......
...@@ -280,7 +280,7 @@ namespace dbaui ...@@ -280,7 +280,7 @@ namespace dbaui
@return @return
<TRUE/> if the paste opertions was successfull, otherwise <FALSE/>. <TRUE/> if the paste opertions was successfull, otherwise <FALSE/>.
*/ */
sal_Bool paste( ElementType _eType,const ::svx::ODataAccessDescriptor& _rPasteData ,const String& _sParentFolder = String(),sal_Bool _bMove = sal_False); sal_Bool paste( ElementType _eType,const ::svx::ODataAccessDescriptor& _rPasteData ,const OUString& _sParentFolder = String(),sal_Bool _bMove = sal_False);
/// returns the system clipboard. /// returns the system clipboard.
const TransferableDataHelper& getViewClipboard() const { return m_aSystemClipboard; } const TransferableDataHelper& getViewClipboard() const { return m_aSystemClipboard; }
...@@ -349,7 +349,7 @@ namespace dbaui ...@@ -349,7 +349,7 @@ namespace dbaui
<TRUE/> if the insert opertions was successfull, otherwise <FALSE/>. <TRUE/> if the insert opertions was successfull, otherwise <FALSE/>.
*/ */
sal_Bool insertHierachyElement( ElementType _eType sal_Bool insertHierachyElement( ElementType _eType
,const String& _sParentFolder ,const OUString& _sParentFolder
,sal_Bool _bCollection = sal_True ,sal_Bool _bCollection = sal_True
,const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent = ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>() ,const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent = ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>()
,sal_Bool _bMove = sal_False); ,sal_Bool _bMove = sal_False);
...@@ -523,7 +523,7 @@ namespace dbaui ...@@ -523,7 +523,7 @@ namespace dbaui
virtual bool interceptUserInput( const NotifyEvent& _rEvent ); virtual bool interceptUserInput( const NotifyEvent& _rEvent );
// IControlActionListener overridables // IControlActionListener overridables
virtual sal_Bool requestQuickHelp( const SvTreeListEntry* _pEntry, String& _rText ) const; virtual sal_Bool requestQuickHelp( const SvTreeListEntry* _pEntry, OUString& _rText ) const;
virtual sal_Bool requestDrag( sal_Int8 _nAction, const Point& _rPosPixel ); virtual sal_Bool requestDrag( sal_Int8 _nAction, const Point& _rPosPixel );
virtual sal_Int8 queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors ); virtual sal_Int8 queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors );
virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ); virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt );
......
...@@ -139,9 +139,9 @@ void OApplicationController::convertToView(const OUString& _sName) ...@@ -139,9 +139,9 @@ void OApplicationController::convertToView(const OUString& _sName)
Reference< XDatabaseMetaData > xMeta = xConnection->getMetaData(); Reference< XDatabaseMetaData > xMeta = xConnection->getMetaData();
String aName = String(ModuleRes(STR_TBL_TITLE)); OUString aName = OUString(ModuleRes(STR_TBL_TITLE));
aName = aName.GetToken(0,' '); aName = aName.getToken(0,' ');
String aDefaultName = ::dbaui::createDefaultName(xMeta,xTables,aName); OUString aDefaultName = ::dbaui::createDefaultName(xMeta,xTables,aName);
DynamicTableOrQueryNameCheck aNameChecker( xConnection, CommandType::TABLE ); DynamicTableOrQueryNameCheck aNameChecker( xConnection, CommandType::TABLE );
OSaveAsDlg aDlg( getView(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker ); OSaveAsDlg aDlg( getView(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker );
...@@ -154,7 +154,7 @@ void OApplicationController::convertToView(const OUString& _sName) ...@@ -154,7 +154,7 @@ void OApplicationController::convertToView(const OUString& _sName)
::dbtools::composeTableName( xMeta, sCatalog, sSchema, sName, sal_False, ::dbtools::eInTableDefinitions ) ); ::dbtools::composeTableName( xMeta, sCatalog, sSchema, sName, sal_False, ::dbtools::eInTableDefinitions ) );
Reference<XPropertySet> xView = ::dbaui::createView(sNewName,xConnection,xSourceObject); Reference<XPropertySet> xView = ::dbaui::createView(sNewName,xConnection,xSourceObject);
if ( !xView.is() ) if ( !xView.is() )
throw SQLException(String(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE)),*this,OUString("S1000") ,0,Any()); throw SQLException(OUString(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE)),*this,OUString( "S1000" ) ,0,Any());
getContainer()->elementAdded(E_TABLE,sNewName,makeAny(xView)); getContainer()->elementAdded(E_TABLE,sNewName,makeAny(xView));
} }
} }
...@@ -390,9 +390,8 @@ void SAL_CALL OApplicationController::connect( ) throw (SQLException, RuntimeEx ...@@ -390,9 +390,8 @@ void SAL_CALL OApplicationController::connect( ) throw (SQLException, RuntimeEx
aError.doThrow(); aError.doThrow();
// no particular error, but nonetheless could not connect -> throw a generic exception // no particular error, but nonetheless could not connect -> throw a generic exception
String sConnectingContext( ModuleRes( STR_COULDNOTCONNECT_DATASOURCE ) ); OUString sConnectingContext( ModuleRes( STR_COULDNOTCONNECT_DATASOURCE ) );
sConnectingContext.SearchAndReplaceAscii( "$name$", getStrippedDatabaseName() ); ::dbtools::throwGenericSQLException( sConnectingContext.replaceFirst( "$name$", getStrippedDatabaseName() ), *this );
::dbtools::throwGenericSQLException( sConnectingContext, *this );
} }
} }
...@@ -664,7 +663,7 @@ void OApplicationController::onDocumentOpened( const OUString& _rName, const sal ...@@ -664,7 +663,7 @@ void OApplicationController::onDocumentOpened( const OUString& _rName, const sal
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
sal_Bool OApplicationController::insertHierachyElement(ElementType _eType,const String& _sParentFolder,sal_Bool _bCollection,const Reference<XContent>& _xContent,sal_Bool _bMove) sal_Bool OApplicationController::insertHierachyElement(ElementType _eType,const OUString& _sParentFolder,sal_Bool _bCollection,const Reference<XContent>& _xContent,sal_Bool _bMove)
{ {
Reference<XHierarchicalNameContainer> xNames(getElements(_eType), UNO_QUERY); Reference<XHierarchicalNameContainer> xNames(getElements(_eType), UNO_QUERY);
return dbaui::insertHierachyElement(getView() return dbaui::insertHierachyElement(getView()
......
...@@ -93,7 +93,7 @@ namespace ...@@ -93,7 +93,7 @@ namespace
{ {
SvTreeListEntry* pReturn = NULL; SvTreeListEntry* pReturn = NULL;
sal_Int32 nIndex = 0; sal_Int32 nIndex = 0;
String sName( _rName.getToken(0,'/',nIndex) ); OUString sName( _rName.getToken(0,'/',nIndex) );
SvTreeListEntry* pEntry = _pFirst; SvTreeListEntry* pEntry = _pFirst;
while( pEntry ) while( pEntry )
...@@ -1111,7 +1111,7 @@ void OAppDetailPageHelper::showPreview(const Reference< XContent >& _xContent) ...@@ -1111,7 +1111,7 @@ void OAppDetailPageHelper::showPreview(const Reference< XContent >& _xContent)
Reference<document::XDocumentProperties> xProp( Reference<document::XDocumentProperties> xProp(
aPreview, UNO_QUERY); aPreview, UNO_QUERY);
if ( xProp.is() ) if ( xProp.is() )
m_aDocumentInfo.fill(xProp,String()); m_aDocumentInfo.fill(xProp,OUString());
} }
} }
else else
......
...@@ -428,13 +428,13 @@ void OTasksWindow::setHelpText(sal_uInt16 _nId) ...@@ -428,13 +428,13 @@ void OTasksWindow::setHelpText(sal_uInt16 _nId)
DBG_CHKTHIS(OTasksWindow,NULL); DBG_CHKTHIS(OTasksWindow,NULL);
if ( _nId ) if ( _nId )
{ {
String sText = ModuleRes(_nId); OUString sText = ModuleRes(_nId);
m_aHelpText.SetText(sText); m_aHelpText.SetText(sText);
} }
else else
{ {
m_aHelpText.SetText(String()); m_aHelpText.SetText(OUString());
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -54,7 +54,7 @@ OApplicationIconControl::OApplicationIconControl(Window* _pParent) ...@@ -54,7 +54,7 @@ OApplicationIconControl::OApplicationIconControl(Window* _pParent)
for ( size_t i=0; i < sizeof(aCategories)/sizeof(aCategories[0]); ++i) for ( size_t i=0; i < sizeof(aCategories)/sizeof(aCategories[0]); ++i)
{ {
SvxIconChoiceCtrlEntry* pEntry = InsertEntry( SvxIconChoiceCtrlEntry* pEntry = InsertEntry(
String( ModuleRes( aCategories[i].nLabelResId ) ) , OUString( ModuleRes( aCategories[i].nLabelResId ) ) ,
Image( ModuleRes( aCategories[i].nImageResId ) ) ); Image( ModuleRes( aCategories[i].nImageResId ) ) );
if ( pEntry ) if ( pEntry )
pEntry->SetUserData( new ElementType( aCategories[i].eType ) ); pEntry->SetUserData( new ElementType( aCategories[i].eType ) );
......
...@@ -323,7 +323,7 @@ void DBTreeListBox::RequestHelp( const HelpEvent& rHEvt ) ...@@ -323,7 +323,7 @@ void DBTreeListBox::RequestHelp( const HelpEvent& rHEvt )
SvTreeListEntry* pEntry = GetEntry( aPos ); SvTreeListEntry* pEntry = GetEntry( aPos );
if( pEntry ) if( pEntry )
{ {
String sQuickHelpText; OUString sQuickHelpText;
if ( m_pActionListener->requestQuickHelp( pEntry, sQuickHelpText ) ) if ( m_pActionListener->requestQuickHelp( pEntry, sQuickHelpText ) )
{ {
Size aSize( GetOutputSizePixel().Width(), GetEntryHeight() ); Size aSize( GetOutputSizePixel().Width(), GetEntryHeight() );
...@@ -408,7 +408,7 @@ sal_Bool DBTreeListBox::EditingEntry( SvTreeListEntry* pEntry, Selection& /*_aSe ...@@ -408,7 +408,7 @@ sal_Bool DBTreeListBox::EditingEntry( SvTreeListEntry* pEntry, Selection& /*_aSe
return m_aEditingHandler.Call(pEntry) != 0; return m_aEditingHandler.Call(pEntry) != 0;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
sal_Bool DBTreeListBox::EditedEntry( SvTreeListEntry* pEntry, const rtl::OUString& rNewText ) sal_Bool DBTreeListBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText )
{ {
DBTreeEditedEntry aEntry; DBTreeEditedEntry aEntry;
aEntry.pEntry = pEntry; aEntry.pEntry = pEntry;
...@@ -475,7 +475,7 @@ namespace ...@@ -475,7 +475,7 @@ namespace
} }
else else
{ {
::rtl::OUString sCommandURL( _pPopup->GetItemCommand( nId ) ); OUString sCommandURL( _pPopup->GetItemCommand( nId ) );
bool bEnabled = sCommandURL.isEmpty() bool bEnabled = sCommandURL.isEmpty()
? _rController.isCommandEnabled( nId ) ? _rController.isCommandEnabled( nId )
: _rController.isCommandEnabled( sCommandURL ); : _rController.isCommandEnabled( sCommandURL );
...@@ -515,7 +515,7 @@ namespace ...@@ -515,7 +515,7 @@ namespace
// more things to preserve: // more things to preserve:
// - the help command // - the help command
::rtl::OUString sHelpURL = _rMenu.GetHelpCommand( nId ); OUString sHelpURL = _rMenu.GetHelpCommand( nId );
if ( !sHelpURL.isEmpty() ) if ( !sHelpURL.isEmpty() )
_rMenu.SetHelpCommand( nCommandId, sHelpURL ); _rMenu.SetHelpCommand( nCommandId, sHelpURL );
......
...@@ -49,7 +49,7 @@ namespace dbaui ...@@ -49,7 +49,7 @@ namespace dbaui
/** requests a quick help text to display /** requests a quick help text to display
@return <FALSE/> if the default quick help text should be used @return <FALSE/> if the default quick help text should be used
*/ */
virtual sal_Bool requestQuickHelp( const SvTreeListEntry* _pEntry, String& _rText ) const = 0; virtual sal_Bool requestQuickHelp( const SvTreeListEntry* _pEntry, OUString& _rText ) const = 0;
/** handler for StartDrag requests /** handler for StartDrag requests
@return <TRUE/> if a drag operation was started @return <TRUE/> if a drag operation was started
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment