Tag: cws_dev300_dba31b
User: oj      
Date: 2008-08-13 07:17:52+0000
Modified:
   dba/dbaccess/inc/genericcontroller.hxx
   dba/dbaccess/source/ui/browser/genericcontroller.cxx
   dba/dbaccess/source/ui/misc/singledoccontroller.cxx
   dba/dbaccess/source/ui/querydesign/querycontroller.cxx
   dba/dbaccess/source/ui/tabledesign/TableController.cxx

Log:
 #i91443# notify title changes and create unique name for save dialog

File Changes:

Directory: /dba/dbaccess/inc/
=============================

File [changed]: genericcontroller.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/inc/genericcontroller.hxx?r1=1.13.24.1&r2=1.13.24.2
Delta lines:  +3 -1
-------------------
--- genericcontroller.hxx       2008-08-04 07:23:26+0000        1.13.24.1
+++ genericcontroller.hxx       2008-08-13 07:17:48+0000        1.13.24.2
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: genericcontroller.hxx,v $
- * $Revision: 1.13.24.1 $
+ * $Revision: 1.13.24.2 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -387,6 +387,8 @@
         virtual void    startFrameListening( const 
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame );
         virtual void    stopFrameListening( const 
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame );
 
+        void releaseNumberForComponent();
+
         virtual ~OGenericUnoController();
 
     private:

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

File [changed]: genericcontroller.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/genericcontroller.cxx?r1=1.94.24.1&r2=1.94.24.2
Delta lines:  +16 -13
---------------------
--- genericcontroller.cxx       2008-08-04 07:25:59+0000        1.94.24.1
+++ genericcontroller.cxx       2008-08-13 07:17:48+0000        1.94.24.2
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: genericcontroller.cxx,v $
- * $Revision: 1.94.24.1 $
+ * $Revision: 1.94.24.2 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -900,8 +900,20 @@
                                                        
::std::bind2nd(FindFeatureListener(),aListener))
                ,m_aFeaturesToInvalidate.end());
 }
-
-
+// 
-----------------------------------------------------------------------------
+void OGenericUnoController::releaseNumberForComponent()
+{
+    try
+    {
+        Reference< XUntitledNumbers > xUntitledProvider(getPrivateModel(), 
UNO_QUERY      );
+        if ( xUntitledProvider.is() )
+            
xUntitledProvider->releaseNumberForComponent(static_cast<XWeak*>(this));
+    }
+    catch( const Exception& )
+       {
+        // NII
+       }
+}
 // -----------------------------------------------------------------------
 void OGenericUnoController::disposing()
 {
@@ -924,16 +936,7 @@
                m_aFeaturesToInvalidate.clear();
        }
 
-    try
-    {
-        Reference< XUntitledNumbers > xUntitledProvider(getPrivateModel(), 
UNO_QUERY      );
-        if ( xUntitledProvider.is() )
-            
xUntitledProvider->releaseNumberForComponent(static_cast<XWeak*>(this));
-    }
-    catch( const Exception& )
-       {
-        DBG_UNHANDLED_EXCEPTION();
-       }
+    releaseNumberForComponent();
 
        // check out from all the objects we are listening
        // the frame

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

File [changed]: singledoccontroller.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/singledoccontroller.cxx?r1=1.30&r2=1.30.24.1
Delta lines:  +17 -3
--------------------
--- singledoccontroller.cxx     2008-06-25 12:51:12+0000        1.30
+++ singledoccontroller.cxx     2008-08-13 07:17:49+0000        1.30.24.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: singledoccontroller.cxx,v $
- * $Revision: 1.30 $
+ * $Revision: 1.30.24.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -155,13 +155,15 @@
                sal_Bool                                m_bSuspended;   // is 
true when the controller was already suspended
                sal_Bool                                m_bEditable;    // is 
the control readonly or not
                sal_Bool                                m_bModified;    // is 
the data modified
+        bool                            m_bNotAttached;
 
         OSingleDocumentControllerImpl()
             :m_aDocScriptSupport()
-            ,m_nDocStartNumber(1)
+            ,m_nDocStartNumber(0)
             ,m_bSuspended( sal_False )
                    ,m_bEditable(sal_True)
                    ,m_bModified(sal_False)
+            ,m_bNotAttached(true)
         {
         }
 
