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