From 6dd5fa4a48346ea9b7ff330204feb4f9817dca80 Mon Sep 17 00:00:00 2001 From: RĂ¼diger Timm Date: Fri, 20 Feb 2009 16:53:09 +0000 Subject: CWS-TOOLING: integrate CWS aw063_OOO310 2009-02-12 13:10:24 +0100 aw r267649 : #i99123# when a primitive is invisible, it is not sufficient to produce no output when decomposing, but to add invisible data using HitTestPrimitive2D. This is needed for the slideshow which relies on geometry data in MetaFiles when painting invisible objects 2009-02-12 13:08:39 +0100 aw r267648 : #i99123# do not ignore HitTestPrimitive2D, but draw empty rectangles instead. This is needed since Slideshow is based on getting MetaFile content when painting invisible objects 2009-02-11 16:04:28 +0100 aw r267620 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:04:10 +0100 aw r267619 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:03:56 +0100 aw r267618 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:03:39 +0100 aw r267617 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:03:21 +0100 aw r267615 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:02:48 +0100 aw r267614 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:02:24 +0100 aw r267613 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:02:01 +0100 aw r267612 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:01:32 +0100 aw r267611 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:01:05 +0100 aw r267610 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:00:15 +0100 aw r267608 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 11:27:33 +0100 aw r267585 : #i98788# added missing include for STL 2009-02-10 17:46:50 +0100 aw r267570 : #i98788# added reaction on pool destruction 2009-02-10 17:11:58 +0100 aw r267562 : #i98788# added messaging mechanism to register for pool destruction 2009-02-10 13:35:35 +0100 aw r267549 : #i98788# removing changes, too complicated and risky for 3.1 2009-02-10 12:13:48 +0100 aw r267546 : #i98788# 4th round 2009-02-10 12:13:37 +0100 aw r267545 : #i98788# 4th round 2009-02-10 12:13:26 +0100 aw r267544 : #i98788# 4th round 2009-02-10 12:13:14 +0100 aw r267543 : #i98788# 4th round 2009-02-10 12:13:03 +0100 aw r267542 : #i98788# 4th round 2009-02-10 12:12:50 +0100 aw r267541 : #i98788# 4th round 2009-02-10 12:12:37 +0100 aw r267540 : #i98788# 4th round 2009-02-08 14:38:22 +0100 aw r267495 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:38:06 +0100 aw r267494 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:37:48 +0100 aw r267493 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:37:17 +0100 aw r267492 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:56 +0100 aw r267491 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:44 +0100 aw r267490 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:29 +0100 aw r267489 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:16 +0100 aw r267488 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:02 +0100 aw r267487 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:35:46 +0100 aw r267486 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-05 12:20:39 +0100 aw r267415 : #i98788# 2nd batch of adaptions for SfxItemPoolHolder addition 2009-02-04 15:12:54 +0100 aw r267385 : #i98788# added newline at EOF 2009-02-04 13:26:04 +0100 aw r267379 : #i98788# make SfxItemPool holdable 2009-02-04 13:25:40 +0100 aw r267378 : #i98788# make SfxItemPool holdable 2009-02-04 13:25:08 +0100 aw r267377 : #i98788# make SfxItemPool holdable 2009-02-04 13:24:42 +0100 aw r267376 : #i98788# make SfxItemPool holdable 2009-02-04 13:23:14 +0100 aw r267375 : #i98788# make SfxItemPool holdable 2009-02-04 13:23:02 +0100 aw r267374 : #i98788# make SfxItemPool holdable 2009-01-29 17:08:31 +0100 aw r267159 : #i97628# completed the fix 2009-01-29 17:08:15 +0100 aw r267158 : #i97628# completed the fix 2009-01-29 14:09:07 +0100 aw r267132 : #i97628# Corrected usage of ParagraphData in headers 2009-01-29 14:06:58 +0100 iha r267131 : #i98344# incorrect font size in charts 2009-01-29 12:13:46 +0100 aw r267115 : #i97628# back to old state; triggers too many errors in other modules 2009-01-29 12:03:51 +0100 aw r267114 : #i97628# enabled exceptions due to STL vector include 2009-01-29 11:21:37 +0100 aw r267107 : #i97628# added needed include 2009-01-28 17:58:29 +0100 aw r267077 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-28 17:58:12 +0100 aw r267076 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-28 17:57:51 +0100 aw r267074 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-28 17:57:21 +0100 aw r267073 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-27 17:07:33 +0100 aw r267011 : #i98402# added support for ViewRange when exporting MetaFiles in ObjectContactOfPageView::DoProcessDisplay to avoid to paint too much 2009-01-27 11:45:48 +0100 aw r266973 : #i98404# Added a warning to a place where a conversion to rectangle should not be copied from 2009-01-26 21:44:36 +0100 iha r266949 : #i98497# 3D charts are rendered with wrong size 2009-01-26 20:47:07 +0100 aw r266947 : #i98404# handle BackgroundColorPrimitive2D directly in PixelRenderers and avoid AA under all circumstances 2009-01-26 14:50:36 +0100 aw r266926 : #i98386# secured cloning of SdrObject in IMapUserData by boost::shared_prt usage 2009-01-26 12:51:30 +0100 aw r266916 : #i96581# added separated FontStretching and fallback for small X!=Y scale differences 2009-01-23 16:14:55 +0100 aw r266834 : #i96475# added missing implementation of TextDecoratedPortionPrimitive2D::getB2DRange 2009-01-23 15:24:34 +0100 aw r266826 : #i98405# fixed fallback to DrawAlphaRect to use the correctly sized rectangle 2009-01-23 13:34:43 +0100 aw r266813 : #i96474# fixed impSplitSingleWords for an unexpected case 2009-01-23 10:47:31 +0100 aw r266786 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:47:20 +0100 aw r266785 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:47:09 +0100 aw r266783 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:46:58 +0100 aw r266782 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:46:48 +0100 aw r266781 : #i98289#,#i96474# tooling and new flags for tasks --- .../primitive2d/drawinglayer_primitivetypes2d.hxx | 25 +- .../primitive2d/textdecoratedprimitive2d.hxx | 3 + .../primitive2d/texthierarchyprimitive2d.hxx | 25 ++ .../drawinglayer/processor2d/vclprocessor2d.hxx | 2 +- .../primitive2d/textdecoratedprimitive2d.cxx | 51 +++- .../primitive2d/texthierarchyprimitive2d.cxx | 17 ++ .../source/processor2d/vclmetafileprocessor2d.cxx | 24 +- .../source/processor2d/vclpixelprocessor2d.cxx | 63 ++++- drawinglayer/source/processor2d/vclprocessor2d.cxx | 53 +++- .../schema/org/openoffice/Office/Common.xcs | 40 +++ svx/inc/svx/outliner.hxx | 20 +- svx/inc/svx/outlobj.hxx | 77 ++--- svx/inc/svx/paragraphdata.hxx | 75 +++++ svx/inc/svx/sdr/attribute/sdrtextattribute.hxx | 16 +- svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx | 9 +- svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx | 16 +- svx/inc/svx/svdpool.hxx | 2 + svx/inc/svx/xpool.hxx | 3 +- svx/prj/d.lst | 1 + .../accessibility/AccessibleEmptyEditSource.cxx | 8 +- .../customshapes/EnhancedCustomShapeEngine.cxx | 2 +- svx/source/dialog/imapwnd.cxx | 32 +-- svx/source/dialog/imapwnd.hxx | 21 +- svx/source/editeng/editdoc.cxx | 2 +- svx/source/editeng/editdoc.hxx | 4 +- svx/source/editeng/editobj.cxx | 57 +++- svx/source/editeng/editobj2.hxx | 4 +- svx/source/form/fmtextcontrolshell.cxx | 10 +- svx/source/outliner/makefile.mk | 1 + svx/source/outliner/outliner.cxx | 35 ++- svx/source/outliner/outlobj.cxx | 310 ++++++++++----------- svx/source/outliner/paralist.cxx | 7 + svx/source/sdr/attribute/sdrtextattribute.cxx | 16 +- svx/source/sdr/contact/objectcontactofpageview.cxx | 18 +- svx/source/sdr/contact/viewcontactofsdrrectobj.cxx | 13 + svx/source/sdr/primitive2d/sdrattributecreator.cxx | 52 ++-- .../sdr/primitive2d/sdrdecompositiontools.cxx | 29 +- .../sdr/primitive2d/sdrmeasureprimitive2d.cxx | 3 +- svx/source/sdr/primitive2d/sdrprimitivetools.cxx | 18 ++ svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx | 43 +-- svx/source/svdraw/svdedtv2.cxx | 4 +- svx/source/svdraw/svdfppt.cxx | 2 +- svx/source/svdraw/svdmodel.cxx | 6 +- svx/source/svdraw/svdoashp.cxx | 2 +- svx/source/svdraw/svdobj.cxx | 4 +- svx/source/svdraw/svdotext.cxx | 4 +- svx/source/svdraw/svdotextdecomposition.cxx | 12 +- svx/source/svdraw/svdtext.cxx | 2 + svx/source/svdraw/svdtxhdl.cxx | 1 + svx/source/svdraw/svdundo.cxx | 18 +- svx/source/table/cell.cxx | 7 +- svx/source/table/tableundo.cxx | 4 +- svx/source/unodraw/unopool.cxx | 2 +- svx/source/unoedit/unotext.cxx | 7 +- svx/source/xoutdev/xtable.cxx | 4 +- 55 files changed, 884 insertions(+), 402 deletions(-) create mode 100644 svx/inc/svx/paragraphdata.hxx diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index a54fe3bb7b..44223c3ac3 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -89,18 +89,19 @@ #define PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 38) #define PRIMITIVE2D_ID_TEXTHIERARCHYPARAGRAPHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 39) #define PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 40) -#define PRIMITIVE2D_ID_POLYGONWAVEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 41) -#define PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 42) -#define PRIMITIVE2D_ID_TEXTEFFECTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 43) -#define PRIMITIVE2D_ID_TEXTHIERARCHYBULLETPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 44) -#define PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 45) -#define PRIMITIVE2D_ID_EXECUTEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 46) -#define PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 47) -#define PRIMITIVE2D_ID_CHARTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 48) -#define PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 49) -#define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50) -#define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51) -#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51) +#define PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 41) +#define PRIMITIVE2D_ID_POLYGONWAVEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 42) +#define PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 43) +#define PRIMITIVE2D_ID_TEXTEFFECTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 44) +#define PRIMITIVE2D_ID_TEXTHIERARCHYBULLETPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 45) +#define PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 46) +#define PRIMITIVE2D_ID_EXECUTEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 47) +#define PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 48) +#define PRIMITIVE2D_ID_CHARTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 49) +#define PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50) +#define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51) +#define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52) +#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx index c4c0fa09b3..6585e62178 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx @@ -198,6 +198,9 @@ namespace drawinglayer // compare operator virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + // get range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + // provide unique ID DeclPrimitrive2DIDBlock() }; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx index b554107196..685d3af57e 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx @@ -164,6 +164,31 @@ namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// +namespace drawinglayer +{ + namespace primitive2d + { + // #i97628# + // Primitive to encapsulate text from an active text edit; some + // renderers need to suppress this output due to painting the + // edited text in e.g. an OutlinerEditView. It's derived from + // GroupPrimitive2D, so the implicit decomposition will use the + // content. To suppress, this primitive needs to be parsed by + // the renderer without taking any action + class TextHierarchyEditPrimitive2D : public GroupPrimitive2D + { + private: + public: + TextHierarchyEditPrimitive2D(const Primitive2DSequence& rChildren); + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTHIERARCHYPRIMITIVE2D_HXX ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx index 1ad23644d9..fcf8766dbf 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx @@ -96,7 +96,7 @@ namespace drawinglayer // common VCL rendering support void RenderTextSimpleOrDecoratedPortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate); - void RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate); + void RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate, bool bPixelBased); void RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate); void RenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate); void RenderPolyPolygonGradientPrimitive2D(const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate); diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index a253c81b17..b397314aee 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -186,7 +186,7 @@ namespace drawinglayer if(bWaveLine) { eLineJoin = basegfx::B2DLINEJOIN_ROUND; - fLineHeight *= 0.5; + fLineHeight *= 0.25; } // prepare Line and Stroke Attributes @@ -215,7 +215,7 @@ namespace drawinglayer if(bWaveLine) { - double fWaveWidth(4.0 * fLineHeight); + double fWaveWidth(10.6 * fLineHeight); if(FONT_UNDERLINE_SMALLWAVE == eLineStyle) { @@ -227,7 +227,7 @@ namespace drawinglayer fWaveWidth *= 2.0; } - aNewPrimitive = Primitive2DReference(new PolygonWavePrimitive2D(aLine, aLineAttribute, aStrokeAttribute, fWaveWidth, 0.5 * fWaveWidth)); + aNewPrimitive = Primitive2DReference(new PolygonWavePrimitive2D(aLine, aLineAttribute, aStrokeAttribute, fWaveWidth, fWaveWidth * 0.5)); } else { @@ -241,7 +241,13 @@ namespace drawinglayer { // double line, create 2nd primitive with offset using TransformPrimitive based on // already created NewPrimitive - const double fLineDist((bWaveLine ? 3.0 : 2.0) * fLineHeight); + double fLineDist(2.3 * fLineHeight); + + if(bWaveLine) + { + fLineDist = 6.3 * fLineHeight; + } + basegfx::B2DHomMatrix aTransform; // move base point of text to 0.0 and de-rotate @@ -482,6 +488,16 @@ namespace drawinglayer // init word iterator, get first word and truncate to possibilities ::com::sun::star::i18n::Boundary aNextWordBoundary(xLocalBreakIterator->getWordBoundary( getText(), getTextPosition(), getLocale(), ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True)); + + if(aNextWordBoundary.endPos == getTextPosition() && getTextLength() > 0) + { + // #i96474# + // a word before was found (this can happen when search starts on a whitespace and a word + // in front of it exists), force to look one position further + aNextWordBoundary = xLocalBreakIterator->getWordBoundary( + getText(), getTextPosition() + 1, getLocale(), ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True); + } + impCorrectTextBoundary(aNextWordBoundary); // prepare new font attributes WITHOUT outline @@ -791,6 +807,33 @@ namespace drawinglayer return false; } + // #i96475# + // Added missing implementation. Decorations may (will) stick out of the text's + // inking area, so add them if needed + basegfx::B2DRange TextDecoratedPortionPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + const bool bDecoratedIsNeeded( + FONT_UNDERLINE_NONE != getFontOverline() + || FONT_UNDERLINE_NONE != getFontUnderline() + || FONT_STRIKEOUT_NONE != getFontStrikeout() + || FONT_EMPHASISMARK_NONE != getFontEmphasisMark() + || FONT_RELIEF_NONE != getFontRelief() + || getShadow()); + + if(bDecoratedIsNeeded) + { + // decoration is used, fallback to BasePrimitive2D::getB2DRange which uses + // the own local decomposition for computation and thus creates all necessary + // geometric objects + return BasePrimitive2D::getB2DRange(rViewInformation); + } + else + { + // no relevant decoration used, fallback to TextSimplePortionPrimitive2D::getB2DRange + return TextSimplePortionPrimitive2D::getB2DRange(rViewInformation); + } + } + // provide unique ID ImplPrimitrive2DIDBlock(TextDecoratedPortionPrimitive2D, PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D) diff --git a/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx index e782bfd252..ff5caffb91 100644 --- a/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx @@ -145,5 +145,22 @@ namespace drawinglayer } // end of namespace primitive2d } // end of namespace drawinglayer +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + TextHierarchyEditPrimitive2D::TextHierarchyEditPrimitive2D(const Primitive2DSequence& rChildren) + : GroupPrimitive2D(rChildren) + { + } + + // provide unique ID + ImplPrimitrive2DIDBlock(TextHierarchyEditPrimitive2D, PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + ////////////////////////////////////////////////////////////////////////////// // eof diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 723155a18b..d3e7ea172c 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -73,6 +73,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // for PDFExtOutDevData Graphic support @@ -983,7 +984,7 @@ namespace drawinglayer SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rHairlinePrimitive.getB2DPolygon(), &aLineColor, 0, 0, 0, 0); impStartSvtGraphicStroke(pSvtGraphicStroke); - RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate)); + RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate), false); impEndSvtGraphicStroke(pSvtGraphicStroke); break; } @@ -1652,6 +1653,27 @@ namespace drawinglayer break; } + case PRIMITIVE2D_ID_HITTESTPRIMITIVE2D : + { + // #i99123# + // invisible primitive; to rebuilt the old MetaFile creation, it is necessary to + // not ignore them (as it was thought), but to add a MetaFile entry for them. + basegfx::B2DRange aInvisibleRange(rCandidate.getB2DRange(getViewInformation2D())); + + if(!aInvisibleRange.isEmpty()) + { + aInvisibleRange.transform(maCurrentTransformation); + const Rectangle aRectLogic( + (sal_Int32)floor(aInvisibleRange.getMinX()), (sal_Int32)floor(aInvisibleRange.getMinY()), + (sal_Int32)ceil(aInvisibleRange.getMaxX()), (sal_Int32)ceil(aInvisibleRange.getMaxY())); + + mpOutputDevice->SetFillColor(); + mpOutputDevice->SetLineColor(); + mpOutputDevice->DrawRect(aRectLogic); + } + + break; + } default : { // process recursively diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index f4474f235d..5754e5a29c 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -65,6 +65,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -139,13 +140,13 @@ namespace drawinglayer case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D : { // directdraw of text simple portion; added test possibility to check text decompose - static bool bHandleSimpleTextDirectly(true); + static bool bForceSimpleTextDecomposition(false); // Adapt evtl. used special DrawMode const sal_uInt32 nOriginalDrawMode(mpOutputDevice->GetDrawMode()); adaptTextToFillDrawMode(); - if(bHandleSimpleTextDirectly) + if(!bForceSimpleTextDecomposition && getOptionsDrawinglayer().IsRenderSimpleTextDirect()) { RenderTextSimpleOrDecoratedPortionPrimitive2D(static_cast< const primitive2d::TextSimplePortionPrimitive2D& >(rCandidate)); } @@ -162,13 +163,13 @@ namespace drawinglayer case PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D : { // directdraw of text simple portion; added test possibility to check text decompose - static bool bHandleComplexTextDirectly(false); + static bool bForceComplexTextDecomposition(false); // Adapt evtl. used special DrawMode const sal_uInt32 nOriginalDrawMode(mpOutputDevice->GetDrawMode()); adaptTextToFillDrawMode(); - if(bHandleComplexTextDirectly) + if(!bForceComplexTextDecomposition && getOptionsDrawinglayer().IsRenderDecoratedTextDirect()) { RenderTextSimpleOrDecoratedPortionPrimitive2D(static_cast< const primitive2d::TextSimplePortionPrimitive2D& >(rCandidate)); } @@ -185,7 +186,7 @@ namespace drawinglayer case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D : { // direct draw of hairline - RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate)); + RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate), true); break; } case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D : @@ -224,8 +225,23 @@ namespace drawinglayer } case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D : { + // #i98289# + const bool bForceLineSnap(getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()); + const sal_uInt16 nOldAntiAliase(mpOutputDevice->GetAntialiasing()); + + if(bForceLineSnap) + { + mpOutputDevice->SetAntialiasing(nOldAntiAliase | ANTIALIASING_PIXELSNAPHAIRLINE); + } + // direct draw of MetaFile RenderMetafilePrimitive2D(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate)); + + if(bForceLineSnap) + { + mpOutputDevice->SetAntialiasing(nOldAntiAliase); + } + break; } case PRIMITIVE2D_ID_MASKPRIMITIVE2D : @@ -479,6 +495,43 @@ namespace drawinglayer } break; } + case PRIMITIVE2D_ID_BACKGROUNDCOLORPRIMITIVE2D : + { + // #i98404# Handle directly, especially when AA is active + const primitive2d::BackgroundColorPrimitive2D& rPrimitive = static_cast< const primitive2d::BackgroundColorPrimitive2D& >(rCandidate); + const sal_uInt16 nOriginalAA(mpOutputDevice->GetAntialiasing()); + + // switch AA off in all cases + mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() & ~ANTIALIASING_ENABLE_B2DDRAW); + + // create color for fill + const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(rPrimitive.getBColor())); + mpOutputDevice->SetFillColor(Color(aPolygonColor)); + mpOutputDevice->SetLineColor(); + + // create rectangle for fill + const basegfx::B2DRange& aViewport(getViewInformation2D().getDiscreteViewport()); + const Rectangle aRectangle( + (sal_Int32)floor(aViewport.getMinX()), (sal_Int32)floor(aViewport.getMinY()), + (sal_Int32)ceil(aViewport.getMaxX()), (sal_Int32)ceil(aViewport.getMaxY())); + mpOutputDevice->DrawRect(aRectangle); + + // restore AA setting + mpOutputDevice->SetAntialiasing(nOriginalAA); + + break; + } + case PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D : + { + // #i97628# + // This primitive means that the content is derived from an active text edit, + // not from model data itself. Some renderers need to suppress this content, e.g. + // the pixel renderer used for displaying the edit view (like this one). It's + // not to be suppressed by the MetaFile renderers, so that the edited text is + // part of the MetaFile, e.g. needed for presentation previews. + // Action: Ignore here, do nothing. + break; + } default : { // process recursively diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 3d45998672..31e4919103 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -66,6 +66,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // control support @@ -158,9 +159,42 @@ namespace drawinglayer if(basegfx::fTools::more(aScale.getX(), 0.0) && basegfx::fTools::more(aScale.getY(), 0.0)) { - // prepare everything that is not sheared and mirrored + // #i96581# Get the font forced without FontStretching (use FontHeight as FontWidth) Font aFont(primitive2d::getVclFontFromFontAttributes( - rTextCandidate.getFontAttributes(), aScale.getX(), aScale.getY(), fRotate, *mpOutputDevice)); + rTextCandidate.getFontAttributes(), + aScale.getY(), + aScale.getY(), + fRotate, + *mpOutputDevice)); + + if(!basegfx::fTools::equal(aScale.getX(), aScale.getY())) + { + // #i96581# font stretching is needed; examine how big the difference between X and Y scaling is + const double fPercent(fabs(1.0 - (aScale.getX() / aScale.getY()))); + static double fMaximumAcceptedPercent(0.05); + static bool bForceAdaption(false); + + if(bForceAdaption || fPercent > fMaximumAcceptedPercent) + { + // #i96581# Need to adapt to a FontStretching bigger than acceptable maximum. + // Get font's real width using FontMetric and adapt font to stretched + // font + const FontMetric aFontMetric(mpOutputDevice->GetFontMetric(aFont)); + const double fRealFontWidth(aFontMetric.GetWidth()); + + aFont = primitive2d::getVclFontFromFontAttributes( + rTextCandidate.getFontAttributes(), + fRealFontWidth, + aScale.getY(), + fRotate, + *mpOutputDevice); + } + else + { + // #i96581# less than allowed maximum (probably SC's generated MapModes). React + // pragmatically by ignoring the stretching up to this point + } + } // handle additional font attributes const primitive2d::TextDecoratedPortionPrimitive2D* pTCPP = @@ -317,7 +351,7 @@ namespace drawinglayer } // direct draw of hairline - void VclProcessor2D::RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate) + void VclProcessor2D::RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate, bool bPixelBased) { const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rPolygonCandidate.getBColor())); mpOutputDevice->SetLineColor(Color(aHairlineColor)); @@ -325,6 +359,17 @@ namespace drawinglayer basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon()); aLocalPolygon.transform(maCurrentTransformation); + + if(bPixelBased && getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()) + { + // #i98289# + // when a Hairline is painted and AntiAliasing is on the option SnapHorVerLinesToDiscrete + // allows to suppress AntiAliasing for pure horizontal or vertical lines. This is done since + // not-AntiAliased such lines look more pleasing to the eye (e.g. 2D chart content). This + // NEEDS to be done in discrete coordinates, so only useful for pixel based rendering. + aLocalPolygon = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aLocalPolygon); + } + mpOutputDevice->DrawPolyLine(aLocalPolygon, 0.0); } @@ -623,6 +668,8 @@ namespace drawinglayer // units e.g. when creating a new MetaFile, but since much huger value ranges are used // there typically will be okay for this compromize. Rectangle aDestRectView( + // !!CAUTION!! Here, ceil and floor are exchanged BY PURPOSE, do NOT copy when + // looking for a standard conversion to rectangle (!) (sal_Int32)ceil(aOutlineRange.getMinX()), (sal_Int32)ceil(aOutlineRange.getMinY()), (sal_Int32)floor(aOutlineRange.getMaxX()), (sal_Int32)floor(aOutlineRange.getMaxY())); diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index de0159bb9f..5379ddaea0 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -1106,6 +1106,46 @@ Dymamic border coloring means that when the mouse is hovered over a control, and true + + + AW + + This switch allows to enhance visualisation of graphics which use Horizontal or Vertical Hairlines + combined with AntiAliased mode (e.g. in 2D charts). When not used, those lines will be AntiAliased + as everything else. Since this is not pleasing for the eye, this option allows to force those lines + to snap to discrete points (pixels) when activated and thus avoids AntiAliasing of pure Horizontal or + Vertical Hairlines. + + + + true + + + + AW + + This switch determines if the decorations of decorated text portions (e.g. underline, strike through) + are rendered using VCL direct rendering or if the primitive is decomposed into simple text and the + corresponding geometrical representations of the decorations. Default is true since VCL's usage + of the diverse System's hinting possibilities for decorations is useful. + + + + true + + + + AW + + This switch determines if simple text is directly rendered using VCL or not. If not, the simple text + is decomposed into PolyPolygons which will be painted then. Default is true, since VCL will use the + hinting for font rendering on the diverse supported systems, which gives better quality than rendering + the text as Polygons. + + + + true + AW diff --git a/svx/inc/svx/outliner.hxx b/svx/inc/svx/outliner.hxx index 6ec0054dcd..33818ccabc 100644 --- a/svx/inc/svx/outliner.hxx +++ b/svx/inc/svx/outliner.hxx @@ -89,6 +89,7 @@ class SvxForbiddenCharactersTable; #include #include #include +#include class SvxFieldData; ////////////////////////////////////////////////////////////////////////////// @@ -122,25 +123,6 @@ namespace basegfx { class B2DPolyPolygon; } // #define OLUNDO_MOVEPARAGRAPHS EDITUNDO_USER+7 #define OLUNDO_CHECKPARA EDITUNDO_USER+8 -// MT 07/00: Only for internal use, oder some kind like hPara for the few -// functions where you need it outside ( eg. moving paragraphs... ) - -class ParagraphData -{ - friend class Paragraph; - friend class OutlinerParaObject; -protected: - sal_Int16 nDepth; - sal_Int16 mnNumberingStartValue; - sal_Bool mbParaIsNumberingRestart; - -public: - ParagraphData( const ParagraphData& ); - ParagraphData(); - - ParagraphData& operator=( const ParagraphData& ); -}; - class Paragraph : protected ParagraphData { private: diff --git a/svx/inc/svx/outlobj.hxx b/svx/inc/svx/outlobj.hxx index 5fdbcb61dc..f99a95aedb 100644 --- a/svx/inc/svx/outlobj.hxx +++ b/svx/inc/svx/outlobj.hxx @@ -31,61 +31,66 @@ #ifndef _OUTLOBJ_HXX #define _OUTLOBJ_HXX +////////////////////////////////////////////////////////////////////////////// + #include #include #include -#include +#include #include "svx/svxdllapi.h" -#include - -class Outliner; class EditTextObject; -class SvStream; -class SfxItemPool; -class SfxStyleSheetPool; -class ParagraphData; +class ImplOutlinerParaObject; + +////////////////////////////////////////////////////////////////////////////// class SVX_DLLPUBLIC OutlinerParaObject { - friend class Outliner; +private: + ImplOutlinerParaObject* mpImplOutlinerParaObject; - EditTextObject* pText; - ParagraphData* pParagraphDataArr; - sal_uInt32 nCount; - BOOL bIsEditDoc; - OutlinerParaObject( USHORT nParaCount ); + void ImplMakeUnique(); public: - OutlinerParaObject( const OutlinerParaObject& ); - OutlinerParaObject( const EditTextObject& rTObj ); - ~OutlinerParaObject(); + // constructors/destructor + OutlinerParaObject( + const EditTextObject& rEditTextObject, + const ParagraphDataVector& rParagraphDataVector = ParagraphDataVector(), + bool bIsEditDoc = true); + OutlinerParaObject(const OutlinerParaObject& rCandidate); + ~OutlinerParaObject(); - OutlinerParaObject* Clone() const; + // assignment operator + OutlinerParaObject& operator=(const OutlinerParaObject& rCandidate); - USHORT GetOutlinerMode() const; - void SetOutlinerMode( USHORT n ); + // compare operator + bool operator==(const OutlinerParaObject& rCandidate) const; + bool operator!=(const OutlinerParaObject& rCandidate) const { return !operator==(rCandidate); } - BOOL IsVertical() const; - void SetVertical( BOOL bVertical ); + // outliner mode access + sal_uInt16 GetOutlinerMode() const; + void SetOutlinerMode(sal_uInt16 nNew); - sal_uInt32 Count() const { return nCount; } - sal_Int16 GetDepth( USHORT nPara ) const; - const EditTextObject& GetTextObject() const { return *pText; } - void ClearPortionInfo(); - BOOL IsEditDoc() const { return bIsEditDoc; } - void Store( SvStream& ) const; - static OutlinerParaObject* Create( SvStream&, SfxItemPool* pTextObjectPool = 0 ); + // vertical access + bool IsVertical() const; + void SetVertical(bool bNew); - BOOL ChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily, - const XubString& rNewName, SfxStyleFamily eNewFamily ); - void ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName ); - void SetStyleSheets( USHORT nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily ); + // data read access + sal_uInt32 Count() const; + sal_Int16 GetDepth(sal_uInt16 nPara) const; + const EditTextObject& GetTextObject() const; + bool IsEditDoc() const; + const ParagraphData& GetParagraphData(sal_uInt32 nIndex) const; - BOOL RemoveCharAttribs( USHORT nWhich = 0 ); - BOOL RemoveParaAttribs( USHORT nWhich = 0 ); + // portion info support + void ClearPortionInfo(); - void MergeParaAttribs( const SfxItemSet& rAttribs, USHORT nStart = EE_CHAR_START, USHORT nEnd = EE_CHAR_END ); + // StyleSheet support + bool ChangeStyleSheets(const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily); + void ChangeStyleSheetName(SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName); + void SetStyleSheets(sal_uInt16 nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily); }; +////////////////////////////////////////////////////////////////////////////// + #endif diff --git a/svx/inc/svx/paragraphdata.hxx b/svx/inc/svx/paragraphdata.hxx new file mode 100644 index 0000000000..c998cc6291 --- /dev/null +++ b/svx/inc/svx/paragraphdata.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: outlobj.hxx,v $ + * $Revision: 1.5.78.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _PARAGRAPH_DATA_HXX +#define _PARAGRAPH_DATA_HXX + +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// MT 07/00: Only for internal use, oder some kind like hPara for the few +// functions where you need it outside ( eg. moving paragraphs... ) +// +// AW: Unfortunately NOT only local (formally in outliner.hxx), but also +// used in outlobj.hxx. Moved to own header + +class ParagraphData +{ + friend class Paragraph; + friend class OutlinerParaObject; + +protected: + sal_Int16 nDepth; + sal_Int16 mnNumberingStartValue; + sal_Bool mbParaIsNumberingRestart; + +public: + ParagraphData( const ParagraphData& ); + ParagraphData(); + + ParagraphData& operator=( const ParagraphData& ); + + // compare operator + bool operator==(const ParagraphData& rCandidate) const; + + // data read access + sal_Int16 getDepth() const { return nDepth; } +}; + +////////////////////////////////////////////////////////////////////////////// + +typedef ::std::vector< ParagraphData > ParagraphDataVector; + +////////////////////////////////////////////////////////////////////////////// + +#endif // _PARAGRAPH_DATA_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx index 21cd2a26c7..6193488113 100644 --- a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx @@ -34,6 +34,7 @@ #include #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines @@ -53,7 +54,7 @@ namespace drawinglayer class SdrTextAttribute { const SdrText& mrSdrText; - const OutlinerParaObject* mpOutlinerParaObject; + const OutlinerParaObject maOutlinerParaObject; XFormTextStyle meFormTextStyle; sal_Int32 maTextLeftDistance; @@ -67,28 +68,35 @@ namespace drawinglayer unsigned mbHideContour : 1; unsigned mbBlink : 1; unsigned mbScroll : 1; + unsigned mbInEditMode : 1; public: SdrTextAttribute( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, XFormTextStyle eFormTextStyle, sal_Int32 aTextLeftDistance, sal_Int32 aTextUpperDistance, sal_Int32 aTextRightDistance, sal_Int32 aTextLowerDistance, - bool bContour, bool bFitToSize, - bool bHideContour, bool bBlink, - bool bScroll); + bool bContour, + bool bFitToSize, + bool bHideContour, + bool bBlink, + bool bScroll, + bool bInEditMode); bool operator==(const SdrTextAttribute& rCandidate) const; // data access const SdrText& getSdrText() const { return mrSdrText; } + const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; } bool isContour() const { return mbContour; } bool isFontwork() const { return (XFT_NONE != meFormTextStyle); } bool isFitToSize() const { return mbFitToSize; } bool isHideContour() const { return mbHideContour; } bool isBlink() const { return mbBlink; } bool isScroll() const { return mbScroll; } + bool isInEditMode() const { return mbInEditMode; } XFormTextStyle getFormTextStyle() const { return meFormTextStyle; } sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } diff --git a/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx index 2312325eaa..f8d8fb3880 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx @@ -33,12 +33,14 @@ #define INCLUDED_SDR_PRIMITIVE2D_PRIMITIVETOOLS_HXX #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines -namespace basegfx { - class BColor; +namespace basegfx { + class BColor; + class B2DHomMatrix; } ////////////////////////////////////////////////////////////////////////////// @@ -54,6 +56,9 @@ namespace drawinglayer // create a 7x7 gluepoint symbol in given colors as BitmapEx BitmapEx createDefaultGluepoint_7x7(const basegfx::BColor& rBColorA, const basegfx::BColor& rBColorB); + // #i99123# + Primitive2DReference createFallbackHitTestPrimitive(const basegfx::B2DHomMatrix& rMatrix); + } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx index e277dea965..e7903997de 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx @@ -36,6 +36,8 @@ #include #include #include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines @@ -54,6 +56,11 @@ namespace drawinglayer // something equal const SdrText& mrSdrText; // text model data + // #i97628# + // The text content; now as OutlinerParaObject* and in exclusive, local, cloned + // form as needed in a primitive + const OutlinerParaObject maOutlinerParaObject; + // remeber last VisualizingPage for which a decomposition was made. If the new target // is not given or different, the decomposition needs to be potentially removed // for supporting e.g. page number change on MasterPage objects or the different @@ -77,10 +84,13 @@ namespace drawinglayer void setLastSpellCheck(bool bNew) { mbLastSpellCheck = bNew; } public: - SdrTextPrimitive2D(const SdrText& rSdrText); + SdrTextPrimitive2D( + const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr); // get data const SdrText& getSdrText() const { return mrSdrText; } + const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; @@ -114,6 +124,7 @@ namespace drawinglayer public: SdrContourTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, const ::basegfx::B2DHomMatrix& rObjectTransform); @@ -151,6 +162,7 @@ namespace drawinglayer public: SdrPathTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, const ::basegfx::B2DPolyPolygon& rPathPolyPolygon); // get data @@ -191,6 +203,7 @@ namespace drawinglayer public: SdrBlockTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, const ::basegfx::B2DHomMatrix& rTextRangeTransform, bool bUnlimitedPage, bool bCellText, @@ -232,6 +245,7 @@ namespace drawinglayer public: SdrStretchTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, const ::basegfx::B2DHomMatrix& rTextRangeTransform); // get data diff --git a/svx/inc/svx/svdpool.hxx b/svx/inc/svx/svdpool.hxx index 65fa8444e5..75059d7796 100644 --- a/svx/inc/svx/svdpool.hxx +++ b/svx/inc/svx/svdpool.hxx @@ -45,7 +45,9 @@ class SVX_DLLPUBLIC SdrItemPool : public XOutdevItemPool public: SdrItemPool(SfxItemPool* pMaster = 0L, sal_Bool bLoadRefCounts = sal_True); SdrItemPool(const SdrItemPool& rPool); +protected: virtual ~SdrItemPool(); +public: virtual SfxItemPool* Clone() const; virtual SfxItemPresentation GetPresentation(const SfxPoolItem& rItem, diff --git a/svx/inc/svx/xpool.hxx b/svx/inc/svx/xpool.hxx index a74f73f754..58cf4bea94 100644 --- a/svx/inc/svx/xpool.hxx +++ b/svx/inc/svx/xpool.hxx @@ -56,7 +56,8 @@ public: XOutdevItemPool(const XOutdevItemPool& rPool); virtual SfxItemPool* Clone() const; - ~XOutdevItemPool(); +protected: + virtual ~XOutdevItemPool(); }; #endif // _XPOOL_HXX diff --git a/svx/prj/d.lst b/svx/prj/d.lst index e55f2a5858..3b70b59970 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -412,6 +412,7 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\source\items\boxobj.hxx %_DEST%\inc%_EXT%\svx\boxobj.hxx ..\inc\svx\itemtype.hxx %_DEST%\inc%_EXT%\svx\itemtype.hxx ..\inc\svx\outliner.hxx %_DEST%\inc%_EXT%\svx\outliner.hxx +..\inc\svx\paragraphdata.hxx %_DEST%\inc%_EXT%\svx\paragraphdata.hxx ..\inc\svx\outlobj.hxx %_DEST%\inc%_EXT%\svx\outlobj.hxx ..\inc\svx\editdata.hxx %_DEST%\inc%_EXT%\svx\editdata.hxx ..\inc\svx\editeng.hxx %_DEST%\inc%_EXT%\svx\editeng.hxx diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx index 1a417997b3..e19d5040b9 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx @@ -41,6 +41,7 @@ #include #include #include +#include //------------------------------------------------------------------------ // @@ -112,9 +113,10 @@ namespace accessibility String GetText( const ESelection& /*rSel*/ ) const { return String(); } SfxItemSet GetAttribs( const ESelection& /*rSel*/, BOOL /*bOnlyHardAttrib*/ = 0 ) const { - String aDummyStr(RTL_CONSTASCII_USTRINGPARAM("Dummy")); - SfxItemPool aPool(aDummyStr,0,0,NULL); - return SfxItemSet(aPool); + // AW: Very dangerous: The former implementation used a SfxItemPool created on the + // fly which of course was deleted again ASAP. Thus, the returned SfxItemSet was using + // a deleted Pool by design. + return SfxItemSet(SdrObject::GetGlobalDrawObjectItemPool()); } SfxItemSet GetParaAttribs( USHORT /*nPara*/ ) const { return GetAttribs(ESelection()); } void SetParaAttribs( USHORT /*nPara*/, const SfxItemSet& /*rSet*/ ) {} diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx index e0f2f56394..42979df0c8 100644 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx @@ -177,7 +177,7 @@ SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText( const SdrObjCustom // Copy text content OutlinerParaObject* pParaObj = pCustoObj->GetOutlinerParaObject(); if( pParaObj ) - pTextObj->NbcSetOutlinerParaObject( pParaObj->Clone() ); + pTextObj->NbcSetOutlinerParaObject( new OutlinerParaObject(*pParaObj) ); // copy all attributes SfxItemSet aTargetItemSet( pCustoObj->GetMergedItemSet() ); diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 53b2332eae..b805287785 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -141,7 +141,7 @@ IMapWindow::~IMapWindow() for( String* pStr = aTargetList.First(); pStr; pStr = aTargetList.Next() ) delete pStr; - delete pIMapPool; + SfxItemPool::Free(pIMapPool); delete[] pItemInfo; } @@ -287,7 +287,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) Point aPoint; Rectangle aClipRect( aPoint, GetGraphicSize() ); SdrObject* pSdrObj = NULL; - IMapObject* pCloneIMapObj = NULL; + IMapObjectPtr pCloneIMapObj; switch( pIMapObj->GetType() ) { @@ -300,7 +300,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) aDrawRect.Intersection( aClipRect ); pSdrObj = (SdrObject*) new SdrRectObj( aDrawRect ); - pCloneIMapObj = (IMapObject*) new IMapRectangleObject( *pIMapRectObj ); + pCloneIMapObj.reset((IMapObject*) new IMapRectangleObject( *pIMapRectObj )); } break; @@ -316,7 +316,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) aCircle.Intersection( aClipRect ); pSdrObj = (SdrObject*) new SdrCircObj( OBJ_CIRC, aCircle, 0, 36000 ); - pCloneIMapObj = (IMapObject*) new IMapCircleObject( *pIMapCircleObj ); + pCloneIMapObj.reset((IMapObject*) new IMapCircleObject( *pIMapCircleObj )); } break; @@ -348,7 +348,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) pSdrObj = (SdrObject*)new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aPolygon)); } - pCloneIMapObj = (IMapObject*) new IMapPolygonObject( *pIMapPolyObj ); + pCloneIMapObj.reset((IMapObject*) new IMapPolygonObject( *pIMapPolyObj )); } break; @@ -416,9 +416,9 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj ) { SdrRectObj* pRectObj = (SdrRectObj*) &rObj; IMapRectangleObject* pObj = new IMapRectangleObject( pRectObj->GetLogicRect(), - String(), String(), String(), String(), String(), TRUE, FALSE ); + String(), String(), String(), String(), String(), TRUE, FALSE ); - pRectObj->InsertUserData( new IMapUserData( pObj ) ); + pRectObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) ); } break; @@ -431,7 +431,7 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj ) IMapPolygonObject* pObj = new IMapPolygonObject( Polygon(aPoly), String(), String(), String(), String(), String(), TRUE, FALSE ); pObj->SetExtraEllipse( aPoly.GetBoundRect() ); - pCircObj->InsertUserData( new IMapUserData( pObj ) ); + pCircObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) ); } break; @@ -447,7 +447,7 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj ) { Polygon aPoly(rXPolyPoly.getB2DPolygon(0L)); IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, String(), String(), String(), String(), String(), TRUE, FALSE ); - pPathObj->InsertUserData( new IMapUserData( pObj ) ); + pPathObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) ); } } break; @@ -473,10 +473,10 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) String aAltText; String aDesc; String aTarget; - IMapObject* pIMapObj = pUserData->GetObject(); + IMapObjectPtr pIMapObj = pUserData->GetObject(); BOOL bActive = TRUE; - if ( pIMapObj ) + if ( pIMapObj.get() ) { aURL = pIMapObj->GetURL(); aAltText = pIMapObj->GetAltText(); @@ -489,8 +489,8 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) { case( OBJ_RECT ): { - pUserData->ReplaceObject( new IMapRectangleObject( ( (const SdrRectObj&) rObj ).GetLogicRect(), - aURL, aAltText, aDesc, aTarget, String(), bActive, FALSE ) ); + pUserData->ReplaceObject( IMapObjectPtr(new IMapRectangleObject( ( (const SdrRectObj&) rObj ).GetLogicRect(), + aURL, aAltText, aDesc, aTarget, String(), bActive, FALSE ) ) ); } break; @@ -505,7 +505,7 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) // wurde von uns nur temporaer angelegt delete pPathObj; - pUserData->ReplaceObject( pObj ); + pUserData->ReplaceObject( IMapObjectPtr(pObj) ); } break; @@ -521,7 +521,7 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) { Polygon aPoly(rPathObj.GetPathPoly().getB2DPolygon(0L)); IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, String(), bActive, FALSE ); - pUserData->ReplaceObject( pObj ); + pUserData->ReplaceObject( IMapObjectPtr(pObj) ); } } break; @@ -606,7 +606,7 @@ IMapObject* IMapWindow::GetIMapObj( const SdrObject* pSdrObj ) const IMapUserData* pUserData = (IMapUserData*) pSdrObj->GetUserData( 0 ); if ( pUserData ) - pIMapObj = pUserData->GetObject(); + pIMapObj = pUserData->GetObject().get(); } return pIMapObj; diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx index 19a39f0132..31d108dfe0 100644 --- a/svx/source/dialog/imapwnd.hxx +++ b/svx/source/dialog/imapwnd.hxx @@ -83,31 +83,34 @@ const UINT32 IMapInventor = UINT32('I') * 0x00000001+ UINT32('P') * 0x01000000; +typedef boost::shared_ptr< IMapObject > IMapObjectPtr; + class IMapUserData : public SdrObjUserData { - IMapObject* pObj; + // #i98386# use boost::shared_ptr here due to cloning possibilities + IMapObjectPtr mpObj; public: IMapUserData() : SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ), - pObj ( NULL ) {} + mpObj ( ) {} - IMapUserData( IMapObject* pIMapObj ) : + IMapUserData( const IMapObjectPtr& rIMapObj ) : SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ), - pObj ( pIMapObj ) {} + mpObj ( rIMapObj ) {} IMapUserData( const IMapUserData& rIMapUserData ) : SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ), - pObj ( rIMapUserData.pObj ) {} + mpObj ( rIMapUserData.mpObj ) {} - ~IMapUserData() { delete pObj; } + ~IMapUserData() { } virtual SdrObjUserData* Clone( SdrObject * ) const { return new IMapUserData( *this ); } - void SetObject( IMapObject* pIMapObj ) { pObj = pIMapObj; } - IMapObject* GetObject() const { return pObj; } - void ReplaceObject( IMapObject* pNewIMapObject ) { delete pObj; pObj = pNewIMapObject; } + void SetObject( const IMapObjectPtr& rIMapObj ) { mpObj = rIMapObj; } + const IMapObjectPtr GetObject() const { return mpObj; } + void ReplaceObject( const IMapObjectPtr& pNewIMapObject ) { mpObj = pNewIMapObject; } }; diff --git a/svx/source/editeng/editdoc.cxx b/svx/source/editeng/editdoc.cxx index 8bd094ae98..45493a700f 100644 --- a/svx/source/editeng/editdoc.cxx +++ b/svx/source/editeng/editdoc.cxx @@ -1245,7 +1245,7 @@ EditDoc::~EditDoc() { ImplDestroyContents(); if ( bOwnerOfPool ) - delete pItemPool; + SfxItemPool::Free(pItemPool); } void EditDoc::ImplDestroyContents() diff --git a/svx/source/editeng/editdoc.hxx b/svx/source/editeng/editdoc.hxx index 0d2e6288dc..301883042a 100644 --- a/svx/source/editeng/editdoc.hxx +++ b/svx/source/editeng/editdoc.hxx @@ -784,7 +784,9 @@ class EditEngineItemPool : public SfxItemPool { public: EditEngineItemPool( BOOL bPersistenRefCounts ); - ~EditEngineItemPool(); +protected: + virtual ~EditEngineItemPool(); +public: virtual SvStream& Store( SvStream& rStream ) const; }; diff --git a/svx/source/editeng/editobj.cxx b/svx/source/editeng/editobj.cxx index 42f2fafaf0..a9d3bca341 100644 --- a/svx/source/editeng/editobj.cxx +++ b/svx/source/editeng/editobj.cxx @@ -566,8 +566,42 @@ bool EditTextObject::operator==( const EditTextObject& rCompare ) const return static_cast< const BinTextObject* >( this )->operator==( static_cast< const BinTextObject& >( rCompare ) ); } +// from SfxItemPoolUser +void BinTextObject::ObjectInDestruction(const SfxItemPool& rSfxItemPool) +{ + if(!bOwnerOfPool && pPool && pPool == &rSfxItemPool) + { + // The pool we are based on gets destructed; get owner of pool by creating own one. + // No need to call RemoveSfxItemPoolUser(), this is done from the pool's destructor + // Base new pool on EditEnginePool; it would also be possible to clone the used + // pool if needed, but only text attributes should be used. + SfxItemPool* pNewPool = EditEngine::CreatePool(); + + if(pPool) + { + pNewPool->SetDefaultMetric(pPool->GetMetric(DEF_METRIC)); + } + + for(sal_uInt16 n(0); n < aContents.Count(); n++) + { + // clone ContentInfos for new pool + ContentInfo* pOrg = aContents.GetObject(n); + DBG_ASSERT(pOrg, "NULL-Pointer in ContentList!"); + + ContentInfo* pNew = new ContentInfo(*pOrg, *pNewPool); + aContents.Replace(pNew, n); + delete pOrg; + } + + // set local variables + pPool = pNewPool; + bOwnerOfPool = TRUE; + } +} + BinTextObject::BinTextObject( SfxItemPool* pP ) : - EditTextObject( EE_FORMAT_BIN ) + EditTextObject( EE_FORMAT_BIN ), + SfxItemPoolUser() { nVersion = 0; nMetric = 0xFFFF; @@ -584,13 +618,20 @@ BinTextObject::BinTextObject( SfxItemPool* pP ) : pPool = EditEngine::CreatePool(); bOwnerOfPool = TRUE; } + + if(!bOwnerOfPool && pPool) + { + pPool->AddSfxItemPoolUser(*this); + } + bVertical = FALSE; bStoreUnicodeStrings = FALSE; nScriptType = 0; } BinTextObject::BinTextObject( const BinTextObject& r ) : - EditTextObject( r ) + EditTextObject( r ), + SfxItemPoolUser() { nVersion = r.nVersion; nMetric = r.nMetric; @@ -613,6 +654,11 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : } + if(!bOwnerOfPool && pPool) + { + pPool->AddSfxItemPoolUser(*this); + } + if ( bOwnerOfPool && pPool && r.pPool ) pPool->SetDefaultMetric( r.pPool->GetMetric( DEF_METRIC ) ); @@ -627,6 +673,11 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : __EXPORT BinTextObject::~BinTextObject() { + if(!bOwnerOfPool && pPool) + { + pPool->RemoveSfxItemPoolUser(*this); + } + ClearPortionInfo(); DeleteContents(); if ( bOwnerOfPool ) @@ -634,7 +685,7 @@ __EXPORT BinTextObject::~BinTextObject() // Nicht mehr, wegen 1xDefItems. // siehe auch ~EditDoc(). // pPool->ReleaseDefaults( TRUE /* bDelete */ ); - delete pPool; + SfxItemPool::Free(pPool); } } diff --git a/svx/source/editeng/editobj2.hxx b/svx/source/editeng/editobj2.hxx index 5a023ac931..c61a198f47 100644 --- a/svx/source/editeng/editobj2.hxx +++ b/svx/source/editeng/editobj2.hxx @@ -195,7 +195,7 @@ SV_DECL_PTRARR( ContentInfoList, ContentInfoPtr, 1, 4 ) // MT 05/00: Sollte mal direkt EditTextObjekt werden => keine virtuellen Methoden mehr. -class BinTextObject : public EditTextObject +class BinTextObject : public EditTextObject, public SfxItemPoolUser { using EditTextObject::operator==; @@ -303,6 +303,8 @@ public: bool operator==( const BinTextObject& rCompare ) const; + // from SfxItemPoolUser + virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool); }; #endif // _EDITOBJ2_HXX diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 13f2b0cb69..e53a3966c6 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -670,15 +670,15 @@ namespace svx //------------------------------------------------------------------------ void FmTextControlShell::executeAttributeDialog( AttributeSet _eSet, SfxRequest& _rReq ) { - ::std::auto_ptr< SfxItemPool > pPool( EditEngine::CreatePool() ); - pPool->FreezeIdRanges(); - SfxItemSet aPureItems( *pPool ); - const SvxFontListItem* pFontList = PTR_CAST( SvxFontListItem, m_pViewFrame->GetObjectShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ); DBG_ASSERT( pFontList, "FmTextControlShell::executeAttributeDialog: no font list item!" ); if ( !pFontList ) return; + SfxItemPool* pPool = EditEngine::CreatePool(); + pPool->FreezeIdRanges(); + SfxItemSet aPureItems( *pPool ); + // put the current states of the items into the set SfxAllItemSet aCurrentItems( aPureItems ); transferFeatureStatesToItemSet( m_aControlFeatures, aCurrentItems ); @@ -774,6 +774,8 @@ namespace svx } _rReq.Done( rModifiedItems ); } + + SfxItemPool::Free(pPool); } //------------------------------------------------------------------------ diff --git a/svx/source/outliner/makefile.mk b/svx/source/outliner/makefile.mk index 5a1e287d6e..deef353049 100644 --- a/svx/source/outliner/makefile.mk +++ b/svx/source/outliner/makefile.mk @@ -34,6 +34,7 @@ PRJ=..$/.. PRJNAME=svx TARGET=outliner AUTOSEG=true +ENABLE_EXCEPTIONS=TRUE PROJECTPCH4DLL=TRUE PROJECTPCH=outl_pch diff --git a/svx/source/outliner/outliner.cxx b/svx/source/outliner/outliner.cxx index 3e4a0ed868..988a73dab7 100644 --- a/svx/source/outliner/outliner.cxx +++ b/svx/source/outliner/outliner.cxx @@ -378,14 +378,19 @@ OutlinerParaObject* Outliner::CreateParaObject( USHORT nStartPara, USHORT nCount if( !nCount ) return NULL; - OutlinerParaObject* pPObj = new OutlinerParaObject( nCount ); - pPObj->pText = pEditEngine->CreateTextObject( nStartPara, nCount ); - pPObj->SetOutlinerMode( GetMode() ); - pPObj->bIsEditDoc = ( ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) ? TRUE : FALSE; + EditTextObject* pText = pEditEngine->CreateTextObject( nStartPara, nCount ); + const bool bIsEditDoc(OUTLINERMODE_TEXTOBJECT == ImplGetOutlinerMode()); + ParagraphDataVector aParagraphDataVector(nCount); + const sal_uInt16 nLastPara(nStartPara + nCount - 1); - USHORT nLastPara = nStartPara + nCount - 1; - for ( USHORT nPara = nStartPara; nPara <= nLastPara; nPara++ ) - pPObj->pParagraphDataArr[ nPara-nStartPara] = *GetParagraph( nPara ); + for(sal_uInt16 nPara(nStartPara); nPara <= nLastPara; nPara++) + { + aParagraphDataVector[nPara-nStartPara] = *GetParagraph(nPara); + } + + OutlinerParaObject* pPObj = new OutlinerParaObject(*pText, aParagraphDataVector, bIsEditDoc); + pPObj->SetOutlinerMode(GetMode()); + delete pText; return pPObj; } @@ -573,8 +578,8 @@ void Outliner::SetText( const OutlinerParaObject& rPObj ) Init( rPObj.GetOutlinerMode() ); ImplBlockInsertionCallbacks( TRUE ); - pEditEngine->SetText( *(rPObj.pText) ); - if( rPObj.nCount != pEditEngine->GetParagraphCount() ) + pEditEngine->SetText(rPObj.GetTextObject()); + if( rPObj.Count() != pEditEngine->GetParagraphCount() ) { int nop=0;nop++; } @@ -582,9 +587,9 @@ void Outliner::SetText( const OutlinerParaObject& rPObj ) bFirstParaIsEmpty = FALSE; pParaList->Clear( TRUE ); - for( USHORT nCurPara = 0; nCurPara < rPObj.nCount; nCurPara++ ) + for( USHORT nCurPara = 0; nCurPara < rPObj.Count(); nCurPara++ ) { - Paragraph* pPara = new Paragraph( rPObj.pParagraphDataArr[ nCurPara ] ); + Paragraph* pPara = new Paragraph( rPObj.GetParagraphData(nCurPara)); ImplCheckDepth( pPara->nDepth ); pParaList->Insert( pPara, LIST_APPEND ); @@ -614,19 +619,19 @@ void Outliner::AddText( const OutlinerParaObject& rPObj ) if( bFirstParaIsEmpty ) { pParaList->Clear( TRUE ); - pEditEngine->SetText( *(rPObj.pText) ); + pEditEngine->SetText(rPObj.GetTextObject()); nPara = 0; } else { nPara = pParaList->GetParagraphCount(); - pEditEngine->InsertParagraph( EE_PARA_APPEND, *(rPObj.pText) ); + pEditEngine->InsertParagraph( EE_PARA_APPEND, rPObj.GetTextObject() ); } bFirstParaIsEmpty = FALSE; - for( USHORT n = 0; n < rPObj.nCount; n++ ) + for( USHORT n = 0; n < rPObj.Count(); n++ ) { - pPara = new Paragraph( rPObj.pParagraphDataArr[ n ] ); + pPara = new Paragraph( rPObj.GetParagraphData(n) ); pParaList->Insert( pPara, LIST_APPEND ); USHORT nP = sal::static_int_cast< USHORT >(nPara+n); DBG_ASSERT(pParaList->GetAbsPos(pPara)==nP,"AddText:Out of sync"); diff --git a/svx/source/outliner/outlobj.cxx b/svx/source/outliner/outlobj.cxx index 5097e944d6..554ea34004 100644 --- a/svx/source/outliner/outlobj.cxx +++ b/svx/source/outliner/outlobj.cxx @@ -38,234 +38,218 @@ #include #include #include +#include +#include +////////////////////////////////////////////////////////////////////////////// -#include +class ImplOutlinerParaObject +{ +public: + // data members + EditTextObject* mpEditTextObject; + ParagraphDataVector maParagraphDataVector; + bool mbIsEditDoc; + // refcounter + sal_uInt32 mnRefCount; -#include + // constuctor + ImplOutlinerParaObject(EditTextObject* pEditTextObject, const ParagraphDataVector& rParagraphDataVector, bool bIsEditDoc) + : mpEditTextObject(pEditTextObject), + maParagraphDataVector(rParagraphDataVector), + mbIsEditDoc(bIsEditDoc), + mnRefCount(0) + { + } + + // destructor + ~ImplOutlinerParaObject() + { + delete mpEditTextObject; + } + + bool operator==(const ImplOutlinerParaObject& rCandidate) const + { + return (*mpEditTextObject == *rCandidate.mpEditTextObject + && maParagraphDataVector == rCandidate.maParagraphDataVector + && mbIsEditDoc == rCandidate.mbIsEditDoc); + } +}; -DBG_NAME(OutlinerParaObject) +////////////////////////////////////////////////////////////////////////////// -OutlinerParaObject::OutlinerParaObject( USHORT nParaCount ) +void OutlinerParaObject::ImplMakeUnique() { - DBG_CTOR(OutlinerParaObject,0); - - bIsEditDoc = TRUE; - pParagraphDataArr = new ParagraphData[ nParaCount ]; - nCount = nParaCount; + if(mpImplOutlinerParaObject->mnRefCount) + { + ImplOutlinerParaObject* pNew = new ImplOutlinerParaObject( + mpImplOutlinerParaObject->mpEditTextObject->Clone(), + mpImplOutlinerParaObject->maParagraphDataVector, + mpImplOutlinerParaObject->mbIsEditDoc); + mpImplOutlinerParaObject->mnRefCount--; + mpImplOutlinerParaObject = pNew; + } } -OutlinerParaObject::OutlinerParaObject( const OutlinerParaObject& rObj ) +OutlinerParaObject::OutlinerParaObject(const EditTextObject& rEditTextObject, const ParagraphDataVector& rParagraphDataVector, bool bIsEditDoc) +: mpImplOutlinerParaObject(new ImplOutlinerParaObject(rEditTextObject.Clone(), rParagraphDataVector, bIsEditDoc)) { - DBG_CTOR(OutlinerParaObject,0); - - bIsEditDoc = rObj.bIsEditDoc; - nCount = rObj.nCount; - pParagraphDataArr = new ParagraphData[ nCount ]; - for( sal_uInt32 i = 0; i < nCount; i++ ) - pParagraphDataArr[i] = rObj.pParagraphDataArr[i]; - pText = rObj.pText->Clone(); } -OutlinerParaObject::OutlinerParaObject( const EditTextObject& rEditObj ) +OutlinerParaObject::OutlinerParaObject(const OutlinerParaObject& rCandidate) +: mpImplOutlinerParaObject(rCandidate.mpImplOutlinerParaObject) { - DBG_CTOR(OutlinerParaObject,0); - - bIsEditDoc = TRUE; - pText = rEditObj.Clone(); - nCount = pText->GetParagraphCount(); - pParagraphDataArr = new ParagraphData[ nCount ]; + mpImplOutlinerParaObject->mnRefCount++; } OutlinerParaObject::~OutlinerParaObject() { - DBG_DTOR(OutlinerParaObject,0); - - delete pText; - delete[] pParagraphDataArr; + if(mpImplOutlinerParaObject->mnRefCount) + { + mpImplOutlinerParaObject->mnRefCount--; + } + else + { + delete mpImplOutlinerParaObject; + } } -sal_Int16 OutlinerParaObject::GetDepth( USHORT nPara ) const +OutlinerParaObject& OutlinerParaObject::operator=(const OutlinerParaObject& rCandidate) { - if( pParagraphDataArr && (nPara < nCount ) ) - return pParagraphDataArr[nPara].nDepth; - else - return -1; + if(rCandidate.mpImplOutlinerParaObject != mpImplOutlinerParaObject) + { + if(mpImplOutlinerParaObject->mnRefCount) + { + mpImplOutlinerParaObject->mnRefCount--; + } + else + { + delete mpImplOutlinerParaObject; + } + + mpImplOutlinerParaObject = rCandidate.mpImplOutlinerParaObject; + mpImplOutlinerParaObject->mnRefCount++; + } + + return *this; } -void OutlinerParaObject::ClearPortionInfo() +bool OutlinerParaObject::operator==(const OutlinerParaObject& rCandidate) const { - DBG_CHKTHIS(OutlinerParaObject,0); - pText->ClearPortionInfo(); + if(rCandidate.mpImplOutlinerParaObject == mpImplOutlinerParaObject) + { + return true; + } + + return (*rCandidate.mpImplOutlinerParaObject == *mpImplOutlinerParaObject); } -OutlinerParaObject* OutlinerParaObject::Clone() const +sal_uInt16 OutlinerParaObject::GetOutlinerMode() const { - DBG_CHKTHIS(OutlinerParaObject,0); - OutlinerParaObject* pObj = new OutlinerParaObject(*this); - return pObj; + return mpImplOutlinerParaObject->mpEditTextObject->GetUserType(); } -void OutlinerParaObject::ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName ) +void OutlinerParaObject::SetOutlinerMode(sal_uInt16 nNew) { - DBG_CHKTHIS(OutlinerParaObject,0); - pText->ChangeStyleSheetName( eFamily, rOldName, rNewName ); + if(mpImplOutlinerParaObject->mpEditTextObject->GetUserType() != nNew) + { + ImplMakeUnique(); + mpImplOutlinerParaObject->mpEditTextObject->SetUserType(nNew); + } } -BOOL OutlinerParaObject::ChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily ) +bool OutlinerParaObject::IsVertical() const { - DBG_CHKTHIS(OutlinerParaObject,0); - return pText->ChangeStyleSheets( rOldName, eOldFamily, rNewName, eNewFamily ); + return mpImplOutlinerParaObject->mpEditTextObject->IsVertical(); } -void OutlinerParaObject::SetStyleSheets( USHORT nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily ) +void OutlinerParaObject::SetVertical(bool bNew) { - for ( USHORT n = sal::static_int_cast< USHORT >( Count() ); n; ) + if((bool)mpImplOutlinerParaObject->mpEditTextObject->IsVertical() != bNew) { - if ( GetDepth( --n ) == nLevel ) - pText->SetStyleSheet( n, rNewName, rNewFamily ); + ImplMakeUnique(); + mpImplOutlinerParaObject->mpEditTextObject->SetVertical(bNew); } } -void OutlinerParaObject::Store(SvStream& rStream ) const +sal_uInt32 OutlinerParaObject::Count() const { - rStream << nCount; - rStream << static_cast(0x42345678); - pText->Store( rStream ); - - for( USHORT nPos=0; nPos < nCount; nPos++ ) - rStream << pParagraphDataArr[ nPos ].nDepth; - - rStream << bIsEditDoc; + return mpImplOutlinerParaObject->maParagraphDataVector.size(); } -OutlinerParaObject* OutlinerParaObject::Create( SvStream& rStream, SfxItemPool* pTextObjectPool ) +sal_Int16 OutlinerParaObject::GetDepth(sal_uInt16 nPara) const { - OutlinerParaObject* pPObj = NULL; - USHORT nVersion = 0; - - sal_uInt32 nCount; - rStream >> nCount; - - sal_uInt32 nSyncRef; - rStream >> nSyncRef; - if( nSyncRef == 0x12345678 ) - nVersion = 1; - else if( nSyncRef == 0x22345678 ) - nVersion = 2; - else if( nSyncRef == 0x32345678 ) - nVersion = 3; - else if ( nSyncRef == 0x42345678 ) - nVersion = 4; - - if ( nVersion ) + if(nPara < mpImplOutlinerParaObject->maParagraphDataVector.size()) { - pPObj = new OutlinerParaObject( (USHORT)nCount ); - if( nVersion <= 3 ) - { - EditTextObject* pAllText = 0; - USHORT nCurPara = 0; - while ( nCount ) - { - EditTextObject* pText = EditTextObject::Create( rStream, NULL ); - DBG_ASSERT(pText,"CreateEditTextObject failed"); - sal_uInt32 nSync = 0; - rStream >> nSync; - DBG_ASSERT(nSync==nSyncRef,"Stream out of sync"); - USHORT nDepth; - rStream >> nDepth; - Paragraph* pPara = new Paragraph( nDepth ); - if( nVersion == 1 ) - { - // Bullet ueberlesen - USHORT nFlags; - rStream >> nFlags; - - if ( nFlags & 0x0001 ) // Bitmap - { - Bitmap aBmp; - rStream >> aBmp; - } - else - { - Color aColor; - rStream >> aColor; - rStream.SeekRel( 16 ); - String aName; - rStream.ReadByteString(aName); - rStream.SeekRel( 12 ); - } - long nDummy; - rStream >> nDummy; - rStream >> nDummy; - } - pPara->bVisible = TRUE; - if( !pAllText ) - pAllText = pText; - else - { - pAllText->Insert( *pText, 0xffff ); - delete pText; - } - pPObj->pParagraphDataArr[ nCurPara ] = *pPara; - delete pPara; - nCount--; - nCurPara++; - if( nCount ) - { - sal_uInt32 _nSync = 0; - rStream >> _nSync; - DBG_ASSERT(_nSync==nSyncRef,"Stream out of sync"); - } - } - if( nVersion == 3 ) - rStream >> pPObj->bIsEditDoc; - pPObj->pText = pAllText; - } - else // nVersion >= 4 - { - pPObj->pText = EditTextObject::Create( rStream, pTextObjectPool ); - for( USHORT nCur=0; nCur < nCount; nCur++ ) - rStream >> pPObj->pParagraphDataArr[ nCur ].nDepth; - rStream >> pPObj->bIsEditDoc; - } + return mpImplOutlinerParaObject->maParagraphDataVector[nPara].getDepth(); + } + else + { + return -1; } - return pPObj; } -USHORT OutlinerParaObject::GetOutlinerMode() const +const EditTextObject& OutlinerParaObject::GetTextObject() const { - return pText->GetUserType(); + return *mpImplOutlinerParaObject->mpEditTextObject; } -void OutlinerParaObject::SetOutlinerMode( USHORT n ) +bool OutlinerParaObject::IsEditDoc() const { - pText->SetUserType( n ); + return mpImplOutlinerParaObject->mbIsEditDoc; } -BOOL OutlinerParaObject::RemoveCharAttribs( USHORT nWhich ) +const ParagraphData& OutlinerParaObject::GetParagraphData(sal_uInt32 nIndex) const { - return pText->RemoveCharAttribs( nWhich ); + if(nIndex < mpImplOutlinerParaObject->maParagraphDataVector.size()) + { + return mpImplOutlinerParaObject->maParagraphDataVector[nIndex]; + } + else + { + OSL_ENSURE(false, "OutlinerParaObject::GetParagraphData: Access out of range (!)"); + static ParagraphData aEmptyParagraphData; + return aEmptyParagraphData; + } } -BOOL OutlinerParaObject::RemoveParaAttribs( USHORT nWhich ) +void OutlinerParaObject::ClearPortionInfo() { - return pText->RemoveParaAttribs( nWhich ); + ImplMakeUnique(); + mpImplOutlinerParaObject->mpEditTextObject->ClearPortionInfo(); } -void OutlinerParaObject::MergeParaAttribs( const SfxItemSet& rAttribs, USHORT nStart, USHORT nEnd ) +bool OutlinerParaObject::ChangeStyleSheets(const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily) { - pText->MergeParaAttribs( rAttribs, nStart, nEnd ); + ImplMakeUnique(); + return mpImplOutlinerParaObject->mpEditTextObject->ChangeStyleSheets(rOldName, eOldFamily, rNewName, eNewFamily); } -void OutlinerParaObject::SetVertical( BOOL bVertical ) +void OutlinerParaObject::ChangeStyleSheetName(SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName) { - pText->SetVertical( bVertical ); + ImplMakeUnique(); + mpImplOutlinerParaObject->mpEditTextObject->ChangeStyleSheetName(eFamily, rOldName, rNewName); } -BOOL OutlinerParaObject::IsVertical() const +void OutlinerParaObject::SetStyleSheets(sal_uInt16 nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily) { - return pText->IsVertical(); + const sal_uInt32 nCount(mpImplOutlinerParaObject->maParagraphDataVector.size()); + + if(nCount) + { + ImplMakeUnique(); + sal_uInt16 nDecrementer(sal::static_int_cast< sal_uInt16 >(nCount)); + + for(;nDecrementer;) + { + if(GetDepth(--nDecrementer) == nLevel) + { + mpImplOutlinerParaObject->mpEditTextObject->SetStyleSheet(nDecrementer, rNewName, rNewFamily); + } + } + } } +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/outliner/paralist.cxx b/svx/source/outliner/paralist.cxx index 5f87148176..e5493a24dc 100644 --- a/svx/source/outliner/paralist.cxx +++ b/svx/source/outliner/paralist.cxx @@ -59,6 +59,13 @@ ParagraphData& ParagraphData::operator=( const ParagraphData& r) return *this; } +bool ParagraphData::operator==(const ParagraphData& rCandidate) const +{ + return (nDepth == rCandidate.nDepth + && mnNumberingStartValue == rCandidate.mnNumberingStartValue + && mbParaIsNumberingRestart == rCandidate.mbParaIsNumberingRestart); +} + Paragraph::Paragraph( sal_Int16 nDDepth ) : aBulSize( -1, -1) { diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index 7ed0fffb4a..591fcb026a 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -44,6 +44,7 @@ namespace drawinglayer { SdrTextAttribute::SdrTextAttribute( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, XFormTextStyle eFormTextStyle, sal_Int32 aTextLeftDistance, sal_Int32 aTextUpperDistance, @@ -53,9 +54,10 @@ namespace drawinglayer bool bFitToSize, bool bHideContour, bool bBlink, - bool bScroll) + bool bScroll, + bool bInEditMode) : mrSdrText(rSdrText), - mpOutlinerParaObject(rSdrText.GetOutlinerParaObject()), + maOutlinerParaObject(rOutlinerParaObject), meFormTextStyle(eFormTextStyle), maTextLeftDistance(aTextLeftDistance), maTextUpperDistance(aTextUpperDistance), @@ -65,15 +67,14 @@ namespace drawinglayer mbFitToSize(bFitToSize), mbHideContour(bHideContour), mbBlink(bBlink), - mbScroll(bScroll) + mbScroll(bScroll), + mbInEditMode(bInEditMode) { } bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const { - const bool bOutlinerParaObjectSameAddress(mpOutlinerParaObject == rCandidate.mpOutlinerParaObject); - - return (bOutlinerParaObjectSameAddress + return (getOutlinerParaObject() == rCandidate.getOutlinerParaObject() && getFormTextStyle() == rCandidate.getFormTextStyle() && getTextLeftDistance() == rCandidate.getTextLeftDistance() && getTextUpperDistance() == rCandidate.getTextUpperDistance() @@ -83,7 +84,8 @@ namespace drawinglayer && isFitToSize() == rCandidate.isFitToSize() && isHideContour() == rCandidate.isHideContour() && isBlink() == rCandidate.isBlink() - && isScroll() == rCandidate.isScroll()); + && isScroll() == rCandidate.isScroll() + && isInEditMode() == rCandidate.isInEditMode()); } void SdrTextAttribute::getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx index fa42ffc532..18db96f142 100644 --- a/svx/source/sdr/contact/objectcontactofpageview.cxx +++ b/svx/source/sdr/contact/objectcontactofpageview.cxx @@ -185,12 +185,24 @@ namespace sdr // update current ViewInformation2D at the ObjectContact const double fCurrentTime(getPrimitiveAnimator().GetTime()); OutputDevice& rTargetOutDev = GetPageWindow().GetPaintWindow().GetTargetOutputDevice(); - const GDIMetaFile* pMetaFile = rTargetOutDev.GetConnectMetaFile(); - const bool bOutputToRecordingMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause()); basegfx::B2DRange aViewRange; // create ViewRange - if(!bOutputToRecordingMetaFile) + if(isOutputToRecordingMetaFile()) + { + if(isOutputToPDFFile()) + { + // #i98402# if it's a PDF export, set the ClipRegion as ViewRange. This is + // mainly because SW does not use DrawingLayer Page-Oriented and if not doing this, + // all existing objects will be collected as primitives and processed. + const Rectangle aLogicClipRectangle(rDisplayInfo.GetRedrawArea().GetBoundRect()); + + aViewRange = basegfx::B2DRange( + aLogicClipRectangle.Left(), aLogicClipRectangle.Top(), + aLogicClipRectangle.Right(), aLogicClipRectangle.Bottom()); + } + } + else { // use visible pixels, but transform to world coordinates const Size aOutputSizePixel(rTargetOutDev.GetOutputSizePixel()); diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index 648e7efca0..0c6d3177b9 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -38,6 +38,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -111,6 +112,18 @@ namespace sdr delete pAttribute; } + + if(!xRetval.hasElements()) + { + // #i99123# + // Object is invisible. Create a fallback primitive for HitTest + basegfx::B2DHomMatrix aObjectMatrix; + basegfx::B2DPolyPolygon aObjectPolyPolygon; + GetRectObj().TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon); + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createFallbackHitTestPrimitive(aObjectMatrix)); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } return xRetval; diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 56e4550b3e..3cb131929c 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -475,7 +475,7 @@ namespace drawinglayer attribute::SdrTextAttribute* createNewSdrTextAttribute(const SfxItemSet& rSet, const SdrText& rText) { - attribute::SdrTextAttribute* pRetval(0L); + attribute::SdrTextAttribute* pRetval(0); const SdrTextObj& rTextObj = rText.GetObject(); if(rText.GetOutlinerParaObject() && rText.GetModel()) @@ -491,25 +491,41 @@ namespace drawinglayer { bInEditMode = rTextObj.IsInEditMode(); } - - if(!bInEditMode) + + OutlinerParaObject aOutlinerParaObject(*rText.GetOutlinerParaObject()); + + if(bInEditMode) { - const SdrFitToSizeType eFit = rTextObj.GetFitToSize(); - const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind()); - - pRetval = new attribute::SdrTextAttribute( - rText, - ((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(), - rTextObj.GetTextLeftDistance(), - rTextObj.GetTextUpperDistance(), - rTextObj.GetTextRightDistance(), - rTextObj.GetTextLowerDistance(), - ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(), - (SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit), - ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(), - SDRTEXTANI_BLINK == eAniKind, - SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind); + OutlinerParaObject* pTempObj = rTextObj.GetEditOutlinerParaObject(); + + if(pTempObj) + { + aOutlinerParaObject = *pTempObj; + delete pTempObj; + } + else + { + bInEditMode = false; + } } + + const SdrFitToSizeType eFit = rTextObj.GetFitToSize(); + const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind()); + + pRetval = new attribute::SdrTextAttribute( + rText, + aOutlinerParaObject, + ((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(), + rTextObj.GetTextLeftDistance(), + rTextObj.GetTextUpperDistance(), + rTextObj.GetTextRightDistance(), + rTextObj.GetTextLowerDistance(), + ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(), + (SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit), + ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(), + SDRTEXTANI_BLINK == eAniKind, + SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind, + bInEditMode); } return pRetval; diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 2f768d4c54..39157f5b7f 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -54,6 +54,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -205,12 +206,12 @@ namespace drawinglayer aScaledUnitPolyPolygon.transform(aScaleTransform); // create with unit polygon - pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), aScaledUnitPolyPolygon, rObjectTransform); + pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aScaledUnitPolyPolygon, rObjectTransform); } else { // create with unit polygon - pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), rUnitPolyPolygon, rObjectTransform); + pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), rUnitPolyPolygon, rObjectTransform); } } else if(rText.isFontwork() && !rText.isScroll()) @@ -218,7 +219,7 @@ namespace drawinglayer // text on path, use scaled polygon. Not allowed when text scrolling is used. ::basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); - pNew = new SdrPathTextPrimitive2D(rText.getSdrText(), aScaledPolyPolygon); + pNew = new SdrPathTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aScaledPolyPolygon); } else { @@ -266,12 +267,12 @@ namespace drawinglayer if(rText.isFitToSize()) { // streched text in range - pNew = new SdrStretchTextPrimitive2D(rText.getSdrText(), aAnchorTransform); + pNew = new SdrStretchTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform); } else // text in range { // build new primitive - pNew = new SdrBlockTextPrimitive2D(rText.getSdrText(), aAnchorTransform, rText.isScroll(), bCellText, bWordWrap); + pNew = new SdrBlockTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform, rText.isScroll(), bCellText, bWordWrap); } } @@ -397,8 +398,22 @@ namespace drawinglayer } else { - // add to decomposition - return Primitive2DReference(pNew); + if(rText.isInEditMode()) + { + // #i97628# + // encapsulate with TextHierarchyEditPrimitive2D to allow renderers + // to suppress actively edited content if needed + const Primitive2DReference xRefA(pNew); + const Primitive2DSequence aContent(&xRefA, 1L); + + // create and add TextHierarchyEditPrimitive2D primitive + return Primitive2DReference(new TextHierarchyEditPrimitive2D(aContent)); + } + else + { + // add to decomposition + return Primitive2DReference(pNew); + } } } diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 6fd3e51d58..2eba93c5c0 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -125,7 +125,8 @@ namespace drawinglayer } // create primitive and get text range - pBlockText = new SdrBlockTextPrimitive2D(pTextAttribute->getSdrText(), aTextMatrix, pTextAttribute->isScroll(), false, false); + pBlockText = new SdrBlockTextPrimitive2D(pTextAttribute->getSdrText(), pTextAttribute->getOutlinerParaObject(), + aTextMatrix, pTextAttribute->isScroll(), false, false); aTextRange = pBlockText->getB2DRange(aViewInformation); } diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx index 8eca658c3c..1066a988ca 100644 --- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx +++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx @@ -33,6 +33,10 @@ #include #include #include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // helper methods @@ -175,6 +179,20 @@ namespace drawinglayer return *pRetVal; } + + // #i99123# + Primitive2DReference createFallbackHitTestPrimitive(const basegfx::B2DHomMatrix& rMatrix) + { + // create PolygonHairlinePrimitive2D + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + aUnitOutline.transform(rMatrix); + const basegfx::BColor aBlack(0.0, 0.0, 0.0); + const Primitive2DReference xReference(new PolygonHairlinePrimitive2D(aUnitOutline, aBlack)); + + // create HitTestPrimitive2D with it + const Primitive2DSequence xSequence(&xReference, 1); + return Primitive2DReference(new HitTestPrimitive2D(xSequence)); + } } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index 9553ff52ab..919ac76e39 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -63,33 +63,30 @@ namespace drawinglayer return xRetval; } - SdrTextPrimitive2D::SdrTextPrimitive2D(const SdrText& rSdrText) + SdrTextPrimitive2D::SdrTextPrimitive2D( + const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject) : BasePrimitive2D(), mrSdrText(rSdrText), + maOutlinerParaObject(rOutlinerParaObject), mxLastVisualizingPage(), mbLastSpellCheck(false), mbContainsPageField(false) { - if(mrSdrText.GetOutlinerParaObject()) - { - const EditTextObject& rETO = mrSdrText.GetOutlinerParaObject()->GetTextObject(); - mbContainsPageField = rETO.HasField(SvxPageField::StaticType()) - || rETO.HasField(SvxHeaderField::StaticType()) - || rETO.HasField(SvxFooterField::StaticType()) - || rETO.HasField(SvxDateTimeField::StaticType()); - } + const EditTextObject& rETO = maOutlinerParaObject.GetTextObject(); + mbContainsPageField = rETO.HasField(SvxPageField::StaticType()) + || rETO.HasField(SvxHeaderField::StaticType()) + || rETO.HasField(SvxFooterField::StaticType()) + || rETO.HasField(SvxDateTimeField::StaticType()); } bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { if(BasePrimitive2D::operator==(rPrimitive)) { - // since OutlinerParaObject has no compare operator, i do not clone it for this class and - // use the address in the SdrText for comparison if it did change const SdrTextPrimitive2D& rCompare = (SdrTextPrimitive2D&)rPrimitive; - const bool bOutlinerParaSameAddress(getSdrText().GetOutlinerParaObject() == rCompare.getSdrText().GetOutlinerParaObject()); - return bOutlinerParaSameAddress; + return (getOutlinerParaObject() == rCompare.getOutlinerParaObject()); } return false; @@ -154,9 +151,10 @@ namespace drawinglayer SdrContourTextPrimitive2D::SdrContourTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, const ::basegfx::B2DHomMatrix& rObjectTransform) - : SdrTextPrimitive2D(rSdrText), + : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), maUnitPolyPolygon(rUnitPolyPolygon), maObjectTransform(rObjectTransform) { @@ -177,7 +175,7 @@ namespace drawinglayer SdrTextPrimitive2D* SdrContourTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const { - return new SdrContourTextPrimitive2D(getSdrText(), maUnitPolyPolygon, rTransform * maObjectTransform); + return new SdrContourTextPrimitive2D(getSdrText(), getOutlinerParaObject(), maUnitPolyPolygon, rTransform * maObjectTransform); } // provide unique ID @@ -208,8 +206,9 @@ namespace drawinglayer SdrPathTextPrimitive2D::SdrPathTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, const ::basegfx::B2DPolyPolygon& rPathPolyPolygon) - : SdrTextPrimitive2D(rSdrText), + : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), maPathPolyPolygon(rPathPolyPolygon) { } @@ -230,7 +229,7 @@ namespace drawinglayer { ::basegfx::B2DPolyPolygon aNewPolyPolygon(maPathPolyPolygon); aNewPolyPolygon.transform(rTransform); - return new SdrPathTextPrimitive2D(getSdrText(), aNewPolyPolygon); + return new SdrPathTextPrimitive2D(getSdrText(), getOutlinerParaObject(), aNewPolyPolygon); } // provide unique ID @@ -261,11 +260,12 @@ namespace drawinglayer SdrBlockTextPrimitive2D::SdrBlockTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, const ::basegfx::B2DHomMatrix& rTextRangeTransform, bool bUnlimitedPage, bool bCellText, bool bWordWrap) - : SdrTextPrimitive2D(rSdrText), + : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), maTextRangeTransform(rTextRangeTransform), mbUnlimitedPage(bUnlimitedPage), mbCellText(bCellText), @@ -290,7 +290,7 @@ namespace drawinglayer SdrTextPrimitive2D* SdrBlockTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const { - return new SdrBlockTextPrimitive2D(getSdrText(), rTransform * getTextRangeTransform(), getUnlimitedPage(), getCellText(), getWordWrap()); + return new SdrBlockTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * getTextRangeTransform(), getUnlimitedPage(), getCellText(), getWordWrap()); } // provide unique ID @@ -321,8 +321,9 @@ namespace drawinglayer SdrStretchTextPrimitive2D::SdrStretchTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, const ::basegfx::B2DHomMatrix& rTextRangeTransform) - : SdrTextPrimitive2D(rSdrText), + : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), maTextRangeTransform(rTextRangeTransform) { } @@ -341,7 +342,7 @@ namespace drawinglayer SdrTextPrimitive2D* SdrStretchTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const { - return new SdrStretchTextPrimitive2D(getSdrText(), rTransform * maTextRangeTransform); + return new SdrStretchTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * maTextRangeTransform); } // provide unique ID diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index fd86d0d861..73b4aa24b3 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -1430,7 +1430,7 @@ void SdrEditView::ImpDismantleOneObject(const SdrObject* pObj, SdrObjList& rOL, if(pLast && pSrcPath->GetOutlinerParaObject()) { - pLast->SetOutlinerParaObject(pSrcPath->GetOutlinerParaObject()->Clone()); + pLast->SetOutlinerParaObject(new OutlinerParaObject(*pSrcPath->GetOutlinerParaObject())); } } else if(pCustomShape) @@ -1469,7 +1469,7 @@ void SdrEditView::ImpDismantleOneObject(const SdrObject* pObj, SdrObjList& rOL, OutlinerParaObject* pParaObj = pCustomShape->GetOutlinerParaObject(); if(pParaObj) { - pTextObj->NbcSetOutlinerParaObject(pParaObj->Clone()); + pTextObj->NbcSetOutlinerParaObject(new OutlinerParaObject(*pParaObj)); } // copy all attributes diff --git a/svx/source/svdraw/svdfppt.cxx b/svx/source/svdraw/svdfppt.cxx index c7df32f05a..72ed6b1a3f 100644 --- a/svx/source/svdraw/svdfppt.cxx +++ b/svx/source/svdraw/svdfppt.cxx @@ -7551,7 +7551,7 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab { SdrText* pSdrText = pTable->getText( nTableIndex ); if ( pSdrText ) - pSdrText->SetOutlinerParaObject( pParaObject->Clone() ); + pSdrText->SetOutlinerParaObject(new OutlinerParaObject(*pParaObject) ); } } } diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 601ae1cf26..becf94e01e 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -93,6 +93,8 @@ // #95114# #include #include +#include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -346,11 +348,11 @@ SdrModel::~SdrModel() { // Pools loeschen, falls es meine sind SfxItemPool* pOutlPool=pItemPool->GetSecondaryPool(); - delete pItemPool; + SfxItemPool::Free(pItemPool); // Der OutlinerPool muss nach dem ItemPool plattgemacht werden, da der // ItemPool SetItems enthaelt die ihrerseits Items des OutlinerPools // referenzieren (Joe) - delete pOutlPool; + SfxItemPool::Free(pOutlPool); } if( mpForbiddenCharactersTable ) diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 823c1e032b..d866b4f600 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -2461,7 +2461,7 @@ void SdrObjCustomShape::SetVerticalWriting( sal_Bool bVertical ) if( pOutlinerParaObject ) { - if(pOutlinerParaObject->IsVertical() != bVertical) + if(pOutlinerParaObject->IsVertical() != (bool)bVertical) { // get item settings const SfxItemSet& rSet = GetObjectItemSet(); diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 1f934bf361..7aa383576f 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -613,8 +613,8 @@ void SdrObject::FreeGlobalDrawObjectItemPool() if(mpGlobalItemPool) { SfxItemPool* pGlobalOutlPool = mpGlobalItemPool->GetSecondaryPool(); - delete mpGlobalItemPool; - delete pGlobalOutlPool; + SfxItemPool::Free(mpGlobalItemPool); + SfxItemPool::Free(pGlobalOutlPool); } } diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 11332376f6..043b38957c 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1341,7 +1341,7 @@ void SdrTextObj::operator=(const SdrObject& rObj) } else { - pNewOutlinerParaObject = pTextObj->getActiveText()->GetOutlinerParaObject()->Clone(); + pNewOutlinerParaObject = new OutlinerParaObject(*pTextObj->getActiveText()->GetOutlinerParaObject()); } } @@ -1717,7 +1717,7 @@ void SdrTextObj::SetVerticalWriting(sal_Bool bVertical) pOutlinerParaObject = GetOutlinerParaObject(); } - if( pOutlinerParaObject && (pOutlinerParaObject->IsVertical() != bVertical) ) + if( pOutlinerParaObject && (pOutlinerParaObject->IsVertical() != (bool)bVertical) ) { // get item settings const SfxItemSet& rSet = GetObjectItemSet(); diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index ad667fa500..5d1fb9b3d1 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -662,7 +662,7 @@ bool SdrTextObj::impDecomposeContourTextPrimitive( rOutliner.SetPaperSize(aNullSize); rOutliner.SetPolygon(aPolyPolygon); rOutliner.SetUpdateMode(true); - rOutliner.SetText(*rSdrContourTextPrimitive.getSdrText().GetOutlinerParaObject()); + rOutliner.SetText(rSdrContourTextPrimitive.getOutlinerParaObject()); // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage())); @@ -729,9 +729,7 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( // add one to rage sizes to get back to the old Rectangle and outliner measurements const sal_uInt32 nAnchorTextWidth(FRound(aAnchorTextRange.getWidth() + 1L)); const sal_uInt32 nAnchorTextHeight(FRound(aAnchorTextRange.getHeight() + 1L)); - const OutlinerParaObject* pOutlinerParaObject = rSdrBlockTextPrimitive.getSdrText().GetOutlinerParaObject(); - OSL_ENSURE(pOutlinerParaObject, "impDecomposeBlockTextPrimitive used with no OutlinerParaObject (!)"); - const bool bVerticalWritintg(pOutlinerParaObject->IsVertical()); + const bool bVerticalWritintg(rSdrBlockTextPrimitive.getOutlinerParaObject().IsVertical()); const Size aAnchorTextSize(Size(nAnchorTextWidth, nAnchorTextHeight)); if(bIsCell) @@ -743,7 +741,7 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( rOutliner.SetPaperSize(aAnchorTextSize); rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0)); rOutliner.SetUpdateMode(TRUE); - rOutliner.SetText(*pOutlinerParaObject); + rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); rOutliner.SetUpdateMode(TRUE); rOutliner.SetControlWord(nOriginalControlWord); } @@ -766,7 +764,7 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( rOutliner.SetPaperSize(aNullSize); rOutliner.SetUpdateMode(true); - rOutliner.SetText(*pOutlinerParaObject); + rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); rOutliner.SetControlWord(nOriginalControlWord); } @@ -894,7 +892,7 @@ bool SdrTextObj::impDecomposeStretchTextPrimitive( rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000)); rOutliner.SetPaperSize(aNullSize); rOutliner.SetUpdateMode(true); - rOutliner.SetText(*rSdrStretchTextPrimitive.getSdrText().GetOutlinerParaObject()); + rOutliner.SetText(rSdrStretchTextPrimitive.getOutlinerParaObject()); // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage())); diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx index afaf763540..2d513942af 100644 --- a/svx/source/svdraw/svdtext.cxx +++ b/svx/source/svdraw/svdtext.cxx @@ -39,6 +39,8 @@ #include "svx/svdoutl.hxx" #include "svx/svdmodel.hxx" #include "svx/fhgtitem.hxx" +#include +#include SdrText::SdrText( SdrTextObj& rObject, OutlinerParaObject* pOutlinerParaObject /* = 0 */ ) : mpOutlinerParaObject( pOutlinerParaObject ) diff --git a/svx/source/svdraw/svdtxhdl.cxx b/svx/source/svdraw/svdtxhdl.cxx index b9d8edc855..d64dcad177 100644 --- a/svx/source/svdraw/svdtxhdl.cxx +++ b/svx/source/svdraw/svdtxhdl.cxx @@ -57,6 +57,7 @@ #include #include #include +#include using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index 9fed4c8c9a..a148269343 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -348,7 +348,7 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1, FASTBO { pTextUndo = pObj->GetOutlinerParaObject(); if(pTextUndo) - pTextUndo = pTextUndo->Clone(); + pTextUndo = new OutlinerParaObject(*pTextUndo); } } } @@ -409,7 +409,7 @@ void SdrUndoAttrObj::Undo() pTextRedo = pObj->GetOutlinerParaObject(); if(pTextRedo) - pTextRedo = pTextRedo->Clone(); + pTextRedo = new OutlinerParaObject(*pTextRedo); } } @@ -470,7 +470,7 @@ void SdrUndoAttrObj::Undo() if(pTextUndo) { - pObj->SetOutlinerParaObject(pTextUndo->Clone()); + pObj->SetOutlinerParaObject(new OutlinerParaObject(*pTextUndo)); } } @@ -540,7 +540,7 @@ void SdrUndoAttrObj::Redo() // #i8508# if(pTextRedo) { - pObj->SetOutlinerParaObject(pTextRedo->Clone()); + pObj->SetOutlinerParaObject(new OutlinerParaObject(*pTextRedo)); } } @@ -1096,7 +1096,7 @@ SdrUndoObjSetText::SdrUndoObjSetText(SdrObject& rNewObj, sal_Int32 nText) { SdrText* pText = static_cast< SdrTextObj*>( &rNewObj )->getText(mnText); if( pText && pText->GetOutlinerParaObject() ) - pOldText = pText->GetOutlinerParaObject()->Clone(); + pOldText = new OutlinerParaObject(*pText->GetOutlinerParaObject()); bEmptyPresObj = rNewObj.IsEmptyPresObj(); } @@ -1115,7 +1115,7 @@ void SdrUndoObjSetText::AfterSetText() { SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText); if( pText && pText->GetOutlinerParaObject() ) - pNewText = pText->GetOutlinerParaObject()->Clone(); + pNewText = new OutlinerParaObject(*pText->GetOutlinerParaObject()); bNewTextAvailable=TRUE; } } @@ -1132,7 +1132,7 @@ void SdrUndoObjSetText::Undo() // Text fuer Undo kopieren, denn SetOutlinerParaObject() ist Eigentumsuebereignung OutlinerParaObject* pText1 = pOldText; if(pText1) - pText1 = pText1->Clone(); + pText1 = new OutlinerParaObject(*pText1); SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText); if( pText ) @@ -1148,7 +1148,7 @@ void SdrUndoObjSetText::Redo() OutlinerParaObject* pText1 = pNewText; if(pText1) - pText1 = pText1->Clone(); + pText1 = new OutlinerParaObject(*pText1); SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText); if( pText ) @@ -1192,7 +1192,7 @@ void SdrUndoObjSetText::SdrRepeat(SdrView& rView) rView.AddUndo(new SdrUndoObjSetText(*pTextObj,0)); OutlinerParaObject* pText1=pNewText; if (pText1!=NULL) - pText1=pText1->Clone(); + pText1 = new OutlinerParaObject(*pText1); pTextObj->SetOutlinerParaObject(pText1); } } diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index 40e1456ffd..5571f2cedd 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -409,7 +409,7 @@ void Cell::replaceContentAndFormating( const CellRef& xSourceCell ) if( xSourceCell.is() && mpProperties ) { mpProperties->SetMergedItemSet( xSourceCell->GetObjectItemSet() ); - SetOutlinerParaObject( xSourceCell->GetOutlinerParaObject()->Clone() ); + SetOutlinerParaObject( new OutlinerParaObject(*xSourceCell->GetOutlinerParaObject()) ); SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() ); SdrTableObj& rSourceTableObj = dynamic_cast< SdrTableObj& >( xSourceCell->GetObject() ); @@ -509,10 +509,7 @@ const SfxItemSet& Cell::GetObjectItemSet() else { DBG_ERROR("Cell::GetObjectItemSet(), called without properties!"); - static UniString aEmptyStr; - static SfxItemPool aEmptyPool(aEmptyStr,0,0,0); - static SfxItemSet aSet(aEmptyPool); - return aSet; + return GetObject().GetObjectItemSet(); } } diff --git a/svx/source/table/tableundo.cxx b/svx/source/table/tableundo.cxx index a6c5ff1e3b..f4d6e89aec 100644 --- a/svx/source/table/tableundo.cxx +++ b/svx/source/table/tableundo.cxx @@ -132,7 +132,7 @@ void CellUndo::setDataToCell( const Data& rData ) mxCell->mpProperties = 0; if( rData.mpOutlinerParaObject ) - mxCell->SetOutlinerParaObject( rData.mpOutlinerParaObject->Clone() ); + mxCell->SetOutlinerParaObject( new OutlinerParaObject(*rData.mpOutlinerParaObject) ); else mxCell->RemoveOutlinerParaObject(); @@ -155,7 +155,7 @@ void CellUndo::getDataFromCell( Data& rData ) rData.mpProperties = mxCell->CloneProperties( *mxObjRef.get(), *mxCell.get()); if( mxCell->GetOutlinerParaObject() ) - rData.mpOutlinerParaObject = mxCell->GetOutlinerParaObject()->Clone(); + rData.mpOutlinerParaObject = new OutlinerParaObject(*mxCell->GetOutlinerParaObject()); else rData.mpOutlinerParaObject = 0; diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx index 3cfd6d26f8..78a0f885f9 100644 --- a/svx/source/unodraw/unopool.cxx +++ b/svx/source/unodraw/unopool.cxx @@ -73,7 +73,7 @@ SvxUnoDrawPool::SvxUnoDrawPool( SdrModel* pModel ) throw() SvxUnoDrawPool::~SvxUnoDrawPool() throw() { - delete mpDefaultsPool; + SfxItemPool::Free(mpDefaultsPool); } void SvxUnoDrawPool::init() diff --git a/svx/source/unoedit/unotext.cxx b/svx/source/unoedit/unotext.cxx index e927aa33f9..aed1e631b2 100644 --- a/svx/source/unoedit/unotext.cxx +++ b/svx/source/unoedit/unotext.cxx @@ -2496,9 +2496,10 @@ String SvxDummyTextSource::GetText( const ESelection& ) const SfxItemSet SvxDummyTextSource::GetAttribs( const ESelection&, BOOL ) const { - String aDummyStr(RTL_CONSTASCII_USTRINGPARAM("Dummy")); - SfxItemPool aPool(aDummyStr,0,0,NULL); - return SfxItemSet(aPool); + // AW: Very dangerous: The former implementation used a SfxItemPool created on the + // fly which of course was deleted again ASAP. Thus, the returned SfxItemSet was using + // a deleted Pool by design. + return SfxItemSet(SdrObject::GetGlobalDrawObjectItemPool()); } SfxItemSet SvxDummyTextSource::GetParaAttribs( sal_uInt16 ) const diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index dd457697c9..882a4a0a98 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -120,7 +120,7 @@ XPropertyTable::~XPropertyTable() // Eigener Pool wird geloescht if( bOwnPool && pXPool ) { - delete pXPool; + SfxItemPool::Free(pXPool); } } @@ -352,7 +352,7 @@ XPropertyList::~XPropertyList() if( bOwnPool && pXPool ) { - delete pXPool; + SfxItemPool::Free(pXPool); } } -- cgit v1.2.3