/* -*- 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 .
*/
usingnamespace ::com::sun::star::uno; usingnamespace ::com::sun::star::drawing::framework; using ::com::sun::star::frame::XFrame; using ::com::sun::star::frame::XController;
namespace sd {
/** * handle SfxRequests for controller
*/ void DrawViewShell::ExecCtrl(SfxRequest& rReq)
{ // except a page switch and jumps to bookmarks, nothing is executed during // a slide show if( HasCurrentFunction(SID_PRESENTATION) &&
rReq.GetSlot() != SID_SWITCHPAGE &&
rReq.GetSlot() != SID_JUMPTOMARK) return;
CheckLineTo (rReq);
// End text edit mode for some requests.
sal_uInt16 nSlot = rReq.GetSlot(); bool bAllowFocusChange = true; switch (nSlot)
{ case SID_OUTPUT_QUALITY_COLOR: case SID_OUTPUT_QUALITY_GRAYSCALE: case SID_OUTPUT_QUALITY_BLACKWHITE: case SID_OUTPUT_QUALITY_CONTRAST: // Do nothing. break; case SID_SWITCHPAGE: if (rReq.GetArgs() && rReq.GetArgs()->Count () == 1)
{ const SfxBoolItem* pAllowFocusChange = rReq.GetArg<SfxBoolItem>(SID_SWITCHPAGE);
bAllowFocusChange = pAllowFocusChange->GetValue(); if (!bAllowFocusChange) break;
}
[[fallthrough]]; default: if ( mpDrawView->IsTextEdit() )
{
mpDrawView->SdrEndTextEdit();
}
}
case SID_HEADER_AND_FOOTER: case SID_INSERT_PAGE_NUMBER: case SID_INSERT_DATE_TIME:
{
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
vcl::Window* pWin = GetActiveWindow();
VclPtr<AbstractHeaderFooterDialog> pDlg(pFact->CreateHeaderFooterDialog(*this, pWin ? pWin->GetFrameWeld() : nullptr, GetDoc(), mpActualPage)); auto xRequest = std::make_shared<SfxRequest>(rReq);
rReq.Ignore(); // the 'old' request is not relevant any more
pDlg->StartExecuteAsync([this, pDlg, xRequest=std::move(xRequest)](sal_Int32 /*nResult*/){
GetActiveWindow()->Invalidate();
UpdatePreview( mpActualPage );
Invalidate();
xRequest->Done();
pDlg->disposeOnce();
}); break;
}
case SID_MASTER_LAYOUTS:
{
SdPage* pPage = GetActualPage(); if (meEditMode == EditMode::MasterPage) // Use the master page of the current page.
pPage = static_cast<SdPage*>(&pPage->TRG_GetMasterPage());
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
vcl::Window* pWin = GetActiveWindow();
ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateMasterLayoutDialog(pWin ? pWin->GetFrameWeld() : nullptr, GetDoc(), pPage));
pDlg->Execute();
Invalidate();
rReq.Done (); break;
} case SID_OBJECTRESIZE:
{ // The server likes to change the client size
OSL_ASSERT (GetViewShell()!=nullptr);
SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient();
// Save the current configuration of panes and views.
DrawController* pDrawController = GetViewShellBase().GetDrawController(); if (pDrawController)
{
Reference<XConfigurationController> xConfigurationController (
pDrawController->getConfigurationController(), UNO_SET_THROW );
Reference<XConfiguration> xConfiguration (
xConfigurationController->getRequestedConfiguration(), UNO_SET_THROW );
// normal forwarding to ViewFrame for execution
GetViewFrame()->ExecuteSlot(rReq);
// From here on we must cope with this object and the frame already being // deleted. Do not call any methods or use data members.
Reference<XController> xController( xFrame->getController(), UNO_SET_THROW );
case SID_OUTPUT_QUALITY_COLOR: case SID_OUTPUT_QUALITY_GRAYSCALE: case SID_OUTPUT_QUALITY_BLACKWHITE: case SID_OUTPUT_QUALITY_CONTRAST:
{
ExecReq( rReq ); break;
}
case SID_MAIL_SCROLLBODY_PAGEDOWN:
{
ExecReq( rReq ); break;
}
case SID_ATTR_YEAR2000:
{
FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell(); if (pFormShell != nullptr)
{ const SfxPoolItem* pItem; if (rReq.GetArgs()->GetItemState(
SID_ATTR_YEAR2000, true, &pItem) == SfxItemState::SET)
pFormShell->SetY2KState ( static_cast<const SfxUInt16Item*>(pItem)->GetValue());
}
rReq.Done();
} break;
case SID_OPT_LOCALE_CHANGED:
{
GetActiveWindow()->Invalidate();
UpdatePreview( mpActualPage );
rReq.Done();
} break;
case SID_REGENERATE_DIAGRAM: case SID_EDIT_DIAGRAM:
{ if (1 == rMarkList.GetMarkCount())
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
sal_uInt16 i; for ( i = 0; i < nPageCnt; i++)
{
SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
SdUndoAction* pUndo = new SdPageLRUndoAction(*GetDoc(),
pPage,
pPage->GetLeftBorder(),
pPage->GetRightBorder(),
nLeft, nRight);
pUndoGroup->AddAction(pUndo);
pPage->SetLeftBorder(nLeft);
pPage->SetRightBorder(nRight);
}
nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
SdUndoAction* pUndo = new SdPageLRUndoAction(*GetDoc(),
pPage,
pPage->GetLeftBorder(),
pPage->GetRightBorder(),
nLeft, nRight);
pUndoGroup->AddAction(pUndo);
pPage->SetLeftBorder(nLeft);
pPage->SetRightBorder(nRight);
}
InvalidateWindows();
}
// give the undo group to the undo manager
GetViewFrame()->GetObjectShell()->GetUndoManager()->
AddUndoAction(std::move(pUndoGroup));
} break; case SID_ATTR_LONG_ULSPACE: if (pArgs)
{
std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup(*GetDoc()));
pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
sal_uInt16 i; for ( i = 0; i < nPageCnt; i++)
{
SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
SdUndoAction* pUndo = new SdPageULUndoAction(*GetDoc(),
pPage,
pPage->GetUpperBorder(),
pPage->GetLowerBorder(),
nUpper, nLower);
pUndoGroup->AddAction(pUndo);
pPage->SetUpperBorder(nUpper);
pPage->SetLowerBorder(nLower);
}
nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
SdUndoAction* pUndo = new SdPageULUndoAction(*GetDoc(),
pPage,
pPage->GetUpperBorder(),
pPage->GetLowerBorder(),
nUpper, nLower);
pUndoGroup->AddAction(pUndo);
pPage->SetUpperBorder(nUpper);
pPage->SetLowerBorder(nLower);
}
InvalidateWindows();
}
// give the undo group to the undo manager
GetViewFrame()->GetObjectShell()->GetUndoManager()->
AddUndoAction(std::move(pUndoGroup));
} break; case SID_RULER_OBJECT: if (pArgs)
{
::tools::Rectangle aRect = maMarkRect;
aRect.SetPos(aRect.TopLeft() + aPagePos);
const SvxObjectItem& rOI = pArgs->Get(SID_RULER_OBJECT);
// left margin gets distributed onto LRSpace item // and number format AbsLSpace - this fixes // n#707779 (previously, LRSpace left indent could // become negative - EditEngine really does not // like that. constauto nAbsLSpace=aFormat.GetAbsLSpace(); const ::tools::Long nTxtLeft = rItem.ResolveTextLeft({}); const ::tools::Long nLeftIndent=std::max(::tools::Long(0),nTxtLeft - nAbsLSpace);
aLRSpaceItem.SetTextLeft(SvxIndentValue::twips(nLeftIndent)); // control for clipped left indent - remainder // reduces number format first line indent
aFormat.SetAbsLSpace(nTxtLeft - nLeftIndent);
// negative first line indent goes to the number // format, positive to the lrSpace item if (rItem.GetTextFirstLineOffset().m_dValue < 0.0)
{
aFormat.SetFirstLineOffset(rItem.ResolveTextFirstLineOffset({})
- rOrigLRSpaceItem.ResolveTextFirstLineOffset({})
+ aFormat.GetCharTextDistance());
aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::zero());
} else
{
aFormat.SetFirstLineOffset(0);
aLRSpaceItem.SetTextFirstLineOffset(SvxIndentValue::twips(
rItem.ResolveTextFirstLineOffset({}) - aFormat.GetFirstLineOffset()
+ aFormat.GetCharTextDistance()));
}
if( rFormat != aFormat )
{ // put all items const_cast<SvxNumRule&>(rNumBulletItem.GetNumRule()).SetLevel(nOutlineLevel,aFormat);
aEditAttr.Put( rNumBulletItem );
aEditAttr.Put( aLRSpaceItem );
mpDrawView->SetAttributes( aEditAttr );
Invalidate(SID_ATTR_PARA_LRSPACE); break;
}
}
// only put lrSpace item
SfxItemSetFixed<EE_PARA_LRSPACE, EE_PARA_LRSPACE> aEditAttrReduced( GetDoc()->GetPool() );
aEditAttrReduced.Put( aLRSpaceItem );
mpDrawView->SetAttributes( aEditAttrReduced );
Invalidate(SID_ATTR_PARA_LRSPACE);
} break;
}
}
void DrawViewShell::GetRulerState(SfxItemSet& rSet)
{
Point aOrigin;
if (mpDrawView->GetSdrPageView())
{
aOrigin = mpDrawView->GetSdrPageView()->GetPageOrigin();
}
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.