merge the formfield patch from ooo-build
[ooovba.git] / sc / source / ui / view / tabvwsh8.cxx
blob10a918a0ee9cd179c4d56141b2d7d866851e64fa
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tabvwsh8.cxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 // INCLUDE ---------------------------------------------------------------
38 #include "scitems.hxx"
39 #include <svx/boxitem.hxx>
41 #include "tabvwsh.hxx"
42 #include "document.hxx"
45 //------------------------------------------------------------------
47 void ScTabViewShell::SetDefaultFrameLine( const SvxBorderLine* pLine )
49 if ( pLine )
51 delete pCurFrameLine;
52 pCurFrameLine = new SvxBorderLine( &pLine->GetColor(),
53 pLine->GetOutWidth(),
54 pLine->GetInWidth(),
55 pLine->GetDistance() );
57 else if ( pCurFrameLine )
59 delete pCurFrameLine;
60 pCurFrameLine = NULL;
64 //------------------------------------------------------------------
66 BOOL __EXPORT ScTabViewShell::HasSelection( BOOL bText ) const
68 BOOL bHas = FALSE;
69 ScViewData* pData = (ScViewData*)GetViewData(); // const weggecasted
70 if ( bText )
72 // Text enthalten: Anzahl2 >= 1
73 ScDocument* pDoc = pData->GetDocument();
74 ScMarkData& rMark = pData->GetMarkData();
75 ScAddress aCursor( pData->GetCurX(), pData->GetCurY(), pData->GetTabNo() );
76 double fVal = 0.0;
77 if ( pDoc->GetSelectionFunction( SUBTOTAL_FUNC_CNT2, aCursor, rMark, fVal ) )
78 bHas = ( fVal > 0.5 );
80 else
82 ScRange aRange;
83 ScMarkType eMarkType = pData->GetSimpleArea( aRange );
84 if ( eMarkType == SC_MARK_SIMPLE )
85 bHas = ( aRange.aStart != aRange.aEnd ); // more than 1 cell
86 else
87 bHas = TRUE; // multiple selection or filtered
89 return bHas;
92 //------------------------------------------------------------------
94 void ScTabViewShell::UIDeactivated( SfxInPlaceClient* pClient )
96 ClearHighlightRanges();
98 // Move an der ViewShell soll eigentlich vom Sfx gerufen werden, wenn sich
99 // das Frame-Window wegen unterschiedlicher Toolboxen o.ae. verschiebt
100 // (um nicht aus Versehen z.B. Zeichenobjekte zu verschieben, #56515#).
101 // Dieser Mechanismus funktioniert aber momentan nicht, darum hier der Aufruf
102 // per Hand (im Move wird verglichen, ob die Position wirklich geaendert ist).
103 ForceMove();
104 SfxViewShell::UIDeactivated( pClient );