/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
void ScTabView::Init()
{ /* RTL layout of the view windows is done manually, because it depends on the sheet orientation, not the UI setting. Note: controls that are already constructed (e.g. scroll bars) have the RTL setting of the GUI.
Eventually this has to be disabled manually (see below). */
pFrameWin->EnableRTL( false );
// SSA: override default keyboard step size to allow snap to row/column
pHSplitter->SetKeyboardStepSize( 1 );
pVSplitter->SetKeyboardStepSize( 1 );
pTabControl = VclPtr<ScTabControl>::Create(pFrameWin, aViewData); if (mbInlineWithScrollbar)
pTabControl->SetStyle(pTabControl->GetStyle() | WB_SIZEABLE);
/* #i97900# The tab control has to remain in RTL mode if GUI is RTL, this is needed to draw the 3D effect correctly. The base TabBar implements mirroring independent from the GUI direction. Have to set RTL mode
explicitly because the parent frame window is already RTL disabled. */
pTabControl->EnableRTL( AllSettings::GetLayoutRTL() );
InitScrollBar( *aHScrollLeft, aViewData.GetDocument().MaxCol()+1, LINK(this, ScTabView, HScrollLeftHdl) );
InitScrollBar( *aHScrollRight, aViewData.GetDocument().MaxCol()+1, LINK(this, ScTabView, HScrollRightHdl) );
InitScrollBar( *aVScrollTop, aViewData.GetDocument().MaxRow()+1, LINK(this, ScTabView, VScrollTopHdl) );
InitScrollBar( *aVScrollBottom, aViewData.GetDocument().MaxRow()+1, LINK(this, ScTabView, VScrollBottomHdl) ); /* #i97900# scrollbars remain in correct RTL mode, needed mirroring etc.
is now handled correctly at the respective places. */
// Don't show anything here, because still in wrong order // Show is received from UpdateShow during first resize // pTabControl, pGridWin, aHScrollLeft, aVScrollBottom, // aCornerButton, pHSplitter, pVSplitter
void ScTabView::MakeDrawView( TriState nForceDesignMode )
{ if (pDrawView) return;
ScDrawLayer* pLayer = aViewData.GetDocument().GetDrawLayer();
OSL_ENSURE(pLayer, "Where is the Draw Layer ??");
sal_uInt16 i;
pDrawView.reset( new ScDrawView( pGridWin[SC_SPLIT_BOTTOMLEFT]->GetOutDev(), aViewData ) ); for (i=0; i<4; i++) if (pGridWin[i])
{ if ( SC_SPLIT_BOTTOMLEFT != static_cast<ScSplitPos>(i) )
pDrawView->AddDeviceToPaintView(*pGridWin[i]->GetOutDev(), nullptr);
}
pDrawView->RecalcScale(); for (i=0; i<4; i++) if (pGridWin[i])
{
pGridWin[i]->SetMapMode(pGridWin[i]->GetDrawMapMode());
pGridWin[i]->PaintImmediately(); // because of Invalidate in DrawView ctor (ShowPage), // so that immediately can be drawn
}
SfxRequest aSfxRequest(SID_OBJECT_SELECT, SfxCallMode::SLOT, aViewData.GetViewShell()->GetPool());
SetDrawFuncPtr(new FuSelection(*aViewData.GetViewShell(), GetActiveWin(), pDrawView.get(),
*pLayer,aSfxRequest));
// used when switching back from page preview: restore saved design mode state // (otherwise, keep the default from the draw view ctor) if ( nForceDesignMode != TRISTATE_INDET )
pDrawView->SetDesignMode( nForceDesignMode != TRISTATE_FALSE );
// register at FormShell
FmFormShell* pFormSh = aViewData.GetViewShell()->GetFormShell(); if (pFormSh)
pFormSh->SetView(pDrawView.get());
if (aViewData.GetViewShell()->HasAccessibilityObjects())
aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SfxHintId::ScAccMakeDrawLayer));
}
void ScTabView::ImplTabChanged(bool bSameTabButMoved)
{ // For kit ignore invalidations during tab change
ScTabViewShell* pViewShell = aViewData.GetViewShell();
SfxLokCallbackInterface* pCallback = pViewShell->getLibreOfficeKitViewCallback();
pViewShell->setLibreOfficeKitViewCallback(nullptr);
comphelper::ScopeGuard aOutputGuard(
[this, pViewShell, pCallback] {
pViewShell->setLibreOfficeKitViewCallback(pCallback); // But possibly update any out of date formulas on the tab we switched to
UpdateFormulas();
});
if (pDrawView)
{
DrawDeselectAll(); // end also text edit mode
pDrawView->RecalcScale();
pDrawView->UpdateWorkArea(); // PageSize is different per page
}
SfxBindings& rBindings = aViewData.GetBindings();
// There is no easy way to invalidate all slots of the FormShell // (for disabled slots on protected tables), therefore simply everything...
rBindings.InvalidateAll(false);
if (aViewData.GetViewShell()->HasAccessibilityObjects())
{
SfxHint aAccHint(SfxHintId::ScAccTableChanged);
aViewData.GetViewShell()->BroadcastAccessibility(aAccHint);
}
// notification for XActivationBroadcaster
SfxViewFrame& rViewFrame = aViewData.GetViewShell()->GetViewFrame();
uno::Reference<frame::XController> xController = rViewFrame.GetFrame().GetController(); if (xController.is())
{
ScTabViewObj* pImp = dynamic_cast<ScTabViewObj*>( xController.get() ); if (pImp)
pImp->SheetChanged( bSameTabButMoved );
}
for (int i = 0; i < 4; i++)
{ if (pGridWin[i])
{
pGridWin[i]->initiatePageBreaks(); // Trigger calculating page breaks only once. break;
}
}
}
void ScTabView::ViewOptionsHasChanged( bool bHScrollChanged, bool bGraphicsChanged )
{ // create DrawView when grid should be displayed if ( !pDrawView && aViewData.GetOptions().GetGridOptions().GetGridVisible() )
MakeDrawLayer();
if (pDrawView)
pDrawView->UpdateUserViewOptions();
if (bGraphicsChanged)
DrawEnableAnim(true); // DrawEnableAnim checks the options state
// if TabBar is set to visible, make sure its size is not 0 bool bGrow = ( aViewData.IsTabMode() && pTabControl->GetSizePixel().Width() <= 0 );
// if ScrollBar is set to visible, TabBar must make room bool bShrink = ( bHScrollChanged && aViewData.IsTabMode() && aViewData.IsHScrollMode() &&
pTabControl->GetSizePixel().Width() > SC_TABBAR_DEFWIDTH );
if ( bGrow || bShrink )
{
Size aSize = pTabControl->GetSizePixel();
aSize.setWidth( SC_TABBAR_DEFWIDTH ); // initial size
pTabControl->SetSizePixel(aSize); // DoResize is called later...
}
}
// helper function against including the drawing layer
void ScTabView::DrawMarkListHasChanged()
{ if ( pDrawView )
pDrawView->MarkListHasChanged();
}
void ScTabView::UpdateAnchorHandles()
{ if ( pDrawView )
pDrawView->AdjustMarkHdl();
}
// don't start animations if display of graphics is disabled // graphics are controlled by VOBJ_TYPE_OLE if ( bSet && aViewData.GetOptions().GetObjMode(VOBJ_TYPE_OLE) == VOBJ_MODE_SHOW )
{ if ( !pDrawView->IsAnimationEnabled() )
{
pDrawView->SetAnimationEnabled();
// animated GIFs must be restarted:
ScDocument& rDoc = aViewData.GetDocument(); for (i=0; i<4; i++) if ( pGridWin[i] && pGridWin[i]->IsVisible() )
rDoc.StartAnimations( aViewData.GetTabNo() );
}
} else
{
pDrawView->SetAnimationEnabled(false);
}
}
void ScTabView::UpdateDrawTextOutliner()
{ if ( pDrawView )
{
Outliner* pOL = pDrawView->GetTextEditOutliner(); if (pOL)
aViewData.UpdateOutlinerFlags( *pOL );
}
}
void ScTabView::ScrollToObject( const SdrObject* pDrawObj )
{ if ( pDrawObj )
{ // #i118524# use the BoundRect, this defines the visible area
MakeVisible(pDrawObj->GetCurrentBoundRect());
}
}
if ( aRect.Right() >= aWinSize.Width() ) // right out
{
nScrollX = aRect.Right() - aWinSize.Width() + 1; // right border visible if ( aRect.Left() < nScrollX )
nScrollX = aRect.Left(); // left visible (if too big)
} if ( aRect.Bottom() >= aWinSize.Height() ) // bottom out
{
nScrollY = aRect.Bottom() - aWinSize.Height() + 1; // bottom border visible if ( aRect.Top() < nScrollY )
nScrollY = aRect.Top(); // top visible (if too big)
}
if ( aRect.Left() < 0 ) // left out
nScrollX = aRect.Left(); // left border visible if ( aRect.Top() < 0 ) // top out
nScrollY = aRect.Top(); // top border visible
// This is a temporary workaround: sometime in tiled rendering mode // the tip of the note arrow is misplaced by a fixed offset. // The value used below is enough to get the tile, where the arrow tip is // placed, invalidated. constint nBorderSize = 200;
tools::Rectangle aInvalidRect = aRect;
aInvalidRect.AdjustLeft( -nBorderSize );
aInvalidRect.AdjustRight( nBorderSize );
aInvalidRect.AdjustTop( -nBorderSize );
aInvalidRect.AdjustBottom( nBorderSize );
SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell)
{
ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell); if (pTabViewShell && pViewShell->GetDocId() == pCurrentViewShell->GetDocId())
{ for (auto& pWin: pTabViewShell->pGridWin)
{ if (pWin && pWin->IsVisible())
{
pWin->Invalidate(aInvalidRect);
}
}
}
pViewShell = SfxViewShell::GetNext(*pViewShell);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.