vbawindow.cxx (b3f79822) | vbawindow.cxx (a9ad1b25) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 588 unchanged lines hidden (view full) --- 597::sal_Bool SAL_CALL 598ScVbaWindow::getFreezePanes() throw (uno::RuntimeException) 599{ 600 uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW ); 601 return xViewFreezable->hasFrozenPanes(); 602} 603 604void SAL_CALL | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 588 unchanged lines hidden (view full) --- 597::sal_Bool SAL_CALL 598ScVbaWindow::getFreezePanes() throw (uno::RuntimeException) 599{ 600 uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW ); 601 return xViewFreezable->hasFrozenPanes(); 602} 603 604void SAL_CALL |
605ScVbaWindow::setFreezePanes( ::sal_Bool /*_bFreezePanes*/ ) throw (uno::RuntimeException) | 605ScVbaWindow::setFreezePanes( ::sal_Bool _bFreezePanes ) throw (uno::RuntimeException) |
606{ 607 uno::Reference< sheet::XViewPane > xViewPane( getController(), 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 ); | 606{ 607 uno::Reference< sheet::XViewPane > xViewPane( getController(), 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 ); |
610 if( xViewSplitable->getIsWindowSplit() ) | 610 if( _bFreezePanes ) |
611 { | 611 { |
612 // if there is a split we freeze at the split 613 sal_Int32 nColumn = getSplitColumn(); 614 sal_Int32 nRow = getSplitRow(); 615 xViewFreezable->freezeAtPosition( nColumn, nRow ); | 612 if( xViewSplitable->getIsWindowSplit() ) 613 { 614 // if there is a split we freeze at the split 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 } 617 else 618 { | 627 } 628 else 629 { |
619 // otherwise we freeze in the center of the visible sheet 620 table::CellRangeAddress aCellRangeAddress = xViewPane->getVisibleRange(); 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 ); | 630 //remove the freeze panes 631 xViewSplitable->splitAtPosition(0,0); |
624 } 625} 626 627::sal_Bool SAL_CALL 628ScVbaWindow::getSplit() throw (uno::RuntimeException) 629{ 630 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); 631 return xViewSplitable->getIsWindowSplit(); --- 8 unchanged lines hidden (view full) --- 640 xViewSplitable->splitAtPosition(0,0); 641 } 642 else 643 { 644 uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW ); 645 uno::Reference< excel::XRange > xRange = ActiveCell(); 646 sal_Int32 nRow = xRange->getRow(); 647 sal_Int32 nColumn = xRange->getColumn(); | 632 } 633} 634 635::sal_Bool SAL_CALL 636ScVbaWindow::getSplit() throw (uno::RuntimeException) 637{ 638 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); 639 return xViewSplitable->getIsWindowSplit(); --- 8 unchanged lines hidden (view full) --- 648 xViewSplitable->splitAtPosition(0,0); 649 } 650 else 651 { 652 uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW ); 653 uno::Reference< excel::XRange > xRange = ActiveCell(); 654 sal_Int32 nRow = xRange->getRow(); 655 sal_Int32 nColumn = xRange->getColumn(); |
648 xViewFreezable->freezeAtPosition( nColumn-1, nRow-1 ); 649 SplitAtDefinedPosition( sal_True ); | 656 SplitAtDefinedPosition( nColumn-1, nRow-1 ); |
650 } 651} 652 653sal_Int32 SAL_CALL 654ScVbaWindow::getSplitColumn() throw (uno::RuntimeException) 655{ 656 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); 657 return xViewSplitable->getSplitColumn(); 658} 659 660void SAL_CALL 661ScVbaWindow::setSplitColumn( sal_Int32 _splitcolumn ) throw (uno::RuntimeException) 662{ 663 if( getSplitColumn() != _splitcolumn ) 664 { 665 uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW ); | 657 } 658} 659 660sal_Int32 SAL_CALL 661ScVbaWindow::getSplitColumn() throw (uno::RuntimeException) 662{ 663 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); 664 return xViewSplitable->getSplitColumn(); 665} 666 667void SAL_CALL 668ScVbaWindow::setSplitColumn( sal_Int32 _splitcolumn ) throw (uno::RuntimeException) 669{ 670 if( getSplitColumn() != _splitcolumn ) 671 { 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 ); 669 SplitAtDefinedPosition( !bFrozen ); | 674 SplitAtDefinedPosition( _splitcolumn, nRow ); |
670 } 671} 672 673double SAL_CALL 674ScVbaWindow::getSplitHorizontal() throw (uno::RuntimeException) 675{ 676 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); 677 return PixelsToPoints( getDevice(), xViewSplitable->getSplitHorizontal(), sal_True ); --- 6 unchanged lines hidden (view full) --- 684 double fHoriPixels = PointsToPixels( getDevice(), _splithorizontal, sal_True ); 685 xViewSplitable->splitAtPosition( static_cast< sal_Int32 >( fHoriPixels ), 0 ); 686} 687 688sal_Int32 SAL_CALL 689ScVbaWindow::getSplitRow() throw (uno::RuntimeException) 690{ 691 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); | 675 } 676} 677 678double SAL_CALL 679ScVbaWindow::getSplitHorizontal() throw (uno::RuntimeException) 680{ 681 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); 682 return PixelsToPoints( getDevice(), xViewSplitable->getSplitHorizontal(), sal_True ); --- 6 unchanged lines hidden (view full) --- 689 double fHoriPixels = PointsToPixels( getDevice(), _splithorizontal, sal_True ); 690 xViewSplitable->splitAtPosition( static_cast< sal_Int32 >( fHoriPixels ), 0 ); 691} 692 693sal_Int32 SAL_CALL 694ScVbaWindow::getSplitRow() throw (uno::RuntimeException) 695{ 696 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); |
692 sal_Int32 nValue = xViewSplitable->getSplitRow(); 693 return nValue ? nValue - 1 : nValue; | 697 return xViewSplitable->getSplitRow(); |
694} 695 696void SAL_CALL 697ScVbaWindow::setSplitRow( sal_Int32 _splitrow ) throw (uno::RuntimeException) 698{ 699 if( getSplitRow() != _splitrow ) 700 { 701 uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW ); | 698} 699 700void SAL_CALL 701ScVbaWindow::setSplitRow( sal_Int32 _splitrow ) throw (uno::RuntimeException) 702{ 703 if( getSplitRow() != _splitrow ) 704 { 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 ); 705 SplitAtDefinedPosition( !bFrozen ); | 707 SplitAtDefinedPosition( nColumn, _splitrow ); |
706 } 707} 708 709double SAL_CALL 710ScVbaWindow::getSplitVertical() throw (uno::RuntimeException) 711{ 712 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); 713 return PixelsToPoints( getDevice(), xViewSplitable->getSplitVertical(), sal_False ); 714} 715 716void SAL_CALL 717ScVbaWindow::setSplitVertical(double _splitvertical ) throw (uno::RuntimeException) 718{ 719 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); 720 double fVertiPixels = PointsToPixels( getDevice(), _splitvertical, sal_False ); 721 xViewSplitable->splitAtPosition( 0, static_cast<sal_Int32>( fVertiPixels ) ); 722} 723 | 708 } 709} 710 711double SAL_CALL 712ScVbaWindow::getSplitVertical() throw (uno::RuntimeException) 713{ 714 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); 715 return PixelsToPoints( getDevice(), xViewSplitable->getSplitVertical(), sal_False ); 716} 717 718void SAL_CALL 719ScVbaWindow::setSplitVertical(double _splitvertical ) throw (uno::RuntimeException) 720{ 721 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); 722 double fVertiPixels = PointsToPixels( getDevice(), _splitvertical, sal_False ); 723 xViewSplitable->splitAtPosition( 0, static_cast<sal_Int32>( fVertiPixels ) ); 724} 725 |
724void ScVbaWindow::SplitAtDefinedPosition(sal_Bool _bUnFreezePane) | 726void ScVbaWindow::SplitAtDefinedPosition( sal_Int32 nColumns, sal_Int32 nRows ) |
725{ 726 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); 727 uno::Reference< sheet::XViewFreezable > xViewFreezable( xViewSplitable, uno::UNO_QUERY_THROW ); | 727{ 728 uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); 729 uno::Reference< sheet::XViewFreezable > xViewFreezable( xViewSplitable, uno::UNO_QUERY_THROW ); |
728 sal_Int32 nVertSplit = xViewSplitable->getSplitVertical(); 729 sal_Int32 nHoriSplit = xViewSplitable->getSplitHorizontal(); 730 if( _bUnFreezePane ) 731 xViewFreezable->freezeAtPosition(0,0); 732 xViewSplitable->splitAtPosition(nHoriSplit, nVertSplit); | 730 // nColumns and nRows means split columns/rows 731 if( nColumns == 0 && nRows == 0 ) 732 return; 733 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} 734 735uno::Any SAL_CALL 736ScVbaWindow::getZoom() throw (uno::RuntimeException) 737{ 738 uno::Reference< beans::XPropertySet > xProps = getControllerProps(); 739 rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_ZOOMTYPE ) ); 740 sal_Int16 nZoomType = view::DocumentZoomType::PAGE_WIDTH; --- 32 unchanged lines hidden (view full) --- 773{ 774 uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); 775 return xApplication->getActiveSheet(); 776} 777 778uno::Any SAL_CALL 779ScVbaWindow::getView() throw (uno::RuntimeException) 780{ | 750} 751 752uno::Any SAL_CALL 753ScVbaWindow::getZoom() throw (uno::RuntimeException) 754{ 755 uno::Reference< beans::XPropertySet > xProps = getControllerProps(); 756 rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_ZOOMTYPE ) ); 757 sal_Int16 nZoomType = view::DocumentZoomType::PAGE_WIDTH; --- 32 unchanged lines hidden (view full) --- 790{ 791 uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); 792 return xApplication->getActiveSheet(); 793} 794 795uno::Any SAL_CALL 796ScVbaWindow::getView() throw (uno::RuntimeException) 797{ |
781 // not supported now 782 sal_Int32 nWindowView = excel::XlWindowView::xlNormalView; | 798 sal_Bool bPageBreak = sal_False; 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 ); 784} 785 786void SAL_CALL 787ScVbaWindow::setView( const uno::Any& _view) throw (uno::RuntimeException) 788{ 789 sal_Int32 nWindowView = excel::XlWindowView::xlNormalView; 790 _view >>= nWindowView; --- 86 unchanged lines hidden --- | 810 return uno::makeAny( nWindowView ); 811} 812 813void SAL_CALL 814ScVbaWindow::setView( const uno::Any& _view) throw (uno::RuntimeException) 815{ 816 sal_Int32 nWindowView = excel::XlWindowView::xlNormalView; 817 _view >>= nWindowView; --- 86 unchanged lines hidden --- |