LCOV - code coverage report
Current view: top level - sc/source/ui/dbgui - sfiltdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 199 0.0 %
Date: 2012-08-25 Functions: 0 17 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 492 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <sfx2/dispatch.hxx>
      30                 :            : 
      31                 :            : #include "uiitems.hxx"
      32                 :            : #include "rangenam.hxx"
      33                 :            : #include "dbdata.hxx"
      34                 :            : #include "reffact.hxx"
      35                 :            : #include "viewdata.hxx"
      36                 :            : #include "document.hxx"
      37                 :            : #include "docsh.hxx"
      38                 :            : #include "scresid.hxx"
      39                 :            : 
      40                 :            : #include "foptmgr.hxx"
      41                 :            : 
      42                 :            : #include "globstr.hrc"
      43                 :            : #include "filter.hrc"
      44                 :            : 
      45                 :            : #define _SFILTDLG_CXX
      46                 :            : #include "filtdlg.hxx"
      47                 :            : #undef _SFILTDLG_CXX
      48                 :            : #include <vcl/msgbox.hxx>
      49                 :            : 
      50                 :            : // DEFINE --------------------------------------------------------------------
      51                 :            : 
      52                 :            : #define ERRORBOX(rid) ErrorBox( this, WinBits( WB_OK|WB_DEF_OK),\
      53                 :            :                                     ScGlobal::GetRscString(rid) ).Execute()
      54                 :            : 
      55                 :            : 
      56                 :            : //============================================================================
      57                 :            : //  class ScSpecialFilterDialog
      58                 :            : 
      59                 :            : //----------------------------------------------------------------------------
      60                 :            : 
      61                 :          0 : ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
      62                 :            :                                         const SfxItemSet&   rArgSet )
      63                 :            : 
      64                 :            :     :   ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_SPEC_FILTER ),
      65                 :            :         //
      66                 :            :         aFtFilterArea   ( this, ScResId( FT_CRITERIA_AREA ) ),
      67                 :            :         aLbFilterArea   ( this, ScResId( LB_CRITERIA_AREA ) ),
      68                 :            :         aEdFilterArea   ( this, this, ScResId( ED_CRITERIA_AREA ) ),
      69                 :            :         aRbFilterArea   ( this, ScResId( RB_CRITERIA_AREA ), &aEdFilterArea, this ),
      70                 :            :         //
      71                 :            :         aFlOptions      ( this, ScResId( FL_OPTIONS ) ),
      72                 :            :         aBtnCase        ( this, ScResId( BTN_CASE ) ),
      73                 :            :         aBtnRegExp      ( this, ScResId( BTN_REGEXP ) ),
      74                 :            :         aBtnHeader      ( this, ScResId( BTN_HEADER ) ),
      75                 :            :         aBtnUnique      ( this, ScResId( BTN_UNIQUE ) ),
      76                 :            :         aBtnCopyResult  ( this, ScResId( BTN_COPY_RESULT ) ),
      77                 :            :         aLbCopyArea     ( this, ScResId( LB_COPY_AREA ) ),
      78                 :            :         aEdCopyArea     ( this, this, ScResId( ED_COPY_AREA ) ),
      79                 :            :         aRbCopyArea     ( this, ScResId( RB_COPY_AREA ), &aEdCopyArea, this ),
      80                 :            :         aBtnDestPers    ( this, ScResId( BTN_DEST_PERS ) ),
      81                 :            :         aFtDbAreaLabel  ( this, ScResId( FT_DBAREA_LABEL ) ),
      82                 :            :         aFtDbArea       ( this, ScResId( FT_DBAREA ) ),
      83                 :            :         aStrUndefined   ( SC_RESSTR(SCSTR_UNDEFINED) ),
      84                 :            :         aBtnOk          ( this, ScResId( BTN_OK ) ),
      85                 :            :         aBtnCancel      ( this, ScResId( BTN_CANCEL ) ),
      86                 :            :         aBtnHelp        ( this, ScResId( BTN_HELP ) ),
      87                 :            :         aBtnMore        ( this, ScResId( BTN_MORE ) ),
      88                 :            :         //
      89                 :            :         pOptionsMgr     ( NULL ),
      90         [ #  # ]:          0 :         nWhichQuery     ( rArgSet.GetPool()->GetWhich( SID_QUERY ) ),
      91                 :            :         theQueryData    ( ((const ScQueryItem&)
      92 [ #  # ][ #  # ]:          0 :                            rArgSet.Get( nWhichQuery )).GetQueryData() ),
      93                 :            :         pOutItem        ( NULL ),
      94                 :            :         pViewData       ( NULL ),
      95                 :            :         pDoc            ( NULL ),
      96                 :            :         pRefInputEdit   ( NULL ),
      97                 :            :         bRefInputMode   ( false ),
      98 [ #  # ][ #  # ]:          0 :         pTimer          ( NULL )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      99                 :            : {
     100         [ #  # ]:          0 :     Init( rArgSet );
     101         [ #  # ]:          0 :     aEdFilterArea.GrabFocus();
     102                 :            : 
     103         [ #  # ]:          0 :     FreeResource();
     104                 :            : 
     105                 :            :     // Hack: RefInput-Kontrolle
     106 [ #  # ][ #  # ]:          0 :     pTimer = new Timer;
     107         [ #  # ]:          0 :     pTimer->SetTimeout( 50 ); // 50ms warten
     108         [ #  # ]:          0 :     pTimer->SetTimeoutHdl( LINK( this, ScSpecialFilterDlg, TimeOutHdl ) );
     109         [ #  # ]:          0 :     pTimer->Start();
     110                 :            : 
     111 [ #  # ][ #  # ]:          0 :     aLbCopyArea.SetAccessibleName(aBtnCopyResult.GetText());
                 [ #  # ]
     112 [ #  # ][ #  # ]:          0 :     aEdCopyArea.SetAccessibleName(aBtnCopyResult.GetText());
                 [ #  # ]
     113         [ #  # ]:          0 :     aLbCopyArea.SetAccessibleRelationLabeledBy(&aBtnCopyResult);
     114         [ #  # ]:          0 :     aEdCopyArea.SetAccessibleRelationLabeledBy(&aBtnCopyResult);
     115                 :          0 : }
     116                 :            : 
     117                 :            : 
     118                 :            : //----------------------------------------------------------------------------
     119                 :            : 
     120 [ #  # ][ #  # ]:          0 : ScSpecialFilterDlg::~ScSpecialFilterDlg()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     121                 :            : {
     122         [ #  # ]:          0 :     sal_uInt16 nEntries = aLbFilterArea.GetEntryCount();
     123                 :            :     sal_uInt16 i;
     124                 :            : 
     125         [ #  # ]:          0 :     for ( i=1; i<nEntries; i++ )
     126 [ #  # ][ #  # ]:          0 :         delete (String*)aLbFilterArea.GetEntryData( i );
                 [ #  # ]
     127                 :            : 
     128 [ #  # ][ #  # ]:          0 :     delete pOptionsMgr;
     129                 :            : 
     130         [ #  # ]:          0 :     if ( pOutItem )
     131 [ #  # ][ #  # ]:          0 :         delete pOutItem;
     132                 :            : 
     133                 :            :     // Hack: RefInput-Kontrolle
     134         [ #  # ]:          0 :     pTimer->Stop();
     135 [ #  # ][ #  # ]:          0 :     delete pTimer;
     136         [ #  # ]:          0 : }
     137                 :            : 
     138                 :            : 
     139                 :            : //----------------------------------------------------------------------------
     140                 :            : 
     141                 :          0 : void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet )
     142                 :            : {
     143                 :            :     const ScQueryItem& rQueryItem = (const ScQueryItem&)
     144                 :          0 :                                     rArgSet.Get( nWhichQuery );
     145                 :            : 
     146                 :          0 :     aBtnOk.SetClickHdl          ( LINK( this, ScSpecialFilterDlg, EndDlgHdl ) );
     147                 :          0 :     aBtnCancel.SetClickHdl      ( LINK( this, ScSpecialFilterDlg, EndDlgHdl ) );
     148                 :          0 :     aLbFilterArea.SetSelectHdl  ( LINK( this, ScSpecialFilterDlg, FilterAreaSelHdl ) );
     149                 :          0 :     aEdFilterArea.SetModifyHdl  ( LINK( this, ScSpecialFilterDlg, FilterAreaModHdl ) );
     150                 :            : 
     151                 :          0 :     pViewData   = rQueryItem.GetViewData();
     152         [ #  # ]:          0 :     pDoc        = pViewData ? pViewData->GetDocument()  : NULL;
     153                 :            : 
     154                 :          0 :     aEdFilterArea.SetText( EMPTY_STRING );      // may be overwritten below
     155                 :            : 
     156 [ #  # ][ #  # ]:          0 :     if ( pViewData && pDoc )
     157                 :            :     {
     158 [ #  # ][ #  # ]:          0 :         if(pDoc->GetChangeTrack()!=NULL) aBtnCopyResult.Disable();
     159                 :            : 
     160         [ #  # ]:          0 :         ScRangeName* pRangeNames = pDoc->GetRangeName();
     161         [ #  # ]:          0 :         aLbFilterArea.Clear();
     162 [ #  # ][ #  # ]:          0 :         aLbFilterArea.InsertEntry( aStrUndefined, 0 );
                 [ #  # ]
     163                 :            : 
     164 [ #  # ][ #  # ]:          0 :         if (!pRangeNames->empty())
     165                 :            :         {
     166 [ #  # ][ #  # ]:          0 :             ScRangeName::const_iterator itr = pRangeNames->begin(), itrEnd = pRangeNames->end();
         [ #  # ][ #  # ]
     167                 :          0 :             sal_uInt16 nInsert = 0;
     168 [ #  # ][ #  # ]:          0 :             for (; itr != itrEnd; ++itr)
                 [ #  # ]
     169                 :            :             {
     170 [ #  # ][ #  # ]:          0 :                 if (!itr->second->HasType(RT_CRITERIA))
     171                 :          0 :                     continue;
     172                 :            : 
     173 [ #  # ][ #  # ]:          0 :                 nInsert = aLbFilterArea.InsertEntry(itr->second->GetName());
         [ #  # ][ #  # ]
     174                 :          0 :                 rtl::OUString aSymbol;
     175 [ #  # ][ #  # ]:          0 :                 itr->second->GetSymbol(aSymbol);
     176 [ #  # ][ #  # ]:          0 :                 aLbFilterArea.SetEntryData(nInsert, new String(aSymbol));
                 [ #  # ]
     177                 :          0 :             }
     178                 :            :         }
     179                 :            : 
     180                 :            :         //  is there a stored source range?
     181                 :            : 
     182                 :          0 :         ScRange aAdvSource;
     183 [ #  # ][ #  # ]:          0 :         if (rQueryItem.GetAdvancedQuerySource(aAdvSource))
     184                 :            :         {
     185         [ #  # ]:          0 :             String aRefStr;
     186 [ #  # ][ #  # ]:          0 :             aAdvSource.Format( aRefStr, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() );
     187 [ #  # ][ #  # ]:          0 :             aEdFilterArea.SetRefString( aRefStr );
     188                 :            :         }
     189                 :            :     }
     190                 :            : 
     191                 :          0 :     aLbFilterArea.SelectEntryPos( 0 );
     192                 :            : 
     193                 :            :     // Optionen initialisieren lassen:
     194                 :            : 
     195                 :            :     pOptionsMgr  = new ScFilterOptionsMgr(
     196                 :            :                             this,
     197                 :            :                             pViewData,
     198                 :            :                             theQueryData,
     199                 :            :                             aBtnMore,
     200                 :            :                             aBtnCase,
     201                 :            :                             aBtnRegExp,
     202                 :            :                             aBtnHeader,
     203                 :            :                             aBtnUnique,
     204                 :            :                             aBtnCopyResult,
     205                 :            :                             aBtnDestPers,
     206                 :            :                             aLbCopyArea,
     207                 :            :                             aEdCopyArea,
     208                 :            :                             aRbCopyArea,
     209                 :            :                             aFtDbAreaLabel,
     210                 :            :                             aFtDbArea,
     211                 :            :                             aFlOptions,
     212 [ #  # ][ #  # ]:          0 :                             aStrUndefined );
     213                 :            : 
     214                 :            :     //  Spezialfilter braucht immer Spaltenkoepfe
     215                 :          0 :     aBtnHeader.Check(true);
     216                 :          0 :     aBtnHeader.Disable();
     217                 :            : 
     218                 :            :     // Modal-Modus einschalten
     219                 :            : //  SetDispatcherLock( true );
     220                 :            :     //@BugID 54702 Enablen/Disablen nur noch in Basisklasse
     221                 :            :     //SFX_APPWINDOW->Disable(false);        //! allgemeine Methode im ScAnyRefDlg
     222                 :          0 : }
     223                 :            : 
     224                 :            : 
     225                 :            : //----------------------------------------------------------------------------
     226                 :            : 
     227                 :          0 : sal_Bool ScSpecialFilterDlg::Close()
     228                 :            : {
     229         [ #  # ]:          0 :     if (pViewData)
     230                 :          0 :         pViewData->GetDocShell()->CancelAutoDBRange();
     231                 :            : 
     232                 :          0 :     return DoClose( ScSpecialFilterDlgWrapper::GetChildWindowId() );
     233                 :            : }
     234                 :            : 
     235                 :            : 
     236                 :            : //----------------------------------------------------------------------------
     237                 :            : // Uebergabe eines mit der Maus selektierten Tabellenbereiches, der dann als
     238                 :            : // neue Selektion im Referenz-Edit angezeigt wird.
     239                 :            : 
     240                 :          0 : void ScSpecialFilterDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
     241                 :            : {
     242 [ #  # ][ #  # ]:          0 :     if ( bRefInputMode && pRefInputEdit )       // Nur moeglich, wenn im Referenz-Editmodus
     243                 :            :     {
     244         [ #  # ]:          0 :         if ( rRef.aStart != rRef.aEnd )
     245         [ #  # ]:          0 :             RefInputStart( pRefInputEdit );
     246                 :            : 
     247         [ #  # ]:          0 :         String aRefStr;
     248         [ #  # ]:          0 :         const formula::FormulaGrammar::AddressConvention eConv = pDocP->GetAddressConvention();
     249                 :            : 
     250         [ #  # ]:          0 :         if ( pRefInputEdit == &aEdCopyArea)
     251         [ #  # ]:          0 :             rRef.aStart.Format( aRefStr, SCA_ABS_3D, pDocP, eConv );
     252         [ #  # ]:          0 :         else if ( pRefInputEdit == &aEdFilterArea)
     253         [ #  # ]:          0 :             rRef.Format( aRefStr, SCR_ABS_3D, pDocP, eConv );
     254                 :            : 
     255 [ #  # ][ #  # ]:          0 :         pRefInputEdit->SetRefString( aRefStr );
     256                 :            :     }
     257                 :          0 : }
     258                 :            : 
     259                 :            : 
     260                 :            : //----------------------------------------------------------------------------
     261                 :            : 
     262                 :          0 : void ScSpecialFilterDlg::SetActive()
     263                 :            : {
     264         [ #  # ]:          0 :     if ( bRefInputMode )
     265                 :            :     {
     266         [ #  # ]:          0 :         if ( pRefInputEdit == &aEdCopyArea )
     267                 :            :         {
     268                 :          0 :             aEdCopyArea.GrabFocus();
     269         [ #  # ]:          0 :             if ( aEdCopyArea.GetModifyHdl().IsSet() )
     270                 :          0 :                 ((Link&)aEdCopyArea.GetModifyHdl()).Call( &aEdCopyArea );
     271                 :            :         }
     272         [ #  # ]:          0 :         else if ( pRefInputEdit == &aEdFilterArea )
     273                 :            :         {
     274                 :          0 :             aEdFilterArea.GrabFocus();
     275                 :          0 :             FilterAreaModHdl( &aEdFilterArea );
     276                 :            :         }
     277                 :            :     }
     278                 :            :     else
     279                 :          0 :         GrabFocus();
     280                 :            : 
     281                 :          0 :     RefInputDone();
     282                 :          0 : }
     283                 :            : 
     284                 :            : 
     285                 :            : //----------------------------------------------------------------------------
     286                 :            : 
     287                 :          0 : ScQueryItem* ScSpecialFilterDlg::GetOutputItem( const ScQueryParam& rParam,
     288                 :            :                                                 const ScRange& rSource )
     289                 :            : {
     290 [ #  # ][ #  # ]:          0 :     if ( pOutItem ) DELETEZ( pOutItem );
     291         [ #  # ]:          0 :     pOutItem = new ScQueryItem( nWhichQuery, &rParam );
     292                 :          0 :     pOutItem->SetAdvancedQuerySource( &rSource );
     293                 :            : 
     294                 :          0 :     return pOutItem;
     295                 :            : }
     296                 :            : 
     297                 :            : 
     298                 :            : //----------------------------------------------------------------------------
     299                 :            : 
     300                 :          0 : sal_Bool ScSpecialFilterDlg::IsRefInputMode() const
     301                 :            : {
     302                 :          0 :     return bRefInputMode;
     303                 :            : }
     304                 :            : 
     305                 :            : 
     306                 :            : //----------------------------------------------------------------------------
     307                 :            : // Handler:
     308                 :            : // ========
     309                 :            : 
     310                 :          0 : IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn )
     311                 :            : {
     312                 :            :     OSL_ENSURE( pDoc && pViewData, "Document or ViewData not found. :-/" );
     313                 :            : 
     314 [ #  # ][ #  # ]:          0 :     if ( (pBtn == &aBtnOk) && pDoc && pViewData )
                 [ #  # ]
     315                 :            :     {
     316         [ #  # ]:          0 :         String          theCopyStr( aEdCopyArea.GetText() );
     317         [ #  # ]:          0 :         String          theAreaStr( aEdFilterArea.GetText() );
     318         [ #  # ]:          0 :         ScQueryParam    theOutParam( theQueryData );
     319                 :          0 :         ScAddress       theAdrCopy;
     320                 :          0 :         sal_Bool            bEditInputOk    = true;
     321                 :          0 :         sal_Bool            bQueryOk        = false;
     322                 :          0 :         ScRange         theFilterArea;
     323         [ #  # ]:          0 :         const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
     324                 :            : 
     325 [ #  # ][ #  # ]:          0 :         if ( aBtnCopyResult.IsChecked() )
     326                 :            :         {
     327         [ #  # ]:          0 :             xub_StrLen nColonPos = theCopyStr.Search( ':' );
     328                 :            : 
     329         [ #  # ]:          0 :             if ( STRING_NOTFOUND != nColonPos )
     330         [ #  # ]:          0 :                 theCopyStr.Erase( nColonPos );
     331                 :            : 
     332         [ #  # ]:          0 :             sal_uInt16 nResult = theAdrCopy.Parse( theCopyStr, pDoc, eConv );
     333                 :            : 
     334         [ #  # ]:          0 :             if ( SCA_VALID != (nResult & SCA_VALID) )
     335                 :            :             {
     336         [ #  # ]:          0 :                 if ( !aBtnMore.GetState() )
     337         [ #  # ]:          0 :                     aBtnMore.SetState( true );
     338                 :            : 
     339 [ #  # ][ #  # ]:          0 :                 ERRORBOX( STR_INVALID_TABREF );
         [ #  # ][ #  # ]
     340         [ #  # ]:          0 :                 aEdCopyArea.GrabFocus();
     341                 :          0 :                 bEditInputOk = false;
     342                 :            :             }
     343                 :            :         }
     344                 :            : 
     345         [ #  # ]:          0 :         if ( bEditInputOk )
     346                 :            :         {
     347         [ #  # ]:          0 :             sal_uInt16 nResult = ScRange().Parse( theAreaStr, pDoc, eConv );
     348                 :            : 
     349         [ #  # ]:          0 :             if ( SCA_VALID != (nResult & SCA_VALID) )
     350                 :            :             {
     351 [ #  # ][ #  # ]:          0 :                 ERRORBOX( STR_INVALID_TABREF );
         [ #  # ][ #  # ]
     352         [ #  # ]:          0 :                 aEdFilterArea.GrabFocus();
     353                 :          0 :                 bEditInputOk = false;
     354                 :            :             }
     355                 :            :         }
     356                 :            : 
     357         [ #  # ]:          0 :         if ( bEditInputOk )
     358                 :            :         {
     359                 :            :             /*
     360                 :            :              * Alle Edit-Felder enthalten gueltige Bereiche.
     361                 :            :              * Nun wird versucht aus dem Filterbereich
     362                 :            :              * ein ScQueryParam zu erzeugen:
     363                 :            :              */
     364                 :            : 
     365         [ #  # ]:          0 :             sal_uInt16  nResult = theFilterArea.Parse( theAreaStr, pDoc, eConv );
     366                 :            : 
     367         [ #  # ]:          0 :             if ( SCA_VALID == (nResult & SCA_VALID) )
     368                 :            :             {
     369                 :          0 :                 ScAddress& rStart = theFilterArea.aStart;
     370                 :          0 :                 ScAddress& rEnd   = theFilterArea.aEnd;
     371                 :            : 
     372 [ #  # ][ #  # ]:          0 :                 if ( aBtnCopyResult.IsChecked() )
     373                 :            :                 {
     374                 :          0 :                     theOutParam.bInplace    = false;
     375                 :          0 :                     theOutParam.nDestTab    = theAdrCopy.Tab();
     376                 :          0 :                     theOutParam.nDestCol    = theAdrCopy.Col();
     377                 :          0 :                     theOutParam.nDestRow    = theAdrCopy.Row();
     378                 :            :                 }
     379                 :            :                 else
     380                 :            :                 {
     381                 :          0 :                     theOutParam.bInplace    = true;
     382                 :          0 :                     theOutParam.nDestTab    = 0;
     383                 :          0 :                     theOutParam.nDestCol    = 0;
     384                 :          0 :                     theOutParam.nDestRow    = 0;
     385                 :            :                 }
     386                 :            : 
     387         [ #  # ]:          0 :                 theOutParam.bHasHeader = aBtnHeader.IsChecked();
     388                 :          0 :                 theOutParam.bByRow     = true;
     389         [ #  # ]:          0 :                 theOutParam.bCaseSens  = aBtnCase.IsChecked();
     390         [ #  # ]:          0 :                 theOutParam.bRegExp    = aBtnRegExp.IsChecked();
     391         [ #  # ]:          0 :                 theOutParam.bDuplicate = !aBtnUnique.IsChecked();
     392         [ #  # ]:          0 :                 theOutParam.bDestPers  = aBtnDestPers.IsChecked();
     393                 :            : 
     394                 :            :                 bQueryOk =
     395                 :          0 :                     pDoc->CreateQueryParam( rStart.Col(),
     396                 :            :                                             rStart.Row(),
     397                 :          0 :                                             rEnd.Col(),
     398                 :            :                                             rEnd.Row(),
     399                 :          0 :                                             rStart.Tab(),
     400         [ #  # ]:          0 :                                             theOutParam );
     401                 :            :             }
     402                 :            :         }
     403                 :            : 
     404         [ #  # ]:          0 :         if ( bQueryOk )
     405                 :            :         {
     406         [ #  # ]:          0 :             SetDispatcherLock( false );
     407         [ #  # ]:          0 :             SwitchToDocument();
     408                 :          0 :             GetBindings().GetDispatcher()->Execute( FID_FILTER_OK,
     409                 :            :                                       SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
     410   [ #  #  #  # ]:          0 :                                       GetOutputItem( theOutParam, theFilterArea ), 0L, 0L );
     411         [ #  # ]:          0 :             Close();
     412                 :            :         }
     413                 :            :         else
     414                 :            :         {
     415 [ #  # ][ #  # ]:          0 :             ERRORBOX( STR_INVALID_QUERYAREA );
         [ #  # ][ #  # ]
     416         [ #  # ]:          0 :             aEdFilterArea.GrabFocus();
     417 [ #  # ][ #  # ]:          0 :         }
                 [ #  # ]
     418                 :            :     }
     419         [ #  # ]:          0 :     else if ( pBtn == &aBtnCancel )
     420                 :            :     {
     421                 :          0 :         Close();
     422                 :            :     }
     423                 :          0 :     return 0;
     424                 :            : }
     425                 :            : 
     426                 :            : 
     427                 :            : //----------------------------------------------------------------------------
     428                 :            : 
     429                 :          0 : IMPL_LINK( ScSpecialFilterDlg, TimeOutHdl, Timer*, _pTimer )
     430                 :            : {
     431                 :            :     // alle 50ms nachschauen, ob RefInputMode noch stimmt
     432                 :            : 
     433 [ #  # ][ #  # ]:          0 :     if( (_pTimer == pTimer) && IsActive() )
                 [ #  # ]
     434                 :            :     {
     435 [ #  # ][ #  # ]:          0 :         if( aEdCopyArea.HasFocus() || aRbCopyArea.HasFocus() )
                 [ #  # ]
     436                 :            :         {
     437                 :          0 :             pRefInputEdit = &aEdCopyArea;
     438                 :          0 :             bRefInputMode = true;
     439                 :            :         }
     440 [ #  # ][ #  # ]:          0 :         else if( aEdFilterArea.HasFocus() || aRbFilterArea.HasFocus() )
                 [ #  # ]
     441                 :            :         {
     442                 :          0 :             pRefInputEdit = &aEdFilterArea;
     443                 :          0 :             bRefInputMode = true;
     444                 :            :         }
     445         [ #  # ]:          0 :         else if( bRefInputMode )
     446                 :            :         {
     447                 :          0 :             pRefInputEdit = NULL;
     448                 :          0 :             bRefInputMode = false;
     449                 :            :         }
     450                 :            :     }
     451                 :            : 
     452                 :          0 :     pTimer->Start();
     453                 :            : 
     454                 :          0 :     return 0;
     455                 :            : }
     456                 :            : 
     457                 :            : 
     458                 :            : //----------------------------------------------------------------------------
     459                 :            : 
     460                 :          0 : IMPL_LINK( ScSpecialFilterDlg, FilterAreaSelHdl, ListBox*, pLb )
     461                 :            : {
     462         [ #  # ]:          0 :     if ( pLb == &aLbFilterArea )
     463                 :            :     {
     464         [ #  # ]:          0 :         String  aString;
     465         [ #  # ]:          0 :         sal_uInt16  nSelPos = aLbFilterArea.GetSelectEntryPos();
     466                 :            : 
     467         [ #  # ]:          0 :         if ( nSelPos > 0 )
     468 [ #  # ][ #  # ]:          0 :             aString = *(String*)aLbFilterArea.GetEntryData( nSelPos );
     469                 :            : 
     470 [ #  # ][ #  # ]:          0 :         aEdFilterArea.SetText( aString );
     471                 :            :     }
     472                 :            : 
     473                 :          0 :     return 0;
     474                 :            : }
     475                 :            : 
     476                 :            : 
     477                 :            : //----------------------------------------------------------------------------
     478                 :            : 
     479                 :          0 : IMPL_LINK( ScSpecialFilterDlg, FilterAreaModHdl, formula::RefEdit*, pEd )
     480                 :            : {
     481         [ #  # ]:          0 :     if ( pEd == &aEdFilterArea )
     482                 :            :     {
     483 [ #  # ][ #  # ]:          0 :         if ( pDoc && pViewData )
     484                 :            :         {
     485         [ #  # ]:          0 :             String  theCurAreaStr = pEd->GetText();
     486         [ #  # ]:          0 :             sal_uInt16  nResult = ScRange().Parse( theCurAreaStr, pDoc );
     487                 :            : 
     488         [ #  # ]:          0 :             if ( SCA_VALID == (nResult & SCA_VALID) )
     489                 :            :             {
     490                 :          0 :                 String* pStr    = NULL;
     491                 :          0 :                 sal_Bool    bFound  = false;
     492                 :          0 :                 sal_uInt16  i       = 0;
     493         [ #  # ]:          0 :                 sal_uInt16  nCount  = aLbFilterArea.GetEntryCount();
     494                 :            : 
     495 [ #  # ][ #  # ]:          0 :                 for ( i=1; i<nCount && !bFound; i++ )
                 [ #  # ]
     496                 :            :                 {
     497         [ #  # ]:          0 :                     pStr = (String*)aLbFilterArea.GetEntryData( i );
     498         [ #  # ]:          0 :                     bFound = (theCurAreaStr == *pStr);
     499                 :            :                 }
     500                 :            : 
     501         [ #  # ]:          0 :                 if ( bFound )
     502         [ #  # ]:          0 :                     aLbFilterArea.SelectEntryPos( --i );
     503                 :            :                 else
     504         [ #  # ]:          0 :                     aLbFilterArea.SelectEntryPos( 0 );
     505         [ #  # ]:          0 :             }
     506                 :            :         }
     507                 :            :         else
     508                 :          0 :             aLbFilterArea.SelectEntryPos( 0 );
     509                 :            :     }
     510                 :            : 
     511                 :          0 :     return 0;
     512                 :            : }
     513                 :            : 
     514                 :            : 
     515                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10