/* -*- 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 .
*/
// tdf#150773: do not grab focus on loading if (mbFirstTimeActivation)
mbFirstTimeActivation = false; else
{
// When the mode is switched to normal the main view shell grabs focus. // This is done for getting cut/copy/paste commands on slides in the left // pane (slide sorter view shell) to work properly.
SfxShell* pTopViewShell = GetViewShellBase().GetViewShellManager()->GetTopViewShell(); if (pTopViewShell == this)
{
GetActiveWindow()->GrabFocus();
}
}
}
// Disable own controls
maTabControl->Disable(); if (GetLayerTabControl() != nullptr)
GetLayerTabControl()->Disable();
}
void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli )
{ // Enable own controls
maTabControl->Enable(); if (GetLayerTabControl() != nullptr)
GetLayerTabControl()->Enable();
ViewShell::UIDeactivated(pCli);
}
void DrawViewShell::Deactivate(bool bIsMDIActivate)
{ // Temporarily disable context broadcasting while the Deactivate() // call is forwarded to our base class. constbool bIsContextBroadcasterEnabled (SfxShell::SetContextBroadcasterEnabled(false));
try
{ if (pOleObj)
{ if (constauto& xObj = pOleObj->GetObjRef())
rBase.SetVerbs(xObj->getSupportedVerbs());
} elseif (auto* pIPClient = rBase.GetIPClient();
pIPClient && pIPClient->IsObjectInPlaceActive())
{ // as appropriate take ole-objects into account and deactivate
// this means we recently deselected an inplace active ole object so // we need to deselect it now
//#i47279# disable frame until after object has completed unload
LockUI aUILock(GetViewFrame());
pIPClient->DeactivateObject(); //HMHmpDrView->ShowMarkHdl();
}
} catch( css::uno::Exception& )
{
TOOLS_WARN_EXCEPTION( "sd", "sd::DrawViewShell::SelectionHasChanged()" );
}
/** * set zoom factor
*/ void DrawViewShell::SetZoom( ::tools::Long nZoom )
{ // Make sure that the zoom factor will not be recalculated on // following window resizings.
mbZoomOnPage = false;
ViewShell::SetZoom( nZoom );
GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
mpViewOverlayManager->onZoomChanged();
collectUIInformation(OUString::number(nZoom));
}
if ( mpDrawView->IsTextEdit() )
{ // This exits the text edit mode when going in and out of window focus, which is not needed // Let's keep this call as comment for now as it probably just needs a better conditional. // mpDrawView->SdrEndTextEdit();
}
LayerTabBar* pLayerBar = GetLayerTabControl(); if (pLayerBar != nullptr)
pLayerBar->EndEditMode();
maTabControl->EndEditMode();
if(pLayerBar)
{ // #i87182# only switch activation mode of LayerTabBar when there is one, // else it will not get initialized with the current set of Layers as needed
mbIsLayerModeActive = bIsLayerModeActive;
}
// Determine whether to show the master view toolbar. The master // page mode has to be active and the shell must not be a handout // view. bool bShowMasterViewToolbar (meEditMode == EditMode::MasterPage
&& GetShellType() != ViewShell::ST_HANDOUT); bool bShowPresentationToolbar (meEditMode != EditMode::MasterPage
&& GetShellType() != ViewShell::ST_HANDOUT
&& GetShellType() != ViewShell::ST_DRAW);
// If the master view toolbar is not shown we hide it before // switching the edit mode. if (::sd::ViewShell::mpImpl->mbIsInitialized
&& IsMainViewShell())
{ if ( !bShowMasterViewToolbar )
GetViewShellBase().GetToolBarManager()->ResetToolBars(ToolBarManager::ToolBarGroup::MasterMode); if ( !bShowPresentationToolbar )
GetViewShellBase().GetToolBarManager()->ResetToolBars(ToolBarManager::ToolBarGroup::CommonTask);
}
ConfigureAppBackgroundColor();
// tdf#87638 - change slide pane title according to the edit mode auto setLeftPaneTitleIfPaneExists
= [pViewShell = GetViewFrame()](sal_uInt16 nId, TranslateId aId)
{ if (auto* pChildWindow = pViewShell->GetChildWindow(nId)) if (auto* pTitledDockingWindow
= static_cast<TitledDockingWindow*>(pChildWindow->GetWindow()))
pTitledDockingWindow->SetTitle(SdResId(aId));
};
if (meEditMode == EditMode::Page)
{ /****************************************************************** * PAGEMODE
******************************************************************/
maTabControl->Clear();
// tdf#87638 - change slide pane title according to the edit mode
setLeftPaneTitleIfPaneExists(SID_LEFT_PANE_DRAW, STR_LEFT_PANE_DRAW_TITLE);
setLeftPaneTitleIfPaneExists(SID_LEFT_PANE_IMPRESS, STR_LEFT_PANE_IMPRESS_TITLE);
//tdf#102343 re-enable common undo on switch back from master mode
mpDrawView->GetModel().SetDisableTextEditUsesCommonUndoManager(false);
} else
{ /****************************************************************** * MASTERPAGE
******************************************************************/
GetViewFrame()->SetChildWindow(
AnimationChildWindow::GetChildWindowId(), false );
// tdf#87638 - change slide pane title according to the edit mode
setLeftPaneTitleIfPaneExists(SID_LEFT_PANE_DRAW, STR_LEFT_PANE_DRAW_TITLE_MASTER);
setLeftPaneTitleIfPaneExists(SID_LEFT_PANE_IMPRESS, STR_LEFT_PANE_IMPRESS_TITLE_MASTER);
if (!mpActualPage)
{ // as long as there is no mpActualPage, take first
mpActualPage = GetDoc()->GetSdPage(0, mePageKind);
}
//tdf#102343 changing attributes of textboxes in master typically //changes the stylesheet they are linked to, so if the common //undo manager is in use, those stylesheet changes are thrown //away at present
mpDrawView->GetModel().SetDisableTextEditUsesCommonUndoManager(true);
}
// If the master view toolbar is to be shown we turn it on after the // edit mode has been changed. if (::sd::ViewShell::mpImpl->mbIsInitialized && !sfx2::SfxNotebookBar::IsActive()
&& IsMainViewShell())
{ if (bShowMasterViewToolbar)
GetViewShellBase().GetToolBarManager()->SetToolBar(
ToolBarManager::ToolBarGroup::MasterMode,
ToolBarManager::msMasterViewToolBar); if (bShowPresentationToolbar)
GetViewShellBase().GetToolBarManager()->SetToolBar(
ToolBarManager::ToolBarGroup::CommonTask,
ToolBarManager::msCommonTaskToolBar);
}
if ( ! mbIsLayerModeActive)
{
maTabControl->Show(); // Set the tab control only for draw pages. For master page // this has been done already above. if (meEditMode == EditMode::Page)
maTabControl->SetCurPageId (nActualPageId);
}
/** * Mark the desired page as selected (1), deselected (0), toggle (2). * nPage refers to the page in question.
*/ bool DrawViewShell::SelectPage(sal_uInt16 nPage, sal_uInt16 nSelect)
{
SdPage* pPage = GetDoc()->GetSdPage(nPage, PageKind::Standard); if (!pPage) returnfalse;
//page selector marks pages as selected in view
sd::slidesorter::SlideSorterViewShell* pSlideSorterVS
= sd::slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase());
if (nSelect == 1 || (/*Toggle*/ nSelect > 1 && !pPage->IsSelected()))
{
GetDoc()->SetSelected(pPage, true); // Select. if (pSlideSorterVS)
pSlideSorterVS->GetSlideSorter().GetController().GetPageSelector().SelectPage(nPage);
} else
{
GetDoc()->SetSelected(pPage, false); // Deselect. if (pSlideSorterVS)
pSlideSorterVS->GetSlideSorter().GetController().GetPageSelector().DeselectPage(nPage);
}
/** * Switch to desired page. * nSelectPage refers to the current EditMode * bAllowChangeFocus set to false when slide is inserted before current page * and we need to only update the current page number, * do not disturb editing in that case * bUpdateScrollbars set to false when the scrollbars are going to be updated by * some other mechanism. (e.g. if the page switch happened as * a result of a scroll)
*/ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage, bool bAllowChangeFocus, bool bUpdateScrollbars)
{ /** Under some circumstances there are nested calls to SwitchPage() and may crash the application (activation of form controls when the shell of the edit view is not on top of the shell stack, see issue 83888 for details.) Therefore the nested calls are ignored (they would jump to the wrong page anyway.)
*/
if (GetActiveWindow()->IsInPaint())
{ // Switching the current page while a Paint is being executed is // dangerous. So, post it for later execution and return.
maAsynchronousSwitchPageCall.Post(
[this, nSelectedPage] () { this->SwitchPage(nSelectedPage); } ); returnfalse;
}
bool bOK = false;
// With the current implementation of FuSlideShow there is a problem // when it displays the show in a window: when the show is stopped it // returns at one point in time SDRPAGE_NOTFOUND as current page index. // Because FuSlideShow is currently being rewritten this bug is fixed // here. // This is not as bad a hack as it may look because making SwitchPage() // more robust with respect to invalid page numbers is a good thing // anyway. if (nSelectedPage == SDRPAGE_NOTFOUND)
{
nSelectedPage = 0;
} else
{ // Make sure that the given page index points to an existing page. Move // the index into the valid range if necessary.
sal_uInt16 nPageCount = (meEditMode == EditMode::Page)
? GetDoc()->GetSdPageCount(mePageKind)
: GetDoc()->GetMasterSdPageCount(mePageKind); if (nSelectedPage >= nPageCount)
nSelectedPage = nPageCount-1;
}
if (IsSwitchPageAllowed())
{
ModifyGuard aGuard2( GetDoc() );
// does the selected page fit to the masterpage?
sal_uInt16 nPageCount = GetDoc()->GetSdPageCount(mePageKind); for (sal_uInt16 i = 0; i < nPageCount; i++)
{
SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind); if(pPage && pPage->IsSelected() && pMaster == &(pPage->TRG_GetMasterPage()))
{
mpActualPage = pPage; break;
}
}
if (!mpActualPage)
{ // take the first page, that fits to the masterpage for (sal_uInt16 i = 0; i < nPageCount; i++)
{
SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind); if(pPage && pMaster == &(pPage->TRG_GetMasterPage()))
{
mpActualPage = pPage; break;
}
}
}
}
for (sal_uInt16 i = 0; i < GetDoc()->GetSdPageCount(mePageKind); i++)
{ // deselect all pages
GetDoc()->SetSelected( GetDoc()->GetSdPage(i, mePageKind), false);
}
if (!mpActualPage)
{ // as far as there is no mpActualPage, take the first
mpActualPage = GetDoc()->GetSdPage(0, mePageKind);
}
// also select this page (mpActualPage always points at a drawing page, // never at a masterpage)
GetDoc()->SetSelected(mpActualPage, true);
if (comphelper::LibreOfficeKit::isActive())
{ // notify LibreOfficeKit about changed page
OString aPayload = OString::number(nSelectedPage); if (SfxViewShell* pViewShell = GetViewShell())
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload);
}
rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) ); if( !xSlideshow.is() || !xSlideshow->isRunning() || ( xSlideshow->getAnimationMode() != ANIMATIONMODE_SHOW ) )
{ // tighten VisArea, to possibly deactivate objects // !!! only if we are not in presentation mode (#96279) !!!
OSL_ASSERT (GetViewShell()!=nullptr);
GetViewShell()->DisconnectAllClients();
VisAreaChanged(::tools::Rectangle(Point(), Size(1, 1)));
}
// Try to prefetch all graphics for the active page. This will be done // in threads to be more efficient than loading them on-demand one by one.
std::vector<Graphic*> graphics;
mpActualPage->getGraphicsForPrefetch(graphics); if(graphics.size() > 1) // threading does not help with loading just one
GraphicFilter::GetGraphicFilter().MakeGraphicsAvailableThreaded(graphics);
if (maTabControl->GetPageText(maTabControl->GetPageId(nSelectedPage)) != aLayoutName)
{
maTabControl->SetPageText(maTabControl->GetPageId(nSelectedPage), aLayoutName);
}
if( mePageKind == PageKind::Handout )
{ // set pages for all available handout presentation objects
sd::ShapeList& rShapeList = pMaster->GetPresentationShapeList();
SdrObject* pObj = nullptr;
rShapeList.seekShape(0);
while( (pObj = rShapeList.getNextShape()) )
{ if( pMaster->GetPresObjKind(pObj) == PresObjKind::Handout )
{ // #i105146# We want no content to be displayed for PageKind::Handout, // so just never set a page as content static_cast<SdrPageObj*>(pObj)->SetReferencedPage(nullptr);
}
}
}
}
// remember old tab count and current tab id // this is needed when one layer is renamed to // restore current tab
sal_uInt16 nOldLayerCnt = pLayerBar->GetPageCount(); // actually it is tab count
sal_uInt16 nOldLayerPos = pLayerBar->GetCurPageId(); // actually it is a tab nId
/** * Update for LayerTab
*/
pLayerBar->Clear();
OUString aName; // a real layer name
OUString aActiveLayer = mpDrawView->GetActiveLayer();
sal_uInt16 nActiveLayerPos = SDRLAYERPOS_NOTFOUND;
SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount();
if ( aName != sUNO_LayerName_background ) // layer "background" has never a tab
{ if (meEditMode == EditMode::MasterPage)
{ // don't show page layer onto the masterpage if (aName != sUNO_LayerName_layout &&
aName != sUNO_LayerName_controls &&
aName != sUNO_LayerName_measurelines)
{
TabBarPageBits nBits = TabBarPageBits::NONE;
SdrPageView* pPV = mpDrawView->GetSdrPageView(); if (pPV)
{ if (!pPV->IsLayerVisible(aName))
{
nBits |= TabBarPageBits::Blue;
} if (pPV->IsLayerLocked(aName))
{
nBits |= TabBarPageBits::Italic;
} if (!pPV->IsLayerPrintable(aName))
{
nBits |= TabBarPageBits::Underline;
}
}
pLayerBar->InsertPage(nLayerPos+1, aName, nBits); // why +1? It is a nId, not a position. Position is APPEND.
}
} else
{ // don't show masterpage layer onto the page if (aName != sUNO_LayerName_background_objects)
{
TabBarPageBits nBits = TabBarPageBits::NONE; if (!mpDrawView->GetSdrPageView()->IsLayerVisible(aName))
{
nBits = TabBarPageBits::Blue;
} if (mpDrawView->GetSdrPageView()->IsLayerLocked(aName))
{
nBits |= TabBarPageBits::Italic;
} if (!mpDrawView->GetSdrPageView()->IsLayerPrintable(aName))
{
nBits |= TabBarPageBits::Underline;
}
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.