30 const Reference<XComponentContext>& rxContext)
33 Reference<lang::XMultiComponentFactory>
xFactory (rxContext->getServiceManager());
38 "com.sun.star.comp.Draw.PresenterHelper",
44PresenterPaneContainer::~PresenterPaneContainer()
48void PresenterPaneContainer::PreparePane (
49 const Reference<XResourceId>& rxPaneId,
50 const OUString& rsViewURL,
51 const OUString& rsTitle,
52 const OUString& rsAccessibleTitle,
65 pDescriptor->mxPaneId = rxPaneId;
66 pDescriptor->msViewURL = rsViewURL;
67 pDescriptor->mxPane =
nullptr;
68 if (rsTitle.indexOf(
'%') < 0)
70 pDescriptor->msTitle = rsTitle;
71 pDescriptor->msTitleTemplate.clear();
75 pDescriptor->msTitleTemplate = rsTitle;
76 pDescriptor->msTitle.clear();
78 pDescriptor->msAccessibleTitleTemplate = rsAccessibleTitle;
79 pDescriptor->maViewInitialization = rViewInitialization;
80 pDescriptor->mbIsActive =
true;
81 pDescriptor->mbIsOpaque = bIsOpaque;
82 pDescriptor->mbIsSprite =
false;
84 maPanes.push_back(pDescriptor);
87void SAL_CALL PresenterPaneContainer::disposing()
89 for (
const auto& rxPane : maPanes)
90 if (rxPane->mxPaneId.is())
91 RemovePane(rxPane->mxPaneId);
102 Reference<XResourceId> xPaneId (rxPane->getResourceId());
104 sPaneURL = xPaneId->getResourceURL();
106 pDescriptor = FindPaneURL(sPaneURL);
108 PreparePane(xPaneId, OUString(), OUString(), OUString(),
110 pDescriptor = FindPaneURL(sPaneURL);
113 Reference<awt::XWindow> xWindow (rxPane->getWindow());
114 pDescriptor->mxContentWindow = xWindow;
115 pDescriptor->mxPaneId = xPaneId;
116 pDescriptor->mxPane = rxPane;
117 pDescriptor->mxPane->SetTitle(pDescriptor->msTitle);
120 xWindow->addEventListener(
this);
128 PresenterPaneContainer::StoreBorderWindow(
129 const Reference<XResourceId>& rxPaneId,
130 const Reference<awt::XWindow>& rxBorderWindow)
136 sPaneURL = rxPaneId->getResourceURL();
141 pDescriptor->mxBorderWindow = rxBorderWindow;
149 PresenterPaneContainer::StoreView (
150 const Reference<XView>& rxView)
157 Reference<XResourceId> xViewId (rxView->getResourceId());
160 Reference<XResourceId> xPaneId (xViewId->getAnchor());
162 sPaneURL = xPaneId->getResourceURL();
165 pDescriptor = FindPaneURL(sPaneURL);
168 pDescriptor->mxView = rxView;
171 if (pDescriptor->maViewInitialization)
172 pDescriptor->maViewInitialization(rxView);
185 PresenterPaneContainer::RemovePane (
const Reference<XResourceId>& rxPaneId)
190 if (pDescriptor->mxContentWindow.is())
191 pDescriptor->mxContentWindow->removeEventListener(
this);
192 pDescriptor->mxContentWindow =
nullptr;
193 pDescriptor->mxBorderWindow =
nullptr;
194 pDescriptor->mxPane =
nullptr;
195 pDescriptor->mxView =
nullptr;
196 pDescriptor->mbIsActive =
false;
202 PresenterPaneContainer::RemoveView (
const Reference<XView>& rxView)
209 Reference<XResourceId> xViewId (rxView->getResourceId());
212 Reference<XResourceId> xPaneId (xViewId->getAnchor());
214 sPaneURL = xPaneId->getResourceURL();
217 pDescriptor = FindPaneURL(sPaneURL);
220 pDescriptor->mxView =
nullptr;
228 const Reference<awt::XWindow>& rxBorderWindow)
230 auto iPane = std::find_if(maPanes.begin(), maPanes.end(),
231 [&rxBorderWindow](
const SharedPaneDescriptor& rxPane) { return rxPane->mxBorderWindow == rxBorderWindow; });
232 if (iPane != maPanes.end())
238 const Reference<awt::XWindow>& rxContentWindow)
240 auto iPane = std::find_if(maPanes.begin(), maPanes.end(),
241 [&rxContentWindow](
const SharedPaneDescriptor& rxPane) { return rxPane->mxContentWindow == rxContentWindow; });
242 if (iPane != maPanes.end())
248 const OUString& rsPaneURL)
250 auto iPane = std::find_if(maPanes.begin(), maPanes.end(),
251 [&rsPaneURL](
const SharedPaneDescriptor& rxPane) { return rxPane->mxPaneId->getResourceURL() == rsPaneURL; });
252 if (iPane != maPanes.end())
258 const Reference<XResourceId>& rxPaneId)
260 if ( ! rxPaneId.is())
263 auto iPane = std::find_if(maPanes.begin(), maPanes.end(),
264 [&rxPaneId](
const SharedPaneDescriptor& rxPane) { return rxPaneId->compareTo(rxPane->mxPaneId) == 0; });
265 if (iPane != maPanes.end())
271 const OUString& rsViewURL)
273 auto iPane = std::find_if(maPanes.begin(), maPanes.end(),
275 if (iPane != maPanes.end())
280OUString PresenterPaneContainer::GetPaneURLForViewURL (
const OUString& rsViewURL)
284 if (pDescriptor->mxPaneId.is())
285 return pDescriptor->mxPaneId->getResourceURL();
295 PaneList::iterator iEnd (maPanes.end());
296 auto iPane = std::find_if(maPanes.begin(), iEnd,
298 OSL_ASSERT(iPane!=iEnd);
305 maPanes.erase(iPane);
306 maPanes.push_back(rpDescriptor);
311void SAL_CALL PresenterPaneContainer::disposing (
312 const css::lang::EventObject& rEvent)
315 FindContentWindow(Reference<awt::XWindow>(rEvent.Source, UNO_QUERY)));
318 RemovePane(pDescriptor->mxPaneId);
324void PresenterPaneContainer::PaneDescriptor::SetActivationState (
const bool bIsActive)
Reference< drawing::XPresenterHelper > mxPresenterHelper
::std::function< void(const css::uno::Reference< css::drawing::framework::XView > &)> ViewInitializationFunction
std::shared_ptr< PaneDescriptor > SharedPaneDescriptor
PresenterPaneContainer(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
Reference< XSingleServiceFactory > xFactory
::cppu::WeakComponentImplHelper< css::lang::XEventListener > PresenterPaneContainerInterfaceBase