2012-03-26 12:15:22 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* Version: MPL 1.1 / GPLv3+ / LGPLv3+
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.)
|
2012-03-27 14:20:17 +01:00
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2012 the
|
2012-03-26 12:15:22 +01:00
|
|
|
* Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): Caolán McNamara <caolanm@redhat.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
|
|
|
|
* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
|
|
|
|
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
|
|
|
|
* instead of those above.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <vcl/builder.hxx>
|
|
|
|
#include <vcl/button.hxx>
|
|
|
|
#include <vcl/dialog.hxx>
|
2012-03-27 14:32:24 +01:00
|
|
|
#include <vcl/edit.hxx>
|
2012-04-04 09:30:41 +01:00
|
|
|
#include <vcl/field.hxx>
|
2012-03-26 12:15:22 +01:00
|
|
|
#include <vcl/fixed.hxx>
|
|
|
|
#include <vcl/layout.hxx>
|
2012-04-04 09:30:41 +01:00
|
|
|
#include <vcl/lstbox.hxx>
|
2012-03-26 12:15:22 +01:00
|
|
|
|
|
|
|
VclBuilder::VclBuilder(Window *pParent, rtl::OUString sUri)
|
|
|
|
{
|
|
|
|
xmlreader::XmlReader reader(sUri);
|
|
|
|
|
2012-03-27 14:20:17 +01:00
|
|
|
handleChild(pParent, reader);
|
2012-03-26 12:15:22 +01:00
|
|
|
|
|
|
|
for (std::vector<Window*>::iterator aI = m_aChildren.begin(),
|
|
|
|
aEnd = m_aChildren.end(); aI != aEnd; ++aI)
|
|
|
|
{
|
|
|
|
Window *pWindow = *aI;
|
|
|
|
if (pWindow)
|
|
|
|
{
|
|
|
|
pWindow->Show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
VclBuilder::~VclBuilder()
|
|
|
|
{
|
|
|
|
for (std::vector<Window*>::reverse_iterator aI = m_aChildren.rbegin(),
|
|
|
|
aEnd = m_aChildren.rend(); aI != aEnd; ++aI)
|
|
|
|
{
|
|
|
|
Window *pWindow = *aI;
|
|
|
|
delete pWindow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-27 14:20:17 +01:00
|
|
|
Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, bool bVertical)
|
2012-03-26 12:15:22 +01:00
|
|
|
{
|
|
|
|
Window *pWindow = NULL;
|
2012-03-27 14:20:17 +01:00
|
|
|
if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkDialog")))
|
2012-03-26 12:15:22 +01:00
|
|
|
{
|
2012-04-05 21:28:08 +01:00
|
|
|
pWindow = new Dialog(pParent, WB_SIZEMOVE|WB_3DLOOK|WB_CLOSEABLE);
|
2012-03-26 12:15:22 +01:00
|
|
|
}
|
2012-03-27 14:20:17 +01:00
|
|
|
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkBox")))
|
|
|
|
{
|
2012-04-11 11:41:54 +01:00
|
|
|
// <property name="visible">True</property>
|
|
|
|
// <property name="can_focus">False</property>
|
|
|
|
// <property name="orientation">vertical</property>
|
|
|
|
// <property name="spacing">6</property>
|
|
|
|
// <property name="homogeneous">True</property>
|
2012-03-27 14:20:17 +01:00
|
|
|
if (bVertical)
|
|
|
|
pWindow = new VclVBox(pParent);
|
|
|
|
else
|
|
|
|
pWindow = new VclHBox(pParent);
|
|
|
|
}
|
|
|
|
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkButtonBox")))
|
|
|
|
{
|
|
|
|
if (bVertical)
|
|
|
|
pWindow = new VclVButtonBox(pParent);
|
|
|
|
else
|
|
|
|
pWindow = new VclHButtonBox(pParent);
|
|
|
|
}
|
2012-04-05 20:43:33 +01:00
|
|
|
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkGrid")))
|
|
|
|
{
|
2012-04-11 11:41:54 +01:00
|
|
|
// <property name="row_spacing">4</property>
|
|
|
|
// <property name="column_spacing">2</property>
|
|
|
|
// <property name="row_homogeneous">True</property>
|
|
|
|
// <property name="column_homogeneous">True</property>
|
2012-04-05 20:43:33 +01:00
|
|
|
pWindow = new VclGrid(pParent);
|
|
|
|
}
|
2012-04-11 11:41:54 +01:00
|
|
|
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkFrame")))
|
|
|
|
{
|
|
|
|
// <property name="label_xalign">0</property>
|
|
|
|
// <property name="shadow_type">none</property>
|
|
|
|
pWindow = new VclFrame(pParent);
|
|
|
|
}
|
2012-04-16 10:12:57 +01:00
|
|
|
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkAlignment")))
|
|
|
|
{
|
|
|
|
// <property name="label_xalign">0</property>
|
|
|
|
// <property name="shadow_type">none</property>
|
|
|
|
pWindow = new VclAlignment(pParent);
|
|
|
|
}
|
2012-03-27 14:20:17 +01:00
|
|
|
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkButton")))
|
2012-03-26 12:15:22 +01:00
|
|
|
{
|
2012-04-04 09:30:41 +01:00
|
|
|
pWindow = new PushButton(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK);
|
2012-03-26 12:15:22 +01:00
|
|
|
}
|
2012-03-27 14:20:17 +01:00
|
|
|
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkRadioButton")))
|
2012-03-26 12:15:22 +01:00
|
|
|
{
|
2012-04-04 09:30:41 +01:00
|
|
|
pWindow = new RadioButton(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK);
|
2012-03-26 12:15:22 +01:00
|
|
|
}
|
2012-03-27 14:32:24 +01:00
|
|
|
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkCheckButton")))
|
|
|
|
{
|
2012-04-04 09:30:41 +01:00
|
|
|
pWindow = new CheckBox(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK);
|
2012-03-27 14:32:24 +01:00
|
|
|
}
|
2012-03-27 16:32:28 +01:00
|
|
|
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkSpinButton")))
|
|
|
|
{
|
2012-04-04 09:30:41 +01:00
|
|
|
pWindow = new NumericField(pParent, WB_RIGHT|WB_SPIN|WB_BORDER|WB_3DLOOK);
|
2012-03-27 16:32:28 +01:00
|
|
|
}
|
|
|
|
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkComboBox")))
|
|
|
|
{
|
2012-04-04 09:30:41 +01:00
|
|
|
pWindow = new ListBox(pParent, WB_DROPDOWN|WB_CENTER|WB_VCENTER|WB_3DLOOK);
|
2012-03-27 16:32:28 +01:00
|
|
|
}
|
2012-03-27 14:20:17 +01:00
|
|
|
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkLabel")))
|
2012-03-26 12:15:22 +01:00
|
|
|
{
|
2012-04-04 09:30:41 +01:00
|
|
|
pWindow = new FixedText(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK);
|
2012-03-26 12:15:22 +01:00
|
|
|
}
|
2012-03-27 14:32:24 +01:00
|
|
|
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkEntry")))
|
|
|
|
{
|
2012-04-04 09:30:41 +01:00
|
|
|
pWindow = new Edit(pParent, WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK );
|
2012-03-27 14:32:24 +01:00
|
|
|
}
|
2012-03-26 12:15:22 +01:00
|
|
|
else
|
|
|
|
{
|
2012-03-27 14:20:17 +01:00
|
|
|
fprintf(stderr, "TO-DO, implement %s\n", name.getStr());
|
2012-03-26 12:15:22 +01:00
|
|
|
}
|
2012-03-27 14:20:17 +01:00
|
|
|
fprintf(stderr, "for %s, created %p child of %p\n", name.getStr(), pWindow, pParent);
|
2012-03-26 12:15:22 +01:00
|
|
|
return pWindow;
|
|
|
|
}
|
|
|
|
|
2012-03-27 14:20:17 +01:00
|
|
|
Window *VclBuilder::insertObject(Window *pParent, const rtl::OString &rClass, stringmap &rMap)
|
2012-03-26 12:15:22 +01:00
|
|
|
{
|
2012-03-27 14:20:17 +01:00
|
|
|
bool bVertical = false;
|
|
|
|
stringmap::iterator aFind = rMap.find(rtl::OString(RTL_CONSTASCII_STRINGPARAM("orientation")));
|
|
|
|
if (aFind != rMap.end())
|
2012-04-16 10:50:23 +01:00
|
|
|
{
|
2012-03-27 14:20:17 +01:00
|
|
|
bVertical = aFind->second.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("vertical"));
|
2012-04-16 10:50:23 +01:00
|
|
|
rMap.erase(aFind);
|
|
|
|
}
|
2012-03-26 12:15:22 +01:00
|
|
|
|
2012-03-27 14:20:17 +01:00
|
|
|
Window *pCurrentChild = makeObject(pParent, rClass, bVertical);
|
|
|
|
if (!pCurrentChild)
|
|
|
|
fprintf(stderr, "missing object!\n");
|
2012-03-26 12:15:22 +01:00
|
|
|
|
2012-03-27 14:20:17 +01:00
|
|
|
if (pCurrentChild)
|
|
|
|
{
|
|
|
|
m_aChildren.push_back(pCurrentChild);
|
2012-03-26 12:15:22 +01:00
|
|
|
|
2012-03-27 14:20:17 +01:00
|
|
|
for (stringmap::iterator aI = rMap.begin(), aEnd = rMap.end(); aI != aEnd; ++aI)
|
2012-03-26 12:15:22 +01:00
|
|
|
{
|
2012-03-27 14:20:17 +01:00
|
|
|
const rtl::OString &rKey = aI->first;
|
|
|
|
const rtl::OString &rValue = aI->second;
|
2012-04-16 10:50:23 +01:00
|
|
|
pCurrentChild->set_property(rKey, rValue);
|
2012-03-26 12:15:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-16 10:50:23 +01:00
|
|
|
rMap.clear();
|
|
|
|
|
2012-03-26 12:15:22 +01:00
|
|
|
if (!pCurrentChild)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "missing object!\n");
|
|
|
|
pCurrentChild = m_aChildren.empty() ? pParent : m_aChildren.back();
|
|
|
|
}
|
2012-03-27 14:20:17 +01:00
|
|
|
return pCurrentChild;
|
|
|
|
}
|
2012-03-26 12:15:22 +01:00
|
|
|
|
2012-03-27 14:20:17 +01:00
|
|
|
void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
|
|
|
|
{
|
2012-03-26 12:15:22 +01:00
|
|
|
int nLevel = 1;
|
|
|
|
|
2012-03-27 16:32:28 +01:00
|
|
|
Window *pCurrentChild = NULL;
|
|
|
|
|
2012-03-26 12:15:22 +01:00
|
|
|
while(1)
|
|
|
|
{
|
2012-03-27 14:20:17 +01:00
|
|
|
xmlreader::Span name;
|
|
|
|
int nsId;
|
2012-03-26 12:15:22 +01:00
|
|
|
xmlreader::XmlReader::Result res = reader.nextItem(
|
|
|
|
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
|
|
|
|
|
2012-03-27 14:20:17 +01:00
|
|
|
if (res == xmlreader::XmlReader::RESULT_BEGIN)
|
|
|
|
{
|
|
|
|
if (name.equals(RTL_CONSTASCII_STRINGPARAM("object")))
|
|
|
|
{
|
2012-03-27 16:32:28 +01:00
|
|
|
pCurrentChild = handleObject(pParent, reader);
|
2012-03-28 14:10:13 +01:00
|
|
|
|
|
|
|
if (pCurrentChild)
|
|
|
|
{
|
|
|
|
rtl::OString sPosition(RTL_CONSTASCII_STRINGPARAM("position"));
|
|
|
|
std::vector<Window*> aChilds;
|
|
|
|
for (Window* pChild = pCurrentChild->GetWindow(WINDOW_FIRSTCHILD); pChild;
|
|
|
|
pChild = pChild->GetWindow(WINDOW_NEXT))
|
|
|
|
{
|
|
|
|
aChilds.push_back(pChild);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < aChilds.size(); ++i)
|
|
|
|
{
|
|
|
|
sal_uInt16 nPosition = aChilds[i]->getWidgetProperty<sal_uInt16>(sPosition);
|
|
|
|
aChilds[i]->reorderWithinParent(nPosition);
|
|
|
|
}
|
|
|
|
}
|
2012-03-27 16:32:28 +01:00
|
|
|
}
|
|
|
|
else if (name.equals(RTL_CONSTASCII_STRINGPARAM("packing")))
|
|
|
|
{
|
|
|
|
handlePacking(pCurrentChild, reader);
|
2012-03-27 14:20:17 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
++nLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (res == xmlreader::XmlReader::RESULT_END)
|
|
|
|
{
|
|
|
|
--nLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!nLevel)
|
|
|
|
break;
|
|
|
|
|
2012-03-26 12:15:22 +01:00
|
|
|
if (res == xmlreader::XmlReader::RESULT_DONE)
|
|
|
|
break;
|
2012-03-27 14:20:17 +01:00
|
|
|
}
|
|
|
|
}
|
2012-03-26 12:15:22 +01:00
|
|
|
|
2012-03-27 16:32:28 +01:00
|
|
|
Window* VclBuilder::handleObject(Window *pParent, xmlreader::XmlReader &reader)
|
2012-03-27 14:20:17 +01:00
|
|
|
{
|
|
|
|
rtl::OString sClass;
|
2012-03-26 12:15:22 +01:00
|
|
|
|
2012-03-27 14:20:17 +01:00
|
|
|
xmlreader::Span name;
|
|
|
|
int nsId;
|
|
|
|
|
|
|
|
while (reader.nextAttribute(&nsId, &name))
|
|
|
|
{
|
|
|
|
if (name.equals(RTL_CONSTASCII_STRINGPARAM("class")))
|
2012-03-26 12:15:22 +01:00
|
|
|
{
|
2012-03-27 14:20:17 +01:00
|
|
|
name = reader.getAttributeValue(false);
|
|
|
|
sClass = rtl::OString(name.begin, name.length);
|
2012-03-26 12:15:22 +01:00
|
|
|
}
|
2012-03-27 14:20:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int nLevel = 1;
|
|
|
|
|
|
|
|
stringmap aProperties;
|
2012-03-26 12:15:22 +01:00
|
|
|
|
2012-03-27 14:20:17 +01:00
|
|
|
Window *pCurrentChild = NULL;
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
xmlreader::XmlReader::Result res = reader.nextItem(
|
|
|
|
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
|
|
|
|
|
|
|
|
if (res == xmlreader::XmlReader::RESULT_DONE)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (res == xmlreader::XmlReader::RESULT_BEGIN)
|
2012-03-26 12:15:22 +01:00
|
|
|
{
|
2012-03-27 14:20:17 +01:00
|
|
|
if (name.equals(RTL_CONSTASCII_STRINGPARAM("child")))
|
|
|
|
{
|
|
|
|
if (!pCurrentChild)
|
|
|
|
pCurrentChild = insertObject(pParent, sClass, aProperties);
|
|
|
|
handleChild(pCurrentChild, reader);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
++nLevel;
|
|
|
|
if (name.equals(RTL_CONSTASCII_STRINGPARAM("property")))
|
|
|
|
collectProperty(reader, aProperties);
|
|
|
|
}
|
2012-03-26 12:15:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (res == xmlreader::XmlReader::RESULT_END)
|
|
|
|
{
|
|
|
|
--nLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!nLevel)
|
|
|
|
break;
|
|
|
|
}
|
2012-03-27 14:20:17 +01:00
|
|
|
|
|
|
|
if (!pCurrentChild)
|
2012-03-27 16:32:28 +01:00
|
|
|
pCurrentChild = insertObject(pParent, sClass, aProperties);
|
2012-03-27 14:20:17 +01:00
|
|
|
|
2012-03-27 16:32:28 +01:00
|
|
|
return pCurrentChild;
|
2012-03-26 12:15:22 +01:00
|
|
|
}
|
|
|
|
|
2012-03-27 16:32:28 +01:00
|
|
|
void VclBuilder::handlePacking(Window *pCurrent, xmlreader::XmlReader &reader)
|
|
|
|
{
|
|
|
|
xmlreader::Span name;
|
|
|
|
int nsId;
|
|
|
|
|
|
|
|
int nLevel = 1;
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
xmlreader::XmlReader::Result res = reader.nextItem(
|
|
|
|
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
|
|
|
|
|
|
|
|
if (res == xmlreader::XmlReader::RESULT_DONE)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (res == xmlreader::XmlReader::RESULT_BEGIN)
|
|
|
|
{
|
|
|
|
++nLevel;
|
|
|
|
if (name.equals(RTL_CONSTASCII_STRINGPARAM("property")))
|
|
|
|
applyPackingProperty(pCurrent, reader);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (res == xmlreader::XmlReader::RESULT_END)
|
|
|
|
{
|
|
|
|
--nLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!nLevel)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VclBuilder::applyPackingProperty(Window *pCurrent,
|
|
|
|
xmlreader::XmlReader &reader)
|
2012-03-26 12:15:22 +01:00
|
|
|
{
|
|
|
|
xmlreader::Span name;
|
|
|
|
int nsId;
|
|
|
|
|
2012-03-27 16:32:28 +01:00
|
|
|
if (!pCurrent)
|
|
|
|
return;
|
|
|
|
|
2012-03-27 14:20:17 +01:00
|
|
|
while (reader.nextAttribute(&nsId, &name))
|
|
|
|
{
|
2012-03-27 16:32:28 +01:00
|
|
|
if (name.equals(RTL_CONSTASCII_STRINGPARAM("name")))
|
|
|
|
{
|
|
|
|
name = reader.getAttributeValue(false);
|
|
|
|
rtl::OString sKey(name.begin, name.length);
|
2012-04-05 20:43:33 +01:00
|
|
|
sKey = sKey.replace('_', '-');
|
2012-03-27 16:32:28 +01:00
|
|
|
reader.nextItem(
|
|
|
|
xmlreader::XmlReader::TEXT_NORMALIZED, &name, &nsId);
|
|
|
|
rtl::OString sValue(name.begin, name.length);
|
|
|
|
|
|
|
|
if ( sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("expand")) ||
|
|
|
|
sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("fill")) )
|
|
|
|
{
|
|
|
|
bool bTrue = (sValue[0] == 't' || sValue[0] == 'T' || sValue[0] == '1');
|
|
|
|
pCurrent->setChildProperty(sKey, bTrue);
|
|
|
|
}
|
2012-03-28 14:10:13 +01:00
|
|
|
else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("position")))
|
|
|
|
{
|
|
|
|
pCurrent->setChildProperty(sKey, static_cast<sal_uInt16>(sValue.toInt32()));
|
|
|
|
}
|
2012-04-05 20:43:33 +01:00
|
|
|
else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("pack-type")))
|
2012-03-29 10:27:27 +01:00
|
|
|
{
|
|
|
|
sal_Int32 nPackType = (sValue[0] == 'e' || sValue[0] == 'e') ? VCL_PACK_END : VCL_PACK_START;
|
2012-04-05 20:43:33 +01:00
|
|
|
pCurrent->setChildProperty(sKey, nPackType);
|
|
|
|
}
|
|
|
|
else if (
|
|
|
|
sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("left-attach")) ||
|
|
|
|
sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("top-attach")) ||
|
|
|
|
sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("width")) ||
|
|
|
|
sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("height"))
|
|
|
|
)
|
|
|
|
{
|
|
|
|
pCurrent->setChildProperty(sKey, sValue.toInt32());
|
2012-03-29 10:27:27 +01:00
|
|
|
}
|
2012-03-27 16:32:28 +01:00
|
|
|
else
|
|
|
|
fprintf(stderr, "unknown packing %s\n", sKey.getStr());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VclBuilder::collectProperty(xmlreader::XmlReader &reader, stringmap &rMap)
|
|
|
|
{
|
|
|
|
xmlreader::Span name;
|
|
|
|
int nsId;
|
2012-03-26 12:15:22 +01:00
|
|
|
|
2012-03-27 16:32:28 +01:00
|
|
|
while (reader.nextAttribute(&nsId, &name))
|
|
|
|
{
|
2012-03-26 12:15:22 +01:00
|
|
|
if (name.equals(RTL_CONSTASCII_STRINGPARAM("name")))
|
|
|
|
{
|
|
|
|
name = reader.getAttributeValue(false);
|
2012-03-27 14:20:17 +01:00
|
|
|
rtl::OString sProperty(name.begin, name.length);
|
2012-04-16 10:50:23 +01:00
|
|
|
sProperty = sProperty.replace('_', '-');
|
2012-03-27 14:20:17 +01:00
|
|
|
reader.nextItem(
|
|
|
|
xmlreader::XmlReader::TEXT_NORMALIZED, &name, &nsId);
|
|
|
|
rtl::OString sValue(name.begin, name.length);
|
2012-04-16 10:50:23 +01:00
|
|
|
rMap[sProperty] = sValue.replace('_', '-');
|
2012-03-26 12:15:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Window *VclBuilder::get_widget_root()
|
|
|
|
{
|
|
|
|
return m_aChildren.empty() ? NULL : m_aChildren[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|