diff options
author | Marco Cecchetti <mrcekets@gmail.com> | 2012-08-11 22:23:22 +0200 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2012-10-10 12:03:28 +0200 |
commit | b76628acb1ae4fc06f8c1b70ec2e0cf39356deef (patch) | |
tree | 23d2bc9d6e763c601db80e38bf4901dcdd5a4474 /filter/source/svg/svgwriter.hxx | |
parent | 5626e723945eb39ed211a26ba5386ee486b8a4e8 (diff) |
text export support for bullets and hyperlinks
SVGFilter:
- new:
implExportTextShapeIndex, implEmbedBulletGlyphs, implEmbedBulletGlyph,
implExportTextEmbeddedBitmaps
- modified:
implExportShape, implCreateObjectsFromShapes, implCreateObjectsFromShape
SVGActionWriter:
- new:
GetChecksum
- modified:
ImplWriteActions, WriteMetaFile
SVGTextWriter:
-new:
implExportHyperlinkIds, implWriteBulletChars, writeBitmapPlaceholder,
implWriteEmbeddedBitmaps, setTextShape, implRegisterInterface,
implGetValidIDFromInterface
-modified:
nextParagraph, nextTextPortion, startTextShape, endTextShape, startTextParagraph,
endTextParagraph, writeTextPortion, implWriteTextPortion
Diffstat (limited to 'filter/source/svg/svgwriter.hxx')
-rw-r--r-- | filter/source/svg/svgwriter.hxx | 103 |
1 files changed, 98 insertions, 5 deletions
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx index 8f74671903cc..3a23f5fa52ad 100644 --- a/filter/source/svg/svgwriter.hxx +++ b/filter/source/svg/svgwriter.hxx @@ -45,6 +45,12 @@ #include <xmloff/nmspmap.hxx> #include <com/sun/star/uno/Reference.h> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -55,6 +61,21 @@ #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> #include <com/sun/star/i18n/CharacterIteratorMode.hpp> #include <com/sun/star/i18n/XBreakIterator.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/XTextContent.hpp> +#include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/text/XTextField.hpp> +#include <com/sun/star/style/NumberingType.hpp> + +// ----------------------------------------------------------------------------- + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::text; +using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::style; // ----------------------------------------------------------------------------- @@ -141,29 +162,68 @@ struct SVGShapeDescriptor } }; -// ------------------- -// - SVGActionWriter - -// ------------------- + class SVGAttributeWriter; class GDIMetaFile; + +// --------------------------- +// - BulletListItemInfo - +// --------------------------- +struct BulletListItemInfo +{ + long nFontSize; + Color aColor; + Point aPos; + sal_Unicode cBulletChar; +}; + +// --------------------------- +// - OUStringHasher - +// --------------------------- + +struct OUStringHasher +{ + size_t operator()( const ::rtl::OUString& oustr ) const { return static_cast< size_t >( oustr.hashCode() ); } +}; + + // ------------------- // - SVGTextWriter - // ------------------- class SVGTextWriter { + public: + typedef ::boost::unordered_map< ::rtl::OUString, BulletListItemInfo, OUStringHasher > BulletListItemInfoMap; + private: SVGExport& mrExport; SVGFontExport& mrFontExport; SVGAttributeWriter* mpContext; VirtualDevice* mpVDev; + Reference<XText> mrTextShape; + Reference<XEnumeration> mrParagraphEnumeration; + Reference<XEnumeration> mrTextPortionEnumeration; + Reference<XTextRange> mrCurrentTextPortion; + const GDIMetaFile* mpTextEmbeddedBitmapMtf; MapMode* mpTargetMapMode; SvXMLElementExport* mpTextShapeElem; SvXMLElementExport* mpTextParagraphElem; SvXMLElementExport* mpTextPositionElem; + sal_Int32 mnLeftTextPortionLength; Point maTextPos; long int mnTextWidth; + sal_Bool mbPositioningNeeded; + sal_Bool mbIsNumbering; + sal_Int16 meNumberingType; + sal_Unicode mcBulletChar; + BulletListItemInfoMap maBulletListItemMap; + sal_Bool mbIsListLevelStyleImage; + sal_Bool mbLineBreak; + sal_Bool mbIsURLField; + ::rtl::OUString msUrl; + ::rtl::OUString msHyperlinkIdList; sal_Bool mbIsPlacehlolderShape; sal_Bool mbIWS; Font maCurrentFont; @@ -177,12 +237,19 @@ class SVGTextWriter void setTextProperties( const GDIMetaFile& rMtf, sal_uLong nCurAction ); void addFontAttributes( sal_Bool bIsTextContainer ); + sal_Bool nextParagraph(); + sal_Bool nextTextPortion(); + void startTextShape(); void endTextShape(); void startTextParagraph(); void endTextParagraph(); void startTextPosition( sal_Bool bExportX = sal_True, sal_Bool bExportY = sal_True); void endTextPosition(); + void implExportHyperlinkIds(); + void implWriteBulletChars(); + void writeBitmapPlaceholder( const MetaBmpExScaleAction* pAction ); + void implWriteEmbeddedBitmaps(); void writeTextPortion( const Point& rPos, const String& rText, sal_Bool bApplyMapping = sal_True ); void implWriteTextPortion( const Point& rPos, const String& rText, @@ -201,6 +268,19 @@ class SVGTextWriter mpContext = pContext; } + void setTextShape( const Reference<XText>& rxText, + const GDIMetaFile* pTextEmbeddedBitmapMtf ) + { + mrTextShape.set( rxText ); + mpTextEmbeddedBitmapMtf = pTextEmbeddedBitmapMtf; + } + + const Reference<XText>& getTextShape() const + { + return mrTextShape; + } + + void setPlaceholderShapeFlag( sal_Bool bState ) { mbIsPlacehlolderShape = bState; @@ -213,9 +293,15 @@ class SVGTextWriter void implSetFontFamily(); template< typename SubType > sal_Bool implGetTextPosition( const MetaAction* pAction, Point& raPos, sal_Bool& bEmpty ); + void implRegisterInterface( const Reference< XInterface >& rxIf ); + const ::rtl::OUString & implGetValidIDFromInterface( const Reference< XInterface >& rxIf ); + }; +// ------------------- +// - SVGActionWriter - +// ------------------- class SVGActionWriter { @@ -289,13 +375,18 @@ private: void ImplCheckFontAttributes(); void ImplCheckPaintAttributes(); - void ImplWriteActions( const GDIMetaFile& rMtf, sal_uInt32 nWriteFlags, const ::rtl::OUString* pElementId ); + void ImplWriteActions( const GDIMetaFile& rMtf, + sal_uInt32 nWriteFlags, + const ::rtl::OUString* pElementId, + const Reference< XShape >* pXShape = NULL, + const GDIMetaFile* pTextEmbeddedBitmapMtf = NULL ); Font ImplSetCorrectFontHeight() const; public: static ::rtl::OUString GetPathString( const PolyPolygon& rPolyPoly, sal_Bool bLine ); + static sal_uLong GetChecksum( const MetaBmpExScaleAction* pAct ); public: @@ -306,7 +397,9 @@ public: const Size& rSize100thmm, const GDIMetaFile& rMtf, sal_uInt32 nWriteFlags, - const ::rtl::OUString* pElementId = NULL ); + const ::rtl::OUString* pElementId = NULL, + const Reference< XShape >* pXShape = NULL, + const GDIMetaFile* pTextEmbeddedBitmapMtf = NULL ); sal_Bool bIsTextShape; }; |