xref: /aoo42x/main/sc/source/ui/view/tabvwsh8.cxx (revision b3f79822)
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
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26 
27 
28 
29 // INCLUDE ---------------------------------------------------------------
30 
31 #include "scitems.hxx"
32 #include <editeng/boxitem.hxx>
33 
34 #include "tabvwsh.hxx"
35 #include "document.hxx"
36 
37 
38 //------------------------------------------------------------------
39 
SetDefaultFrameLine(const SvxBorderLine * pLine)40 void ScTabViewShell::SetDefaultFrameLine( const SvxBorderLine* pLine )
41 {
42 	if ( pLine )
43 	{
44 		delete pCurFrameLine;
45 		pCurFrameLine = new SvxBorderLine( &pLine->GetColor(),
46 											pLine->GetOutWidth(),
47 											pLine->GetInWidth(),
48 											pLine->GetDistance() );
49 	}
50 	else if ( pCurFrameLine )
51 	{
52 		delete pCurFrameLine;
53 		pCurFrameLine = NULL;
54 	}
55 }
56 
57 //------------------------------------------------------------------
58 
HasSelection(sal_Bool bText) const59 sal_Bool __EXPORT ScTabViewShell::HasSelection( sal_Bool bText ) const
60 {
61 	sal_Bool bHas = sal_False;
62 	ScViewData* pData = (ScViewData*)GetViewData();		// const weggecasted
63 	if ( bText )
64 	{
65 		//	Text enthalten: Anzahl2 >= 1
66 		ScDocument* pDoc = pData->GetDocument();
67 		ScMarkData& rMark = pData->GetMarkData();
68 		ScAddress aCursor( pData->GetCurX(), pData->GetCurY(), pData->GetTabNo() );
69 		double fVal = 0.0;
70 		if ( pDoc->GetSelectionFunction( SUBTOTAL_FUNC_CNT2, aCursor, rMark, fVal ) )
71 			bHas = ( fVal > 0.5 );
72 	}
73 	else
74 	{
75 		ScRange aRange;
76         ScMarkType eMarkType = pData->GetSimpleArea( aRange );
77         if ( eMarkType == SC_MARK_SIMPLE )
78             bHas = ( aRange.aStart != aRange.aEnd );    // more than 1 cell
79         else
80             bHas = sal_True;                                // multiple selection or filtered
81 	}
82 	return bHas;
83 }
84 
85 //------------------------------------------------------------------
86 
UIDeactivated(SfxInPlaceClient * pClient)87 void ScTabViewShell::UIDeactivated( SfxInPlaceClient* pClient )
88 {
89     ClearHighlightRanges();
90 
91     //  Move an der ViewShell soll eigentlich vom Sfx gerufen werden, wenn sich
92     //  das Frame-Window wegen unterschiedlicher Toolboxen o.ae. verschiebt
93     //  (um nicht aus Versehen z.B. Zeichenobjekte zu verschieben, #56515#).
94     //  Dieser Mechanismus funktioniert aber momentan nicht, darum hier der Aufruf
95     //  per Hand (im Move wird verglichen, ob die Position wirklich geaendert ist).
96     ForceMove();
97     SfxViewShell::UIDeactivated( pClient );
98 }
99 
100 
101