class ViewShellBase::Implementation
{ public:
SdViewOptions maViewOptions;
/** Main controller of the view shell. During the switching from one stackedshelltoanotherthispointermaybeNULL.
*/
::rtl::Reference<DrawController> mpController;
/** The view tab bar is the control for switching between different viewsinonepane.
*/
::rtl::Reference<ViewTabBar> mpViewTabBar;
// contains the complete area of the current view relative to the frame window
::tools::Rectangle maClientArea;
// This is set to true when PrepareClose() is called. bool mbIsClosing;
/** The view window is the parent of all UI elements that belong to the vieworViewShell.Thiscomprisestherulers,thescrollbars,and thecontentwindow. ItdoesnotincludetheViewTabBar.
*/
VclPtr<vcl::Window> mpViewWindow;
std::shared_ptr<ToolBarManager> mpToolBarManager;
std::shared_ptr<ViewShellManager> mpViewShellManager;
std::shared_ptr<tools::EventMultiplexer> mpEventMultiplexer;
std::shared_ptr<FormShellManager> mpFormShellManager;
/** Common code of ViewShellBase::OuterResizePixel() and ViewShellBase::InnerResizePixel().
*/ void ResizePixel ( const Point& rOrigin, const Size& rSize, bool bOuterResize);
/** Show or hide the specified pane. The visibility state is taken fromthegivenrequest. @paramrRequest Therequestdeterminesthenewvisibilitystate.Thestatecan eitherbetoggledorbesettoagivenvalue. @paramrsPaneURL ThisURLspecifiesthepanewhosevisibilitystatetoset. @paramrsViewURL WhenthepanebecomesvisiblethenthisviewURLspecifieswhich typeofviewtoshowinit.
*/ void SetPaneVisibility ( const SfxRequest& rRequest, const OUString& rsPaneURL, const OUString& rsViewURL);
void GetSlotState (SfxItemSet& rSet);
void ProcessRestoreEditingViewSlot();
private:
ViewShellBase& mrBase; bool mbUserWantsTabBar; bool mbTabBarShouldBeVisible; /** Hold a reference to the page cache manager of the slide sorter in ordertoensurethatitstaysalivewhiletheViewShellBaseis alive.
*/
std::shared_ptr<slidesorter::cache::PageCacheManager> mpPageCacheManager;
};
namespace { /** The only task of this window is to forward key presses to the content windowofthemainviewshell.Withthekeypressitforwardsthefocus sothatitisnotcalledveryoften.
*/ class FocusForwardingWindow : public vcl::Window
{ public:
FocusForwardingWindow (vcl::Window& rParentWindow, ViewShellBase& rBase); virtual ~FocusForwardingWindow() override; virtualvoid dispose() override; virtualvoid KeyInput (const KeyEvent& rEvent) override; virtualvoid Command (const CommandEvent& rEvent) override;
private:
ViewShellBase& mrBase;
};
} // end of anonymous namespace
// Set up the members in the correct order. if (auto pDrawDocShell = dynamic_cast< DrawDocShell *>( GetViewFrame().GetObjectShell() ))
mpDocShell = pDrawDocShell; if (mpDocShell != nullptr)
mpDocument = mpDocShell->GetDoc();
mpImpl->mpViewShellManager = std::make_shared<ViewShellManager>(*this);
SetWindow(mpImpl->mpViewWindow.get());
// Hide the window to avoid complaints from Sfx...SwitchViewShell...
_rFrame.GetWindow().Hide();
}
/** In this destructor the order in which some of the members are destroyed (and/orbeingpreparedtobeingdestroyed)isimportant.Changeitonly whenyouknowwhatyouaredoing.
*/
ViewShellBase::~ViewShellBase()
{ // Notify other LOK views that we are going away.
SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", "false"_ostr);
SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", ""_ostr);
SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY"_ostr);
rtl::Reference<SlideShow> xSlideShow(SlideShow::GetSlideShow(*this)); if (xSlideShow.is() && xSlideShow->dependsOn(this))
SlideShow::Stop(*this);
xSlideShow.clear();
// Tell the controller that the ViewShellBase is not available anymore. if (mpImpl->mpController)
mpImpl->mpController->ReleaseViewShellBase();
// We have to hide the main window to prevent SFX complaining after a // reload about it being already visible.
ViewShell* pShell = GetMainViewShell().get(); if (pShell!=nullptr
&& pShell->GetActiveWindow()!=nullptr
&& pShell->GetActiveWindow()->GetParent()!=nullptr)
{
pShell->GetActiveWindow()->GetParent()->Hide();
}
try
{
rtl::Reference<::sd::DrawController> xControllerManager (GetDrawController());
Reference<XConfigurationController> xConfigurationController; if (xControllerManager)
xConfigurationController = xControllerManager->getConfigurationController(); if (xConfigurationController.is())
{
OUString sView (rsDefaultView); if (sView.isEmpty())
sView = GetInitialViewShellType();
FrameworkHelper::Instance(*this);
// Create the resource ids for the center pane and view. const Reference<drawing::framework::XResourceId> xCenterPaneId (
FrameworkHelper::CreateResourceId(FrameworkHelper::msCenterPaneURL)); const Reference<drawing::framework::XResourceId> xCenterViewId (
FrameworkHelper::CreateResourceId(sView, xCenterPaneId));
// Request center pane and view.
xConfigurationController->requestResourceActivation(xCenterPaneId, ResourceActivationMode_ADD);
xConfigurationController->requestResourceActivation(xCenterViewId, ResourceActivationMode_REPLACE);
// Process configuration events synchronously until the center view // has been created.
sd::framework::ConfigurationController* pConfigurationController
= dynamic_cast<sd::framework::ConfigurationController*>(xConfigurationController.get()); if (pConfigurationController != nullptr)
{ while (
! pConfigurationController->getResource(xCenterViewId).is()
&& pConfigurationController->hasPendingRequests())
{
pConfigurationController->ProcessEvent();
}
}
}
} catch (const RuntimeException&)
{
}
// AutoLayouts have to be ready.
GetDocument()->StopWorkStartupDelay();
UpdateBorder();
// Remember the type of the current main view shell in the frame view.
ViewShell* pViewShell = GetMainViewShell().get(); if (pViewShell != nullptr)
{
FrameView* pFrameView = pViewShell->GetFrameView(); if (pFrameView != nullptr)
pFrameView->SetViewShellTypeOnLoad(pViewShell->GetShellType());
} // Show/Hide the TabBar
SdOptions* pOptions = SdModule::get()->GetSdOptions(GetDocument()->GetDocumentType()); bool bIsTabBarVisible = pOptions->IsTabBarVisible();
mpImpl->SetUserWantsTabBar( bIsTabBarVisible );
}
if (pViewFrame != nullptr)
{ // Get the view shell for the frame and cast it to // sd::ViewShellBase.
SfxViewShell* pSfxViewShell = pViewFrame->GetViewShell();
pBase = dynamic_cast< ::sd::ViewShellBase *>( pSfxViewShell );
}
void ViewShellBase::Rearrange()
{ // There is a bug in the communication between embedded objects and the // framework::LayoutManager that leads to missing resize updates. The // following workaround enforces such an update by cycling the border to // zero and back to the current value. if (GetWindow() != nullptr)
{
SetBorderPixel(SvBorder());
UpdateBorder(true);
} else
{
SAL_WARN("sd.view", "Rearrange: window missing");
}
Reference<view::XRenderable> ViewShellBase::GetRenderable()
{ // Create a new DocumentRenderer on every call. It observes the life // time of this ViewShellBase object. return Reference<view::XRenderable>(new DocumentRenderer(*this));
}
// draw case SID_DRAWINGMODE: // impress normal case SID_NORMAL_MULTI_PANE_GUI: case SID_NOTES_MODE: case SID_OUTLINE_MODE: case SID_SLIDE_SORTER_MULTI_PANE_GUI: case SID_SLIDE_SORTER_MODE: // impress master case SID_SLIDE_MASTER_MODE: case SID_NOTES_MASTER_MODE: case SID_HANDOUT_MASTER_MODE:
framework::FrameworkHelper::Instance(*this)->HandleModeChangeSlot(nSlotId, rRequest); break;
case SID_WIN_FULLSCREEN: // The full screen mode is not supported. Ignore the request. break;
case SID_RESTORE_EDITING_VIEW:
mpImpl->ProcessRestoreEditingViewSlot(); break;
case SID_PROTECTPOS: case SID_PROTECTSIZE:
{
::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); if (!pDocSh) break;
::sd::View* pView = pDocSh->GetViewShell()->GetView();
void ViewShellBase::WriteUserDataSequence (
css::uno::Sequence< css::beans::PropertyValue >& rSequence)
{ // Forward call to main sub shell.
ViewShell* pShell = GetMainViewShell().get(); if (pShell != nullptr)
pShell->WriteUserDataSequence (rSequence);
}
void ViewShellBase::ReadUserDataSequence ( const css::uno::Sequence< css::beans::PropertyValue >& rSequence)
{ // Forward call to main sub shell.
ViewShell* pShell = GetMainViewShell().get(); if (pShell == nullptr) return;
pShell->ReadUserDataSequence (rSequence);
// For certain shell types ReadUserDataSequence may have changed the // type to another one. Make sure that the center pane shows the // right view shell. switch (pShell->GetShellType())
{ case ViewShell::ST_IMPRESS: case ViewShell::ST_NOTES: case ViewShell::ST_HANDOUT:
{
OUString sViewURL; switch (dynamic_cast<DrawViewShell&>(*pShell).GetPageKind())
{ default: case PageKind::Standard:
sViewURL = framework::FrameworkHelper::msImpressViewURL; break; case PageKind::Notes:
sViewURL = framework::FrameworkHelper::msNotesViewURL; break; case PageKind::Handout:
sViewURL = framework::FrameworkHelper::msHandoutViewURL; break;
} if (!sViewURL.isEmpty())
framework::FrameworkHelper::Instance(*this)->RequestView(
sViewURL,
framework::FrameworkHelper::msCenterPaneURL);
} break;
void ViewShellBase::UpdateBorder ( bool bForce /* = false */ )
{ // The following calls to SetBorderPixel() and InvalidateBorder() are // made only for the main view shell. This not only avoids unnecessary // calls for the views in side panes but prevents calling an already // dying SfxViewShell base class. // We have to check the existence of the window, too. // The SfxViewFrame accesses the window without checking it.
ViewShell* pMainViewShell = GetMainViewShell().get(); if (pMainViewShell == nullptr || GetWindow()==nullptr) return;
// Search the properties for the one that tells us what page kind to // use. auto pProperty = std::find_if(std::cbegin(aProperties), std::cend(aProperties),
[](const beans::PropertyValue& rProperty) { return rProperty.Name == sUNO_View_PageKind; }); if (pProperty != std::cend(aProperties))
{
sal_Int16 nPageKind = 0;
pProperty->Value >>= nPageKind; switch (static_cast<PageKind>(nPageKind))
{ case PageKind::Standard:
sRequestedView = FrameworkHelper::msImpressViewURL; break;
case PageKind::Handout:
sRequestedView = FrameworkHelper::msHandoutViewURL; break;
case PageKind::Notes:
sRequestedView = FrameworkHelper::msNotesViewURL; break;
default: // The page kind is invalid. This is probably an // error by the caller. We use the standard type to // keep things going.
SAL_WARN( "sd.view", "ViewShellBase::GetInitialViewShellType: invalid page kind");
sRequestedView = FrameworkHelper::msImpressViewURL; break;
}
}
} while (false);
::Color ViewShellBase::GetColorConfigColor(svtools::ColorConfigEntry nColorType) const
{
Color aColor;
const SdViewOptions& rViewOptions = GetViewOptions(); switch (nColorType)
{ case svtools::ColorConfigEntry::DOCCOLOR:
{
aColor = rViewOptions.mnDocBackgroundColor; break;
} // Should never be called for an unimplemented color type default:
{
O3TL_UNREACHABLE;
}
}
// Forward the call to both the base class and the main stacked sub // shell only when main sub shell exists.
ViewShell* pMainViewShell = mrBase.GetMainViewShell().get();
// Set the ViewTabBar temporarily to full size so that, when asked // later, it can return its true height.
mrBase.SetWindow (mpViewWindow.get()); if (mpViewTabBar.is() && mpViewTabBar->GetTabControl()->IsVisible())
mpViewTabBar->GetTabControl()->SetPosSizePixel (rOrigin, rSize);
// Calculate and set the border before the controls are placed.
SvBorder aBorder; if (pMainViewShell != nullptr)
aBorder = pMainViewShell->GetBorder();
aBorder += mrBase.GetBorder(bOuterResize); if (mrBase.GetBorderPixel() != aBorder)
mrBase.SetBorderPixel(aBorder);
// Place the ViewTabBar at the top. It is part of the border.
SvBorder aBaseBorder; if (mpViewTabBar.is() && mpViewTabBar->GetTabControl()->IsVisible())
{
aBaseBorder.Top() = mpViewTabBar->GetHeight();
mpViewTabBar->GetTabControl()->SetPosSizePixel(
rOrigin, Size(rSize.Width(),aBaseBorder.Top()));
}
// The view window gets the remaining space.
Point aViewWindowPosition (
rOrigin.X()+aBaseBorder.Left(),
rOrigin.Y()+aBaseBorder.Top());
// Set the desired visibility state at the current configuration // and update it accordingly.
Reference<XConfigurationController> xConfigurationController (
pDrawController->getConfigurationController()); if ( ! xConfigurationController.is()) throw RuntimeException(); if (bShowChildWindow)
{
xConfigurationController->requestResourceActivation(
xPaneId,
ResourceActivationMode_ADD);
xConfigurationController->requestResourceActivation(
xViewId,
ResourceActivationMode_REPLACE);
} else
xConfigurationController->requestResourceDeactivation(
xPaneId);
} catch (const Exception&)
{
DBG_UNHANDLED_EXCEPTION("sd.view");
}
}
void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
{ try
{ // Get some frequently used values.
DrawController* pDrawController(mrBase.GetDrawController()); if (!pDrawController) return;
Reference<XConfigurationController> xConfigurationController (
pDrawController->getConfigurationController()); if ( ! xConfigurationController.is()) throw RuntimeException();
Reference<XConfiguration> xConfiguration (
xConfigurationController->getRequestedConfiguration()); if ( ! xConfiguration.is()) throw RuntimeException();
if (auto pViewShell = mrBase.GetMainViewShell().get())
{
pFrameView = pViewShell->GetFrameView();
}
if (pFrameView==nullptr) return;
try
{ // Get the current page either from the DrawPagesSupplier or the // MasterPagesSupplier.
Any aPage; if (pFrameView->GetViewShEditModeOnLoad() == EditMode::Page)
{
Reference<drawing::XDrawPagesSupplier> xPagesSupplier (
mrBase.GetController()->getModel(), UNO_QUERY_THROW);
Reference<container::XIndexAccess> xPages (
xPagesSupplier->getDrawPages(), UNO_QUERY_THROW);
aPage = xPages->getByIndex(pFrameView->GetSelectedPageOnLoad());
} else
{
Reference<drawing::XMasterPagesSupplier> xPagesSupplier (
mrBase.GetController()->getModel(), UNO_QUERY_THROW);
Reference<container::XIndexAccess> xPages (
xPagesSupplier->getMasterPages(), UNO_QUERY_THROW);
aPage = xPages->getByIndex(pFrameView->GetSelectedPageOnLoad());
} // Switch to the page last edited by setting the CurrentPage // property.
DrawController* pDrawController = mrBase.GetDrawController();
pDrawController->setPropertyValue (u"CurrentPage"_ustr, aPage);
} catch (const RuntimeException&)
{ // We have not been able to set the current page at the main view. // This is sad but still leaves us in a valid state. Therefore, // this exception is silently ignored.
} catch (const beans::UnknownPropertyException&)
{
SAL_WARN("sd.view", "CurrentPage property unknown");
}
}
void FocusForwardingWindow::KeyInput (const KeyEvent& rKEvt)
{
std::shared_ptr<ViewShell> pViewShell = mrBase.GetMainViewShell(); if (pViewShell != nullptr)
{
vcl::Window* pWindow = pViewShell->GetActiveWindow(); if (pWindow != nullptr)
{ // Forward the focus so that the window is called directly the // next time.
pWindow->GrabFocus(); // Forward the key press as well.
pWindow->KeyInput(rKEvt);
}
}
}
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.