From 7d8fd9baecc240f0543efea679cb9727957e3231 Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Fri, 3 Aug 2007 09:43:05 +0000 Subject: #i39532# restructured MetaFile comment reation to use TextHierarchy primitives --- .../primitive2d/drawinglayer_primitivetypes2d.hxx | 9 +- .../primitive2d/textdecoratedprimitive2d.hxx | 10 +- .../primitive2d/texthierarchyprimitive2d.hxx | 156 ++++++++++++++++++++ drawinglayer/prj/d.lst | 2 +- drawinglayer/source/primitive2d/makefile.mk | 6 +- .../primitive2d/textdecoratedprimitive2d.cxx | 14 +- .../primitive2d/texthierarchyprimitive2d.cxx | 134 +++++++++++++++++ .../source/processor2d/vclmetafileprocessor2d.cxx | 160 ++++++++++++--------- 8 files changed, 402 insertions(+), 89 deletions(-) create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx create mode 100644 drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx (limited to 'drawinglayer') diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index dc74ec7ebc80..181d641f4b59 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: drawinglayer_primitivetypes2d.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2007-08-02 11:43:43 $ + * last change: $Author: aw $ $Date: 2007-08-03 10:43:04 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -84,7 +84,10 @@ #define PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 35) #define PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 36) #define PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 37) -#define PRIMITIVE2D_ID_TEXTFIELDPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 38) +#define PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 38) +#define PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 39) +#define PRIMITIVE2D_ID_TEXTHIERARCHYPARAGRAPHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 40) +#define PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 41) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx index 941c1d62df26..f5fe74965cee 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: textdecoratedprimitive2d.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: aw $ $Date: 2007-08-02 11:43:43 $ + * last change: $Author: aw $ $Date: 2007-08-03 10:43:04 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -133,8 +133,6 @@ namespace drawinglayer unsigned mbEmphasisMarkAbove : 1; unsigned mbEmphasisMarkBelow : 1; unsigned mbShadow : 1; - unsigned mbEndOfLine: 1; - unsigned mbEndOfParagraph : 1; protected: // local decomposition. @@ -162,8 +160,6 @@ namespace drawinglayer bool bEmphasisMarkBelow = false, FontRelief eFontRelief = FONT_RELIEF_NONE, bool bShadow = false, - bool bEndOfLine = false, - bool bEndOfParagraph = false, const WrongSpellVector& rWrongSpellVector = WrongSpellVector()); // get data @@ -179,8 +175,6 @@ namespace drawinglayer bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; } bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; } bool getShadow() const { return mbShadow; } - bool getEndOfLine() const { return mbEndOfLine; } - bool getEndOfParagraph() const { return mbEndOfParagraph; } // compare operator virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx new file mode 100644 index 000000000000..39bd7f1a1615 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx @@ -0,0 +1,156 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: texthierarchyprimitive2d.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-08-03 10:43:04 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTHIERARCHYPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTHIERARCHYPRIMITIVE2D_HXX + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX +#include +#endif + +#ifndef _STRING_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + // text format hierarchy helper class. It decomposes to it's + // content, so all direct renderers may ignore it. If You need + // to know more about line hierarchies You may react on it and + // also need to take care that the source of data uses it. + class TextHierarchyLinePrimitive2D : public GroupPrimitive2D + { + private: + public: + TextHierarchyLinePrimitive2D(const Primitive2DSequence& rChildren); + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + // see TextHierarchyLinePrimitive2D comment + class TextHierarchyParagraphPrimitive2D : public GroupPrimitive2D + { + private: + public: + TextHierarchyParagraphPrimitive2D(const Primitive2DSequence& rChildren); + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + // see TextHierarchyLinePrimitive2D comment + class TextHierarchyBlockPrimitive2D : public GroupPrimitive2D + { + private: + public: + TextHierarchyBlockPrimitive2D(const Primitive2DSequence& rChildren); + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + // type enum + enum FieldType + { + FIELD_TYPE_COMMON, // unspecified. If more info is needed for a FieldType, + // create a new type and it's handling + FIELD_TYPE_PAGE, // uses "FIELD_SEQ_BEGIN;PageField" -> special handling + FIELD_TYPE_URL // uses URL as string -> special handling + }; + + // see TextHierarchyLinePrimitive2D comment. + // Also: This type uses a type enum to transport the encapsulated field + // type. Also added is a String which is type-dependent. E.g. for URL + // fields, it contains the URL. + class TextHierarchyFieldPrimitive2D : public GroupPrimitive2D + { + private: + FieldType meType; + String maString; + + public: + TextHierarchyFieldPrimitive2D( + const Primitive2DSequence& rChildren, + const FieldType& rFieldType, + const String& rString); + + // get data + FieldType getType() const { return meType; } + const String& getString() const { return maString; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTHIERARCHYPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst index 3805b28b7e5b..57f4ba6487bd 100644 --- a/drawinglayer/prj/d.lst +++ b/drawinglayer/prj/d.lst @@ -36,7 +36,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\textlayoutdevice.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textlayoutdevice.hxx ..\inc\drawinglayer\primitive2d\textprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textprimitive2d.hxx ..\inc\drawinglayer\primitive2d\textdecoratedprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textdecoratedprimitive2d.hxx -..\inc\drawinglayer\primitive2d\textfieldprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textfieldprimitive2d.hxx +..\inc\drawinglayer\primitive2d\texthierarchyprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\texthierarchyprimitive2d.hxx ..\inc\drawinglayer\primitive2d\transformprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\transformprimitive2d.hxx ..\inc\drawinglayer\primitive2d\unifiedalphaprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\unifiedalphaprimitive2d.hxx diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk index 3d3173bcef98..75d589019299 100644 --- a/drawinglayer/source/primitive2d/makefile.mk +++ b/drawinglayer/source/primitive2d/makefile.mk @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.6 $ # -# last change: $Author: aw $ $Date: 2007-08-02 11:43:44 $ +# last change: $Author: aw $ $Date: 2007-08-03 10:43:04 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -73,7 +73,7 @@ SLOFILES= \ $(SLO)$/textlayoutdevice.obj \ $(SLO)$/textprimitive2d.obj \ $(SLO)$/textdecoratedprimitive2d.obj \ - $(SLO)$/textfieldprimitive2d.obj \ + $(SLO)$/texthierarchyprimitive2d.obj \ $(SLO)$/transformprimitive2d.obj \ $(SLO)$/unifiedalphaprimitive2d.obj diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index 3a21465c9e4f..d97951011b52 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: textdecoratedprimitive2d.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: aw $ $Date: 2007-08-02 11:43:44 $ + * last change: $Author: aw $ $Date: 2007-08-03 10:43:04 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -377,8 +377,6 @@ namespace drawinglayer bool bEmphasisMarkBelow, FontRelief eFontRelief, bool bShadow, - bool bEndOfLine, - bool bEndOfParagraph, const WrongSpellVector& rWrongSpellVector) : TextSimplePortionPrimitive2D(rNewTransform, rText, rDXArray, rFontAttributes, rLocale, rFontColor), maTextlineColor(rTextlineColor), @@ -391,9 +389,7 @@ namespace drawinglayer mbWordLineMode(bWordLineMode), mbEmphasisMarkAbove(bEmphasisMarkAbove), mbEmphasisMarkBelow(bEmphasisMarkBelow), - mbShadow(bShadow), - mbEndOfLine(bEndOfLine), - mbEndOfParagraph(bEndOfParagraph) + mbShadow(bShadow) { } @@ -413,9 +409,7 @@ namespace drawinglayer && getWordLineMode() == rCompare.getWordLineMode() && getEmphasisMarkAbove() == rCompare.getEmphasisMarkAbove() && getEmphasisMarkBelow() == rCompare.getEmphasisMarkBelow() - && getShadow() == rCompare.getShadow() - && getEndOfLine() == rCompare.getEndOfLine() - && getEndOfParagraph() == rCompare.getEndOfParagraph()); + && getShadow() == rCompare.getShadow()); } return false; diff --git a/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx new file mode 100644 index 000000000000..76aff361226f --- /dev/null +++ b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: texthierarchyprimitive2d.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-08-03 10:43:05 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTHIERARCHYPRIMITIVE2D_HXX +#include +#endif + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#include +#endif + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + TextHierarchyLinePrimitive2D::TextHierarchyLinePrimitive2D(const Primitive2DSequence& rChildren) + : GroupPrimitive2D(rChildren) + { + } + + // provide unique ID + ImplPrimitrive2DIDBlock(TextHierarchyLinePrimitive2D, PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + TextHierarchyParagraphPrimitive2D::TextHierarchyParagraphPrimitive2D(const Primitive2DSequence& rChildren) + : GroupPrimitive2D(rChildren) + { + } + + // provide unique ID + ImplPrimitrive2DIDBlock(TextHierarchyParagraphPrimitive2D, PRIMITIVE2D_ID_TEXTHIERARCHYPARAGRAPHPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + TextHierarchyBlockPrimitive2D::TextHierarchyBlockPrimitive2D(const Primitive2DSequence& rChildren) + : GroupPrimitive2D(rChildren) + { + } + + // provide unique ID + ImplPrimitrive2DIDBlock(TextHierarchyBlockPrimitive2D, PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + TextHierarchyFieldPrimitive2D::TextHierarchyFieldPrimitive2D( + const Primitive2DSequence& rChildren, + const FieldType& rFieldType, + const String& rString) + : GroupPrimitive2D(rChildren), + meType(rFieldType), + maString(rString) + { + } + + bool TextHierarchyFieldPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(GroupPrimitive2D::operator==(rPrimitive)) + { + const TextHierarchyFieldPrimitive2D& rCompare = (TextHierarchyFieldPrimitive2D&)rPrimitive; + + return (getType() == rCompare.getType() + && getString() == rCompare.getString()); + } + + return false; + } + + // provide unique ID + ImplPrimitrive2DIDBlock(TextHierarchyFieldPrimitive2D, PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D) + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index fc019dfa4a13..a7508d046bab 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: vclmetafileprocessor2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2007-08-02 11:43:45 $ + * last change: $Author: aw $ $Date: 2007-08-03 10:43:05 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -137,8 +137,8 @@ #include #endif -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTFIELDPRIMITIVE2D_HXX -#include +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTHIERARCHYPRIMITIVE2D_HXX +#include #endif #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE_TEXTDECORATEDPRIMITIVE2D_HXX @@ -474,38 +474,18 @@ namespace drawinglayer This can be done hierarchical, too. Okay, base implementation done based on those three primitives. - - - - - - To be done: - - - - - - - - FIELD_SEQ_BEGIN, FIELD_SEQ_END + Used from slideshow for URLs, created from diverse SvxField implementations inside createBeginComment()/createEndComment(). createBeginComment() is used from editeng\impedit3.cxx inside ImpEditEngine::Paint. - Created TextFieldPrimitive2D and added needed infos there; it is an group primitive and wraps - text primitives (but is not limited to that). It contains the Prolog string (normally FIELD_SEQ_BEGIN, - but there are others), the Epilog string and the URL if it was an URL field. + Created TextHierarchyFieldPrimitive2D and added needed infos there; it is an group primitive and wraps + text primitives (but is not limited to that). It contains the field type if special actions for the + support of FIELD_SEQ_BEGIN/END are needed; this is the case for Page and URL fields. If more is + needed, it may be supported there. FIELD_SEQ_BEGIN;PageField FIELD_SEQ_END - - - - - - - EPSReplacementGraphic - - + Okay, these are now completely supported by TextHierarchyFieldPrimitive2D. URL works, too. XTEXT @@ -515,19 +495,39 @@ namespace drawinglayer this three are with index and are created with the help of a i18n::XBreakIterator in ImplDrawWithComments. Simplifying, moving out text painting, reworking to create some data structure for holding those TEXT infos. + Supported directly by TextSimplePortionPrimitive2D with adding a Locale to the basic text + primitive. In the MetaFileRenderer, the creation is now done (see below). This has the advantage + that this creations do not need to be done for all paints all the time. This would be + expensive since the BreakIterator and it's usage is expensive and for each paint also the + whole character stops would need to be created. + Created only for TextDecoratedPortionPrimitive2D due to XTEXT_EOL and XTEXT_EOP (see below) XTEXT_EOL() end of line XTEXT_EOP() end of paragraph - this two are boolean marks, created by the loop in ImpEditEngine::Paint + First try with boolean marks at TextDecoratedPortionPrimitive2D did not work too well, + i decided to solve it with structure. I added the TextHierarchyPrimitives for this, + namely: + - TextHierarchyLinePrimitive2D: Encapsulates single line + - TextHierarchyParagraphPrimitive2D: Encapsulates single paragraph + - TextHierarchyBlockPrimitive2D: encapsulates object texts (only one ATM) + Those are now supported in hierarchy. This means the MetaFile renderer will support them + by using them, reculrively using their content and adding MetaFile comments as needed. + This also means that when another text layouter will be used it will be necessary to + create/support the same HierarchyPrimitives to support users. + To transport the information using this hierarchy is best suited to all future needs; + the slideshow will be able to profit from it directly when using primitives; all other + renderers not interested in the text structure will just ignore the encapsulations. + XTEXT_PAINTSHAPE_BEGIN, XTEXT_PAINTSHAPE_END + Supported now by the TextHierarchyBlockPrimitive2D. + To be done: + EPSReplacementGraphic - XTEXT_PAINTSHAPE_BEGIN - XTEXT_PAINTSHAPE_END XTEXT_SCROLLRECT XTEXT_PAINTRECT @@ -548,36 +548,75 @@ namespace drawinglayer { switch(rCandidate.getPrimitiveID()) { - case PRIMITIVE2D_ID_TEXTFIELDPRIMITIVE2D : + case PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D : { // support for FIELD_SEQ_BEGIN, FIELD_SEQ_END and URL. It wraps text primitives (but is not limited to) - // thus do the extra stuff but handle recursively. - const primitive2d::TextFieldPrimitive2D& rTextFieldPrimitive = static_cast< const primitive2d::TextFieldPrimitive2D& >(rCandidate); - const bool bUsePrologEpilog(0 != rTextFieldPrimitive.getProlog().Len() || 0 != rTextFieldPrimitive.getEpilog().Len()); - const bool bIsURL(0 != rTextFieldPrimitive.getURL().Len()); + // thus do the MetafileAction embedding stuff but just handle recursively. + const primitive2d::TextHierarchyFieldPrimitive2D& rFieldPrimitive = static_cast< const primitive2d::TextHierarchyFieldPrimitive2D& >(rCandidate); + static const ByteString aCommentStringCommon("FIELD_SEQ_BEGIN"); + static const ByteString aCommentStringPage("FIELD_SEQ_BEGIN;PageField"); + static const ByteString aCommentStringEnd("FIELD_SEQ_END"); - if(bUsePrologEpilog) + switch(rFieldPrimitive.getType()) { - if(bIsURL) + default : // case drawinglayer::primitive2d::FIELD_TYPE_COMMON : { - const String& rURL = rTextFieldPrimitive.getURL(); - mrMetaFile.AddAction(new MetaCommentAction(rTextFieldPrimitive.getProlog(), - 0, reinterpret_cast(rURL.GetBuffer()), - 2 * rURL.Len())); + mrMetaFile.AddAction(new MetaCommentAction(aCommentStringCommon)); + break; } - else + case drawinglayer::primitive2d::FIELD_TYPE_PAGE : { - mrMetaFile.AddAction(new MetaCommentAction(rTextFieldPrimitive.getProlog())); + mrMetaFile.AddAction(new MetaCommentAction(aCommentStringPage)); + break; + } + case drawinglayer::primitive2d::FIELD_TYPE_URL : + { + const String& rURL = rFieldPrimitive.getString(); + mrMetaFile.AddAction(new MetaCommentAction(aCommentStringCommon, 0, reinterpret_cast< const BYTE* >(rURL.GetBuffer()), 2 * rURL.Len())); + break; } } // process recursively - process(rTextFieldPrimitive.get2DDecomposition(getViewInformation2D())); + process(rFieldPrimitive.get2DDecomposition(getViewInformation2D())); - if(bUsePrologEpilog) - { - mrMetaFile.AddAction(new MetaCommentAction(rTextFieldPrimitive.getEpilog())); - } + // for the end comment the type is not relevant yet, they are all the same. Just add. + mrMetaFile.AddAction(new MetaCommentAction(aCommentStringEnd)); + + break; + } + case PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D : + { + const primitive2d::TextHierarchyLinePrimitive2D& rLinePrimitive = static_cast< const primitive2d::TextHierarchyLinePrimitive2D& >(rCandidate); + static const ByteString aCommentString("XTEXT_EOL"); + + // process recursively and add MetaFile comment + process(rLinePrimitive.get2DDecomposition(getViewInformation2D())); + mrMetaFile.AddAction(new MetaCommentAction(aCommentString)); + + break; + } + case PRIMITIVE2D_ID_TEXTHIERARCHYPARAGRAPHPRIMITIVE2D : + { + const primitive2d::TextHierarchyParagraphPrimitive2D& rParagraphPrimitive = static_cast< const primitive2d::TextHierarchyParagraphPrimitive2D& >(rCandidate); + static const ByteString aCommentString("XTEXT_EOP"); + + // process recursively and add MetaFile comment + process(rParagraphPrimitive.get2DDecomposition(getViewInformation2D())); + mrMetaFile.AddAction(new MetaCommentAction(aCommentString)); + + break; + } + case PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D : + { + const primitive2d::TextHierarchyBlockPrimitive2D& rBlockPrimitive = static_cast< const primitive2d::TextHierarchyBlockPrimitive2D& >(rCandidate); + static const ByteString aCommentStringA("XTEXT_PAINTSHAPE_BEGIN"); + static const ByteString aCommentStringB("XTEXT_PAINTSHAPE_END"); + + // add MetaFile comment, process recursively and add MetaFile comment + mrMetaFile.AddAction(new MetaCommentAction(aCommentStringA)); + process(rBlockPrimitive.get2DDecomposition(getViewInformation2D())); + mrMetaFile.AddAction(new MetaCommentAction(aCommentStringB)); break; } @@ -613,38 +652,31 @@ namespace drawinglayer sal_Int32 nNextCellBreak(mxBreakIterator->nextCharacters(rTxt, 0, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 0, nDone)); ::com::sun::star::i18n::Boundary nNextWordBoundary(mxBreakIterator->getWordBoundary(rTxt, 0, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True)); sal_Int32 nNextSentenceBreak(mxBreakIterator->endOfSentence(rTxt, 0, rLocale)); + static const ByteString aCommentStringA("XTEXT_EOC"); + static const ByteString aCommentStringB("XTEXT_EOW"); + static const ByteString aCommentStringC("XTEXT_EOS"); for(sal_Int32 i(0); i < nLen; i++) { // create the entries for the respective break positions if(i == nNextCellBreak) { - mrMetaFile.AddAction(new MetaCommentAction("XTEXT_EOC", i)); + mrMetaFile.AddAction(new MetaCommentAction(aCommentStringA, i)); nNextCellBreak = mxBreakIterator->nextCharacters(rTxt, i, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); } if(i == nNextWordBoundary.endPos) { - mrMetaFile.AddAction(new MetaCommentAction("XTEXT_EOW", i)); + mrMetaFile.AddAction(new MetaCommentAction(aCommentStringB, i)); nNextWordBoundary = mxBreakIterator->getWordBoundary(rTxt, i + 1, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True); } if(i == nNextSentenceBreak) { - mrMetaFile.AddAction(new MetaCommentAction("XTEXT_EOS", i)); + mrMetaFile.AddAction(new MetaCommentAction(aCommentStringC, i)); nNextSentenceBreak = mxBreakIterator->endOfSentence(rTxt, i + 1, rLocale); } } } } - - if(pTextDecoratedCandidate->getEndOfLine()) - { - mrMetaFile.AddAction( new MetaCommentAction( "XTEXT_EOL" ) ); - } - - if(pTextDecoratedCandidate->getEndOfParagraph()) - { - mrMetaFile.AddAction( new MetaCommentAction( "XTEXT_EOP" ) ); - } } break; -- cgit