@@ -288,6 +290,14 @@
             }
             OSL_POSTCOND( m_pImpl->m_aDataSource.is(), 
"OSingleDocumentController::initializeConnection: unable to obtain the data 
source object!" );
 
+            if ( m_pImpl->m_bNotAttached )
+            {
+                Reference< XUntitledNumbers > xUntitledProvider( 
getDatabaseDocument(), UNO_QUERY );
+                m_pImpl->m_nDocStartNumber = 1;
+                if ( xUntitledProvider.is() )
+                    m_pImpl->m_nDocStartNumber = 
xUntitledProvider->leaseNumber( static_cast< XWeak* >( this ) );
+            }
+
             // determine the availability of script support in our document. 
Our own XScriptInvocationContext
             // interface depends on this
             m_pImpl->setDocumentScriptSupport( Reference< XEmbeddedScripts >( 
getDatabaseDocument(), UNO_QUERY ).is() );
@@ -474,6 +484,10 @@
         if ( !OSingleDocumentController_Base::attachModel( _rxModel ) )
             return sal_False;
 
+        m_pImpl->m_bNotAttached = false;
+        if ( m_pImpl->m_nDocStartNumber == 1 )
+            releaseNumberForComponent();
+
         Reference< XUntitledNumbers > xUntitledProvider( _rxModel, UNO_QUERY );
         m_pImpl->m_nDocStartNumber = 1;
         if ( xUntitledProvider.is() )

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

File [changed]: querycontroller.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/querydesign/querycontroller.cxx?r1=1.119&r2=1.119.24.1
Delta lines:  +18 -4
--------------------
--- querycontroller.cxx 2008-06-25 12:55:43+0000        1.119
+++ querycontroller.cxx 2008-08-13 07:17:49+0000        1.119.24.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: querycontroller.cxx,v $
- * $Revision: 1.119 $
+ * $Revision: 1.119.24.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -76,6 +76,7 @@
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
 #include <com/sun/star/util/XCloseable.hpp>
 #include <com/sun/star/util/VetoException.hpp>
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
 /** === end UNO includes === **/
 
 #include <comphelper/basicio.hxx>
@@ -1248,7 +1249,12 @@
                if ( ( _bSaveAs && !bNew ) || ( bNew && m_sName.getLength() ) )
                        aDefaultName = String( m_sName );
                else
-            aDefaultName = getPrivateTitle( );
+        {
+            String sName = String( ModuleRes( editingView() ? STR_VIEW_TITLE : 
STR_QRY_TITLE ) );
+                       aDefaultName = sName.GetToken(0,' ');
+            //aDefaultName = getPrivateTitle( );
+            aDefaultName = 
::dbtools::createUniqueName(_xElements,aDefaultName);
+        }
 
         DynamicTableOrQueryNameCheck aNameChecker( getConnection(), 
CommandType::QUERY );
                OSaveAsDlg aDlg(
@@ -1419,11 +1425,19 @@
 
                 // now check if our datasource has set a tablefilter and if 
so, append the new table name to it
                                ::dbaui::appendToFilter( getConnection(), 
m_sName, getORB(), getView() );
+                       } // if ( editingView() )
+            Reference< XTitleChangeListener> 
xEventListener(impl_getTitleHelper_throw(),UNO_QUERY);
+            if ( xEventListener.is() )
+            {
+                TitleChangedEvent aEvent;
+                xEventListener->titleChanged(aEvent);
                        }
+            releaseNumberForComponent();
                }
 
                setModified( sal_False );
         bSuccess = true;
+        
        }
        catch( const SQLException& )
        {

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

File [changed]: TableController.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/tabledesign/TableController.cxx?r1=1.122&r2=1.122.24.1
Delta lines:  +18 -4
--------------------
--- TableController.cxx 2008-06-25 13:01:13+0000        1.122
+++ TableController.cxx 2008-08-13 07:17:49+0000        1.122.24.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: TableController.cxx,v $
- * $Revision: 1.122 $
+ * $Revision: 1.122.24.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -110,12 +110,14 @@
 #ifndef _COM_SUN_STAR_SDBCX_XINDEXESSUPPLIER_HPP_
 #include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
 #endif
+#include <com/sun/star/frame/XTitleChangeListener.hpp>
 #ifndef _DBHELPER_DBEXCEPTION_HXX_
 #include <connectivity/dbexception.hxx>
 #endif
 #ifndef _COM_SUN_STAR_UI_XEXECUTABLEDIALOG_HPP_ 
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
 #endif
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
 #ifndef _COMPHELPER_STREAMSECTION_HXX_
 #include <comphelper/streamsection.hxx>
 #endif
@@ -169,7 +171,7 @@
        static ::dbaui::OMultiInstanceAutoRegistration< 
::dbaui::OTableController > aAutoRegistration;
 }
 
-
+using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::io;
 using namespace ::com::sun::star::beans;
@@ -422,7 +424,12 @@
                        if (_bSaveAs && !bNew)
                                 aDefaultName = String(m_sName);
                        else
-                aDefaultName = getPrivateTitle();
+            {
+                String aName = String(ModuleRes(STR_TBL_TITLE));
+                           aDefaultName = aName.GetToken(0,' ');
+                //aDefaultName = getPrivateTitle();
+                aDefaultName = 
::dbtools::createUniqueName(xTables,aDefaultName);
+            }
 
             DynamicTableOrQueryNameCheck aNameChecker( getConnection(), 
CommandType::TABLE );
                        OSaveAsDlg aDlg( getView(), CommandType::TABLE, 
getORB(), getConnection(), aDefaultName, aNameChecker );
@@ -492,6 +499,13 @@
                        }
                        // now check if our datasource has set a tablefilter 
and if append the new table name to it
                        
::dbaui::appendToFilter(getConnection(),m_sName,getORB(),getView()); // we are 
not interessted in the return value
+            Reference< frame::XTitleChangeListener> 
xEventListener(impl_getTitleHelper_throw(),UNO_QUERY);
+            if ( xEventListener.is() )
+            {
+                frame::TitleChangedEvent aEvent;
+                xEventListener->titleChanged(aEvent);
+            }
+            releaseNumberForComponent();
                }
                else if(m_xTable.is())
                {




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

Reply via email to