Tag: cws_src680_qiq
User: fs      
Date: 06/05/17 04:43:34

Modified:
 /dba/dbaccess/source/ui/app/
  AppController.cxx, AppControllerDnD.cxx, AppControllerGen.cxx

Log:
 refactored OSaveAsDlg in preparation of #i51143#

File Changes:

Directory: /dba/dbaccess/source/ui/app/
=======================================

File [changed]: AppController.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppController.cxx?r1=1.29&r2=1.29.12.1
Delta lines:  +23 -19
---------------------
--- AppController.cxx   19 Apr 2006 13:19:19 -0000      1.29
+++ AppController.cxx   17 May 2006 11:43:31 -0000      1.29.12.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: AppController.cxx,v $
  *
- *  $Revision: 1.29 $
+ *  $Revision: 1.29.12.1 $
  *
- *  last change: $Author: hr $ $Date: 2006/04/19 13:19:19 $
+ *  last change: $Author: fs $ $Date: 2006/05/17 11:43:31 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -139,6 +139,9 @@
 #ifndef _DBU_APP_HRC_
 #include "dbu_app.hrc"
 #endif
+#ifndef DBACCESS_SOURCE_UI_MISC_DEFAULTOBJECTNAMECHECK_HXX
+#include "defaultobjectnamecheck.hxx"
+#endif
 #ifndef _SV_MENU_HXX
 #include <vcl/menu.hxx>
 #endif
@@ -1834,7 +1837,9 @@
        {
                if ( xContainer.is() )
                {
-            ::std::auto_ptr<OSaveAsDlg> aDlg;
+            ::std::auto_ptr< IObjectNameCheck > pNameChecker;
+            ::std::auto_ptr< OSaveAsDlg > aDialog;
+
                        Reference<XRename> xRename;
                        ElementType eType = getContainer()->getElementType();
                        switch( eType )
@@ -1847,13 +1852,9 @@
                                                {
                                                        String sLabel;
                                                        if ( eType == E_FORM )
-                                                       {
                                                                sLabel = 
String(ModuleRes( STR_FRM_LABEL ));
-                                                       }
                                                        else
-                                                       {
                                                                sLabel = 
String(ModuleRes( STR_RPT_LABEL ));
-                                                       }
 
                                                        ::rtl::OUString sName = 
*aList.begin();
                                                        if ( 
xHNames->hasByHierarchicalName(sName) )
@@ -1869,7 +1870,9 @@
                                                                                
Reference<XPropertySet>(xRename,UNO_QUERY)->getPropertyValue(PROPERTY_NAME) >>= 
sName;
                                                                        }
                                                                }
-                                                               aDlg.reset( new 
OSaveAsDlg(getView(),xHNames.get(),sName,sLabel,String(),SAD_TITLE_RENAME) );
+                                pNameChecker.reset( new HierarchicalNameCheck( 
xHNames.get(), String() ) );
+                                                               aDialog.reset( 
new OSaveAsDlg(
+                                    getView(), getORB(), sName, sLabel, 
*pNameChecker, SAD_TITLE_RENAME ) );
                                                        }
                                                }
                                        }
@@ -1885,34 +1888,35 @@
                                                
xRename.set(xContainer->getByName(*aList.begin()),UNO_QUERY);
                         sal_Int32 nCommandType = eType == E_QUERY ? 
CommandType::QUERY : CommandType::TABLE;
 
-                                           aDlg.reset( new OSaveAsDlg(
-                            getView(), nCommandType, xContainer,
-                            m_xMetaData, getConnection(), *aList.begin(), 
SAD_TITLE_RENAME) );
+                        pNameChecker.reset( new PlainNameCheck( xContainer ) );
+                                           aDialog.reset( new OSaveAsDlg(
+                            getView(), nCommandType, getORB(), getConnection(),
+                                *aList.begin(), *pNameChecker, 
SAD_TITLE_RENAME ) );
                                        }
                                        break;
                        }
 
