Tag: cws_src680_qiq User: fs Date: 06/05/17 04:46:33 Modified: /dba/dbaccess/source/ui/misc/ UITools.cxx
Log: ::dbaui::insertHierarchyElement needs an ORB now File Changes: Directory: /dba/dbaccess/source/ui/misc/ ======================================== File [changed]: UITools.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/UITools.cxx?r1=1.59.66.2&r2=1.59.66.3 Delta lines: +103 -97 ---------------------- --- UITools.cxx 12 May 2006 14:36:31 -0000 1.59.66.2 +++ UITools.cxx 17 May 2006 11:46:31 -0000 1.59.66.3 @@ -4,9 +4,9 @@ * * $RCSfile: UITools.cxx,v $ * - * $Revision: 1.59.66.2 $ + * $Revision: 1.59.66.3 $ * - * last change: $Author: fs $ $Date: 2006/05/12 14:36:31 $ + * last change: $Author: fs $ $Date: 2006/05/17 11:46:31 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -54,6 +54,9 @@ #ifndef DBAUI_DBTREELISTBOX_HXX #include "dbtreelistbox.hxx" #endif +#ifndef DBACCESS_SOURCE_UI_INC_DEFAULTOBJECTNAMECHECK_HXX +#include "defaultobjectnamecheck.hxx" +#endif #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif @@ -1858,17 +1861,19 @@ } } // ----------------------------------------------------------------------------- -sal_Bool insertHierachyElement(Window* _pParent - ,const Reference<XHierarchicalNameContainer>& _xNames - ,const String& _sParentFolder - ,sal_Bool _bForm - ,sal_Bool _bCollection - ,const Reference<XContent>& _xContent - ,sal_Bool _bMove) +sal_Bool insertHierachyElement( Window* _pParent, const Reference< XMultiServiceFactory >& _rxORB, + const Reference<XHierarchicalNameContainer>& _xNames, + const String& _sParentFolder, + sal_Bool _bForm, + sal_Bool _bCollection, + const Reference<XContent>& _xContent, + sal_Bool _bMove) { - if ( _xNames.is() ) - { - Reference<XNameAccess> xNameAccess(_xNames,UNO_QUERY); + OSL_ENSURE( _xNames.is(), "insertHierachyElement: illegal name container!" ); + if ( !_xNames.is() ) + return sal_False; + + Reference<XNameAccess> xNameAccess( _xNames, UNO_QUERY ); ::rtl::OUString sName = _sParentFolder; if ( _xNames->hasByHierarchicalName(sName) ) { @@ -1878,8 +1883,10 @@ xNameAccess.set(xChild->getParent(),UNO_QUERY); } - if ( xNameAccess.is() ) - { + OSL_ENSURE( xNameAccess.is(), "insertHierachyElement: could not find the proper name container!" ); + if ( !xNameAccess.is() ) + return sal_False; + ::rtl::OUString sNewName; Reference<XPropertySet> xProp(_xContent,UNO_QUERY); if ( xProp.is() ) @@ -1899,12 +1906,13 @@ // here we have everything needed to create a new query object ... + HierarchicalNameCheck aNameChecker( _xNames.get(), sName ); // ... ehm, except a new name OSaveAsDlg aAskForName( _pParent, - _xNames.get(), + _rxORB, sTargetName, sLabel, - sName, + aNameChecker, SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS); if ( RET_OK != aAskForName.Execute() ) // cancelled by the user @@ -1915,13 +1923,13 @@ } else if ( xNameAccess->hasByName(sNewName) ) { - String sError(ModuleRes(STR_OBJECT_ALREADY_EXISTS)); + String sError(ModuleRes(STR_NAME_ALREADY_EXISTS)); sError.SearchAndReplaceAscii("#",sNewName); throw SQLException(sError,NULL,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")) ,0,Any()); } - if ( sNewName.getLength() ) - { + if ( !sNewName.getLength() ) + return sal_False; try { Reference<XMultiServiceFactory> xORB(xNameAccess,UNO_QUERY); @@ -1954,12 +1962,10 @@ } catch(Exception&) { - OSL_ENSURE(0,"OApplicationController::OApplicationController -> exception catched"); + DBG_UNHANDLED_EXCEPTION(); return sal_False; } - } - } - } + return sal_True; } // ----------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
