23#include <core_resource.hxx>
29#include <svx/svxids.hrc>
43 std::unique_ptr<weld::Button> xFormula)
45 , m_xSubEdit(
std::move(xSubEdit))
46 , m_xFormula(
std::move(xFormula))
54 OUString
sFormula(m_xSubEdit->get_text());
55 const sal_Int32 nLen =
sFormula.getLength();
61 uno::Reference< awt::XWindow> xInspectorWindow = m_pParent->GetXWindow();
62 uno::Reference< beans::XPropertySet> xProp(m_pParent->getController().getRowSet(),uno::UNO_QUERY);
77 [[maybe_unused]]
const OUString& ,
const NamedColor& rNamedColor)
85 , m_aBackColorWrapper(this, SID_BACKGROUND_COLOR)
86 , m_aForeColorWrapper(this, SID_ATTR_CHAR_COLOR2)
91 , m_xBuilder(
Application::CreateBuilder(pParent,
"modules/dbreport/ui/conditionwin.ui"))
92 ,
m_xContainer(m_xBuilder->weld_container(
"ConditionWin"))
93 , m_xHeader(m_xBuilder->weld_label(
"headerLabel"))
94 , m_xConditionType(m_xBuilder->weld_combo_box(
"typeCombobox"))
95 , m_xOperationList(m_xBuilder->weld_combo_box(
"opCombobox"))
96 , m_xOperandGlue(m_xBuilder->weld_label(
"andLabel"))
97 , m_xActions(m_xBuilder->weld_toolbar(
"formatToolbox"))
98 , m_xPreview(new
weld::CustomWeld(*m_xBuilder,
"previewDrawingarea", m_aPreview))
99 , m_xMoveUp(m_xBuilder->weld_button(
"upButton"))
100 , m_xMoveDown(m_xBuilder->weld_button(
"downButton"))
101 , m_xAddCondition(m_xBuilder->weld_button(
"addButton"))
102 , m_xRemoveCondition(m_xBuilder->weld_button(
"removeButton"))
133 if (rItemId ==
u"bold")
134 return SID_ATTR_CHAR_WEIGHT;
135 if (rItemId ==
u"italic")
136 return SID_ATTR_CHAR_POSTURE;
137 if (rItemId ==
u"underline")
138 return SID_ATTR_CHAR_UNDERLINE;
139 if (rItemId ==
u"background")
140 return SID_BACKGROUND_COLOR;
141 if (rItemId ==
u"foreground")
142 return SID_ATTR_CHAR_COLOR2;
143 if (rItemId ==
u"fontdialog")
158 SID_BACKGROUND_COLOR,
161 [
this]{ return m_pDialog; },
173 SID_ATTR_CHAR_COLOR2,
176 [
this]{ return m_pDialog; },
185 ApplyCommand(mapToolbarItemToSlotId(rIdent),
191 if ( &rClickedButton == m_xMoveUp.get() )
192 m_rAction.moveConditionUp( getConditionIndex() );
193 else if ( &rClickedButton == m_xMoveDown.get() )
194 m_rAction.moveConditionDown( getConditionIndex() );
195 else if ( &rClickedButton == m_xAddCondition.get() )
196 m_rAction.addCondition( getConditionIndex() );
197 else if ( &rClickedButton == m_xRemoveCondition.get() )
198 m_rAction.deleteCondition( getConditionIndex() );
208 impl_layoutOperands();
213 impl_layoutOperands();
222 const bool bHaveRHS =
244 if ( !_rConditionFormula.isEmpty() )
249 OUString sExpression;
264 if ( rxConditionalExpression->matchExpression( sExpression, sUnprefixedFieldContent, sLHS, sRHS ) )
267 eOperation = rOperation;
286 OSL_PRECOND( _rxCondition.is(),
"Condition::setCondition: empty condition object!" );
287 if ( !_rxCondition.is() )
290 OUString sConditionFormula;
293 if ( _rxCondition.is() )
294 sConditionFormula = _rxCondition->getFormula();
307 OUString aItems[] = {
"bold",
"italic",
"underline",
"fontdialog" };
309 OSL_ENSURE(_xReportControlFormat.is(),
"XReportControlFormat is NULL!");
310 if ( !_xReportControlFormat.is() )
316 _xReportControlFormat));
324 aFont.SetEmphasisMark(
static_cast< FontEmphasisMark >( _xReportControlFormat->getControlTextEmphasis() ) );
325 aFont.SetRelief(
static_cast< FontRelief >( _xReportControlFormat->getCharRelief() ) );
341 const OUString sLHS(
m_xCondLHS->get_text() );
342 const OUString sRHS(
m_xCondRHS->get_text() );
344 OUString sUndecoratedFormula( sLHS );
352 sUndecoratedFormula = pFactory->assembleExpression( sUnprefixedFieldContent, sLHS, sRHS );
362 OUString sHeader(
RptResId( STR_NUMBERED_CONDITION ) );
363 sHeader = sHeader.replaceFirst(
"$number$", OUString::number( _nCondIndex + 1) );
366 m_xMoveUp->set_sensitive(_nCondIndex > 0);
367 OSL_PRECOND( _nCondCount > 0,
"Condition::setConditionIndex: having no conditions at all is nonsense!" );
368 m_xMoveDown->set_sensitive(_nCondIndex < _nCondCount - 1);
static OutputDevice * GetDefaultDevice()
OUString AsRGBHexString() const
void SetFont(const SvxFont &rNormalFont, const SvxFont &rCJKFont, const SvxFont &rCTLFont)
void SetTextLineColor(const Color &rColor)
static vcl::Font CreateFont(const css::awt::FontDescriptor &rDescr, const vcl::Font &rInitFont)
ClassificationCategoriesController & m_rController
ConditionColorWrapper(Condition *pControl, sal_uInt16 nSlotId)
void operator()(const OUString &rCommand, const NamedColor &rColor)
std::unique_ptr< weld::Button > m_xFormula
ConditionField(Condition *pParent, std::unique_ptr< weld::Entry > xSubEdit, std::unique_ptr< weld::Button > xFormula)
std::unique_ptr< weld::ComboBox > m_xConditionType
ConditionType impl_getCurrentConditionType() const
void updateToolbar(const css::uno::Reference< css::report::XReportControlFormat > &_xCondition)
updates the toolbar _xCondition the destination
std::unique_ptr< weld::Toolbar > m_xActions
void SetBackgroundDropdownClick()
void fillFormatCondition(const css::uno::Reference< css::report::XFormatCondition > &_xCondition)
fills from the control _xCondition the destination
ConditionalExpressions m_aConditionalExpressions
Condition(weld::Container *pParent, weld::Window *pDialog, IConditionalFormatAction &rAction, ::rptui::OReportController &rController)
std::unique_ptr< weld::Label > m_xOperandGlue
ConditionColorWrapper m_aBackColorWrapper
void setConditionIndex(size_t _nCondIndex, size_t _nCondCount)
tells the condition its new index within the dialog's condition array
std::unique_ptr< weld::Label > m_xHeader
void setCondition(const css::uno::Reference< css::report::XFormatCondition > &_xCondition)
sets the props at the control
ComparisonOperation impl_getCurrentComparisonOperation() const
std::unique_ptr< weld::ComboBox > m_xOperationList
std::unique_ptr< ConditionField > m_xCondLHS
void impl_layoutOperands()
std::unique_ptr< weld::Container > m_xContainer
void SetForegroundDropdownClick()
std::unique_ptr< weld::Builder > m_xBuilder
void ApplyCommand(sal_uInt16 _nCommandId, const NamedColor &rNamedColor)
forward to the parent class
std::unique_ptr< weld::Button > m_xMoveDown
void impl_setCondition(const OUString &_rConditionFormula)
SvxFontPrevWindow m_aPreview
std::unique_ptr< ColorWindow > m_xForeColorFloat
bool isEmpty() const
determines whether the condition is actually empty
std::unique_ptr< ConditionField > m_xCondRHS
ColorStatus m_aColorStatus
std::shared_ptr< PaletteManager > m_xPaletteManager
std::unique_ptr< ColorWindow > m_xBackColorFloat
std::unique_ptr< weld::Button > m_xAddCondition
std::unique_ptr< weld::Button > m_xRemoveCondition
std::unique_ptr< weld::Button > m_xMoveUp
static sal_uInt16 mapToolbarItemToSlotId(std::u16string_view rItemId)
ConditionColorWrapper m_aForeColorWrapper
IConditionalFormatAction & m_rAction
static size_t getKnownConditionalExpressions(ConditionalExpressions &_out_rCondExp)
fills the given map with all ConditionalExpressions which we know
static bool isFormatCommandEnabled(sal_uInt16 _nCommand, const css::uno::Reference< css::report::XReportControlFormat > &_xControlFormat)
returns <TRUE> when the command is enabled
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
OUString RptResId(TranslateId aId)
#define DBG_UNHANDLED_EXCEPTION(...)
#define LINK(Instance, Class, Member)
#define SAL_N_ELEMENTS(arr)
std::shared_ptr< T > make_shared(Args &&... args)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
std::shared_ptr< ConditionalExpression > PConditionalExpression
IMPL_LINK_NOARG(OAddFieldWindow, FocusChangeHdl, weld::Container &, void)
bool openDialogFormula_nothrow(OUString &_in_out_rFormula, const css::uno::Reference< css::uno::XComponentContext > &_xContext, const css::uno::Reference< css::awt::XWindow > &_xWindow, const css::uno::Reference< css::beans::XPropertySet > &_xRowSet)
opens the formula dialog
IMPL_LINK(OAddFieldWindow, DragBeginHdl, bool &, rUnsetDragIcon, bool)
Reference< XNameAccess > m_xContainer