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