class ViewShellObjectBarFactory
: public ::sd::ShellFactory<SfxShell>
{ public: explicit ViewShellObjectBarFactory (::sd::ViewShell& rViewShell); virtual SfxShell* CreateShell( ::sd::ShellId nId ) override; virtualvoid ReleaseShell (SfxShell* pShell) override; private:
::sd::ViewShell& mrViewShell;
};
} // end of anonymous namespace
namespace sd {
/// When true, scrolling to bottom of a page switches to the next page. bool ViewShell::CanPanAcrossPages() const
{ returndynamic_cast<const DrawViewShell*>(this) && mpContentWindow &&
mpContentWindow->GetVisibleHeight() < 1.0;
}
// Re-initialize the spell dialog.
::sd::SpellDialogChildWindow* pSpellDialog = static_cast< ::sd::SpellDialogChildWindow*> (
GetViewFrame()->GetChildWindow (
::sd::SpellDialogChildWindow::GetChildWindowId())); if (pSpellDialog != nullptr)
pSpellDialog->InvalidateSpellDialog();
// Register the sub shell factory.
mpImpl->mpSubShellFactory = std::make_shared<ViewShellObjectBarFactory>(*this);
GetViewShellBase().GetViewShellManager()->AddSubShellFactory(this,mpImpl->mpSubShellFactory);
}
ViewShell::~ViewShell()
{ // Keep the content window from accessing in its destructor the // WindowUpdater. if (mpContentWindow)
suppress_fun_call_w_exception(mpContentWindow->SetViewShell(nullptr));
mpZoomList.reset();
mpLayerTabBar.disposeAndClear();
if (mpImpl->mpSubShellFactory)
GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory( this,mpImpl->mpSubShellFactory);
if (mpContentWindow)
{
SAL_INFO( "sd.view", "destroying mpContentWindow at " << mpContentWindow.get()
<< " with parent " << mpContentWindow->GetParent());
mpContentWindow.disposeAndClear();
}
if (IsMainViewShell())
GetDocSh()->Disconnect(this);
SetIsMainViewShell(false);
}
/** *setfocustoworkingwindow
*/ void ViewShell::Activate(bool bIsMDIActivate)
{ // Do not forward to SfxShell::Activate()
/* According to MI, nobody is allowed to call GrabFocus, who does not exactlyknowfromwhichwindowthefocusisgrabbed.SinceActivate() issentsometimesasynchronous,itcanhappen,thatthewrongwindow
gets the focus. */
if (mpHorizontalRuler)
mpHorizontalRuler->SetActive(); if (mpVerticalRuler)
mpVerticalRuler->SetActive();
if (bIsMDIActivate)
{ // thus, the Navigator will also get a current status
SfxBoolItem aItem( SID_NAVIGATOR_INIT, true ); if (GetDispatcher() != nullptr)
{
SfxCallMode nCall = SfxCallMode::RECORD; if (comphelper::LibreOfficeKit::isActive())
{ // Make sure the LOK case doesn't dispatch async events while switching views, that // would lead to a loop, see SfxHintPoster::DoEvent_Impl().
nCall |= SfxCallMode::SYNCHRON;
} else
{
nCall |= SfxCallMode::ASYNCHRON;
}
GetDispatcher()->ExecuteList(
SID_NAVIGATOR_INIT,
nCall,
{ &aItem });
}
void ViewShell::Deactivate(bool bIsMDIActivate)
{ // remove view from a still active drag'n'drop session
SdTransferable* pDragTransferable = SdModule::get()->pTransferDrag;
if (IsMainViewShell())
GetDocSh()->Disconnect(this);
if (mpHorizontalRuler)
mpHorizontalRuler->SetActive(false); if (mpVerticalRuler)
mpVerticalRuler->SetActive(false);
SfxShell::Deactivate(bIsMDIActivate);
}
void ViewShell::BroadcastContextForActivation(constbool bIsActivated)
{ auto getFrameworkResourceIdForShell
= [&]() -> uno::Reference<drawing::framework::XResourceId> const
{
DrawController* pDrawController = GetViewShellBase().GetDrawController(); if (!pDrawController) return {};
Reference<::css::drawing::framework::XConfigurationController> xConfigurationController
= pDrawController->getConfigurationController(); if (!xConfigurationController.is()) return {};
Reference<::css::drawing::framework::XConfiguration> xConfiguration
= xConfigurationController->getCurrentConfiguration(); if (!xConfiguration.is()) return {};
auto aResIdsIndirect
= xConfiguration->getResources({}, "", drawing::framework::AnchorBindingMode_INDIRECT);
for (const uno::Reference<drawing::framework::XResourceId>& rResId : aResIdsIndirect)
{ auto pFrameworkHelper = framework::FrameworkHelper::Instance(GetViewShellBase());
uno::Reference<drawing::framework::XView> xView; if (rResId->getResourceURL().match(framework::FrameworkHelper::msViewURLPrefix))
{
xView.set(xConfigurationController->getResource(rResId), UNO_QUERY);
if (xView.is())
{ if (auto pViewShellWrapper = dynamic_cast<framework::ViewShellWrapper*>(xView.get()))
{ if (pViewShellWrapper->GetViewShell().get() == this)
{ return rResId;
}
}
}
}
} return {};
};
if (bIsActivated)
{
GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
EventMultiplexerEventId::FocusShifted, nullptr, getFrameworkResourceIdForShell());
}
if (GetDispatcher())
SfxShell::BroadcastContextForActivation(bIsActivated);
}
void ViewShell::Shutdown()
{ Exit ();
}
// IASS: Check if commands should be used for SlideShow // This is the case when IASS is on, SlideShow is active // and the SlideShow Window has the focus bool ViewShell::useInputForSlideShow() const
{
rtl::Reference< SlideShow > xSlideShow(SlideShow::GetSlideShow(GetViewShellBase()));
if (!xSlideShow.is()) // no SlideShow, do not use returnfalse;
if (!xSlideShow->isRunning()) // SlideShow not running, do not use returnfalse;
if(!xSlideShow->IsInteractiveSlideshow()) // if IASS is deactivated, do what was done before when // SlideSHow is running: use for SlideShow returntrue;
// else, check if SlideShow Window has the focus
OutputDevice* pShOut(xSlideShow->getShowWindow());
vcl::Window* pShWin(pShOut ? pShOut->GetOwnerWindow() : nullptr);
// return true if we got the SlideShow Window and it has the focus return nullptr != pShWin && pShWin->HasFocus();
}
// give key input first to SfxViewShell to give CTRL+Key // (e.g. CTRL+SHIFT+'+', to front) priority.
OSL_ASSERT(GetViewShell() != nullptr);
bReturn = GetViewShell()->KeyInput(rKEvt);
void ViewShell::MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin)
{ // We have to lock tool bar updates while the mouse button is pressed in // order to prevent the shape under the mouse to be moved (this happens // when the number of docked tool bars changes as result of a changed // selection; this changes the window size and thus the mouse position // in model coordinates: with respect to model coordinates the mouse // moves.)
OSL_ASSERT(mpImpl->mpUpdateLockForMouse.expired());
mpImpl->mpUpdateLockForMouse = ViewShell::Implementation::ToolBarManagerLock::Create(
GetViewShellBase().GetToolBarManager());
if ( pWin && !pWin->HasFocus() )
{
pWin->GrabFocus();
SetActiveWindow(pWin);
}
::sd::View* pView = GetView(); if (!pView) return;
// insert MouseEvent into E3dView
pView->SetMouseEvent(rMEvt);
SetZoom( nNewZoom ); // Keep mouse at same doc point before zoom
Point aNewMousePos = GetActiveWindow()->PixelToLogic(rCEvt.GetMousePosPixel());
SetWinViewPos(GetWinViewPos() - (aNewMousePos - aOldMousePos));
// Keep mouse at same doc point before zoom
Point aNewMousePos = GetActiveWindow()->PixelToLogic(rCEvt.GetMousePosPixel());
SetWinViewPos(GetWinViewPos() - (aNewMousePos - aOldMousePos));
// Place horizontal ruler below tab bar. if (mbHasRulers && mpContentWindow)
{
SetupRulers(); if (mpHorizontalRuler)
aBorder.Top() = mpHorizontalRuler->GetSizePixel().Height(); if (mpVerticalRuler)
aBorder.Left() = mpVerticalRuler->GetSizePixel().Width();
}
return aBorder;
}
void ViewShell::ArrangeGUIElements()
{ if (mpImpl->mbArrangeActive) return; if (maViewSize.IsEmpty()) return;
mpImpl->mbArrangeActive = true;
// The size of the window of the center pane is set differently from // that of the windows in the docking windows. bool bSlideShowActive = (xSlideShow.is() && xSlideShow->isRunning()) //IASS
&& !xSlideShow->isFullScreen() && xSlideShow->getAnimationMode() == ANIMATIONMODE_SHOW; if ( !bSlideShowActive)
{
OSL_ASSERT (GetViewShell()!=nullptr);
if (mpContentWindow)
mpContentWindow->SetPosSizePixel(
Point(nLeft,nTop),
Size(nRight-nLeft,nBottom-nTop));
}
// Windows in the center and rulers at the left and top side.
maAllWindowRectangle = ::tools::Rectangle(
maViewPos,
Size(maViewSize.Width()-maScrBarWH.Width(),
maViewSize.Height()-maScrBarWH.Height()));
if (mpContentWindow)
mpContentWindow->UpdateMapOrigin();
UpdateScrollBars();
mpImpl->mbArrangeActive = false;
}
void ViewShell::SetUIUnit(FieldUnit eUnit)
{ // Set unit at horizontal and vertical rulers. if (mpHorizontalRuler)
mpHorizontalRuler->SetUnit(eUnit);
if (mpVerticalRuler)
mpVerticalRuler->SetUnit(eUnit);
}
/** Tell the FmFormShell that the view shell is closing. Give it the opportunitytopreventthat.
*/ bool ViewShell::PrepareClose (bool bUI)
{ bool bResult = true;
void ViewShell::UpdatePreview (SdPage*)
{ // Do nothing. After the actual preview has been removed, // OutlineViewShell::UpdatePreview() is the place where something // useful is still done.
}
sal_uInt16 nCount(pUndoManager->GetUndoActionCount()); if(nCount)
{ // prepare list
std::vector<OUString> aStringList;
aStringList.reserve(nCount); for (sal_uInt16 a = 0; a < nCount; ++a)
{ // generate one String in list per undo step
aStringList.push_back( pUndoManager->GetUndoActionComment(a) );
}
sal_uInt16 nCount(pUndoManager->GetRedoActionCount()); if(nCount)
{ // prepare list
::std::vector< OUString > aStringList;
aStringList.reserve(nCount); for(sal_uInt16 a = 0; a < nCount; a++) // generate one String in list per undo step
aStringList.push_back( pUndoManager->GetRedoActionComment(a) );
// Repair mode: allow undo/redo of all undo actions, even if access would // be limited based on the view shell ID. if (const SfxBoolItem* pRepairItem = pReqArgs->GetItemIfSet(SID_REPAIRPACKAGE, false))
bRepair = pRepairItem->GetValue();
}
if(nNumber && pUndoManager)
{
sal_uInt16 nCount(pUndoManager->GetUndoActionCount()); if(nCount >= nNumber)
{ if (comphelper::LibreOfficeKit::isActive() && !bRepair)
{ // If another view created the first undo action, prevent redoing it from this view. const SfxUndoAction* pAction = pUndoManager->GetUndoAction(); if (pAction->GetViewShellId() != GetViewShellBase().GetViewShellId())
{
rReq.SetReturnValue(SfxUInt32Item(SID_UNDO, static_cast<sal_uInt32>(SID_REPAIRPACKAGE))); return;
}
}
try
{ // when UndoStack is cleared by ModifyPageUndoAction // the nCount may have changed, so test GetUndoActionCount() while (nNumber && pUndoManager->GetUndoActionCount())
{
pUndoManager->Undo();
--nNumber;
}
} catch( const Exception& )
{ // no need to handle. By definition, the UndoManager handled this by clearing the // Undo/Redo stacks
}
}
// refresh rulers, maybe UNDO was move of TAB marker in ruler if (mbHasRulers)
Invalidate(SID_ATTR_TABSTOP);
}
// This one is corresponding to the default handling // of SID_UNDO in sfx2
GetViewFrame()->GetBindings().InvalidateAll(false);
rReq.Done();
}
void ViewShell::ImpSidRedo(SfxRequest& rReq)
{ //The xWatcher keeps the SlideSorter selection in sync //with the page insertions/deletions that Undo may introduce
std::unique_ptr<KeepSlideSorterInSyncWithPageChanges, o3tl::default_delete<KeepSlideSorterInSyncWithPageChanges>> xWatcher;
slidesorter::SlideSorterViewShell* pSlideSorterViewShell
= slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase()); if (pSlideSorterViewShell)
xWatcher.reset(new KeepSlideSorterInSyncWithPageChanges(pSlideSorterViewShell->GetSlideSorter()));
if(pReqArgs)
{ const SfxUInt16Item* pUIntItem = static_cast<const SfxUInt16Item*>(&pReqArgs->Get(SID_REDO));
nNumber = pUIntItem->GetValue(); // Repair mode: allow undo/redo of all undo actions, even if access would // be limited based on the view shell ID. if (const SfxBoolItem* pRepairItem = pReqArgs->GetItemIfSet(SID_REPAIRPACKAGE, false))
bRepair = pRepairItem->GetValue();
}
if(nNumber && pUndoManager)
{
sal_uInt16 nCount(pUndoManager->GetRedoActionCount()); if(nCount >= nNumber)
{ if (comphelper::LibreOfficeKit::isActive() && !bRepair)
{ // If another view created the first undo action, prevent redoing it from this view. const SfxUndoAction* pAction = pUndoManager->GetRedoAction(); if (pAction->GetViewShellId() != GetViewShellBase().GetViewShellId())
{
rReq.SetReturnValue(SfxUInt32Item(SID_REDO, static_cast<sal_uInt32>(SID_REPAIRPACKAGE))); return;
}
}
try
{ // when UndoStack is cleared by ModifyPageRedoAction // the nCount may have changed, so test GetRedoActionCount() while (nNumber && pUndoManager->GetRedoActionCount())
{
pUndoManager->Redo();
--nNumber;
}
} catch( const Exception& )
{ // no need to handle. By definition, the UndoManager handled this by clearing the // Undo/Redo stacks
}
}
// refresh rulers, maybe REDO was move of TAB marker in ruler if (mbHasRulers)
{
Invalidate(SID_ATTR_TABSTOP);
}
}
// This one is corresponding to the default handling // of SID_UNDO in sfx2
GetViewFrame()->GetBindings().InvalidateAll(false);
case SID_OUTPUT_QUALITY_COLOR: case SID_OUTPUT_QUALITY_GRAYSCALE: case SID_OUTPUT_QUALITY_BLACKWHITE: case SID_OUTPUT_QUALITY_CONTRAST:
{
DrawModeFlags nMode = OUTPUT_DRAWMODE_COLOR;
switch( nSlot )
{ case SID_OUTPUT_QUALITY_COLOR: nMode = OUTPUT_DRAWMODE_COLOR; break; case SID_OUTPUT_QUALITY_GRAYSCALE: nMode = OUTPUT_DRAWMODE_GRAYSCALE; break; case SID_OUTPUT_QUALITY_BLACKWHITE: nMode = OUTPUT_DRAWMODE_BLACKWHITE; break; case SID_OUTPUT_QUALITY_CONTRAST: nMode = OUTPUT_DRAWMODE_CONTRAST; break;
}
/** This default implementation returns only an empty reference. See derived classesformoreinterestingexamples.
*/
css::uno::Reference<css::accessibility::XAccessible>
ViewShell::CreateAccessibleDocumentView (::sd::Window* )
{
OSL_FAIL("ViewShell::CreateAccessibleDocumentView should not be called!, perhaps Meyers, 3rd edition, Item 9:");
/** this method deactivates the current function. If an old function is saved,thiswillbecomeactivatedandcurrentfunction.
*/ void ViewShell::Cancel()
{ if(mxCurrentFunction.is() && (mxCurrentFunction != mxOldFunction ))
{
rtl::Reference<FuPoor> xTemp( mxCurrentFunction );
mxCurrentFunction.clear();
xTemp->Deactivate();
xTemp->Dispose();
}
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.