Lines 602-626
Link Here
|
602 |
} |
602 |
} |
603 |
|
603 |
|
604 |
void SAL_CALL |
604 |
void SAL_CALL |
605 |
ScVbaWindow::setFreezePanes( ::sal_Bool /*_bFreezePanes*/ ) throw (uno::RuntimeException) |
605 |
ScVbaWindow::setFreezePanes( ::sal_Bool _bFreezePanes ) throw (uno::RuntimeException) |
606 |
{ |
606 |
{ |
607 |
uno::Reference< sheet::XViewPane > xViewPane( getController(), uno::UNO_QUERY_THROW ); |
607 |
uno::Reference< sheet::XViewPane > xViewPane( getController(), uno::UNO_QUERY_THROW ); |
608 |
uno::Reference< sheet::XViewSplitable > xViewSplitable( xViewPane, uno::UNO_QUERY_THROW ); |
608 |
uno::Reference< sheet::XViewSplitable > xViewSplitable( xViewPane, uno::UNO_QUERY_THROW ); |
609 |
uno::Reference< sheet::XViewFreezable > xViewFreezable( xViewPane, uno::UNO_QUERY_THROW ); |
609 |
uno::Reference< sheet::XViewFreezable > xViewFreezable( xViewPane, uno::UNO_QUERY_THROW ); |
610 |
if( xViewSplitable->getIsWindowSplit() ) |
610 |
if( _bFreezePanes ) |
611 |
{ |
611 |
{ |
612 |
// if there is a split we freeze at the split |
612 |
if( xViewSplitable->getIsWindowSplit() ) |
613 |
sal_Int32 nColumn = getSplitColumn(); |
613 |
{ |
614 |
sal_Int32 nRow = getSplitRow(); |
614 |
// if there is a split we freeze at the split |
615 |
xViewFreezable->freezeAtPosition( nColumn, nRow ); |
615 |
sal_Int32 nColumn = getSplitColumn(); |
|
|
616 |
sal_Int32 nRow = getSplitRow(); |
617 |
xViewFreezable->freezeAtPosition( nColumn, nRow ); |
618 |
} |
619 |
else |
620 |
{ |
621 |
// otherwise we freeze in the center of the visible sheet |
622 |
table::CellRangeAddress aCellRangeAddress = xViewPane->getVisibleRange(); |
623 |
sal_Int32 nColumn = aCellRangeAddress.StartColumn + (( aCellRangeAddress.EndColumn - aCellRangeAddress.StartColumn )/2 ); |
624 |
sal_Int32 nRow = aCellRangeAddress.StartRow + (( aCellRangeAddress.EndRow - aCellRangeAddress.StartRow )/2 ); |
625 |
xViewFreezable->freezeAtPosition( nColumn, nRow ); |
626 |
} |
616 |
} |
627 |
} |
617 |
else |
628 |
else |
618 |
{ |
629 |
{ |
619 |
// otherwise we freeze in the center of the visible sheet |
630 |
//remove the freeze panes |
620 |
table::CellRangeAddress aCellRangeAddress = xViewPane->getVisibleRange(); |
631 |
xViewSplitable->splitAtPosition(0,0); |
621 |
sal_Int32 nColumn = aCellRangeAddress.StartColumn + (( aCellRangeAddress.EndColumn - aCellRangeAddress.StartColumn )/2 ); |
|
|
622 |
sal_Int32 nRow = aCellRangeAddress.StartRow + (( aCellRangeAddress.EndRow - aCellRangeAddress.StartRow )/2 ); |
623 |
xViewFreezable->freezeAtPosition( nColumn, nRow ); |
624 |
} |
632 |
} |
625 |
} |
633 |
} |
626 |
|
634 |
|
Lines 645-652
Link Here
|
645 |
uno::Reference< excel::XRange > xRange = ActiveCell(); |
653 |
uno::Reference< excel::XRange > xRange = ActiveCell(); |
646 |
sal_Int32 nRow = xRange->getRow(); |
654 |
sal_Int32 nRow = xRange->getRow(); |
647 |
sal_Int32 nColumn = xRange->getColumn(); |
655 |
sal_Int32 nColumn = xRange->getColumn(); |
648 |
xViewFreezable->freezeAtPosition( nColumn-1, nRow-1 ); |
656 |
SplitAtDefinedPosition( nColumn-1, nRow-1 ); |
649 |
SplitAtDefinedPosition( sal_True ); |
|
|
650 |
} |
657 |
} |
651 |
} |
658 |
} |
652 |
|
659 |
|
Lines 663-672
Link Here
|
663 |
if( getSplitColumn() != _splitcolumn ) |
670 |
if( getSplitColumn() != _splitcolumn ) |
664 |
{ |
671 |
{ |
665 |
uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW ); |
672 |
uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW ); |
666 |
sal_Bool bFrozen = getFreezePanes(); |
|
|
667 |
sal_Int32 nRow = getSplitRow(); |
673 |
sal_Int32 nRow = getSplitRow(); |
668 |
xViewFreezable->freezeAtPosition( _splitcolumn, nRow ); |
674 |
SplitAtDefinedPosition( _splitcolumn, nRow ); |
669 |
SplitAtDefinedPosition( !bFrozen ); |
|
|
670 |
} |
675 |
} |
671 |
} |
676 |
} |
672 |
|
677 |
|
Lines 689-696
Link Here
|
689 |
ScVbaWindow::getSplitRow() throw (uno::RuntimeException) |
694 |
ScVbaWindow::getSplitRow() throw (uno::RuntimeException) |
690 |
{ |
695 |
{ |
691 |
uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); |
696 |
uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); |
692 |
sal_Int32 nValue = xViewSplitable->getSplitRow(); |
697 |
return xViewSplitable->getSplitRow(); |
693 |
return nValue ? nValue - 1 : nValue; |
|
|
694 |
} |
698 |
} |
695 |
|
699 |
|
696 |
void SAL_CALL |
700 |
void SAL_CALL |
Lines 699-708
Link Here
|
699 |
if( getSplitRow() != _splitrow ) |
703 |
if( getSplitRow() != _splitrow ) |
700 |
{ |
704 |
{ |
701 |
uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW ); |
705 |
uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW ); |
702 |
sal_Bool bFrozen = getFreezePanes(); |
|
|
703 |
sal_Int32 nColumn = getSplitColumn(); |
706 |
sal_Int32 nColumn = getSplitColumn(); |
704 |
xViewFreezable->freezeAtPosition( nColumn , _splitrow ); |
707 |
SplitAtDefinedPosition( nColumn, _splitrow ); |
705 |
SplitAtDefinedPosition( !bFrozen ); |
|
|
706 |
} |
708 |
} |
707 |
} |
709 |
} |
708 |
|
710 |
|
Lines 721-735
Link Here
|
721 |
xViewSplitable->splitAtPosition( 0, static_cast<sal_Int32>( fVertiPixels ) ); |
723 |
xViewSplitable->splitAtPosition( 0, static_cast<sal_Int32>( fVertiPixels ) ); |
722 |
} |
724 |
} |
723 |
|
725 |
|
724 |
void ScVbaWindow::SplitAtDefinedPosition(sal_Bool _bUnFreezePane) |
726 |
void ScVbaWindow::SplitAtDefinedPosition( sal_Int32 nColumns, sal_Int32 nRows ) |
725 |
{ |
727 |
{ |
726 |
uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); |
728 |
uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); |
727 |
uno::Reference< sheet::XViewFreezable > xViewFreezable( xViewSplitable, uno::UNO_QUERY_THROW ); |
729 |
uno::Reference< sheet::XViewFreezable > xViewFreezable( xViewSplitable, uno::UNO_QUERY_THROW ); |
728 |
sal_Int32 nVertSplit = xViewSplitable->getSplitVertical(); |
730 |
// nColumns and nRows means split columns/rows |
729 |
sal_Int32 nHoriSplit = xViewSplitable->getSplitHorizontal(); |
731 |
if( nColumns == 0 && nRows == 0 ) |
730 |
if( _bUnFreezePane ) |
732 |
return; |
731 |
xViewFreezable->freezeAtPosition(0,0); |
733 |
|
732 |
xViewSplitable->splitAtPosition(nHoriSplit, nVertSplit); |
734 |
sal_Int32 cellColumn = nColumns + 1; |
|
|
735 |
sal_Int32 cellRow = nRows + 1; |
736 |
|
737 |
ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); |
738 |
if ( pViewShell ) |
739 |
{ |
740 |
//firstly remove the old splitter |
741 |
xViewSplitable->splitAtPosition(0,0); |
742 |
|
743 |
uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); |
744 |
uno::Reference< excel::XWorksheet > xSheet( xApplication->getActiveSheet(), uno::UNO_QUERY_THROW ); |
745 |
xSheet->Cells(uno::makeAny(cellRow), uno::makeAny(cellColumn))->Select(); |
746 |
|
747 |
//pViewShell->FreezeSplitters( FALSE ); |
748 |
dispatchExecute( pViewShell, SID_WINDOW_SPLIT ); |
749 |
} |
733 |
} |
750 |
} |
734 |
|
751 |
|
735 |
uno::Any SAL_CALL |
752 |
uno::Any SAL_CALL |
Lines 778-785
Link Here
|
778 |
uno::Any SAL_CALL |
795 |
uno::Any SAL_CALL |
779 |
ScVbaWindow::getView() throw (uno::RuntimeException) |
796 |
ScVbaWindow::getView() throw (uno::RuntimeException) |
780 |
{ |
797 |
{ |
781 |
// not supported now |
798 |
sal_Bool bPageBreak = sal_False; |
782 |
sal_Int32 nWindowView = excel::XlWindowView::xlNormalView; |
799 |
sal_Int32 nWindowView = excel::XlWindowView::xlNormalView; |
|
|
800 |
|
801 |
ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); |
802 |
if (pViewShell) |
803 |
bPageBreak = pViewShell->GetViewData()->IsPagebreakMode(); |
804 |
|
805 |
if( bPageBreak ) |
806 |
nWindowView = excel::XlWindowView::xlPageBreakPreview; |
807 |
else |
808 |
nWindowView = excel::XlWindowView::xlNormalView; |
809 |
|
783 |
return uno::makeAny( nWindowView ); |
810 |
return uno::makeAny( nWindowView ); |
784 |
} |
811 |
} |
785 |
|
812 |
|