summaryrefslogtreecommitdiff
path: root/reportdesign/source/ui/dlg/Condition.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'reportdesign/source/ui/dlg/Condition.hxx')
-rw-r--r--reportdesign/source/ui/dlg/Condition.hxx116
1 files changed, 53 insertions, 63 deletions
diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx
index d8a03ac82f57..1b9a5ea365fa 100644
--- a/reportdesign/source/ui/dlg/Condition.hxx
+++ b/reportdesign/source/ui/dlg/Condition.hxx
@@ -24,8 +24,6 @@
#include <com/sun/star/report/XFormatCondition.hpp>
-#include <dbaccess/ToolBoxHelper.hxx>
-
#include <svx/colorwindow.hxx>
#include <svx/fntctrl.hxx>
@@ -35,7 +33,8 @@
#include <vcl/button.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/builder.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/customweld.hxx>
+#include <vcl/weld.hxx>
#include <memory>
@@ -50,84 +49,74 @@ namespace rptui
class ConditionField
{
- VclPtr<Condition> m_pParent;
- VclPtr<Edit> m_pSubEdit;
- VclPtr<PushButton> m_pFormula;
+ Condition* m_pParent;
+ std::unique_ptr<weld::Entry> m_xSubEdit;
+ std::unique_ptr<weld::Button> m_xFormula;
- DECL_LINK( OnFormula, Button*, void );
+ DECL_LINK(OnFormula, weld::Button&, void);
public:
- ConditionField(Condition* pParent, Edit* pSubEdit, PushButton *pFormula);
- void GrabFocus() { m_pSubEdit->GrabFocus(); }
- void Show(bool bShow) { m_pSubEdit->Show(bShow); m_pFormula->Show(bShow); }
- void SetText(const OUString& rText) { m_pSubEdit->SetText(rText); }
- OUString GetText() const { return m_pSubEdit->GetText(); }
+ ConditionField(Condition* pParent, std::unique_ptr<weld::Entry> xSubEdit, std::unique_ptr<weld::Button> xFormula);
+ void grab_focus() { m_xSubEdit->grab_focus(); }
+ void set_visible(bool bShow) { m_xSubEdit->set_visible(bShow); m_xFormula->set_visible(bShow); }
+ void set_text(const OUString& rText) { m_xSubEdit->set_text(rText); }
+ OUString get_text() const { return m_xSubEdit->get_text(); }
};
class ConditionColorWrapper
{
public:
- ConditionColorWrapper(Condition* pControl);
- void SetSlotId(sal_uInt16 nSlotId) { mnSlotId = nSlotId; }
+ ConditionColorWrapper(Condition* pControl, sal_uInt16 nSlotId);
void operator()(const OUString& rCommand, const NamedColor& rColor);
void dispose();
private:
- VclPtr<Condition> mxControl;
+ Condition* mpControl;
sal_uInt16 mnSlotId;
};
//= Condition
- class Condition :public VclHBox
- ,public dbaui::OToolBoxHelper
- ,public VclBuilderContainer
+ class Condition
{
- sal_uInt16 m_nBoldId;
- sal_uInt16 m_nItalicId;
- sal_uInt16 m_nUnderLineId;
- sal_uInt16 m_nBackgroundColorId;
- sal_uInt16 m_nFontColorId;
- sal_uInt16 m_nFontDialogId;
std::shared_ptr<PaletteManager> m_xPaletteManager;
ColorStatus m_aColorStatus;
- ConditionColorWrapper m_aColorWrapper;
+ ConditionColorWrapper m_aBackColorWrapper;
+ ConditionColorWrapper m_aForeColorWrapper;
::rptui::OReportController& m_rController;
IConditionalFormatAction& m_rAction;
- VclPtr<FixedText> m_pHeader;
- VclPtr<ListBox> m_pConditionType;
- VclPtr<ListBox> m_pOperationList;
- std::unique_ptr<ConditionField> m_pCondLHS;
- VclPtr<FixedText> m_pOperandGlue;
- std::unique_ptr<ConditionField> m_pCondRHS;
- VclPtr<ToolBox> m_pActions;
- VclPtr<SvxFontPrevWindow> m_pPreview;
- VclPtr<PushButton> m_pMoveUp;
- VclPtr<PushButton> m_pMoveDown;
- VclPtr<PushButton> m_pAddCondition;
- VclPtr<PushButton> m_pRemoveCondition;
- VclPtr<SvxColorWindow> m_pColorFloat;
-
- std::unique_ptr<svx::ToolboxButtonColorUpdater> m_pBtnUpdaterFontColor; // updates the color below the toolbar icon
- std::unique_ptr<svx::ToolboxButtonColorUpdater> m_pBtnUpdaterBackgroundColor;
-
size_t m_nCondIndex;
- bool m_bInDestruction;
ConditionalExpressions m_aConditionalExpressions;
- DECL_LINK( OnFormatAction, ToolBox*, void );
- DECL_LINK( DropdownClick, ToolBox*, void );
- DECL_LINK( OnConditionAction, Button*, void );
+ FontPrevWindow m_aPreview;
+ weld::Window* m_pDialog;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<weld::Label> m_xHeader;
+ std::unique_ptr<weld::ComboBox> m_xConditionType;
+ std::unique_ptr<weld::ComboBox> m_xOperationList;
+ std::unique_ptr<ConditionField> m_xCondLHS;
+ std::unique_ptr<weld::Label> m_xOperandGlue;
+ std::unique_ptr<ConditionField> m_xCondRHS;
+ std::unique_ptr<weld::Toolbar> m_xActions;
+ std::unique_ptr<weld::CustomWeld> m_xPreview;
+ std::unique_ptr<weld::Button> m_xMoveUp;
+ std::unique_ptr<weld::Button> m_xMoveDown;
+ std::unique_ptr<weld::Button> m_xAddCondition;
+ std::unique_ptr<weld::Button> m_xRemoveCondition;
+ std::unique_ptr<ColorWindow> m_xBackColorFloat;
+ std::unique_ptr<ColorWindow> m_xForeColorFloat;
+
+ void SetBackgroundDropdownClick();
+ void SetForegroundDropdownClick();
+
+ DECL_LINK( OnFormatAction, const OString&, void );
+ DECL_LINK( OnConditionAction, weld::Button&, void );
public:
- Condition( vcl::Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController );
- virtual ~Condition() override;
- virtual void dispose() override;
-
- /** will be called when the controls need to be resized.
- */
- virtual void resizeControls(const Size& _rDiff) override;
+ Condition(weld::Container* pParent, weld::Window* pDialog, IConditionalFormatAction& rAction, ::rptui::OReportController& rController);
+ ~Condition();
/** sets the props at the control
@param _xCondition the source
@@ -160,10 +149,14 @@ namespace rptui
::rptui::OReportController& getController() const { return m_rController; }
- sal_uInt16 mapToolbarItemToSlotId(sal_uInt16 nItemId) const;
+ static sal_uInt16 mapToolbarItemToSlotId(const OString& rItemId);
- protected:
- virtual void GetFocus() override;
+ css::uno::Reference<css::awt::XWindow> GetXWindow() const { return m_pDialog->GetXWindow(); }
+
+ void grab_focus() { m_xContainer->grab_focus(); }
+ bool has_focus() const { return m_xContainer->has_focus(); }
+ Size get_preferred_size() const { return m_xContainer->get_preferred_size(); }
+ weld::Widget* get_widget() const { return m_xContainer.get(); }
private:
void impl_layoutOperands();
@@ -177,23 +170,20 @@ namespace rptui
void impl_setCondition( const OUString& _rConditionFormula );
private:
- DECL_LINK( OnTypeSelected, ListBox&, void );
- DECL_LINK( OnOperationSelected, ListBox&, void );
+ DECL_LINK( OnTypeSelected, weld::ComboBox&, void );
+ DECL_LINK( OnOperationSelected, weld::ComboBox&, void );
};
-
inline ConditionType Condition::impl_getCurrentConditionType() const
{
- return sal::static_int_cast< ConditionType >( m_pConditionType->GetSelectedEntryPos() );
+ return sal::static_int_cast<ConditionType>(m_xConditionType->get_active());
}
-
inline ComparisonOperation Condition::impl_getCurrentComparisonOperation() const
{
- return sal::static_int_cast< ComparisonOperation >( m_pOperationList->GetSelectedEntryPos() );
+ return sal::static_int_cast<ComparisonOperation>(m_xOperationList->get_active());
}
-
} // namespace rptui
#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_DLG_CONDITION_HXX