summaryrefslogtreecommitdiff
path: root/oox/source/ole/axcontrolfragment.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/ole/axcontrolfragment.cxx')
-rw-r--r--oox/source/ole/axcontrolfragment.cxx35
1 files changed, 29 insertions, 6 deletions
diff --git a/oox/source/ole/axcontrolfragment.cxx b/oox/source/ole/axcontrolfragment.cxx
index e641ec40d71b..ecd782da2cb0 100644
--- a/oox/source/ole/axcontrolfragment.cxx
+++ b/oox/source/ole/axcontrolfragment.cxx
@@ -30,8 +30,12 @@
#include "oox/helper/binaryoutputstream.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/ole/axcontrol.hxx"
+#include "oox/ole/olehelper.hxx"
+#include "oox/ole/olestorage.hxx"
using ::rtl::OUString;
+using ::com::sun::star::io::XInputStream;
+using ::com::sun::star::uno::Reference;
using ::oox::core::ContextHandler2;
using ::oox::core::ContextHandlerRef;
using ::oox::core::FragmentHandler2;
@@ -42,7 +46,7 @@ namespace ole {
// ============================================================================
-AxControlPropertyContext::AxControlPropertyContext( FragmentHandler2& rFragment, AxControlModelBase& rModel ) :
+AxControlPropertyContext::AxControlPropertyContext( FragmentHandler2& rFragment, ControlModelBase& rModel ) :
ContextHandler2( rFragment ),
mrModel( rModel ),
mnPropId( XML_TOKEN_INVALID )
@@ -87,7 +91,7 @@ ContextHandlerRef AxControlPropertyContext::onCreateContext( sal_Int32 nElement,
// ============================================================================
-AxControlFragment::AxControlFragment( XmlFilterBase& rFilter, const OUString& rFragmentPath, AxControl& rControl ) :
+AxControlFragment::AxControlFragment( XmlFilterBase& rFilter, const OUString& rFragmentPath, EmbeddedControl& rControl ) :
FragmentHandler2( rFilter, rFragmentPath, true ),
mrControl( rControl )
{
@@ -101,7 +105,7 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const
switch( rAttribs.getToken( AX_TOKEN( persistence ), XML_TOKEN_INVALID ) )
{
case XML_persistPropertyBag:
- if( AxControlModelBase* pModel = mrControl.createModel( aClassId ) )
+ if( ControlModelBase* pModel = mrControl.createModel( aClassId ).get() )
return new AxControlPropertyContext( *this, *pModel );
break;
@@ -113,10 +117,30 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const
BinaryXInputStream aInStrm( getFilter().openInputStream( aFragmentPath ), true );
if( !aInStrm.isEof() )
{
- mrControl.importBinaryModel( aInStrm );
// binary stream contains a copy of the class ID, must be equal to attribute value
- OSL_ENSURE( !mrControl.getModel() || aClassId.equalsIgnoreAsciiCase( mrControl.getClassId() ),
+ OUString aStrmClassId = OleHelper::importGuid( aInStrm );
+ OSL_ENSURE( aClassId.equalsIgnoreAsciiCase( aStrmClassId ),
"AxControlFragment::importBinaryControl - form control class ID mismatch" );
+ if( ControlModelBase* pModel = mrControl.createModel( aStrmClassId ).get() )
+ pModel->importBinaryModel( aInStrm );
+ }
+ }
+ }
+ break;
+
+ case XML_persistStorage:
+ {
+ OUString aFragmentPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
+ if( aFragmentPath.getLength() > 0 )
+ {
+ Reference< XInputStream > xStrgStrm = getFilter().openInputStream( aFragmentPath );
+ if( xStrgStrm.is() )
+ {
+ OleStorage aStorage( getFilter().getGlobalFactory(), xStrgStrm, false );
+ BinaryXInputStream aInStrm( aStorage.openInputStream( CREATE_OUSTRING( "f" ) ), true );
+ if( !aInStrm.isEof() )
+ if( AxContainerModelBase* pModel = dynamic_cast< AxContainerModelBase* >( mrControl.createModel( aClassId ).get() ) )
+ pModel->importBinaryModel( aInStrm );
}
}
}
@@ -130,4 +154,3 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const
} // namespace ole
} // namespace oox
-