23#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
24#include <com/sun/star/ui/UIElementType.hpp>
25#include <com/sun/star/lang/DisposedException.hpp>
46 ImplInheritanceHelper( UIElementType::TOOLBAR ),
69 css::lang::EventObject
aEvent( xThis );
70 m_aListenerContainer.disposeAndClear(
aEvent );
74 auto xMultiplexer( ContextChangeEventMultiplexer::get(
m_xContext ) );
75 xMultiplexer->removeAllContextChangeEventListeners(
this );
78 if ( xComponent.is() )
85 m_xConfigSource.clear();
86 m_xConfigData.clear();
97 throw DisposedException();
104 bool bPopupMode(
false );
108 PropertyValue aPropValue;
109 if ( arg >>= aPropValue )
111 if ( aPropValue.Name ==
"PopupMode" )
112 aPropValue.Value >>= bPopupMode;
113 else if ( aPropValue.Name ==
"ParentWindow" )
114 xParentWindow.set( aPropValue.Value, UNO_QUERY );
119 if ( !(
xFrame.is() && m_xConfigSource.is()) )
122 OUString aContextPart;
123 if ( m_aResourceURL.startsWith(
"private:resource/toolbar/singlemode", &aContextPart ) && aContextPart.isEmpty() )
125 auto xMultiplexer( ContextChangeEventMultiplexer::get(
m_xContext ) );
128 xMultiplexer->addContextChangeEventListener(
this,
xFrame->getController() );
140 if ( aContextPart.isEmpty() )
143 if ( !xParentWindow.is() )
144 xParentWindow.set(
xFrame->getContainerWindow() );
151 pToolBar->SetLineSpacing(
true);
154 pToolBar->WillUsePopupMode( bPopupMode );
171 m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL,
false );
172 if ( m_xConfigData.is() && (pToolBar ||
m_xWeldedToolbar) && pToolBarManager )
178 pToolBar->EnableCustomize();
179 ::Size aActSize( pToolBar->GetSizePixel() );
180 ::Size aSize( pToolBar->CalcWindowSizePixel() );
182 pToolBar->SetOutputSizePixel( aSize );
186 catch (
const NoSuchElementException& )
190 m_bPersistent =
false;
191 if ( pToolBar && pToolBarManager )
193 pToolBar->EnableCustomize();
194 ::Size aActSize( pToolBar->GetSizePixel() );
195 ::Size aSize( pToolBar->CalcWindowSizePixel() );
197 pToolBar->SetOutputSizePixel( aSize );
215 throw DisposedException();
218 if ( pToolBarManager )
228 throw DisposedException();
230 if ( m_xConfigSource.is() && m_bPersistent )
234 m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL,
false );
235 if ( m_xConfigData.is() )
238 catch (
const NoSuchElementException& )
246 else if ( !m_bPersistent )
255 if ( pToolBarManager )
259 OUString aContextToolbar = xContextData.is() ?
m_xSubElement->getResourceURL() : OUString();
260 pToolBarManager->
FillToolbar( m_xConfigData, xContextData, aContextToolbar );
270 throw DisposedException();
272 if (
aEvent.ContextName.isEmpty() ||
aEvent.ContextName ==
"default" )
275 const OUString aContextToolbar( m_aResourceURL +
"-" +
aEvent.ContextName.toAsciiLowerCase() );
280 if ( xComponent.is() )
287 xPropSet->getPropertyValue(
"LayoutManager") >>= xLayoutManager;
288 if ( !xLayoutManager.is() )
291 xLayoutManager->createElement( aContextToolbar );
292 m_xSubElement.set( xLayoutManager->getElement( aContextToolbar ) );
294 if ( xComponent.is() )
297 if ( m_xConfigData.is() )
299 xLayoutManager->lock();
301 xLayoutManager->unlock();
313 if ( pToolBarManager )
325 const OUString& aUIElementName,
333 if ( pToolBarManager )
341 bool bNoClose( m_bNoClose );
348 bool bNewNoClose( m_bNoClose );
353 if ( !pToolBarManager )
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
void SetFloatStyle(WinBits nWinStyle)
WinBits GetFloatStyle() const
void setWidth(tools::Long nWidth)
constexpr tools::Long Width() const
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
static VclPtr< reference_type > Create(Arg &&... arg)
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &aValue) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
Sequence< PropertyValue > aArguments
Reference< XFrame > xFrame
WinBits const WB_CLOSEABLE
WinBits const WB_MOVEABLE
WinBits const WB_DOCKABLE
WinBits const WB_SIZEABLE