summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--starmath/source/mathml.cxx165
-rw-r--r--starmath/source/mathml.hxx12
-rw-r--r--starmath/source/register.cxx51
3 files changed, 215 insertions, 13 deletions
diff --git a/starmath/source/mathml.cxx b/starmath/source/mathml.cxx
index c9e469160a64..fcffda631875 100644
--- a/starmath/source/mathml.cxx
+++ b/starmath/source/mathml.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: mathml.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: mib $ $Date: 2001-03-07 15:34:06 $
+ * last change: $Author: mib $ $Date: 2001-03-23 07:46:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -295,6 +295,11 @@ sal_Bool SmXMLWrapper::Import(SfxMedium &rMedium)
bRet = ReadThroughComponent(
rMedium.GetStorage(), xModelComp, "content.xml", "Content.xml", xServiceFactory,
"com.sun.star.comp.Math.XMLImporter" );
+
+ ReadThroughComponent(
+ rMedium.GetStorage(), xModelComp, "settings.xml", 0, xServiceFactory,
+ "com.sun.star.comp.Math.XMLSettingsImporter" );
+
}
else
{
@@ -438,6 +443,46 @@ uno::Reference< uno::XInterface > SAL_CALL SmXMLExportMeta_createInstance(
return (cppu::OWeakObject*)new SmXMLExport( EXPORT_META );
}
+OUString SAL_CALL SmXMLImportSettings_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLSettingsImporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLImportSettings_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( SmXMLImportSettings_getImplementationName() );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLImportSettings_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new SmXMLImport( IMPORT_SETTINGS );
+}
+
+OUString SAL_CALL SmXMLExportSettings_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLSettingsExporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLExportSettings_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( SmXMLExportSettings_getImplementationName());
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLExportSettings_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new SmXMLExport( EXPORT_SETTINGS );
+}
+
sal_Int64 SAL_CALL SmXMLImport::getSomething( const uno::Sequence< sal_Int8 >&
rId ) throw(uno::RuntimeException)
@@ -624,12 +669,16 @@ sal_Bool SmXMLWrapper::Export(SfxMedium &rMedium)
{
SvStorage *pStg = rMedium.GetOutputStorage(sal_True);
bRet = WriteThroughComponent(
- pStg, xModelComp, "meta.xml", xServiceFactory,
- "com.sun.star.comp.Math.XMLMetaExporter", sal_False );
+ pStg, xModelComp, "meta.xml", xServiceFactory,
+ "com.sun.star.comp.Math.XMLMetaExporter", sal_False );
if( bRet )
- WriteThroughComponent(
- pStg, xModelComp, "content.xml", xServiceFactory,
- "com.sun.star.comp.Math.XMLExporter" );
+ bRet = WriteThroughComponent(
+ pStg, xModelComp, "content.xml", xServiceFactory,
+ "com.sun.star.comp.Math.XMLExporter" );
+ if( bRet )
+ bRet = WriteThroughComponent(
+ pStg, xModelComp, "settings.xml", xServiceFactory,
+ "com.sun.star.comp.Math.XMLSettingsExporter" );
}
else
{
@@ -1913,6 +1962,11 @@ SvXMLImportContext *SmXMLOfficeContext_Impl::CreateChildContext(sal_uInt16 nPref
pContext = new SfxXMLMetaContext( GetImport(),
XML_NAMESPACE_OFFICE, rLocalName,
GetImport().GetModel() );
+ else if( XML_NAMESPACE_OFFICE == nPrefix &&
+ rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sXML_settings) ) )
+ pContext = new XMLDocumentSettingsContext( GetImport(),
+ XML_NAMESPACE_OFFICE, rLocalName,
+ xAttrList );
else
pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
@@ -2698,8 +2752,7 @@ SvXMLImportContext *SmXMLImport::CreateContext(sal_uInt16 nPrefix,
const OUString &rLocalName,
const uno::Reference <xml::sax::XAttributeList> &xAttrList)
{
- if( XML_NAMESPACE_OFFICE == nPrefix &&
- rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sXML_document_meta ) ) )
+ if( XML_NAMESPACE_OFFICE == nPrefix )
return new SmXMLOfficeContext_Impl( *this,nPrefix,rLocalName);
else
return new SmXMLDocContext_Impl(*this,nPrefix,rLocalName);
@@ -2928,6 +2981,61 @@ SmXMLImport::~SmXMLImport()
delete pAnnotationAttrTokenMap;
}
+void SmXMLImport::SetViewSettings(const Sequence<beans::PropertyValue>& aViewProps)
+{
+ uno::Reference <frame::XModel> xModel = GetModel();
+ if( !xModel.is() )
+ return;
+
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ if( !pModel )
+ return;
+
+ SmDocShell *pDocShell =
+ static_cast<SmDocShell*>(pModel->GetObjectShell());
+ if( !pDocShell )
+ return;
+
+ Rectangle aRect( pDocShell->GetVisArea() );
+
+ sal_Int32 nCount = aViewProps.getLength();
+ const beans::PropertyValue *pValue = aViewProps.getConstArray();
+
+ long nTmp;
+ sal_Bool bShowDeletes = sal_False, bShowInserts = sal_False, bShowFooter = sal_False, bShowHeader = sal_False;
+
+ for (sal_Int32 i = 0; i < nCount ; i++)
+ {
+ if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaTop" ) ) )
+ {
+ pValue->Value >>= nTmp;
+ aRect.setY( nTmp );
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaLeft" ) ) )
+ {
+ pValue->Value >>= nTmp;
+ aRect.setX( nTmp );
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaWidth" ) ) )
+ {
+ pValue->Value >>= nTmp;
+ aRect.setWidth( nTmp );
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaHeight" ) ) )
+ {
+ pValue->Value >>= nTmp;
+ aRect.setHeight( nTmp );
+ }
+ pValue++;
+ }
+
+ pDocShell->SetVisArea ( aRect );
+}
+
void SmXMLExport::_ExportContent()
{
SvXMLElementExport aEquation(*this,XML_NAMESPACE_MATH,sXML_math, sal_False,
@@ -2951,6 +3059,45 @@ void SmXMLExport::_ExportContent()
}
}
+void SmXMLExport::GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps)
+{
+ uno::Reference <frame::XModel> xModel = GetModel();
+ if( !xModel.is() )
+ return;
+
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ if( !pModel )
+ return;
+
+ SmDocShell *pDocShell =
+ static_cast<SmDocShell*>(pModel->GetObjectShell());
+ if( !pDocShell )
+ return;
+
+ aProps.realloc( 4 );
+ beans::PropertyValue *pValue = aProps.getArray();
+ sal_Int32 nIndex = 0;
+
+ const Rectangle &rRect =
+ pDocShell->GetVisArea();
+
+ pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaTop") );
+ pValue[nIndex++].Value <<= rRect.Top();
+
+ pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaLeft") );
+ pValue[nIndex++].Value <<= rRect.Left();
+
+ pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaWidth") );
+ pValue[nIndex++].Value <<= rRect.GetWidth();
+
+ pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaHeight") );
+ pValue[nIndex++].Value <<= rRect.GetHeight();
+}
+
void SmXMLExport::ExportLine(const SmNode *pNode,int nLevel)
{
ExportExpression(pNode,nLevel);
diff --git a/starmath/source/mathml.hxx b/starmath/source/mathml.hxx
index cb1ecab5a344..3b893dcfabd3 100644
--- a/starmath/source/mathml.hxx
+++ b/starmath/source/mathml.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: mathml.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: obo $ $Date: 2001-03-08 16:53:42 $
+ * last change: $Author: mib $ $Date: 2001-03-23 07:46:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,6 +66,9 @@
#ifndef _SDXMLEXP_HXX
#include <xmloff/xmlexp.hxx>
#endif
+#ifndef _XMLOFF_DOCUMENTSETTINGSCONTEXT_HXX
+#include <xmloff/DocumentSettingsContext.hxx>
+#endif
#ifndef NODE_HXX
@@ -291,6 +294,9 @@ public:
SmNode *GetTree() { return aNodeStack.Pop();}
sal_Bool GetSuccess() { return bSuccess; }
String &GetText() { return aText;}
+
+ virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
+
private:
SvXMLTokenMap *pMathElemTokenMap;
SvXMLTokenMap *pPresLayoutElemTokenMap;
@@ -404,6 +410,8 @@ public:
void _ExportContent();
sal_uInt32 exportDoc(const sal_Char *pClass);
+ virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
+
sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException);
static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId()
diff --git a/starmath/source/register.cxx b/starmath/source/register.cxx
index 98725266f984..5abd525752ed 100644
--- a/starmath/source/register.cxx
+++ b/starmath/source/register.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: register.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jl $ $Date: 2001-03-22 16:02:38 $
+ * last change: $Author: mib $ $Date: 2001-03-23 07:46:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -85,6 +85,13 @@ extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
SAL_CALL SmXMLImportMeta_createInstance(const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw(
::com::sun::star::uno::Exception );
+extern ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+SmXMLImportSettings_getSupportedServiceNames() throw();
+extern ::rtl::OUString SAL_CALL SmXMLImportSettings_getImplementationName() throw();
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL SmXMLImportSettings_createInstance(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw(
+ ::com::sun::star::uno::Exception );
//MathML export
extern ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
@@ -101,6 +108,13 @@ extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
SAL_CALL SmXMLExportMeta_createInstance(const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw(
::com::sun::star::uno::Exception );
+extern ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+SmXMLExportSettings_getSupportedServiceNames() throw();
+extern ::rtl::OUString SAL_CALL SmXMLExportSettings_getImplementationName() throw();
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL SmXMLExportSettings_createInstance(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw(
+ ::com::sun::star::uno::Exception );
extern "C" {
@@ -178,6 +192,23 @@ sal_Bool SAL_CALL component_writeInfo( void* pServiceManager ,
for(i = 0; i < rServices.getLength(); i++ )
xNewKey->createKey( rServices.getConstArray()[i]);
+ xNewKey = xKey->createKey(::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("/") ) + SmXMLImportSettings_getImplementationName() +
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) );
+
+ rServices = SmXMLImportSettings_getSupportedServiceNames();
+ for(i = 0; i < rServices.getLength(); i++ )
+ xNewKey->createKey( rServices.getConstArray()[i]);
+
+ xNewKey = xKey->createKey(::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("/") ) + SmXMLExportSettings_getImplementationName() +
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) );
+
+ rServices = SmXMLExportSettings_getSupportedServiceNames();
+ for(i = 0; i < rServices.getLength(); i++ )
+ xNewKey->createKey( rServices.getConstArray()[i]);
+
+
return sal_True;
}
@@ -230,6 +261,22 @@ void* SAL_CALL component_getFactory( const sal_Char* pImplementationName
SmXMLExportMeta_createInstance,
SmXMLExportMeta_getSupportedServiceNames() );
}
+ else if( SmXMLImportSettings_getImplementationName().equalsAsciiL(
+ pImplementationName, strlen(pImplementationName)) )
+ {
+ xFactory = ::cppu::createSingleFactory( xServiceManager,
+ SmXMLImportSettings_getImplementationName(),
+ SmXMLImportSettings_createInstance,
+ SmXMLImportSettings_getSupportedServiceNames() );
+ }
+ else if( SmXMLExportSettings_getImplementationName().equalsAsciiL(
+ pImplementationName, strlen(pImplementationName)) )
+ {
+ xFactory = ::cppu::createSingleFactory( xServiceManager,
+ SmXMLExportSettings_getImplementationName(),
+ SmXMLExportSettings_createInstance,
+ SmXMLExportSettings_getSupportedServiceNames() );
+ }
// Factory is valid - service was found.
if ( xFactory.is() )