LibreOffice Module sc (master) 1
tabvwsh8.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
21
22#include <tabvwsh.hxx>
23#include <document.hxx>
24
25void ScTabViewShell::SetDefaultFrameLine( const ::editeng::SvxBorderLine* pLine )
26{
27 if ( pLine )
28 {
29 pCurFrameLine.reset( new ::editeng::SvxBorderLine( &pLine->GetColor(),
30 pLine->GetWidth(),
31 pLine->GetBorderLineStyle() ) );
32 }
33 else
34 pCurFrameLine.reset();
35}
36
37bool ScTabViewShell::HasSelection( bool bText ) const
38{
39 bool bHas = false;
40 ScViewData& rData = const_cast<ScViewData&>(GetViewData());
41 if ( bText )
42 {
43 // Content contained: Count2 >= 1
44 ScDocument& rDoc = rData.GetDocument();
45 ScMarkData& rMark = rData.GetMarkData();
46 ScAddress aCursor( rData.GetCurX(), rData.GetCurY(), rData.GetTabNo() );
47 double fVal = 0.0;
48 if ( rDoc.GetSelectionFunction( SUBTOTAL_FUNC_CNT2, aCursor, rMark, fVal ) )
49 bHas = ( fVal > 0.5 );
50 }
51 else
52 {
53 ScRange aRange;
54 ScMarkType eMarkType = rData.GetSimpleArea( aRange );
55 if ( eMarkType == SC_MARK_SIMPLE )
56 bHas = ( aRange.aStart != aRange.aEnd ); // more than 1 cell
57 else
58 bHas = true; // multiple selection or filtered
59 }
60 return bHas;
61}
62
64{
66
67 // Move in the ViewShell should really be called from Sfx, when the
68 // frame window is moved due to different toolboxes or other things
69 // (to not move painted objects by mistake, #56515#).
70 // this mechanism does however not work at the moment, that is why this
71 // call is here (in Move it is checked if the position has really changed).
72 ForceMove();
74}
75
76/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool GetSelectionFunction(ScSubTotalFunc eFunc, const ScAddress &rCursor, const ScMarkData &rMark, double &rResult)
Definition: documen4.cxx:609
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
std::unique_ptr<::editeng::SvxBorderLine > pCurFrameLine
Definition: tabvwsh.hxx:122
virtual bool HasSelection(bool bText=true) const override
Definition: tabvwsh8.cxx:37
void ForceMove()
Definition: tabvwsh.hxx:355
virtual void UIDeactivated(SfxInPlaceClient *pClient) override
Definition: tabvwsh8.cxx:63
void SetDefaultFrameLine(const ::editeng::SvxBorderLine *pLine)
Definition: tabvwsh8.cxx:25
void ClearHighlightRanges()
Definition: tabview3.cxx:2559
ScViewData & GetViewData()
Definition: tabview.hxx:335
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3141
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
Definition: viewdata.cxx:1181
SCROW GetCurY() const
Definition: viewdata.hxx:402
SCCOL GetCurX() const
Definition: viewdata.hxx:401
virtual void UIDeactivated(SfxInPlaceClient *pClient)
@ SUBTOTAL_FUNC_CNT2
Definition: global.hxx:863
ScMarkType
States GetSimpleArea() returns for the underlying selection marks, so the caller can react if the res...
Definition: viewdata.hxx:61
@ SC_MARK_SIMPLE
Definition: viewdata.hxx:65