Tag: cws_src680_qiq
User: fs      
Date: 06/05/17 04:48:50

Modified:
 /dba/dbaccess/source/ui/querydesign/
  QueryViewSwitch.cxx, SelectionBrowseBox.cxx, querycontroller.cxx

Log:
 refactored OSaveAsDlg in preparation of #i51143#

File Changes:

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

File [changed]: QueryViewSwitch.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx?r1=1.24&r2=1.24.124.1
Delta lines:  +19 -10
---------------------
--- QueryViewSwitch.cxx 8 Sep 2005 16:27:29 -0000       1.24
+++ QueryViewSwitch.cxx 17 May 2006 11:48:47 -0000      1.24.124.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: QueryViewSwitch.cxx,v $
  *
- *  $Revision: 1.24 $
+ *  $Revision: 1.24.124.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 16:27:29 $
+ *  last change: $Author: fs $ $Date: 2006/05/17 11:48:47 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -236,10 +236,13 @@
        sal_Bool bRet = sal_True;
        sal_Bool bGraphicalDesign = 
static_cast<OQueryController*>(m_pDesignView->getController())->isDesignMode();
 
+    OAddTableDlg* pAddTabDialog( getAddTableDialog() );
+
        if ( !bGraphicalDesign ) // we have to hide the add table dialog
        {
-               m_bAddTableDialogWasVisible = getAddTableDialog()->IsVisible();
-               m_pDesignView->getAddTableDialog()->Hide();
+        m_bAddTableDialogWasVisible = pAddTabDialog ? 
pAddTabDialog->IsVisible() : false;
+        if ( m_bAddTableDialogWasVisible )
+            pAddTabDialog->Hide();
        }
 
        OQueryContainerWindow* pContainer = getContainer();
@@ -256,7 +259,9 @@
                ::rtl::OUString sOldStatement = 
static_cast<OQueryController*>(m_pDesignView->getController())->getStatement();
                // we have to stop the sqledit from our textview
                m_pTextView->getSqlEdit()->stopTimer();
-               getAddTableDialog()->Update();
+
+        if ( pAddTabDialog )
+                   pAddTabDialog->Update();
                bRet = m_pDesignView->InitFromParseNode();
 
                // only show the view when the data is inserted
@@ -267,8 +272,8 @@
        {
                m_pTextView->Show       ( !bGraphicalDesign );
                m_pDesignView->Show     ( bGraphicalDesign );
-               if ( bGraphicalDesign && m_bAddTableDialogWasVisible )
-                       getAddTableDialog()->Show();
+               if ( bGraphicalDesign && m_bAddTableDialogWasVisible && 
pAddTabDialog )
+                       pAddTabDialog->Show();
 
                GrabFocus();
        }
@@ -289,7 +294,11 @@
 // 
-----------------------------------------------------------------------------
 OAddTableDlg* OQueryViewSwitch::getAddTableDialog()
 {
-       return m_pDesignView->getAddTableDialog();
+    if ( !m_pDesignView )
+        return NULL;
+    if ( !m_pDesignView->getController() )
+        return NULL;
+    return m_pDesignView->getController()->getAddTableDialog();
 }
 // 
-----------------------------------------------------------------------------
 BOOL OQueryViewSwitch::IsAddAllowed()

File [changed]: SelectionBrowseBox.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx?r1=1.66.66.2&r2=1.66.66.3
Delta lines:  +10 -5
--------------------
--- SelectionBrowseBox.cxx      17 May 2006 04:31:51 -0000      1.66.66.2
+++ SelectionBrowseBox.cxx      17 May 2006 11:48:47 -0000      1.66.66.3
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: SelectionBrowseBox.cxx,v $
  *
- *  $Revision: 1.66.66.2 $
+ *  $Revision: 1.66.66.3 $
  *
- *  last change: $Author: fs $ $Date: 2006/05/17 04:31:51 $
+ *  last change: $Author: fs $ $Date: 2006/05/17 11:48:47 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -463,10 +463,13 @@
        OQueryController* pController = 
static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController()));
 
        OTableFields::reverse_iterator aIter = getFields().rbegin();
