1*cdf0e10cSrcweir* Obsolete notes ... 2*cdf0e10cSrcweir 3*cdf0e10cSrcweir** Form XML format: 4*cdf0e10cSrcweir 5*cdf0e10cSrcweir + from the basic editor: 6*cdf0e10cSrcweir 7*cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 8*cdf0e10cSrcweir<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd"> 9*cdf0e10cSrcweir<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Dialog1" dlg:left="204" dlg:top="148" dlg:width="136" dlg:height="115" dlg:closeable="true" dlg:moveable="true"> 10*cdf0e10cSrcweir <dlg:bulletinboard> 11*cdf0e10cSrcweir <dlg:button dlg:id="OkButtonName" dlg:tab-index="0" dlg:left="86" dlg:top="92" dlg:width="44" dlg:height="19" dlg:value="OkButtonLabel"/> 12*cdf0e10cSrcweir <dlg:titledbox dlg:id="FrameControl1" dlg:tab-index="1" dlg:left="4" dlg:top="7" dlg:width="68" dlg:height="41"> 13*cdf0e10cSrcweir <dlg:title dlg:value="FrameControl1"/> 14*cdf0e10cSrcweir </dlg:titledbox> 15*cdf0e10cSrcweir <dlg:scrollbar dlg:id="ScrollBar1" dlg:tab-index="2" dlg:left="82" dlg:top="10" dlg:width="45" dlg:height="24"/> 16*cdf0e10cSrcweir <dlg:scrollbar dlg:id="ScrollBar2" dlg:tab-index="3" dlg:left="107" dlg:top="43" dlg:width="21" dlg:height="37" dlg:align="vertical"/> 17*cdf0e10cSrcweir <dlg:timefield dlg:id="TimeField1" dlg:tab-index="4" dlg:left="4" dlg:top="92" dlg:width="28" dlg:height="19"/> 18*cdf0e10cSrcweir <dlg:text dlg:id="Label1" dlg:tab-index="5" dlg:left="22" dlg:top="61" dlg:width="44" dlg:height="15" dlg:value="Label1"/> 19*cdf0e10cSrcweir </dlg:bulletinboard> 20*cdf0e10cSrcweir</dlg:window> 21*cdf0e10cSrcweir 22*cdf0e10cSrcweir + code to read this & generate UIs is in: 23*cdf0e10cSrcweir + DTD: xmlscript/dtd/dialog.dtd 24*cdf0e10cSrcweir + xmlscript/source/xmldlg_imexp/imp_share.hxx, line 674 25*cdf0e10cSrcweir + xmlscript/source/misc/unoservices.cxx 26*cdf0e10cSrcweir xmlscript/source/xmlflat_imexp/xmlbas_import.cxx (?) 27*cdf0e10cSrcweir "com.sun.star.comp.xmlscript.XMLBasicImporter" 28*cdf0e10cSrcweir + the dialog piece seems separate ? 29*cdf0e10cSrcweir "importDialogModel" ... 30*cdf0e10cSrcweir + cf. the interesting test code ... 31*cdf0e10cSrcweir + cd xmlscript/test 32*cdf0e10cSrcweir dmake 33*cdf0e10cSrcweir ../unxlngi6.pro/bin/imexp /opt/OOInstall ./test.xml 34*cdf0e10cSrcweir + generates & renders a dialog ... 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir + This code has ~all we need to get a simple impl. 37*cdf0e10cSrcweir + compatibility wrappers [!] 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir // first create model: 40*cdf0e10cSrcweir Reference< container::XNameContainer > xModel( xContext->getServiceManager()->createInstanceWithContext( 41*cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ), xContext ), UNO_QUERY ); 42*cdf0e10cSrcweir // NB. xmldlg_addfunc.cxx not xmldlg_import.cxx [!?] ;-) 43*cdf0e10cSrcweir ::xmlscript::importDialogModel( ::xmlscript::createInputStream( bytes ), 44*cdf0e10cSrcweir xModel, xContext ); 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir // second create view of model: 47*cdf0e10cSrcweir Reference< awt::XControl > xDlg( xMSF->createInstance( 48*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialog" ) ) ), UNO_QUERY ); 49*cdf0e10cSrcweir xDlg->setModel( Reference< awt::XControlModel >::query( xModel ) ); 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir // third - associate toolkit / peer ... 52*cdf0e10cSrcweir Reference< awt::XToolkit> xToolkit( xMSF->createInstance( 53*cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.ExtToolkit" ) ) ), UNO_QUERY ); 54*cdf0e10cSrcweir xDlg->createPeer( xToolkit, 0 ); 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir // fourth - execute [ nasty ... ] 57*cdf0e10cSrcweir Reference< awt::XDialog > xD( xDlg, UNO_QUERY ); 58*cdf0e10cSrcweir xD->execute(); 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir** Basic dialog editor: 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir + basctl/source/dlged/dlged.cxx 64*cdf0e10cSrcweir + dialog editor (?) 65*cdf0e10cSrcweir + basctl/source/basicide/basobj3.cxx 66*cdf0e10cSrcweir + basctl/source/basicide/basides3.cxx 67*cdf0e10cSrcweir + BasicIDEShell:CreateDlgWin ... 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir** FIXME: 71*cdf0e10cSrcweir + createPeer - when called is always passed 72*cdf0e10cSrcweir the toplevel [ it seems ... ] 73*cdf0e10cSrcweir + we need to pass a container instead ... 74*cdf0e10cSrcweir + or have some separate hint / method ? 75*cdf0e10cSrcweir + or call the 'setChild' inside the model 76*cdf0e10cSrcweir construction bits ? [!?] 77*cdf0e10cSrcweir 78*cdf0e10cSrcweirUnoControlContainer::addingControl: 79*cdf0e10cSrcweir + only caller to 'setContext' 80*cdf0e10cSrcweir + sets the 'Parent' for peers ... 81*cdf0e10cSrcweir 82*cdf0e10cSrcweirDialog is an UnoControlContainer ... 83*cdf0e10cSrcweir + hmm ... 84*cdf0e10cSrcweir + 'XControlContainer' 85*cdf0e10cSrcweir + perhaps just what we need ... [!] 86*cdf0e10cSrcweir + our VBox should be one ... 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir + Other things: tab widgets are 'UnoControlContainers' ... 89*cdf0e10cSrcweir + finally remembered: xml foo ... 90*cdf0e10cSrcweir + 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir + FIXME: it -seems- that we don't store 94*cdf0e10cSrcweir much hierarchy in the model [ any ? ] 95*cdf0e10cSrcweir + UnoControlModel -> ? 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir + UnoControlDialogModel - has an XNameContainer ... 98*cdf0e10cSrcweir + but ... only the UnoControl-Dialog-Model has this ... 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir + Wow - even the percieved hierarchy: 102*cdf0e10cSrcweir + 'exportDialogModel' 103*cdf0e10cSrcweir + achieved by 'getElementNames' 104*cdf0e10cSrcweir -> flat set of names ... [urgh] 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir + So - we need to add more structure: 107*cdf0e10cSrcweir + XNameContainers ... 108*cdf0e10cSrcweir + that we insert into [!?] 109*cdf0e10cSrcweir + we also need to retain order for packing. 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir + need a list of sillies to reverse / revert (?) ... 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir + back-compat: 114*cdf0e10cSrcweir + kill bogus nesting eg. radiogroup ... 115*cdf0e10cSrcweir [ have a group/tag instead - or hierarchical names ? ] 116*cdf0e10cSrcweir + ditto for 'titledbox' ... 117*cdf0e10cSrcweir + menulists - seem rather unrelated / bogus anyway. 118*cdf0e10cSrcweir + Add into toplevel & child ... 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir + copy Dialog bits into unocontrolcontainer.cxx ... 121*cdf0e10cSrcweir + re-using unocontrolcontainer ... 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir** FIXME: 125*cdf0e10cSrcweir + we need property introspection on the awt widgets: 126*cdf0e10cSrcweir + but they have no property interfaces [!] - 127*cdf0e10cSrcweir interestingly the UnoControl's don't either 128*cdf0e10cSrcweir only the UnoControlModel foo ... 129*cdf0e10cSrcweir + unocontrols.cxx: 130*cdf0e10cSrcweir Uno 131*cdf0e10cSrcweir + source/helper/property.cxx 132*cdf0e10cSrcweir + has all the type information ... 133*cdf0e10cSrcweir + but no information on what properties are 134*cdf0e10cSrcweir valid for a type ... - implicit in the UnoControlModel's 135*cdf0e10cSrcweir code ... 136*cdf0e10cSrcweir + ImplGetPropertyInfos ... 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir + add to vclxwindow.cxx: 139*cdf0e10cSrcweir + inc/toolkit/helper/property.hxx 140*cdf0e10cSrcweir + 'getProperties' static ... 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir** It seems that things like UnoControlComboBoxModel are missing 143*cdf0e10cSrcweir some derived properties: EchoChar (etc.) 144*cdf0e10cSrcweir UnoControlDateFieldModel - missing ... EchoChar too (?) - deliberate ? 145*cdf0e10cSrcweir + query these ... [!?] 146*cdf0e10cSrcweir 147*cdf0e10cSrcweirlayout container - start child 'combobox' 148*cdf0e10cSrcweir missing property 46 (EchoChar) 149*cdf0e10cSrcweir missing property 48 (HardLineBreaks) 150*cdf0e10cSrcweir missing property 12 (HScroll) 151*cdf0e10cSrcweir missing property 104 (LineEndFormat) 152*cdf0e10cSrcweir missing property 10 (MultiLine) 153*cdf0e10cSrcweir missing property 13 (VScroll) 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir + add regression test: 156*cdf0e10cSrcweir + count number of properties ... 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir 159*cdf0e10cSrcweirTODO: 160*cdf0e10cSrcweir add 'XPropertySetInfo' to VCLXWindow: 161*cdf0e10cSrcweir + trivial to implement :-) 162*cdf0e10cSrcweir + hook it to Ricardo's parser ... [!] :-) 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir* xmlscript 165*cdf0e10cSrcweir + xmldlg_import.cxx - 166*cdf0e10cSrcweir + xml_helper/xml_impctx.cxx - foo ... 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir* plan: 170*cdf0e10cSrcweir + hard-code container hooks into the xmlscript/ parser ... 171*cdf0e10cSrcweir + create a layout object in toolkit/ 172*cdf0e10cSrcweir + populate it with good things ... 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir + coupling to toolkit - widget instantiation: how ... 175*cdf0e10cSrcweir + ComponentInfos 176*cdf0e10cSrcweir + vclxtoolkit.cxx: 177*cdf0e10cSrcweir + has a 'hook function' for 'fnSvtCreateWindow' 178*cdf0e10cSrcweir for SVT widgets :-) [ grotesque ;-] 179*cdf0e10cSrcweir + [ wow - fetched by dlopen! ;-] 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir + A little app - a-la solver: using awt (?) 182*cdf0e10cSrcweir + XMessageBoxFactory ... 183*cdf0e10cSrcweir + XToolkit: 184*cdf0e10cSrcweir + CreateWindow ... 185*cdf0e10cSrcweir + ** how does the xml code generate these guys ? ** 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir + what APIs does the xmlimporter use ? not 'createWindow' seemingly. 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir+ existing xml import uses: property bag a -lot-: 190*cdf0e10cSrcweir Reference< beans::XPropertySet > xProps( 191*cdf0e10cSrcweir _pImport->_xDialogModel, UNO_QUERY_THROW ); 192*cdf0e10cSrcweir * we do _xDialogModel->insertByName (new any<XControlModel>()) 193*cdf0e10cSrcweir + to build hierarchy ( cf. ~ControlImportContext ) 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir DialogImport: 196*cdf0e10cSrcweir css::uno::Reference< css::container::XNameContainer > _xDialogModel; 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir Reference< container::XNameContainer > xModel( xContext->getServiceManager()->createInstanceWithContext( 199*cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ), xContext ), UNO_QUERY ); 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir toolkit/source/controls/dialogcontrol.cxx 202*cdf0e10cSrcweir + UnoControlButtonModel (eg.) 203*cdf0e10cSrcweir + service 'UnoControlModel' ... 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir + poke at 'titledbox' or 'radiogroup' to see how containment works there ... 206*cdf0e10cSrcweir + how will child widget properties work ? 207*cdf0e10cSrcweir + bug with a 'vbox' inside a 'titledbox' ... 208*cdf0e10cSrcweir + titledbox - acts as a container (interesting) 209*cdf0e10cSrcweir - offsetting child positions 210*cdf0e10cSrcweir + how will pseudo-containers eg. "radiogroup" cope ? 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir + propose new syntax: [ with child properties a-la glade ]: 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir <hbox id="baa" flange="true"> 215*cdf0e10cSrcweir <child padding="0" expand="false" fill="false"> 216*cdf0e10cSrcweir <radio id="foo" value="..."/> 217*cdf0e10cSrcweir </child> 218*cdf0e10cSrcweir <radio id="foo" value="..."/> 219*cdf0e10cSrcweir </hbox> 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir + if 'child' element omitted - default properties used ... 222*cdf0e10cSrcweir + if multiple elements in same 'child' set: all have the same props. 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir 225