/* -*- 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 .
*/
case SID_ATTR_METRIC:
{ const SfxUInt16Item* pItem; if ( pSet && (pItem = pSet->GetItemIfSet( SID_ATTR_METRIC ) ) )
{
FieldUnit eUnit = static_cast<FieldUnit>(pItem->GetValue()); switch( eUnit )
{ case FieldUnit::MM: // only the units which are also in the dialog case FieldUnit::CM: case FieldUnit::INCH: case FieldUnit::PICA: case FieldUnit::POINT:
{
::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if(pDocSh)
{
DocumentType eDocType = pDocSh->GetDoc()->GetDocumentType();
case SID_NEWSD:
{
SfxFrame* pFrame = ExecuteNewDocument( rReq ); // if a frame was created, set it as return value if(pFrame)
rReq.SetReturnValue(SfxFrameItem(0, pFrame));
}
break;
case SID_OPENHYPERLINK: case SID_OPENDOC:
{ bool bIntercept = false;
::sd::DrawDocShell* pDocShell = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() );
::sd::ViewShell* pViewShell = pDocShell ? pDocShell->GetViewShell() : nullptr; if (pViewShell)
{ if( sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() )
&& !sd::SlideShow::IsInteractiveSlideshow( &pViewShell->GetViewShellBase() ) ) // IASS
{ // Prevent documents from opening while the slide // show is running, except when this request comes // from a shape interaction. if (rReq.GetArgs() == nullptr)
{
bIntercept = true;
}
}
}
if (!bIntercept)
{ if (const SfxStringItem* pURLItem = rReq.GetArg<SfxStringItem>(SID_FILE_NAME))
{ if (!pViewShell || !SfxObjectShell::AllowedLinkProtocolFromDocument(pURLItem->GetValue(),
pViewShell->GetObjectShell(),
pViewShell->GetFrameWeld()))
{ return;
}
}
SfxGetpApp()->ExecuteSlot(rReq, SfxGetpApp()->GetInterface());
} else
{
std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(rReq.GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_CANT_PERFORM_IN_LIVEMODE)));
if (pViewSh && pDoc)
{ // AutoLayouts have to be finished
pDoc->StopWorkStartupDelay();
if (SfxViewFrame* pViewFrame = pViewSh->GetViewFrame())
{ // When the view frame has not been just created we have // to switch synchronously to the outline view. // (Otherwise the request will be ignored anyway.)
::sd::ViewShellBase* pBase
= dynamic_cast< ::sd::ViewShellBase*>(pViewFrame->GetViewShell()); if (pBase != nullptr)
{
std::shared_ptr<FrameworkHelper> pHelper (
FrameworkHelper::Instance(*pBase));
pHelper->RequestView(
FrameworkHelper::msOutlineViewURL,
FrameworkHelper::msCenterPaneURL);
// state of SID_OPENDOC is determined by the base class if (rItemSet.GetItemState(SID_OPENDOC) != SfxItemState::UNKNOWN)
{ const SfxPoolItemHolder aItem(SfxGetpApp()->GetSlotState(SID_OPENDOC, SfxGetpApp()->GetInterface())); if (aItem)
rItemSet.Put(*aItem.getItem());
}
// state of SID_OPENHYPERLINK is determined by the base class if (rItemSet.GetItemState(SID_OPENHYPERLINK) != SfxItemState::UNKNOWN)
{ const SfxPoolItemHolder aItem(SfxGetpApp()->GetSlotState(SID_OPENHYPERLINK, SfxGetpApp()->GetInterface())); if (aItem)
rItemSet.Put(*aItem.getItem());
}
// #i97925# start the presentation if and only if an Impress document is focused if( pViewShell && (pDocShell->GetDocumentType() == DocumentType::Impress) )
pViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION );
} break;
} default:
pMediaData->SetPassThroughToOS(true); break;
}
}
//check whether we should load a template document
OUString aStandardTemplate( SfxObjectFactory::GetStandardTemplate( u"com.sun.star.presentation.PresentationDocument" ) );
if (bStartWithTemplate)
{ //Launch TemplateSelectionDialog
SfxTemplateSelectionDlg aTemplDlg(SfxGetpApp()->GetTopWindow());
aTemplDlg.run();
//check to disable the dialog
pOpt->SetStartWithTemplate( aTemplDlg.IsStartWithTemplate() );
//pFrame is loaded with the desired template if (!aTemplDlg.getTemplatePath().isEmpty())
pFrame = CreateFromTemplate(aTemplDlg.getTemplatePath(), xTargetFrame, false);
// show tip-of-the-day dialog if it was deferred because SfxTemplateSelectionDlg // was open if (pFrame && SfxApplication::IsTipOfTheDayDue() && !SfxApplication::IsHeadlessOrUITest())
{ if (SfxDispatcher* pDispatcher = GetDispatcher())
{ // tdf#127946 pass in argument for dialog parent
SfxUnoFrameItem aDocFrame(SID_FILLFRAME, pFrame->GetFrameInterface());
pDispatcher->ExecuteList(SID_TIPOFTHEDAY, SfxCallMode::SLOT, {}, { &aDocFrame });
}
}
}
}
OutlineToImpressFinalizer::OutlineToImpressFinalizer (
::sd::ViewShellBase& rBase,
SdDrawDocument& rDocument,
css::uno::Sequence<sal_Int8> const & rBytes)
: mrBase(rBase),
mrDocument(rDocument)
{ // Create a memory stream to fill it with the content of // the original stream.
mpStream = std::make_shared<SvMemoryStream>(static_cast<void*>(const_cast<sal_Int8*>(rBytes.getConstArray())), rBytes.getLength(), StreamMode::READ);
// Rewind the memory stream so that in the operator() method its // content is properly read.
mpStream->Seek(STREAM_SEEK_TO_BEGIN);
}
void OutlineToImpressFinalizer::operator() (bool)
{ // Fetch the new outline view shell.
::sd::OutlineViewShell* pOutlineShell
= dynamic_cast<sd::OutlineViewShell*>(FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
if (pOutlineShell != nullptr && mpStream != nullptr)
{
sd::OutlineView* pView = static_cast<sd::OutlineView*>(pOutlineShell->GetView()); // mba: the stream can't contain any relative URLs, because we don't // have any information about a BaseURL!
pOutlineShell->ReadRtf(*mpStream);
// Call UpdatePreview once for every slide to resync the // document with the outliner of the OutlineViewShell.
sal_uInt16 nPageCount (mrDocument.GetSdPageCount(PageKind::Standard)); for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++)
{
SdPage* pPage = mrDocument.GetSdPage(nIndex, PageKind::Standard); // Make the page the actual page so that the // following UpdatePreview() call accesses the // correct paragraphs.
pView->SetActualPage(pPage);
pOutlineShell->UpdatePreview(pPage);
} // Select the first slide.
SdPage* pPage = mrDocument.GetSdPage(0, PageKind::Standard);
pView->SetActualPage(pPage);
pOutlineShell->UpdatePreview(pPage);
}
// Undo-Stack needs to be cleared, else the user may remove the // only drawpage and this is a state we cannot handle ATM.
::sd::DrawDocShell* pDocShell = mrDocument.GetDocSh(); if( pDocShell )
pDocShell->ClearUndoBuffer();
}
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.