diff options
-rw-r--r-- | sc/UIConfig_scalc.mk | 1 | ||||
-rw-r--r-- | sc/source/ui/dbgui/foptmgr.cxx | 261 | ||||
-rw-r--r-- | sc/source/ui/dbgui/sfiltdlg.cxx | 190 | ||||
-rw-r--r-- | sc/source/ui/inc/filtdlg.hxx | 47 | ||||
-rw-r--r-- | sc/source/ui/inc/filter.hrc | 4 | ||||
-rw-r--r-- | sc/source/ui/inc/foptmgr.hxx | 76 | ||||
-rw-r--r-- | sc/source/ui/src/filter.src | 4 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/advancedfilterdialog.ui | 443 |
8 files changed, 899 insertions, 127 deletions
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index cab80912c4b4..0dc6338086f5 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -59,6 +59,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/scalc,\ )) $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ + sc/uiconfig/scalc/ui/advancedfilterdialog \ sc/uiconfig/scalc/ui/allheaderfooterdialog \ sc/uiconfig/scalc/ui/cellprotectionpage \ sc/uiconfig/scalc/ui/createnamesdialog \ diff --git a/sc/source/ui/dbgui/foptmgr.cxx b/sc/source/ui/dbgui/foptmgr.cxx index 5d31d1da530f..3d02a9739e42 100644 --- a/sc/source/ui/dbgui/foptmgr.cxx +++ b/sc/source/ui/dbgui/foptmgr.cxx @@ -29,7 +29,9 @@ #include "globalnames.hxx" #define _FOPTMGR_CXX +#define _NEWFOPTMGR_CXX #include "foptmgr.hxx" +#undef _NEWFOPTMGR_CXX #undef _FOPTMGR_CXX //---------------------------------------------------------------------------- @@ -323,5 +325,264 @@ IMPL_LINK( ScFilterOptionsMgr, BtnCopyResultHdl, CheckBox*, pBox ) return 0; } +//---------------------------------------------------------------------------- +// ScNewFilterOptionsMgr (.ui's option helper) +//---------------------------------------------------------------------------- + +ScNewFilterOptionsMgr::ScNewFilterOptionsMgr( + ScViewData* ptrViewData, + const ScQueryParam& refQueryData, + CheckBox* refBtnCase, + CheckBox* refBtnRegExp, + CheckBox* refBtnHeader, + CheckBox* refBtnUnique, + CheckBox* refBtnCopyResult, + CheckBox* refBtnDestPers, + ListBox* refLbCopyArea, + Edit* refEdCopyArea, + formula::RefButton* refRbCopyArea, + FixedText* refFtDbAreaLabel, + FixedText* refFtDbArea, + const String& refStrUndefined ) + + : pViewData ( ptrViewData ), + pDoc ( ptrViewData ? ptrViewData->GetDocument() : NULL ), + pBtnCase ( refBtnCase ), + pBtnRegExp ( refBtnRegExp ), + pBtnHeader ( refBtnHeader ), + pBtnUnique ( refBtnUnique ), + pBtnCopyResult ( refBtnCopyResult ), + pBtnDestPers ( refBtnDestPers ), + pLbCopyArea ( refLbCopyArea ), + pEdCopyArea ( refEdCopyArea ), + pRbCopyArea ( refRbCopyArea ), + pFtDbAreaLabel ( refFtDbAreaLabel ), + pFtDbArea ( refFtDbArea ), + rStrUndefined ( refStrUndefined ), + rQueryData ( refQueryData ) +{ + Init(); +} + + +//---------------------------------------------------------------------------- + +ScNewFilterOptionsMgr::~ScNewFilterOptionsMgr() +{ + sal_uInt16 nEntries = pLbCopyArea->GetEntryCount(); + sal_uInt16 i; + + for ( i=2; i<nEntries; i++ ) + delete (String*)pLbCopyArea->GetEntryData( i ); +} + + +//---------------------------------------------------------------------------- + +void ScNewFilterOptionsMgr::Init() +{ +//moggi:TODO + OSL_ENSURE( pViewData && pDoc, "Init failed :-/" ); + + pLbCopyArea->SetSelectHdl ( LINK( this, ScNewFilterOptionsMgr, LbAreaSelHdl ) ); + pEdCopyArea->SetModifyHdl ( LINK( this, ScNewFilterOptionsMgr, EdAreaModifyHdl ) ); + pBtnCopyResult->SetToggleHdl ( LINK( this, ScNewFilterOptionsMgr, BtnCopyResultHdl ) ); + + pBtnCase ->Check( rQueryData.bCaseSens ); + pBtnHeader ->Check( rQueryData.bHasHeader ); + pBtnRegExp ->Check( rQueryData.bRegExp ); + pBtnUnique ->Check( !rQueryData.bDuplicate ); + + if ( pViewData && pDoc ) + { + OUString theAreaStr; + ScRange theCurArea ( ScAddress( rQueryData.nCol1, + rQueryData.nRow1, + pViewData->GetTabNo() ), + ScAddress( rQueryData.nCol2, + rQueryData.nRow2, + pViewData->GetTabNo() ) ); + ScDBCollection* pDBColl = pDoc->GetDBCollection(); + OUStringBuffer theDbArea; + OUString theDbName(STR_DB_LOCAL_NONAME); + const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + + theCurArea.Format( theAreaStr, SCR_ABS_3D, pDoc, eConv ); + + // Zielbereichsliste fuellen + + pLbCopyArea->Clear(); + pLbCopyArea->InsertEntry( rStrUndefined, 0 ); + + ScAreaNameIterator aIter( pDoc ); + String aName; + ScRange aRange; + String aRefStr; + while ( aIter.Next( aName, aRange ) ) + { + sal_uInt16 nInsert = pLbCopyArea->InsertEntry( aName ); + + aRange.aStart.Format( aRefStr, SCA_ABS_3D, pDoc, eConv ); + pLbCopyArea->SetEntryData( nInsert, new String( aRefStr ) ); + } + + pBtnDestPers->Check( sal_True ); // beim Aufruf immer an + pLbCopyArea->SelectEntryPos( 0 ); + pEdCopyArea->SetText( EMPTY_STRING ); + + /* + * Ueberpruefen, ob es sich bei dem uebergebenen + * Bereich um einen Datenbankbereich handelt: + */ + + theDbArea = theAreaStr; + + if ( pDBColl ) + { + ScAddress& rStart = theCurArea.aStart; + ScAddress& rEnd = theCurArea.aEnd; + const ScDBData* pDBData = pDBColl->GetDBAtArea( + rStart.Tab(), rStart.Col(), rStart.Row(), rEnd.Col(), rEnd.Row()); + + if ( pDBData ) + { + pBtnHeader->Check( pDBData->HasHeader() ); + theDbName = pDBData->GetName(); + + if ( theDbName == STR_DB_LOCAL_NONAME ) + pBtnHeader->Enable(); + else + pBtnHeader->Disable(); + } + } + + if ( !theDbName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(STR_DB_LOCAL_NONAME)) ) + { + theDbArea.appendAscii(RTL_CONSTASCII_STRINGPARAM(" (")); + theDbArea.append(theDbName).append(')'); + pFtDbArea->SetText( theDbArea.makeStringAndClear() ); + } + else + { + pFtDbAreaLabel->SetText( OUString() ); + pFtDbArea->SetText( OUString() ); + } + + //------------------------------------------------------ + // Kopierposition: + + if ( !rQueryData.bInplace ) + { + String aString; + + ScAddress( rQueryData.nDestCol, + rQueryData.nDestRow, + rQueryData.nDestTab + ).Format( aString, SCA_ABS_3D, pDoc, eConv ); + + pBtnCopyResult->Check( sal_True ); + pEdCopyArea->SetText( aString ); + EdAreaModifyHdl( pEdCopyArea ); + pLbCopyArea->Enable(); + pEdCopyArea->Enable(); + pRbCopyArea->Enable(); + pBtnDestPers->Enable(); + } + else + { + pBtnCopyResult->Check( false ); + pEdCopyArea->SetText( EMPTY_STRING ); + pLbCopyArea->Disable(); + pEdCopyArea->Disable(); + pRbCopyArea->Disable(); + pBtnDestPers->Disable(); + } + } + else + pEdCopyArea->SetText( EMPTY_STRING ); +} + +//---------------------------------------------------------------------------- +// Handler: + +//---------------------------------------------------------------------------- + +IMPL_LINK( ScNewFilterOptionsMgr, LbAreaSelHdl, ListBox*, pLb ) +{ + if ( pLb == pLbCopyArea ) + { + String aString; + sal_uInt16 nSelPos = pLbCopyArea->GetSelectEntryPos(); + + if ( nSelPos > 0 ) + aString = *(String*)pLbCopyArea->GetEntryData( nSelPos ); + + pEdCopyArea->SetText( aString ); + } + + return 0; +} + + +//---------------------------------------------------------------------------- + +IMPL_LINK( ScNewFilterOptionsMgr, EdAreaModifyHdl, Edit*, pEd ) +{ + if ( pEd == pEdCopyArea ) + { + String theCurPosStr = pEd->GetText(); + sal_uInt16 nResult = ScAddress().Parse( theCurPosStr, pDoc, pDoc->GetAddressConvention() ); + + if ( SCA_VALID == (nResult & SCA_VALID) ) + { + String* pStr = NULL; + sal_Bool bFound = false; + sal_uInt16 i = 0; + sal_uInt16 nCount = pLbCopyArea->GetEntryCount(); + + for ( i=2; i<nCount && !bFound; i++ ) + { + pStr = (String*)pLbCopyArea->GetEntryData( i ); + bFound = (theCurPosStr == *pStr); + } + + if ( bFound ) + pLbCopyArea->SelectEntryPos( --i ); + else + pLbCopyArea->SelectEntryPos( 0 ); + } + else + pLbCopyArea->SelectEntryPos( 0 ); + } + + return 0; +} + + +//---------------------------------------------------------------------------- + +IMPL_LINK( ScNewFilterOptionsMgr, BtnCopyResultHdl, CheckBox*, pBox ) +{ + if ( pBox == pBtnCopyResult ) + { + if ( pBox->IsChecked() ) + { + pBtnDestPers->Enable(); + pLbCopyArea->Enable(); + pEdCopyArea->Enable(); + pRbCopyArea->Enable(); + pEdCopyArea->GrabFocus(); + } + else + { + pBtnDestPers->Disable(); + pLbCopyArea->Disable(); + pEdCopyArea->Disable(); + pRbCopyArea->Disable(); + } + } + + return 0; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index 04c7f9fb27ef..4c3eef53b825 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -52,31 +52,10 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, const SfxItemSet& rArgSet ) - : ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_SPEC_FILTER ), + : ScAnyRefDlg ( pB, pCW, pParent, "AdvancedFilterDialog", "modules/scalc/ui/advancedfilterdialog.ui" ), // - aFtFilterArea ( this, ScResId( FT_CRITERIA_AREA ) ), - aLbFilterArea ( this, ScResId( LB_CRITERIA_AREA ) ), - aEdFilterArea ( this, this, &aFtFilterArea, ScResId( ED_CRITERIA_AREA ) ), - aRbFilterArea ( this, ScResId( RB_CRITERIA_AREA ), &aEdFilterArea, this ), // - aFlOptions ( this, ScResId( FL_OPTIONS ) ), - aBtnCase ( this, ScResId( BTN_CASE ) ), - aBtnRegExp ( this, ScResId( BTN_REGEXP ) ), - aBtnHeader ( this, ScResId( BTN_HEADER ) ), - aBtnUnique ( this, ScResId( BTN_UNIQUE ) ), - aBtnCopyResult ( this, ScResId( BTN_COPY_RESULT ) ), - aLbCopyArea ( this, ScResId( LB_COPY_AREA ) ), - aEdCopyArea ( this, this, NULL, ScResId( ED_COPY_AREA ) ), - aRbCopyArea ( this, ScResId( RB_COPY_AREA ), &aEdCopyArea, this ), - aBtnDestPers ( this, ScResId( BTN_DEST_PERS ) ), - aFtDbAreaLabel ( this, ScResId( FT_DBAREA_LABEL ) ), - aFtDbArea ( this, ScResId( FT_DBAREA ) ), aStrUndefined ( SC_RESSTR(SCSTR_UNDEFINED) ), - aBtnOk ( this, ScResId( BTN_OK ) ), - aBtnCancel ( this, ScResId( BTN_CANCEL ) ), - aBtnHelp ( this, ScResId( BTN_HELP ) ), - aBtnMore ( this, ScResId( BTN_MORE ) ), - // pOptionsMgr ( NULL ), nWhichQuery ( rArgSet.GetPool()->GetWhich( SID_QUERY ) ), theQueryData ( ((const ScQueryItem&) @@ -88,10 +67,28 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Wi bRefInputMode ( false ), pTimer ( NULL ) { - Init( rArgSet ); - aEdFilterArea.GrabFocus(); + get(pLbFilterArea,"lbfilterarea"); + get(pEdFilterArea,"edfilterarea"); + get(pRbFilterArea,"rbfilterarea"); + pRbFilterArea->SetReferences(this, pEdFilterArea); + get(pBtnCase,"case"); + get(pBtnRegExp,"regexp"); + get(pBtnHeader,"header"); + get(pBtnUnique,"unique"); + get(pBtnCopyResult,"copyresult"); + get(pLbCopyArea,"lbcopyarea"); + get(pEdCopyArea,"edcopyarea"); + get(pRbCopyArea,"rbcopyarea"); + pRbCopyArea->SetReferences(this, pEdCopyArea); + get(pBtnDestPers,"destpers"); + get(pFtDbAreaLabel,"dbarealabel"); + get(pFtDbArea,"dbarea"); + get(pBtnOk,"ok"); + get(pBtnCancel,"cancel"); + get(pExpander,"more"); - FreeResource(); + Init( rArgSet ); + pEdFilterArea->GrabFocus(); // Hack: RefInput-Kontrolle pTimer = new Timer; @@ -99,10 +96,8 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Wi pTimer->SetTimeoutHdl( LINK( this, ScSpecialFilterDlg, TimeOutHdl ) ); pTimer->Start(); - aLbCopyArea.SetAccessibleName(aBtnCopyResult.GetText()); - aEdCopyArea.SetAccessibleName(aBtnCopyResult.GetText()); - aLbCopyArea.SetAccessibleRelationLabeledBy(&aBtnCopyResult); - aEdCopyArea.SetAccessibleRelationLabeledBy(&aBtnCopyResult); + pLbCopyArea->SetAccessibleName(pBtnCopyResult->GetText()); + pEdCopyArea->SetAccessibleName(pBtnCopyResult->GetText()); } @@ -110,11 +105,11 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Wi ScSpecialFilterDlg::~ScSpecialFilterDlg() { - sal_uInt16 nEntries = aLbFilterArea.GetEntryCount(); + sal_uInt16 nEntries = pLbFilterArea->GetEntryCount(); sal_uInt16 i; for ( i=1; i<nEntries; i++ ) - delete (String*)aLbFilterArea.GetEntryData( i ); + delete (String*)pLbFilterArea->GetEntryData( i ); delete pOptionsMgr; @@ -134,23 +129,23 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet ) const ScQueryItem& rQueryItem = (const ScQueryItem&) rArgSet.Get( nWhichQuery ); - aBtnOk.SetClickHdl ( LINK( this, ScSpecialFilterDlg, EndDlgHdl ) ); - aBtnCancel.SetClickHdl ( LINK( this, ScSpecialFilterDlg, EndDlgHdl ) ); - aLbFilterArea.SetSelectHdl ( LINK( this, ScSpecialFilterDlg, FilterAreaSelHdl ) ); - aEdFilterArea.SetModifyHdl ( LINK( this, ScSpecialFilterDlg, FilterAreaModHdl ) ); + pBtnOk->SetClickHdl ( LINK( this, ScSpecialFilterDlg, EndDlgHdl ) ); + pBtnCancel->SetClickHdl ( LINK( this, ScSpecialFilterDlg, EndDlgHdl ) ); + pLbFilterArea->SetSelectHdl ( LINK( this, ScSpecialFilterDlg, FilterAreaSelHdl ) ); + pEdFilterArea->SetModifyHdl ( LINK( this, ScSpecialFilterDlg, FilterAreaModHdl ) ); pViewData = rQueryItem.GetViewData(); pDoc = pViewData ? pViewData->GetDocument() : NULL; - aEdFilterArea.SetText( EMPTY_STRING ); // may be overwritten below + pEdFilterArea->SetText( EMPTY_STRING ); // may be overwritten below if ( pViewData && pDoc ) { - if(pDoc->GetChangeTrack()!=NULL) aBtnCopyResult.Disable(); + if(pDoc->GetChangeTrack()!=NULL) pBtnCopyResult->Disable(); ScRangeName* pRangeNames = pDoc->GetRangeName(); - aLbFilterArea.Clear(); - aLbFilterArea.InsertEntry( aStrUndefined, 0 ); + pLbFilterArea->Clear(); + pLbFilterArea->InsertEntry( aStrUndefined, 0 ); if (!pRangeNames->empty()) { @@ -161,10 +156,10 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet ) if (!itr->second->HasType(RT_CRITERIA)) continue; - nInsert = aLbFilterArea.InsertEntry(itr->second->GetName()); + nInsert = pLbFilterArea->InsertEntry(itr->second->GetName()); OUString aSymbol; itr->second->GetSymbol(aSymbol); - aLbFilterArea.SetEntryData(nInsert, new String(aSymbol)); + pLbFilterArea->SetEntryData(nInsert, new String(aSymbol)); } } @@ -175,35 +170,33 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet ) { String aRefStr; aAdvSource.Format( aRefStr, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() ); - aEdFilterArea.SetRefString( aRefStr ); + pEdFilterArea->SetRefString( aRefStr ); } } - aLbFilterArea.SelectEntryPos( 0 ); + pLbFilterArea->SelectEntryPos( 0 ); // Optionen initialisieren lassen: - pOptionsMgr = new ScFilterOptionsMgr( + pOptionsMgr = new ScNewFilterOptionsMgr( pViewData, theQueryData, - aBtnMore, - aBtnCase, - aBtnRegExp, - aBtnHeader, - aBtnUnique, - aBtnCopyResult, - aBtnDestPers, - aLbCopyArea, - aEdCopyArea, - aRbCopyArea, - aFtDbAreaLabel, - aFtDbArea, - aFlOptions, + pBtnCase, + pBtnRegExp, + pBtnHeader, + pBtnUnique, + pBtnCopyResult, + pBtnDestPers, + pLbCopyArea, + pEdCopyArea, + pRbCopyArea, + pFtDbAreaLabel, + pFtDbArea, aStrUndefined ); // Spezialfilter braucht immer Spaltenkoepfe - aBtnHeader.Check(true); - aBtnHeader.Disable(); + pBtnHeader->Check(true); + pBtnHeader->Disable(); // Modal-Modus einschalten // SetDispatcherLock( true ); @@ -237,9 +230,9 @@ void ScSpecialFilterDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) String aRefStr; const formula::FormulaGrammar::AddressConvention eConv = pDocP->GetAddressConvention(); - if ( pRefInputEdit == &aEdCopyArea) + if ( pRefInputEdit == pEdCopyArea) rRef.aStart.Format( aRefStr, SCA_ABS_3D, pDocP, eConv ); - else if ( pRefInputEdit == &aEdFilterArea) + else if ( pRefInputEdit == pEdFilterArea) rRef.Format( aRefStr, SCR_ABS_3D, pDocP, eConv ); pRefInputEdit->SetRefString( aRefStr ); @@ -253,16 +246,16 @@ void ScSpecialFilterDlg::SetActive() { if ( bRefInputMode ) { - if ( pRefInputEdit == &aEdCopyArea ) + if ( pRefInputEdit == pEdCopyArea ) { - aEdCopyArea.GrabFocus(); - if ( aEdCopyArea.GetModifyHdl().IsSet() ) - ((Link&)aEdCopyArea.GetModifyHdl()).Call( &aEdCopyArea ); + pEdCopyArea->GrabFocus(); + if ( pEdCopyArea->GetModifyHdl().IsSet() ) + ((Link&)pEdCopyArea->GetModifyHdl()).Call( pEdCopyArea ); } - else if ( pRefInputEdit == &aEdFilterArea ) + else if ( pRefInputEdit == pEdFilterArea ) { - aEdFilterArea.GrabFocus(); - FilterAreaModHdl( &aEdFilterArea ); + pEdFilterArea->GrabFocus(); + FilterAreaModHdl( pEdFilterArea ); } } else @@ -301,10 +294,10 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn ) { OSL_ENSURE( pDoc && pViewData, "Document or ViewData not found. :-/" ); - if ( (pBtn == &aBtnOk) && pDoc && pViewData ) + if ( (pBtn == pBtnOk) && pDoc && pViewData ) { - String theCopyStr( aEdCopyArea.GetText() ); - String theAreaStr( aEdFilterArea.GetText() ); + String theCopyStr( pEdCopyArea->GetText() ); + String theAreaStr( pEdFilterArea->GetText() ); ScQueryParam theOutParam( theQueryData ); ScAddress theAdrCopy; sal_Bool bEditInputOk = true; @@ -312,7 +305,7 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn ) ScRange theFilterArea; const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); - if ( aBtnCopyResult.IsChecked() ) + if ( pBtnCopyResult->IsChecked() ) { xub_StrLen nColonPos = theCopyStr.Search( ':' ); @@ -323,11 +316,11 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn ) if ( SCA_VALID != (nResult & SCA_VALID) ) { - if ( !aBtnMore.GetState() ) - aBtnMore.SetState( true ); + /*if (!pExpander->get_expanded()) + pExpander->set_expanded(true);*/ ERRORBOX( STR_INVALID_TABREF ); - aEdCopyArea.GrabFocus(); + pEdCopyArea->GrabFocus(); bEditInputOk = false; } } @@ -339,7 +332,7 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn ) if ( SCA_VALID != (nResult & SCA_VALID) ) { ERRORBOX( STR_INVALID_TABREF ); - aEdFilterArea.GrabFocus(); + pEdFilterArea->GrabFocus(); bEditInputOk = false; } } @@ -359,7 +352,7 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn ) ScAddress& rStart = theFilterArea.aStart; ScAddress& rEnd = theFilterArea.aEnd; - if ( aBtnCopyResult.IsChecked() ) + if ( pBtnCopyResult->IsChecked() ) { theOutParam.bInplace = false; theOutParam.nDestTab = theAdrCopy.Tab(); @@ -374,12 +367,12 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn ) theOutParam.nDestRow = 0; } - theOutParam.bHasHeader = aBtnHeader.IsChecked(); + theOutParam.bHasHeader = pBtnHeader->IsChecked(); theOutParam.bByRow = true; - theOutParam.bCaseSens = aBtnCase.IsChecked(); - theOutParam.bRegExp = aBtnRegExp.IsChecked(); - theOutParam.bDuplicate = !aBtnUnique.IsChecked(); - theOutParam.bDestPers = aBtnDestPers.IsChecked(); + theOutParam.bCaseSens = pBtnCase->IsChecked(); + theOutParam.bRegExp = pBtnRegExp->IsChecked(); + theOutParam.bDuplicate = !pBtnUnique->IsChecked(); + theOutParam.bDestPers = pBtnDestPers->IsChecked(); bQueryOk = pDoc->CreateQueryParam( rStart.Col(), @@ -403,10 +396,10 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn ) else { ERRORBOX( STR_INVALID_QUERYAREA ); - aEdFilterArea.GrabFocus(); + pEdFilterArea->GrabFocus(); } } - else if ( pBtn == &aBtnCancel ) + else if ( pBtn == pBtnCancel ) { Close(); } @@ -422,14 +415,14 @@ IMPL_LINK( ScSpecialFilterDlg, TimeOutHdl, Timer*, _pTimer ) if( (_pTimer == pTimer) && IsActive() ) { - if( aEdCopyArea.HasFocus() || aRbCopyArea.HasFocus() ) + if( pEdCopyArea->HasFocus() || pRbCopyArea->HasFocus() ) { - pRefInputEdit = &aEdCopyArea; + pRefInputEdit = pEdCopyArea; bRefInputMode = true; } - else if( aEdFilterArea.HasFocus() || aRbFilterArea.HasFocus() ) + else if( pEdFilterArea->HasFocus() || pRbFilterArea->HasFocus() ) { - pRefInputEdit = &aEdFilterArea; + pRefInputEdit = pEdFilterArea; bRefInputMode = true; } else if( bRefInputMode ) @@ -449,15 +442,15 @@ IMPL_LINK( ScSpecialFilterDlg, TimeOutHdl, Timer*, _pTimer ) IMPL_LINK( ScSpecialFilterDlg, FilterAreaSelHdl, ListBox*, pLb ) { - if ( pLb == &aLbFilterArea ) + if ( pLb == pLbFilterArea ) { String aString; - sal_uInt16 nSelPos = aLbFilterArea.GetSelectEntryPos(); + sal_uInt16 nSelPos = pLbFilterArea->GetSelectEntryPos(); if ( nSelPos > 0 ) - aString = *(String*)aLbFilterArea.GetEntryData( nSelPos ); + aString = *(String*)pLbFilterArea->GetEntryData( nSelPos ); - aEdFilterArea.SetText( aString ); + pEdFilterArea->SetText( aString ); } return 0; @@ -468,7 +461,7 @@ IMPL_LINK( ScSpecialFilterDlg, FilterAreaSelHdl, ListBox*, pLb ) IMPL_LINK( ScSpecialFilterDlg, FilterAreaModHdl, formula::RefEdit*, pEd ) { - if ( pEd == &aEdFilterArea ) + if ( pEd == pEdFilterArea ) { if ( pDoc && pViewData ) { @@ -480,26 +473,25 @@ IMPL_LINK( ScSpecialFilterDlg, FilterAreaModHdl, formula::RefEdit*, pEd ) String* pStr = NULL; sal_Bool bFound = false; sal_uInt16 i = 0; - sal_uInt16 nCount = aLbFilterArea.GetEntryCount(); + sal_uInt16 nCount = pLbFilterArea->GetEntryCount(); for ( i=1; i<nCount && !bFound; i++ ) { - pStr = (String*)aLbFilterArea.GetEntryData( i ); + pStr = (String*)pLbFilterArea->GetEntryData( i ); bFound = (theCurAreaStr == *pStr); } if ( bFound ) - aLbFilterArea.SelectEntryPos( --i ); + pLbFilterArea->SelectEntryPos( --i ); else - aLbFilterArea.SelectEntryPos( 0 ); + pLbFilterArea->SelectEntryPos( 0 ); } } else - aLbFilterArea.SelectEntryPos( 0 ); + pLbFilterArea->SelectEntryPos( 0 ); } return 0; } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx index 698d5176a5ca..023962047503 100644 --- a/sc/source/ui/inc/filtdlg.hxx +++ b/sc/source/ui/inc/filtdlg.hxx @@ -20,9 +20,10 @@ #ifndef SC_FILTDLG_HXX #define SC_FILTDLG_HXX -#include <vcl/morebtn.hxx> #include <vcl/combobox.hxx> #include <vcl/lstbox.hxx> +#include <vcl/layout.hxx> +#include <vcl/morebtn.hxx> #include <svtools/stdctrl.hxx> #include "global.hxx" // -> ScQueryParam #include "address.hxx" @@ -40,6 +41,7 @@ //---------------------------------------------------------------------------- class ScFilterOptionsMgr; +class ScNewFilterOptionsMgr; class ScViewData; class ScDocument; class ScQueryItem; @@ -186,33 +188,30 @@ public: virtual sal_Bool Close(); private: - FixedText aFtFilterArea; - ListBox aLbFilterArea; - formula::RefEdit aEdFilterArea; - formula::RefButton aRbFilterArea; - - FixedLine aFlOptions; - - CheckBox aBtnCase; - CheckBox aBtnRegExp; - CheckBox aBtnHeader; - CheckBox aBtnUnique; - CheckBox aBtnCopyResult; - ListBox aLbCopyArea; - formula::RefEdit aEdCopyArea; - formula::RefButton aRbCopyArea; - CheckBox aBtnDestPers; - FixedText aFtDbAreaLabel; - FixedInfo aFtDbArea; + ListBox* pLbFilterArea; + formula::RefEdit* pEdFilterArea; + formula::RefButton* pRbFilterArea; + + VclExpander* pExpander; + CheckBox* pBtnCase; + CheckBox* pBtnRegExp; + CheckBox* pBtnHeader; + CheckBox* pBtnUnique; + CheckBox* pBtnCopyResult; + ListBox* pLbCopyArea; + formula::RefEdit* pEdCopyArea; + formula::RefButton* pRbCopyArea; + CheckBox* pBtnDestPers; + FixedText* pFtDbAreaLabel; + FixedText* pFtDbArea; const OUString aStrUndefined; const OUString aStrNoName; - OKButton aBtnOk; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - MoreButton aBtnMore; + OKButton* pBtnOk; + CancelButton* pBtnCancel; + HelpButton* pBtnHelp; - ScFilterOptionsMgr* pOptionsMgr; + ScNewFilterOptionsMgr* pOptionsMgr; const sal_uInt16 nWhichQuery; const ScQueryParam theQueryData; diff --git a/sc/source/ui/inc/filter.hrc b/sc/source/ui/inc/filter.hrc index 7f5c908c1e68..bf783c20a634 100644 --- a/sc/source/ui/inc/filter.hrc +++ b/sc/source/ui/inc/filter.hrc @@ -66,12 +66,12 @@ #define LB_OP4 42 // Special filter - +/* #define FT_CRITERIA_AREA 50 #define LB_CRITERIA_AREA 51 #define ED_CRITERIA_AREA 52 #define RB_CRITERIA_AREA 53 - +*/ #define STR_COPY_AREA_TO 5054 #define RID_FILTER_OPERATOR 5055 #define RID_FILTER_FIELDNAME 5056 diff --git a/sc/source/ui/inc/foptmgr.hxx b/sc/source/ui/inc/foptmgr.hxx index d86d4c41c0c6..298727ef358b 100644 --- a/sc/source/ui/inc/foptmgr.hxx +++ b/sc/source/ui/inc/foptmgr.hxx @@ -99,4 +99,80 @@ private: #endif // SC_FOPTMGR_HXX + +#ifndef SC_NEWFOPTMGR_HXX +#define SC_NEWFOPTMGR_HXX + +#include <vcl/fixed.hxx> +#include <vcl/edit.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/button.hxx> +//#include <vcl/layout.hxx> + +//---------------------------------------------------------------------------- + +namespace formula +{ + class RefButton; +} +struct ScQueryParam; +class ScDocument; +class ScViewData; + +//---------------------------------------------------------------------------- + +class ScNewFilterOptionsMgr +{ +public: + ScNewFilterOptionsMgr( ScViewData* ptrViewData, + const ScQueryParam& refQueryData, + CheckBox* refBtnCase, + CheckBox* refBtnRegExp, + CheckBox* refBtnHeader, + CheckBox* refBtnUnique, + CheckBox* refBtnCopyResult, + CheckBox* refBtnDestPers, + ListBox* refLbCopyArea, + Edit* refEdCopyArea, + formula::RefButton* refRbCopyArea, + FixedText* refFtDbAreaLabel, + FixedText* refFtDbArea, + const String& refStrUndefined ); + ~ScNewFilterOptionsMgr(); + +private: + ScViewData* pViewData; + ScDocument* pDoc; + + CheckBox* pBtnCase; + CheckBox* pBtnRegExp; + CheckBox* pBtnHeader; + CheckBox* pBtnUnique; + CheckBox* pBtnCopyResult; + CheckBox* pBtnDestPers; + ListBox* pLbCopyArea; + Edit* pEdCopyArea; + formula::RefButton* pRbCopyArea; + FixedText* pFtDbAreaLabel; + FixedText* pFtDbArea; + + const String& rStrUndefined; + + const ScQueryParam& rQueryData; + +#ifdef _NEWFOPTMGR_CXX +private: + void Init(); + + // Handler: + DECL_LINK( EdAreaModifyHdl, Edit* ); + DECL_LINK( LbAreaSelHdl, ListBox* ); + DECL_LINK( BtnCopyResultHdl, CheckBox* ); +#endif +}; + + +#endif // SC_NEWFOPTMGR_HXX + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/src/filter.src b/sc/source/ui/src/filter.src index 673875cff4e2..1490b09cb1ed 100644 --- a/sc/source/ui/src/filter.src +++ b/sc/source/ui/src/filter.src @@ -438,7 +438,7 @@ ModelessDialog RID_SCDLG_FILTER }; }; //============================================================================ -ModelessDialog RID_SCDLG_SPEC_FILTER +/*ModelessDialog RID_SCDLG_SPEC_FILTER { OutputSize = TRUE ; HelpId = CMD_SID_SPECIAL_FILTER ; @@ -610,7 +610,7 @@ ModelessDialog RID_SCDLG_SPEC_FILTER MapUnit = MAP_APPFONT ; Delta = 32 ; }; -}; +};*/ //============================================================================ ModalDialog RID_SCDLG_PIVOTFILTER { diff --git a/sc/uiconfig/scalc/ui/advancedfilterdialog.ui b/sc/uiconfig/scalc/ui/advancedfilterdialog.ui new file mode 100644 index 000000000000..6202dc3bd2bc --- /dev/null +++ b/sc/uiconfig/scalc/ui/advancedfilterdialog.ui @@ -0,0 +1,443 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <!-- interface-requires LibreOffice 1.0 --> + <object class="GtkDialog" id="AdvancedFilterDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Advanced Filter</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child> + <object class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="column_spacing">12</property> + <child> + <object class="foruilo-RefButton" id="rbfilterarea"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="lbfilterarea"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="width_chars">20</property> + <property name="entry_text_column">0</property> + <property name="id_column">1</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="foruilo-RefEdit" id="edfilterarea"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="width_chars">30</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Read _filter criteria from</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">lbfilterarea</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkExpander" id="more"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="spacing">6</property> + <property name="resize_toplevel">True</property> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <child> + <object class="GtkGrid" id="grid3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkCheckButton" id="case"> + <property name="label" translatable="yes">_Case sensitive</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="header"> + <property name="label" translatable="yes">Range c_ontains column labels</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="regexp"> + <property name="label" translatable="yes">Regular _expressions</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="unique"> + <property name="label" translatable="yes">_No duplications</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="copyresult"> + <property name="label" translatable="yes">Co_py results to:</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <accessibility> + <relation type="label-for" target="lbcopyarea"/> + <relation type="label-for" target="edcopyarea"/> + </accessibility> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="destpers"> + <property name="label" translatable="yes">_Keep filter criteria</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_left">12</property> + <property name="hexpand">True</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkComboBoxText" id="lbcopyarea"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="width_chars">20</property> + <property name="entry_text_column">0</property> + <property name="id_column">1</property> + <accessibility> + <relation type="labelled-by" target="copyresult"/> + </accessibility> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="foruilo-RefEdit" id="edcopyarea"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + <property name="width_chars">30</property> + <accessibility> + <relation type="labelled-by" target="copyresult"/> + </accessibility> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="foruilo-RefButton" id="rbcopyarea"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid5"> + <property name="sensitive">False</property> + <property name="can_focus">False</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkLabel" id="dbarealabel"> + <property name="sensitive">False</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Data range:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="dbarea"> + <property name="sensitive">False</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">dummy</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_underline">True</property> + <property name="label" translatable="yes">Op_tions</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">ok</action-widget> + <action-widget response="0">cancel</action-widget> + <action-widget response="0">help</action-widget> + </action-widgets> + </object> +</interface> |