diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/pivot.hxx | 12 | ||||
-rw-r--r-- | sc/inc/scabstdlg.hxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/pivot2.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/dbgui/filtdlg.cxx | 86 | ||||
-rw-r--r-- | sc/source/ui/dbgui/pvfundlg.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/dbgui/pvlaydlg.cxx | 416 | ||||
-rw-r--r-- | sc/source/ui/inc/filter.hrc | 7 | ||||
-rw-r--r-- | sc/source/ui/inc/pvfundlg.hxx | 8 | ||||
-rw-r--r-- | sc/source/ui/inc/pvlaydlg.hxx | 6 |
11 files changed, 325 insertions, 236 deletions
diff --git a/sc/inc/pivot.hxx b/sc/inc/pivot.hxx index ed69859df546..a71b30629f65 100644 --- a/sc/inc/pivot.hxx +++ b/sc/inc/pivot.hxx @@ -193,26 +193,22 @@ typedef ::std::vector< ScPivotField > ScPivotFieldVector; // ============================================================================ -struct ScPivotFuncData +struct ScDPFuncData { - SCCOL mnCol; + short mnCol; sal_uInt16 mnFuncMask; ::com::sun::star::sheet::DataPilotFieldReference maFieldRef; - explicit ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask ); - explicit ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask, + explicit ScDPFuncData( short nNewCol, sal_uInt16 nNewFuncMask ); + explicit ScDPFuncData( short nNewCol, sal_uInt16 nNewFuncMask, const ::com::sun::star::sheet::DataPilotFieldReference& rFieldRef ); }; -typedef ::std::vector< ScPivotFuncData > ScPivotFuncDataVector; - // ============================================================================ typedef std::vector< ScDPLabelData > ScDPLabelDataVec; typedef std::vector<ScDPName> ScDPNameVec; -// ============================================================================ - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index 6eea3204ab53..bbbe7ce0737b 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -54,7 +54,7 @@ class ScQueryItem; class ScImportOptions; class SfxStyleSheetBase; class ScDPObject; -struct ScPivotFuncData; +struct ScDPFuncData; struct ScDPNumGroupInfo; class ScTabViewShell; @@ -425,12 +425,12 @@ public: virtual AbstractScDPFunctionDlg * CreateScDPFunctionDlg( Window* pParent, int nId, const ScDPLabelDataVector& rLabelVec, const ScDPLabelData& rLabelData, - const ScPivotFuncData& rFuncData ) = 0; + const ScDPFuncData& rFuncData ) = 0; virtual AbstractScDPSubtotalDlg * CreateScDPSubtotalDlg( Window* pParent, int nId, ScDPObject& rDPObj, const ScDPLabelData& rLabelData, - const ScPivotFuncData& rFuncData, + const ScDPFuncData& rFuncData, const ScDPNameVec& rDataFields, bool bEnableLayout ) = 0; diff --git a/sc/source/core/data/pivot2.cxx b/sc/source/core/data/pivot2.cxx index aca819c54065..7ee91d0db9f9 100644 --- a/sc/source/core/data/pivot2.cxx +++ b/sc/source/core/data/pivot2.cxx @@ -148,13 +148,13 @@ bool ScPivotParam::operator==( const ScPivotParam& r ) const // ============================================================================ -ScPivotFuncData::ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask ) : +ScDPFuncData::ScDPFuncData( SCCOL nCol, sal_uInt16 nFuncMask ) : mnCol( nCol ), mnFuncMask( nFuncMask ) { } -ScPivotFuncData::ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask, const DataPilotFieldReference& rFieldRef ) : +ScDPFuncData::ScDPFuncData( SCCOL nCol, sal_uInt16 nFuncMask, const DataPilotFieldReference& rFieldRef ) : mnCol( nCol ), mnFuncMask( nFuncMask ), maFieldRef( rFieldRef ) diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index cbf62f945e36..c501f19e0d68 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -1223,7 +1223,7 @@ AbstractScDPFunctionDlg * ScAbstractDialogFactory_Impl::CreateScDPFunctionDlg ( int nId, const ScDPLabelDataVector& rLabelVec, const ScDPLabelData& rLabelData, - const ScPivotFuncData& rFuncData ) + const ScDPFuncData& rFuncData ) { ScDPFunctionDlg * pDlg=NULL; switch ( nId ) @@ -1246,7 +1246,7 @@ AbstractScDPSubtotalDlg * ScAbstractDialogFactory_Impl::CreateScDPSubtotalDlg ( int nId, ScDPObject& rDPObj, const ScDPLabelData& rLabelData, - const ScPivotFuncData& rFuncData, + const ScDPFuncData& rFuncData, const ScDPNameVec& rDataFields, bool bEnableLayout ) { diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index d1eaf2edbab0..0bf643d0e3e0 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -509,12 +509,12 @@ public: virtual AbstractScDPFunctionDlg * CreateScDPFunctionDlg( Window* pParent, int nId, const ScDPLabelDataVector& rLabelVec, const ScDPLabelData& rLabelData, - const ScPivotFuncData& rFuncData ); + const ScDPFuncData& rFuncData ); virtual AbstractScDPSubtotalDlg * CreateScDPSubtotalDlg( Window* pParent, int nId, ScDPObject& rDPObj, const ScDPLabelData& rLabelData, - const ScPivotFuncData& rFuncData, + const ScDPFuncData& rFuncData, const ScDPNameVec& rDataFields, bool bEnableLayout ); diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 03fd26ffd32e..e05b1a36138a 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -56,6 +56,9 @@ #undef _FILTDLG_CXX #include <vcl/msgbox.hxx> +using ::rtl::OUString; +using ::rtl::OUStringBuffer; + // DEFINE -------------------------------------------------------------------- #define ERRORBOX(rid) ErrorBox( this, WinBits( WB_OK|WB_DEF_OK), \ @@ -134,47 +137,48 @@ ScFilterDlg::ScFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, pTimer->SetTimeout( 50 ); // 50ms warten pTimer->SetTimeoutHdl( LINK( this, ScFilterDlg, TimeOutHdl ) ); - String sAccName (ScResId(RID_FILTER_OPERATOR)); - String sIndexName(sAccName); - sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1")); - aLbConnect1.SetAccessibleName(sIndexName); - sIndexName = sAccName; - sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2")); - aLbConnect2.SetAccessibleName(sIndexName); - - sAccName = String(ScResId(RID_FILTER_FIELDNAME)); - sIndexName = sAccName; - sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1")); - aLbField1.SetAccessibleName(sIndexName); - sIndexName = sAccName; - sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2")); - aLbField2.SetAccessibleName(sIndexName); - sIndexName = sAccName; - sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3")); - aLbField3.SetAccessibleName(sIndexName); - - - sAccName = String(ScResId(RID_FILTER_CONDITION)); - sIndexName = sAccName; - sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1")); - aLbCond1.SetAccessibleName(sIndexName); - sIndexName = sAccName; - sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2")); - aLbCond2.SetAccessibleName(sIndexName); - sIndexName = sAccName; - sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3")); - aLbCond3.SetAccessibleName(sIndexName); - - sAccName = String(ScResId(RID_FILTER_VALUE)); - sIndexName = sAccName; - sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1")); - aEdVal1.SetAccessibleName(sIndexName); - sIndexName = sAccName; - sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2")); - aEdVal2.SetAccessibleName(sIndexName); - sIndexName = sAccName; - sIndexName.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3")); - aEdVal3.SetAccessibleName(sIndexName); + OUStringBuffer aBuf; + + OUString sAccName = ResId::toString(ScResId(RID_FILTER_OPERATOR)); + aBuf.append(sAccName); + aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM (" 1")); + aLbConnect1.SetAccessibleName(aBuf.makeStringAndClear()); + aBuf.append(sAccName); + aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM (" 2")); + aLbConnect2.SetAccessibleName(aBuf.makeStringAndClear()); + + sAccName = ResId::toString(ScResId(RID_FILTER_FIELDNAME)); + aBuf.append(sAccName); + aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM (" 1")); + aLbField1.SetAccessibleName(aBuf.makeStringAndClear()); + aBuf.append(sAccName); + aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM (" 2")); + aLbField2.SetAccessibleName(aBuf.makeStringAndClear()); + aBuf.append(sAccName); + aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM (" 3")); + aLbField3.SetAccessibleName(aBuf.makeStringAndClear()); + + sAccName = ResId::toString(ScResId(RID_FILTER_CONDITION)); + aBuf.append(sAccName); + aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM (" 1")); + aLbCond1.SetAccessibleName(aBuf.makeStringAndClear()); + aBuf.append(sAccName); + aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM (" 2")); + aLbCond2.SetAccessibleName(aBuf.makeStringAndClear()); + aBuf.append(sAccName); + aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM (" 3")); + aLbCond3.SetAccessibleName(aBuf.makeStringAndClear()); + + sAccName = ResId::toString(ScResId(RID_FILTER_VALUE)); + aBuf.append(sAccName); + aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM (" 1")); + aEdVal1.SetAccessibleName(aBuf.makeStringAndClear()); + aBuf.append(sAccName); + aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM (" 2")); + aEdVal2.SetAccessibleName(aBuf.makeStringAndClear()); + aBuf.append(sAccName); + aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM (" 3")); + aEdVal3.SetAccessibleName(aBuf.makeStringAndClear()); aLbCopyArea.SetAccessibleName(ScResId(STR_COPY_AREA_TO)); aEdCopyArea.SetAccessibleName(ScResId(STR_COPY_AREA_TO)); diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx index 403ae802fc1e..8c526b1c5300 100644 --- a/sc/source/ui/dbgui/pvfundlg.cxx +++ b/sc/source/ui/dbgui/pvfundlg.cxx @@ -203,7 +203,7 @@ void ScDPFunctionListBox::FillFunctionNames() ScDPFunctionDlg::ScDPFunctionDlg( Window* pParent, const ScDPLabelDataVector& rLabelVec, - const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ) : + const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData ) : ModalDialog ( pParent, ScResId( RID_SCDLG_DPDATAFIELD ) ), maFlFunc ( this, ScResId( FL_FUNC ) ), maLbFunc ( this, ScResId( LB_FUNC ) ), @@ -260,7 +260,7 @@ DataPilotFieldReference ScDPFunctionDlg::GetFieldRef() const return aRef; } -void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ) +void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData ) { // list box sal_uInt16 nFuncMask = (rFuncData.mnFuncMask == PIVOT_FUNC_NONE) ? PIVOT_FUNC_SUM : rFuncData.mnFuncMask; @@ -432,7 +432,7 @@ IMPL_LINK( ScDPFunctionDlg, DblClickHdl, MultiListBox*, EMPTYARG ) // ============================================================================ ScDPSubtotalDlg::ScDPSubtotalDlg( Window* pParent, ScDPObject& rDPObj, - const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData, + const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData, const ScDPNameVec& rDataFields, bool bEnableLayout ) : ModalDialog ( pParent, ScResId( RID_SCDLG_PIVOTSUBT ) ), maFlSubt ( this, ScResId( FL_FUNC ) ), @@ -479,7 +479,7 @@ void ScDPSubtotalDlg::FillLabelData( ScDPLabelData& rLabelData ) const rLabelData.maShowInfo = maLabelData.maShowInfo; } -void ScDPSubtotalDlg::Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ) +void ScDPSubtotalDlg::Init( const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData ) { // field name maFtName.SetText(rLabelData.getDisplayName()); diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx index e805ecff55db..89c1eeb396c0 100644 --- a/sc/source/ui/dbgui/pvlaydlg.cxx +++ b/sc/source/ui/dbgui/pvlaydlg.cxx @@ -41,11 +41,6 @@ #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp> #include <com/sun/star/sheet/DataPilotFieldSortMode.hpp> -#include <sfx2/dispatch.hxx> -#include <vcl/mnemonic.hxx> -#include <vcl/msgbox.hxx> - -#include "dbdocfun.hxx" #include "uiitems.hxx" #include "rangeutl.hxx" #include "document.hxx" @@ -80,7 +75,15 @@ namespace { PointerStyle lclGetPointerForField( ScDPFieldType eType ) { - return MnemonicGenerator::EraseAllMnemonicChars( rFixedText.GetText() ); + switch( eType ) + { + case TYPE_PAGE: return POINTER_PIVOT_FIELD; + case TYPE_COL: return POINTER_PIVOT_COL; + case TYPE_ROW: return POINTER_PIVOT_ROW; + case TYPE_DATA: return POINTER_PIVOT_FIELD; + case TYPE_SELECT: return POINTER_PIVOT_FIELD; + } + return POINTER_ARROW; } } // namespace @@ -146,7 +149,7 @@ ScDPLayoutDlg::ScDPLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pPar bRefInputMode (false) { xDlgDPObject->SetAlive( true ); // needed to get structure information - xDlgDPObject->FillOldParam( thePivotData, false ); + xDlgDPObject->FillOldParam( thePivotData ); xDlgDPObject->FillLabelData( thePivotData ); Init(bNewOutput); @@ -215,17 +218,12 @@ void ScDPLayoutDlg::Init(bool bNewOutput) } else { - // data is not reachable, so could be a remote database - maEdInPos.Disable(); - maRbInPos.Disable(); + /* Data is not reachable, so could be a remote database */ + aEdInPos.Disable(); + aRbInPos.Disable(); } - // #i29203# align right border of page window with data window - long nPagePosX = maWndData.GetPosPixel().X() + maWndData.GetSizePixel().Width() - maWndPage.GetSizePixel().Width(); - maWndPage.SetPosPixel( Point( nPagePosX, maWndPage.GetPosPixel().Y() ) ); - maScrPage.SetPosPixel( Point( maScrData.GetPosPixel().X(), maScrPage.GetPosPixel().Y() ) ); - - InitFieldWindows(); + InitFields(); aLbOutPos .SetSelectHdl( LINK( this, ScDPLayoutDlg, SelAreaHdl ) ); aEdOutPos .SetModifyHdl( LINK( this, ScDPLayoutDlg, EdModifyHdl ) ); @@ -238,7 +236,7 @@ void ScDPLayoutDlg::Init(bool bNewOutput) aEdInPos.SetGetFocusHdl( aLink ); aEdOutPos.SetGetFocusHdl( aLink ); - if( mpViewData && mpDoc ) + if ( pViewData && pDoc ) { /* * Aus den RangeNames des Dokumentes werden nun die @@ -246,11 +244,11 @@ void ScDPLayoutDlg::Init(bool bNewOutput) * um sinnvolle Bereiche handelt */ - maLbOutPos.Clear(); - maLbOutPos.InsertEntry( String( ScResId( SCSTR_UNDEFINED ) ), 0 ); - maLbOutPos.InsertEntry( String( ScResId( SCSTR_NEWTABLE ) ), 1 ); + aLbOutPos.Clear(); + aLbOutPos.InsertEntry( aStrUndefined, 0 ); + aLbOutPos.InsertEntry( aStrNewTable, 1 ); - ScAreaNameIterator aIter( mpDoc ); + ScAreaNameIterator aIter( pDoc ); String aName; ScRange aRange; String aRefStr; @@ -258,10 +256,10 @@ void ScDPLayoutDlg::Init(bool bNewOutput) { if ( !aIter.WasDBName() ) // hier keine DB-Bereiche ! { - sal_uInt16 nInsert = maLbOutPos.InsertEntry( aName ); + sal_uInt16 nInsert = aLbOutPos.InsertEntry( aName ); - aRange.aStart.Format( aRefStr, SCA_ABS_3D, mpDoc, mpDoc->GetAddressConvention() ); - maLbOutPos.SetEntryData( nInsert, new String( aRefStr ) ); + aRange.aStart.Format( aRefStr, SCA_ABS_3D, pDoc, pDoc->GetAddressConvention() ); + aLbOutPos.SetEntryData( nInsert, new String( aRefStr ) ); } } } @@ -325,7 +323,9 @@ sal_Bool ScDPLayoutDlg::Close() return DoClose( ScPivotLayoutWrapper::GetChildWindowId() ); } -ScPivotLayoutDlg::~ScPivotLayoutDlg() +//---------------------------------------------------------------------------- + +void ScDPLayoutDlg::StateChanged( StateChangedType nStateChange ) { ScAnyRefDlg::StateChanged( nStateChange ); @@ -344,7 +344,9 @@ ScPivotLayoutDlg::~ScPivotLayoutDlg() } } -ScDPLabelData* ScPivotLayoutDlg::GetLabelData( SCCOL nCol, size_t* pnIndex ) +//---------------------------------------------------------------------------- + +void ScDPLayoutDlg::InitWndSelect( const vector<ScDPLabelDataRef>& rLabels ) { size_t nLabelCount = rLabels.size(); if (nLabelCount > MAX_LABELS) @@ -412,16 +414,18 @@ void ScDPLayoutDlg::InitFieldWindow( const vector<PivotField>& rFields, ScDPFiel //---------------------------------------------------------------------------- -void ScPivotLayoutDlg::NotifyStartTracking( ScPivotFieldWindow& rSourceWindow ) +void ScDPLayoutDlg::InitFocus() { - mpTrackingWindow = &rSourceWindow; - mpDropWindow = 0; - rSourceWindow.NotifyStartTracking(); - StartTracking( STARTTRACK_BUTTONREPEAT ); - SetPointer( Pointer( rSourceWindow.GetDropPointerStyle() ) ); + if( aWndSelect.IsEmpty() ) + { + aBtnOk.GrabFocus(); + NotifyFieldFocus( TYPE_SELECT, false ); + } + else + aWndSelect.GrabFocus(); } -void ScPivotLayoutDlg::NotifyDoubleClick( ScPivotFieldWindow& rSourceWindow ) +void ScDPLayoutDlg::InitFields() { InitWndSelect(thePivotData.maLabelArray); InitFieldWindow(thePivotData.maPageFields, TYPE_PAGE); @@ -430,10 +434,7 @@ void ScPivotLayoutDlg::NotifyDoubleClick( ScPivotFieldWindow& rSourceWindow ) InitFieldWindow(thePivotData.maDataFields, TYPE_DATA); } - ScDPLabelData* pLabelData = GetLabelData( pFuncData->mnCol ); - DBG_ASSERT( pLabelData, "ScPivotLayoutDlg::NotifyDoubleClick - missing label data" ); - if( !pLabelData ) - return; +//---------------------------------------------------------------------------- void ScDPLayoutDlg::AddField( size_t nFromIndex, ScDPFieldType eToType, const Point& rAtPos ) { @@ -454,15 +455,38 @@ void ScDPLayoutDlg::AddField( size_t nFromIndex, ScDPFieldType eToType, const Po bool bAllowed = IsOrientationAllowed( fData.mnCol, eToType ); if ( bAllowed && (!Contains( toArr, fData.mnCol, nAt )) ) { - // list of plain names of all data fields - ScDPNameVec aDataFieldNames; - maWndData.WriteFieldNames( aDataFieldNames ); - // allow to modify layout options for row fields, if multiple data fields exist, or if it is not the last row field - bool bLayout = (rSourceWindow.GetType() == PIVOTFIELDTYPE_ROW) && ((aDataFieldNames.size() > 1) || (rSourceWindow.GetSelectedIndex() + 1 < rSourceWindow.GetFieldCount())); - - ::std::auto_ptr< AbstractScDPSubtotalDlg > xDlg( pFactory->CreateScDPSubtotalDlg( - this, RID_SCDLG_PIVOTSUBT, *mxDlgDPObject, *pLabelData, *pFuncData, aDataFieldNames, bLayout ) ); - if( xDlg->Execute() == RET_OK ) + // ggF. in anderem Fenster entfernen + if ( rmArr1 ) + { + if ( Contains( rmArr1, fData.mnCol, nAt ) ) + { + rmWnd1->DelField( nAt ); + Remove( rmArr1, nAt ); + } + } + if ( rmArr2 ) + { + if ( Contains( rmArr2, fData.mnCol, nAt ) ) + { + rmWnd2->DelField( nAt ); + Remove( rmArr2, nAt ); + } + } + + ScDPLabelData& rData = aLabelDataArr[nFromIndex+nOffset]; + size_t nAddedAt = 0; + + if ( !bDataArr ) + { + if ( toWnd->AddField( rData.getDisplayName(), + DlgPos2WndPos( rAtPos, *toWnd ), + nAddedAt ) ) + { + Insert( toArr, fData, nAddedAt ); + toWnd->GrabFocus(); + } + } + else { ScDPLabelData* p = GetLabelData(fData.mnCol); OUString aStr = p->maLayoutName; @@ -482,6 +506,7 @@ void ScDPLayoutDlg::AddField( size_t nFromIndex, ScDPFieldType eToType, const Po toWnd->GrabFocus(); } } + } } @@ -644,11 +669,7 @@ void ScDPLayoutDlg::MoveField( ScDPFieldType eFromType, size_t nFromIndex, ScDPF } } } - if( mpDropWindow ) - mpDropWindow->NotifyTracking( rDialogPos - pTargetWindow->GetPosPixel() ); - - // end tracking: move or remove field - if( rTEvt.IsTrackingEnded() ) + else // -> eFromType == eToType { ScDPFieldControlBase* theWnd = GetFieldWindow(eFromType); ScDPFuncDataVec* theArr = GetFieldDataArray(eFromType); @@ -835,15 +856,12 @@ void ScDPLayoutDlg::MoveFieldToEnd( ScDPFieldType eFromType, size_t nFromIndex, } } } - eTargetPointer = POINTER_ARROW; - if( mpTrackingWindow != mpDropWindow ) - mpTrackingWindow->NotifyEndTracking( ENDTRACKING_CANCEL ); - mpTrackingWindow = mpDropWindow = 0; } - SetPointer( eTargetPointer ); } -void ScPivotLayoutDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) +//---------------------------------------------------------------------------- + +void ScDPLayoutDlg::RemoveField( ScDPFieldType eFromType, size_t nIndex ) { ScDPFuncDataVec* pArr = GetFieldDataArray(eFromType); @@ -859,7 +877,9 @@ void ScPivotLayoutDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) } } -sal_Bool ScPivotLayoutDlg::IsRefInputMode() const +//---------------------------------------------------------------------------- + +void ScDPLayoutDlg::NotifyMouseButtonUp( const Point& rAt ) { if ( bIsDrag ) { @@ -907,29 +927,59 @@ sal_Bool ScPivotLayoutDlg::IsRefInputMode() const PointerStyle ScDPLayoutDlg::NotifyMouseMove( const Point& rAt ) { - if( mbRefInputMode ) - { - if( mpActiveEdit ) - mpActiveEdit->GrabFocus(); + PointerStyle ePtr = POINTER_ARROW; - if( mpActiveEdit == &maEdInPos ) - EdInModifyHdl( 0 ); - else if( mpActiveEdit == &maEdOutPos ) - EdOutModifyHdl( 0 ); - } - else + if ( bIsDrag ) { - GrabFocus(); + Point aPos = ScreenToOutputPixel( rAt ); + ScDPFieldType eCheckTarget = TYPE_SELECT; + + if ( aRectPage.IsInside( aPos ) ) + eCheckTarget = TYPE_PAGE; + else if ( aRectCol.IsInside( aPos ) ) + eCheckTarget = TYPE_COL; + else if ( aRectRow.IsInside( aPos ) ) + eCheckTarget = TYPE_ROW; + else if ( aRectData.IsInside( aPos ) ) + eCheckTarget = TYPE_DATA; + else if ( eDnDFromType != TYPE_SELECT ) + ePtr = POINTER_PIVOT_DELETE; + else if ( aRectSelect.IsInside( aPos ) ) + ePtr = lclGetPointerForField( TYPE_SELECT ); + else + ePtr = POINTER_NOTALLOWED; + + if ( eCheckTarget != TYPE_SELECT ) + { + // check if the target orientation is allowed for this field + ScDPFuncDataVec* fromArr = NULL; + switch ( eDnDFromType ) + { + case TYPE_PAGE: fromArr = &aPageArr; break; + case TYPE_COL: fromArr = &aColArr; break; + case TYPE_ROW: fromArr = &aRowArr; break; + case TYPE_DATA: fromArr = &aDataArr; break; + case TYPE_SELECT: fromArr = &aSelectArr; break; + } + ScDPFuncData fData( *((*fromArr)[nDnDFromIndex]) ); + if (IsOrientationAllowed( fData.mnCol, eCheckTarget )) + ePtr = lclGetPointerForField( eCheckTarget ); + else + ePtr = POINTER_NOTALLOWED; + } } - RefInputDone(); + return ePtr; } //---------------------------------------------------------------------------- PointerStyle ScDPLayoutDlg::NotifyMouseButtonDown( ScDPFieldType eType, size_t nFieldIndex ) { - return DoClose( ScPivotLayoutWrapper::GetChildWindowId() ); + bIsDrag = true; + eDnDFromType = eType; + nDnDFromIndex = nFieldIndex; + return lclGetPointerForField( eType ); } //---------------------------------------------------------------------------- @@ -938,14 +988,9 @@ void ScDPLayoutDlg::NotifyDoubleClick( ScDPFieldType eType, size_t nFieldIndex ) { ScDPFuncDataVec* pArr = GetFieldDataArray(eType); -bool ScPivotLayoutDlg::IsInsertAllowed( const ScPivotFieldWindow& rSourceWindow, const ScPivotFieldWindow& rTargetWindow ) -{ - if( rTargetWindow.GetType() != PIVOTFIELDTYPE_SELECT ) + if ( pArr ) { - const ScPivotFuncData* pSourceData = rSourceWindow.GetSelectedFuncData(); - ScDPLabelData* pLabelData = pSourceData ? GetLabelData( pSourceData->mnCol ) : 0; - DBG_ASSERT( pLabelData, "ScPivotLayoutDlg::IsInsertAllowed - label data not found" ); - if( pLabelData ) + if ( nFieldIndex >= pArr->size() ) { OSL_FAIL("invalid selection"); return; @@ -1032,13 +1077,13 @@ bool ScPivotLayoutDlg::IsInsertAllowed( const ScPivotFieldWindow& rSourceWindow, // added to avoid warnings } } - return ScDPObject::IsOrientationAllowed( static_cast< sal_uInt16 >( eOrient ), pLabelData->mnFlags ); } } - return false; } -void ScPivotLayoutDlg::InitFieldWindows() +//---------------------------------------------------------------------------- + +void ScDPLayoutDlg::NotifyFieldFocus( ScDPFieldType eType, sal_Bool bGotFocus ) { /* Enable Remove/Options buttons on GetFocus in field window. Enable them also, if dialog is deactivated (click into document). @@ -1076,7 +1121,15 @@ void ScDPLayoutDlg::NotifyMoveFieldToEnd( ScDPFieldType eToType ) aWndSelect.SelectNext(); } else - rFieldWindow.GrabFocus(); + InitFocus(); +} + +//---------------------------------------------------------------------------- + +void ScDPLayoutDlg::NotifyRemoveField( ScDPFieldType eType, size_t nFieldIndex ) +{ + if( eType != TYPE_SELECT ) + RemoveField( eType, nFieldIndex ); } void ScDPLayoutDlg::Deactivate() @@ -1090,7 +1143,7 @@ void ScDPLayoutDlg::Deactivate() //---------------------------------------------------------------------------- -bool ScPivotLayoutDlg::MoveField( ScPivotFieldWindow& rSourceWindow, ScPivotFieldWindow& rTargetWindow, size_t nInsertIndex, bool bMoveExisting ) +sal_Bool ScDPLayoutDlg::Contains( ScDPFuncDataVec* pArr, SCsCOL nCol, size_t& nAt ) { if (!pArr || pArr->empty()) return false; @@ -1134,40 +1187,72 @@ void ScDPLayoutDlg::Insert( ScDPFuncDataVec* pArr, const ScDPFuncData& rFData, s //---------------------------------------------------------------------------- - return true; +ScDPLabelData* ScDPLayoutDlg::GetLabelData( SCsCOL nCol, size_t* pnPos ) +{ + ScDPLabelData* pData = 0; + for( ScDPLabelDataVec::iterator aIt = aLabelDataArr.begin(), aEnd = aLabelDataArr.end(); !pData && (aIt != aEnd); ++aIt ) + { + if( aIt->mnCol == nCol ) + { + pData = &*aIt; + if( pnPos ) *pnPos = aIt - aLabelDataArr.begin(); + } } return pData; } //---------------------------------------------------------------------------- - return false; +String ScDPLayoutDlg::GetLabelString( SCsCOL nCol ) +{ + ScDPLabelData* pData = GetLabelData( nCol ); + DBG_ASSERT( pData, "LabelData not found" ); + if (pData) + return pData->getDisplayName(); + return String(); +} + +//---------------------------------------------------------------------------- + +bool ScDPLayoutDlg::IsOrientationAllowed( SCsCOL nCol, ScDPFieldType eType ) +{ + bool bAllowed = true; + ScDPLabelData* pData = GetLabelData( nCol ); + DBG_ASSERT( pData, "LabelData not found" ); + if (pData) + { + sheet::DataPilotFieldOrientation eOrient = sheet::DataPilotFieldOrientation_HIDDEN; + switch (eType) + { + case TYPE_PAGE: eOrient = sheet::DataPilotFieldOrientation_PAGE; break; + case TYPE_COL: eOrient = sheet::DataPilotFieldOrientation_COLUMN; break; + case TYPE_ROW: eOrient = sheet::DataPilotFieldOrientation_ROW; break; + case TYPE_DATA: eOrient = sheet::DataPilotFieldOrientation_DATA; break; + case TYPE_SELECT: eOrient = sheet::DataPilotFieldOrientation_HIDDEN; break; + } + bAllowed = ScDPObject::IsOrientationAllowed( (sal_uInt16)eOrient, pData->mnFlags ); + } + return bAllowed; } -// handlers ------------------------------------------------------------------- +//---------------------------------------------------------------------------- -IMPL_LINK( ScPivotLayoutDlg, ClickHdl, PushButton *, pBtn ) +String ScDPLayoutDlg::GetFuncString( sal_uInt16& rFuncMask, sal_Bool bIsValue ) { - if( mpFocusWindow ) + String aStr; + + if ( rFuncMask == PIVOT_FUNC_NONE + || rFuncMask == PIVOT_FUNC_AUTO ) { - /* Raising sub dialogs (from the NotifyDoubleClick function) triggers - VCL child window focus events from this sub dialog which may - invalidate the member mpFocusWindow pointing to the target field - window. This would cause a crash with the following call to the - GrabFieldFocus function, if mpFocusWindow is used directly. */ - ScPivotFieldWindow& rTargetWindow = *mpFocusWindow; - - if( pBtn == &maBtnRemove ) + if ( bIsValue ) { - rTargetWindow.RemoveSelectedField(); - // focus back to field window - GrabFieldFocus( rTargetWindow ); + aStr = FSTR(PIVOTSTR_SUM); + rFuncMask = PIVOT_FUNC_SUM; } - else if( pBtn == &maBtnOptions ) + else { - NotifyDoubleClick( rTargetWindow ); - // focus back to field window - GrabFieldFocus( rTargetWindow ); + aStr = FSTR(PIVOTSTR_COUNT); + rFuncMask = PIVOT_FUNC_COUNT; } } else if ( rFuncMask == PIVOT_FUNC_SUM ) aStr = FSTR(PIVOTSTR_SUM); @@ -1297,7 +1382,7 @@ bool ScDPLayoutDlg::GetPivotArrays( return true; } -IMPL_LINK( ScPivotLayoutDlg, OkHdl, OKButton *, EMPTYARG ) +void ScDPLayoutDlg::UpdateSrcRange() { String aSrcStr = aEdInPos.GetText(); sal_uInt16 nResult = ScRange().Parse(aSrcStr, pDoc, pDoc->GetAddressConvention()); @@ -1365,7 +1450,7 @@ IMPL_LINK( ScPivotLayoutDlg, OkHdl, OKButton *, EMPTYARG ) } xDlgDPObject->SetSheetDesc(inSheet); - xDlgDPObject->FillOldParam( thePivotData, false ); + xDlgDPObject->FillOldParam( thePivotData ); xDlgDPObject->FillLabelData(thePivotData); aLabelDataArr.clear(); @@ -1483,17 +1568,27 @@ void ScDPLayoutDlg::GetOtherDataArrays( //---------------------------------------------------------------------------- - ScDPSaveData* pOldSaveData = mxDlgDPObject->GetSaveData(); +void ScDPLayoutDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) +{ + if ( !bRefInputMode || !pEditActive ) + return; - ScRange aOutRange( aAdrDest ); // bToNewTable is passed separately + if ( rRef.aStart != rRef.aEnd ) + RefInputStart( pEditActive ); - ScDPSaveData aSaveData; - aSaveData.SetIgnoreEmptyRows( maBtnIgnEmptyRows.IsChecked() ); - aSaveData.SetRepeatIfEmpty( maBtnDetectCat.IsChecked() ); - aSaveData.SetColumnGrand( maBtnTotalCol.IsChecked() ); - aSaveData.SetRowGrand( maBtnTotalRow.IsChecked() ); - aSaveData.SetFilterButton( maBtnFilter.IsChecked() ); - aSaveData.SetDrillDown( maBtnDrillDown.IsChecked() ); + if ( pEditActive == &aEdInPos ) + { + String aRefStr; + rRef.Format( aRefStr, SCR_ABS_3D, pDocP, pDocP->GetAddressConvention() ); + pEditActive->SetRefString( aRefStr ); + } + else if ( pEditActive == &aEdOutPos ) + { + String aRefStr; + rRef.aStart.Format( aRefStr, STD_FORMAT, pDocP, pDocP->GetAddressConvention() ); + pEditActive->SetRefString( aRefStr ); + } +} //---------------------------------------------------------------------------- @@ -1625,7 +1720,6 @@ IMPL_LINK( ScDPLayoutDlg, OkHdl, OKButton *, EMPTYARG ) pDim->SetSubtotalName(*pSubtotalName); } } - } bool bManualSort = ( aIt->maSortInfo.Mode == sheet::DataPilotFieldSortMode::MANUAL ); @@ -1717,25 +1811,29 @@ IMPL_LINK( ScDPLayoutDlg, CancelHdl, CancelButton *, EMPTYARG ) IMPL_LINK( ScDPLayoutDlg, MoreClickHdl, MoreButton *, EMPTYARG ) { - if ( maBtnMore.GetState() ) + if ( aBtnMore.GetState() ) { - mbRefInputMode = true; - if ( maEdInPos.IsEnabled() ) + bRefInputMode = true; + //@BugID 54702 Enablen/Disablen nur noch in Basisklasse + //SFX_APPWINDOW->Enable(); + if ( aEdInPos.IsEnabled() ) { - maEdInPos.Enable(); - maEdInPos.GrabFocus(); - maEdInPos.Enable(); + aEdInPos.Enable(); + aEdInPos.GrabFocus(); + aEdInPos.Enable(); } else { - maEdOutPos.Enable(); - maEdOutPos.GrabFocus(); - maEdOutPos.Enable(); + aEdOutPos.Enable(); + aEdOutPos.GrabFocus(); + aEdOutPos.Enable(); } } else { - mbRefInputMode = false; + bRefInputMode = false; + //@BugID 54702 Enablen/Disablen nur noch in Basisklasse + //SFX_APPWINDOW->Disable(false); //! allgemeine Methode im ScAnyRefDlg } return 0; } @@ -1744,73 +1842,59 @@ IMPL_LINK( ScDPLayoutDlg, MoreClickHdl, MoreButton *, EMPTYARG ) IMPL_LINK( ScDPLayoutDlg, EdModifyHdl, Edit *, EMPTYARG ) { - String theCurPosStr = maEdOutPos.GetText(); - sal_uInt16 nResult = ScAddress().Parse( theCurPosStr, mpDoc, mpDoc->GetAddressConvention() ); + String theCurPosStr = aEdOutPos.GetText(); + sal_uInt16 nResult = ScAddress().Parse( theCurPosStr, pDoc, pDoc->GetAddressConvention() ); if ( SCA_VALID == (nResult & SCA_VALID) ) { - String* pStr = 0; - bool bFound = false; - sal_uInt16 i = 0; - sal_uInt16 nCount = maLbOutPos.GetEntryCount(); + String* pStr = NULL; + sal_Bool bFound = false; + sal_uInt16 i = 0; + sal_uInt16 nCount = aLbOutPos.GetEntryCount(); for ( i=2; i<nCount && !bFound; i++ ) { - pStr = (String*)maLbOutPos.GetEntryData( i ); + pStr = (String*)aLbOutPos.GetEntryData( i ); bFound = (theCurPosStr == *pStr); } if ( bFound ) - maLbOutPos.SelectEntryPos( --i ); + aLbOutPos.SelectEntryPos( --i ); else - maLbOutPos.SelectEntryPos( 0 ); + aLbOutPos.SelectEntryPos( 0 ); } return 0; } IMPL_LINK( ScDPLayoutDlg, EdInModifyHdl, Edit *, EMPTYARG ) { - String theCurPosStr = maEdInPos.GetText(); - sal_uInt16 nResult = ScRange().Parse( theCurPosStr, mpDoc, mpDoc->GetAddressConvention() ); - -//---------------------------------------------------------------------------- - - // new range is identical to the current range - if( inSheet.aSourceRange == aNewRange ) - return 0; - - ScTabViewShell* pTabViewShell = mpViewData->GetViewShell(); - inSheet.aSourceRange = aNewRange; - mxDlgDPObject->SetSheetDesc( inSheet ); - mxDlgDPObject->FillOldParam( maPivotData ); - mxDlgDPObject->FillLabelData( maPivotData ); - - // SetDialogDPObject does not take ownership but makes a copy internally - pTabViewShell->SetDialogDPObject( mxDlgDPObject.get() ); - - // re-initialize the field windows from the new data - InitFieldWindows(); - + UpdateSrcRange(); return 0; } -IMPL_LINK( ScPivotLayoutDlg, SelAreaHdl, ListBox *, EMPTYARG ) +//---------------------------------------------------------------------------- + +IMPL_LINK( ScDPLayoutDlg, SelAreaHdl, ListBox *, EMPTYARG ) { - String aString; - sal_uInt16 nSelPos = maLbOutPos.GetSelectEntryPos(); - if( nSelPos > 1 ) + String aString; + sal_uInt16 nSelPos = aLbOutPos.GetSelectEntryPos(); + + if ( nSelPos > 1 ) + { + aString = *(String*)aLbOutPos.GetEntryData( nSelPos ); + } + else if ( nSelPos == aLbOutPos.GetEntryCount()-1 ) // auf neue Tabelle? { - aString = *(String*)maLbOutPos.GetEntryData( nSelPos ); + aEdOutPos.Disable(); + aRbOutPos.Disable(); } else { - // do not allow to specify output position, if target is "new sheet" - bool bNewSheet = nSelPos == 1; - maEdOutPos.Enable( !bNewSheet ); - maRbOutPos.Enable( !bNewSheet ); + aEdOutPos.Enable(); + aRbOutPos.Enable(); } - maEdOutPos.SetText( aString ); + aEdOutPos.SetText( aString ); return 0; } @@ -1822,8 +1906,6 @@ IMPL_LINK( ScDPLayoutDlg, GetFocusHdl, Control*, pCtrl ) else if ( pCtrl == &aEdOutPos ) pEditActive = &aEdOutPos; - mpActiveEdit = dynamic_cast< ::formula::RefEdit* >( pEvent->GetWindow() ); - } return 0; } diff --git a/sc/source/ui/inc/filter.hrc b/sc/source/ui/inc/filter.hrc index d973bb15180b..62a299c3240e 100644 --- a/sc/source/ui/inc/filter.hrc +++ b/sc/source/ui/inc/filter.hrc @@ -79,3 +79,10 @@ #define LB_CRITERIA_AREA 51 #define ED_CRITERIA_AREA 52 #define RB_CRITERIA_AREA 53 + +// IAccessibility2 Implementation +#define STR_COPY_AREA_TO 5054 +#define RID_FILTER_OPERATOR 5055 +#define RID_FILTER_FIELDNAME 5056 +#define RID_FILTER_CONDITION 5057 +#define RID_FILTER_VALUE 5058 diff --git a/sc/source/ui/inc/pvfundlg.hxx b/sc/source/ui/inc/pvfundlg.hxx index b41293779b75..c017bd88586a 100644 --- a/sc/source/ui/inc/pvfundlg.hxx +++ b/sc/source/ui/inc/pvfundlg.hxx @@ -72,13 +72,13 @@ class ScDPFunctionDlg : public ModalDialog typedef ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > NameMapType; public: explicit ScDPFunctionDlg( Window* pParent, const ScDPLabelDataVector& rLabelVec, - const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ); + const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData ); sal_uInt16 GetFuncMask() const; ::com::sun::star::sheet::DataPilotFieldReference GetFieldRef() const; private: - void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ); + void Init( const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData ); const ::rtl::OUString& GetBaseFieldName(const ::rtl::OUString& rLayoutName) const; const ::rtl::OUString& GetBaseItemName(const ::rtl::OUString& rLayoutName) const; @@ -121,7 +121,7 @@ class ScDPSubtotalDlg : public ModalDialog { public: explicit ScDPSubtotalDlg( Window* pParent, ScDPObject& rDPObj, - const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData, + const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData, const ScDPNameVec& rDataFields, bool bEnableLayout ); sal_uInt16 GetFuncMask() const; @@ -129,7 +129,7 @@ public: void FillLabelData( ScDPLabelData& rLabelData ) const; private: - void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ); + void Init( const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData ); DECL_LINK( DblClickHdl, MultiListBox* ); DECL_LINK( RadioClickHdl, RadioButton* ); diff --git a/sc/source/ui/inc/pvlaydlg.hxx b/sc/source/ui/inc/pvlaydlg.hxx index 72e3bdff90f6..19176e7fdc61 100644 --- a/sc/source/ui/inc/pvlaydlg.hxx +++ b/sc/source/ui/inc/pvlaydlg.hxx @@ -91,9 +91,9 @@ public: virtual ~ScDPLayoutDlg(); virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ); - virtual sal_Bool IsRefInputMode() const { return bRefInputMode; } + virtual sal_Bool IsRefInputMode() const { return bRefInputMode; } virtual void SetActive(); - virtual sal_Bool Close(); + virtual sal_Bool Close(); virtual void StateChanged( StateChangedType nStateChange ); void NotifyDoubleClick ( ScDPFieldType eType, size_t nFieldIndex ); @@ -199,7 +199,7 @@ private: String GetLabelString ( SCsCOL nCol ); bool IsOrientationAllowed( SCsCOL nCol, ScDPFieldType eType ); String GetFuncString ( sal_uInt16& rFuncMask, sal_Bool bIsValue = true ); - sal_Bool Contains ( ScDPFuncDataVec* pArr, SCsCOL nCol, size_t& nAt ); + sal_Bool Contains ( ScDPFuncDataVec* pArr, SCsCOL nCol, size_t& nAt ); void Remove ( ScDPFuncDataVec* pArr, size_t nAt ); void Insert ( ScDPFuncDataVec* pArr, const ScDPFuncData& rFData, size_t nAt ); |