22#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
23#include <com/sun/star/ui/ImageType.hpp>
24#include <com/sun/star/ui/ItemType.hpp>
31static sal_Int16
theImageType = css::ui::ImageType::COLOR_NORMAL | css::ui::ImageType::SIZE_DEFAULT;
35 SvxEntries::iterator iter = pEntries->begin();
37 while (iter != pEntries->end())
39 if (pChildEntry == *iter)
41 pEntries->erase(iter);
49 std::u16string_view rSaveInName)
51 OUString
name = rMessage.replaceFirst(
"%SAVE IN SELECTION%", rSaveInName);
60 return str.replaceAll(OUString::number(16), OUString::number(nReplacement));
67 theImageType = css::ui::ImageType::COLOR_NORMAL | css::ui::ImageType::SIZE_DEFAULT;
79css::uno::Reference<css::graphic::XGraphic>
81 const OUString& rCommandURL)
83 css::uno::Reference<css::graphic::XGraphic>
result;
85 if (xImageManager.is())
88 css::uno::Sequence<css::uno::Reference<css::graphic::XGraphic>> aGraphicSeq;
90 css::uno::Sequence<OUString> aImageCmdSeq{ rCommandURL };
94 aGraphicSeq = xImageManager->getImages(
GetImageType(), aImageCmdSeq);
96 if (aGraphicSeq.hasElements())
101 catch (css::uno::Exception&)
117 name =
prefix.replaceFirst(
"%n", OUString::number(suffix), &
pos);
122 name += OUString::number(suffix);
129 bool bFoundEntry =
false;
130 for (
auto const& entry : *entries)
132 if (
name.equals(entry->GetName()))
150 OUString url =
"vnd.openoffice.org:CustomMenu" + OUString::number(suffix);
155 bool bFoundEntry =
false;
156 for (
auto const& entry : *entries)
158 if (url.equals(entry->GetCommand()))
186 bool bFoundEntry =
false;
187 for (
auto const& entry : *entries)
189 if (url.equals(entry->GetCommand()))
207 if (aModuleId ==
u"com.sun.star.text.TextDocument"
208 || aModuleId ==
u"com.sun.star.text.GlobalDocument")
210 else if (aModuleId ==
u"com.sun.star.text.WebDocument")
212 else if (aModuleId ==
u"com.sun.star.drawing.DrawingDocument")
214 else if (aModuleId ==
u"com.sun.star.presentation.PresentationDocument")
216 else if (aModuleId ==
u"com.sun.star.sheet.SpreadsheetDocument")
218 else if (aModuleId ==
u"com.sun.star.script.BasicIDE")
220 else if (aModuleId ==
u"com.sun.star.formula.FormulaProperties")
222 else if (aModuleId ==
u"com.sun.star.sdb.RelationDesign")
223 return "Relation Design";
224 else if (aModuleId ==
u"com.sun.star.sdb.QueryDesign")
225 return "Query Design";
226 else if (aModuleId ==
u"com.sun.star.sdb.TableDesign")
227 return "Table Design";
228 else if (aModuleId ==
u"com.sun.star.sdb.DataSourceBrowser")
229 return "Data Source Browser";
230 else if (aModuleId ==
u"com.sun.star.sdb.DatabaseDocument")
237 const OUString& aModuleId,
238 const css::uno::Reference<css::frame::XModuleManager2>& rModuleManager)
240 assert(rModuleManager.is());
242 OUString aModuleUIName;
246 css::uno::Any
a = rModuleManager->getByName(aModuleId);
247 css::uno::Sequence<css::beans::PropertyValue>
aSeq;
251 for (css::beans::PropertyValue
const& rProp : std::as_const(
aSeq))
253 if (rProp.Name ==
"ooSetupFactoryUIName")
255 rProp.Value >>= aModuleUIName;
261 catch (css::uno::RuntimeException&)
265 catch (css::uno::Exception&)
269 if (aModuleUIName.isEmpty())
272 return aModuleUIName;
276 const css::uno::Reference<css::container::XIndexAccess>& rItemContainer, sal_Int32 nIndex,
277 OUString& rCommandURL, OUString& rLabel, sal_uInt16& rType, sal_Int32& rStyle,
278 css::uno::Reference<css::container::XIndexAccess>& rSubMenu)
282 css::uno::Sequence<css::beans::PropertyValue> aProps;
283 if (rItemContainer->getByIndex(
nIndex) >>= aProps)
285 for (css::beans::PropertyValue
const& rProp : std::as_const(aProps))
289 rProp.Value >>= rCommandURL;
293 rProp.Value >>= rSubMenu;
297 rProp.Value >>= rStyle;
301 rProp.Value >>= rLabel;
305 rProp.Value >>= rType;
312 catch (css::lang::IndexOutOfBoundsException&)
320 const css::uno::Reference<css::container::XIndexAccess>& rItemContainer, sal_Int32 nIndex,
321 OUString& rCommandURL, OUString& rLabel, sal_uInt16& rType,
bool& rIsVisible, sal_Int32& rStyle)
325 css::uno::Sequence<css::beans::PropertyValue> aProps;
326 if (rItemContainer->getByIndex(
nIndex) >>= aProps)
328 for (css::beans::PropertyValue
const& rProp : std::as_const(aProps))
332 rProp.Value >>= rCommandURL;
336 rProp.Value >>= rStyle;
340 rProp.Value >>= rLabel;
344 rProp.Value >>= rType;
348 rProp.Value >>= rIsVisible;
355 catch (css::lang::IndexOutOfBoundsException&)
362css::uno::Sequence<css::beans::PropertyValue>
372 css::uno::Sequence<css::beans::PropertyValue> aPropSeq{
377 static_cast<sal_Int16
>(pEntry->
GetStyle()))
383css::uno::Sequence<css::beans::PropertyValue>
393 css::uno::Sequence<css::beans::PropertyValue> aPropSeq{
399 static_cast<sal_Int16
>(pEntry->
GetStyle()))
407 return a->GetName().compareTo(b->
GetName()) < 0;
416 for (
const auto& entry : *pEntries)
static sal_Int16 theImageType
constexpr OUStringLiteral ITEM_DESCRIPTOR_ISVISIBLE
constexpr OUStringLiteral CUSTOM_TOOLBAR_STR
constexpr OUStringLiteral ITEM_TOOLBAR_URL
constexpr OUStringLiteral ITEM_DESCRIPTOR_STYLE
constexpr OUStringLiteral ITEM_DESCRIPTOR_COMMANDURL
constexpr OUStringLiteral ITEM_DESCRIPTOR_TYPE
std::vector< SvxConfigEntry * > SvxEntries
constexpr OUStringLiteral ITEM_DESCRIPTOR_LABEL
constexpr OUStringLiteral ITEM_DESCRIPTOR_CONTAINER
static sal_Int16 GetCurrentSymbolsSize()
sal_Int32 GetStyle() const
const OUString & GetCommand() const
SvxEntries * GetEntries() const
const OUString & GetName() const
bool HasChangedName() const
static void InitImageType()
static sal_uInt32 generateRandomValue()
static sal_Int16 GetImageType()
static OUString GetModuleName(std::u16string_view aModuleId)
static OUString generateCustomURL(SvxEntries *entries)
Generates a custom resource URL for a new toolbar.
static OUString generateCustomMenuURL(SvxEntries *entries, sal_Int32 suffix=1)
static OUString replaceSaveInName(const OUString &rMessage, std::u16string_view rSaveInName)
static OUString GetUIModuleName(const OUString &aModuleId, const css::uno::Reference< css::frame::XModuleManager2 > &rModuleManager)
static bool GetMenuItemData(const css::uno::Reference< css::container::XIndexAccess > &rItemContainer, sal_Int32 nIndex, OUString &rCommandURL, OUString &rLabel, sal_uInt16 &rType, sal_Int32 &rStyle, css::uno::Reference< css::container::XIndexAccess > &rSubMenu)
static css::uno::Sequence< css::beans::PropertyValue > ConvertSvxConfigEntry(const SvxConfigEntry *pEntry)
static OUString stripHotKey(const OUString &str)
static OUString generateCustomName(const OUString &prefix, SvxEntries *entries, sal_Int32 suffix=1)
static bool GetToolbarItemData(const css::uno::Reference< css::container::XIndexAccess > &rItemContainer, sal_Int32 nIndex, OUString &rCommandURL, OUString &rLabel, sal_uInt16 &rType, bool &rIsVisible, sal_Int32 &rStyle)
static void RemoveEntry(SvxEntries *pEntries, SvxConfigEntry const *pChildEntry)
static bool SvxConfigEntryModified(SvxConfigEntry const *pEntry)
static css::uno::Reference< css::graphic::XGraphic > GetGraphic(const css::uno::Reference< css::ui::XImageManager > &xImageManager, const OUString &rCommandURL)
static OUString replaceSixteen(const OUString &str, sal_Int32 nReplacement)
static css::uno::Sequence< css::beans::PropertyValue > ConvertToolbarEntry(const SvxConfigEntry *pEntry)
static bool EntrySort(SvxConfigEntry const *a, SvxConfigEntry const *b)
Sequence< sal_Int8 > aSeq
unsigned int uniform_uint_distribution(unsigned int a, unsigned int b)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)