View | Details | Raw Unified | Return to issue 106278
Collapse All | Expand All

(-)./old/sc/source/ui/vba/vbawindow.cxx (-25 / +73 lines)
Lines 2-8 Link Here
2
 *
2
 *
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
 * 
4
 * 
5
 * Copyright 2008 by Sun Microsystems, Inc.
5
 * Copyright 2009 by Sun Microsystems, Inc.
6
 *
6
 *
7
 * OpenOffice.org - a multi-platform office productivity suite
7
 * OpenOffice.org - a multi-platform office productivity suite
8
 *
8
 *
Lines 594-615 Link Here
594
}
594
}
595
595
596
void SAL_CALL 
596
void SAL_CALL 
597
ScVbaWindow::setFreezePanes( ::sal_Bool /*_bFreezePanes*/ ) throw (uno::RuntimeException)
597
ScVbaWindow::setFreezePanes( ::sal_Bool _bFreezePanes ) throw (uno::RuntimeException)
598
{
598
{
599
	if( m_xViewSplitable->getIsWindowSplit() )
599
	if( _bFreezePanes )
600
	{
600
	{
601
		// if there is a split we freeze at the split
601
		if( m_xViewSplitable->getIsWindowSplit() )
602
		sal_Int32 nColumn = getSplitColumn();
602
		{
603
		sal_Int32 nRow = getSplitRow();
603
			// if there is a split we freeze at the split
604
		m_xViewFreezable->freezeAtPosition( nColumn, nRow );
604
			sal_Int32 nColumn = getSplitColumn();
605
			sal_Int32 nRow = getSplitRow();
606
			m_xViewFreezable->freezeAtPosition( nColumn, nRow );
607
		}
608
		else
609
		{
610
			// otherwise we freeze in the center of the visible sheet	
611
			table::CellRangeAddress aCellRangeAddress = m_xViewPane->getVisibleRange();
612
			sal_Int32 nColumn = aCellRangeAddress.StartColumn + (( aCellRangeAddress.EndColumn - aCellRangeAddress.StartColumn )/2 );
613
			sal_Int32 nRow = aCellRangeAddress.StartRow + (( aCellRangeAddress.EndRow - aCellRangeAddress.StartRow )/2 );
614
			m_xViewFreezable->freezeAtPosition( nColumn, nRow );	
615
		}
605
	}
616
	}
606
	else
617
	else //VBA, minz@cn.ibm.com.
607
	{
618
	{
608
		// otherwise we freeze in the center of the visible sheet	
619
		//remove the freeze panes
609
		table::CellRangeAddress aCellRangeAddress = m_xViewPane->getVisibleRange();
620
		m_xViewSplitable->splitAtPosition(0,0);
610
		sal_Int32 nColumn = aCellRangeAddress.StartColumn + (( aCellRangeAddress.EndColumn - aCellRangeAddress.StartColumn )/2 );
611
		sal_Int32 nRow = aCellRangeAddress.StartRow + (( aCellRangeAddress.EndRow - aCellRangeAddress.StartRow )/2 );
612
		m_xViewFreezable->freezeAtPosition( nColumn, nRow );	
613
	}
621
	}
614
}
622
}
615
623
Lines 631-638 Link Here
631
		uno::Reference< excel::XRange > xRange = ActiveCell();
639
		uno::Reference< excel::XRange > xRange = ActiveCell();
632
		sal_Int32 nRow = xRange->getRow();
640
		sal_Int32 nRow = xRange->getRow();
633
		sal_Int32 nColumn = xRange->getColumn();
641
		sal_Int32 nColumn = xRange->getColumn();
634
		m_xViewFreezable->freezeAtPosition( nColumn-1, nRow-1 );
642
		//m_xViewFreezable->freezeAtPosition( nColumn-1, nRow-1 );
635
		SplitAtDefinedPosition( sal_True );
643
		//SplitAtDefinedPosition( sal_True );
644
		SplitAtDefinedPosition( nColumn-1, nRow-1 );
636
	}
645
	}
637
}
646
}
638
647
Lines 647-656 Link Here
647
{
656
{
648
	if( getSplitColumn() != _splitcolumn )
657
	if( getSplitColumn() != _splitcolumn )
649
	{
658
	{
650
		sal_Bool bFrozen = getFreezePanes();
659
		//sal_Bool bFrozen = getFreezePanes();
651
		sal_Int32 nRow = getSplitRow();
660
		sal_Int32 nRow = getSplitRow();
652
		m_xViewFreezable->freezeAtPosition( _splitcolumn, nRow );
661
		//m_xViewFreezable->freezeAtPosition( _splitcolumn, nRow );
653
		SplitAtDefinedPosition( !bFrozen );
662
		//SplitAtDefinedPosition( !bFrozen );
663
		SplitAtDefinedPosition( _splitcolumn, nRow );
654
	}
664
	}
655
}
665
}
656
666
Lines 672-679 Link Here
672
sal_Int32 SAL_CALL 
682
sal_Int32 SAL_CALL 
673
ScVbaWindow::getSplitRow() throw (uno::RuntimeException)
683
ScVbaWindow::getSplitRow() throw (uno::RuntimeException)
674
{
684
{
675
	sal_Int32 nValue = m_xViewSplitable->getSplitRow();
685
	//VBA, minz@cn.ibm.com.
676
	return nValue ? nValue - 1 : nValue;	
686
	return m_xViewSplitable->getSplitRow();
687
	//return nValue ? nValue - 1 : nValue;	
677
}
688
}
678
689
679
void SAL_CALL 
690
void SAL_CALL 
Lines 681-690 Link Here
681
{
692
{
682
	if( getSplitRow() != _splitrow )
693
	if( getSplitRow() != _splitrow )
683
	{
694
	{
684
		sal_Bool bFrozen = getFreezePanes();
695
		//sal_Bool bFrozen = getFreezePanes();
685
		sal_Int32 nColumn = getSplitColumn();
696
		sal_Int32 nColumn = getSplitColumn();
686
		m_xViewFreezable->freezeAtPosition( nColumn , _splitrow );
697
		//m_xViewFreezable->freezeAtPosition( nColumn , _splitrow );
687
		SplitAtDefinedPosition( !bFrozen );
698
		//SplitAtDefinedPosition( !bFrozen );
699
		SplitAtDefinedPosition( nColumn, _splitrow );
688
	}
700
	}
689
}
701
}
690
702
Lines 703-710 Link Here
703
	m_xViewSplitable->splitAtPosition( 0, static_cast<sal_Int32>( fVertiPixels ) );
