22#include <bitmaps.hlst>
27#include <com/sun/star/beans/XPropertySet.hpp>
28#include <com/sun/star/form/FormComponentType.hpp>
29#include <com/sun/star/form/runtime/FormController.hpp>
30#include <osl/diagnose.h>
45 OUString GetImage(
const Reference< XPropertySet >& _rxSet )
47 OUString sImageId = RID_EXTBMP_CONTROL;
51 switch( ::comphelper::getINT16( _rxSet->getPropertyValue(
PROPERTY_CLASSID ) ) )
53 case FormComponentType::COMMANDBUTTON: sImageId = RID_EXTBMP_BUTTON;
break;
54 case FormComponentType::FIXEDTEXT: sImageId = RID_EXTBMP_FIXEDTEXT;
break;
55 case FormComponentType::TEXTFIELD: sImageId = RID_EXTBMP_EDITBOX;
break;
56 case FormComponentType::RADIOBUTTON: sImageId = RID_EXTBMP_RADIOBUTTON;
break;
57 case FormComponentType::CHECKBOX: sImageId = RID_EXTBMP_CHECKBOX;
break;
58 case FormComponentType::LISTBOX: sImageId = RID_EXTBMP_LISTBOX;
break;
59 case FormComponentType::COMBOBOX: sImageId = RID_EXTBMP_COMBOBOX;
break;
60 case FormComponentType::GROUPBOX: sImageId = RID_EXTBMP_GROUPBOX;
break;
61 case FormComponentType::IMAGEBUTTON: sImageId = RID_EXTBMP_IMAGEBUTTON;
break;
62 case FormComponentType::FILECONTROL: sImageId = RID_EXTBMP_FILECONTROL;
break;
63 case FormComponentType::HIDDENCONTROL: sImageId = RID_EXTBMP_HIDDEN;
break;
64 case FormComponentType::DATEFIELD: sImageId = RID_EXTBMP_DATEFIELD;
break;
65 case FormComponentType::TIMEFIELD: sImageId = RID_EXTBMP_TIMEFIELD;
break;
66 case FormComponentType::NUMERICFIELD: sImageId = RID_EXTBMP_NUMERICFIELD;
break;
67 case FormComponentType::CURRENCYFIELD: sImageId = RID_EXTBMP_CURRENCYFIELD;
break;
68 case FormComponentType::PATTERNFIELD: sImageId = RID_EXTBMP_PATTERNFIELD;
break;
69 case FormComponentType::IMAGECONTROL: sImageId = RID_EXTBMP_IMAGECONTROL;
break;
70 case FormComponentType::GRIDCONTROL: sImageId = RID_EXTBMP_GRID;
break;
71 case FormComponentType::SCROLLBAR: sImageId = RID_EXTBMP_SCROLLBAR;
break;
72 case FormComponentType::SPINBUTTON: sImageId = RID_EXTBMP_SPINBUTTON;
break;
73 case FormComponentType::NAVIGATIONBAR: sImageId = RID_EXTBMP_NAVIGATIONBAR;
break;
75 OSL_FAIL(
"TabOrderDialog::GetImage: unknown control type" );
84 class OSimpleTabModel :
public ::cppu::WeakImplHelper< XTabControllerModel>
86 Sequence< Reference< XControlModel > > m_aModels;
89 explicit OSimpleTabModel(
const Sequence< Reference< XControlModel > >& _rModels )
90 :m_aModels( _rModels )
95 virtual void SAL_CALL setControlModels(
const Sequence< Reference< XControlModel > >& rModels)
override {m_aModels = rModels;}
96 virtual Sequence< Reference< XControlModel > > SAL_CALL getControlModels()
override {
return m_aModels;}
97 virtual void SAL_CALL setGroup(
const Sequence< Reference< XControlModel > >& ,
const OUString& )
override {}
98 virtual sal_Int32 SAL_CALL getGroupCount()
override {
return 0;}
99 virtual void SAL_CALL getGroup(sal_Int32 , Sequence< Reference< XControlModel > >& , OUString& )
override {}
100 virtual void SAL_CALL getGroupByName(
const OUString& , Sequence< Reference< XControlModel > >& )
override {}
101 virtual sal_Bool SAL_CALL getGroupControl()
override {
return false;} ;
102 virtual void SAL_CALL setGroupControl(
sal_Bool )
override {};
109 const Reference< XControlContainer >& _rxControlCont,
const Reference< XComponentContext >& _rxORB)
110 : GenericDialogController( _pParent,
"modules/spropctrlr/ui/taborder.ui",
"TabOrderDialog")
112 , m_xControlContainer( _rxControlCont )
114 , m_xLB_Controls(m_xBuilder->weld_tree_view(
"CTRLtree"))
115 , m_xPB_OK(m_xBuilder->weld_button(
"ok"))
116 , m_xPB_MoveUp(m_xBuilder->weld_button(
"upB"))
117 , m_xPB_MoveDown(m_xBuilder->weld_button(
"downB"))
118 , m_xPB_AutoOrder(m_xBuilder->weld_button(
"autoB"))
168 const Sequence<Reference<css::awt::XControlModel>> aControlModels =
m_xTempModel->getControlModels();
169 for (
auto const& rControlModel : aControlModels )
171 Reference< XPropertySet > xControl( rControlModel, UNO_QUERY );
172 Reference< XPropertySetInfo > xPI;
174 xPI = xControl->getPropertySetInfo();
182 aImage = GetImage( xControl );
190 OSL_FAIL(
"TabOrderDialog::FillList: invalid control encountered!" );
220 Reference< css::form::runtime::XFormController > xTabController = css::form::runtime::FormController::create( m_xORB );
222 xTabController->setModel( m_xTempModel );
223 xTabController->setContainer( m_xControlContainer );
224 xTabController->autoTabOrder();
229 ::comphelper::disposeComponent( xTabController );
239 int nEntryCount = m_xLB_Controls->n_children();
240 Sequence< Reference< XControlModel > > aSortedControlModelSeq( nEntryCount );
241 const Sequence< Reference< XControlModel > > aControlModels( m_xTempModel->getControlModels());
242 Reference< XControlModel > * pSortedControlModels = aSortedControlModelSeq.getArray();
244 for (
int i = 0;
i < nEntryCount; ++
i)
246 XPropertySet* pEntry = weld::fromId<XPropertySet*>(m_xLB_Controls->get_id(
i));
247 for(
auto const& rControlModel : aControlModels )
249 Reference< XPropertySet > xSet(rControlModel, UNO_QUERY);
250 if (xSet.get() == pEntry)
252 pSortedControlModels[
i] = rControlModel;
259 m_xModel->setControlModels( aSortedControlModelSeq );
276 for (
int i = 0;
i <
abs(nRelPos); ++
i)
283 std::sort(aRows.begin(), aRows.end());
285 int nFirstSelPos = aRows[0];
286 if (nFirstSelPos == 0)
return;
288 for (
auto row : aRows)
290 int nInsertPos = row - 1;
294 for (
auto row : aRows)
297 else if (nRelPos > 0)
299 std::sort(aRows.rbegin(), aRows.rend());
301 int nLastSelPos = aRows[0];
302 if( (nLastSelPos + nRelPos -
i) > (
m_xLB_Controls->n_children()-1) )
return;
304 for (
auto row : aRows)
306 int nInsertPos = row + 1;
310 for (
auto row : aRows)
Reference< XExecutableDialog > m_xDialog
void MoveSelection(int nRelPos)
css::uno::Reference< css::awt::XControlContainer > m_xControlContainer
std::unique_ptr< weld::Button > m_xPB_MoveUp
std::unique_ptr< weld::Button > m_xPB_OK
virtual ~TabOrderDialog() override
TabOrderDialog(weld::Window *pParent, const css::uno::Reference< css::awt::XTabControllerModel > &_rxTabModel, const css::uno::Reference< css::awt::XControlContainer > &_rxControlCont, const css::uno::Reference< css::uno::XComponentContext > &_rxORB)
std::unique_ptr< weld::Button > m_xPB_MoveDown
std::unique_ptr< weld::TreeView > m_xLB_Controls
css::uno::Reference< css::awt::XTabControllerModel > m_xTempModel
css::uno::Reference< css::awt::XTabControllerModel > m_xModel
std::unique_ptr< weld::Button > m_xPB_AutoOrder
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
Reference< frame::XModel > m_xModel
#define LINK(Instance, Class, Member)
class SAL_NO_VTABLE XPropertySet
a property handler for any virtual string properties
IMPL_LINK_NOARG(OBrowserLine, OnButtonFocus, weld::Widget &, void)
OUString toId(const void *pValue)
SwNodeOffset abs(const SwNodeOffset &a)