diff options
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r-- | sc/source/ui/view/cellsh2.cxx | 30 | ||||
-rw-r--r-- | sc/source/ui/view/makefile.mk | 3 | ||||
-rw-r--r-- | sc/source/ui/view/olinewin.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/reffact.cxx | 84 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 135 |
6 files changed, 223 insertions, 35 deletions
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 039e4dc256ba..29db7f2286b3 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -209,6 +209,18 @@ BOOL lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortParam ) return bSort; } +//<!-- Added by PengYunQuan for Validity Cell Range Picker +//after end execute from !IsModalInputMode, it is safer to delay deleting +namespace +{ + long DelayDeleteAbstractDialog( void *pAbstractDialog, void * /*pArg*/ ) + { + delete reinterpret_cast<VclAbstractDialog*>( pAbstractDialog ); + return 0; + } +} +//--> Added by PengYunQuan for Validity Cell Range Picker + void ScCellShell::ExecuteDB( SfxRequest& rReq ) { ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); @@ -1060,10 +1072,18 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) //CHINA001 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); //CHINA001 DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 - SfxAbstractTabDialog* pDlg = pFact->CreateScValidationDlg( NULL, &aArgSet, TAB_DLG_VALIDATION ); + //<!--Modified by PengYunQuan for Validity Cell Range Picker + //SfxAbstractTabDialog* pDlg = pFact->CreateScValidationDlg( NULL, &aArgSet, TAB_DLG_VALIDATION ); + SfxAbstractTabDialog* pDlg = pFact->CreateScValidationDlg( NULL, &aArgSet, TAB_DLG_VALIDATION, pTabViewShell ); + //-->Modified by PengYunQuan for Validity Cell Range Picker DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 - if ( pDlg->Execute() == RET_OK ) + //<!--Modified by PengYunQuan for Validity Cell Range Picker + //if ( pDlg->Execute() == RET_OK ) + short nResult = pDlg->Execute(); + pTabViewShell->SetTabNo( nTab );//When picking Cell Range ,other Tab may be switched. Need restore the correct tab + if ( nResult == RET_OK ) + //-->Modified by PengYunQuan for Validity Cell Range Picker { const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); @@ -1142,7 +1162,11 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) pTabViewShell->SetValidation( aData ); rReq.Done( *pOutSet ); } - delete pDlg; + //<!-- Modified by PengYunQuan for Validity Cell Range Picker + //after end execute from !IsModalInputMode, it is safer to delay deleting + //delete pDlg; + Application::PostUserEvent( Link( pDlg, &DelayDeleteAbstractDialog ) ); + //--> Modified by PengYunQuan for Validity Cell Range Picker } } break; diff --git a/sc/source/ui/view/makefile.mk b/sc/source/ui/view/makefile.mk index 466ab5dc8627..d8f45c8a754f 100644 --- a/sc/source/ui/view/makefile.mk +++ b/sc/source/ui/view/makefile.mk @@ -161,7 +161,8 @@ EXCEPTIONSFILES= \ $(SLO)$/tabvwshb.obj \ $(SLO)$/viewdata.obj \ $(SLO)$/viewfun5.obj \ - $(SLO)$/viewfun7.obj + $(SLO)$/viewfun7.obj \ + $(SLO)$/reffact.obj # goal seek -O2 diff --git a/sc/source/ui/view/olinewin.cxx b/sc/source/ui/view/olinewin.cxx index 5ac563987e65..6e5535361653 100644 --- a/sc/source/ui/view/olinewin.cxx +++ b/sc/source/ui/view/olinewin.cxx @@ -167,7 +167,7 @@ void ScOutlineWindow::InitSettings() const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); SetBackground( rStyleSettings.GetFaceColor() ); maLineColor = rStyleSettings.GetButtonTextColor(); - mpSymbols = ScGlobal::GetOutlineSymbols( !!GetBackground().GetColor().IsDark() ); + mpSymbols = ScGlobal::GetOutlineSymbols( rStyleSettings.GetHighContrastMode() ); Invalidate(); } diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx index 66f9cb88fb2c..8b36ae6a480e 100644 --- a/sc/source/ui/view/reffact.cxx +++ b/sc/source/ui/view/reffact.cxx @@ -47,6 +47,9 @@ #include "acredlin.hxx" #include "simpref.hxx" #include "scmod.hxx" +//<!--Added by PengYunQuan for Validity Cell Range Picker +#include "validate.hxx" +//<!--Added by PengYunQuan for Validity Cell Range Picker // ----------------------------------------------------------------------- @@ -71,6 +74,27 @@ SFX_IMPL_CHILDWINDOW(ScFunctionDlgWrapper, SID_OPENDLG_FUNCTION ) SFX_IMPL_CHILDWINDOW(ScEditFunctionDlgWrapper, SID_OPENDLG_EDITFUNCTION ) SFX_IMPL_CHILDWINDOW(ScArgumentDlgWrapper, SID_OPENDLG_ARGUMENT ) */ +//<!--Added by PengYunQuan for Validity Cell Range Picker +//SFX_IMPL_MODELESSDIALOG(ScValidityRefChildWin, SID_VALIDITY_REFERENCE ) +SFX_IMPL_CHILDWINDOW(ScValidityRefChildWin, SID_VALIDITY_REFERENCE) +SfxChildWinInfo __EXPORT ScValidityRefChildWin::GetInfo() const +{ + SfxChildWinInfo anInfo = SfxChildWindow::GetInfo(); + + if( Window *pWnd = GetWindow() ) + { + anInfo.aSize = pWnd->GetSizePixel(); + + if( pWnd->IsDialog() ) + if ( static_cast<Dialog*>(pWnd)->IsRollUp() ) + anInfo.nFlags |= SFX_CHILDWIN_ZOOMIN; + } + + return anInfo; +} + +namespace { ScTabViewShell * lcl_GetTabViewShell( SfxBindings *pBindings ); } +//<!--Added by PengYunQuan for Validity Cell Range Picker #define IMPL_CHILD_CTOR(Class,sid) \ Class::Class( Window* pParentP, \ @@ -79,8 +103,17 @@ SFX_IMPL_CHILDWINDOW(ScArgumentDlgWrapper, SID_OPENDLG_ARGUMENT ) SfxChildWinInfo* pInfo ) \ : SfxChildWindow(pParentP, nId) \ { \ - ScTabViewShell* pViewShell = \ - PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); \ + /*//<!--Added by PengYunQuan for Validity Cell Range Picker*/\ + /************************************************************************************/\ + /* When a new document is creating, the SfxViewFrame may be ready, */\ + /* But the ScTabViewShell may have not been activated yet. In this */\ + /* situation, SfxViewShell::Current() does not get the correct shell, */\ + /* and we should lcl_GetTabViewShell( p ) instead of SfxViewShell::Current() */\ + /************************************************************************************/\ + ScTabViewShell* pViewShell = lcl_GetTabViewShell( p ); \ + /*//-->Added by PengYunQuan for Validity Cell Range Picker*/\ + if (!pViewShell) \ + pViewShell = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); \ DBG_ASSERT( pViewShell, "missing view shell :-(" ); \ pWindow = pViewShell ? \ pViewShell->CreateRefDialog( p, this, pInfo, pParentP, sid ) : NULL; \ @@ -355,3 +388,50 @@ IMPL_CHILD_CTOR( ScHighlightChgDlgWrapper, FID_CHG_SHOW ) /*------------------------------------------------------------------------*/ +//<!--Added by PengYunQuan for Validity Cell Range Picker +namespace +{ + ScTabViewShell * lcl_GetTabViewShell( SfxBindings *pBindings ) + { + if( pBindings ) + if( SfxDispatcher* pDisp = pBindings ->GetDispatcher() ) + if( SfxViewFrame *pFrm = pDisp->GetFrame() ) + if( SfxViewShell* pViewSh = pFrm->GetViewShell() ) + return dynamic_cast<ScTabViewShell*>( pViewSh ); + + return NULL; + } +} + +ScValidityRefChildWin::ScValidityRefChildWin( Window* pParentP, \ + USHORT nId, \ + SfxBindings* p, \ + SfxChildWinInfo* /*pInfo*/ ) \ + : SfxChildWindow(pParentP, nId), + m_bVisibleLock( false ), + m_bFreeWindowLock( false ), + m_pSavedWndParent( NULL ) +{ + SetWantsFocus( FALSE );\ + ScTabViewShell* pViewShell = \ + NULL != ( pWindow = ScValidationDlg::Find1AliveObject( pParentP ) ) ? static_cast<ScValidationDlg*>(pWindow)->GetTabViewShell() : + lcl_GetTabViewShell( p ); + if (!pViewShell) + pViewShell = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + DBG_ASSERT( pViewShell, "missing view shell :-(" ); \ + if (pViewShell && !pWindow) \ + pViewShell->GetViewFrame()->SetChildWindow( nId, FALSE ); \ + else if( pWindow /*&& pWindow->ISA(ScValidationDlg)*/ ) + {}//pWindow = new Window( pParentP, WB_HIDE ); + + if( pWindow ) m_pSavedWndParent = pWindow->GetParent(); +} + +ScValidityRefChildWin::~ScValidityRefChildWin() +{ + if( pWindow ) pWindow->SetParent( m_pSavedWndParent ); + + if( m_bFreeWindowLock ) + pWindow = NULL; +} +//-->Added by PengYunQuan for Validity Cell Range Picker diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx index 497eb65fc76f..4c73d14d51be 100644 --- a/sc/source/ui/view/tabvwsh.cxx +++ b/sc/source/ui/view/tabvwsh.cxx @@ -96,6 +96,10 @@ SFX_IMPL_INTERFACE(ScTabViewShell,SfxViewShell,ScResId(SCSTR_TABVIEWSHELL)) SFX_CHILDWINDOW_REGISTRATION(GalleryChildWindow::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(ScSpellDialogChildWindow::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() ); + + //<!--Added by PengYunQuan for Validity Cell Range Picker + SFX_CHILDWINDOW_REGISTRATION(ScValidityRefChildWin::GetChildWindowId()); + //-->Added by PengYunQuan for Validity Cell Range Picker } SFX_IMPL_VIEWFACTORY( ScTabViewShell, ScResId(STR_NONAME) ) diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index c3848b76b92b..c23eb73e1f59 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -597,68 +597,147 @@ void ScViewData::SetViewShell( ScTabViewShell* pViewSh ) pView = NULL; } } +void ScViewData::CreateTabData( std::vector< SCTAB >& rvTabs ) +{ + std::vector< SCTAB >::iterator it_end = rvTabs.end(); + for ( std::vector< SCTAB >::iterator it = rvTabs.begin(); it != it_end; ++it ) + if ( !pTabData[*it] ) + CreateTabData( *it ); +} -void ScViewData::SetZoomType( SvxZoomType eNew, BOOL bAll ) +void ScViewData::SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs ) { - if ( !bAll ) - CreateSelectedTabData(); // if zoom is set for a table, it must be stored + BOOL bAll = ( tabs.size() == 0 ); - for ( SCTAB i = 0; i <= MAXTAB; i++ ) - if ( pTabData[i] && ( bAll || aMarkData.GetTableSelect(i) ) ) - pTabData[i]->eZoomType = eNew; + if ( !bAll ) // create associated table data + CreateTabData( tabs ); if ( bAll ) + { + for ( SCTAB i = 0; i <= MAXTAB; ++i ) + { + if ( pTabData[i] ) + pTabData[i]->eZoomType = eNew; + } eDefZoomType = eNew; + } + else + { + std::vector< SCTAB >::iterator it_end = tabs.end(); + std::vector< SCTAB >::iterator it = tabs.begin(); + for ( ; it != it_end; ++it ) + { + SCTAB i = *it; + if ( pTabData[i] ) + pTabData[i]->eZoomType = eNew; + } + } } -void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, BOOL bAll ) +void ScViewData::SetZoomType( SvxZoomType eNew, BOOL bAll ) { - if ( !bAll ) - CreateSelectedTabData(); // if zoom is set for a table, it must be stored + std::vector< SCTAB > vTabs; // Empty for all tabs + if ( !bAll ) // get selected tabs + { + SCTAB nTabCount = pDoc->GetTableCount(); + for (SCTAB i=0; i<nTabCount; i++) + { + if ( aMarkData.GetTableSelect(i) ) + vTabs.push_back( i ); + } + } + SetZoomType( eNew, vTabs ); +} +void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs ) +{ + BOOL bAll = ( tabs.size() == 0 ); + if ( !bAll ) // create associated table data + CreateTabData( tabs ); Fraction aFrac20( 1,5 ); Fraction aFrac400( 4,1 ); Fraction aValidX = rNewX; - if (aValidX<aFrac20) aValidX = aFrac20; - if (aValidX>aFrac400) aValidX = aFrac400; + if (aValidX<aFrac20) + aValidX = aFrac20; + if (aValidX>aFrac400) + aValidX = aFrac400; Fraction aValidY = rNewY; - if (aValidY<aFrac20) aValidY = aFrac20; - if (aValidY>aFrac400) aValidY = aFrac400; + if (aValidY<aFrac20) + aValidY = aFrac20; + if (aValidY>aFrac400) + aValidY = aFrac400; - if ( bPagebreak ) + if ( bAll ) { - for ( SCTAB i = 0; i <= MAXTAB; i++ ) - if ( pTabData[i] && ( bAll || aMarkData.GetTableSelect(i) ) ) + for ( SCTAB i = 0; i <= MAXTAB; ++i ) + { + if ( pTabData[i] ) { - pTabData[i]->aPageZoomX = aValidX; - pTabData[i]->aPageZoomY = aValidY; + if ( bPagebreak ) + { + pTabData[i]->aPageZoomX = aValidX; + pTabData[i]->aPageZoomY = aValidY; + } + else + { + pTabData[i]->aZoomX = aValidX; + pTabData[i]->aZoomY = aValidY; + } } - if ( bAll ) + } + if ( bPagebreak ) { aDefPageZoomX = aValidX; aDefPageZoomY = aValidY; } + else + { + aDefZoomX = aValidX; + aDefZoomY = aValidY; + } } else { - for ( SCTAB i = 0; i <= MAXTAB; i++ ) - if ( pTabData[i] && ( bAll || aMarkData.GetTableSelect(i) ) ) + std::vector< SCTAB >::iterator it_end = tabs.end(); + std::vector< SCTAB >::iterator it = tabs.begin(); + for ( ; it != it_end; ++it ) + { + SCTAB i = *it; + if ( pTabData[i] ) { - pTabData[i]->aZoomX = aValidX; - pTabData[i]->aZoomY = aValidY; + if ( bPagebreak ) + { + pTabData[i]->aPageZoomX = aValidX; + pTabData[i]->aPageZoomY = aValidY; + } + else + { + pTabData[i]->aZoomX = aValidX; + pTabData[i]->aZoomY = aValidY; + } } - if ( bAll ) - { - aDefZoomX = aValidX; - aDefZoomY = aValidY; } } - RefreshZoom(); } +void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, BOOL bAll ) +{ + std::vector< SCTAB > vTabs; + if ( !bAll ) // get selected tabs + { + SCTAB nTabCount = pDoc->GetTableCount(); + for (SCTAB i=0; i<nTabCount; i++) + { + if ( aMarkData.GetTableSelect(i) ) + vTabs.push_back( i ); + } + } + SetZoom( rNewX, rNewY, vTabs ); +} + void ScViewData::RefreshZoom() { // recalculate zoom-dependent values (only for current sheet) |