diff options
author | mb93783 <mb93783@v60x-so15.Germany.Sun.COM> | 2009-12-02 12:43:33 +0100 |
---|---|---|
committer | mb93783 <mb93783@v60x-so15.Germany.Sun.COM> | 2009-12-02 12:43:33 +0100 |
commit | 726f87d603a38c988a8425d42f023b03bda725b1 (patch) | |
tree | 9aabbedb96a77bdd8401334b9df4c30d9319dcad /svx | |
parent | 39cb219b68d81efc454d1860d6b3c42b204c1eb5 (diff) | |
parent | ef1ec7001a06a6ba0fdbed702bcd7a6fec58eaf9 (diff) |
merge to m66
Diffstat (limited to 'svx')
23 files changed, 534 insertions, 373 deletions
diff --git a/svx/inc/svx/fmmodel.hxx b/svx/inc/svx/fmmodel.hxx index 2f61967bc3ac..f831729b5006 100644 --- a/svx/inc/svx/fmmodel.hxx +++ b/svx/inc/svx/fmmodel.hxx @@ -89,14 +89,16 @@ public: /** check whether the OpenInDesignMode has been set explicitly or been loaded (<FALSE/>) or if it still has the default value from construction (<TRUE/>) */ - sal_Bool OpenInDesignModeIsDefaulted( ); + sal_Bool OpenInDesignModeIsDefaulted(); -//#if 0 // _SOLAR__PRIVATE - void implSetOpenInDesignMode( sal_Bool _bOpenDesignMode, sal_Bool _bForce ); + /** determines whether form controls should use the SdrModel's reference device for text rendering + */ + sal_Bool ControlsUseRefDevice() const; FmXUndoEnvironment& GetUndoEnv(); -//#endif +private: + void implSetOpenInDesignMode( sal_Bool _bOpenDesignMode, sal_Bool _bForce ); }; #endif // _FM_FMMODEL_HXX diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx index 4eddc4386a0d..8f7f0eb23cb3 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx @@ -56,8 +56,13 @@ namespace drawinglayer // defines if SdrTextWordWrapItem was set at SdrObjCustomShape which means // that the text needs to be block formatted unsigned mbWordWrap : 1; - // #SJ# Allow text clipping against TextBox in special cases (used for SC)
- unsigned mbForceTextClipToTextRange : 1;
+ + // #SJ# Allow text clipping against TextBox in special cases (used for SC) + unsigned mbForceTextClipToTextRange : 1; + + // defines that the object contains/is a 3D AutoShape. Needed for + // making exceptions with shadow generation + unsigned mb3DShape : 1; protected: // local decomposition. @@ -69,7 +74,8 @@ namespace drawinglayer const Primitive2DSequence& rSubPrimitives, const basegfx::B2DHomMatrix& rTextBox, bool bWordWrap, - bool bForceTextClipToTextRange); + bool bForceTextClipToTextRange, + bool b3DShape); // data access const attribute::SdrShadowTextAttribute& getSdrSTAttribute() const { return maSdrSTAttribute; } @@ -77,6 +83,7 @@ namespace drawinglayer const basegfx::B2DHomMatrix& getTextBox() const { return maTextBox; } bool getWordWrap() const { return mbWordWrap; } bool isForceTextClipToTextRange() const { return mbForceTextClipToTextRange; } + bool get3DShape() const { return mb3DShape; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx index 70e28d599a44..9ee4f3f69417 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx @@ -53,6 +53,11 @@ namespace drawinglayer SdrObjectWeakRef mpSdrOle2Obj; basegfx::B2DHomMatrix maObjectTransform; + // #i104867# The GraphicVersion number to identify in operator== if + // the graphic has changed, but without fetching it (which may + // be expensive, e.g. triggering chart creation) + sal_uInt32 mnGraphicVersion; + // bitfield unsigned mbHighContrast : 1; @@ -64,6 +69,7 @@ namespace drawinglayer SdrOleContentPrimitive2D( const SdrOle2Obj& rSdrOle2Obj, const basegfx::B2DHomMatrix& rObjectTransform, + sal_uInt32 nGraphicVersion, bool bHighContrast); // compare operator @@ -74,6 +80,7 @@ namespace drawinglayer // data access const basegfx::B2DHomMatrix& getObjectTransform() const { return maObjectTransform; } + sal_uInt32 getGraphicVersion() const { return mnGraphicVersion; } bool getHighContrast() const { return mbHighContrast; } // provide unique ID diff --git a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx index 650cc1a882c5..23bbc2676f22 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx @@ -55,9 +55,8 @@ namespace drawinglayer double mfCornerRadiusY; // [0.0..1.0] relative to 1/2 height // bitfield - // flag which decides if this is a text frame. If Yes, the HitArea - // should be the filled geometry - bool mbTextFrame : 1; + // flag which decides if the HitArea should be the filled geometry + bool mbForceFillForHitTest : 1; protected: // local decomposition. @@ -69,7 +68,7 @@ namespace drawinglayer const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, double fCornerRadiusX, double fCornerRadiusY, - bool bTextFrame); + bool bForceFillForHitTest); // data access const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } @@ -77,7 +76,7 @@ namespace drawinglayer double getCornerRadiusX() const { return mfCornerRadiusX; } double getCornerRadiusY() const { return mfCornerRadiusY; } bool isCornerRadiusUsed() const { return (0.0 != mfCornerRadiusX || 0.0 != mfCornerRadiusY); } - bool getTextFrame() const { return mbTextFrame; } + bool getForceFillForHitTest() const { return mbForceFillForHitTest; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/svx/inc/svx/svddrgmt.hxx b/svx/inc/svx/svddrgmt.hxx index fa4e09c9a324..91112a7dd287 100644 --- a/svx/inc/svx/svddrgmt.hxx +++ b/svx/inc/svx/svddrgmt.hxx @@ -107,6 +107,22 @@ public: ////////////////////////////////////////////////////////////////////////////// +class SdrDragEntryPrimitive2DSequence : public SdrDragEntry +{ +private: + drawinglayer::primitive2d::Primitive2DSequence maPrimitive2DSequence; + +public: + SdrDragEntryPrimitive2DSequence( + const drawinglayer::primitive2d::Primitive2DSequence& rSequence, + bool bAddToTransparent); + virtual ~SdrDragEntryPrimitive2DSequence(); + + virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod); +}; + +////////////////////////////////////////////////////////////////////////////// + class SdrDragEntryPointGlueDrag : public SdrDragEntry { private: @@ -138,6 +154,7 @@ protected: void clearSdrDragEntries() { for(sal_uInt32 a(0); a < maSdrDragEntries.size(); a++) { delete maSdrDragEntries[a]; } maSdrDragEntries.clear(); } void addSdrDragEntry(SdrDragEntry* pNew) { if(pNew) { maSdrDragEntries.push_back(pNew); }} virtual void createSdrDragEntries(); + virtual void createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify); // access for derivated classes to maOverlayObjectList void clearOverlayObjectList() { maOverlayObjectList.clear(); } @@ -236,6 +253,9 @@ private: void ImpCheckSnap(const Point& rPt); +protected: + virtual void createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify); + public: TYPEINFO(); SdrDragMove(SdrDragView& rNewView); diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 2d5b12ff7129..940b882f2e7c 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -695,7 +695,16 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) : ClearItem( SDRATTR_TEXTDIRECTION ); //SJ: vertical writing is not required, by removing this item no outliner is created - // For primitive rendering, shadow handling is done completely based on the geometry, so i removed it here + // #i105323# For 2D AtoShapes, the shadow attirbute does not need to be applied to any + // of the constucted helper SdrObjects. This would lead to problems since the shadow + // of one helper object would fall on one helper object behind it (e.g. with the + // eyes of the smiley shape). This is not wanted; instead a single shadow 'behind' + // the AutoShape visualisation is wanted. This is done with primitive functionailty + // now in SdrCustomShapePrimitive2D::create2DDecomposition, but only for 2D objects + // (see there and in EnhancedCustomShape3d::Create3DObject to read more). + // This exception may be removed later when AutoShapes will create primitives directly. + // So, currently remove the ShadowAttribute from the ItemSet to not apply it to any + // 2D helper shape. ClearItem(SDRATTR_SHADOW); Point aP( pCustomShapeObj->GetSnapRect().Center() ); @@ -730,23 +739,23 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) : /*const sal_Int32* pDefData =*/ ApplyShapeAttributes( rGeometryItem ); switch( eSpType ) { - case mso_sptCan : nColorData = 0x20400000; break;
- case mso_sptCube : nColorData = 0x302e0000; break;
- case mso_sptActionButtonBlank : nColorData = 0x502ce400; break;
- case mso_sptActionButtonHome : nColorData = 0x702ce4ce; break;
- case mso_sptActionButtonHelp : nColorData = 0x602ce4c0; break;
- case mso_sptActionButtonInformation : nColorData = 0x702ce4c5; break;
- case mso_sptActionButtonBackPrevious : nColorData = 0x602ce4c0; break;
- case mso_sptActionButtonForwardNext : nColorData = 0x602ce4c0; break;
- case mso_sptActionButtonBeginning : nColorData = 0x602ce4c0; break;
- case mso_sptActionButtonEnd : nColorData = 0x602ce4c0; break;
- case mso_sptActionButtonReturn : nColorData = 0x602ce4c0; break;
- case mso_sptActionButtonDocument : nColorData = 0x702ce4ec; break;
- case mso_sptActionButtonSound : nColorData = 0x602ce4c0; break;
- case mso_sptActionButtonMovie : nColorData = 0x602ce4c0; break;
- case mso_sptBevel : nColorData = 0x502ce400; break;
- case mso_sptFoldedCorner : nColorData = 0x20e00000; break;
- case mso_sptSmileyFace : nColorData = 0x20e00000; break;
+ case mso_sptCan : nColorData = 0x20400000; break; + case mso_sptCube : nColorData = 0x302e0000; break; + case mso_sptActionButtonBlank : nColorData = 0x502ce400; break; + case mso_sptActionButtonHome : nColorData = 0x702ce4ce; break; + case mso_sptActionButtonHelp : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonInformation : nColorData = 0x702ce4c5; break; + case mso_sptActionButtonBackPrevious : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonForwardNext : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonBeginning : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonEnd : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonReturn : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonDocument : nColorData = 0x702ce4ec; break; + case mso_sptActionButtonSound : nColorData = 0x602ce4c0; break; + case mso_sptActionButtonMovie : nColorData = 0x602ce4c0; break; + case mso_sptBevel : nColorData = 0x502ce400; break; + case mso_sptFoldedCorner : nColorData = 0x20e00000; break; + case mso_sptSmileyFace : nColorData = 0x20e00000; break; case mso_sptNil : { if( sShapeType.getLength() > 4 && @@ -1700,6 +1709,19 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm if(aNewB2DPolyPolygon.count()) { + if( !bLineGeometryNeededOnly ) + { + // hack aNewB2DPolyPolygon to fill logic rect - this is + // needed to produce gradient fills that look like mso + aNewB2DPolygon.clear(); + aNewB2DPolygon.append(basegfx::B2DPoint(0,0)); + aNewB2DPolyPolygon.append(aNewB2DPolygon); + + aNewB2DPolygon.clear(); + aNewB2DPolygon.append(basegfx::B2DPoint(aLogicRect.GetWidth(), + aLogicRect.GetHeight())); + aNewB2DPolyPolygon.append(aNewB2DPolygon); + } // #i37011# bool bForceCreateTwoObjects(false); diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index 16074f3ce3cc..63759e1dc4b9 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -323,7 +323,17 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con Point aCenter( aSnapRect.Center() ); SfxItemSet aSet( pCustomShape->GetMergedItemSet() ); - aSet.ClearItem( SDRATTR_TEXTDIRECTION ); //SJ: vertical writing is not required, by removing this item no outliner is created + + //SJ: vertical writing is not required, by removing this item no outliner is created + aSet.ClearItem( SDRATTR_TEXTDIRECTION ); + + // #i105323# For 3D AutoShapes, the shadow attribute has to be applied to each + // created visualisation helper model shape individually. The shadow itself + // will then be rendered from the 3D renderer correctly for the whole 3D scene + // (and thus behind all objects of which the visualisation may be built). So, + // dio NOT remove it from the ItemSet here. + // aSet.ClearItem(SDRATTR_SHADOW); + std::vector< E3dCompoundObject* > aPlaceholderObjectList; double fExtrusionBackward, fExtrusionForward; diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx index 821c0ba07c32..ad70d3399c8f 100644 --- a/svx/source/engine3d/helperhittest3d.cxx +++ b/svx/source/engine3d/helperhittest3d.cxx @@ -36,18 +36,10 @@ #include <svx/svdpage.hxx> #include <svx/scene3d.hxx> #include <svditer.hxx> -#include <drawinglayer/processor3d/baseprocessor3d.hxx> -#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> -#include <drawinglayer/primitive3d/transformprimitive3d.hxx> -#include <drawinglayer/primitive3d/polygonprimitive3d.hxx> -#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx> +#include <drawinglayer/processor3d/cutfindprocessor3d.hxx> #include <svx/sdr/contact/viewcontactofe3d.hxx> #include <svx/sdr/contact/viewcontactofe3dscene.hxx> -#include <basegfx/polygon/b3dpolygontools.hxx> -#include <basegfx/polygon/b3dpolypolygontools.hxx> -#include <drawinglayer/primitive3d/hittestprimitive3d.hxx> #include <com/sun/star/uno/Sequence.h> -#include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -80,176 +72,13 @@ public: ////////////////////////////////////////////////////////////////////////////// -namespace drawinglayer -{ - namespace processor3d - { - class CutFindProcessor : public BaseProcessor3D - { - private: - // the start and stop point for the cut vector - basegfx::B3DPoint maFront; - basegfx::B3DPoint maBack; - - // the found cut points - ::std::vector< basegfx::B3DPoint > maResult; - - // #i102956# the transformation change from TransformPrimitive3D processings - // needs to be remembered to be able to transform found cuts to the - // basic coordinate system the processor starts with - basegfx::B3DHomMatrix maCombinedTransform; - - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. - virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); - - public: - CutFindProcessor(const geometry::ViewInformation3D& rViewInformation, - const basegfx::B3DPoint& rFront, - const basegfx::B3DPoint& rBack) - : BaseProcessor3D(rViewInformation), - maFront(rFront), - maBack(rBack), - maResult(), - maCombinedTransform() - {} - - // data access - const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return maResult; } - }; - - void CutFindProcessor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) - { - // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch - switch(rCandidate.getPrimitiveID()) - { - case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D : - { - // transform group. - const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(rCandidate); - - // remember old and transform front, back to object coordinates - const basegfx::B3DPoint aLastFront(maFront); - const basegfx::B3DPoint aLastBack(maBack); - basegfx::B3DHomMatrix aInverseTrans(rPrimitive.getTransformation()); - aInverseTrans.invert(); - maFront *= aInverseTrans; - maBack *= aInverseTrans; - - // remember current and create new transformation; add new object transform from right side - const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D()); - const geometry::ViewInformation3D aNewViewInformation3D( - aLastViewInformation3D.getObjectTransformation() * rPrimitive.getTransformation(), - aLastViewInformation3D.getOrientation(), - aLastViewInformation3D.getProjection(), - aLastViewInformation3D.getDeviceToView(), - aLastViewInformation3D.getViewTime(), - aLastViewInformation3D.getExtendedInformationSequence()); - updateViewInformation(aNewViewInformation3D); - - // #i102956# remember needed back-transform for found cuts (combine from right side) - const basegfx::B3DHomMatrix aLastCombinedTransform(maCombinedTransform); - maCombinedTransform = maCombinedTransform * rPrimitive.getTransformation(); - - // let break down - process(rPrimitive.getChildren()); - - // restore transformations and front, back - maCombinedTransform = aLastCombinedTransform; - updateViewInformation(aLastViewInformation3D); - maFront = aLastFront; - maBack = aLastBack; - break; - } - case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D : - { - // PolygonHairlinePrimitive3D, not used for hit test with planes, ignore. This - // means that also thick line expansion will not be hit-tested as - // PolyPolygonMaterialPrimitive3D - break; - } - case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D : - { - // #i97321# - // For HatchTexturePrimitive3D, do not use the decomposition since it will produce - // clipped hatch lines in 3D. It can be used when the hatch also has a filling, but for - // simplicity, just use the children which are the PolyPolygonMaterialPrimitive3D - // which define the hatched areas anyways; for HitTest this is more than adequate - const primitive3d::HatchTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::HatchTexturePrimitive3D& >(rCandidate); - process(rPrimitive.getChildren()); - break; - } - case PRIMITIVE3D_ID_HITTESTPRIMITIVE3D : - { - // HitTestPrimitive3D, force usage due to we are doing a hit test and this - // primitive only gets generated on 3d objects without fill, exactly for this - // purpose - const primitive3d::HitTestPrimitive3D& rPrimitive = static_cast< const primitive3d::HitTestPrimitive3D& >(rCandidate); - process(rPrimitive.getChildren()); - break; - } - case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D : - { - // PolyPolygonMaterialPrimitive3D - const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rCandidate); - - if(!maFront.equal(maBack)) - { - const basegfx::B3DPolyPolygon& rPolyPolygon = rPrimitive.getB3DPolyPolygon(); - const sal_uInt32 nPolyCount(rPolyPolygon.count()); - - if(nPolyCount) - { - const basegfx::B3DPolygon aPolygon(rPolyPolygon.getB3DPolygon(0)); - const sal_uInt32 nPointCount(aPolygon.count()); - - if(nPointCount > 2) - { - const basegfx::B3DVector aPlaneNormal(aPolygon.getNormal()); - - if(!aPlaneNormal.equalZero()) - { - const basegfx::B3DPoint aPointOnPlane(aPolygon.getB3DPoint(0)); - double fCut(0.0); - - if(basegfx::tools::getCutBetweenLineAndPlane(aPlaneNormal, aPointOnPlane, maFront, maBack, fCut)) - { - const basegfx::B3DPoint aCutPoint(basegfx::interpolate(maFront, maBack, fCut)); - - if(basegfx::tools::isInside(rPolyPolygon, aCutPoint, false)) - { - // #i102956# add result. Do not forget to do this in the coordinate - // system the processor get started with, so use the collected - // combined transformation from processed TransformPrimitive3D's - maResult.push_back(maCombinedTransform * aCutPoint); - } - } - } - } - } - } - - break; - } - default : - { - // process recursively - process(rCandidate.get3DDecomposition(getViewInformation3D())); - break; - } - } - } - } // end of namespace processor3d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - void getAllHit3DObjectWithRelativePoint( const basegfx::B3DPoint& rFront, const basegfx::B3DPoint& rBack, const E3dCompoundObject& rObject, const drawinglayer::geometry::ViewInformation3D& rObjectViewInformation3D, - ::std::vector< basegfx::B3DPoint >& o_rResult) + ::std::vector< basegfx::B3DPoint >& o_rResult, + bool bAnyHit) { o_rResult.clear(); @@ -271,7 +100,7 @@ void getAllHit3DObjectWithRelativePoint( if(aObjectRange.overlaps(aFrontBackRange)) { // bound volumes hit, geometric cut tests needed - drawinglayer::processor3d::CutFindProcessor aCutFindProcessor(rObjectViewInformation3D, rFront, rBack); + drawinglayer::processor3d::CutFindProcessor aCutFindProcessor(rObjectViewInformation3D, rFront, rBack, bAnyHit); aCutFindProcessor.process(aPrimitives); o_rResult = aCutFindProcessor.getCutPoints(); } @@ -388,7 +217,7 @@ SVX_DLLPUBLIC void getAllHit3DObjectsSortedFrontToBack( { // get all hit points with object ::std::vector< basegfx::B3DPoint > aHitsWithObject; - getAllHit3DObjectWithRelativePoint(aFront, aBack, *pCandidate, aViewInfo3D, aHitsWithObject); + getAllHit3DObjectWithRelativePoint(aFront, aBack, *pCandidate, aViewInfo3D, aHitsWithObject, false); for(sal_uInt32 a(0); a < aHitsWithObject.size(); a++) { @@ -452,7 +281,7 @@ bool checkHitSingle3DObject( { // get all hit points with object ::std::vector< basegfx::B3DPoint > aHitsWithObject; - getAllHit3DObjectWithRelativePoint(aFront, aBack, rCandidate, aViewInfo3D, aHitsWithObject); + getAllHit3DObjectWithRelativePoint(aFront, aBack, rCandidate, aViewInfo3D, aHitsWithObject, true); if(aHitsWithObject.size()) { diff --git a/svx/source/form/fmcontrollayout.cxx b/svx/source/form/fmcontrollayout.cxx index 92e987db796c..9748426c0b26 100644 --- a/svx/source/form/fmcontrollayout.cxx +++ b/svx/source/form/fmcontrollayout.cxx @@ -30,17 +30,28 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" + #include "fmcontrollayout.hxx" -#ifndef _SVX_FMPROP_HRC #include "fmprop.hrc" -#endif /** === begin UNO includes === **/ #include <com/sun/star/form/FormComponentType.hpp> #include <com/sun/star/awt/VisualEffect.hpp> +#include <com/sun/star/i18n/ScriptType.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/awt/FontDescriptor.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XChild.hpp> /** === end UNO includes === **/ -#include <tools/debug.hxx> + #include <comphelper/processfactory.hxx> +#include <i18npool/mslangid.hxx> +#include <svtools/syslocale.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <tools/debug.hxx> +#include <tools/diagnose_ex.h> +#include <vcl/outdev.hxx> //........................................................................ namespace svxform @@ -48,15 +59,171 @@ namespace svxform //........................................................................ using namespace ::utl; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::form; + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::beans::XPropertySet; + using ::com::sun::star::beans::XPropertySetInfo; + using ::com::sun::star::lang::Locale; + using ::com::sun::star::awt::FontDescriptor; + using ::com::sun::star::style::XStyleFamiliesSupplier; + using ::com::sun::star::lang::XServiceInfo; + using ::com::sun::star::container::XNameAccess; + using ::com::sun::star::container::XChild; + /** === end UNO using === **/ + namespace FormComponentType = ::com::sun::star::form::FormComponentType; + namespace VisualEffect = ::com::sun::star::awt::VisualEffect; + namespace ScriptType = ::com::sun::star::i18n::ScriptType; + + //-------------------------------------------------------------------- + namespace + { + //.................................................................... + template< class INTERFACE_TYPE > + Reference< INTERFACE_TYPE > getTypedModelNode( const Reference< XInterface >& _rxModelNode ) + { + Reference< INTERFACE_TYPE > xTypedNode( _rxModelNode, UNO_QUERY ); + if ( xTypedNode.is() ) + return xTypedNode; + else + { + Reference< XChild > xChild( _rxModelNode, UNO_QUERY ); + if ( xChild.is() ) + return getTypedModelNode< INTERFACE_TYPE >( xChild->getParent() ); + else + return NULL; + } + } + + //.................................................................... + static bool lcl_getDocumentDefaultStyleAndFamily( const Reference< XInterface >& _rxDocument, ::rtl::OUString& _rFamilyName, ::rtl::OUString& _rStyleName ) SAL_THROW(( Exception )) + { + bool bSuccess = true; + Reference< XServiceInfo > xDocumentSI( _rxDocument, UNO_QUERY ); + if ( xDocumentSI.is() ) + { + if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ) ) + || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.WebDocument" ) ) ) + ) + { + _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) ); + _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); + } + else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) ) ) ) + { + _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellStyles" ) ); + _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Default" ) ); + } + else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ) + || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) + ) + { + _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) ); + _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "standard" ) ); + } + else + bSuccess = false; + } + return bSuccess; + } + + //.................................................................... + static void lcl_initializeControlFont( const Reference< XPropertySet >& _rxModel ) + { + try + { + Reference< XPropertySet > xStyle( ControlLayouter::getDefaultDocumentTextStyle( _rxModel ), UNO_SET_THROW ); + Reference< XPropertySetInfo > xStylePSI( xStyle->getPropertySetInfo(), UNO_SET_THROW ); + + // determine the script type associated with the system locale + const LocaleDataWrapper& rSysLocaleData = SvtSysLocale().GetLocaleData(); + const sal_Int16 eSysLocaleScriptType = MsLangId::getScriptType( MsLangId::convertLocaleToLanguage( rSysLocaleData.getLocale() ) ); + + // depending on this script type, use the right property from the document's style which controls the + // default locale for document content + const sal_Char* pCharLocalePropertyName = "CharLocale"; + switch ( eSysLocaleScriptType ) + { + case ScriptType::LATIN: + // already defaulted above + break; + case ScriptType::ASIAN: + pCharLocalePropertyName = "CharLocaleAsian"; + break; + case ScriptType::COMPLEX: + pCharLocalePropertyName = "CharLocaleComplex"; + break; + default: + OSL_ENSURE( false, "lcl_initializeControlFont: unexpected script type for system locale!" ); + break; + } + + ::rtl::OUString sCharLocalePropertyName = ::rtl::OUString::createFromAscii( pCharLocalePropertyName ); + Locale aDocumentCharLocale; + if ( xStylePSI->hasPropertyByName( sCharLocalePropertyName ) ) + { + OSL_VERIFY( xStyle->getPropertyValue( sCharLocalePropertyName ) >>= aDocumentCharLocale ); + } + // fall back to CharLocale property at the style + if ( !aDocumentCharLocale.Language.getLength() ) + { + sCharLocalePropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharLocale" ) ); + if ( xStylePSI->hasPropertyByName( sCharLocalePropertyName ) ) + { + OSL_VERIFY( xStyle->getPropertyValue( sCharLocalePropertyName ) >>= aDocumentCharLocale ); + } + } + // fall back to the system locale + if ( !aDocumentCharLocale.Language.getLength() ) + { + aDocumentCharLocale = rSysLocaleData.getLocale(); + } + + // retrieve a default font for this locale, and set it at the control + Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_SANS, MsLangId::convertLocaleToLanguage( aDocumentCharLocale ), DEFAULTFONT_FLAGS_ONLYONE ); + FontDescriptor aFontDesc = VCLUnoHelper::CreateFontDescriptor( aFont ); + _rxModel->setPropertyValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontDescriptor" ) ), + makeAny( aFontDesc ) + ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } //==================================================================== //= ControlLayouter //==================================================================== //-------------------------------------------------------------------- + Reference< XPropertySet > ControlLayouter::getDefaultDocumentTextStyle( const Reference< XPropertySet >& _rxModel ) + { + // the style family collection + Reference< XStyleFamiliesSupplier > xSuppStyleFamilies( getTypedModelNode< XStyleFamiliesSupplier >( _rxModel.get() ), UNO_SET_THROW ); + Reference< XNameAccess > xStyleFamilies( xSuppStyleFamilies->getStyleFamilies(), UNO_SET_THROW ); + + // the names of the family, and the style - depends on the document type we live in + ::rtl::OUString sFamilyName, sStyleName; + if ( !lcl_getDocumentDefaultStyleAndFamily( xSuppStyleFamilies.get(), sFamilyName, sStyleName ) ) + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unknown document type!" ) ), NULL ); + + // the concrete style + Reference< XNameAccess > xStyleFamily( xStyleFamilies->getByName( sFamilyName ), UNO_QUERY_THROW ); + return Reference< XPropertySet >( xStyleFamily->getByName( sStyleName ), UNO_QUERY_THROW ); + } + + //-------------------------------------------------------------------- void ControlLayouter::initializeControlLayout( const Reference< XPropertySet >& _rxControlModel, DocumentType _eDocType ) { DBG_ASSERT( _rxControlModel.is(), "ControlLayouter::initializeControlLayout: invalid model!" ); @@ -65,10 +232,7 @@ namespace svxform try { - Reference< XPropertySetInfo > xPSI( _rxControlModel->getPropertySetInfo() ); - if ( !xPSI.is() ) - // can't do anything - return; + Reference< XPropertySetInfo > xPSI( _rxControlModel->getPropertySetInfo(), UNO_SET_THROW ); // the control type sal_Int16 nClassId = FormComponentType::CONTROL; @@ -114,6 +278,13 @@ namespace svxform if ( xPSI->hasPropertyByName( FM_PROP_VISUALEFFECT ) ) _rxControlModel->setPropertyValue( FM_PROP_VISUALEFFECT, makeAny( nVisualEffect ) ); } + + // the font (only if we use the document's ref devices for rendering control text, otherwise, the + // default font of VCL controls is assumed to be fine) + if ( useDocumentReferenceDevice( _eDocType ) + && xPSI->hasPropertyByName( FM_PROP_FONT ) + ) + lcl_initializeControlFont( _rxControlModel ); } catch( const Exception& ) { @@ -141,6 +312,18 @@ namespace svxform return bDynamicBorderColor; } + //-------------------------------------------------------------------- + bool ControlLayouter::useDocumentReferenceDevice( DocumentType _eDocType ) + { + if ( _eDocType == eUnknownDocumentType ) + return false; + OConfigurationNode aConfig = getLayoutSettings( _eDocType ); + Any aUseRefDevice = aConfig.getNodeValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentTextMetrics" ) ) ); + bool bUseRefDevice = false; + OSL_VERIFY( aUseRefDevice >>= bUseRefDevice ); + return bUseRefDevice; + } + //........................................................................ } // namespace svxform //........................................................................ diff --git a/svx/source/form/fmmodel.cxx b/svx/source/form/fmmodel.cxx index 09008ae220b9..a09d0f78173a 100644 --- a/svx/source/form/fmmodel.cxx +++ b/svx/source/form/fmmodel.cxx @@ -30,30 +30,27 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" + +#include "fmundo.hxx" +#include "fmdocumentclassification.hxx" +#include "fmcontrollayout.hxx" + +#include <svx/fmmodel.hxx> +#include <svx/fmpage.hxx> +#include <svx/svdobj.hxx> #include <tools/debug.hxx> #ifndef SVX_LIGHT -#ifndef _SFX_OBJSH_HXX //autogen #include <sfx2/objsh.hxx> -#endif #else class SfxObjectShell; #endif -#ifndef _FM_FMMODEL_HXX -#include <svx/fmmodel.hxx> -#endif - -#ifndef _FM_PAGE_HXX -#include <svx/fmpage.hxx> -#endif -#include "fmundo.hxx" -#ifndef _SVX_SVDOBJ_HXX -#include <svx/svdobj.hxx> -#endif +#include <boost/optional.hpp> using ::com::sun::star::uno::Reference; using ::com::sun::star::container::XNameContainer; +using namespace svxform; TYPEINIT1(FmFormModel, SdrModel); @@ -62,11 +59,14 @@ struct FmFormModelImplData FmXUndoEnvironment* pUndoEnv; sal_Bool bOpenInDesignIsDefaulted; sal_Bool bMovingPage; + ::boost::optional< sal_Bool > + aControlsUseRefDevice; FmFormModelImplData() :pUndoEnv( NULL ) ,bOpenInDesignIsDefaulted( sal_True ) ,bMovingPage( sal_False ) + ,aControlsUseRefDevice() { } }; @@ -314,6 +314,19 @@ sal_Bool FmFormModel::OpenInDesignModeIsDefaulted( ) #endif //------------------------------------------------------------------------ +sal_Bool FmFormModel::ControlsUseRefDevice() const +{ + if ( !m_pImpl->aControlsUseRefDevice ) + { + DocumentType eDocType = eUnknownDocumentType; + if ( m_pObjShell ) + eDocType = DocumentClassification::classifyHostDocument( m_pObjShell->GetModel() ); + m_pImpl->aControlsUseRefDevice.reset( ControlLayouter::useDocumentReferenceDevice( eDocType ) ); + } + return *m_pImpl->aControlsUseRefDevice; +} + +//------------------------------------------------------------------------ void FmFormModel::SetAutoControlFocus( sal_Bool _bAutoControlFocus ) { #ifndef SVX_LIGHT diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 1b03be62d019..691acb8a33e4 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -81,6 +81,10 @@ FmFormObj::FmFormObj(const ::rtl::OUString& rModelName,sal_Int32 _nType) ,m_pLastKnownRefDevice ( NULL ) { DBG_CTOR(FmFormObj, NULL); + + // normally, this is done in SetUnoControlModel, but if the call happened in the base class ctor, + // then our incarnation of it was not called (since we were not constructed at this time). + impl_checkRefDevice_nothrow( true ); } //------------------------------------------------------------------ @@ -124,6 +128,45 @@ void FmFormObj::ClearObjEnv() } //------------------------------------------------------------------ +void FmFormObj::impl_checkRefDevice_nothrow( bool _force ) +{ + const FmFormModel* pFormModel = PTR_CAST( FmFormModel, GetModel() ); + if ( !pFormModel || !pFormModel->ControlsUseRefDevice() ) + return; + + OutputDevice* pCurrentRefDevice = pFormModel ? pFormModel->GetRefDevice() : NULL; + if ( ( m_pLastKnownRefDevice == pCurrentRefDevice ) && !_force ) + return; + + Reference< XControlModel > xControlModel( GetUnoControlModel() ); + if ( !xControlModel.is() ) + return; + + m_pLastKnownRefDevice = pCurrentRefDevice; + if ( m_pLastKnownRefDevice == NULL ) + return; + + try + { + Reference< XPropertySet > xModelProps( GetUnoControlModel(), UNO_QUERY_THROW ); + Reference< XPropertySetInfo > xPropertyInfo( xModelProps->getPropertySetInfo(), UNO_SET_THROW ); + + static const ::rtl::OUString sRefDevicePropName( RTL_CONSTASCII_USTRINGPARAM( "ReferenceDevice" ) ); + if ( xPropertyInfo->hasPropertyByName( sRefDevicePropName ) ) + { + VCLXDevice* pUnoRefDevice = new VCLXDevice; + pUnoRefDevice->SetOutputDevice( m_pLastKnownRefDevice ); + Reference< XDevice > xRefDevice( pUnoRefDevice ); + xModelProps->setPropertyValue( sRefDevicePropName, makeAny( xRefDevice ) ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//------------------------------------------------------------------ void FmFormObj::impl_isolateControlModel_nothrow() { try @@ -360,38 +403,10 @@ SdrObject* FmFormObj::Clone() const } //------------------------------------------------------------------ -void FmFormObj::ReformatText() +void FmFormObj::NbcReformatText() { - const FmFormModel* pFormModel = PTR_CAST( FmFormModel, GetModel() ); - OutputDevice* pCurrentRefDevice = pFormModel ? pFormModel->GetRefDevice() : NULL; - - if ( m_pLastKnownRefDevice != pCurrentRefDevice ) - { - m_pLastKnownRefDevice = pCurrentRefDevice; - - try - { - Reference< XPropertySet > xModelProps( GetUnoControlModel(), UNO_QUERY ); - Reference< XPropertySetInfo > xPropertyInfo; - if ( xModelProps.is() ) - xPropertyInfo = xModelProps->getPropertySetInfo(); - - const ::rtl::OUString sRefDevicePropName( RTL_CONSTASCII_USTRINGPARAM( "ReferenceDevice" ) ); - if ( xPropertyInfo.is() && xPropertyInfo->hasPropertyByName( sRefDevicePropName ) ) - { - VCLXDevice* pUnoRefDevice = new VCLXDevice; - pUnoRefDevice->SetOutputDevice( m_pLastKnownRefDevice ); - Reference< XDevice > xRefDevice( pUnoRefDevice ); - xModelProps->setPropertyValue( sRefDevicePropName, makeAny( xRefDevice ) ); - } - } - catch( const Exception& ) - { - OSL_ENSURE( sal_False, "FmFormObj::ReformatText: caught an exception!" ); - } - } - - SdrUnoObj::ReformatText(); + impl_checkRefDevice_nothrow( false ); + SdrUnoObj::NbcReformatText(); } //------------------------------------------------------------------ @@ -564,6 +579,13 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > } //------------------------------------------------------------------ +void FmFormObj::SetModel( SdrModel* _pNewModel ) +{ + SdrUnoObj::SetModel( _pNewModel ); + impl_checkRefDevice_nothrow(); +} + +//------------------------------------------------------------------ FmFormObj* FmFormObj::GetFormObject( SdrObject* _pSdrObject ) { FmFormObj* pFormObject = dynamic_cast< FmFormObj* >( _pSdrObject ); @@ -595,6 +617,8 @@ void FmFormObj::SetUnoControlModel( const Reference< com::sun::star::awt::XContr SdrUnoObj::SetUnoControlModel( _rxModel ); // TODO: call something like formObjectInserted at the form page, to tell it the new model + + impl_checkRefDevice_nothrow( true ); } //------------------------------------------------------------------ diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 36463c4ada89..afc7e8ace77f 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -44,8 +44,6 @@ #include <com/sun/star/form/FormComponentType.hpp> #include <com/sun/star/awt/ScrollBarOrientation.hpp> #include <com/sun/star/form/XGridColumnFactory.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/style/VerticalAlignment.hpp> #include <com/sun/star/awt/LineEndFormat.hpp> #include <com/sun/star/awt/ImageScaleMode.hpp> @@ -53,6 +51,7 @@ #include <com/sun/star/util/XNumberFormatTypes.hpp> #include <com/sun/star/sdbc/ColumnValue.hpp> #include <com/sun/star/text/WritingMode2.hpp> +#include <com/sun/star/awt/FontDescriptor.hpp> /** === end UNO includes === **/ #include <comphelper/componentcontext.hxx> @@ -88,15 +87,16 @@ namespace svxform using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::container::XChild; using ::com::sun::star::form::XGridColumnFactory; - using ::com::sun::star::lang::XServiceInfo; - using ::com::sun::star::style::XStyleFamiliesSupplier; - using ::com::sun::star::container::XNameAccess; using ::com::sun::star::style::VerticalAlignment_MIDDLE; using ::com::sun::star::beans::Property; using ::com::sun::star::uno::TypeClass_DOUBLE; using ::com::sun::star::uno::TypeClass_LONG; using ::com::sun::star::util::XNumberFormats; using ::com::sun::star::util::XNumberFormatTypes; + using ::com::sun::star::awt::FontDescriptor; + using ::com::sun::star::lang::Locale; + using ::com::sun::star::lang::XServiceInfo; + using ::com::sun::star::container::XNameAccess; /** === end UNO using === **/ namespace FormComponentType = ::com::sun::star::form::FormComponentType; namespace ScrollBarOrientation = ::com::sun::star::awt::ScrollBarOrientation; @@ -236,65 +236,6 @@ namespace svxform } return aInfo; } - /* - ATTENTION! - Broken for solaris? It seems that the old used template argument TYPE was already - defined as a macro ... which expand to ... "TYPE "!? - All platforms are OK - excepting Solaris. There the line "template< class TYPE >" - was expanded to "template < class TYPE " where the closing ">" was missing. - */ - #ifdef MYTYPE - #error "Who defines the macro MYTYPE, which is used as template argument here?" - #endif - - //.................................................................... - template< class MYTYPE > - Reference< MYTYPE > getTypedModelNode( const Reference< XInterface >& _rxModelNode ) - { - Reference< MYTYPE > xTypedNode( _rxModelNode, UNO_QUERY ); - if ( xTypedNode.is() ) - return xTypedNode; - else - { - Reference< XChild > xChild( _rxModelNode, UNO_QUERY ); - if ( xChild.is() ) - return getTypedModelNode< MYTYPE >( xChild->getParent() ); - else - return NULL; - } - } - - //.................................................................... - static bool lcl_getDocumentDefaultStyleAndFamily( const Reference< XInterface >& _rxDocument, ::rtl::OUString& _rFamilyName, ::rtl::OUString& _rStyleName ) SAL_THROW(( Exception )) - { - bool bSuccess = true; - Reference< XServiceInfo > xDocumentSI( _rxDocument, UNO_QUERY ); - if ( xDocumentSI.is() ) - { - if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ) ) - || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.WebDocument" ) ) ) - ) - { - _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) ); - _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); - } - else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) ) ) ) - { - _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellStyles" ) ); - _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Default" ) ); - } - else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ) - || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) - ) - { - _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) ); - _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "standard" ) ); - } - else - bSuccess = false; - } - return bSuccess; - } //.................................................................... static const sal_Char* aCharacterAndParagraphProperties[] = @@ -430,41 +371,13 @@ namespace svxform //.................................................................... static void lcl_initializeCharacterAttributes( const Reference< XPropertySet >& _rxModel ) { - // need to initialize the attributes from the "Default" style of the document we live in - try { - // the style family collection - Reference< XStyleFamiliesSupplier > xSuppStyleFamilies = getTypedModelNode< XStyleFamiliesSupplier >( _rxModel.get() ); - Reference< XNameAccess > xStyleFamilies; - if ( xSuppStyleFamilies.is() ) - xStyleFamilies = xSuppStyleFamilies->getStyleFamilies(); - OSL_ENSURE( xStyleFamilies.is(), "lcl_initializeCharacterAttributes: could not obtain the style families!" ); - if ( !xStyleFamilies.is() ) - return; - - // the names of the family, and the style - depends on the document type we live in - ::rtl::OUString sFamilyName, sStyleName; - bool bKnownDocumentType = lcl_getDocumentDefaultStyleAndFamily( xSuppStyleFamilies.get(), sFamilyName, sStyleName ); - OSL_ENSURE( bKnownDocumentType, "lcl_initializeCharacterAttributes: Huh? What document type is this?" ); - if ( !bKnownDocumentType ) - return; - - // the concrete style - Reference< XNameAccess > xStyleFamily( xStyleFamilies->getByName( sFamilyName ), UNO_QUERY ); - Reference< XPropertySet > xStyle; - if ( xStyleFamily.is() ) - xStyleFamily->getByName( sStyleName ) >>= xStyle; - OSL_ENSURE( xStyle.is(), "lcl_initializeCharacterAttributes: could not retrieve the style!" ); - if ( !xStyle.is() ) - return; - - // transfer all properties which are described by the com.sun.star.style. - Reference< XPropertySetInfo > xSourcePropInfo( xStyle->getPropertySetInfo() ); - Reference< XPropertySetInfo > xDestPropInfo( _rxModel->getPropertySetInfo() ); - OSL_ENSURE( xSourcePropInfo.is() && xDestPropInfo.is(), "lcl_initializeCharacterAttributes: no property set info!" ); - if ( !xSourcePropInfo.is() || !xDestPropInfo.is() ) - return; + Reference< XPropertySet > xStyle( ControlLayouter::getDefaultDocumentTextStyle( _rxModel ), UNO_SET_THROW ); + + // transfer all properties which are described by the style + Reference< XPropertySetInfo > xSourcePropInfo( xStyle->getPropertySetInfo(), UNO_SET_THROW ); + Reference< XPropertySetInfo > xDestPropInfo( _rxModel->getPropertySetInfo(), UNO_SET_THROW ); ::rtl::OUString sPropertyName; const sal_Char** pCharacterProperty = aCharacterAndParagraphProperties; diff --git a/svx/source/inc/fmcontrollayout.hxx b/svx/source/inc/fmcontrollayout.hxx index 1110c274b9f8..c5abe43f3228 100644 --- a/svx/source/inc/fmcontrollayout.hxx +++ b/svx/source/inc/fmcontrollayout.hxx @@ -62,6 +62,22 @@ namespace svxform */ static bool useDynamicBorderColor( DocumentType _eDocType ); + /** determines whether for the given document type, form controls should use the document's reference device + for text rendering + */ + static bool useDocumentReferenceDevice( DocumentType _eDocType ); + + /** gets the "default" style in a document which can be used if some default text format is needed + + It depends on the type document type which concrete kind of style is returned, but it is expected to support + the css.style.CharacterProperties service. + + @param _rxModel + a form component. + */ + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + getDefaultDocumentTextStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); + private: ControlLayouter(); // never implemented diff --git a/svx/source/inc/fmobj.hxx b/svx/source/inc/fmobj.hxx index 4099f241b72a..25f792ed7417 100644 --- a/svx/source/inc/fmobj.hxx +++ b/svx/source/inc/fmobj.hxx @@ -86,12 +86,14 @@ public: virtual sal_uInt32 GetObjInventor() const; virtual sal_uInt16 GetObjIdentifier() const; - virtual void ReformatText(); + virtual void NbcReformatText(); virtual SdrObject* Clone() const; // #116235# virtual SdrObject* Clone(SdrPage* pPage, SdrModel* pModel) const; virtual void operator= (const SdrObject& rObj); + virtual void SetModel(SdrModel* pNewModel); + virtual void clonedFrom(const FmFormObj* _pSource); static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> ensureModelEnv(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rSourceContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> _rTopLevelDestContainer); @@ -124,6 +126,10 @@ private: its parent. */ void impl_isolateControlModel_nothrow(); + + /** forwards the reference device of our SdrModel to the control model + */ + void impl_checkRefDevice_nothrow( bool _force = false ); }; diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 5f632f60ab85..9d19e752396c 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -39,6 +39,7 @@ #include <svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> +#include <svx/obj3d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -134,6 +135,7 @@ namespace sdr // create Primitive2DSequence from sub-geometry const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); + bool b3DShape(false); if(pSdrObjRepresentation) { @@ -142,6 +144,12 @@ namespace sdr while(aIterator.IsMore()) { SdrObject& rCandidate = *aIterator.Next(); + + if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate)) + { + b3DShape = true; + } + const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence()); drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew); } @@ -220,7 +228,8 @@ namespace sdr xGroup, aTextBoxMatrix, bWordWrap, - false)); // #SJ# New parameter to force to clipped BlockText for SC + false, // #SJ# New parameter to force to clipped BlockText for SC + b3DShape)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index 3c239b12113c..a054e881b7c3 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -113,6 +113,11 @@ namespace sdr new drawinglayer::primitive2d::SdrOleContentPrimitive2D( GetOle2Obj(), aObjectMatrix, + + // #i104867# add GraphicVersion number to be able to check for + // content change in the primitive later + GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), + bHighContrast)); // create primitive. Use Ole2 primitive here. Prepare attribute settings, will be used soon anyways. diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index bf483b5329f2..0eab2c882ce5 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -39,6 +39,7 @@ #include <svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx> #include <svl/itemset.hxx> #include <svx/sdr/primitive2d/sdrprimitivetools.hxx> +#include <svx/svdmodel.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -104,6 +105,10 @@ namespace sdr double fCornerRadiusY; drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); + // #i105856# use knowledge about pickthrough from the model + const bool bPickThroughTransparentTextFrames( + GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames()); + // create primitive const drawinglayer::primitive2d::Primitive2DReference xReference( new drawinglayer::primitive2d::SdrRectanglePrimitive2D( @@ -111,7 +116,8 @@ namespace sdr *pAttribute, fCornerRadiusX, fCornerRadiusY, - GetRectObj().IsTextFrame())); + // #i105856# use fill for HitTest when TextFrame and not PickThrough + GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index 79d493b6d9d0..24a5fb56a8cf 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -44,6 +44,10 @@ ////////////////////////////////////////////////////////////////////////////// +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + namespace sdr { namespace overlay @@ -140,6 +144,18 @@ namespace sdr maViewInformation2D(0), mfDiscreteOne(0.0) { + // set Property 'ReducedDisplayQuality' to true to allow simpler interaction + // visualisations + static bool bUseReducedDisplayQualityForDrag(true); + + if(bUseReducedDisplayQualityForDrag) + { + uno::Sequence< beans::PropertyValue > xProperties(1); + xProperties[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedDisplayQuality")); + xProperties[0].Value <<= true; + maViewInformation2D = drawinglayer::geometry::ViewInformation2D(xProperties); + } + if(pOldOverlayManager) { // take over OverlayObjects from given OverlayManager. Copy diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx index 3fedc40f37cf..13a83f0fc235 100644 --- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx +++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx @@ -370,6 +370,9 @@ namespace sdr OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, getOutputDevice()); } + // #i80730# removed: VCL hack for transparent child windows + // No longer needed, checked in DEV300 m54 + // #i80730# restore visibility of VCL cursor if(bCursorWasEnabled) { diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index e2dce7b551ed..af3e6aacb410 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -68,7 +68,20 @@ namespace drawinglayer // add shadow if(aRetval.hasElements() && getSdrSTAttribute().getShadow()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrSTAttribute().getShadow()); + // #i105323# add generic shadow only for 2D shapes. For + // 3D shapes shadow will be set at the individual created + // visualisation objects and be visualized by the 3d renderer + // as a single shadow. + // + // The shadow for AutoShapes could be handled uniformely by not setting any + // shadow items at the helper model objects and only adding shadow here for + // 2D and 3D (and it works, too), but this would lead to two 3D scenes for + // the 3D object; one for the shadow aond one for the content. The one for the + // shadow will be correct (using ColorModifierStack), but expensive. + if(!get3DShape()) + { + aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrSTAttribute().getShadow()); + } } return aRetval; @@ -79,13 +92,15 @@ namespace drawinglayer const Primitive2DSequence& rSubPrimitives, const basegfx::B2DHomMatrix& rTextBox, bool bWordWrap, - bool bForceTextClipToTextRange) + bool bForceTextClipToTextRange, + bool b3DShape) : BasePrimitive2D(), maSdrSTAttribute(rSdrSTAttribute), maSubPrimitives(rSubPrimitives), maTextBox(rTextBox), mbWordWrap(bWordWrap), - mbForceTextClipToTextRange(bForceTextClipToTextRange) + mbForceTextClipToTextRange(bForceTextClipToTextRange), + mb3DShape(b3DShape) { } @@ -99,7 +114,8 @@ namespace drawinglayer && getSubPrimitives() == rCompare.getSubPrimitives() && getTextBox() == rCompare.getTextBox() && getWordWrap() == rCompare.getWordWrap() - && isForceTextClipToTextRange() == rCompare.isForceTextClipToTextRange()); + && isForceTextClipToTextRange() == rCompare.isForceTextClipToTextRange() + && get3DShape() == rCompare.get3DShape()); } return false; diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index 67fee9215b73..e682c0e04b55 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -157,10 +157,12 @@ namespace drawinglayer SdrOleContentPrimitive2D::SdrOleContentPrimitive2D( const SdrOle2Obj& rSdrOle2Obj, const basegfx::B2DHomMatrix& rObjectTransform, + sal_uInt32 nGraphicVersion, bool bHighContrast) : BasePrimitive2D(), mpSdrOle2Obj(const_cast< SdrOle2Obj* >(&rSdrOle2Obj)), maObjectTransform(rObjectTransform), + mnGraphicVersion(nGraphicVersion), mbHighContrast(bHighContrast) { } @@ -176,6 +178,11 @@ namespace drawinglayer return ((bBothNot || bBothAndEqual) && getObjectTransform() == rCompare.getObjectTransform() + + // #i104867# to find out if the Graphic content of the + // OLE has changed, use GraphicVersion number + && getGraphicVersion() == rCompare.getGraphicVersion() + && getHighContrast() == rCompare.getHighContrast()); } diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index edb2837ef670..097cd5edd445 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -68,7 +68,7 @@ namespace drawinglayer *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); } - else if(getTextFrame()) + else if(getForceFillForHitTest()) { // if no fill and it's a text frame, create a fill for HitTest and // BoundRect fallback @@ -89,7 +89,7 @@ namespace drawinglayer getTransform(), *getSdrLFSTAttribute().getLine())); } - else if(!getTextFrame()) + else if(!getForceFillForHitTest()) { // if initially no line is defined and it's not a text frame, create // a line for HitTest and BoundRect @@ -127,13 +127,13 @@ namespace drawinglayer const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, double fCornerRadiusX, double fCornerRadiusY, - bool bTextFrame) + bool bForceFillForHitTest) : BasePrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute), mfCornerRadiusX(fCornerRadiusX), mfCornerRadiusY(fCornerRadiusY), - mbTextFrame(bTextFrame) + mbForceFillForHitTest(bForceFillForHitTest) { } @@ -147,7 +147,7 @@ namespace drawinglayer && getCornerRadiusY() == rCompare.getCornerRadiusY() && getTransform() == rCompare.getTransform() && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute() - && getTextFrame() == rCompare.getTextFrame()); + && getForceFillForHitTest() == rCompare.getForceFillForHitTest()); } return false; diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index eb6412b20259..a8d588e73fe5 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -206,6 +206,32 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragEntrySdrObject::createPrim //////////////////////////////////////////////////////////////////////////////////////////////////// +SdrDragEntryPrimitive2DSequence::SdrDragEntryPrimitive2DSequence( + const drawinglayer::primitive2d::Primitive2DSequence& rSequence, + bool bAddToTransparent) +: SdrDragEntry(), + maPrimitive2DSequence(rSequence) +{ + // add parts to transparent overlay stuff eventually + setAddToTransparent(bAddToTransparent); +} + +SdrDragEntryPrimitive2DSequence::~SdrDragEntryPrimitive2DSequence() +{ +} + +drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPrimitive2DSequence::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod) +{ + drawinglayer::primitive2d::Primitive2DReference aTransformPrimitive2D( + new drawinglayer::primitive2d::TransformPrimitive2D( + rDragMethod.getCurrentTransformation(), + maPrimitive2DSequence)); + + return drawinglayer::primitive2d::Primitive2DSequence(&aTransformPrimitive2D, 1); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + SdrDragEntryPointGlueDrag::SdrDragEntryPointGlueDrag(const std::vector< basegfx::B2DPoint >& rPositions, bool bIsPointDrag) : maPositions(rPositions), mbIsPointDrag(bIsPointDrag) @@ -318,6 +344,13 @@ void SdrDragMethod::createSdrDragEntries() } } +void SdrDragMethod::createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify) +{ + // add full obejct drag; Clone() at the object has to work + // for this + addSdrDragEntry(new SdrDragEntrySdrObject(rOriginal, rObjectContact, bModify)); +} + void SdrDragMethod::createSdrDragEntries_SolidDrag() { const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount()); @@ -359,7 +392,7 @@ void SdrDragMethod::createSdrDragEntries_SolidDrag() { // add full obejct drag; Clone() at the object has to work // for this - addSdrDragEntry(new SdrDragEntrySdrObject(*pCandidate, rOC, true)); + createSdrDragEntryForSdrObject(*pCandidate, rOC, true); } if(bAddWireframe) @@ -1358,6 +1391,21 @@ Pointer SdrDragObjOwn::GetSdrDragPointer() const TYPEINIT1(SdrDragMove,SdrDragMethod); +void SdrDragMove::createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool /*bModify*/) +{ + // for SdrDragMove, use current Primitive2DSequence of SdrObject visualisation + // in given ObjectContact directly + sdr::contact::ViewContact& rVC = rOriginal.GetViewContact(); + sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(rObjectContact); + sdr::contact::DisplayInfo aDisplayInfo; + + // Do not use the last ViewPort set at the OC from the last ProcessDisplay(), + // here we want the complete primitive sequence without visibility clippings + rObjectContact.resetViewPort(); + + addSdrDragEntry(new SdrDragEntryPrimitive2DSequence(rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo), true)); +} + void SdrDragMove::applyCurrentTransformationToSdrObject(SdrObject& rTarget) { rTarget.Move(Size(DragStat().GetDX(), DragStat().GetDY())); |