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