diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-16 13:55:36 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-16 13:55:36 +0000 |
commit | 3927423de93170f30844970b98b415ba83543dae (patch) | |
tree | 74394c6e84b99368d32d5083a7225745d760b459 /xmloff | |
parent | 38170c58d324546265db7c5f40bb40133348c66b (diff) |
CWS-TOOLING: integrate CWS impressnotes01
2009-09-11 13:52:41 +0200 cl r276061 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@276043 (milestone: DEV300:m58)
2009-09-10 15:44:57 +0200 cl r276039 : #i103139# continued work on the impress annotation feature
2009-09-10 14:52:31 +0200 cl r276032 : #i103139# continued work on the impress annotation feature
2009-09-10 14:50:32 +0200 cl r276031 : #i103139# continued work on the impress annotation feature
2009-09-10 14:48:29 +0200 cl r276030 : #i103139# continued work on the impress annotation feature
2009-09-10 11:36:11 +0200 cl r276027 : #i103139# continued work on the impress annotation feature
2009-09-09 20:22:41 +0200 cl r276018 : #i103139# continued work on the impress annotation feature
2009-09-09 20:21:45 +0200 cl r276017 : #i103139# continued work on the impress annotation feature
2009-09-09 19:32:29 +0200 sj r276015 : #i103139# added import of comments (ppt binary)
2009-09-09 19:31:07 +0200 sj r276014 : #i103139# added import of comments (ppt binary)
2009-09-09 19:16:41 +0200 cl r276011 : #i103139# continued work on the impress annotation feature
2009-09-09 19:15:19 +0200 cl r276010 : #i103139# continued work on the impress annotation feature
2009-09-09 16:27:19 +0200 cl r276001 : #i104579# fixed isEmptyPresObj()
2009-09-09 15:12:02 +0200 cl r275997 : #i103139# continued work on the impress annotation feature
2009-09-09 15:06:29 +0200 sj r275996 : #i103139# added import of comments (ppt binary)
2009-09-09 14:53:01 +0200 cl r275995 : #i103139# continued work on the impress annotation feature
2009-09-09 14:51:32 +0200 cl r275994 : #i103139# continued work on the impress annotation feature
2009-09-09 12:11:17 +0200 cl r275982 : #i103139# continued work on the impress annotation feature
2009-09-09 11:47:55 +0200 cl r275981 : #i103139# continued work on the impress annotation feature
2009-09-09 11:47:23 +0200 cl r275980 : #i103139# continued work on the impress annotation feature
2009-09-09 11:44:47 +0200 cl r275978 : #i104315# added missing tab pages
2009-09-08 16:04:44 +0200 cl r275936 : #i103139# continued work on the impress annotation feature
2009-09-08 16:03:28 +0200 cl r275935 : #i103139# continued work on the impress annotation feature
2009-09-08 11:45:47 +0200 cl r275920 : #i103139# continued work on the impress annotation feature
2009-09-08 11:41:51 +0200 cl r275919 : #i103139# continued work on the impress annotation feature
2009-09-07 18:30:55 +0200 cl r275910 : #i103139# continued work on the impress annotation feature
2009-09-07 18:29:37 +0200 cl r275909 : #i103139# continued work on the impress annotation feature
2009-09-07 17:25:43 +0200 cl r275905 : #i103139# continued work on the impress annotation feature
2009-09-07 12:00:28 +0200 cl r275884 : #i103139# continued work on the impress annotation feature
2009-09-06 14:14:00 +0200 cl r275859 : #i103139# continued work on the impress annotation feature
2009-09-05 20:57:24 +0200 cl r275854 : #i103139# continued work on the impress annotation feature
2009-09-05 20:56:29 +0200 cl r275853 : #i103139# continued work on the impress annotation feature
2009-09-05 20:55:27 +0200 cl r275852 : #i103139# continued work on the impress annotation feature
2009-09-05 20:11:42 +0200 cl r275851 : #i103139# continued work on the impress annotation feature
2009-09-05 20:11:09 +0200 cl r275850 : #i103139# continued work on the impress annotation feature
2009-09-05 17:43:33 +0200 cl r275845 : #i103139# continued work on the impress annotation feature
2009-09-05 17:04:41 +0200 cl r275843 : #i103139# continued work on the impress annotation feature
2009-09-05 17:03:26 +0200 cl r275842 : #i103139# continued work on the impress annotation feature
2009-09-05 17:02:53 +0200 cl r275841 : #i103139# continued work on the impress annotation feature
2009-09-05 13:15:04 +0200 pl r275839 : #i104823# WB_NEEDSFOCUS
2009-09-05 13:14:41 +0200 pl r275838 : #i104823# WB_NEEDSFOCUS
2009-09-04 17:48:21 +0200 cl r275826 : #i103139# continued work on the impress annotation feature
2009-09-04 17:35:03 +0200 cl r275825 : #i103139# continued work on the impress annotation feature
2009-09-04 17:15:46 +0200 cl r275824 : #i103139# continued work on the impress annotation feature
2009-09-04 17:12:54 +0200 cl r275823 : #i103139# continued work on the impress annotation feature
2009-09-04 17:05:23 +0200 cl r275822 : #i103139# continued work on the impress annotation feature
2009-09-04 16:48:28 +0200 cl r275820 : #i103139# continued work on the impress annotation feature
2009-09-04 16:44:02 +0200 cl r275818 : #i103139# continued work on the impress annotation feature
2009-09-04 16:43:23 +0200 cl r275817 : #i103139# continued work on the impress annotation feature
2009-09-04 16:06:04 +0200 cl r275812 : #i103139# continued work on the impress annotation feature
2009-09-04 16:05:45 +0200 cl r275811 : #i103139# continued work on the impress annotation feature
2009-09-04 15:04:33 +0200 cl r275806 : #i103139# continued work on the impress annotation feature
2009-09-04 11:43:14 +0200 cl r275795 : #i103139# continued work on the impress annotation feature
2009-09-04 11:27:10 +0200 cl r275793 : #i103139# continued work on the impress annotation feature
2009-09-04 11:10:02 +0200 cl r275792 : #i103139# continued work on the impress annotation feature
2009-09-04 11:07:05 +0200 cl r275790 : #i103139# continued work on the impress annotation feature
2009-09-04 11:05:01 +0200 cl r275789 : #i103139# continued work on the impress annotation feature
2009-09-04 10:55:51 +0200 cl r275785 : #i103139# renamed notes to comments
2009-09-04 10:54:57 +0200 cl r275784 : #i103139# renamed notes to comments
2009-09-03 20:37:35 +0200 cl r275772 : #i103139# continued work on the impress annotation feature
2009-09-03 20:35:31 +0200 cl r275771 : #i103139# continued work on the impress annotation feature
2009-09-01 18:17:55 +0200 cl r275680 : #i103139# continued work on the impress annotation feature
2009-09-01 18:15:08 +0200 cl r275678 : #i103139# continued work on the impress annotation feature
2009-09-01 18:13:38 +0200 cl r275677 : #i103139#
continued work on the impress annotation feature
2009-08-18 12:35:42 +0200 cl r275089 : fixed merge error
2009-08-18 11:39:58 +0200 cl r275086 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@275001 (milestone: DEV300:m55)
2009-07-30 13:45:10 +0200 cl r274481 : fixed merge errrors
2009-07-30 13:41:21 +0200 cl r274480 : fixed merge errrors
2009-07-30 13:39:40 +0200 cl r274478 : fixed merge errrors
2009-07-22 18:07:30 +0200 cl r274256 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@273858 (milestone: DEV300:m52)
2009-07-21 17:21:31 +0200 cl r274208 : merging
2009-07-20 14:28:34 +0200 cl r274137 : #i103139# annotation support for impress
2009-07-20 14:28:04 +0200 cl r274136 : #i103139# annotation support for impress
2009-07-20 14:27:20 +0200 cl r274135 : #i103139# annotation support for impress
2009-07-20 14:21:17 +0200 cl r274134 : #i103139# annotation support for impress
2009-07-20 14:20:56 +0200 cl r274133 : #i103139# annotation support for impress
2009-07-20 14:20:09 +0200 cl r274132 : #i103139# annotation support for impress
2009-07-20 14:19:00 +0200 cl r274131 : #i103139# annotation support for impress
2009-07-20 14:17:50 +0200 cl r274130 : #i103139# annotation support for impress
2009-07-20 14:12:24 +0200 cl r274129 : #i103139# annotation support for impress
2009-07-20 13:52:03 +0200 cl r274128 : #i103139# annotation support for impress
2009-07-20 13:51:11 +0200 cl r274127 : #i103139# annotation support for impress
2009-07-20 13:48:59 +0200 cl r274126 : #i103139# annotation support for impress
2009-07-20 13:43:56 +0200 cl r274125 : #i103139# annotation support for impress
2009-07-20 13:31:55 +0200 cl r274123 : #i103139# annotation support for impress
2009-07-20 13:30:45 +0200 cl r274122 : #i103139# annotation support for impress
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/xmlnmspe.hxx | 10 | ||||
-rw-r--r-- | xmloff/inc/xmloff/xmltoken.hxx | 4 | ||||
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/draw/sdxmlexp.cxx | 131 | ||||
-rw-r--r-- | xmloff/source/draw/sdxmlexp_impl.hxx | 3 | ||||
-rw-r--r-- | xmloff/source/draw/ximppage.cxx | 164 | ||||
-rw-r--r-- | xmloff/source/draw/ximppage.hxx | 4 | ||||
-rw-r--r-- | xmloff/source/meta/MetaExportComponent.cxx | 1 |
10 files changed, 306 insertions, 22 deletions
diff --git a/xmloff/inc/xmlnmspe.hxx b/xmloff/inc/xmlnmspe.hxx index 86fc13ba31..c2447dd7b6 100644 --- a/xmloff/inc/xmlnmspe.hxx +++ b/xmloff/inc/xmlnmspe.hxx @@ -82,7 +82,15 @@ XML_NAMESPACE( OF, 34U ) // OpenFormula aka ODFF XML_NAMESPACE( XHTML, 35U ) XML_NAMESPACE( GRDDL, 36U ) -#define _XML_OLD_NAMESPACE_BASE 37U +// namespaces for odf extended formats + +#define XML_NAMESPACE_EXT( prefix, key ) \ +const sal_uInt16 XML_NAMESPACE_##prefix##_EXT = key; \ +const sal_uInt16 XML_NAMESPACE_##prefix##_EXT_IDX = key; + +XML_NAMESPACE_EXT( OFFICE, 37U ) + +#define _XML_OLD_NAMESPACE_BASE 38U // namespaces used in the technical preview (SO 5.2) XML_OLD_NAMESPACE( FO, 0U ) diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index 20ccb24944..daca654692 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -144,6 +144,10 @@ namespace xmloff { namespace token { XML_NP_GRDDL, XML_N_GRDDL, + // ODF Enhanced namespaces + XML_NP_OFFICE_EXT, + XML_N_OFFICE_EXT, + // units XML_UNIT_MM, XML_UNIT_M, diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index ec4d6acdb9..37e74b4caf 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1357,7 +1357,8 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) { const sal_Char* pVersion = 0; switch( getDefaultVersion() ) - { + { + case SvtSaveOptions::ODFVER_LATEST: pVersion = sXML_1_2; break; case SvtSaveOptions::ODFVER_012: pVersion = sXML_1_2; break; case SvtSaveOptions::ODFVER_011: pVersion = sXML_1_1; break; case SvtSaveOptions::ODFVER_010: break; diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 1dad571f56..9e37af91b7 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -89,6 +89,7 @@ using namespace ::com::sun::star::document; using namespace ::xmloff::token; sal_Char __READONLY_DATA sXML_np__office[] = "_office"; +sal_Char __READONLY_DATA sXML_np__office_ext[] = "_office_ooo"; sal_Char __READONLY_DATA sXML_np__ooo[] = "_ooo"; sal_Char __READONLY_DATA sXML_np__ooow[] = "_ooow"; sal_Char __READONLY_DATA sXML_np__oooc[] = "_oooc"; @@ -241,6 +242,9 @@ void SvXMLImport::_InitCtor() mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office ) ), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE ); + mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office_ext ) ), + GetXMLToken(XML_N_OFFICE_EXT), + XML_NAMESPACE_OFFICE_EXT ); mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__ooo ) ), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO ); mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__style) ), GetXMLToken(XML_N_STYLE), diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 0dde523b4e..0a2ccd57d1 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -152,6 +152,10 @@ namespace xmloff { namespace token { TOKEN( "grddl", XML_NP_GRDDL ), TOKEN( "http://www.w3.org/2003/g/data-view#", XML_N_GRDDL ), + // ODF Enhanced namespaces + TOKEN( "officeooo", XML_NP_OFFICE_EXT ), + TOKEN( "http://openoffice.org/2009/office", XML_N_OFFICE_EXT ), + // units TOKEN( "mm", XML_UNIT_MM ), TOKEN( "m", XML_UNIT_M ), diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 765b5b8528..f75107c6e2 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -39,7 +39,9 @@ #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> #include <com/sun/star/presentation/XPresentationSupplier.hpp> #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp> +#include <com/sun/star/geometry/RealPoint2D.hpp> #include <com/sun/star/task/XStatusIndicatorSupplier.hpp> +#include <com/sun/star/office/XAnnotationAccess.hpp> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/uno/Any.hxx> #include "sdxmlexp_impl.hxx" @@ -51,9 +53,7 @@ #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/style/XStyle.hpp> -#ifndef _COM_SUN_STAR_FORM_XFORMSUPPLIER2_HPP_ #include <com/sun/star/form/XFormsSupplier2.hpp> -#endif #include <com/sun/star/presentation/XPresentationPage.hpp> #include <com/sun/star/drawing/XMasterPageTarget.hpp> #include <com/sun/star/text/XText.hpp> @@ -96,9 +96,13 @@ using ::rtl::OUStringBuffer; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::util; using namespace ::com::sun::star::container; using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::office; using namespace ::com::sun::star::presentation; +using namespace ::com::sun::star::geometry; +using namespace ::com::sun::star::text; using namespace ::xmloff::token; @@ -640,6 +644,14 @@ void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent GetXMLToken(XML_N_ANIMATION), XML_NAMESPACE_ANIMATION); + if( getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST ) + { + _GetNamespaceMap().Add( + GetXMLToken(XML_NP_OFFICE_EXT), + GetXMLToken(XML_N_OFFICE_EXT), + XML_NAMESPACE_OFFICE_EXT); + } + GetShapeExport()->enableLayerExport(); // #88546# enable progress bar increments @@ -2060,6 +2072,8 @@ void SdXMLExport::_ExportContent() } } } + + exportAnnotations( xDrawPage ); } } @@ -2355,10 +2369,9 @@ void SdXMLExport::_ExportAutoStyles() // create auto style infos for objects on master pages for(sal_Int32 nMPageId(0L); nMPageId < mnDocMasterPageCount; nMPageId++) { - Any aAny(mxDocMasterPages->getByIndex(nMPageId)); - Reference< XDrawPage > xMasterPage; + Reference< XDrawPage > xMasterPage(mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY ); - if((aAny >>= xMasterPage) && xMasterPage.is() ) + if( xMasterPage.is() ) { // collect layer information GetFormExport()->examineForms( xMasterPage ); @@ -2397,6 +2410,7 @@ void SdXMLExport::_ExportAutoStyles() } } } + collectAnnotationAutoStyles(xMasterPage); } } } @@ -2413,10 +2427,8 @@ void SdXMLExport::_ExportAutoStyles() // create auto style infos for objects on pages for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++) { - Any aAny(mxDocDrawPages->getByIndex(nPageInd)); - Reference<XDrawPage> xDrawPage; - - if((aAny >>= xDrawPage) && xDrawPage.is() ) + Reference<XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), UNO_QUERY ); + if( xDrawPage.is() ) { // collect layer information GetFormExport()->examineForms( xDrawPage ); @@ -2466,6 +2478,8 @@ void SdXMLExport::_ExportAutoStyles() } } } + + collectAnnotationAutoStyles( xDrawPage ); } } if(IsImpress()) @@ -2536,10 +2550,8 @@ void SdXMLExport::_ExportMasterStyles() // export MasterPages in master-styles section for(sal_Int32 nMPageId = 0L; nMPageId < mnDocMasterPageCount; nMPageId++) { - Any aAny(mxDocMasterPages->getByIndex(nMPageId)); - Reference< XDrawPage > xMasterPage; - - if((aAny >>= xMasterPage) && xMasterPage.is()) + Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY ); + if(xMasterPage.is()) { // prepare masterpage attributes OUString sMasterPageName; @@ -2610,6 +2622,7 @@ void SdXMLExport::_ExportMasterStyles() } } } + exportAnnotations( xMasterPage ); } } } @@ -2770,6 +2783,98 @@ OUString SdXMLExport::getNavigationOrder( const Reference< XDrawPage >& xDrawPag ////////////////////////////////////////////////////////////////////////////// +void SdXMLExport::collectAnnotationAutoStyles( const Reference<XDrawPage>& xDrawPage ) +{ + Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY ); + if( xAnnotationAccess.is() ) try + { + Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() ); + if( xAnnotationEnumeration.is() ) + { + while( xAnnotationEnumeration->hasMoreElements() ) + { + Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_QUERY_THROW ); + Reference< XText > xText( xAnnotation->getTextRange() ); + if(xText.is() && xText->getString().getLength()) + GetTextParagraphExport()->collectTextAutoStyles( xText ); + } + } + } + catch( Exception& ) + { + DBG_ERROR("SdXMLExport::collectAnnotationAutoStyles(), exception caught during export of annotation auto styles"); + } +} + +void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage ) +{ + // do not export in ODF 1.2 or older + if( getDefaultVersion() != SvtSaveOptions::ODFVER_LATEST ) + return; + + Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY ); + if( xAnnotationAccess.is() ) try + { + Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() ); + if( xAnnotationEnumeration.is() && xAnnotationEnumeration->hasMoreElements() ) + { + OUStringBuffer sStringBuffer; + do + { + Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_QUERY_THROW ); + + RealPoint2D aPosition( xAnnotation->getPosition() ); + + GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aPosition.X * 100 ) ); + AddAttribute(XML_NAMESPACE_SVG, XML_X, sStringBuffer.makeStringAndClear()); + + GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aPosition.Y * 100 ) ); + AddAttribute(XML_NAMESPACE_SVG, XML_Y, sStringBuffer.makeStringAndClear()); + + RealSize2D aSize( xAnnotation->getSize() ); + + if( aSize.Width || aSize.Height ) + { + GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aSize.Width * 100 ) ); + AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, sStringBuffer.makeStringAndClear()); + GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aSize.Height * 100 ) ); + AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, sStringBuffer.makeStringAndClear()); + } + + // annotation element + content + SvXMLElementExport aElem(*this, XML_NAMESPACE_OFFICE_EXT, XML_ANNOTATION, sal_False, sal_True); + + // author + OUString aAuthor( xAnnotation->getAuthor() ); + if( aAuthor.getLength() ) + { + SvXMLElementExport aCreatorElem( *this, XML_NAMESPACE_DC, XML_CREATOR, sal_True, sal_False ); + this->Characters(aAuthor); + } + + { + // date time + DateTime aDate( xAnnotation->getDateTime() ); + GetMM100UnitConverter().convertDateTime(sStringBuffer, aDate, sal_True); + SvXMLElementExport aDateElem( *this, XML_NAMESPACE_DC, XML_DATE, sal_True, sal_False ); + Characters(sStringBuffer.makeStringAndClear()); + } + + com::sun::star::uno::Reference < com::sun::star::text::XText > xText( xAnnotation->getTextRange() ); + if( xText.is() ) + this->GetTextParagraphExport()->exportText( xText ); + } + while( xAnnotationEnumeration->hasMoreElements() ); + } + } + catch( Exception& ) + { + DBG_ERROR("SdXMLExport::exportAnnotations(), exception caught during export of annotations"); + } +} + +////////////////////////////////////////////////////////////////////////////// + #define SERVICE( classname, servicename, implementationname, draw, flags )\ uno::Sequence< OUString > SAL_CALL classname##_getSupportedServiceNames() throw()\ {\ diff --git a/xmloff/source/draw/sdxmlexp_impl.hxx b/xmloff/source/draw/sdxmlexp_impl.hxx index c87af9d4df..c5d92fcd05 100644 --- a/xmloff/source/draw/sdxmlexp_impl.hxx +++ b/xmloff/source/draw/sdxmlexp_impl.hxx @@ -186,6 +186,9 @@ class SdXMLExport : public SvXMLExport rtl::OUString getNavigationOrder( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage ); + void collectAnnotationAutoStyles( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage ); + void exportAnnotations( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage ); + protected: virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps); virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps); diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index d0fa7f7279..1008691682 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -32,6 +32,9 @@ #include "precompiled_xmloff.hxx" #include <tools/debug.hxx> +#include <com/sun/star/geometry/RealPoint2D.hpp> +#include <com/sun/star/text/XTextCursor.hpp> +#include <com/sun/star/util/DateTime.hpp> #include <cppuhelper/implbase1.hxx> #include "XMLNumberStylesImport.hxx" #include <xmloff/xmlstyle.hxx> @@ -41,6 +44,7 @@ #include "ximppage.hxx" #include "ximpshap.hxx" #include "animimp.hxx" +#include "XMLStringBufferImportContext.hxx" #include <xmloff/formsimp.hxx> #include <xmloff/xmlictxt.hxx> #include "ximpstyl.hxx" @@ -57,9 +61,155 @@ using namespace ::com::sun::star; using namespace ::xmloff::token; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::text; +using namespace ::com::sun::star::util; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::container; +using namespace ::com::sun::star::office; +using namespace ::com::sun::star::xml::sax; +using namespace ::com::sun::star::geometry; + + +////////////////////////////////////////////////////////////////////////////// + +class DrawAnnotationContext : public SvXMLImportContext +{ + +public: + DrawAnnotationContext( SvXMLImport& rImport, USHORT nPrfx, const OUString& rLocalName,const Reference< xml::sax::XAttributeList>& xAttrList, const Reference< XAnnotationAccess >& xAnnotationAccess ); + + virtual SvXMLImportContext * CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ); + virtual void EndElement(); + +private: + Reference< XAnnotation > mxAnnotation; + Reference< XTextCursor > mxCursor; + + OUStringBuffer maAuthorBuffer; + OUStringBuffer maDateBuffer; +}; + +DrawAnnotationContext::DrawAnnotationContext( SvXMLImport& rImport, USHORT nPrfx, const OUString& rLocalName,const Reference< xml::sax::XAttributeList>& xAttrList, const Reference< XAnnotationAccess >& xAnnotationAccess ) +: SvXMLImportContext( rImport, nPrfx, rLocalName ) +, mxAnnotation( xAnnotationAccess->createAndInsertAnnotation() ) +{ + if( mxAnnotation.is() ) + { + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + + RealPoint2D aPosition; + RealSize2D aSize; + + for(sal_Int16 i=0; i < nAttrCount; i++) + { + OUString sValue( xAttrList->getValueByIndex( i ) ); + OUString sAttrName( xAttrList->getNameByIndex( i ) ); + OUString aLocalName; + switch( GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ) ) + { + case XML_NAMESPACE_SVG: + if( IsXMLToken( aLocalName, XML_X ) ) + { + sal_Int32 x; + GetImport().GetMM100UnitConverter().convertMeasure(x, sValue); + aPosition.X = static_cast<double>(x) / 100.0; + } + else if( IsXMLToken( aLocalName, XML_Y ) ) + { + sal_Int32 y; + GetImport().GetMM100UnitConverter().convertMeasure(y, sValue); + aPosition.Y = static_cast<double>(y) / 100.0; + } + else if( IsXMLToken( aLocalName, XML_WIDTH ) ) + { + sal_Int32 w; + GetImport().GetMM100UnitConverter().convertMeasure(w, sValue); + aSize.Width = static_cast<double>(w) / 100.0; + } + else if( IsXMLToken( aLocalName, XML_HEIGHT ) ) + { + sal_Int32 h; + GetImport().GetMM100UnitConverter().convertMeasure(h, sValue); + aSize.Height = static_cast<double>(h) / 100.0; + } + break; + default: + break; + } + } + + mxAnnotation->setPosition( aPosition ); + mxAnnotation->setSize( aSize ); + } +} + +SvXMLImportContext * DrawAnnotationContext::CreateChildContext( USHORT nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList ) +{ + SvXMLImportContext * pContext = NULL; + + if( mxAnnotation.is() ) + { + if( XML_NAMESPACE_DC == nPrefix ) + { + if( IsXMLToken( rLocalName, XML_CREATOR ) ) + pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maAuthorBuffer); + else if( IsXMLToken( rLocalName, XML_DATE ) ) + pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, maDateBuffer); + } + else + { + // create text cursor on demand + if( !mxCursor.is() ) + { + uno::Reference< text::XText > xText( mxAnnotation->getTextRange() ); + if( xText.is() ) + { + UniReference < XMLTextImportHelper > xTxtImport = GetImport().GetTextImport(); + mxCursor = xText->createTextCursor(); + if( mxCursor.is() ) + xTxtImport->SetCursor( mxCursor ); + } + } + + // if we have a text cursor, lets try to import some text + if( mxCursor.is() ) + { + pContext = GetImport().GetTextImport()->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList ); + } + } + } + + // call parent for content + if(!pContext) + pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); + + return pContext; +} + +void DrawAnnotationContext::EndElement() +{ + if(mxCursor.is()) + { + // delete addition newline + const OUString aEmpty; + mxCursor->gotoEnd( sal_False ); + mxCursor->goLeft( 1, sal_True ); + mxCursor->setString( aEmpty ); + + // reset cursor + GetImport().GetTextImport()->ResetCursor(); + } + + if( mxAnnotation.is() ) + { + mxAnnotation->setAuthor( maAuthorBuffer.makeStringAndClear() ); + + DateTime aDateTime; + if(SvXMLUnitConverter::convertDateTime(aDateTime, maDateBuffer.makeStringAndClear())) + mxAnnotation->setDateTime(aDateTime); + } +} ////////////////////////////////////////////////////////////////////////////// @@ -70,8 +220,9 @@ SdXMLGenericPageContext::SdXMLGenericPageContext( USHORT nPrfx, const OUString& rLocalName, const Reference< xml::sax::XAttributeList>& xAttrList, Reference< drawing::XShapes >& rShapes) -: SvXMLImportContext( rImport, nPrfx, rLocalName ), - mxShapes( rShapes ) +: SvXMLImportContext( rImport, nPrfx, rLocalName ) +, mxShapes( rShapes ) +, mxAnnotationAccess( rShapes, UNO_QUERY ) { sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; @@ -100,10 +251,8 @@ void SdXMLGenericPageContext::StartElement( const Reference< ::com::sun::star::x { GetImport().GetShapeImport()->pushGroupForSorting( mxShapes ); -#ifndef SVX_LIGHT if( GetImport().IsFormsSupported() ) GetImport().GetFormImport()->startPage( Reference< drawing::XDrawPage >::query( mxShapes ) ); -#endif } ////////////////////////////////////////////////////////////////////////////// @@ -120,10 +269,13 @@ SvXMLImportContext* SdXMLGenericPageContext::CreateChildContext( USHORT nPrefix, } else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_FORMS ) ) { -#ifndef SVX_LIGHT if( GetImport().IsFormsSupported() ) pContext = GetImport().GetFormImport()->createOfficeFormsContext( GetImport(), nPrefix, rLocalName ); -#endif + } + else if( ((nPrefix == XML_NAMESPACE_OFFICE) || (nPrefix == XML_NAMESPACE_OFFICE_EXT)) && IsXMLToken( rLocalName, XML_ANNOTATION ) ) + { + if( mxAnnotationAccess.is() ) + pContext = new DrawAnnotationContext( GetImport(), nPrefix, rLocalName, xAttrList, mxAnnotationAccess ); } else { diff --git a/xmloff/source/draw/ximppage.hxx b/xmloff/source/draw/ximppage.hxx index e5c8816730..21c6992098 100644 --- a/xmloff/source/draw/ximppage.hxx +++ b/xmloff/source/draw/ximppage.hxx @@ -35,6 +35,7 @@ #include "sdxmlimp_impl.hxx" #include <xmloff/nmspmap.hxx> #include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/office/XAnnotationAccess.hpp> #include <tools/rtti.hxx> #include "ximpshap.hxx" @@ -44,7 +45,8 @@ class SdXMLGenericPageContext : public SvXMLImportContext { // the shape group this group is working on - com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxShapes; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxShapes; + ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationAccess > mxAnnotationAccess; protected: rtl::OUString maPageLayoutName; diff --git a/xmloff/source/meta/MetaExportComponent.cxx b/xmloff/source/meta/MetaExportComponent.cxx index add1e47305..9ad2b841cf 100644 --- a/xmloff/source/meta/MetaExportComponent.cxx +++ b/xmloff/source/meta/MetaExportComponent.cxx @@ -170,6 +170,7 @@ sal_uInt32 XMLMetaExportComponent::exportDoc( enum XMLTokenEnum ) const sal_Char* pVersion = 0; switch( getDefaultVersion() ) { + case SvtSaveOptions::ODFVER_LATEST: pVersion = "1.2"; break; case SvtSaveOptions::ODFVER_012: pVersion = "1.2"; break; case SvtSaveOptions::ODFVER_011: pVersion = "1.1"; break; case SvtSaveOptions::ODFVER_010: break; |