33#include <com/sun/star/drawing/framework/ResourceId.hpp>
34#include <com/sun/star/drawing/framework/XControllerManager.hpp>
35#include <com/sun/star/lang/DisposedException.hpp>
36#include <com/sun/star/drawing/framework/XView.hpp>
45using ::sd::framework::FrameworkHelper;
50bool IsEqual (
const TabBarButton& rButton1,
const TabBarButton& rButton2)
52 return ((rButton1.ResourceId.is()
53 && rButton2.ResourceId.is()
54 && rButton1.ResourceId->compareTo(rButton2.ResourceId) == 0)
55 || rButton1.ButtonLabel == rButton2.ButtonLabel);
61 const Reference<XResourceId>& rxViewTabBarId,
64 mxController(rxController),
65 mxViewTabBarId(rxViewTabBarId),
66 mpViewShellBase(nullptr),
67 mnNoteBookWidthPadding(0)
85 FrameworkHelper::msResourceActivationEvent,
93 && rxViewTabBarId->isBoundToURL(
94 FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
110 FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
122 catch (
const lang::DisposedException&)
139 const Reference<XResourceId>& rxViewTabBarId,
148 pBase = rxController->GetViewShellBase();
151 if (rxViewTabBarId.is()
152 && rxViewTabBarId->isBoundToURL(
153 FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
155 if (pBase !=
nullptr)
160 if (pWindow ==
nullptr)
162 Reference<XPane> xPane;
165 Reference<XConfigurationController> xCC (
166 rxController->getConfigurationController());
168 xPane.set(xCC->getResource(rxViewTabBarId->getAnchor()), UNO_QUERY);
191 const ConfigurationChangeEvent& rEvent)
193 if (rEvent.Type == FrameworkHelper::msResourceActivationEvent
194 && rEvent.ResourceId->getResourceURL().match(FrameworkHelper::msViewURLPrefix)
195 && rEvent.ResourceId->isBoundTo(
mxViewTabBarId->getAnchor(), AnchorBindingMode_DIRECT))
204 const lang::EventObject& rEvent)
216 const TabBarButton& rButton,
217 const TabBarButton& rAnchor)
263 Reference<XConfigurationController> xConfigurationController (
265 if ( ! xConfigurationController.is())
267 Reference<XView> xView;
270 xView.set(xConfigurationController->getResource(
272 ::comphelper::getProcessComponentContext(),
273 FrameworkHelper::msCenterPaneURL)),
276 catch (
const DeploymentException&)
280 Client* pIPClient =
nullptr;
287 xConfigurationController->requestResourceActivation(
289 ResourceActivationMode_REPLACE);
312 int nAllocatedWidth =
mpTabControl->GetAllocatedWidth();
318 OUString sIdent(OUString::number(
nIndex));
340 const css::drawing::framework::TabBarButton& rButton,
341 const css::drawing::framework::TabBarButton& rAnchor)
343 TabBarButtonList::size_type
nIndex;
345 if ( ! rAnchor.ResourceId.is()
346 || (rAnchor.ResourceId->getResourceURL().isEmpty()
347 && rAnchor.ButtonLabel.isEmpty()))
367 const css::drawing::framework::TabBarButton& rButton)
373 const css::drawing::framework::TabBarButton& rButton,
376 if (nPosition >= 0 &&
377 nPosition <= mpTabControl->GetNotebook().get_n_pages())
387 const css::drawing::framework::TabBarButton& rButton)
402 const css::drawing::framework::TabBarButton& rButton)
404 bool bResult (
false);
406 for (
const css::drawing::framework::TabBarButton & r :
maTabBarButtons)
408 if (IsEqual(r, rButton))
418css::uno::Sequence<css::drawing::framework::TabBarButton>
426 Reference<XView> xView;
428 xView = FrameworkHelper::Instance(*mpViewShellBase)->GetView(
433 Reference<XResourceId> xViewId (xView->getResourceId());
446 int nMaxPageWidthReq(0);
453 OUString sIdent(OUString::number(
nIndex));
468 nMaxPageWidthReq = std::max(nMaxPageWidthReq, nTextWidth);
489 :
InterimItemWindow(pParentWindow,
"modules/simpress/ui/tabviewbar.ui",
"TabViewBar")
490 , mxTabControl(m_xBuilder->weld_notebook(
"tabcontrol"))
491 , mpViewTabBar(
std::move(pViewTabBar))
492 , mnAllocatedWidth(0)
520 mnAllocatedWidth = rSize.Width();
525 if (!mpViewTabBar->ActivatePage(mxTabControl->get_page_index(rPage)))
530 mpViewTabBar->UpdateActiveButton();
static const AllSettings & GetSettings()
virtual void dispose() override
void InitControlBase(weld::Widget *pWidget)
bool IsObjectInPlaceActive() const
vcl::Window & GetWindow() const
SfxViewFrame & GetViewFrame() const
SfxInPlaceClient * GetIPClient() const
constexpr tools::Long Width() const
virtual ~TabBarControl() override
virtual void dispose() override
TabBarControl(vcl::Window *pParentWindow, ::rtl::Reference< ViewTabBar > pViewTabBar)
std::unique_ptr< weld::Notebook > mxTabControl
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
void SetViewTabBar(const ::rtl::Reference< ViewTabBar > &rViewTabBar)
int GetHeight() const
The returned value is calculated as the difference between the total height of the control and the he...
virtual ~ViewTabBar() override
void UpdateTabBarButtons()
virtual void SAL_CALL addTabBarButtonAfter(const css::drawing::framework::TabBarButton &rButton, const css::drawing::framework::TabBarButton &rAnchor) override
static vcl::Window * GetAnchorWindow(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewTabBarId, const rtl::Reference<::sd::DrawController > &rxController)
This method is called from the constructor to get the window for an anchor ResourceId and pass it to ...
VclPtr< TabBarControl > mpTabControl
bool ActivatePage(size_t nIndex)
virtual sal_Bool SAL_CALL hasTabBarButton(const css::drawing::framework::TabBarButton &rButton) override
TabBarButtonList maTabBarButtons
css::uno::Sequence< css::drawing::framework::TabBarButton > GetTabBarButtons()
ViewTabBar(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewTabBarId, const rtl::Reference< ::sd::DrawController > &rxController)
virtual void SAL_CALL removeTabBarButton(const css::drawing::framework::TabBarButton &rButton) override
virtual sal_Bool SAL_CALL isAnchorOnly() override
virtual css::uno::Reference< css::drawing::framework::XResourceId > SAL_CALL getResourceId() override
rtl::Reference<::sd::DrawController > mxController
css::uno::Reference< css::drawing::framework::XConfigurationController > mxConfigurationController
ViewShellBase * mpViewShellBase
virtual void SAL_CALL appendTabBarButton(const css::drawing::framework::TabBarButton &rButton) override
virtual void disposing(std::unique_lock< std::mutex > &) override
css::uno::Reference< css::drawing::framework::XResourceId > mxViewTabBarId
virtual css::uno::Sequence< css::drawing::framework::TabBarButton > SAL_CALL getTabBarButtons() override
void AddTabBarButton(const css::drawing::framework::TabBarButton &rButton, const css::drawing::framework::TabBarButton &rAnchor)
bool HasTabBarButton(const css::drawing::framework::TabBarButton &rButton)
int mnNoteBookWidthPadding
virtual void SAL_CALL notifyConfigurationChange(const css::drawing::framework::ConfigurationChangeEvent &rEvent) override
void UpdateActiveButton()
void RemoveTabBarButton(const css::drawing::framework::TabBarButton &rButton)
A pane is a wrapper for a window and possibly for a tab bar (for view switching).
vcl::Window * GetParent() const
vcl::Window * GetWindow(GetWindowType nType) const
void SetPaintTransparent(bool bTransparent)
void append_page(const OUString &rIdent, const OUString &rLabel)
virtual void set_tab_label_text(const OUString &rIdent, const OUString &rLabel)=0
virtual int get_n_pages() const=0
virtual weld::Container * get_page(const OUString &rIdent) const=0
virtual void remove_page(const OUString &rIdent)=0
#define DBG_UNHANDLED_EXCEPTION(...)
#define LINK(Instance, Class, Member)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
IMPL_LINK(SdCharHeightPropertyBox, implMenuSelectHdl, const OUString &, rIdent, void)