715
	m_xViewSplitable->splitAtPosition( 0, static_cast<sal_Int32>( fVertiPixels ) );
704
}
716
}
705
717
706
void ScVbaWindow::SplitAtDefinedPosition(sal_Bool _bUnFreezePane)
718
//VBA, minz@cn.ibm.com. Refactory this function.
719
//void ScVbaWindow::SplitAtDefinedPosition(sal_Bool _bUnFreezePane) 
720
void ScVbaWindow::SplitAtDefinedPosition( sal_Int32 nColumns, sal_Int32 nRows )
707
{
721
{
722
	/*
708
	sal_Int32 nVertSplit = m_xViewSplitable->getSplitVertical();
723
	sal_Int32 nVertSplit = m_xViewSplitable->getSplitVertical();
709
	sal_Int32 nHoriSplit = m_xViewSplitable->getSplitHorizontal();
724
	sal_Int32 nHoriSplit = m_xViewSplitable->getSplitHorizontal();
710
	if( _bUnFreezePane )
725
	if( _bUnFreezePane )
Lines 712-717 Link Here
712
		m_xViewFreezable->freezeAtPosition(0,0);
727
		m_xViewFreezable->freezeAtPosition(0,0);
713
	}
728
	}
714
	m_xViewSplitable->splitAtPosition(nHoriSplit, nVertSplit);
729
	m_xViewSplitable->splitAtPosition(nHoriSplit, nVertSplit);
730
	*/
731
	
732
	// nColumns and nRows means split columns/rows
733
	if( nColumns == 0 && nRows == 0 )
734
		return;
735
736
	sal_Int32 cellColumn = nColumns + 1;
737
	sal_Int32 cellRow = nRows + 1;
738
739
	ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
740
	if ( pViewShell )
741
	{
742
		//firstly remove the old splitter
743
		m_xViewSplitable->splitAtPosition(0,0);
744
745
		uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
746
		uno::Reference< excel::XWorksheet > xSheet( xApplication->getActiveSheet(), uno::UNO_QUERY_THROW );
747
		xSheet->Cells(uno::makeAny(cellRow), uno::makeAny(cellColumn))->Select();
748
749
		//pViewShell->FreezeSplitters( FALSE );
750
		dispatchExecute( pViewShell, SID_WINDOW_SPLIT );
751
	}
715
}
752
}
716
753
717
uno::Any SAL_CALL 
754
uno::Any SAL_CALL 
Lines 762-769 Link Here
762
uno::Any SAL_CALL
799
uno::Any SAL_CALL
763
ScVbaWindow::getView() throw (uno::RuntimeException)
800
ScVbaWindow::getView() throw (uno::RuntimeException)
764
{
801
{
765
	// not supported now	
802
	// VBA, minz@cn.ibm.com. Add the implementation.
803
	BOOL bPageBreak = FALSE;
766
	sal_Int32 nWindowView = excel::XlWindowView::xlNormalView;	
804
	sal_Int32 nWindowView = excel::XlWindowView::xlNormalView;	
805
806
	ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
807
	if (pViewShell)
808
		bPageBreak = pViewShell->GetViewData()->IsPagebreakMode();
809
810
	if( bPageBreak )
811
		nWindowView = excel::XlWindowView::xlPageBreakPreview;	
812
	else
813
		nWindowView = excel::XlWindowView::xlNormalView;
814
767
	return uno::makeAny( nWindowView );	
815
	return uno::makeAny( nWindowView );	
768
}
816
}
769
817
(-)./old/sc/source/ui/vba/vbawindow.hxx (-2 / +2 lines)
Lines 2-8 Link Here
2
 *
2
 *
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
 * 
4
 * 
5
 * Copyright 2008 by Sun Microsystems, Inc.
5
 * Copyright 2009 by Sun Microsystems, Inc.
6
 *
6
 *
7
 * OpenOffice.org - a multi-platform office productivity suite
7
 * OpenOffice.org - a multi-platform office productivity suite
8
 *
8
 *
Lines 56-62 Link Here
56
	css::uno::Reference< css::awt::XDevice > m_xDevice;
56
	css::uno::Reference< css::awt::XDevice > m_xDevice;
57
    void init();
57
    void init();
58
protected:
58
protected:
59
	void SplitAtDefinedPosition(sal_Bool _bUnFreezePane);
59
	void SplitAtDefinedPosition( sal_Int32 nColumns, sal_Int32 nRows /*sal_Bool _bUnFreezePane*/ );//VBA, minz@cn.ibm.com.
60
public:	
60
public:	
61
	void  Scroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft, bool bLargeScroll = false ) throw (css::uno::RuntimeException);	
61
	void  Scroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft, bool bLargeScroll = false ) throw (css::uno::RuntimeException);	
62
public:
62
public:

Return to issue 106278