-                       if ( xRename.is() && aDlg.get() )
+                       if ( xRename.is() && aDialog.get() )
                        {
 
                                sal_Bool bTryAgain = sal_True;
                                while( bTryAgain )
                                {
-                                       if ( aDlg->Execute() == RET_OK )
+                                       if ( aDialog->Execute() == RET_OK )
                                        {
                                                try
                                                {
                                                        ::rtl::OUString 
sNewName;
                                                        if ( eType == E_TABLE )
                                                        {
-                                                               ::rtl::OUString 
sName = aDlg->getName();
-                                                               ::rtl::OUString 
sCatalog = aDlg->getCatalog();
-                                                               ::rtl::OUString 
sSchema  = aDlg->getSchema();
+                                                               ::rtl::OUString 
sName = aDialog->getName();
+                                                               ::rtl::OUString 
sCatalog = aDialog->getCatalog();
+                                                               ::rtl::OUString 
sSchema  = aDialog->getSchema();
 
                                                                
::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sName, sNewName, 
sal_False, ::dbtools::eInTableDefinitions );
                                                        }
                                                        else
-                                                               sNewName = 
aDlg->getName();
+                                                               sNewName = 
aDialog->getName();
 
                                                        ::rtl::OUString 
sOldName = *aList.begin();
                                                        if ( eType == E_FORM || 
eType == E_REPORT )
@@ -1939,7 +1943,7 @@
                                                catch(const 
ElementExistException& e)
                                                {
                                                        static ::rtl::OUString 
sStatus = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000"));
-                                                       String sMsg = 
String(ModuleRes(STR_OBJECT_ALREADY_EXISTS));
+                                                       String sMsg = String( 
ModuleRes( STR_NAME_ALREADY_EXISTS ) );
                                                        
sMsg.SearchAndReplace('#',e.Message);
                                                        
showError(SQLExceptionInfo(SQLException(sMsg, e.Context, sStatus, 0, Any())));
                                                }

File [changed]: AppControllerDnD.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppControllerDnD.cxx?r1=1.14.76.4&r2=1.14.76.5
Delta lines:  +9 -5
-------------------
--- AppControllerDnD.cxx        15 May 2006 14:22:14 -0000      1.14.76.4
+++ AppControllerDnD.cxx        17 May 2006 11:43:31 -0000      1.14.76.5
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: AppControllerDnD.cxx,v $
  *
- *  $Revision: 1.14.76.4 $
+ *  $Revision: 1.14.76.5 $
  *
- *  last change: $Author: fs $ $Date: 2006/05/15 14:22:14 $
+ *  last change: $Author: fs $ $Date: 2006/05/17 11:43:31 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -208,6 +208,9 @@
 #ifndef TOOLS_DIAGNOSE_EX_H
 #include <tools/diagnose_ex.h>
 #endif
+#ifndef DBACCESS_SOURCE_UI_MISC_DEFAULTOBJECTNAMECHECK_HXX
+#include "defaultobjectnamecheck.hxx"
+#endif
 
 //........................................................................
 namespace dbaui
@@ -814,12 +817,13 @@
 
                                // here we have everything needed to create a 
new query object ...
                                // ... ehm, except a new name
+                PlainNameCheck aNameChecker( xDestQueries.get() );
                                OSaveAsDlg aAskForName( getView(),
                                                                                
CommandType::QUERY,
-                                                                               
xDestQueries.get(),
-                                                                               
Reference< XDatabaseMetaData>(),
-                                                                               
Reference< XConnection>(),
+                                        getORB(),
+                                                                               
NULL,
                                                                                
sTargetName,
+                                        aNameChecker,
                                                                                
SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS);
                                if ( RET_OK != aAskForName.Execute() )
                                        // cancelled by the user

File [changed]: AppControllerGen.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppControllerGen.cxx?r1=1.17.24.1&r2=1.17.24.2
Delta lines:  +8 -3
-------------------
--- AppControllerGen.cxx        12 May 2006 14:34:42 -0000      1.17.24.1
+++ AppControllerGen.cxx        17 May 2006 11:43:31 -0000      1.17.24.2
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: AppControllerGen.cxx,v $
  *
- *  $Revision: 1.17.24.1 $
+ *  $Revision: 1.17.24.2 $
  *
- *  last change: $Author: fs $ $Date: 2006/05/12 14:34:42 $
+ *  last change: $Author: fs $ $Date: 2006/05/17 11:43:31 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -129,6 +129,9 @@
 #ifndef _COM_SUN_STAR_UTIL_XCLOSEABLE_HPP_
 #include <com/sun/star/util/XCloseable.hpp>
 #endif
+#ifndef DBACCESS_SOURCE_UI_MISC_DEFAULTOBJECTNAMECHECK_HXX
+#include "defaultobjectnamecheck.hxx"
+#endif
 
 //........................................................................
 namespace dbaui
@@ -166,7 +169,8 @@
                aName = aName.GetToken(0,' ');
                String aDefaultName = 
::dbaui::createDefaultName(xMeta,xTables,aName);
 
-               OSaveAsDlg 
aDlg(getView(),CommandType::TABLE,xTables,xMeta,xConnection,aDefaultName);
+        PlainNameCheck aNameChecker( xTables.get() );
+               OSaveAsDlg aDlg( getView(), CommandType::TABLE, getORB(), 
xConnection, aDefaultName, aNameChecker );
                if ( aDlg.Execute() == RET_OK )
                {
                        ::rtl::OUString sName = aDlg.getName();
@@ -535,6 +539,7 @@
 {
        Reference<XHierarchicalNameContainer> xNames(getElements(_eType), 
UNO_QUERY);
        return dbaui::insertHierachyElement(getView()
+                           ,getORB()
                                                   ,xNames
                                                   ,_sParentFolder
                                                   ,_eType == E_FORM




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to