From 5c79032077d387053c62829d62518695f68555c1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 25 May 2021 09:32:58 +0200 Subject: fix leaks in loading xmlscript Change-Id: I18e663a6da34ef34630272819420ead6f3b8389d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116087 Tested-by: Jenkins Reviewed-by: Noel Grandin --- xmlscript/qa/cppunit/test.cxx | 8 + xmlscript/source/xmldlg_imexp/imp_share.hxx | 9 +- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 310 ++++++++++----------- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 70 ++--- 4 files changed, 203 insertions(+), 194 deletions(-) diff --git a/xmlscript/qa/cppunit/test.cxx b/xmlscript/qa/cppunit/test.cxx index 62f0bb1885c7..572fae867423 100644 --- a/xmlscript/qa/cppunit/test.cxx +++ b/xmlscript/qa/cppunit/test.cxx @@ -95,6 +95,10 @@ Reference XmlScriptTest::importFile(std::u16string_vi ::xmlscript::importDialogModel(::xmlscript::createInputStream(bytes), xDialogModel, mxComponentContext, nullptr); + Reference xDialogModelComp(xDialogModel, UNO_QUERY); + if (xDialogModelComp) + xDialogModelComp->dispose(); + return xDialogModel; } @@ -179,6 +183,10 @@ void XmlScriptTest::testBasicElements() assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:scrollbar[1]", "id", "scrollbar1"); assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:formattedfield[1]", "id", "ffield0"); assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:formattedfield[2]", "id", "ffield1"); + + Reference xDialogModelComp(xModel, UNO_QUERY); + if (xDialogModelComp) + xDialogModelComp->dispose(); } void XmlScriptTest::testEmptyPopupItems() diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx index 82fdfc9a879e..99a52b58dcb1 100644 --- a/xmlscript/source/xmldlg_imexp/imp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx @@ -192,8 +192,9 @@ class ElementBase : public ::cppu::WeakImplHelper< css::xml::input::XElement > { protected: - rtl::Reference const m_xImport; - rtl::Reference const m_xParent; + // We deliberately store these as raw pointers, otherwise we get reference cycles between DialogImport and the elements + DialogImport* m_pImport; + ElementBase* m_pParent; private: const sal_Int32 _nUid; const OUString _aLocalName; @@ -957,7 +958,7 @@ public: ElementBase * pParent, DialogImport * pImport ) : ControlElement( rLocalName, xAttributes, pParent, pImport ) { - m_xContainer.set( m_xImport->_xDialogModelFactory->createInstance( "com.sun.star.awt.UnoMultiPageModel" ), css::uno::UNO_QUERY ); + m_xContainer.set( m_pImport->_xDialogModelFactory->createInstance( "com.sun.star.awt.UnoMultiPageModel" ), css::uno::UNO_QUERY ); } private: css::uno::Reference< css::container::XNameContainer > m_xContainer; @@ -1000,7 +1001,7 @@ public: ElementBase * pParent, DialogImport * pImport ) : ControlElement( rLocalName, xAttributes, pParent, pImport ) { - m_xContainer.set( m_xImport->_xDialogModelFactory->createInstance( "com.sun.star.awt.UnoPageModel" ), css::uno::UNO_QUERY ); + m_xContainer.set( m_pImport->_xDialogModelFactory->createInstance( "com.sun.star.awt.UnoPageModel" ), css::uno::UNO_QUERY ); } private: css::uno::Reference< css::container::XNameContainer > m_xContainer; diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx index 424058cd28fa..da2fd2d2c412 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx @@ -38,24 +38,24 @@ Reference< xml::input::XElement > Frame::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { if ( !m_xContainer.is() ) - m_xContainer.set( m_xImport->_xDialogModelFactory->createInstance( "com.sun.star.awt.UnoFrameModel" ), UNO_QUERY ); + m_xContainer.set( m_pImport->_xDialogModelFactory->createInstance( "com.sun.star.awt.UnoFrameModel" ), UNO_QUERY ); // event - if (m_xImport->isEventElement( nUid, rLocalName )) + if (m_pImport->isEventElement( nUid, rLocalName )) { - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } else if ( rLocalName == "bulletinboard" ) { // Create new DialogImport for this container - rtl::Reference pFrameImport = new DialogImport( *m_xImport ); + rtl::Reference pFrameImport = new DialogImport( *m_pImport ); pFrameImport->_xDialogModel = m_xContainer; return new BulletinBoardElement( rLocalName, xAttributes, this, pFrameImport.get() ); } else if ( rLocalName == "title" ) { - getStringAttr( &_label, "value", xAttributes, m_xImport->XMLNS_DIALOGS_UID ); + getStringAttr( &_label, "value", xAttributes, m_pImport->XMLNS_DIALOGS_UID ); - return new ElementBase( m_xImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, m_xImport.get() ); + return new ElementBase( m_pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, m_pImport ); } else { @@ -67,10 +67,10 @@ Reference< xml::input::XElement > Frame::startChildElement( void Frame::endElement() { if ( !m_xContainer.is() ) - m_xContainer.set( m_xImport->_xDialogModelFactory->createInstance( "com.sun.star.awt.UnoFrameModel" ), UNO_QUERY ); + m_xContainer.set( m_pImport->_xDialogModelFactory->createInstance( "com.sun.star.awt.UnoFrameModel" ), UNO_QUERY ); Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW ); - // m_xImport is what we need to add to ( e.g. the dialog in this case ) - ControlImportContext ctx( m_xImport.get(), xProps, getControlId( _xAttributes ) ); + // m_pImport is what we need to add to ( e.g. the dialog in this case ) + ControlImportContext ctx( m_pImport, xProps, getControlId( _xAttributes ) ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); @@ -102,16 +102,16 @@ Reference< xml::input::XElement > MultiPage::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (m_xImport->isEventElement( nUid, rLocalName )) + if (m_pImport->isEventElement( nUid, rLocalName )) { return new EventElement( - nUid, rLocalName, xAttributes, this, m_xImport.get() ); + nUid, rLocalName, xAttributes, this, m_pImport ); } else if ( rLocalName == "bulletinboard" ) { // Create new DialogImport for this container - rtl::Reference pMultiPageImport = new DialogImport( *m_xImport ); + rtl::Reference pMultiPageImport = new DialogImport( *m_pImport ); pMultiPageImport->_xDialogModel = m_xContainer; return new BulletinBoardElement( rLocalName, xAttributes, this, pMultiPageImport.get() ); } @@ -125,8 +125,8 @@ Reference< xml::input::XElement > MultiPage::startChildElement( void MultiPage::endElement() { Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW ); - // m_xImport is what we need to add to ( e.g. the dialog in this case ) - ControlImportContext ctx( m_xImport.get(), xProps, getControlId( _xAttributes )); + // m_pImport is what we need to add to ( e.g. the dialog in this case ) + ControlImportContext ctx( m_pImport, xProps, getControlId( _xAttributes )); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); @@ -156,15 +156,15 @@ Reference< xml::input::XElement > Page::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (m_xImport->isEventElement( nUid, rLocalName )) + if (m_pImport->isEventElement( nUid, rLocalName )) { return new EventElement( - nUid, rLocalName, xAttributes, this, m_xImport.get() ); + nUid, rLocalName, xAttributes, this, m_pImport ); } else if ( rLocalName == "bulletinboard" ) { - rtl::Reference pPageImport = new DialogImport( *m_xImport ); + rtl::Reference pPageImport = new DialogImport( *m_pImport ); pPageImport->_xDialogModel = m_xContainer; return new BulletinBoardElement( rLocalName, xAttributes, this, pPageImport.get() ); } @@ -179,7 +179,7 @@ void Page::endElement() { Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW ); - ControlImportContext ctx( m_xImport.get(), xProps, getControlId( _xAttributes )); + ControlImportContext ctx( m_pImport, xProps, getControlId( _xAttributes )); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); @@ -209,18 +209,18 @@ Reference< xml::input::XElement > ProgressBarElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() ); } return new EventElement( - nUid, rLocalName, xAttributes, this, m_xImport.get() ); + nUid, rLocalName, xAttributes, this, m_pImport ); } void ProgressBarElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlProgressBarModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlProgressBarModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -250,17 +250,17 @@ Reference< xml::input::XElement > ScrollBarElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void ScrollBarElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlScrollBarModel" , _xAttributes ) ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlScrollBarModel" , _xAttributes ) ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -299,17 +299,17 @@ Reference< xml::input::XElement > SpinButtonElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void SpinButtonElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlSpinButtonModel", _xAttributes ) ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlSpinButtonModel", _xAttributes ) ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -345,17 +345,17 @@ Reference< xml::input::XElement > FixedLineElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void FixedLineElement::endElement() { - ControlImportContext ctx(m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFixedLineModel" ); + ControlImportContext ctx(m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFixedLineModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -384,17 +384,17 @@ Reference< xml::input::XElement > PatternFieldElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void PatternFieldElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlPatternFieldModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlPatternFieldModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -431,17 +431,17 @@ Reference< xml::input::XElement > FormattedFieldElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void FormattedFieldElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFormattedFieldModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFormattedFieldModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -470,7 +470,7 @@ void FormattedFieldElement::endElement() if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes )) ctx.getControlModel()->setPropertyValue( "Repeat" , makeAny(true) ); - OUString sDefault(_xAttributes->getValueByUidName(m_xImport->XMLNS_DIALOGS_UID, "value-default") ); + OUString sDefault(_xAttributes->getValueByUidName(m_pImport->XMLNS_DIALOGS_UID, "value-default") ); if (!sDefault.isEmpty()) { double d = sDefault.toDouble(); @@ -485,14 +485,14 @@ void FormattedFieldElement::endElement() } // format spec - ctx.getControlModel()->setPropertyValue("FormatsSupplier", makeAny( m_xImport->getNumberFormatsSupplier() ) ); + ctx.getControlModel()->setPropertyValue("FormatsSupplier", makeAny( m_pImport->getNumberFormatsSupplier() ) ); - OUString sFormat( _xAttributes->getValueByUidName(m_xImport->XMLNS_DIALOGS_UID, "format-code" ) ); + OUString sFormat( _xAttributes->getValueByUidName(m_pImport->XMLNS_DIALOGS_UID, "format-code" ) ); if (!sFormat.isEmpty()) { lang::Locale locale; - OUString sLocale( _xAttributes->getValueByUidName( m_xImport->XMLNS_DIALOGS_UID, "format-locale" ) ); + OUString sLocale( _xAttributes->getValueByUidName( m_pImport->XMLNS_DIALOGS_UID, "format-locale" ) ); if (!sLocale.isEmpty()) { // split locale @@ -524,7 +524,7 @@ void FormattedFieldElement::endElement() try { Reference< util::XNumberFormats > xFormats( - m_xImport->getNumberFormatsSupplier()->getNumberFormats() ); + m_pImport->getNumberFormatsSupplier()->getNumberFormats() ); sal_Int32 nKey = xFormats->queryKey( sFormat, locale, true ); if (-1 == nKey) { @@ -558,17 +558,17 @@ Reference< xml::input::XElement > TimeFieldElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void TimeFieldElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlTimeFieldModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlTimeFieldModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -611,17 +611,17 @@ Reference< xml::input::XElement > NumericFieldElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void NumericFieldElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlNumericFieldModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlNumericFieldModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -666,17 +666,17 @@ Reference< xml::input::XElement > DateFieldElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void DateFieldElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlDateFieldModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlDateFieldModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -720,17 +720,17 @@ Reference< xml::input::XElement > CurrencyFieldElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException( "expected event element!" , Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void CurrencyFieldElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlCurrencyFieldModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlCurrencyFieldModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -775,17 +775,17 @@ Reference< xml::input::XElement > FileControlElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void FileControlElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFileControlModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFileControlModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -818,17 +818,17 @@ Reference< xml::input::XElement > TreeControlElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void TreeControlElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.tree.TreeControlModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.tree.TreeControlModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -863,17 +863,17 @@ Reference< xml::input::XElement > ImageControlElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException( "expected event element!" , Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void ImageControlElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlImageControlModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlImageControlModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -903,17 +903,17 @@ Reference< xml::input::XElement > TextElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void TextElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFixedTextModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFixedTextModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -948,17 +948,17 @@ Reference< xml::input::XElement > FixedHyperLinkElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException( "expected event element!" , Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void FixedHyperLinkElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFixedHyperlinkModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFixedHyperlinkModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -995,17 +995,17 @@ Reference< xml::input::XElement > TextFieldElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void TextFieldElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlEditModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlEditModel" ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); @@ -1033,7 +1033,7 @@ void TextFieldElement::endElement() ctx.importStringProperty( "Text", "value", _xAttributes ); ctx.importLineEndFormatProperty( "LineEndFormat", "lineend-format", _xAttributes ); OUString aValue; - if (getStringAttr( &aValue, "echochar", _xAttributes, m_xImport->XMLNS_DIALOGS_UID ) && !aValue.isEmpty() ) + if (getStringAttr( &aValue, "echochar", _xAttributes, m_pImport->XMLNS_DIALOGS_UID ) && !aValue.isEmpty() ) { SAL_WARN_IF( aValue.getLength() != 1, "xmlscript.xmldlg", "### more than one character given for echochar!" ); sal_Int16 nChar = 0; @@ -1058,20 +1058,20 @@ Reference< xml::input::XElement > TitledBoxElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (m_xImport->isEventElement( nUid, rLocalName )) + if (m_pImport->isEventElement( nUid, rLocalName )) { - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } - else if (m_xImport->XMLNS_DIALOGS_UID != nUid) + else if (m_pImport->XMLNS_DIALOGS_UID != nUid) { throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() ); } // title else if ( rLocalName == "title" ) { - getStringAttr( &_label, "value", xAttributes, m_xImport->XMLNS_DIALOGS_UID ); + getStringAttr( &_label, "value", xAttributes, m_pImport->XMLNS_DIALOGS_UID ); - return new ElementBase( m_xImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, m_xImport.get() ); + return new ElementBase( m_pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, m_pImport ); } // radio else if ( rLocalName == "radio" ) @@ -1079,7 +1079,7 @@ Reference< xml::input::XElement > TitledBoxElement::startChildElement( // don't create radios here, => titledbox must be inserted first due to radio grouping, // possible predecessors! Reference< xml::input::XElement > xRet( - new RadioElement( rLocalName, xAttributes, this, m_xImport.get() ) ); + new RadioElement( rLocalName, xAttributes, this, m_pImport ) ); _radios.push_back( xRet ); return xRet; } @@ -1092,7 +1092,7 @@ Reference< xml::input::XElement > TitledBoxElement::startChildElement( void TitledBoxElement::endElement() { { - ControlImportContext ctx(m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlGroupBoxModel" ); + ControlImportContext ctx(m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlGroupBoxModel" ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); @@ -1124,7 +1124,7 @@ void TitledBoxElement::endElement() { Reference< xml::input::XAttributes > xAttributes( xRadio->getAttributes() ); - ControlImportContext ctx( m_xImport.get(), getControlId( xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlRadioButtonModel", xAttributes ) ); + ControlImportContext ctx( m_pImport, getControlId( xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlRadioButtonModel", xAttributes ) ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) ); @@ -1150,7 +1150,7 @@ void TitledBoxElement::endElement() sal_Int16 nVal = 0; sal_Bool bChecked = false; - if (getBoolAttr( &bChecked, "checked", xAttributes, m_xImport->XMLNS_DIALOGS_UID ) && bChecked) + if (getBoolAttr( &bChecked, "checked", xAttributes, m_pImport->XMLNS_DIALOGS_UID ) && bChecked) { nVal = 1; } @@ -1176,12 +1176,12 @@ Reference< xml::input::XElement > RadioElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } // radiogroup @@ -1189,7 +1189,7 @@ Reference< xml::input::XElement > RadioGroupElement::startChildElement( sal_Int32 nUid, OUString const & rLocalName, Reference< xml::input::XAttributes > const & xAttributes ) { - if (m_xImport->XMLNS_DIALOGS_UID != nUid) + if (m_pImport->XMLNS_DIALOGS_UID != nUid) { throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() ); } @@ -1199,7 +1199,7 @@ Reference< xml::input::XElement > RadioGroupElement::startChildElement( // don't create radios here, => titledbox must be inserted first due to radio grouping, // possible predecessors! Reference< xml::input::XElement > xRet( - new RadioElement( rLocalName, xAttributes, this, m_xImport.get() ) ); + new RadioElement( rLocalName, xAttributes, this, m_pImport ) ); _radios.push_back( xRet ); return xRet; } @@ -1215,7 +1215,7 @@ void RadioGroupElement::endElement() Reference< xml::input::XAttributes > xAttributes( xRadio->getAttributes() ); - ControlImportContext ctx( m_xImport.get(), getControlId( xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlRadioButtonModel", xAttributes ) ); + ControlImportContext ctx( m_pImport, getControlId( xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlRadioButtonModel", xAttributes ) ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) ); @@ -1240,7 +1240,7 @@ void RadioGroupElement::endElement() ctx.importStringProperty( "GroupName", "group-name", xAttributes ); sal_Int16 nVal = 0; sal_Bool bChecked = false; - if (getBoolAttr( &bChecked, "checked", xAttributes, m_xImport->XMLNS_DIALOGS_UID ) && bChecked) + if (getBoolAttr( &bChecked, "checked", xAttributes, m_pImport->XMLNS_DIALOGS_UID ) && bChecked) { nVal = 1; } @@ -1267,26 +1267,26 @@ Reference< xml::input::XElement > MenuPopupElement::startChildElement( sal_Int32 nUid, OUString const & rLocalName, Reference< xml::input::XAttributes > const & xAttributes ) { - if (m_xImport->XMLNS_DIALOGS_UID != nUid) + if (m_pImport->XMLNS_DIALOGS_UID != nUid) { throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() ); } // menuitem else if ( rLocalName == "menuitem" ) { - OUString aValue( xAttributes->getValueByUidName( m_xImport->XMLNS_DIALOGS_UID,"value" ) ); + OUString aValue( xAttributes->getValueByUidName( m_pImport->XMLNS_DIALOGS_UID,"value" ) ); SAL_WARN_IF( aValue.isEmpty() && !_allowEmptyItems, "xmlscript.xmldlg", "### menuitem has no value?" ); if ((!aValue.isEmpty()) || _allowEmptyItems) { _itemValues.push_back( aValue ); - OUString aSel( xAttributes->getValueByUidName( m_xImport->XMLNS_DIALOGS_UID, "selected" ) ); + OUString aSel( xAttributes->getValueByUidName( m_pImport->XMLNS_DIALOGS_UID, "selected" ) ); if (!aSel.isEmpty() && aSel == "true") { _itemSelected.push_back( static_cast(_itemValues.size()) -1 ); } } - return new ElementBase( m_xImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, m_xImport.get() ); + return new ElementBase( m_pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, m_pImport ); } else { @@ -1320,18 +1320,18 @@ Reference< xml::input::XElement > MenuListElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (m_xImport->isEventElement( nUid, rLocalName )) + if (m_pImport->isEventElement( nUid, rLocalName )) { - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } - else if (m_xImport->XMLNS_DIALOGS_UID != nUid) + else if (m_pImport->XMLNS_DIALOGS_UID != nUid) { throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() ); } // menupopup else if ( rLocalName == "menupopup" ) { - _popup = new MenuPopupElement( rLocalName, xAttributes, this, m_xImport.get(), false ); + _popup = new MenuPopupElement( rLocalName, xAttributes, this, m_pImport, false ); return _popup; } else @@ -1342,7 +1342,7 @@ Reference< xml::input::XElement > MenuListElement::startChildElement( void MenuListElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlListBoxModel", _xAttributes ) ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlListBoxModel", _xAttributes ) ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); @@ -1388,18 +1388,18 @@ Reference< xml::input::XElement > ComboBoxElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (m_xImport->isEventElement( nUid, rLocalName )) + if (m_pImport->isEventElement( nUid, rLocalName )) { - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } - else if (m_xImport->XMLNS_DIALOGS_UID != nUid) + else if (m_pImport->XMLNS_DIALOGS_UID != nUid) { throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() ); } // menupopup else if ( rLocalName == "menupopup" ) { - _popup = new MenuPopupElement( rLocalName, xAttributes, this, m_xImport.get(), true ); + _popup = new MenuPopupElement( rLocalName, xAttributes, this, m_pImport, true ); return _popup; } else @@ -1409,7 +1409,7 @@ Reference< xml::input::XElement > ComboBoxElement::startChildElement( } void ComboBoxElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlComboBoxModel", _xAttributes ) ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlComboBoxModel", _xAttributes ) ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); @@ -1455,17 +1455,17 @@ Reference< xml::input::XElement > CheckBoxElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void CheckBoxElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlCheckBoxModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlCheckBoxModel" ); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); @@ -1489,12 +1489,12 @@ void CheckBoxElement::endElement() ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes ); sal_Bool bTriState = false; - if (getBoolAttr( &bTriState, "tristate", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getBoolAttr( &bTriState, "tristate", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { xControlModel->setPropertyValue( "TriState", makeAny( bTriState ) ); } sal_Bool bChecked = false; - if (getBoolAttr( &bChecked, "checked", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getBoolAttr( &bChecked, "checked", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { // has "checked" attribute sal_Int16 nVal = (bChecked ? 1 : 0); @@ -1520,17 +1520,17 @@ Reference< xml::input::XElement > ButtonElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void ButtonElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.UnoControlButtonModel" ); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlButtonModel" ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -1556,13 +1556,13 @@ void ButtonElement::endElement() if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes )) ctx.getControlModel()->setPropertyValue( "Repeat", makeAny(true) ); sal_Int32 toggled = 0; - if (getLongAttr( &toggled, "toggled", _xAttributes, m_xImport->XMLNS_DIALOGS_UID ) && toggled == 1) + if (getLongAttr( &toggled, "toggled", _xAttributes, m_pImport->XMLNS_DIALOGS_UID ) && toggled == 1) ctx.getControlModel()->setPropertyValue( "Toggle" , makeAny(true)); ctx.importBooleanProperty( "FocusOnClick", "grab-focus", _xAttributes ); ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes ); // State sal_Bool bChecked = false; - if (getBoolAttr( &bChecked, "checked", _xAttributes, m_xImport->XMLNS_DIALOGS_UID ) && bChecked) + if (getBoolAttr( &bChecked, "checked", _xAttributes, m_pImport->XMLNS_DIALOGS_UID ) && bChecked) { ctx.getControlModel()->setPropertyValue( "State" , makeAny( sal_Int16(1) ) ); } @@ -1580,140 +1580,140 @@ Reference< xml::input::XElement > BulletinBoardElement::startChildElement( sal_Int32 nUid, OUString const & rLocalName, Reference< xml::input::XAttributes > const & xAttributes ) { - if (m_xImport->XMLNS_DIALOGS_UID != nUid) + if (m_pImport->XMLNS_DIALOGS_UID != nUid) { throw xml::sax::SAXException("illegal namespace!", Reference< XInterface >(), Any() ); } // button else if ( rLocalName == "button" ) { - return new ButtonElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new ButtonElement( rLocalName, xAttributes, this, m_pImport ); } // checkbox else if ( rLocalName == "checkbox" ) { - return new CheckBoxElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new CheckBoxElement( rLocalName, xAttributes, this, m_pImport ); } // combobox else if ( rLocalName == "combobox" ) { - return new ComboBoxElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new ComboBoxElement( rLocalName, xAttributes, this, m_pImport ); } // listbox else if ( rLocalName == "menulist" ) { - return new MenuListElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new MenuListElement( rLocalName, xAttributes, this, m_pImport ); } // radiogroup else if ( rLocalName == "radiogroup" ) { - return new RadioGroupElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new RadioGroupElement( rLocalName, xAttributes, this, m_pImport ); } // titledbox else if ( rLocalName == "titledbox" ) { - return new TitledBoxElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new TitledBoxElement( rLocalName, xAttributes, this, m_pImport ); } // text else if ( rLocalName == "text" ) { - return new TextElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new TextElement( rLocalName, xAttributes, this, m_pImport ); } else if ( rLocalName == "linklabel" ) { - return new FixedHyperLinkElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new FixedHyperLinkElement( rLocalName, xAttributes, this, m_pImport ); } // textfield else if ( rLocalName == "textfield" ) { - return new TextFieldElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new TextFieldElement( rLocalName, xAttributes, this, m_pImport ); } // img else if ( rLocalName == "img" ) { - return new ImageControlElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new ImageControlElement( rLocalName, xAttributes, this, m_pImport ); } // filecontrol else if ( rLocalName == "filecontrol" ) { - return new FileControlElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new FileControlElement( rLocalName, xAttributes, this, m_pImport ); } // treecontrol else if ( rLocalName == "treecontrol" ) { - return new TreeControlElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new TreeControlElement( rLocalName, xAttributes, this, m_pImport ); } // currencyfield else if ( rLocalName == "currencyfield" ) { - return new CurrencyFieldElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new CurrencyFieldElement( rLocalName, xAttributes, this, m_pImport ); } // datefield else if ( rLocalName == "datefield" ) { - return new DateFieldElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new DateFieldElement( rLocalName, xAttributes, this, m_pImport ); } // datefield else if ( rLocalName == "numericfield" ) { - return new NumericFieldElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new NumericFieldElement( rLocalName, xAttributes, this, m_pImport ); } // timefield else if ( rLocalName == "timefield" ) { - return new TimeFieldElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new TimeFieldElement( rLocalName, xAttributes, this, m_pImport ); } // patternfield else if ( rLocalName == "patternfield" ) { - return new PatternFieldElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new PatternFieldElement( rLocalName, xAttributes, this, m_pImport ); } // formattedfield else if ( rLocalName == "formattedfield" ) { - return new FormattedFieldElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new FormattedFieldElement( rLocalName, xAttributes, this, m_pImport ); } // fixedline else if ( rLocalName == "fixedline" ) { - return new FixedLineElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new FixedLineElement( rLocalName, xAttributes, this, m_pImport ); } // scrollbar else if ( rLocalName == "scrollbar" ) { - return new ScrollBarElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new ScrollBarElement( rLocalName, xAttributes, this, m_pImport ); } // spinbutton else if ( rLocalName == "spinbutton" ) { - return new SpinButtonElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new SpinButtonElement( rLocalName, xAttributes, this, m_pImport ); } // progressmeter else if ( rLocalName == "progressmeter" ) { - return new ProgressBarElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new ProgressBarElement( rLocalName, xAttributes, this, m_pImport ); } // table else if (rLocalName == "table") { - return new GridControlElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new GridControlElement( rLocalName, xAttributes, this, m_pImport ); } else if ( rLocalName == "multipage" ) { - return new MultiPage( rLocalName, xAttributes, this, m_xImport.get() ); + return new MultiPage( rLocalName, xAttributes, this, m_pImport ); } else if ( rLocalName == "frame" ) { - return new Frame( rLocalName, xAttributes, this, m_xImport.get() ); + return new Frame( rLocalName, xAttributes, this, m_pImport ); } else if ( rLocalName == "page" ) { - return new Page( rLocalName, xAttributes, this, m_xImport.get() ); + return new Page( rLocalName, xAttributes, this, m_pImport ); } // bulletinboard else if ( rLocalName == "bulletinboard" ) { - return new BulletinBoardElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new BulletinBoardElement( rLocalName, xAttributes, this, m_pImport ); } else { @@ -1727,12 +1727,12 @@ BulletinBoardElement::BulletinBoardElement( ElementBase * pParent, DialogImport * pImport ) : ControlElement( rLocalName, xAttributes, pParent, pImport ) { - OUString aValue( _xAttributes->getValueByUidName( m_xImport->XMLNS_DIALOGS_UID, "left" ) ); + OUString aValue( _xAttributes->getValueByUidName( m_pImport->XMLNS_DIALOGS_UID, "left" ) ); if (!aValue.isEmpty()) { _nBasePosX += toInt32( aValue ); } - aValue = _xAttributes->getValueByUidName( m_xImport->XMLNS_DIALOGS_UID, "top" ); + aValue = _xAttributes->getValueByUidName( m_pImport->XMLNS_DIALOGS_UID, "top" ); if (!aValue.isEmpty()) { _nBasePosY += toInt32( aValue ); @@ -1749,13 +1749,13 @@ Reference< xml::input::XElement > StyleElement::startChildElement( void StyleElement::endElement() { - OUString aStyleId( _xAttributes->getValueByUidName( m_xImport->XMLNS_DIALOGS_UID, "style-id" ) ); + OUString aStyleId( _xAttributes->getValueByUidName( m_pImport->XMLNS_DIALOGS_UID, "style-id" ) ); if (aStyleId.isEmpty()) { throw xml::sax::SAXException( "missing style-id attribute!", Reference< XInterface >(), Any() ); } - m_xImport->addStyle( aStyleId, this ); + m_pImport->addStyle( aStyleId, this ); } // styles @@ -1763,14 +1763,14 @@ Reference< xml::input::XElement > StylesElement::startChildElement( sal_Int32 nUid, OUString const & rLocalName, Reference< xml::input::XAttributes > const & xAttributes ) { - if (m_xImport->XMLNS_DIALOGS_UID != nUid) + if (m_pImport->XMLNS_DIALOGS_UID != nUid) { throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() ); } // style else if ( rLocalName == "style" ) { - return new StyleElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new StyleElement( rLocalName, xAttributes, this, m_pImport ); } else { @@ -1784,23 +1784,23 @@ Reference< xml::input::XElement > WindowElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (m_xImport->isEventElement( nUid, rLocalName )) + if (m_pImport->isEventElement( nUid, rLocalName )) { - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } - else if (m_xImport->XMLNS_DIALOGS_UID != nUid) + else if (m_pImport->XMLNS_DIALOGS_UID != nUid) { throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() ); } // styles else if ( rLocalName == "styles" ) { - return new StylesElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new StylesElement( rLocalName, xAttributes, this, m_pImport ); } // bulletinboard else if ( rLocalName == "bulletinboard" ) { - return new BulletinBoardElement( rLocalName, xAttributes, this, m_xImport.get() ); + return new BulletinBoardElement( rLocalName, xAttributes, this, m_pImport ); } else { @@ -1811,8 +1811,8 @@ Reference< xml::input::XElement > WindowElement::startChildElement( void WindowElement::endElement() { Reference< beans::XPropertySet > xProps( - m_xImport->_xDialogModel, UNO_QUERY_THROW ); - ImportContext ctx( m_xImport.get(), xProps, getControlId( _xAttributes ) ); + m_pImport->_xDialogModel, UNO_QUERY_THROW ); + ImportContext ctx( m_pImport, xProps, getControlId( _xAttributes ) ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) @@ -1844,18 +1844,18 @@ Reference< xml::input::XElement > GridControlElement::startChildElement( Reference< xml::input::XAttributes > const & xAttributes ) { // event - if (!m_xImport->isEventElement( nUid, rLocalName )) + if (!m_pImport->isEventElement( nUid, rLocalName )) { throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() ); } - return new EventElement( nUid, rLocalName, xAttributes, this, m_xImport.get() ); + return new EventElement( nUid, rLocalName, xAttributes, this, m_pImport ); } void GridControlElement::endElement() { - ControlImportContext ctx( m_xImport.get(), getControlId( _xAttributes ), "com.sun.star.awt.grid.UnoControlGridModel"); + ControlImportContext ctx( m_pImport, getControlId( _xAttributes ), "com.sun.star.awt.grid.UnoControlGridModel"); Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); if (xStyle.is()) diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index 2d3ae432e7a1..a801943bfacf 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx @@ -68,7 +68,7 @@ namespace xmlscript void EventElement::endElement() { - static_cast< ControlElement * >( m_xParent.get() )->_events.emplace_back(this ); + static_cast< ControlElement * >( m_pParent )->_events.emplace_back(this ); } ControlElement::ControlElement( @@ -78,11 +78,11 @@ ControlElement::ControlElement( : ElementBase( pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, pParent, pImport ) { - if (m_xParent.is()) + if (m_pParent) { // inherit position - _nBasePosX = static_cast< ControlElement * >( m_xParent.get() )->_nBasePosX; - _nBasePosY = static_cast< ControlElement * >( m_xParent.get() )->_nBasePosY; + _nBasePosX = static_cast< ControlElement * >( m_pParent )->_nBasePosX; + _nBasePosY = static_cast< ControlElement * >( m_pParent )->_nBasePosY; } else { @@ -94,10 +94,10 @@ ControlElement::ControlElement( Reference< xml::input::XElement > ControlElement::getStyle( Reference< xml::input::XAttributes > const & xAttributes ) { - OUString aStyleId( xAttributes->getValueByUidName( m_xImport->XMLNS_DIALOGS_UID,"style-id" ) ); + OUString aStyleId( xAttributes->getValueByUidName( m_pImport->XMLNS_DIALOGS_UID,"style-id" ) ); if (!aStyleId.isEmpty()) { - return m_xImport->getStyle( aStyleId ); + return m_pImport->getStyle( aStyleId ); } return Reference< xml::input::XElement >(); } @@ -105,7 +105,7 @@ Reference< xml::input::XElement > ControlElement::getStyle( OUString ControlElement::getControlId( Reference< xml::input::XAttributes > const & xAttributes ) { - OUString aId( xAttributes->getValueByUidName( m_xImport->XMLNS_DIALOGS_UID, "id" ) ); + OUString aId( xAttributes->getValueByUidName( m_pImport->XMLNS_DIALOGS_UID, "id" ) ); if (aId.isEmpty()) { throw xml::sax::SAXException( "missing id attribute!", Reference< XInterface >(), Any() ); @@ -117,7 +117,7 @@ OUString ControlElement::getControlModelName( OUString const& rDefaultModel, Reference< xml::input::XAttributes > const & xAttributes ) { - OUString aModel = xAttributes->getValueByUidName( m_xImport->XMLNS_DIALOGS_UID, "control-implementation"); + OUString aModel = xAttributes->getValueByUidName( m_pImport->XMLNS_DIALOGS_UID, "control-implementation"); if (aModel.isEmpty()) aModel = rDefaultModel; return aModel; @@ -136,7 +136,7 @@ void StyleElement::importTextColorStyle( } _inited |= 0x2; - if (getLongAttr( &_textColor, "text-color", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getLongAttr( &_textColor, "text-color", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { _hasValue |= 0x2; xProps->setPropertyValue( "TextColor", makeAny( _textColor ) ); @@ -157,7 +157,7 @@ void StyleElement::importTextLineColorStyle( } _inited |= 0x20; - if (getLongAttr( &_textLineColor, "textline-color", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getLongAttr( &_textLineColor, "textline-color", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { _hasValue |= 0x20; xProps->setPropertyValue( "TextLineColor", makeAny( _textLineColor ) ); @@ -177,7 +177,7 @@ void StyleElement::importFillColorStyle( } _inited |= 0x10; - if (getLongAttr( &_fillColor, "fill-color", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getLongAttr( &_fillColor, "fill-color", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { _hasValue |= 0x10; xProps->setPropertyValue( "FillColor", makeAny( _fillColor ) ); @@ -197,7 +197,7 @@ void StyleElement::importBackgroundColorStyle( } _inited |= 0x1; - if (getLongAttr( &_backgroundColor, "background-color", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getLongAttr( &_backgroundColor, "background-color", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { _hasValue |= 0x1; xProps->setPropertyValue( "BackgroundColor", makeAny( _backgroundColor ) ); @@ -220,7 +220,7 @@ void StyleElement::importBorderStyle( _inited |= 0x4; OUString aValue; - if (!getStringAttr(&aValue, "border", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (!getStringAttr(&aValue, "border", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) return; if ( aValue == "none" ) @@ -252,7 +252,7 @@ void StyleElement::importVisualEffectStyle( _inited |= 0x40; OUString aValue; - if (!getStringAttr( &aValue, "look", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (!getStringAttr( &aValue, "look", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) return; if ( aValue == "none" ) @@ -299,25 +299,25 @@ void StyleElement::importFontStyle( bool bFontImport; // dialog:font-name CDATA #IMPLIED - bFontImport = getStringAttr( &_descr.Name, "font-name", _xAttributes, m_xImport->XMLNS_DIALOGS_UID ); + bFontImport = getStringAttr( &_descr.Name, "font-name", _xAttributes, m_pImport->XMLNS_DIALOGS_UID ); // dialog:font-height %numeric; #IMPLIED - if (getStringAttr( &aValue, "font-height", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr( &aValue, "font-height", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { _descr.Height = static_cast(toInt32( aValue )); bFontImport = true; } // dialog:font-width %numeric; #IMPLIED - if (getStringAttr(&aValue, "font-width", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr(&aValue, "font-width", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { _descr.Width = static_cast(toInt32( aValue )); bFontImport = true; } // dialog:font-stylename CDATA #IMPLIED - bFontImport |= getStringAttr( &_descr.StyleName, "font-stylename", _xAttributes, m_xImport->XMLNS_DIALOGS_UID ); + bFontImport |= getStringAttr( &_descr.StyleName, "font-stylename", _xAttributes, m_pImport->XMLNS_DIALOGS_UID ); // dialog:font-family "(decorative|modern|roman|script|swiss|system)" #IMPLIED - if (getStringAttr(&aValue, "font-family", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr(&aValue, "font-family", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { if ( aValue == "decorative" ) { @@ -351,7 +351,7 @@ void StyleElement::importFontStyle( } // dialog:font-charset "(ansi|mac|ibmpc_437|ibmpc_850|ibmpc_860|ibmpc_861|ibmpc_863|ibmpc_865|system|symbol)" #IMPLIED - if (getStringAttr(&aValue, "font-charset", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr(&aValue, "font-charset", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { if ( aValue == "ansi" ) { @@ -401,7 +401,7 @@ void StyleElement::importFontStyle( } // dialog:font-pitch "(fixed|variable)" #IMPLIED - if (getStringAttr( &aValue, "font-pitch", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr( &aValue, "font-pitch", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { if ( aValue == "fixed" ) { @@ -419,20 +419,20 @@ void StyleElement::importFontStyle( } // dialog:font-charwidth CDATA #IMPLIED - if (getStringAttr( &aValue, "font-charwidth", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr( &aValue, "font-charwidth", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { _descr.CharacterWidth = aValue.toFloat(); bFontImport = true; } // dialog:font-weight CDATA #IMPLIED - if (getStringAttr( &aValue, "font-weight", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr( &aValue, "font-weight", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { _descr.Weight = aValue.toFloat(); bFontImport = true; } // dialog:font-slant "(oblique|italic|reverse_oblique|reverse_italic)" #IMPLIED - if (getStringAttr( &aValue, "font-slant", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr( &aValue, "font-slant", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { if ( aValue == "oblique" ) { @@ -458,7 +458,7 @@ void StyleElement::importFontStyle( } // dialog:font-underline "(single|double|dotted|dash|longdash|dashdot|dashdotdot|smallwave|wave|doublewave|bold|bolddotted|bolddash|boldlongdash|bolddashdot|bolddashdotdot|boldwave)" #IMPLIED - if (getStringAttr( &aValue, "font-underline", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr( &aValue, "font-underline", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { if ( aValue == "single" ) { @@ -536,7 +536,7 @@ void StyleElement::importFontStyle( } // dialog:font-strikeout "(single|double|bold|slash|x)" #IMPLIED - if (getStringAttr( &aValue, "font-strikeout", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr( &aValue, "font-strikeout", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { if ( aValue == "single" ) { @@ -566,18 +566,18 @@ void StyleElement::importFontStyle( } // dialog:font-orientation CDATA #IMPLIED - if (getStringAttr( &aValue, "font-orientation", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr( &aValue, "font-orientation", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { _descr.Orientation = aValue.toFloat(); bFontImport = true; } // dialog:font-kerning %boolean; #IMPLIED - bFontImport |= getBoolAttr( &_descr.Kerning, "font-kerning", _xAttributes, m_xImport->XMLNS_DIALOGS_UID ); + bFontImport |= getBoolAttr( &_descr.Kerning, "font-kerning", _xAttributes, m_pImport->XMLNS_DIALOGS_UID ); // dialog:font-wordlinemode %boolean; #IMPLIED - bFontImport |= getBoolAttr( &_descr.WordLineMode,"font-wordlinemode", _xAttributes, m_xImport->XMLNS_DIALOGS_UID ); + bFontImport |= getBoolAttr( &_descr.WordLineMode,"font-wordlinemode", _xAttributes, m_pImport->XMLNS_DIALOGS_UID ); // dialog:font-type "(raster|device|scalable)" #IMPLIED - if (getStringAttr( &aValue, "font-type", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr( &aValue, "font-type", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { if ( aValue == "raster" ) { @@ -600,7 +600,7 @@ void StyleElement::importFontStyle( // additional properties which are not part of the FontDescriptor struct // dialog:font-relief (none|embossed|engraved) #IMPLIED - if (getStringAttr( &aValue, "font-relief", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr( &aValue, "font-relief", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { if ( aValue == "none" ) { @@ -621,7 +621,7 @@ void StyleElement::importFontStyle( bFontImport = true; } // dialog:font-emphasismark (none|dot|circle|disc|accent|above|below) #IMPLIED - if (getStringAttr(&aValue, "font-emphasismark", _xAttributes, m_xImport->XMLNS_DIALOGS_UID )) + if (getStringAttr(&aValue, "font-emphasismark", _xAttributes, m_pImport->XMLNS_DIALOGS_UID )) { if ( aValue == "none" ) { @@ -1620,7 +1620,7 @@ void ImportContext::importDefaults( Reference< xml::input::XElement > ElementBase::getParent() { - return static_cast< xml::input::XElement * >( m_xParent.get() ); + return static_cast< xml::input::XElement * >( m_pParent ); } OUString ElementBase::getLocalName() @@ -1669,8 +1669,8 @@ ElementBase::ElementBase( sal_Int32 nUid, OUString const & rLocalName, Reference< xml::input::XAttributes > const & xAttributes, ElementBase * pParent, DialogImport * pImport ) - : m_xImport( pImport ) - , m_xParent( pParent ) + : m_pImport( pImport ) + , m_pParent( pParent ) , _nUid( nUid ) , _aLocalName( rLocalName ) , _xAttributes( xAttributes ) -- cgit