-       for(sal_uInt16 nId=getFields().size();aIter != 
getFields().rend();++aIter,--nId)
+       for ( ;aIter != getFields().rend(); ++aIter )
        {
-               if(!(*aIter)->IsEmpty())
-                       RemoveField(GetColumnId(nId));
+               if ( !(*aIter)->IsEmpty() )
+        {
+                       RemoveField( (*aIter)->GetColumnId() );
+            aIter = getFields().rbegin();
+        }
        }
        SetUpdateMode(sal_True);
 }
@@ -493,6 +496,8 @@
        DBG_CHKTHIS(OSelectionBrowseBox,NULL);
        OQueryController* pController = 
static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController()));
 
+    if ( nColId >= getFields().size() )
+        return NULL;
        OTableFieldDescRef pEntry = getFields()[nColId-1];
        DBG_ASSERT(pEntry.isValid(), "OSelectionBrowseBox::GetController : 
keine FieldDescription !");
 

File [changed]: querycontroller.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/querydesign/querycontroller.cxx?r1=1.103.4.4&r2=1.103.4.5
Delta lines:  +16 -12
---------------------
--- querycontroller.cxx 17 May 2006 04:30:56 -0000      1.103.4.4
+++ querycontroller.cxx 17 May 2006 11:48:47 -0000      1.103.4.5
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: querycontroller.cxx,v $
  *
- *  $Revision: 1.103.4.4 $
+ *  $Revision: 1.103.4.5 $
  *
- *  last change: $Author: fs $ $Date: 2006/05/17 04:30:56 $
+ *  last change: $Author: fs $ $Date: 2006/05/17 11:48:47 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -59,6 +59,9 @@
 #ifndef DBAUI_QUERYDESIGNVIEW_HXX
 #include "QueryDesignView.hxx"
 #endif
+#ifndef DBACCESS_SOURCE_UI_INC_DEFAULTOBJECTNAMECHECK_HXX
+#include "defaultobjectnamecheck.hxx"
+#endif
 #ifndef _COMPHELPER_TYPES_HXX_
 #include <comphelper/types.hxx>
 #endif
@@ -436,8 +439,6 @@
        clearFields();
        OTableFields().swap(m_vUnUsedFieldsDesc);
 
-       m_pView         = NULL;
-
        ::comphelper::disposeComponent(m_xComposer);
        OJoinController::disposing();
 }
@@ -1002,10 +1003,6 @@
 
        if (isConnected())
        {
-               // we hide the add table dialog because the tables in it are 
from the old connection
-               if(m_pAddTabDlg)
-                       m_pAddTabDlg->Hide();
-               InvalidateFeature(ID_BROWSER_ADDTABLE);
                setQueryComposer();
        }
        else
@@ -1273,15 +1270,15 @@
                                aDefaultName = 
String(::dbtools::createUniqueName(_xElements,aName));
                }
 
-
+        PlainNameCheck aNameChecker( _xElements );
                OSaveAsDlg aDlg(
                                getView(),
                                m_bCreateView ? CommandType::TABLE : 
CommandType::QUERY,
-                               _xElements,
-                               xMetaData,
+                getORB(),
                                getConnection(),
                                aDefaultName,
-                               _bSaveAs ? SAD_OVERWRITE : SAD_DEFAULT);
+                aNameChecker,
+                               SAD_DEFAULT );
 
                if(bRet = (aDlg.Execute() == RET_OK))
                {
@@ -1479,6 +1476,9 @@
                                         getMetaData());
                                delete pNode;
                        }
+
+            m_xComposer->setQuery(sTranslatedStmt);
+                       sTranslatedStmt = m_xComposer->getComposedQuery();
                }
                catch(SQLException& e)
                {
@@ -1685,6 +1685,10 @@
 // 
-----------------------------------------------------------------------------
 bool OQueryController::allowQueries() const
 {
+    DBG_ASSERT( getSdbMetaData().isConnected(), 
"OQueryController::allowQueries: illegal call!" );
+    if ( !getSdbMetaData().supportsSubqueriesInFrom() )
+        return false;
+
     const NamedValueCollection& rArguments( getInitParams() );
     bool bCreatingView = rArguments.getOrDefault( 
(::rtl::OUString)PROPERTY_CREATEVIEW, false );
     return !bCreatingView;




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

Reply via email to