23#include <com/sun/star/frame/XToolbarController.hpp>
24#include <com/sun/star/frame/XFrame.hpp>
25#include <com/sun/star/frame/theToolbarControllerFactory.hpp>
26#include <com/sun/star/lang/XMultiServiceFactory.hpp>
37using namespace css::uno;
42 const Reference<frame::XFrame>& rxFrame,
43 const Reference<awt::XWindow>& rxParentWindow)
56 const OUString& rsCommandName,
57 const Reference<frame::XFrame>& rxFrame,
58 const Reference<frame::XController>& rxController,
59 const Reference<awt::XWindow>& rxParentWindow,
60 const sal_Int32 nWidth,
bool bSideBar)
66 rxFrame, rxController,
72 if ( !bFactoryHasController )
83 ::comphelper::getProcessComponentContext(),
91 Reference<lang::XInitialization> xInitialization (xController, UNO_QUERY);
92 if (!bFactoryHasController && xInitialization.is())
94 beans::PropertyValue aPropValue;
95 std::vector<Any> aPropertyVector;
97 aPropValue.Name =
"Frame";
98 aPropValue.Value <<= rxFrame;
99 aPropertyVector.push_back(
Any(aPropValue));
101 aPropValue.Name =
"ServiceManager";
102 aPropValue.Value <<= ::comphelper::getProcessServiceFactory();
103 aPropertyVector.push_back(
Any(aPropValue));
105 aPropValue.Name =
"CommandURL";
106 aPropValue.Value <<= rsCommandName;
107 aPropertyVector.push_back(
Any(aPropValue));
110 xInitialization->initialize(aArgs);
115 if (rxParentWindow.is())
117 Reference<awt::XWindow> xItemWindow (
xController->createItemWindow(rxParentWindow));
119 if (pItemWindow !=
nullptr)
122 if (nType == WindowType::LISTBOX || nType == WindowType::MULTILISTBOX || nType == WindowType::COMBOBOX)
123 pItemWindow->SetAccessibleName(pToolBox->
GetItemText(nItemId));
125 pItemWindow->SetSizePixel(
Size(nWidth, pItemWindow->GetSizePixel().Height()));
130 Reference<util::XUpdatable> xUpdatable (xController, UNO_QUERY);
132 xUpdatable->update();
140 rsCommandName, aProperties, rxFrame));
152 const OUString& rsCommandName,
153 const Reference<frame::XFrame>& rxFrame,
154 const Reference<frame::XController>& rxController,
163 rxFrame, rxController,
169 ::comphelper::getProcessComponentContext(),
179 Reference<util::XUpdatable> xUpdatable(xController, UNO_QUERY);
181 xUpdatable->update();
189 const Reference<awt::XWindow>& rxToolbar,
190 const OUString& rsCommandName,
191 const Reference<frame::XFrame>& rxFrame,
192 const Reference<frame::XController>& rxController,
193 const sal_Int32 nWidth,
bool bSideBar)
198 Reference<frame::XUIControllerFactory>
xFactory = frame::theToolbarControllerFactory::get( xContext );
203 beans::PropertyValue aPropValue;
204 std::vector<Any> aPropertyVector;
206 aPropValue.Name =
"ModuleIdentifier";
207 aPropValue.Value <<= sModuleName;
208 aPropertyVector.push_back(
Any( aPropValue ));
210 aPropValue.Name =
"Frame";
211 aPropValue.Value <<= rxFrame;
212 aPropertyVector.push_back(
Any( aPropValue ));
214 aPropValue.Name =
"ServiceManager";
216 aPropertyVector.push_back(
Any( aPropValue ));
218 aPropValue.Name =
"ParentWindow";
219 aPropValue.Value <<= rxToolbar;
220 aPropertyVector.push_back(
Any( aPropValue ));
222 aPropValue.Name =
"IsSidebar";
223 aPropValue.Value <<= bSideBar;
224 aPropertyVector.push_back(
Any( aPropValue ));
228 aPropValue.Name =
"Width";
229 aPropValue.Value <<= nWidth;
230 aPropertyVector.push_back(
Any( aPropValue ));
234 return Reference<frame::XToolbarController>(
235 xFactory->createInstanceWithArgumentsAndContext(
PropertiesInfo aProperties
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
Reference< XSingleServiceFactory > xFactory
Reference< XMultiServiceFactory > getProcessServiceFactory()
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Reference< XComponentContext > getProcessComponentContext()
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
OUString GetTooltipForCommand(const OUString &rsCommandName, const css::uno::Sequence< css::beans::PropertyValue > &rProperties, const Reference< frame::XFrame > &rxFrame)
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
Reference< XController > xController