22#include <com/sun/star/uno/XComponentContext.hpp>
23#include <com/sun/star/inspection/PropertyLineElement.hpp>
24#include <com/sun/star/graphic/GraphicProvider.hpp>
25#include <com/sun/star/graphic/XGraphicProvider.hpp>
42 using ::com::sun::star::uno::Reference;
43 using ::com::sun::star::uno::XComponentContext;
44 using ::com::sun::star::inspection::XPropertyControl;
45 using ::com::sun::star::inspection::XPropertyControlContext;
46 using ::com::sun::star::uno::Exception;
47 using ::com::sun::star::graphic::GraphicProvider;
48 using ::com::sun::star::graphic::XGraphicProvider;
49 using ::com::sun::star::uno::Sequence;
50 using ::com::sun::star::graphic::XGraphic;
57 , m_xBuilder(
Application::CreateBuilder(pParent,
"modules/spropctrlr/ui/browserline.ui"))
58 ,
m_xContainer(m_xBuilder->weld_container(
"BrowserLine"))
59 , m_xFtTitle(m_xBuilder->weld_label(
"label"))
60 , m_xBrowseButton(m_xBuilder->weld_button(
"browse"))
61 , m_xAdditionalBrowseButton(m_xBuilder->weld_button(
"morebrowse"))
62 , m_pInitialControlParent(pInitialControlParent)
64 , m_pControlWindow( nullptr )
65 , m_pBrowseButton(nullptr)
66 , m_pAdditionalBrowseButton( nullptr )
67 , m_pClickListener( nullptr )
69 , m_nEnableFlags( 0xFFFF )
70 , m_bIndentTitle( false )
110 auto xWindow =
m_xControl->getControlWindow();
178 OUStringBuffer aText(
m_xFtTitle->get_label());
180 int n10DotsWidth =
m_xFtTitle->get_pixel_size(
"..........").Width();
181 int nTextWidth =
m_xFtTitle->get_pixel_size(OUString::unacquired(aText)).Width();
183 int nExtraChars = (nDiff * 10) / n10DotsWidth;
184 for (
int i = 0;
i < nExtraChars; ++
i)
191 aText.append( cRTL_mark );
194 m_xFtTitle->set_label(aText.makeStringAndClear());
224 void implSetBitIfAffected(sal_uInt16& nEnabledBits, sal_Int16 _nAffectedMask, sal_Int16 _nTestBit,
bool _bSet)
226 if ( _nAffectedMask & _nTestBit )
229 nEnabledBits |= _nTestBit;
231 nEnabledBits &= ~_nTestBit;
243 void implEnable(
weld::Widget* pWindow, sal_uInt16 nEnabledBits, sal_uInt16 nMatchBits)
245 bool bEnable = ((nEnabledBits & nMatchBits) == nMatchBits);
246 implEnable(pWindow, bEnable);
277 implSetBitIfAffected(
m_nEnableFlags, _nControls, PropertyLineElement::InputControl, _bEnable );
278 implSetBitIfAffected(
m_nEnableFlags, _nControls, PropertyLineElement::PrimaryButton, _bEnable );
279 implSetBitIfAffected(
m_nEnableFlags, _nControls, PropertyLineElement::SecondaryButton, _bEnable );
310 OSL_PRECOND( !rImageURL.isEmpty(),
"OBrowserLine::ShowBrowseButton: use the other version if you don't have an image!" );
311 Reference<XGraphic> xGraphic;
314 Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
315 Reference< XGraphicProvider > xGraphicProvider( GraphicProvider::create(xContext) );
319 xGraphic = Reference<XGraphic>(xGraphicProvider->queryGraphic(aMediaProperties), css::uno::UNO_SET_THROW);
369 int nMinDotsWidth =
m_xFtTitle->get_pixel_size(
"...").Width();
382 if ( m_pClickListener )
383 m_pClickListener->buttonClicked(
this, &rButton == m_pBrowseButton);
392 Reference< XPropertyControlContext > xContext(
m_xControl->getControlContext(), css::uno::UNO_SET_THROW );
static bool GetLayoutRTL()
css::uno::Reference< css::inspection::XPropertyControl > m_xControl
OUString GetTitle() const
std::unique_ptr< weld::Button > m_xBrowseButton
OBrowserLine(OUString aEntryName, weld::Container *pParent, weld::SizeGroup *pLabelGroup, weld::Container *pInitialControlParent)
void setControl(const css::uno::Reference< css::inspection::XPropertyControl > &rxControl)
weld::Container * m_pInitialControlParent
weld::Button * m_pAdditionalBrowseButton
void EnablePropertyControls(sal_Int16 nControls, bool bEnable)
void implUpdateEnabledDisabled()
IButtonClickListener * m_pClickListener
void HideBrowseButton(bool bPrimary)
void SetTitle(const OUString &rString)
std::unique_ptr< weld::Container > m_xContainer
void implHideBrowseButton(bool bPrimary)
weld::Button & impl_ensureButton(bool bPrimary)
void SetClickListener(IButtonClickListener *pListener)
std::unique_ptr< weld::Button > m_xAdditionalBrowseButton
void IndentTitle(bool bIndent)
void EnablePropertyLine(bool bEnable)
void Show(bool bFlag=true)
void FullFillTitleString()
void SetTitleWidth(sal_uInt16)
void SetReadOnly(bool bReadOnly)
weld::Container * m_pParent
weld::Button * m_pBrowseButton
std::unique_ptr< weld::Label > m_xFtTitle
sal_uInt16 m_nEnableFlags
void ShowBrowseButton(const OUString &rImageURL, bool bPrimary)
void SetComponentHelpIds(const OUString &rHelpId)
weld::Widget * m_pControlWindow
virtual void move(weld::Widget *pWidget, weld::Container *pNewParent)=0
virtual void add_widget(weld::Widget *pWidget)=0
#define DBG_ASSERT(sCon, aError)
#define DBG_UNHANDLED_EXCEPTION(...)
#define LINK(Instance, Class, Member)
const sal_Int16 CompleteLine
OString stripEnd(const OString &rIn, char c)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
a property handler for any virtual string properties
IMPL_LINK(OBrowserLine, OnButtonClicked, weld::Button &, rButton, void)
IMPL_LINK_NOARG(OBrowserLine, OnButtonFocus, weld::Widget &, void)
Reference< XNameAccess > m_xContainer