27#include <boost/property_tree/ptree.hpp>
116 maImage(
std::move( aImage ))
118 init(nItemId, nItemBits,
false);
126 init(nItemId, nItemBits,
false);
131 maImage(
std::move( aImage )),
134 init(nItemId, nItemBits,
false);
139 Size aSize( rDefaultSize );
155 bCheckMaxWidth =
false;
157 if ( !bCheckMaxWidth || (aWinSize.
Width() <= maxWidth) )
200 rbImage = rbText =
false;
209 bHasText = !
maText.isEmpty();
216 if( bHasImage || !bHasText )
229 if( bHasText || !bHasImage )
386 SAL_WARN_IF( !nItemId,
"vcl",
"ToolBox::InsertItem(): ItemId == 0" );
388 "ToolBox::InsertItem(): ItemId already exists" );
391 mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ?
mpData->m_aItems.begin()+
nPos :
mpData->m_aItems.end(),
393 mpData->ImplClearLayoutData();
403 ImplToolItems::size_type nPos )
405 SAL_WARN_IF( !nItemId,
"vcl",
"ToolBox::InsertItem(): ItemId == 0" );
407 "ToolBox::InsertItem(): ItemId already exists" );
410 mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ?
mpData->m_aItems.begin()+
nPos :
mpData->m_aItems.end(),
412 mpData->ImplClearLayoutData();
422 ImplToolItems::size_type nPos )
424 SAL_WARN_IF( !nItemId,
"vcl",
"ToolBox::InsertItem(): ItemId == 0" );
426 "ToolBox::InsertItem(): ItemId already exists" );
429 mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ?
mpData->m_aItems.begin()+
nPos :
mpData->m_aItems.end(),
431 mpData->ImplClearLayoutData();
441 const Size& rRequestedSize, ImplToolItems::size_type nPos)
464 SAL_WARN_IF( !nItemId,
"vcl",
"ToolBox::InsertWindow(): ItemId == 0" );
466 "ToolBox::InsertWindow(): ItemId already exists" );
470 aItem.
mnId = nItemId;
474 mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ?
mpData->m_aItems.begin()+
nPos :
mpData->m_aItems.end(), aItem );
475 mpData->ImplClearLayoutData();
493 mpData->m_aItems.push_back( aItem );
494 mpData->ImplClearLayoutData();
499 ImplToolItems::size_type nNewPos =
mpData->m_aItems.size() - 1;
511 mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ?
mpData->m_aItems.begin()+
nPos :
mpData->m_aItems.end(), aItem );
512 mpData->ImplClearLayoutData();
527 mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ?
mpData->m_aItems.begin()+
nPos :
mpData->m_aItems.end(), aItem );
528 mpData->ImplClearLayoutData();
560 mpData->ImplClearLayoutData();
569 "ToolBox::CopyItem(): ItemId already exists" );
583 mpData->m_aItems.push_back( aNewItem );
584 mpData->ImplClearLayoutData();
589 ImplToolItems::size_type nNewPos2 =
mpData->m_aItems.size() - 1;
596 mpData->ImplClearLayoutData();
622 if(
mpData->meButtonSize != eSize )
624 mpData->meButtonSize = eSize;
632 return mpData->meButtonSize;
637 ImageType eImageType = ImageType::Size16;
639 eImageType = ImageType::Size26;
641 eImageType = ImageType::Size32;
651 Size aUnscaledSize(16, 16);
660 aUnscaledSize =
Size(32, 32);
662 return Size(aUnscaledSize.
Width() * fScaleFactor,
663 aUnscaledSize.
Height() * fScaleFactor);
726 ImplToolItems::size_type
nCount =
mpData->m_aItems.size();
737 auto it = std::find_if(
mpData->m_aItems.begin(),
mpData->m_aItems.end(),
738 [&rPos](
const ImplToolItem& rItem) { return rItem.maRect.Contains( rPos ); });
740 if( it !=
mpData->m_aItems.end() )
741 return std::distance(
mpData->m_aItems.begin(), it);
754 auto it = std::find_if(
mpData->m_aItems.begin(),
mpData->m_aItems.end(),
755 [&rPos](
const ImplToolItem& rItem) { return rItem.maRect.Contains( rPos ); });
769 if ( nPos < mpData->m_aItems.size() )
780 auto it = std::find_if(
mpData->m_aItems.begin(),
mpData->m_aItems.end(),
781 [&rCommand](
const ImplToolItem& rItem) { return rItem.maCommandStr == rCommand; });
782 if (it !=
mpData->m_aItems.end())
807 if( devPos.
Y() >= aScreen.
Bottom() )
814 if( devPos.
Y() <= aScreen.
Top() )
821 if( devPos.
X() >= aScreen.
Right() )
828 if( devPos.
X() <= aScreen.
Left() )
852 if ( nPos < mpData->m_aItems.size() )
860 return mpData->maMenubuttonItem.maRect;
889 if ( nBits != nOldBits )
900 mpData->m_aItems[
nPos].mbNonInteractiveWindow = bNonInteractive;
931 if ( nPos < mpData->m_aItems.size() )
954 return Image( aMirrBitmapEx );
963 return Image( aRotBitmapEx );
1032 mpData->ImplClearLayoutData();
1153 if ( pItem->
meState == eState )
1161 ImplToolItems::size_type nGroupPos;
1167 pGroupItem = &
mpData->m_aItems[nGroupPos-1];
1179 while ( nGroupPos < nItemCount )
1181 pGroupItem = &
mpData->m_aItems[nGroupPos];
1254 mpData->ImplClearLayoutData();
1363 mpData->mbKeyInputDisabled = std::none_of(
mpData->m_aItems.begin(),
mpData->m_aItems.end(),
1366 return rItem.mbEnabled;
1372 mpData->m_pLayoutData.emplace();
1374 ImplToolItems::size_type
nCount =
mpData->m_aItems.size();
1375 for( ImplToolItems::size_type
i = 0;
i <
nCount;
i++ )
1387 if( !
mpData->m_pLayoutData )
1389 return mpData->m_pLayoutData ?
mpData->m_pLayoutData->m_aDisplayText : OUString();
1395 if( !
mpData->m_pLayoutData )
1397 if(
mpData->m_pLayoutData )
1399 for(
size_t i = 0;
i <
mpData->m_pLayoutData->m_aLineItemIds.size();
i++ )
1403 nItemIndex =
mpData->m_pLayoutData->m_aLineIndices[
i];
1415 if( !
mpData->m_pLayoutData )
1417 if(
mpData->m_pLayoutData )
1419 nIndex =
mpData->m_pLayoutData->GetIndexForPoint( rPoint );
1420 for(
size_t i = 0;
i <
mpData->m_pLayoutData->m_aLineIndices.size();
i++ )
1423 (
i ==
mpData->m_pLayoutData->m_aLineIndices.size()-1 ||
mpData->m_pLayoutData->m_aLineIndices[
i+1] >
nIndex) )
1425 rItemID =
mpData->m_pLayoutData->m_aLineItemIds[
i];
1436 mpData->maDropdownClickHdl = rLink;
1442 if( aType ==
mpData->maMenuType )
1445 mpData->maMenuType = aType;
1460 if( !
mpData->maMenubuttonItem.maRect.IsEmpty() )
1467 return mpData->maMenuType;
1482 mpData->maMenuButtonHdl = rLink;
1489 return std::any_of(
mpData->m_aItems.begin(),
mpData->m_aItems.end(),
1490 [](
const ImplToolItem& rItem) { return rItem.IsClipped(); });
1503 return nMenuItemBits;
1518 if (
mpData->m_aItems.empty() )
1522 for (
const auto& rItem :
mpData->m_aItems )
1524 if( rItem.IsClipped() )
1527 MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(rItem.mnBits);
1528 pMenu->
InsertItem(
id, rItem.maText, rItem.maImage, nMenuItemBits);
1539 for (
const auto& rItem :
mpData->m_aItems )
1541 if( rItem.IsItemHidden() )
1544 MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(rItem.mnBits);
1545 pMenu->
InsertItem(
id, rItem.maText, rItem.maImage, nMenuItemBits );
1557 sal_uInt16
id =
GetMenu()->GetItemId( rEvent.GetItemPos() );
1572 mpData->maMenuButtonHdl.Call(
this );
1581 bool bBorderDel =
false;
1622 "cannot assume docked and floating" );
1624 if(
mpData->mbAssumeDocked )
1626 else if(
mpData->mbAssumeFloating )
1635 if(
mpData->mbAssumePopupMode )
1649 if(
mpData->mbIsLocked != bLock )
1651 mpData->mbIsLocked = bLock;
1666 static int nAlwaysLocked = -1;
1668 if( nAlwaysLocked == -1 )
1674 "/org.openoffice.Office.UI.GlobalSettings/Toolbars" );
1678 bool bStatesEnabled = bool();
1679 css::uno::Any aValue = aNode.
getNodeValue(
"StatesEnabled" );
1680 if( aValue >>= bStatesEnabled )
1682 if( bStatesEnabled )
1687 "/org.openoffice.Office.UI.GlobalSettings/Toolbars/States" );
1689 bool bLocked = bool();
1690 css::uno::Any aValue2 = aNode2.
getNodeValue(
"Locked" );
1691 if( aValue2 >>= bLocked )
1692 nAlwaysLocked = bLocked ? 1 : 0;
1698 return nAlwaysLocked == 1;
1703 return mpData->mbWillUsePopupMode;
1708 mpData->mbWillUsePopupMode = b;
1715 auto childrenNode = rJsonWriter.
startArray(
"children");
1716 for (ToolBox::ImplToolItems::size_type
i = 0;
i <
GetItemCount(); ++
i)
1729 rJsonWriter.
put(
"type",
"toolitem");
1731 rJsonWriter.
put(
"command", sCommand);
1733 rJsonWriter.
put(
"selected",
true);
1735 rJsonWriter.
put(
"visible",
false);
1737 rJsonWriter.
put(
"dropdown",
true);
1739 rJsonWriter.
put(
"enabled",
false);
1742 if (!sCommand.startsWith(
".uno:") && !!aImage)
1748 OStringBuffer
aBuffer(
"data:image/png;base64,");
PropertiesInfo aProperties
const StyleSettings & GetStyleSettings() const
static OutputDevice * GetDefaultDevice()
Get the default "device" (in this case the default window).
static const AllSettings & GetSettings()
Gets the application's settings.
bool Rotate(Degree10 nAngle10, const Color &rFillColor)
Rotate bitmap by the specified angle.
bool Mirror(BmpMirrorFlags nMirrorFlags)
Mirror the bitmap.
ImplDockingWindowWrapper * GetDockingWindowWrapper(const vcl::Window *pWin)
bool IsFloatingMode() const
bool IsInPopupMode() const
static ErrCode Export(SvStream &rOStm, const Graphic &rGraphic, ConvertDataFormat nFormat)
BitmapEx GetBitmapEx() const
Size GetSizePixel() const
tools::Rectangle GetMenuRect() const
ImplDockingWindowWrapper.
void ShowMenuTitleButton(bool bVisible)
SystemWindow * GetFloatingWindow() const
static OUString EraseAllMnemonicChars(const OUString &rStr)
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
tools::Long GetCtrlTextWidth(const OUString &rStr, const SalLayoutGlyphs *pLayoutCache=nullptr) const
float GetDPIScaleFactor() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
OUString DetermineIconTheme() const
Determine which icon theme should be used.
void logAction(VclPtr< Control > const &xUIElement, VclEventId nEvent)
static UITestLogger & getInstance()
static VclPtr< reference_type > Create(Arg &&... arg)
A construction helper for VclPtr.
static void encode(OUStringBuffer &aStrBuffer, const css::uno::Sequence< sal_Int8 > &aPass)
css::uno::Any getNodeValue(const OUString &_rPath) const noexcept
static OConfigurationTreeRoot tryCreateWithComponentContext(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &_rPath, sal_Int32 _nDepth=-1, CREATION_MODE _eMode=CM_UPDATABLE)
static Size SizeByThemeName(std::u16string_view)
Obtain the icon size by theme name.
bool IsReallyVisible() const
bool IsMouseCaptured() const
tools::Rectangle GetDesktopRectPixel() const
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
virtual void SetSizePixel(const Size &rNewSize)
vcl::Window * GetWindow(GetWindowType nType) const
bool IsUpdateMode() const
void Enable(bool bEnable=true, bool bChild=true)
void GrabFocusToDocument()
::OutputDevice const * GetOutDev() const
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
virtual Size GetSizePixel() const
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
const OUString & GetQuickHelpText() const
const OUString & GetHelpText() const
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
#define LINK(Instance, Class, Member)
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
Reference< XComponentContext > getProcessComponentContext()
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
Return a label for the given command.
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)
Image GetImageForCommand(const OUString &rsCommandName, const Reference< frame::XFrame > &rxFrame, vcl::ImageType eImageType)
OUString GetLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
Return a label for the given command.
DockingManager * ImplGetDockingManager()
@ ToolboxItemWindowChanged
@ ToolboxButtonStateChanged
std::unique_ptr< char[]> aBuffer