LCOV - code coverage report
Current view: top level - dbaccess/source/ui/querydesign - JoinController.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 198 0.0 %
Date: 2012-08-25 Functions: 0 30 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 247 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include <sfx2/sfxsids.hrc>
      21                 :            : #include "dbu_qry.hrc"
      22                 :            : #include "browserids.hxx"
      23                 :            : #include <comphelper/types.hxx>
      24                 :            : #include "dbustrings.hrc"
      25                 :            : #include <connectivity/dbtools.hxx>
      26                 :            : #include <com/sun/star/frame/FrameSearchFlag.hpp>
      27                 :            : #include <comphelper/extract.hxx>
      28                 :            : #include <com/sun/star/container/XChild.hpp>
      29                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      30                 :            : #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
      31                 :            : #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
      32                 :            : #include <com/sun/star/sdbcx/KeyType.hpp>
      33                 :            : #include <com/sun/star/sdbcx/XDrop.hpp>
      34                 :            : #include <com/sun/star/sdbcx/XAlterTable.hpp>
      35                 :            : #include <com/sun/star/sdbcx/XAppend.hpp>
      36                 :            : #include <com/sun/star/sdb/SQLContext.hpp>
      37                 :            : #include <com/sun/star/sdbc/SQLWarning.hpp>
      38                 :            : #include <com/sun/star/sdbc/ColumnValue.hpp>
      39                 :            : #include <com/sun/star/sdbc/XRow.hpp>
      40                 :            : #include <connectivity/dbexception.hxx>
      41                 :            : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
      42                 :            : #include <comphelper/streamsection.hxx>
      43                 :            : #include <comphelper/basicio.hxx>
      44                 :            : #include <comphelper/seqstream.hxx>
      45                 :            : #include <com/sun/star/io/XActiveDataSource.hpp>
      46                 :            : #include <com/sun/star/io/XActiveDataSink.hpp>
      47                 :            : #include "sqlmessage.hxx"
      48                 :            : #include "JoinController.hxx"
      49                 :            : #include <vcl/msgbox.hxx>
      50                 :            : #include "TableWindowData.hxx"
      51                 :            : #include "TableWindow.hxx"
      52                 :            : #include "TableConnectionData.hxx"
      53                 :            : #include "adtabdlg.hxx"
      54                 :            : #include <vcl/waitobj.hxx>
      55                 :            : #include <vcl/svapp.hxx>
      56                 :            : #include <osl/mutex.hxx>
      57                 :            : #include "UITools.hxx"
      58                 :            : #include <osl/diagnose.h>
      59                 :            : 
      60                 :            : #include <boost/optional.hpp>
      61                 :            : 
      62                 :            : using namespace ::com::sun::star::uno;
      63                 :            : using namespace ::com::sun::star::io;
      64                 :            : using namespace ::com::sun::star::beans;
      65                 :            : using namespace ::com::sun::star::frame;
      66                 :            : using namespace ::com::sun::star::util;
      67                 :            : using namespace ::com::sun::star::lang;
      68                 :            : using namespace ::com::sun::star::container;
      69                 :            : using namespace ::com::sun::star::sdbcx;
      70                 :            : using namespace ::com::sun::star::sdbc;
      71                 :            : using namespace ::com::sun::star::sdb;
      72                 :            : using namespace ::com::sun::star::ui::dialogs;
      73                 :            : using namespace ::dbtools;
      74                 :            : using namespace ::comphelper;
      75                 :            : 
      76                 :            : // .............................................................................
      77                 :            : namespace dbaui
      78                 :            : {
      79                 :            : // .............................................................................
      80                 :            : 
      81                 :            : // =============================================================================
      82                 :            : // = AddTableDialogContext
      83                 :            : // =============================================================================
      84                 :            : class AddTableDialogContext : public IAddTableDialogContext
      85                 :            : {
      86                 :            :     OJoinController& m_rController;
      87                 :            : 
      88                 :            : public:
      89                 :          0 :     AddTableDialogContext( OJoinController& _rController )
      90                 :          0 :         :m_rController( _rController )
      91                 :            :     {
      92                 :          0 :     }
      93                 :            : 
      94         [ #  # ]:          0 :     virtual ~AddTableDialogContext() {}
      95                 :            : 
      96                 :            :     // IAddTableDialogContext
      97                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
      98                 :            :                     getConnection() const;
      99                 :            :     virtual bool    allowViews() const;
     100                 :            :     virtual bool    allowQueries() const;
     101                 :            :     virtual bool    allowAddition() const;
     102                 :            :     virtual void    addTableWindow( const String& _rQualifiedTableName, const String& _rAliasName );
     103                 :            :     virtual void    onWindowClosing( const Window* _pWindow );
     104                 :            : 
     105                 :            : private:
     106                 :            :     OJoinTableView* getTableView() const;
     107                 :            : };
     108                 :            : 
     109                 :            : // -----------------------------------------------------------------------------
     110                 :          0 : Reference< XConnection > AddTableDialogContext::getConnection() const
     111                 :            : {
     112                 :          0 :     return m_rController.getConnection();
     113                 :            : }
     114                 :            : 
     115                 :            : // -----------------------------------------------------------------------------
     116                 :          0 : bool AddTableDialogContext::allowViews() const
     117                 :            : {
     118                 :          0 :     return m_rController.allowViews();
     119                 :            : }
     120                 :            : 
     121                 :            : // -----------------------------------------------------------------------------
     122                 :          0 : bool AddTableDialogContext::allowQueries() const
     123                 :            : {
     124                 :          0 :     return m_rController.allowQueries();
     125                 :            : }
     126                 :            : 
     127                 :            : // -----------------------------------------------------------------------------
     128                 :          0 : bool AddTableDialogContext::allowAddition() const
     129                 :            : {
     130                 :          0 :     return const_cast< OJoinController& >( m_rController ).getJoinView()->getTableView()->IsAddAllowed();
     131                 :            : }
     132                 :            : 
     133                 :            : // -----------------------------------------------------------------------------
     134                 :          0 : void AddTableDialogContext::addTableWindow( const String& _rQualifiedTableName, const String& _rAliasName )
     135                 :            : {
     136 [ #  # ][ #  # ]:          0 :     getTableView()->AddTabWin( _rQualifiedTableName, _rAliasName, sal_True );
     137                 :          0 : }
     138                 :            : 
     139                 :            : // -----------------------------------------------------------------------------
     140                 :          0 : void AddTableDialogContext::onWindowClosing( const Window* _pWindow )
     141                 :            : {
     142         [ #  # ]:          0 :     if ( !m_rController.getView() )
     143                 :          0 :         return;
     144                 :            : 
     145                 :            :     ::dbaui::notifySystemWindow(
     146                 :          0 :         m_rController.getView(), const_cast< Window* >( _pWindow ), ::comphelper::mem_fun( &TaskPaneList::RemoveWindow ) );
     147                 :            : 
     148         [ #  # ]:          0 :     m_rController.InvalidateFeature( ID_BROWSER_ADDTABLE );
     149                 :          0 :     m_rController.getView()->GrabFocus();
     150                 :            : }
     151                 :            : 
     152                 :            : // -----------------------------------------------------------------------------
     153                 :          0 : OJoinTableView* AddTableDialogContext::getTableView() const
     154                 :            : {
     155         [ #  # ]:          0 :     if ( m_rController.getJoinView() )
     156                 :          0 :         return m_rController.getJoinView()->getTableView();
     157                 :          0 :     return NULL;
     158                 :            : }
     159                 :            : 
     160                 :            : // =============================================================================
     161                 :            : // = OJoinController
     162                 :            : // =============================================================================
     163                 :            : 
     164                 :            : DBG_NAME(OJoinController)
     165                 :            : // -----------------------------------------------------------------------------
     166                 :          0 : OJoinController::OJoinController(const Reference< XMultiServiceFactory >& _rM)
     167                 :            :     :OJoinController_BASE(_rM)
     168 [ #  # ][ #  # ]:          0 :     ,m_pAddTableDialog(NULL)
         [ #  # ][ #  # ]
     169                 :            : {
     170                 :            :     DBG_CTOR(OJoinController,NULL);
     171                 :          0 : }
     172                 :            : // -----------------------------------------------------------------------------
     173 [ #  # ][ #  # ]:          0 : OJoinController::~OJoinController()
                 [ #  # ]
     174                 :            : {
     175                 :            :     DBG_DTOR(OJoinController,NULL);
     176         [ #  # ]:          0 : }
     177                 :            : 
     178                 :            : // -----------------------------------------------------------------------------
     179                 :          0 : void SAL_CALL OJoinController::disposing( const EventObject& _rSource ) throw(RuntimeException)
     180                 :            : {
     181                 :          0 :     OJoinController_BASE::disposing( _rSource );
     182                 :          0 : }
     183                 :            : 
     184                 :            : // -----------------------------------------------------------------------------
     185                 :          0 : OJoinDesignView* OJoinController::getJoinView()
     186                 :            : {
     187                 :          0 :     return static_cast< OJoinDesignView* >( getView() );
     188                 :            : }
     189                 :            : 
     190                 :            : // -----------------------------------------------------------------------------
     191                 :          0 : void OJoinController::disposing()
     192                 :            : {
     193                 :            :     {
     194                 :          0 :         ::std::auto_ptr< Window > pEnsureDelete( m_pAddTableDialog );
     195         [ #  # ]:          0 :         m_pAddTableDialog   = NULL;
     196                 :            :     }
     197                 :            : 
     198                 :          0 :     OJoinController_BASE::disposing();
     199                 :            : 
     200                 :          0 :     clearView();
     201                 :            : 
     202                 :          0 :     m_vTableConnectionData.clear();
     203                 :          0 :     m_vTableData.clear();
     204                 :          0 : }
     205                 :            : // -----------------------------------------------------------------------------
     206                 :          0 : void OJoinController::reconnect( sal_Bool _bUI )
     207                 :            : {
     208                 :          0 :     OJoinController_BASE::reconnect( _bUI );
     209 [ #  # ][ #  # ]:          0 :     if ( isConnected() && m_pAddTableDialog )
                 [ #  # ]
     210                 :          0 :         m_pAddTableDialog->Update();
     211                 :          0 : }
     212                 :            : 
     213                 :            : // -----------------------------------------------------------------------------
     214                 :          0 : void OJoinController::impl_onModifyChanged()
     215                 :            : {
     216                 :          0 :     OJoinController_BASE::impl_onModifyChanged();
     217         [ #  # ]:          0 :     InvalidateFeature( SID_RELATION_ADD_RELATION );
     218                 :          0 : }
     219                 :            : // -----------------------------------------------------------------------------
     220                 :          0 : void OJoinController::SaveTabWinPosSize(OTableWindow* pTabWin, long nOffsetX, long nOffsetY)
     221                 :            : {
     222                 :            :     // die Daten zum Fenster
     223         [ #  # ]:          0 :     TTableWindowData::value_type pData = pTabWin->GetData();
     224                 :            :     OSL_ENSURE(pData != NULL, "SaveTabWinPosSize : TabWin hat keine Daten !");
     225                 :            : 
     226                 :            :     // Position & Size der Daten neu setzen (aus den aktuellen Fenster-Parametern)
     227         [ #  # ]:          0 :     Point aPos = pTabWin->GetPosPixel();
     228                 :          0 :     aPos.X() += nOffsetX;
     229                 :          0 :     aPos.Y() += nOffsetY;
     230                 :          0 :     pData->SetPosition(aPos);
     231 [ #  # ][ #  # ]:          0 :     pData->SetSize(pTabWin->GetSizePixel());
     232                 :            : 
     233                 :          0 : }
     234                 :            : // -----------------------------------------------------------------------------
     235                 :          0 : FeatureState OJoinController::GetState(sal_uInt16 _nId) const
     236                 :            : {
     237                 :          0 :     FeatureState aReturn;
     238                 :            :         // (disabled automatically)
     239                 :          0 :     aReturn.bEnabled = sal_True;
     240                 :            : 
     241      [ #  #  # ]:          0 :     switch (_nId)
     242                 :            :     {
     243                 :            :         case ID_BROWSER_EDITDOC:
     244 [ #  # ][ #  # ]:          0 :             aReturn.bChecked = isEditable();
     245                 :          0 :             break;
     246                 :            :         case ID_BROWSER_ADDTABLE:
     247                 :          0 :             aReturn.bEnabled = ( getView() != NULL )
     248 [ #  # ][ #  # ]:          0 :                             && const_cast< OJoinController* >( this )->getJoinView()->getTableView()->IsAddAllowed();
         [ #  # ][ #  # ]
     249 [ #  # ][ #  # ]:          0 :             aReturn.bChecked = aReturn.bEnabled && m_pAddTableDialog != NULL && m_pAddTableDialog->IsVisible() ;
         [ #  # ][ #  # ]
                 [ #  # ]
     250         [ #  # ]:          0 :             if ( aReturn.bEnabled )
     251 [ #  # ][ #  # ]:          0 :                 aReturn.sTitle = OAddTableDlg::getDialogTitleForContext( impl_getDialogContext() );
         [ #  # ][ #  # ]
                 [ #  # ]
     252                 :          0 :             break;
     253                 :            : 
     254                 :            :         default:
     255 [ #  # ][ #  # ]:          0 :             aReturn = OJoinController_BASE::GetState(_nId);
                 [ #  # ]
     256                 :            :     }
     257                 :          0 :     return aReturn;
     258                 :            : }
     259                 :            : 
     260                 :            : // -----------------------------------------------------------------------------
     261                 :          0 : AddTableDialogContext& OJoinController::impl_getDialogContext() const
     262                 :            : {
     263         [ #  # ]:          0 :     if ( !m_pDialogContext.get() )
     264                 :            :     {
     265                 :          0 :         OJoinController* pNonConstThis = const_cast< OJoinController* >( this );
     266                 :          0 :         pNonConstThis->m_pDialogContext.reset( new AddTableDialogContext( *pNonConstThis ) );
     267                 :            :     }
     268                 :          0 :     return *m_pDialogContext;
     269                 :            : }
     270                 :            : 
     271                 :            : // -----------------------------------------------------------------------------
     272                 :          0 : void OJoinController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& aArgs)
     273                 :            : {
     274      [ #  #  # ]:          0 :     switch(_nId)
     275                 :            :     {
     276                 :            :         case ID_BROWSER_EDITDOC:
     277         [ #  # ]:          0 :             if(isEditable())
     278                 :            :             { // the state should be changed to not editable
     279      [ #  #  # ]:          0 :                 switch (saveModified())
     280                 :            :                 {
     281                 :            :                     case RET_CANCEL:
     282                 :            :                         // don't change anything here so return
     283                 :          0 :                         return;
     284                 :            :                     case RET_NO:
     285                 :          0 :                         reset();
     286                 :          0 :                         setModified(sal_False);     // and we are not modified yet
     287                 :          0 :                         break;
     288                 :            :                     default:
     289                 :          0 :                         break;
     290                 :            :                 }
     291                 :            :             }
     292                 :          0 :             setEditable(!isEditable());
     293                 :          0 :             getJoinView()->setReadOnly(!isEditable());
     294                 :          0 :             InvalidateAll();
     295                 :          0 :             return;
     296                 :            :         case ID_BROWSER_ADDTABLE:
     297         [ #  # ]:          0 :             if ( !m_pAddTableDialog )
     298         [ #  # ]:          0 :                 m_pAddTableDialog = new OAddTableDlg( getView(), impl_getDialogContext() );
     299                 :            : 
     300         [ #  # ]:          0 :             if ( m_pAddTableDialog->IsVisible() )
     301                 :            :             {
     302                 :          0 :                 m_pAddTableDialog->Show( sal_False );
     303                 :          0 :                 getView()->GrabFocus();
     304                 :            :             }
     305                 :            :             else
     306                 :            :             {
     307                 :            :                 {
     308         [ #  # ]:          0 :                     WaitObject aWaitCursor( getView() );
     309 [ #  # ][ #  # ]:          0 :                     m_pAddTableDialog->Update();
     310                 :            :                 }
     311                 :          0 :                 m_pAddTableDialog->Show( sal_True );
     312                 :          0 :                 ::dbaui::notifySystemWindow(getView(),m_pAddTableDialog,::comphelper::mem_fun(&TaskPaneList::AddWindow));
     313                 :            :             }
     314                 :          0 :             break;
     315                 :            :         default:
     316                 :          0 :             OJoinController_BASE::Execute(_nId,aArgs);
     317                 :            :     }
     318         [ #  # ]:          0 :     InvalidateFeature(_nId);
     319                 :            : }
     320                 :            : // -----------------------------------------------------------------------------
     321                 :          0 : void OJoinController::SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, long nOffsetX, long nOffsetY )
     322                 :            : {
     323                 :            :     // Das Loeschen und Neuanlegen der alten Implementation ist unter dem aktuellen Modell nicht mehr richtig : Die TabWins
     324                 :            :     // habe einen Zeiger auf ihre Daten, verwaltet werden sie aber von mir. Wenn ich die alten loesche, haben die TabWins
     325                 :            :     // ploetzlich Zeiger auf nicht mehr existente Objekte.
     326                 :            :     // Wenn die TabWins ein SetData haetten, koennte ich mir das sparen ... haben sie aber nicht, ausserdem muesste ich dann immer
     327                 :            :     // noch Informationen, die sich eigentlich nicht geaendert haben, auch neu setzen.
     328                 :            :     // Also loesche ich die TabWinDatas nicht, sondern aktualisiere sie nur.
     329                 :            :     OSL_ENSURE(m_vTableData.size() == pTabWinList->size(),
     330                 :            :         "OJoinController::SaveTabWinsPosSize : inkonsistenter Zustand : sollte genausviel TabWinDatas haben wie TabWins !");
     331                 :            : 
     332                 :          0 :     OJoinTableView::OTableWindowMap::iterator aIter = pTabWinList->begin();
     333                 :          0 :     OJoinTableView::OTableWindowMap::iterator aEnd = pTabWinList->end();
     334         [ #  # ]:          0 :     for(;aIter != aEnd;++aIter)
     335         [ #  # ]:          0 :         SaveTabWinPosSize(aIter->second, nOffsetX, nOffsetY);
     336                 :          0 : }
     337                 :            : // -----------------------------------------------------------------------------
     338                 :          0 : void OJoinController::removeConnectionData(const TTableConnectionData::value_type& _pData)
     339                 :            : {
     340                 :          0 :     m_vTableConnectionData.erase( ::std::remove(m_vTableConnectionData.begin(),m_vTableConnectionData.end(),_pData),m_vTableConnectionData.end());
     341                 :          0 : }
     342                 :            : // -----------------------------------------------------------------------------
     343                 :          0 : void OJoinController::describeSupportedFeatures()
     344                 :            : {
     345                 :          0 :     OJoinController_BASE::describeSupportedFeatures();
     346                 :          0 :     implDescribeSupportedFeature( ".uno:Redo",      ID_BROWSER_REDO,    CommandGroup::EDIT );
     347                 :          0 :     implDescribeSupportedFeature( ".uno:Save",      ID_BROWSER_SAVEDOC, CommandGroup::DOCUMENT );
     348                 :          0 :     implDescribeSupportedFeature( ".uno:Undo",      ID_BROWSER_UNDO,    CommandGroup::EDIT );
     349                 :          0 :     implDescribeSupportedFeature( ".uno:AddTable",  ID_BROWSER_ADDTABLE,CommandGroup::EDIT );
     350                 :          0 :     implDescribeSupportedFeature( ".uno:EditDoc",   ID_BROWSER_EDITDOC, CommandGroup::EDIT );
     351                 :          0 : }
     352                 :            : // -----------------------------------------------------------------------------
     353                 :          0 : sal_Bool SAL_CALL OJoinController::suspend(sal_Bool _bSuspend) throw( RuntimeException )
     354                 :            : {
     355 [ #  # ][ #  # ]:          0 :     if ( getBroadcastHelper().bInDispose || getBroadcastHelper().bDisposed )
                 [ #  # ]
     356                 :          0 :         return sal_True;
     357                 :            : 
     358         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     359 [ #  # ][ #  # ]:          0 :     ::osl::MutexGuard aGuard( getMutex() );
     360 [ #  # ][ #  # ]:          0 :     if ( getView() && getView()->IsInModalMode() )
         [ #  # ][ #  # ]
     361                 :          0 :         return sal_False;
     362                 :          0 :     sal_Bool bCheck = sal_True;
     363         [ #  # ]:          0 :     if ( _bSuspend )
     364                 :            :     {
     365         [ #  # ]:          0 :         bCheck = saveModified() != RET_CANCEL;
     366         [ #  # ]:          0 :         if ( bCheck )
     367         [ #  # ]:          0 :             OSingleDocumentController::suspend(_bSuspend);
     368                 :            :     }
     369 [ #  # ][ #  # ]:          0 :     return bCheck;
     370                 :            : }
     371                 :            : // -----------------------------------------------------------------------------
     372                 :          0 : void OJoinController::loadTableWindows( const ::comphelper::NamedValueCollection& i_rViewSettings )
     373                 :            : {
     374                 :          0 :     m_vTableData.clear();
     375                 :            : 
     376                 :          0 :     m_aMinimumTableViewSize = Point();
     377                 :            : 
     378         [ #  # ]:          0 :     Sequence< PropertyValue > aWindowData;
     379 [ #  # ][ #  # ]:          0 :     aWindowData = i_rViewSettings.getOrDefault( "Tables", aWindowData );
                 [ #  # ]
     380                 :            : 
     381                 :          0 :     const PropertyValue* pTablesIter = aWindowData.getConstArray();
     382                 :          0 :     const PropertyValue* pTablesEnd = pTablesIter + aWindowData.getLength();
     383         [ #  # ]:          0 :     for ( ; pTablesIter != pTablesEnd; ++pTablesIter )
     384                 :            :     {
     385         [ #  # ]:          0 :         ::comphelper::NamedValueCollection aSingleTableData( pTablesIter->Value );
     386         [ #  # ]:          0 :         loadTableWindow( aSingleTableData );
     387         [ #  # ]:          0 :     }
     388         [ #  # ]:          0 :     if ( m_aMinimumTableViewSize != Point() )
     389                 :            :     {
     390 [ #  # ][ #  # ]:          0 :         getJoinView()->getScrollHelper()->resetRange( m_aMinimumTableViewSize );
     391         [ #  # ]:          0 :     }
     392                 :          0 : }
     393                 :            : 
     394                 :            : // -----------------------------------------------------------------------------
     395                 :          0 : void OJoinController::loadTableWindow( const ::comphelper::NamedValueCollection& i_rTableWindowSettings )
     396                 :            : {
     397                 :          0 :     sal_Int32 nX = -1, nY = -1, nHeight = -1, nWidth = -1;
     398                 :            : 
     399                 :          0 :     ::rtl::OUString sComposedName,sTableName,sWindowName;
     400                 :          0 :     sal_Bool bShowAll = false;
     401                 :            : 
     402         [ #  # ]:          0 :     sComposedName = i_rTableWindowSettings.getOrDefault( "ComposedName", sComposedName );
     403         [ #  # ]:          0 :     sTableName = i_rTableWindowSettings.getOrDefault( "TableName", sTableName );
     404         [ #  # ]:          0 :     sWindowName = i_rTableWindowSettings.getOrDefault( "WindowName", sWindowName );
     405         [ #  # ]:          0 :     nY = i_rTableWindowSettings.getOrDefault( "WindowTop", nY );
     406         [ #  # ]:          0 :     nX = i_rTableWindowSettings.getOrDefault( "WindowLeft", nX );
     407         [ #  # ]:          0 :     nWidth = i_rTableWindowSettings.getOrDefault( "WindowWidth", nWidth );
     408         [ #  # ]:          0 :     nHeight = i_rTableWindowSettings.getOrDefault( "WindowHeight", nHeight );
     409         [ #  # ]:          0 :     bShowAll = i_rTableWindowSettings.getOrDefault( "ShowAll", bShowAll );
     410                 :            : 
     411         [ #  # ]:          0 :     TTableWindowData::value_type pData = createTableWindowData(sComposedName,sTableName,sWindowName);
     412         [ #  # ]:          0 :     if ( pData )
     413                 :            :     {
     414                 :          0 :         pData->SetPosition(Point(nX,nY));
     415                 :          0 :         pData->SetSize( Size( nWidth, nHeight ) );
     416                 :          0 :         pData->ShowAll(bShowAll);
     417         [ #  # ]:          0 :         m_vTableData.push_back(pData);
     418         [ #  # ]:          0 :         if ( m_aMinimumTableViewSize.X() < (nX+nWidth) )
     419                 :          0 :             m_aMinimumTableViewSize.X() = (nX+nWidth);
     420         [ #  # ]:          0 :         if ( m_aMinimumTableViewSize.Y() < (nY+nHeight) )
     421                 :          0 :             m_aMinimumTableViewSize.Y() = (nY+nHeight);
     422         [ #  # ]:          0 :     }
     423                 :          0 : }
     424                 :            : // -----------------------------------------------------------------------------
     425                 :          0 : void OJoinController::saveTableWindows( ::comphelper::NamedValueCollection& o_rViewSettings ) const
     426                 :            : {
     427         [ #  # ]:          0 :     if ( !m_vTableData.empty() )
     428                 :            :     {
     429         [ #  # ]:          0 :         ::comphelper::NamedValueCollection aAllTablesData;
     430                 :            : 
     431                 :          0 :         TTableWindowData::const_iterator aIter = m_vTableData.begin();
     432                 :          0 :         TTableWindowData::const_iterator aEnd = m_vTableData.end();
     433 [ #  # ][ #  # ]:          0 :         for ( sal_Int32 i = 1; aIter != aEnd; ++aIter, ++i )
     434                 :            :         {
     435         [ #  # ]:          0 :             ::comphelper::NamedValueCollection aWindowData;
     436         [ #  # ]:          0 :             aWindowData.put( "ComposedName", (*aIter)->GetComposedName() );
     437         [ #  # ]:          0 :             aWindowData.put( "TableName", (*aIter)->GetTableName() );
     438         [ #  # ]:          0 :             aWindowData.put( "WindowName", (*aIter)->GetWinName() );
     439         [ #  # ]:          0 :             aWindowData.put( "WindowTop", static_cast<sal_Int32>((*aIter)->GetPosition().Y()) );
     440         [ #  # ]:          0 :             aWindowData.put( "WindowLeft", static_cast<sal_Int32>((*aIter)->GetPosition().X()) );
     441         [ #  # ]:          0 :             aWindowData.put( "WindowWidth", static_cast<sal_Int32>((*aIter)->GetSize().Width()) );
     442         [ #  # ]:          0 :             aWindowData.put( "WindowHeight", static_cast<sal_Int32>((*aIter)->GetSize().Height()) );
     443         [ #  # ]:          0 :             aWindowData.put( "ShowAll", (*aIter)->IsShowAll() );
     444                 :            : 
     445         [ #  # ]:          0 :             const ::rtl::OUString sTableName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Table" ) ) + ::rtl::OUString::valueOf( i ) );
     446 [ #  # ][ #  # ]:          0 :             aAllTablesData.put( sTableName, aWindowData.getPropertyValues() );
                 [ #  # ]
     447         [ #  # ]:          0 :         }
     448                 :            : 
     449 [ #  # ][ #  # ]:          0 :         o_rViewSettings.put( "Tables", aAllTablesData.getPropertyValues() );
         [ #  # ][ #  # ]
     450                 :            :     }
     451                 :          0 : }
     452                 :            : // -----------------------------------------------------------------------------
     453                 :          0 : TTableWindowData::value_type OJoinController::createTableWindowData(const ::rtl::OUString& _sComposedName,const ::rtl::OUString& _sTableName,const ::rtl::OUString& _sWindowName)
     454                 :            : {
     455                 :          0 :     OJoinDesignView* pView = getJoinView();
     456         [ #  # ]:          0 :     if( pView )
     457                 :          0 :         return pView->getTableView()->createTableWindowData(_sComposedName,_sTableName,_sWindowName);
     458                 :            :     OSL_FAIL("We should never ever reach this point!");
     459                 :            : 
     460                 :          0 :     return TTableWindowData::value_type();
     461                 :            : }
     462                 :            : // .............................................................................
     463                 :            : }   // namespace dbaui
     464                 :            : // .............................................................................
     465                 :            : 
     466                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10