From a38342aa7ff93dbf1e3432d42afecac778eb80a1 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 15 Sep 2009 16:06:13 +0200 Subject: #i97509# seperated base and buffered classes for 2D and 3D, adapted aqll usages --- .../primitive2d/animatedprimitive2d.hxx | 6 +- .../primitive2d/backgroundcolorprimitive2d.hxx | 4 +- .../drawinglayer/primitive2d/baseprimitive2d.hxx | 210 ++++++++++++++++----- .../drawinglayer/primitive2d/bitmapprimitive2d.hxx | 2 +- .../primitive2d/borderlineprimitive2d.hxx | 4 +- .../primitive2d/controlprimitive2d.hxx | 6 +- .../primitive2d/embedded3dprimitive2d.hxx | 4 +- .../primitive2d/fillbitmapprimitive2d.hxx | 4 +- .../primitive2d/fillgradientprimitive2d.hxx | 4 +- .../primitive2d/fillhatchprimitive2d.hxx | 4 +- .../primitive2d/graphicprimitive2d.hxx | 4 +- .../drawinglayer/primitive2d/gridprimitive2d.hxx | 4 +- .../drawinglayer/primitive2d/groupprimitive2d.hxx | 4 +- .../primitive2d/helplineprimitive2d.hxx | 4 +- .../primitive2d/hittestprimitive2d.hxx | 2 +- .../primitive2d/markerarrayprimitive2d.hxx | 4 +- .../drawinglayer/primitive2d/mediaprimitive2d.hxx | 4 +- .../primitive2d/metafileprimitive2d.hxx | 2 +- .../primitive2d/pagepreviewprimitive2d.hxx | 2 +- .../primitive2d/pointarrayprimitive2d.hxx | 2 +- .../primitive2d/polygonprimitive2d.hxx | 14 +- .../primitive2d/polypolygonprimitive2d.hxx | 22 +-- .../drawinglayer/primitive2d/primitivetools2d.hxx | 20 +- .../drawinglayer/primitive2d/sceneprimitive2d.hxx | 6 +- .../drawinglayer/primitive2d/shadowprimitive2d.hxx | 2 +- .../primitive2d/textdecoratedprimitive2d.hxx | 2 +- .../primitive2d/texteffectprimitive2d.hxx | 2 +- .../drawinglayer/primitive2d/textprimitive2d.hxx | 4 +- .../primitive2d/unifiedalphaprimitive2d.hxx | 2 +- .../primitive2d/wrongspellprimitive2d.hxx | 4 +- 30 files changed, 235 insertions(+), 123 deletions(-) (limited to 'drawinglayer/inc/drawinglayer/primitive2d') diff --git a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx index 41ae18b30fc9..6811b6ba857b 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx @@ -70,7 +70,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: AnimatedSwitchPrimitive2D( @@ -110,7 +110,7 @@ namespace drawinglayer { protected: // create local decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: AnimatedBlinkPrimitive2D( @@ -174,7 +174,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: AnimatedInterpolatePrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx index 65977cfd4241..47cebbca87e4 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class BackgroundColorPrimitive2D : public BasePrimitive2D + class BackgroundColorPrimitive2D : public BufDecPrimitive2D { private: basegfx::BColor maBColor; @@ -56,7 +56,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: BackgroundColorPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx index b05c60394ecd..f33b9697bff8 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx @@ -43,16 +43,17 @@ #include ////////////////////////////////////////////////////////////////////////////// -// defines for DeclPrimitrive2DIDBlock and ImplPrimitrive2DIDBlock -// Added to be able to simply change identification stuff later, e.g. add -// a identification string and/or ID to the interface and to the implementation -// ATM used to delclare implement getPrimitiveID() +/** defines for DeclPrimitrive2DIDBlock and ImplPrimitrive2DIDBlock + Added to be able to simply change identification stuff later, e.g. add + a identification string and/or ID to the interface and to the implementation + ATM used to delclare implement getPrimitive2DID() +*/ #define DeclPrimitrive2DIDBlock() \ - virtual sal_uInt32 getPrimitiveID() const; + virtual sal_uInt32 getPrimitive2DID() const; #define ImplPrimitrive2DIDBlock(TheClass, TheID) \ - sal_uInt32 TheClass::getPrimitiveID() const { return TheID; } + sal_uInt32 TheClass::getPrimitive2DID() const { return TheID; } ////////////////////////////////////////////////////////////////////////////// // predefines @@ -61,6 +62,13 @@ namespace drawinglayer { namespace geometry { class ViewInformation2D; }} +namespace drawinglayer { namespace primitive2d { + /// typedefs for basePrimitive2DImplBase, Primitive2DSequence and Primitive2DReference + typedef cppu::WeakComponentImplHelper1< ::com::sun::star::graphic::XPrimitive2D > BasePrimitive2DImplBase; + typedef ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XPrimitive2D > Primitive2DReference; + typedef ::com::sun::star::uno::Sequence< Primitive2DReference > Primitive2DSequence; +}} + ////////////////////////////////////////////////////////////////////////////// // basePrimitive2D class @@ -68,77 +76,181 @@ namespace drawinglayer { namespace primitive2d { - // typedefs for basePrimitive2DImplBase, Primitive2DSequence and Primitive2DReference - typedef cppu::WeakComponentImplHelper1< ::com::sun::star::graphic::XPrimitive2D > BasePrimitive2DImplBase; - typedef ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XPrimitive2D > Primitive2DReference; - typedef ::com::sun::star::uno::Sequence< Primitive2DReference > Primitive2DSequence; - - // base class for all C++ implementations of com::sun::star::graphic::XPrimitive2D. This class - // is strongly virtual due to the lack of getPrimitiveID() implementation. This is by purpose, this - // base class shall not be incarnated and be used directly as a XPrimitive2D. + /** Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D + + This class is strongly virtual due to the lack of getPrimitiveID() implementation. + This is by purpose, this base class shall not be incarnated and be used directly as + a XPrimitive2D. + + Is is derived from boost::noncopyable to make clear that a primitive is a read-only + instance and copying or changing values is not intended. The idea is to hold all data + needed for visualisation of this primitive in unchangeable form. + + It is derived from comphelper::OBaseMutex to have a Mutex at hand; in a base + implementation this may not be needed, but e.g. when buffering at last decomposition + in a local member, multiple threads may try to decompose at the same time, so locking + is needed to avoid race conditions seen from the UNO object implementation. + + A method to get a simplified representation is provided by get2DDecomposition. The + default implementation returns an empty sequence. The idea is that processors + using this primitive and do not know it, may get the decomposition and process + these instead. An example is e.g. a fat line, who's decomposition may contain + the geometric representation of that line using filled polygon prmimitives. When + the renderer knows how to handle fat lines, he may proccess this primitive directly; + if not he can use the decomposition. With this functionality, renderers may operate by + knowing only a small set of primitives. + + When a primitive does not implement get2DDecomposition, it is called a 'Basic Primitive' and + belongs to the set of primitives which a processor should be able to handle. Practice + will define this minimal sets of primitives. When defined and the concept is prooved, + unique UNO APIs may be defined/implemented for these set to allow more intense work + with primitives using UNO. + + Current Basic Primitives are: + (add list here) + + To support getting the geometric BoundRect, getB2DRange is used. The default + implementation will use the get2DDecomposition result and merge a range from the + entries. Thus, an implementation is only necessary for the Basic Primitives, but + of course speedups are possible (and are used) by implementing the method at higher-level + primitives. + + For primitive identification, getPrimitiveID is used currently in this implementations + to allow a fast switch/case processing. This needs a unique identifier mechanism which + currently uses defines (see drawinglayer_primitivetypes2d.hxx). For UNO prmitive API + it will be needed to add a unique descriptor (Name?) later to the API. + + This base implementation provides mappings from the methods from XPrimitive2D + (getDecomposition/getRange) to the appropriate methods in the C++ implementations + (get2DDecomposition/getB2DRange). The PropertyValue ViewParameters is converted to + the appropriate C++ implementation class ViewInformation2D. + + This base class does not implement any buffering; e.g. buffering the decompositon + and/or the range. These may be buffered anytime since the definition is that the primitive + is read-only and thus unchangeable. This implies that the decomposition and/or getting + the range will lead to the same result as last time, under the precondition that + the parameter ViewInformation2D is the same as the last one. This is usually the case + for view-independent primitives which are defined by not using ViewInformation2D + in their get2DDecomposition/getB2DRange implementations. + */ class BasePrimitive2D : private boost::noncopyable, protected comphelper::OBaseMutex, public BasePrimitive2DImplBase { private: - // a sequence used for buffering the last createLocalDecomposition() result. Use - // the protected access methods to change. Only implementations of getDecomposition() - // should make use. - Primitive2DSequence maLocalDecomposition; - protected: - // access methods to maLocalDecomposition. The usage of this methods may allow - // later thread-safe stuff to be added if needed. Only to be used by getDecomposition() - // implementations for buffering the last decomposition. - const Primitive2DSequence& getLocalDecomposition() const { return maLocalDecomposition; } - void setLocalDecomposition(const Primitive2DSequence& rNew) { maLocalDecomposition = rNew; } - - // method which is to be used to implement the local decomposition of a 2D primitive. The default - // implementation will just return an empty decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - public: - // constructor + // constructor/destructor BasePrimitive2D(); + virtual ~BasePrimitive2D(); - // the ==operator is mainly needed to allow testing newly-created primitives against their last - // incarnation which buffers/holds the made decompositions. The default implementation - // uses getPrimitiveID()-calls to test if it's the same ID at last. Overloaded implementation are then - // based on this implementation + /** the ==operator is mainly needed to allow testing newly-created primitives against their last + incarnation which buffers/holds the made decompositions. The default implementation + uses getPrimitive2DID()-calls to test if it's the same ID at last. Overloaded implementation are then + based on this implementation + */ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; bool operator!=( const BasePrimitive2D& rPrimitive ) const { return !operator==(rPrimitive); } - // The default implementation will use getDecomposition results to create the range + /// The default implementation will use getDecomposition results to create the range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID for fast identifying of known primitive implementations in renderers. These use - // the the defines from primitivetypes2d.hxx to define unique IDs. - // This method is normally defined using DeclPrimitrive2DIDBlock() - virtual sal_uInt32 getPrimitiveID() const = 0; + /** provide unique ID for fast identifying of known primitive implementations in renderers. These use + the the defines from primitivetypes2d.hxx to define unique IDs. + This method is normally defined using DeclPrimitrive2DIDBlock() + */ + virtual sal_uInt32 getPrimitive2DID() const = 0; - // The getDecomposition default implementation will on demand use createLocalDecomposition() if maLocalDecomposition is empty. - // It will set maLocalDecomposition to this obtained decomposition to buffer it. - // If the decomposition is also ViewInformation2D-dependent, this method needs to be overloaded and the - // ViewInformation2D for the last decomposition need to be remembered, too, and be used in the next call to decide if - // the buffered decomposition may be reused or not. + /// The default implementation will return an empty sequence virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; // // Methods from XPrimitive2D // - // The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It - // will construct a ViewInformation2D from the ViewParameters for that purpose + /** The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It + will construct a ViewInformation2D from the ViewParameters for that purpose + */ virtual Primitive2DSequence SAL_CALL getDecomposition( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters ) throw ( ::com::sun::star::uno::RuntimeException ); - // The getRange implementation for UNO API will use getRange from this implementation. It - // will construct a ViewInformation2D from the ViewParameters for that purpose + /** The getRange implementation for UNO API will use getRange from this implementation. It + will construct a ViewInformation2D from the ViewParameters for that purpose + */ virtual ::com::sun::star::geometry::RealRectangle2D SAL_CALL getRange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters ) throw ( ::com::sun::star::uno::RuntimeException ); }; } // end of namespace primitive2d } // end of namespace drawinglayer +////////////////////////////////////////////////////////////////////////////// +// BufDecPrimitive2D class + +namespace drawinglayer +{ + namespace primitive2d + { + /** Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D + which want to buffer the decomoposition result + + Buffering the decomposition is the most-used buffering and is thus used my most + primitive implementations which support a decomposition as base class. + + The buffering is done by holding the last decomposition in the local parameter + maLocal2DDecomposition. The default implementation of get2DDecomposition checks + if maLocal2DDecomposition is empty. If yes, it uses createLocal2DDecomposition + to create the content. In all cases, maLocal2DDecomposition is returned. + + For view-dependent primitives derived from Primitive2DBufferDecomposition more needs + to be done when the decomposition depends on parts of the parameter ViewInformation2D. + This defines a standard method for processing these: + + Implement a view-dependent get2DDecomposition doing te following steps: + (a) Locally extract needed parameters from ViewInformation2D to new, local parameters + (this may be a complete local copy of ViewInformation2D) + (b) If a buffered decomposition exists, ckeck if one of the new local parameters + differs from the corresponding locally remembered (as member) ones. If yes, + clear maLocal2DDecomposition + (d) call baseclass::get2DDecomposition which will use createLocal2DDecomposition + to fill maLocal2DDecomposition if it's empty + (e) copy the new local parameters to the corresponding locally remembered ones + to identify if a new decomposition is needed at the next call + (f) return maLocal2DDecomposition + */ + class BufDecPrimitive2D + : public BasePrimitive2D + { + private: + /// a sequence used for buffering the last createLocal2DDecomposition() result + Primitive2DSequence maLocal2DDecomposition; + + protected: + /** access methods to maLocal2DDecomposition. The usage of this methods may allow + later thread-safe stuff to be added if needed. Only to be used by getDecomposition() + implementations for buffering the last decomposition. + */ + const Primitive2DSequence& getLocal2DDecomposition() const { return maLocal2DDecomposition; } + void setLocal2DDecomposition(const Primitive2DSequence& rNew) { maLocal2DDecomposition = rNew; } + + /** method which is to be used to implement the local decomposition of a 2D primitive. The default + implementation will just return an empty decomposition + */ + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + // constructor/destructor + BufDecPrimitive2D(); + + /** The getDecomposition default implementation will on demand use createLocal2DDecomposition() if + maLocal2DDecomposition is empty. It will set maLocal2DDecomposition to this obtained decomposition + to buffer it. If the decomposition is also ViewInformation2D-dependent, this method needs to be + overloaded and the ViewInformation2D for the last decomposition need to be remembered, too, and + be used in the next call to decide if the buffered decomposition may be reused or not. + */ + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + ////////////////////////////////////////////////////////////////////////////// // tooling @@ -152,7 +264,7 @@ namespace drawinglayer // get B2DRange from a given Primitive2DSequence basegfx::B2DRange getB2DRangeFromPrimitive2DSequence(const Primitive2DSequence& rCandidate, const geometry::ViewInformation2D& aViewInformation); - // compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D) + // compare two Primitive2DReferences for equality, including trying to get implementations (BufDecPrimitive2D) // and using compare operator bool arePrimitive2DReferencesEqual(const Primitive2DReference& rA, const Primitive2DReference& rB); diff --git a/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx index d295c6ab4b89..4a1244126b6b 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class BitmapPrimitive2D : public BasePrimitive2D + class BitmapPrimitive2D : public BufDecPrimitive2D { private: BitmapEx maBitmapEx; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx index 504ada20f8ac..f7e66e367478 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class BorderLinePrimitive2D : public BasePrimitive2D + class BorderLinePrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DPoint maStart; @@ -107,7 +107,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: BorderLinePrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx index 0e69cb7bdfc0..9902fbfa04d7 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class ControlPrimitive2D : public BasePrimitive2D + class ControlPrimitive2D : public BufDecPrimitive2D { private: // object's base data @@ -64,13 +64,13 @@ namespace drawinglayer // and from thereon always used and returned by getXControl() void createXControl(); - // single local decompositions, used from createLocalDecomposition() + // single local decompositions, used from createLocal2DDecomposition() Primitive2DReference createBitmapDecomposition(const geometry::ViewInformation2D& rViewInformation) const; Primitive2DReference createPlaceholderDecomposition(const geometry::ViewInformation2D& rViewInformation) const; protected: // local decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: ControlPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx index e0da8a36c3f5..f81c91374969 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx @@ -48,7 +48,7 @@ namespace drawinglayer { namespace primitive2d { - class Embedded3DPrimitive2D : public BasePrimitive2D + class Embedded3DPrimitive2D : public BufDecPrimitive2D { private: // the sequence of 3d primitives @@ -85,7 +85,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: Embedded3DPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx index 1811b9bfaad9..0689ff8d6bcc 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class FillBitmapPrimitive2D : public BasePrimitive2D + class FillBitmapPrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DHomMatrix maTransformation; @@ -55,7 +55,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: FillBitmapPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx index ef5a52c6ddcf..cc05f0fc0b07 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class FillGradientPrimitive2D : public BasePrimitive2D + class FillGradientPrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DRange maObjectRange; @@ -54,7 +54,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: FillGradientPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx index 04410429d4a3..9d3ca6feef99 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class FillHatchPrimitive2D : public BasePrimitive2D + class FillHatchPrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DRange maObjectRange; @@ -55,7 +55,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: FillHatchPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx index 6d3826e7ee22..5057a3c63261 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class GraphicPrimitive2D : public BasePrimitive2D + class GraphicPrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DHomMatrix maTransform; @@ -55,7 +55,7 @@ namespace drawinglayer protected: // local decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: GraphicPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx index f0aad415bfce..cf2bd35ba57c 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx @@ -48,7 +48,7 @@ namespace drawinglayer { namespace primitive2d { - class GridPrimitive2D : public BasePrimitive2D + class GridPrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DHomMatrix maTransform; @@ -68,7 +68,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: GridPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx index 855e65ba98f8..80187efb3b78 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx @@ -45,7 +45,7 @@ namespace drawinglayer { namespace primitive2d { - class GroupPrimitive2D : public BasePrimitive2D + class GroupPrimitive2D : public BufDecPrimitive2D { private: // the children. Declared private since this shall never be changed at all after construction @@ -53,7 +53,7 @@ namespace drawinglayer protected: // local decomposition. Implementation will just return children - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: // constructor diff --git a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx index 4e8357a3eac1..28262adacf80 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx @@ -53,7 +53,7 @@ namespace drawinglayer HELPLINESTYLE2D_LINE }; - class HelplinePrimitive2D : public BasePrimitive2D + class HelplinePrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DPoint maPosition; @@ -70,7 +70,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: HelplinePrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx index 2bbcad315eb3..5c964fdc4ecb 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx @@ -57,7 +57,7 @@ namespace drawinglayer protected: // local decomposition. Implementation will return empty Primitive2DSequence // since this is no visualisation data - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: HitTestPrimitive2D(const Primitive2DSequence& rChildren); diff --git a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx index 350471f4aff3..ad6a0b565980 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class MarkerArrayPrimitive2D : public BasePrimitive2D + class MarkerArrayPrimitive2D : public BufDecPrimitive2D { private: std::vector< basegfx::B2DPoint > maPositions; @@ -55,7 +55,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: MarkerArrayPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx index 019fdc69bd3f..b3baa0334edd 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class MediaPrimitive2D : public BasePrimitive2D + class MediaPrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DHomMatrix maTransform; @@ -56,7 +56,7 @@ namespace drawinglayer protected: // local decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: MediaPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx index 23eb5dd1b36e..9104fbf7c83e 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class MetafilePrimitive2D : public BasePrimitive2D + class MetafilePrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DHomMatrix maMetaFileTransform; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx index edba5455ff0a..bbe05fcf9cb1 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx @@ -72,7 +72,7 @@ namespace drawinglayer protected: // local decomposition. Implementation will just return children - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PagePreviewPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx index bdd4142b0584..474921086138 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class PointArrayPrimitive2D : public BasePrimitive2D + class PointArrayPrimitive2D : public BufDecPrimitive2D { private: std::vector< basegfx::B2DPoint > maPositions; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx index 48ec5e80aa09..8c22fa299167 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -49,7 +49,7 @@ namespace drawinglayer { namespace primitive2d { - class PolygonHairlinePrimitive2D : public BasePrimitive2D + class PolygonHairlinePrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DPolygon maPolygon; @@ -81,7 +81,7 @@ namespace drawinglayer { namespace primitive2d { - class PolygonMarkerPrimitive2D : public BasePrimitive2D + class PolygonMarkerPrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DPolygon maPolygon; @@ -94,7 +94,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolygonMarkerPrimitive2D( @@ -131,7 +131,7 @@ namespace drawinglayer { namespace primitive2d { - class PolygonStrokePrimitive2D : public BasePrimitive2D + class PolygonStrokePrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DPolygon maPolygon; @@ -140,7 +140,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolygonStrokePrimitive2D( @@ -184,7 +184,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolygonWavePrimitive2D( @@ -231,7 +231,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolygonStrokeArrowPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index 9991a3109e10..6f63ff5d18bc 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -51,7 +51,7 @@ namespace drawinglayer { namespace primitive2d { - class PolyPolygonHairlinePrimitive2D : public BasePrimitive2D + class PolyPolygonHairlinePrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DPolyPolygon maPolyPolygon; @@ -59,7 +59,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor); @@ -87,7 +87,7 @@ namespace drawinglayer { namespace primitive2d { - class PolyPolygonMarkerPrimitive2D : public BasePrimitive2D + class PolyPolygonMarkerPrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DPolyPolygon maPolyPolygon; @@ -97,7 +97,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonMarkerPrimitive2D( @@ -131,7 +131,7 @@ namespace drawinglayer { namespace primitive2d { - class PolyPolygonStrokePrimitive2D : public BasePrimitive2D + class PolyPolygonStrokePrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DPolyPolygon maPolyPolygon; @@ -140,7 +140,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonStrokePrimitive2D( @@ -184,7 +184,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonStrokeArrowPrimitive2D( @@ -223,7 +223,7 @@ namespace drawinglayer { namespace primitive2d { - class PolyPolygonColorPrimitive2D : public BasePrimitive2D + class PolyPolygonColorPrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DPolyPolygon maPolyPolygon; @@ -264,7 +264,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonGradientPrimitive2D( @@ -298,7 +298,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonHatchPrimitive2D( @@ -332,7 +332,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonBitmapPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx index bd561cbab21a..04b4de88c449 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx @@ -39,26 +39,26 @@ #include ////////////////////////////////////////////////////////////////////////////// -// tooling class for BasePrimitive2D baseed classes which are view-dependent +// tooling class for BufDecPrimitive2D baseed classes which are view-dependent // regarding the size of a discrete unit. The implementation of get2DDecomposition -// guards the buffered local decomposition and ensures that a createLocalDecomposition +// guards the buffered local decomposition and ensures that a createLocal2DDecomposition // implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit() namespace drawinglayer { namespace primitive2d { - class DiscreteMetricDependentPrimitive2D : public BasePrimitive2D + class DiscreteMetricDependentPrimitive2D : public BufDecPrimitive2D { private: // the last used fDiscreteUnit definitions for decomposition. Since this // is checked and updated from get2DDecomposition() it will be current and - // usable in createLocalDecomposition() + // usable in createLocal2DDecomposition() double mfDiscreteUnit; public: DiscreteMetricDependentPrimitive2D() - : BasePrimitive2D(), + : BufDecPrimitive2D(), mfDiscreteUnit(0.0) { } @@ -73,26 +73,26 @@ namespace drawinglayer } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// -// tooling class for BasePrimitive2D baseed classes which are view-dependent +// tooling class for BufDecPrimitive2D baseed classes which are view-dependent // regarding the viewport. The implementation of get2DDecomposition -// guards the buffered local decomposition and ensures that a createLocalDecomposition +// guards the buffered local decomposition and ensures that a createLocal2DDecomposition // implementation may use an up-to-date Viewport accessible using getViewport() namespace drawinglayer { namespace primitive2d { - class ViewportDependentPrimitive2D : public BasePrimitive2D + class ViewportDependentPrimitive2D : public BufDecPrimitive2D { private: // the last used Viewport definition for decomposition. Since this // is checked and updated from get2DDecomposition() it will be current and - // usable in createLocalDecomposition() + // usable in createLocal2DDecomposition() basegfx::B2DRange maViewport; public: ViewportDependentPrimitive2D() - : BasePrimitive2D(), + : BufDecPrimitive2D(), maViewport() { } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx index d7fbfd4deaee..76783abb5372 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx @@ -48,7 +48,7 @@ namespace drawinglayer { namespace primitive2d { - class ScenePrimitive2D : public BasePrimitive2D + class ScenePrimitive2D : public BufDecPrimitive2D { private: primitive3d::Primitive3DSequence mxChildren3D; // the 3d sub-primitives @@ -80,11 +80,11 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: // public helpers - // Geometry extractor. Shadow will be added as in createLocalDecomposition, but + // Geometry extractor. Shadow will be added as in createLocal2DDecomposition, but // the 3D content is not converted to a bitmap visualisation but to projected 2D gemetry. This // helper is useful e.g. for Contour extraction or HitTests. Primitive2DSequence getGeometry2D(const geometry::ViewInformation2D& rViewInformation) const; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/shadowprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/shadowprimitive2d.hxx index b749000ee566..b30d96edcfca 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/shadowprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/shadowprimitive2d.hxx @@ -54,7 +54,7 @@ namespace drawinglayer protected: // create decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: ShadowPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx index 69023873760a..5328b29e963a 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx @@ -151,7 +151,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: TextDecoratedPortionPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx index 128b1ea5a210..aa4d41349f14 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx @@ -68,7 +68,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: TextEffectPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx index 9515fcc22ee8..51bb93a41e91 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx @@ -123,7 +123,7 @@ namespace drawinglayer { namespace primitive2d { - class TextSimplePortionPrimitive2D : public BasePrimitive2D + class TextSimplePortionPrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DHomMatrix maTextTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range @@ -140,7 +140,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: TextSimplePortionPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx index 44f3f738b67e..0ed1900ae14f 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx @@ -51,7 +51,7 @@ namespace drawinglayer protected: // create decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: UnifiedAlphaPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx index 8bd739298059..d2e108e2844a 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class WrongSpellPrimitive2D : public BasePrimitive2D + class WrongSpellPrimitive2D : public BufDecPrimitive2D { private: basegfx::B2DHomMatrix maTransformation; @@ -57,7 +57,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: WrongSpellPrimitive2D( -- cgit v1.2.3 From 52ddaac170a54bcbc5505e73a4e8ca93a19a8913 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 15 Sep 2009 19:08:28 +0200 Subject: #i97509# changed base classes for primitives which need no buffering --- .../primitive2d/animatedprimitive2d.hxx | 11 ----- .../primitive2d/backgroundcolorprimitive2d.hxx | 2 +- .../drawinglayer/primitive2d/baseprimitive2d.hxx | 30 ++++++++++--- .../drawinglayer/primitive2d/bitmapprimitive2d.hxx | 2 +- .../primitive2d/borderlineprimitive2d.hxx | 2 +- .../primitive2d/controlprimitive2d.hxx | 2 +- .../primitive2d/embedded3dprimitive2d.hxx | 2 +- .../primitive2d/fillbitmapprimitive2d.hxx | 2 +- .../primitive2d/fillgradientprimitive2d.hxx | 2 +- .../primitive2d/fillhatchprimitive2d.hxx | 2 +- .../primitive2d/graphicprimitive2d.hxx | 2 +- .../drawinglayer/primitive2d/gridprimitive2d.hxx | 2 +- .../drawinglayer/primitive2d/groupprimitive2d.hxx | 28 +++++++++--- .../primitive2d/helplineprimitive2d.hxx | 2 +- .../primitive2d/hittestprimitive2d.hxx | 9 ++-- .../primitive2d/markerarrayprimitive2d.hxx | 2 +- .../drawinglayer/primitive2d/mediaprimitive2d.hxx | 2 +- .../primitive2d/metafileprimitive2d.hxx | 2 +- .../primitive2d/pagepreviewprimitive2d.hxx | 12 +++-- .../primitive2d/pointarrayprimitive2d.hxx | 4 +- .../primitive2d/polygonprimitive2d.hxx | 6 +-- .../primitive2d/polypolygonprimitive2d.hxx | 8 ++-- .../drawinglayer/primitive2d/primitivetools2d.hxx | 12 ++--- .../drawinglayer/primitive2d/sceneprimitive2d.hxx | 2 +- .../drawinglayer/primitive2d/shadowprimitive2d.hxx | 7 ++- .../primitive2d/texteffectprimitive2d.hxx | 10 +++-- .../drawinglayer/primitive2d/textprimitive2d.hxx | 2 +- .../primitive2d/unifiedalphaprimitive2d.hxx | 7 ++- .../primitive2d/wrongspellprimitive2d.hxx | 2 +- .../drawinglayer/primitive3d/baseprimitive3d.hxx | 2 +- .../drawinglayer/processor2d/baseprocessor2d.hxx | 2 +- .../drawinglayer/processor2d/canvasprocessor.hxx | 2 +- .../source/primitive2d/animatedprimitive2d.cxx | 52 +++++----------------- .../primitive2d/backgroundcolorprimitive2d.cxx | 6 +-- .../source/primitive2d/baseprimitive2d.cxx | 14 +++--- .../source/primitive2d/bitmapprimitive2d.cxx | 4 +- .../source/primitive2d/borderlineprimitive2d.cxx | 4 +- .../source/primitive2d/controlprimitive2d.cxx | 8 ++-- .../source/primitive2d/embedded3dprimitive2d.cxx | 4 +- .../source/primitive2d/fillbitmapprimitive2d.cxx | 4 +- .../source/primitive2d/fillgradientprimitive2d.cxx | 4 +- .../source/primitive2d/fillhatchprimitive2d.cxx | 4 +- .../source/primitive2d/graphicprimitive2d.cxx | 6 +-- .../source/primitive2d/gridprimitive2d.cxx | 6 +-- .../source/primitive2d/groupprimitive2d.cxx | 16 +++---- .../source/primitive2d/helplineprimitive2d.cxx | 8 ++-- .../source/primitive2d/hittestprimitive2d.cxx | 12 ++--- .../source/primitive2d/markerarrayprimitive2d.cxx | 4 +- .../source/primitive2d/mediaprimitive2d.cxx | 4 +- .../source/primitive2d/metafileprimitive2d.cxx | 4 +- .../source/primitive2d/pagepreviewprimitive2d.cxx | 10 +++-- .../source/primitive2d/pointarrayprimitive2d.cxx | 4 +- .../source/primitive2d/polygonprimitive2d.cxx | 20 ++++----- .../source/primitive2d/polypolygonprimitive2d.cxx | 20 ++++----- .../source/primitive2d/primitivetools2d.cxx | 4 +- .../source/primitive2d/sceneprimitive2d.cxx | 6 +-- .../source/primitive2d/shadowprimitive2d.cxx | 40 ++++++++--------- .../primitive2d/textdecoratedprimitive2d.cxx | 4 +- .../source/primitive2d/texteffectprimitive2d.cxx | 40 +++++++++-------- .../source/primitive2d/textprimitive2d.cxx | 4 +- .../source/primitive2d/unifiedalphaprimitive2d.cxx | 42 ++++++++--------- .../source/primitive2d/wrongspellprimitive2d.cxx | 4 +- .../source/primitive3d/hatchtextureprimitive3d.cxx | 2 +- .../source/processor2d/baseprocessor2d.cxx | 6 +-- .../svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx | 2 +- .../sdr/primitive2d/sdrconnectorprimitive2d.hxx | 2 +- .../sdr/primitive2d/sdrcustomshapeprimitive2d.hxx | 2 +- .../svx/sdr/primitive2d/sdrellipseprimitive2d.hxx | 2 +- svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx | 2 +- .../svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx | 2 +- svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx | 14 +++--- .../sdr/primitive2d/sdrolecontentprimitive2d.hxx | 2 +- svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx | 2 +- .../sdr/primitive2d/sdrrectangleprimitive2d.hxx | 2 +- svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx | 2 +- svx/source/sdr/contact/viewobjectcontact.cxx | 2 +- .../sdr/contact/viewobjectcontactofunocontrol.cxx | 8 ++-- .../sdr/primitive2d/sdrcaptionprimitive2d.cxx | 4 +- .../sdr/primitive2d/sdrconnectorprimitive2d.cxx | 4 +- .../sdr/primitive2d/sdrcustomshapeprimitive2d.cxx | 4 +- .../sdr/primitive2d/sdrdecompositiontools.cxx | 4 +- .../sdr/primitive2d/sdrellipseprimitive2d.cxx | 4 +- svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx | 4 +- .../sdr/primitive2d/sdrmeasureprimitive2d.cxx | 4 +- svx/source/sdr/primitive2d/sdrole2primitive2d.cxx | 14 +++--- .../sdr/primitive2d/sdrolecontentprimitive2d.cxx | 4 +- svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx | 4 +- .../sdr/primitive2d/sdrrectangleprimitive2d.cxx | 4 +- svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx | 6 +-- svx/source/svdraw/svdotextdecomposition.cxx | 16 +++---- svx/source/svdraw/svdotextpathdecomposition.cxx | 20 ++++----- svx/source/table/viewcontactoftableobj.cxx | 12 ++--- 92 files changed, 358 insertions(+), 348 deletions(-) (limited to 'drawinglayer/inc/drawinglayer/primitive2d') diff --git a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx index 6811b6ba857b..296d56efe6d8 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx @@ -59,19 +59,11 @@ namespace drawinglayer // definition and is owned by this implementation animation::AnimationEntry* mpAnimationEntry; - // the last remembered decompose time, created and used by getDecomposition() for - // buffering purposes - double mfDecomposeViewTime; - // bitfield // flag if this is a text or graphic animation. Necessary since SdrViews need to differentiate // between both types if they are on/off unsigned mbIsTextAnimation : 1; - protected: - // create local decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - public: AnimatedSwitchPrimitive2D( const animation::AnimationEntry& rAnimationEntry, @@ -87,9 +79,6 @@ 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/backgroundcolorprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx index 47cebbca87e4..5731a1e45ee6 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class BackgroundColorPrimitive2D : public BufDecPrimitive2D + class BackgroundColorPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::BColor maBColor; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx index f33b9697bff8..416fdd2d9816 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx @@ -106,8 +106,26 @@ namespace drawinglayer unique UNO APIs may be defined/implemented for these set to allow more intense work with primitives using UNO. - Current Basic Primitives are: - (add list here) + Current five Basic Primitives are: + + - BitmapPrimitive2D (bitmap data, evtl. with alpha) + - MetafilePrimitive2D (VCL Metafile, currently no decomposition, but planned, so may vanish) + - PointArrayPrimitive2D (single points) + - PolygonHairlinePrimitive2D (hairline curves/polygons) + - PolyPolygonColorPrimitive2D (colored polygons) + + All other implemented primitives have a defined decomposition and can thus be + decomposed downt to this small set. + + A renderer implementing support for this minimal set of primitives can completely + render primitive-based visualisations. Of course, he also has to take states into account + which are representated by the following GroupPrimitive2D derivations: + + - AlphaPrimitive2D (objects with freely defined transparence) + - InvertPrimitive2D (for XOR) + - MaskPrimitive2D (for masking) + - ModifiedColorPrimitive2D (for a stack of color modifications) + - TransformPrimitive2D (for a transformation stack) To support getting the geometric BoundRect, getB2DRange is used. The default implementation will use the get2DDecomposition result and merge a range from the @@ -183,7 +201,7 @@ namespace drawinglayer } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// -// BufDecPrimitive2D class +// BufferedDecompositionPrimitive2D class namespace drawinglayer { @@ -216,7 +234,7 @@ namespace drawinglayer to identify if a new decomposition is needed at the next call (f) return maLocal2DDecomposition */ - class BufDecPrimitive2D + class BufferedDecompositionPrimitive2D : public BasePrimitive2D { private: @@ -238,7 +256,7 @@ namespace drawinglayer public: // constructor/destructor - BufDecPrimitive2D(); + BufferedDecompositionPrimitive2D(); /** The getDecomposition default implementation will on demand use createLocal2DDecomposition() if maLocal2DDecomposition is empty. It will set maLocal2DDecomposition to this obtained decomposition @@ -264,7 +282,7 @@ namespace drawinglayer // get B2DRange from a given Primitive2DSequence basegfx::B2DRange getB2DRangeFromPrimitive2DSequence(const Primitive2DSequence& rCandidate, const geometry::ViewInformation2D& aViewInformation); - // compare two Primitive2DReferences for equality, including trying to get implementations (BufDecPrimitive2D) + // compare two Primitive2DReferences for equality, including trying to get implementations (BufferedDecompositionPrimitive2D) // and using compare operator bool arePrimitive2DReferencesEqual(const Primitive2DReference& rA, const Primitive2DReference& rB); diff --git a/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx index 4a1244126b6b..d295c6ab4b89 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class BitmapPrimitive2D : public BufDecPrimitive2D + class BitmapPrimitive2D : public BasePrimitive2D { private: BitmapEx maBitmapEx; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx index f7e66e367478..88ca4c02935b 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class BorderLinePrimitive2D : public BufDecPrimitive2D + class BorderLinePrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DPoint maStart; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx index 9902fbfa04d7..591407302a37 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class ControlPrimitive2D : public BufDecPrimitive2D + class ControlPrimitive2D : public BufferedDecompositionPrimitive2D { private: // object's base data diff --git a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx index f81c91374969..aef3c0173b43 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx @@ -48,7 +48,7 @@ namespace drawinglayer { namespace primitive2d { - class Embedded3DPrimitive2D : public BufDecPrimitive2D + class Embedded3DPrimitive2D : public BufferedDecompositionPrimitive2D { private: // the sequence of 3d primitives diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx index 0689ff8d6bcc..012824f187bd 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class FillBitmapPrimitive2D : public BufDecPrimitive2D + class FillBitmapPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DHomMatrix maTransformation; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx index cc05f0fc0b07..fbf4e7c34a3f 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class FillGradientPrimitive2D : public BufDecPrimitive2D + class FillGradientPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DRange maObjectRange; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx index 9d3ca6feef99..10cb9a622140 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class FillHatchPrimitive2D : public BufDecPrimitive2D + class FillHatchPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DRange maObjectRange; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx index 5057a3c63261..cfc29ac8d06e 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class GraphicPrimitive2D : public BufDecPrimitive2D + class GraphicPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DHomMatrix maTransform; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx index cf2bd35ba57c..1b1325c4b4f9 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx @@ -48,7 +48,7 @@ namespace drawinglayer { namespace primitive2d { - class GridPrimitive2D : public BufDecPrimitive2D + class GridPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DHomMatrix maTransform; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx index 80187efb3b78..bf30efb66311 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx @@ -45,16 +45,31 @@ namespace drawinglayer { namespace primitive2d { - class GroupPrimitive2D : public BufDecPrimitive2D + /** Baseclass for all grouping 2D primitives + + The grouping primitive in it's basic form is capable of holding + a child primitive content and returns it on decomposition on default. + It is used for two main purposes, but more may apply: + + - to transport extended information, e.g. for text classification, + see e.g. TextHierarchy*Primitive2D implementations. Since they + decompose to their child content, renderers not aware/interested + in that extra information will just ignore these primitives + + - to encapsulate common geometry, e.g. the ShadowPrimitive2D implements + applying a generic shadow to a child sequence by adding the needed + offset and color stuff in the decomposition + + In most cases the decomposition is straightforward, so by default + this primitive will not buffer the result and is not derived from + BufferedDecompositionPrimitive2D, but from BasePrimitive2D. + */ + class GroupPrimitive2D : public BasePrimitive2D { private: // the children. Declared private since this shall never be changed at all after construction Primitive2DSequence maChildren; - protected: - // local decomposition. Implementation will just return children - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - public: // constructor GroupPrimitive2D(const Primitive2DSequence& rChildren); @@ -65,6 +80,9 @@ namespace drawinglayer // compare operator virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + // local decomposition. Implementation will just return children + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + // provide unique ID DeclPrimitrive2DIDBlock() }; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx index 28262adacf80..53abdfa133c8 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx @@ -53,7 +53,7 @@ namespace drawinglayer HELPLINESTYLE2D_LINE }; - class HelplinePrimitive2D : public BufDecPrimitive2D + class HelplinePrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DPoint maPosition; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx index 5c964fdc4ecb..1df9ca2111af 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx @@ -54,11 +54,6 @@ namespace drawinglayer // (and maybe BoundRect extractors) will use it and it's children subcontent. class HitTestPrimitive2D : public GroupPrimitive2D { - protected: - // local decomposition. Implementation will return empty Primitive2DSequence - // since this is no visualisation data - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - public: HitTestPrimitive2D(const Primitive2DSequence& rChildren); @@ -67,6 +62,10 @@ namespace drawinglayer // the local implementation will return the children's range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + // local decomposition. Implementation will return empty Primitive2DSequence + // since this is no visualisation data + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + // provide unique ID DeclPrimitrive2DIDBlock() }; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx index ad6a0b565980..02f254368bc1 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class MarkerArrayPrimitive2D : public BufDecPrimitive2D + class MarkerArrayPrimitive2D : public BufferedDecompositionPrimitive2D { private: std::vector< basegfx::B2DPoint > maPositions; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx index b3baa0334edd..f5d21fa40e3e 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class MediaPrimitive2D : public BufDecPrimitive2D + class MediaPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DHomMatrix maTransform; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx index 9104fbf7c83e..23eb5dd1b36e 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class MetafilePrimitive2D : public BufDecPrimitive2D + class MetafilePrimitive2D : public BasePrimitive2D { private: basegfx::B2DHomMatrix maMetaFileTransform; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx index bbe05fcf9cb1..f44de611d609 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx @@ -36,7 +36,7 @@ #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX -#include +#include #include #include @@ -47,11 +47,11 @@ namespace drawinglayer namespace primitive2d { // This primitive is needed to have the correct XDrawPage as ViewInformation for decomposing - // the page contents (given as childs of the GroupPrimitive2D here) if these contain e.g. + // the page contents (given as PageContent here) if these contain e.g. // view-dependent (in this case XDrawPage-dependent) text fields like PageNumber. If You want // those primitives to be visualized correctly, Your renderer needs to locally correct it's // ViewInformation2D to reference the new XDrawPage. - class PagePreviewPrimitive2D : public GroupPrimitive2D + class PagePreviewPrimitive2D : public BufferedDecompositionPrimitive2D { private: // the XDrawPage visualized by this primitive. When we go forward with primitives @@ -59,6 +59,9 @@ namespace drawinglayer // graphic attribute context, but also to completely create the page's sub-content. const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxDrawPage; + // the PageContent + Primitive2DSequence maPageContent; + // the own geometry basegfx::B2DHomMatrix maTransform; @@ -80,11 +83,12 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rTransform, double fContentWidth, double fContentHeight, - const Primitive2DSequence& rChildren, + const Primitive2DSequence& rPageContent, bool bKeepAspectRatio); // get data const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& getXDrawPage() const { return mxDrawPage; } + const Primitive2DSequence& getPageContent() const { return maPageContent; } const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } double getContentWidth() const { return mfContentWidth; } double getContentHeight() const { return mfContentHeight; } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx index 474921086138..7e82f53c2401 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx @@ -46,14 +46,14 @@ namespace drawinglayer { namespace primitive2d { - class PointArrayPrimitive2D : public BufDecPrimitive2D + class PointArrayPrimitive2D : public BasePrimitive2D { private: std::vector< basegfx::B2DPoint > maPositions; basegfx::BColor maRGBColor; // #i96669# add simple range buffering for this primitive - basegfx::B2DRange maB2DRange; + basegfx::B2DRange maB2DRange; public: PointArrayPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx index 8c22fa299167..c82f54fdfab0 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -49,7 +49,7 @@ namespace drawinglayer { namespace primitive2d { - class PolygonHairlinePrimitive2D : public BufDecPrimitive2D + class PolygonHairlinePrimitive2D : public BasePrimitive2D { private: basegfx::B2DPolygon maPolygon; @@ -81,7 +81,7 @@ namespace drawinglayer { namespace primitive2d { - class PolygonMarkerPrimitive2D : public BufDecPrimitive2D + class PolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DPolygon maPolygon; @@ -131,7 +131,7 @@ namespace drawinglayer { namespace primitive2d { - class PolygonStrokePrimitive2D : public BufDecPrimitive2D + class PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DPolygon maPolygon; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index 6f63ff5d18bc..d152b962de25 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -51,7 +51,7 @@ namespace drawinglayer { namespace primitive2d { - class PolyPolygonHairlinePrimitive2D : public BufDecPrimitive2D + class PolyPolygonHairlinePrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DPolyPolygon maPolyPolygon; @@ -87,7 +87,7 @@ namespace drawinglayer { namespace primitive2d { - class PolyPolygonMarkerPrimitive2D : public BufDecPrimitive2D + class PolyPolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DPolyPolygon maPolyPolygon; @@ -131,7 +131,7 @@ namespace drawinglayer { namespace primitive2d { - class PolyPolygonStrokePrimitive2D : public BufDecPrimitive2D + class PolyPolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DPolyPolygon maPolyPolygon; @@ -223,7 +223,7 @@ namespace drawinglayer { namespace primitive2d { - class PolyPolygonColorPrimitive2D : public BufDecPrimitive2D + class PolyPolygonColorPrimitive2D : public BasePrimitive2D { private: basegfx::B2DPolyPolygon maPolyPolygon; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx index 04b4de88c449..3a0977003915 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx @@ -39,7 +39,7 @@ #include ////////////////////////////////////////////////////////////////////////////// -// tooling class for BufDecPrimitive2D baseed classes which are view-dependent +// tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent // regarding the size of a discrete unit. The implementation of get2DDecomposition // guards the buffered local decomposition and ensures that a createLocal2DDecomposition // implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit() @@ -48,7 +48,7 @@ namespace drawinglayer { namespace primitive2d { - class DiscreteMetricDependentPrimitive2D : public BufDecPrimitive2D + class DiscreteMetricDependentPrimitive2D : public BufferedDecompositionPrimitive2D { private: // the last used fDiscreteUnit definitions for decomposition. Since this @@ -58,7 +58,7 @@ namespace drawinglayer public: DiscreteMetricDependentPrimitive2D() - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), mfDiscreteUnit(0.0) { } @@ -73,7 +73,7 @@ namespace drawinglayer } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// -// tooling class for BufDecPrimitive2D baseed classes which are view-dependent +// tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent // regarding the viewport. The implementation of get2DDecomposition // guards the buffered local decomposition and ensures that a createLocal2DDecomposition // implementation may use an up-to-date Viewport accessible using getViewport() @@ -82,7 +82,7 @@ namespace drawinglayer { namespace primitive2d { - class ViewportDependentPrimitive2D : public BufDecPrimitive2D + class ViewportDependentPrimitive2D : public BufferedDecompositionPrimitive2D { private: // the last used Viewport definition for decomposition. Since this @@ -92,7 +92,7 @@ namespace drawinglayer public: ViewportDependentPrimitive2D() - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maViewport() { } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx index 76783abb5372..0f8e55492688 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx @@ -48,7 +48,7 @@ namespace drawinglayer { namespace primitive2d { - class ScenePrimitive2D : public BufDecPrimitive2D + class ScenePrimitive2D : public BufferedDecompositionPrimitive2D { private: primitive3d::Primitive3DSequence mxChildren3D; // the 3d sub-primitives diff --git a/drawinglayer/inc/drawinglayer/primitive2d/shadowprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/shadowprimitive2d.hxx index b30d96edcfca..3da621f5f174 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/shadowprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/shadowprimitive2d.hxx @@ -52,10 +52,6 @@ namespace drawinglayer basegfx::B2DHomMatrix maShadowTransform; basegfx::BColor maShadowColor; - protected: - // create decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - public: ShadowPrimitive2D( const basegfx::B2DHomMatrix& rShadowTransform, @@ -72,6 +68,9 @@ namespace drawinglayer // get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + // create decomposition + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + // provide unique ID DeclPrimitrive2DIDBlock() }; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx index aa4d41349f14..2a9c890b2b3d 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx @@ -36,7 +36,7 @@ #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX -#include +#include #include ////////////////////////////////////////////////////////////////////////////// @@ -54,9 +54,12 @@ namespace drawinglayer TEXTEFFECTSTYLE2D_OUTLINE }; - class TextEffectPrimitive2D : public GroupPrimitive2D + class TextEffectPrimitive2D : public BufferedDecompositionPrimitive2D { private: + // the text content + Primitive2DSequence maTextContent; + // the style to apply, the direction and the rotation center const basegfx::B2DPoint maRotationCenter; double mfDirection; @@ -72,12 +75,13 @@ namespace drawinglayer public: TextEffectPrimitive2D( - const Primitive2DSequence& rChildren, + const Primitive2DSequence& rTextContent, const basegfx::B2DPoint& rRotationCenter, double fDirection, TextEffectStyle2D eTextEffectStyle2D); // get data + const Primitive2DSequence& getTextContent() const { return maTextContent; } const basegfx::B2DPoint& getRotationCenter() const { return maRotationCenter; } double getDirection() const { return mfDirection; } TextEffectStyle2D getTextEffectStyle2D() const { return meTextEffectStyle2D; } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx index 51bb93a41e91..775fa2bd36e5 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx @@ -123,7 +123,7 @@ namespace drawinglayer { namespace primitive2d { - class TextSimplePortionPrimitive2D : public BufDecPrimitive2D + class TextSimplePortionPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DHomMatrix maTextTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range diff --git a/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx index 0ed1900ae14f..d7ca69129e02 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx @@ -49,10 +49,6 @@ namespace drawinglayer private: double mfAlpha; // unified transparence - protected: - // create decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - public: UnifiedAlphaPrimitive2D( const Primitive2DSequence& rChildren, @@ -64,6 +60,9 @@ namespace drawinglayer // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + // create decomposition + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + // provide unique ID DeclPrimitrive2DIDBlock() }; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx index d2e108e2844a..bddb951bea9c 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class WrongSpellPrimitive2D : public BufDecPrimitive2D + class WrongSpellPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DHomMatrix maTransformation; diff --git a/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx index 5f4bef5a02af..4dc5a7da4acb 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx @@ -192,7 +192,7 @@ namespace drawinglayer // get range3D from a given Primitive3DSequence basegfx::B3DRange getB3DRangeFromPrimitive3DSequence(const Primitive3DSequence& rCandidate, const geometry::ViewInformation3D& aViewInformation); - // compare two Primitive2DReferences for equality, including trying to get implementations (BufDecPrimitive2D) + // compare two Primitive2DReferences for equality, including trying to get implementations (BufferedDecompositionPrimitive2D) // and using compare operator bool arePrimitive3DReferencesEqual(const Primitive3DReference& rA, const Primitive3DReference& rB); diff --git a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx index c9e31eecba91..5139b4d72119 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx @@ -57,7 +57,7 @@ namespace drawinglayer } // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BufDecPrimitive2D-based. + // virtual render method when the primitive implementation is BufferedDecompositionPrimitive2D-based. // Default implementation does nothing virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); diff --git a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx index a100d2bae5c0..ac15ec5f12cf 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx @@ -103,7 +103,7 @@ namespace drawinglayer LanguageType meLang; // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BufDecPrimitive2D-based. + // virtual render method when the primitive implementation is BufferedDecompositionPrimitive2D-based. virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); // direct primitive renderer support diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx index efa6df7c5e35..d2b824962fbf 100644 --- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx @@ -52,33 +52,12 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence AnimatedSwitchPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const - { - if(getChildren().hasElements()) - { - const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime())); - const sal_uInt32 nLen(getChildren().getLength()); - sal_uInt32 nIndex(basegfx::fround(fState * (double)nLen)); - - if(nIndex >= nLen) - { - nIndex = nLen - 1L; - } - - const Primitive2DReference xRef(getChildren()[nIndex], uno::UNO_QUERY_THROW); - return Primitive2DSequence(&xRef, 1L); - } - - return Primitive2DSequence(); - } - AnimatedSwitchPrimitive2D::AnimatedSwitchPrimitive2D( const animation::AnimationEntry& rAnimationEntry, const Primitive2DSequence& rChildren, bool bIsTextAnimation) : GroupPrimitive2D(rChildren), mpAnimationEntry(0), - mfDecomposeViewTime(0.0), mbIsTextAnimation(bIsTextAnimation) { // clone given animation description @@ -105,29 +84,22 @@ namespace drawinglayer Primitive2DSequence AnimatedSwitchPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - ::osl::MutexGuard aGuard( m_aMutex ); - - if(getLocal2DDecomposition().hasElements() && mfDecomposeViewTime != rViewInformation.getViewTime()) + if(getChildren().hasElements()) { - // conditions of last local decomposition have changed, delete - const_cast< AnimatedSwitchPrimitive2D* >(this)->setLocal2DDecomposition(Primitive2DSequence()); - } + const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime())); + const sal_uInt32 nLen(getChildren().getLength()); + sal_uInt32 nIndex(basegfx::fround(fState * (double)nLen)); - if(!getLocal2DDecomposition().hasElements()) - { - // remember time - const_cast< AnimatedSwitchPrimitive2D* >(this)->mfDecomposeViewTime = rViewInformation.getViewTime(); - } + if(nIndex >= nLen) + { + nIndex = nLen - 1L; + } - // use parent implementation - return GroupPrimitive2D::get2DDecomposition(rViewInformation); - } + const Primitive2DReference xRef(getChildren()[nIndex], uno::UNO_QUERY_THROW); + return Primitive2DSequence(&xRef, 1L); + } - basegfx::B2DRange AnimatedSwitchPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const - { - // to get range from decomposition and not from group content, call implementation from - // BufDecPrimitive2D here - return BufDecPrimitive2D::getB2DRange(rViewInformation); + return Primitive2DSequence(); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx index 68527b93d9cb..723a684c51ec 100644 --- a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx @@ -70,7 +70,7 @@ namespace drawinglayer BackgroundColorPrimitive2D::BackgroundColorPrimitive2D( const basegfx::BColor& rBColor) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maBColor(rBColor), maLastViewport() { @@ -78,7 +78,7 @@ namespace drawinglayer bool BackgroundColorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const BackgroundColorPrimitive2D& rCompare = (BackgroundColorPrimitive2D&)rPrimitive; @@ -111,7 +111,7 @@ namespace drawinglayer } // use parent implementation - return BufDecPrimitive2D::get2DDecomposition(rViewInformation); + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx b/drawinglayer/source/primitive2d/baseprimitive2d.cxx index 3ac7253a42a3..db391ab1b548 100644 --- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx @@ -94,25 +94,25 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence BufDecPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence BufferedDecompositionPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { return Primitive2DSequence(); } - BufDecPrimitive2D::BufDecPrimitive2D() + BufferedDecompositionPrimitive2D::BufferedDecompositionPrimitive2D() : BasePrimitive2D(), maLocal2DDecomposition() { } - Primitive2DSequence BufDecPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence BufferedDecompositionPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); if(!getLocal2DDecomposition().hasElements()) { const Primitive2DSequence aNewSequence(createLocal2DDecomposition(rViewInformation)); - const_cast< BufDecPrimitive2D* >(this)->setLocal2DDecomposition(aNewSequence); + const_cast< BufferedDecompositionPrimitive2D* >(this)->setLocal2DDecomposition(aNewSequence); } return getLocal2DDecomposition(); @@ -135,7 +135,7 @@ namespace drawinglayer if(rCandidate.is()) { // try to get C++ implementation base - const BufDecPrimitive2D* pCandidate(dynamic_cast< BufDecPrimitive2D* >(rCandidate.get())); + const BufferedDecompositionPrimitive2D* pCandidate(dynamic_cast< BufferedDecompositionPrimitive2D* >(rCandidate.get())); if(pCandidate) { @@ -185,8 +185,8 @@ namespace drawinglayer return true; } - const BufDecPrimitive2D* pA(dynamic_cast< const BufDecPrimitive2D* >(rxA.get())); - const BufDecPrimitive2D* pB(dynamic_cast< const BufDecPrimitive2D* >(rxB.get())); + const BufferedDecompositionPrimitive2D* pA(dynamic_cast< const BufferedDecompositionPrimitive2D* >(rxA.get())); + const BufferedDecompositionPrimitive2D* pB(dynamic_cast< const BufferedDecompositionPrimitive2D* >(rxB.get())); const bool bAEqualZero(pA == 0L); if(bAEqualZero != (pB == 0L)) diff --git a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx index 67e8dc800b12..5900900bcf06 100644 --- a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx @@ -53,7 +53,7 @@ namespace drawinglayer BitmapPrimitive2D::BitmapPrimitive2D( const BitmapEx& rBitmapEx, const basegfx::B2DHomMatrix& rTransform) - : BufDecPrimitive2D(), + : BasePrimitive2D(), maBitmapEx(rBitmapEx), maTransform(rTransform) { @@ -61,7 +61,7 @@ namespace drawinglayer bool BitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BasePrimitive2D::operator==(rPrimitive)) { const BitmapPrimitive2D& rCompare = (BitmapPrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx index c2c4e46464a0..205f11d688b0 100644 --- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx @@ -194,7 +194,7 @@ namespace drawinglayer bool bCreateInside, bool bCreateOutside, const basegfx::BColor& rRGBColor) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maStart(rStart), maEnd(rEnd), mfLeftWidth(fLeftWidth), @@ -212,7 +212,7 @@ namespace drawinglayer bool BorderLinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const BorderLinePrimitive2D& rCompare = (BorderLinePrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index ecc05621f075..46392106f410 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -283,7 +283,7 @@ namespace drawinglayer ControlPrimitive2D::ControlPrimitive2D( const basegfx::B2DHomMatrix& rTransform, const uno::Reference< awt::XControlModel >& rxControlModel) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), mxControlModel(rxControlModel), mxXControl(), @@ -295,7 +295,7 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rTransform, const uno::Reference< awt::XControlModel >& rxControlModel, const uno::Reference< awt::XControl >& rxXControl) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), mxControlModel(rxControlModel), mxXControl(rxXControl), @@ -316,7 +316,7 @@ namespace drawinglayer bool ControlPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { // use base class compare operator - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const ControlPrimitive2D& rCompare = (ControlPrimitive2D&)rPrimitive; @@ -381,7 +381,7 @@ namespace drawinglayer } // use parent implementation - return BufDecPrimitive2D::get2DDecomposition(rViewInformation); + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx index f2c8dd5c4d98..c796048a4bf3 100644 --- a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx @@ -102,7 +102,7 @@ namespace drawinglayer const basegfx::B3DVector& rLightNormal, double fShadowSlant, const basegfx::B3DRange& rScene3DRange) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), mxChildren3D(rxChildren3D), maObjectTransformation(rObjectTransformation), maViewInformation3D(rViewInformation3D), @@ -118,7 +118,7 @@ namespace drawinglayer bool Embedded3DPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const Embedded3DPrimitive2D& rCompare = static_cast< const Embedded3DPrimitive2D& >(rPrimitive); diff --git a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx index a35bf6eeffe9..636c798f448c 100644 --- a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx @@ -105,7 +105,7 @@ namespace drawinglayer FillBitmapPrimitive2D::FillBitmapPrimitive2D( const basegfx::B2DHomMatrix& rTransformation, const attribute::FillBitmapAttribute& rFillBitmap) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransformation(rTransformation), maFillBitmap(rFillBitmap) { @@ -113,7 +113,7 @@ namespace drawinglayer bool FillBitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const FillBitmapPrimitive2D& rCompare = static_cast< const FillBitmapPrimitive2D& >(rPrimitive); diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx index 8e820f61fbb2..283123621cee 100644 --- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx @@ -167,7 +167,7 @@ namespace drawinglayer FillGradientPrimitive2D::FillGradientPrimitive2D( const basegfx::B2DRange& rObjectRange, const attribute::FillGradientAttribute& rFillGradient) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maObjectRange(rObjectRange), maFillGradient(rFillGradient) { @@ -175,7 +175,7 @@ namespace drawinglayer bool FillGradientPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const FillGradientPrimitive2D& rCompare = (FillGradientPrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx index 42b8483fe172..1446e5677cdf 100644 --- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx @@ -125,7 +125,7 @@ namespace drawinglayer const basegfx::B2DRange& rObjectRange, const basegfx::BColor& rBColor, const attribute::FillHatchAttribute& rFillHatch) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maObjectRange(rObjectRange), maFillHatch(rFillHatch), maBColor(rBColor) @@ -134,7 +134,7 @@ namespace drawinglayer bool FillHatchPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const FillHatchPrimitive2D& rCompare = (FillHatchPrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index 94bd7befcda6..8f1e138d4ca4 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -379,7 +379,7 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rTransform, const GraphicObject& rGraphicObject, const GraphicAttr& rGraphicAttr) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maGraphicObject(rGraphicObject), maGraphicAttr(rGraphicAttr) @@ -389,7 +389,7 @@ namespace drawinglayer GraphicPrimitive2D::GraphicPrimitive2D( const basegfx::B2DHomMatrix& rTransform, const GraphicObject& rGraphicObject) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maGraphicObject(rGraphicObject), maGraphicAttr() @@ -398,7 +398,7 @@ namespace drawinglayer bool GraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const GraphicPrimitive2D& rCompare = (GraphicPrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive2d/gridprimitive2d.cxx b/drawinglayer/source/primitive2d/gridprimitive2d.cxx index 75ba4102da0b..083b5adefa9c 100644 --- a/drawinglayer/source/primitive2d/gridprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/gridprimitive2d.cxx @@ -248,7 +248,7 @@ namespace drawinglayer sal_uInt32 nSubdivisionsY, const basegfx::BColor& rBColor, const BitmapEx& rCrossMarker) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), mfWidth(fWidth), mfHeight(fHeight), @@ -265,7 +265,7 @@ namespace drawinglayer bool GridPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const GridPrimitive2D& rCompare = (GridPrimitive2D&)rPrimitive; @@ -316,7 +316,7 @@ namespace drawinglayer } // use parent implementation - return BufDecPrimitive2D::get2DDecomposition(rViewInformation); + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/groupprimitive2d.cxx b/drawinglayer/source/primitive2d/groupprimitive2d.cxx index 018c786dff64..c9e2a1ea1438 100644 --- a/drawinglayer/source/primitive2d/groupprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/groupprimitive2d.cxx @@ -49,14 +49,8 @@ namespace drawinglayer { namespace primitive2d { - /// default: just return children, so all renderers not supporting group will use it's content - Primitive2DSequence GroupPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const - { - return getChildren(); - } - GroupPrimitive2D::GroupPrimitive2D( const Primitive2DSequence& rChildren ) - : BufDecPrimitive2D(), + : BasePrimitive2D(), maChildren(rChildren) { } @@ -67,7 +61,7 @@ namespace drawinglayer */ bool GroupPrimitive2D::operator==( const BasePrimitive2D& rPrimitive ) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BasePrimitive2D::operator==(rPrimitive)) { const GroupPrimitive2D& rCompare = static_cast< const GroupPrimitive2D& >(rPrimitive); @@ -77,6 +71,12 @@ namespace drawinglayer return false; } + /// default: just return children, so all renderers not supporting group will use it's content + Primitive2DSequence GroupPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + return getChildren(); + } + // provide unique ID ImplPrimitrive2DIDBlock(GroupPrimitive2D, PRIMITIVE2D_ID_GROUPPRIMITIVE2D) diff --git a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx index e676bc9764f8..3b67c7714796 100644 --- a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx @@ -56,7 +56,7 @@ namespace drawinglayer { Primitive2DSequence HelplinePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - std::vector< BufDecPrimitive2D* > aTempPrimitiveTarget; + std::vector< BufferedDecompositionPrimitive2D* > aTempPrimitiveTarget; if(!rViewInformation.getViewport().isEmpty() && !getDirection().equalZero()) { @@ -167,7 +167,7 @@ namespace drawinglayer const basegfx::BColor& rRGBColA, const basegfx::BColor& rRGBColB, double fDiscreteDashLength) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maPosition(rPosition), maDirection(rDirection), meStyle(eStyle), @@ -181,7 +181,7 @@ namespace drawinglayer bool HelplinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const HelplinePrimitive2D& rCompare = (HelplinePrimitive2D&)rPrimitive; @@ -217,7 +217,7 @@ namespace drawinglayer } // use parent implementation - return BufDecPrimitive2D::get2DDecomposition(rViewInformation); + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/hittestprimitive2d.cxx b/drawinglayer/source/primitive2d/hittestprimitive2d.cxx index ba48e7097bbe..137f8cf8ad5c 100644 --- a/drawinglayer/source/primitive2d/hittestprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/hittestprimitive2d.cxx @@ -49,12 +49,6 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence HitTestPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const - { - // return empty sequence - return Primitive2DSequence(); - } - HitTestPrimitive2D::HitTestPrimitive2D( const Primitive2DSequence& rChildren) : GroupPrimitive2D(rChildren) @@ -66,6 +60,12 @@ namespace drawinglayer return getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation); } + Primitive2DSequence HitTestPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + // return empty sequence + return Primitive2DSequence(); + } + // provide unique ID ImplPrimitrive2DIDBlock(HitTestPrimitive2D, PRIMITIVE2D_ID_HITTESTPRIMITIVE2D) diff --git a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx index 0a6ce405e9a1..b61f5df4bb5f 100644 --- a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx @@ -100,7 +100,7 @@ namespace drawinglayer MarkerArrayPrimitive2D::MarkerArrayPrimitive2D( const std::vector< basegfx::B2DPoint >& rPositions, const BitmapEx& rMarker) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maPositions(rPositions), maMarker(rMarker) { @@ -108,7 +108,7 @@ namespace drawinglayer bool MarkerArrayPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const MarkerArrayPrimitive2D& rCompare = (MarkerArrayPrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx index a4ad85d6c016..df95b7a87c29 100644 --- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx @@ -114,7 +114,7 @@ namespace drawinglayer const rtl::OUString& rURL, const basegfx::BColor& rBackgroundColor, sal_uInt32 nDiscreteBorder) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maURL(rURL), maBackgroundColor(rBackgroundColor), @@ -124,7 +124,7 @@ namespace drawinglayer bool MediaPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const MediaPrimitive2D& rCompare = (MediaPrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 411d2155e4c7..2d1c0428a6a3 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -53,7 +53,7 @@ namespace drawinglayer MetafilePrimitive2D::MetafilePrimitive2D( const basegfx::B2DHomMatrix& rMetaFileTransform, const GDIMetaFile& rMetaFile) - : BufDecPrimitive2D(), + : BasePrimitive2D(), maMetaFileTransform(rMetaFileTransform), maMetaFile(rMetaFile) { @@ -61,7 +61,7 @@ namespace drawinglayer bool MetafilePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BasePrimitive2D::operator==(rPrimitive)) { const MetafilePrimitive2D& rCompare = (MetafilePrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx index 0ef988e7eb44..496415efdba4 100644 --- a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx @@ -56,7 +56,7 @@ namespace drawinglayer Primitive2DSequence PagePreviewPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { Primitive2DSequence xRetval; - Primitive2DSequence aContent(getChildren()); + Primitive2DSequence aContent(getPageContent()); if(aContent.hasElements() && basegfx::fTools::more(getContentWidth(), 0.0) @@ -139,10 +139,11 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rTransform, double fContentWidth, double fContentHeight, - const Primitive2DSequence& rChildren, + const Primitive2DSequence& rPageContent, bool bKeepAspectRatio) - : GroupPrimitive2D(rChildren), + : BufferedDecompositionPrimitive2D(), mxDrawPage(rxDrawPage), + maPageContent(rPageContent), maTransform(rTransform), mfContentWidth(fContentWidth), mfContentHeight(fContentHeight), @@ -152,11 +153,12 @@ namespace drawinglayer bool PagePreviewPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(GroupPrimitive2D::operator==(rPrimitive)) + if(BasePrimitive2D::operator==(rPrimitive)) { const PagePreviewPrimitive2D& rCompare = static_cast< const PagePreviewPrimitive2D& >(rPrimitive); return (getXDrawPage() == rCompare.getXDrawPage() + && getPageContent() == rCompare.getPageContent() && getTransform() == rCompare.getTransform() && getContentWidth() == rCompare.getContentWidth() && getContentHeight() == rCompare.getContentHeight() diff --git a/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx index e5cbaf9721a0..d144fd7030e6 100644 --- a/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx @@ -52,7 +52,7 @@ namespace drawinglayer PointArrayPrimitive2D::PointArrayPrimitive2D( const std::vector< basegfx::B2DPoint >& rPositions, const basegfx::BColor& rRGBColor) - : BufDecPrimitive2D(), + : BasePrimitive2D(), maPositions(rPositions), maRGBColor(rRGBColor), maB2DRange() @@ -61,7 +61,7 @@ namespace drawinglayer bool PointArrayPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BasePrimitive2D::operator==(rPrimitive)) { const PointArrayPrimitive2D& rCompare = (PointArrayPrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index 10d153362e6e..4a3678645571 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -57,7 +57,7 @@ namespace drawinglayer PolygonHairlinePrimitive2D::PolygonHairlinePrimitive2D( const basegfx::B2DPolygon& rPolygon, const basegfx::BColor& rBColor) - : BufDecPrimitive2D(), + : BasePrimitive2D(), maPolygon(rPolygon), maBColor(rBColor) { @@ -65,7 +65,7 @@ namespace drawinglayer bool PolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BasePrimitive2D::operator==(rPrimitive)) { const PolygonHairlinePrimitive2D& rCompare = (PolygonHairlinePrimitive2D&)rPrimitive; @@ -147,7 +147,7 @@ namespace drawinglayer const basegfx::BColor& rRGBColorA, const basegfx::BColor& rRGBColorB, double fDiscreteDashLength) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maPolygon(rPolygon), maRGBColorA(rRGBColorA), maRGBColorB(rRGBColorB), @@ -158,7 +158,7 @@ namespace drawinglayer bool PolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const PolygonMarkerPrimitive2D& rCompare = (PolygonMarkerPrimitive2D&)rPrimitive; @@ -220,7 +220,7 @@ namespace drawinglayer } // use parent implementation - return BufDecPrimitive2D::get2DDecomposition(rViewInformation); + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); } // provide unique ID @@ -307,7 +307,7 @@ namespace drawinglayer const basegfx::B2DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maPolygon(rPolygon), maLineAttribute(rLineAttribute), maStrokeAttribute(rStrokeAttribute) @@ -317,7 +317,7 @@ namespace drawinglayer PolygonStrokePrimitive2D::PolygonStrokePrimitive2D( const basegfx::B2DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maPolygon(rPolygon), maLineAttribute(rLineAttribute), maStrokeAttribute() @@ -326,7 +326,7 @@ namespace drawinglayer bool PolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const PolygonStrokePrimitive2D& rCompare = (PolygonStrokePrimitive2D&)rPrimitive; @@ -348,7 +348,7 @@ namespace drawinglayer { // if line is mitered, use parent call since mitered line // geometry may use more space than the geometry grown by half line width - aRetval = BufDecPrimitive2D::getB2DRange(rViewInformation); + aRetval = BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation); } else { @@ -614,7 +614,7 @@ namespace drawinglayer if(getStart().isActive() || getEnd().isActive()) { // use decomposition when line start/end is used - return BufDecPrimitive2D::getB2DRange(rViewInformation); + return BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation); } else { diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index 9c728cec4f56..163c3a8691aa 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -80,7 +80,7 @@ namespace drawinglayer } PolyPolygonHairlinePrimitive2D::PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maPolyPolygon(rPolyPolygon), maBColor(rBColor) { @@ -88,7 +88,7 @@ namespace drawinglayer bool PolyPolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const PolyPolygonHairlinePrimitive2D& rCompare = (PolyPolygonHairlinePrimitive2D&)rPrimitive; @@ -144,7 +144,7 @@ namespace drawinglayer const basegfx::BColor& rRGBColorA, const basegfx::BColor& rRGBColorB, double fDiscreteDashLength) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maPolyPolygon(rPolyPolygon), maRGBColorA(rRGBColorA), maRGBColorB(rRGBColorB), @@ -154,7 +154,7 @@ namespace drawinglayer bool PolyPolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const PolyPolygonMarkerPrimitive2D& rCompare = (PolyPolygonMarkerPrimitive2D&)rPrimitive; @@ -211,7 +211,7 @@ namespace drawinglayer const basegfx::B2DPolyPolygon& rPolyPolygon, const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maPolyPolygon(rPolyPolygon), maLineAttribute(rLineAttribute), maStrokeAttribute(rStrokeAttribute) @@ -221,7 +221,7 @@ namespace drawinglayer PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, const attribute::LineAttribute& rLineAttribute) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maPolyPolygon(rPolyPolygon), maLineAttribute(rLineAttribute), maStrokeAttribute() @@ -230,7 +230,7 @@ namespace drawinglayer bool PolyPolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const PolyPolygonStrokePrimitive2D& rCompare = (PolyPolygonStrokePrimitive2D&)rPrimitive; @@ -343,7 +343,7 @@ namespace drawinglayer if(getStart().isActive() || getEnd().isActive()) { // use decomposition when line start/end is used - return BufDecPrimitive2D::getB2DRange(rViewInformation); + return BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation); } else { @@ -367,7 +367,7 @@ namespace drawinglayer PolyPolygonColorPrimitive2D::PolyPolygonColorPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor) - : BufDecPrimitive2D(), + : BasePrimitive2D(), maPolyPolygon(rPolyPolygon), maBColor(rBColor) { @@ -375,7 +375,7 @@ namespace drawinglayer bool PolyPolygonColorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BasePrimitive2D::operator==(rPrimitive)) { const PolyPolygonColorPrimitive2D& rCompare = (PolyPolygonColorPrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive2d/primitivetools2d.cxx b/drawinglayer/source/primitive2d/primitivetools2d.cxx index 2f8a1edcd5c5..b441bb1b89ff 100644 --- a/drawinglayer/source/primitive2d/primitivetools2d.cxx +++ b/drawinglayer/source/primitive2d/primitivetools2d.cxx @@ -66,7 +66,7 @@ namespace drawinglayer } // call base implementation - return BufDecPrimitive2D::get2DDecomposition(rViewInformation); + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); } } // end of namespace primitive2d } // end of namespace drawinglayer @@ -97,7 +97,7 @@ namespace drawinglayer } // call base implementation - return BufDecPrimitive2D::get2DDecomposition(rViewInformation); + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); } } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index ba5f747c2dce..935b5a14c2d9 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -298,7 +298,7 @@ namespace drawinglayer const attribute::SdrLightingAttribute& rSdrLightingAttribute, const basegfx::B2DHomMatrix& rObjectTransformation, const geometry::ViewInformation3D& rViewInformation3D) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), mxChildren3D(rxChildren3D), maSdrSceneAttribute(rSdrSceneAttribute), maSdrLightingAttribute(rSdrLightingAttribute), @@ -314,7 +314,7 @@ namespace drawinglayer bool ScenePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const ScenePrimitive2D& rCompare = (ScenePrimitive2D&)rPrimitive; @@ -411,7 +411,7 @@ namespace drawinglayer } // use parent implementation - return BufDecPrimitive2D::get2DDecomposition(rViewInformation); + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx index e0f987c70958..b6ce7dc3248d 100644 --- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx @@ -55,25 +55,6 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence ShadowPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const - { - Primitive2DSequence aRetval; - - if(getChildren().hasElements()) - { - // create a modifiedColorPrimitive containing the shadow color and the content - const basegfx::BColorModifier aBColorModifier(getShadowColor()); - const Primitive2DReference xRefA(new ModifiedColorPrimitive2D(getChildren(), aBColorModifier)); - const Primitive2DSequence aSequenceB(&xRefA, 1L); - - // build transformed primitiveVector with shadow offset and add to target - const Primitive2DReference xRefB(new TransformPrimitive2D(getShadowTransform(), aSequenceB)); - aRetval = Primitive2DSequence(&xRefB, 1L); - } - - return aRetval; - } - ShadowPrimitive2D::ShadowPrimitive2D( const basegfx::B2DHomMatrix& rShadowTransform, const basegfx::BColor& rShadowColor, @@ -86,7 +67,7 @@ namespace drawinglayer bool ShadowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(GroupPrimitive2D::operator==(rPrimitive)) + if(BasePrimitive2D::operator==(rPrimitive)) { const ShadowPrimitive2D& rCompare = static_cast< const ShadowPrimitive2D& >(rPrimitive); @@ -104,6 +85,25 @@ namespace drawinglayer return aRetval; } + Primitive2DSequence ShadowPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + Primitive2DSequence aRetval; + + if(getChildren().hasElements()) + { + // create a modifiedColorPrimitive containing the shadow color and the content + const basegfx::BColorModifier aBColorModifier(getShadowColor()); + const Primitive2DReference xRefA(new ModifiedColorPrimitive2D(getChildren(), aBColorModifier)); + const Primitive2DSequence aSequenceB(&xRefA, 1L); + + // build transformed primitiveVector with shadow offset and add to target + const Primitive2DReference xRefB(new TransformPrimitive2D(getShadowTransform(), aSequenceB)); + aRetval = Primitive2DSequence(&xRefB, 1L); + } + + return aRetval; + } + // provide unique ID ImplPrimitrive2DIDBlock(ShadowPrimitive2D, PRIMITIVE2D_ID_SHADOWPRIMITIVE2D) diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index a78acd6bde31..695c92d2b951 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -822,10 +822,10 @@ namespace drawinglayer if(bDecoratedIsNeeded) { - // decoration is used, fallback to BufDecPrimitive2D::getB2DRange which uses + // decoration is used, fallback to BufferedDecompositionPrimitive2D::getB2DRange which uses // the own local decomposition for computation and thus creates all necessary // geometric objects - return BufDecPrimitive2D::getB2DRange(rViewInformation); + return BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation); } else { diff --git a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx index 9d4b01270369..22e51ae6f630 100644 --- a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx @@ -104,22 +104,22 @@ namespace drawinglayer { // emboss/engrave in black, original forced to white const basegfx::BColorModifier aBColorModifierToGray(basegfx::BColor(0.0)); - const Primitive2DReference xModifiedColor(new ModifiedColorPrimitive2D(getChildren(), aBColorModifierToGray)); + const Primitive2DReference xModifiedColor(new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToGray)); aRetval[0] = Primitive2DReference(new TransformPrimitive2D(aTransform, Primitive2DSequence(&xModifiedColor, 1))); // add original, too const basegfx::BColorModifier aBColorModifierToWhite(basegfx::BColor(1.0)); - aRetval[1] = Primitive2DReference(new ModifiedColorPrimitive2D(getChildren(), aBColorModifierToWhite)); + aRetval[1] = Primitive2DReference(new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToWhite)); } else { // emboss/engrave in gray, keep original's color const basegfx::BColorModifier aBColorModifierToGray(basegfx::BColor(0.75)); // 192 - const Primitive2DReference xModifiedColor(new ModifiedColorPrimitive2D(getChildren(), aBColorModifierToGray)); + const Primitive2DReference xModifiedColor(new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToGray)); aRetval[0] = Primitive2DReference(new TransformPrimitive2D(aTransform, Primitive2DSequence(&xModifiedColor, 1))); // add original, too - aRetval[1] = Primitive2DReference(new GroupPrimitive2D(getChildren())); + aRetval[1] = Primitive2DReference(new GroupPrimitive2D(getTextContent())); } break; @@ -132,39 +132,39 @@ namespace drawinglayer aTransform.set(0, 2, aDistance.getX()); aTransform.set(1, 2, 0.0); - aRetval[0] = Primitive2DReference(new TransformPrimitive2D(aTransform, getChildren())); + aRetval[0] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, aDiagonalDistance.getX()); aTransform.set(1, 2, aDiagonalDistance.getY()); - aRetval[1] = Primitive2DReference(new TransformPrimitive2D(aTransform, getChildren())); + aRetval[1] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, 0.0); aTransform.set(1, 2, aDistance.getY()); - aRetval[2] = Primitive2DReference(new TransformPrimitive2D(aTransform, getChildren())); + aRetval[2] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, -aDiagonalDistance.getX()); aTransform.set(1, 2, aDiagonalDistance.getY()); - aRetval[3] = Primitive2DReference(new TransformPrimitive2D(aTransform, getChildren())); + aRetval[3] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, -aDistance.getX()); aTransform.set(1, 2, 0.0); - aRetval[4] = Primitive2DReference(new TransformPrimitive2D(aTransform, getChildren())); + aRetval[4] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, -aDiagonalDistance.getX()); aTransform.set(1, 2, -aDiagonalDistance.getY()); - aRetval[5] = Primitive2DReference(new TransformPrimitive2D(aTransform, getChildren())); + aRetval[5] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, 0.0); aTransform.set(1, 2, -aDistance.getY()); - aRetval[6] = Primitive2DReference(new TransformPrimitive2D(aTransform, getChildren())); + aRetval[6] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, aDiagonalDistance.getX()); aTransform.set(1, 2, -aDiagonalDistance.getY()); - aRetval[7] = Primitive2DReference(new TransformPrimitive2D(aTransform, getChildren())); + aRetval[7] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); // at last, place original over it, but force to white const basegfx::BColorModifier aBColorModifierToWhite(basegfx::BColor(1.0, 1.0, 1.0)); - aRetval[8] = Primitive2DReference(new ModifiedColorPrimitive2D(getChildren(), aBColorModifierToWhite)); + aRetval[8] = Primitive2DReference(new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToWhite)); break; } @@ -174,11 +174,12 @@ namespace drawinglayer } TextEffectPrimitive2D::TextEffectPrimitive2D( - const Primitive2DSequence& rChildren, + const Primitive2DSequence& rTextContent, const basegfx::B2DPoint& rRotationCenter, double fDirection, TextEffectStyle2D eTextEffectStyle2D) - : GroupPrimitive2D(rChildren), + : BufferedDecompositionPrimitive2D(), + maTextContent(rTextContent), maRotationCenter(rRotationCenter), mfDirection(fDirection), meTextEffectStyle2D(eTextEffectStyle2D) @@ -187,11 +188,12 @@ namespace drawinglayer bool TextEffectPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(GroupPrimitive2D::operator==(rPrimitive)) + if(BasePrimitive2D::operator==(rPrimitive)) { const TextEffectPrimitive2D& rCompare = (TextEffectPrimitive2D&)rPrimitive; - return (getRotationCenter() == rCompare.getRotationCenter() + return (getTextContent() == rCompare.getTextContent() + && getRotationCenter() == rCompare.getRotationCenter() && getDirection() == rCompare.getDirection() && getTextEffectStyle2D() == rCompare.getTextEffectStyle2D()); } @@ -206,7 +208,7 @@ namespace drawinglayer // then will ask 9 times at nearly the same content. This may even be refined here using the // TextEffectStyle information, e.g. for TEXTEFFECTSTYLE2D_RELIEF the grow needs only to // be in two directions - basegfx::B2DRange aRetval(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation)); + basegfx::B2DRange aRetval(getB2DRangeFromPrimitive2DSequence(getTextContent(), rViewInformation)); aRetval.grow(fDiscreteSize); return aRetval; @@ -232,7 +234,7 @@ namespace drawinglayer } // use parent implementation - return BufDecPrimitive2D::get2DDecomposition(rViewInformation); + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index e14f3fd714df..b74c4eabf898 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -241,7 +241,7 @@ namespace drawinglayer const FontAttributes& rFontAttributes, const ::com::sun::star::lang::Locale& rLocale, const basegfx::BColor& rFontColor) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTextTransform(rNewTransform), maText(rText), maTextPosition(aTextPosition), @@ -268,7 +268,7 @@ namespace drawinglayer bool TextSimplePortionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const TextSimplePortionPrimitive2D& rCompare = (TextSimplePortionPrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx b/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx index a17431597356..a66ac0f3a539 100644 --- a/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx @@ -55,7 +55,27 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence UnifiedAlphaPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + UnifiedAlphaPrimitive2D::UnifiedAlphaPrimitive2D( + const Primitive2DSequence& rChildren, + double fAlpha) + : GroupPrimitive2D(rChildren), + mfAlpha(fAlpha) + { + } + + bool UnifiedAlphaPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(GroupPrimitive2D::operator==(rPrimitive)) + { + const UnifiedAlphaPrimitive2D& rCompare = (UnifiedAlphaPrimitive2D&)rPrimitive; + + return (getAlpha() == rCompare.getAlpha()); + } + + return false; + } + + Primitive2DSequence UnifiedAlphaPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { if(0.0 == getAlpha()) { @@ -99,26 +119,6 @@ namespace drawinglayer } } - UnifiedAlphaPrimitive2D::UnifiedAlphaPrimitive2D( - const Primitive2DSequence& rChildren, - double fAlpha) - : GroupPrimitive2D(rChildren), - mfAlpha(fAlpha) - { - } - - bool UnifiedAlphaPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const - { - if(GroupPrimitive2D::operator==(rPrimitive)) - { - const UnifiedAlphaPrimitive2D& rCompare = (UnifiedAlphaPrimitive2D&)rPrimitive; - - return (getAlpha() == rCompare.getAlpha()); - } - - return false; - } - // provide unique ID ImplPrimitrive2DIDBlock(UnifiedAlphaPrimitive2D, PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D) diff --git a/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx b/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx index 756a52ea7d2b..07022229bfa8 100644 --- a/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx @@ -97,7 +97,7 @@ namespace drawinglayer double fStart, double fStop, const basegfx::BColor& rColor) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransformation(rTransformation), mfStart(fStart), mfStop(fStop), @@ -107,7 +107,7 @@ namespace drawinglayer bool WrongSpellPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const WrongSpellPrimitive2D& rCompare = (WrongSpellPrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx index 3e723008148e..a0d202dc9dbe 100644 --- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx @@ -76,7 +76,7 @@ namespace drawinglayer if(xReference.is()) { - // try to cast to BufDecPrimitive2D implementation + // try to cast to BufferedDecompositionPrimitive2D implementation const BufDecPrimitive3D* pBasePrimitive = dynamic_cast< const BufDecPrimitive3D* >(xReference.get()); if(pBasePrimitive) diff --git a/drawinglayer/source/processor2d/baseprocessor2d.cxx b/drawinglayer/source/processor2d/baseprocessor2d.cxx index d20eca83fc7e..28023c8b253f 100644 --- a/drawinglayer/source/processor2d/baseprocessor2d.cxx +++ b/drawinglayer/source/processor2d/baseprocessor2d.cxx @@ -74,12 +74,12 @@ namespace drawinglayer if(xReference.is()) { - // try to cast to BufDecPrimitive2D implementation - const primitive2d::BufDecPrimitive2D* pBasePrimitive = dynamic_cast< const primitive2d::BufDecPrimitive2D* >(xReference.get()); + // try to cast to BufferedDecompositionPrimitive2D implementation + const primitive2d::BufferedDecompositionPrimitive2D* pBasePrimitive = dynamic_cast< const primitive2d::BufferedDecompositionPrimitive2D* >(xReference.get()); if(pBasePrimitive) { - // it is a BufDecPrimitive2D implementation, use local processor + // it is a BufferedDecompositionPrimitive2D implementation, use local processor processBasePrimitive2D(*pBasePrimitive); } else diff --git a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx index d7beffc7cd8c..26ce0fc0673a 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrCaptionPrimitive2D : public BufDecPrimitive2D + class SdrCaptionPrimitive2D : public BufferedDecompositionPrimitive2D { private: ::basegfx::B2DHomMatrix maTransform; diff --git a/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx index a6bf4b9b090e..a7465c1c7a4a 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx @@ -45,7 +45,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrConnectorPrimitive2D : public BufDecPrimitive2D + class SdrConnectorPrimitive2D : public BufferedDecompositionPrimitive2D { private: attribute::SdrLineShadowTextAttribute maSdrLSTAttribute; diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx index aeb435f57a48..64716b479ce7 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx @@ -45,7 +45,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrCustomShapePrimitive2D : public BufDecPrimitive2D + class SdrCustomShapePrimitive2D : public BufferedDecompositionPrimitive2D { private: attribute::SdrShadowTextAttribute maSdrSTAttribute; diff --git a/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx index a274bd3cc77b..bcaf0aa22ea0 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx @@ -45,7 +45,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrEllipsePrimitive2D : public BufDecPrimitive2D + class SdrEllipsePrimitive2D : public BufferedDecompositionPrimitive2D { private: ::basegfx::B2DHomMatrix maTransform; diff --git a/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx index 3735598179a7..c3cdf4080f84 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrGrafPrimitive2D : public BufDecPrimitive2D + class SdrGrafPrimitive2D : public BufferedDecompositionPrimitive2D { private: ::basegfx::B2DHomMatrix maTransform; diff --git a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx index 6b50b82e82e6..7244e4d2a743 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx @@ -59,7 +59,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrMeasurePrimitive2D : public BufDecPrimitive2D + class SdrMeasurePrimitive2D : public BufferedDecompositionPrimitive2D { private: attribute::SdrLineShadowTextAttribute maSdrLSTAttribute; diff --git a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx index ff0b0e75b6a4..7fcde5221f87 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx @@ -32,7 +32,7 @@ #ifndef INCLUDED_SDR_PRIMITIVE2D_SDROLE2PRIMITIVE2D_HXX #define INCLUDED_SDR_PRIMITIVE2D_SDROLE2PRIMITIVE2D_HXX -#include +#include #include #include #include @@ -46,10 +46,11 @@ namespace drawinglayer { namespace primitive2d { - class SdrOle2Primitive2D : public GroupPrimitive2D + class SdrOle2Primitive2D : public BasePrimitive2D { private: - ::basegfx::B2DHomMatrix maTransform; + Primitive2DSequence maOLEContent; + basegfx::B2DHomMatrix maTransform; attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute; protected: @@ -58,12 +59,13 @@ namespace drawinglayer public: SdrOle2Primitive2D( - const Primitive2DSequence& rChildren, - const ::basegfx::B2DHomMatrix& rTransform, + const Primitive2DSequence& rOLEContent, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute); // data access - const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; } + const Primitive2DSequence& getOLEContent() const { return maOLEContent; } + const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; } // compare operator diff --git a/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx index 93d674b34fcf..c6349fe7d39c 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrOleContentPrimitive2D : public BufDecPrimitive2D + class SdrOleContentPrimitive2D : public BufferedDecompositionPrimitive2D { private: SdrObjectWeakRef mpSdrOle2Obj; diff --git a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx index 744b512a3efa..bb0731cea3d1 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrPathPrimitive2D : public BufDecPrimitive2D + class SdrPathPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DHomMatrix maTransform; diff --git a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx index 316840ecedfc..1a34d4b35a28 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrRectanglePrimitive2D : public BufDecPrimitive2D + class SdrRectanglePrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DHomMatrix maTransform; diff --git a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx index 5f1cf3ebf251..35b0f42eaa6e 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx @@ -51,7 +51,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrTextPrimitive2D : public BufDecPrimitive2D + class SdrTextPrimitive2D : public BufferedDecompositionPrimitive2D { private: // The text model data; this sould later just be the OutlinerParaObject or diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index 57f8afb08a05..6b6e4e5e641a 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -78,7 +78,7 @@ namespace unsigned mbGraphicAnimationAllowed : 1; // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BufDecPrimitive2D-based. + // virtual render method when the primitive implementation is BufferedDecompositionPrimitive2D-based. virtual void processBasePrimitive2D(const drawinglayer::primitive2d::BasePrimitive2D& rCandidate); public: diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 37ae3200d338..652b9f5ee56f 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -778,10 +778,10 @@ namespace sdr { namespace contact { //==================================================================== //= LazyControlCreationPrimitive2D //==================================================================== - class LazyControlCreationPrimitive2D : public ::drawinglayer::primitive2d::BufDecPrimitive2D + class LazyControlCreationPrimitive2D : public ::drawinglayer::primitive2d::BufferedDecompositionPrimitive2D { private: - typedef ::drawinglayer::primitive2d::BufDecPrimitive2D BufDecPrimitive2D; + typedef ::drawinglayer::primitive2d::BufferedDecompositionPrimitive2D BufferedDecompositionPrimitive2D; protected: virtual ::drawinglayer::primitive2d::Primitive2DSequence @@ -1432,7 +1432,7 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- bool LazyControlCreationPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if ( !BufDecPrimitive2D::operator==( rPrimitive ) ) + if ( !BufferedDecompositionPrimitive2D::operator==( rPrimitive ) ) return false; const LazyControlCreationPrimitive2D* pRHS = dynamic_cast< const LazyControlCreationPrimitive2D* >( &rPrimitive ); @@ -1482,7 +1482,7 @@ namespace sdr { namespace contact { { if ( m_pVOCImpl->hasControl() ) m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() ); - return BufDecPrimitive2D::get2DDecomposition( _rViewInformation ); + return BufferedDecompositionPrimitive2D::get2DDecomposition( _rViewInformation ); } //-------------------------------------------------------------------- diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx index 41016688ee54..8fb3ba8790bc 100644 --- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx @@ -141,7 +141,7 @@ namespace drawinglayer const basegfx::B2DPolygon& rTail, double fCornerRadiusX, double fCornerRadiusY) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute), maTail(rTail), @@ -159,7 +159,7 @@ namespace drawinglayer bool SdrCaptionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrCaptionPrimitive2D& rCompare = (SdrCaptionPrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx index 96f476315efa..406ddc4986e5 100644 --- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx @@ -87,7 +87,7 @@ namespace drawinglayer SdrConnectorPrimitive2D::SdrConnectorPrimitive2D( const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute, const ::basegfx::B2DPolygon& rUnitPolygon) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maSdrLSTAttribute(rSdrLSTAttribute), maUnitPolygon(rUnitPolygon) { @@ -95,7 +95,7 @@ namespace drawinglayer bool SdrConnectorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrConnectorPrimitive2D& rCompare = (SdrConnectorPrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index bc7e13f8afe2..01002e133f84 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -73,7 +73,7 @@ namespace drawinglayer const Primitive2DSequence& rSubPrimitives, const basegfx::B2DHomMatrix& rTextBox, bool bWordWrap) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maSdrSTAttribute(rSdrSTAttribute), maSubPrimitives(rSubPrimitives), maTextBox(rTextBox), @@ -83,7 +83,7 @@ namespace drawinglayer bool SdrCustomShapePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrCustomShapePrimitive2D& rCompare = (SdrCustomShapePrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 4140373c8e86..639ec09f6a34 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -75,7 +75,7 @@ namespace drawinglayer // prepare fully scaled polygon basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); - BufDecPrimitive2D* pNewFillPrimitive = 0L; + BasePrimitive2D* pNewFillPrimitive = 0; if(rFill.isGradient()) { @@ -137,7 +137,7 @@ namespace drawinglayer // create line and stroke attribute const attribute::LineAttribute aLineAttribute(rLine.getColor(), rLine.getWidth(), rLine.getJoin()); const attribute::StrokeAttribute aStrokeAttribute(rLine.getDotDashArray(), rLine.getFullDotDashLen()); - BufDecPrimitive2D* pNewLinePrimitive = 0L; + BufferedDecompositionPrimitive2D* pNewLinePrimitive = 0L; if(!rUnitPolygon.isClosed() && pStroke) { diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx index 674eaa0ea9c2..8aa644da938e 100644 --- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx @@ -109,7 +109,7 @@ namespace drawinglayer SdrEllipsePrimitive2D::SdrEllipsePrimitive2D( const ::basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute) { @@ -117,7 +117,7 @@ namespace drawinglayer bool SdrEllipsePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrEllipsePrimitive2D& rCompare = (SdrEllipsePrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index 2ffc70d5ebc7..3cc4e7b865d4 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -121,7 +121,7 @@ namespace drawinglayer const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, const GraphicObject& rGraphicObject, const GraphicAttr& rGraphicAttr) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute), maGraphicObject(rGraphicObject), @@ -133,7 +133,7 @@ namespace drawinglayer bool SdrGrafPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrGrafPrimitive2D& rCompare = (SdrGrafPrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 5b4a69f4a548..1fcd1047c5ef 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -454,7 +454,7 @@ namespace drawinglayer bool bBelow, bool bTextRotation, bool bTextAutoAngle) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maSdrLSTAttribute(rSdrLSTAttribute), maStart(rStart), maEnd(rEnd), @@ -473,7 +473,7 @@ namespace drawinglayer bool SdrMeasurePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrMeasurePrimitive2D& rCompare = (SdrMeasurePrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index 7e96ef32772e..78978202f20b 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -104,7 +104,7 @@ namespace drawinglayer } // add graphic content - appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, getChildren()); + appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, getOLEContent()); // add text, no need to supress to stay compatible since text was // always supported by the old paints, too @@ -123,10 +123,11 @@ namespace drawinglayer } SdrOle2Primitive2D::SdrOle2Primitive2D( - const Primitive2DSequence& rChildren, - const ::basegfx::B2DHomMatrix& rTransform, + const Primitive2DSequence& rOLEContent, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute) - : GroupPrimitive2D(rChildren), + : BasePrimitive2D(), + maOLEContent(rOLEContent), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute) { @@ -134,11 +135,12 @@ namespace drawinglayer bool SdrOle2Primitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(GroupPrimitive2D::operator==(rPrimitive)) + if(BasePrimitive2D::operator==(rPrimitive)) { const SdrOle2Primitive2D& rCompare = (SdrOle2Primitive2D&)rPrimitive; - if(getTransform() == rCompare.getTransform() + if(getOLEContent() == rCompare.getOLEContent() + && getTransform() == rCompare.getTransform() && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()) { return true; diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index 97468bc6da2f..a2039e1923fa 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -158,7 +158,7 @@ namespace drawinglayer const SdrOle2Obj& rSdrOle2Obj, const basegfx::B2DHomMatrix& rObjectTransform, bool bHighContrast) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), mpSdrOle2Obj(const_cast< SdrOle2Obj* >(&rSdrOle2Obj)), maObjectTransform(rObjectTransform), mbHighContrast(bHighContrast) @@ -167,7 +167,7 @@ namespace drawinglayer bool SdrOleContentPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrOleContentPrimitive2D& rCompare = (SdrOleContentPrimitive2D&)rPrimitive; const bool bBothNot(!mpSdrOle2Obj.is() && !rCompare.mpSdrOle2Obj.is()); diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx index 5174cad712e8..7e18afafb5f2 100644 --- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx @@ -105,7 +105,7 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, const basegfx::B2DPolyPolygon& rUnitPolyPolygon) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute), maUnitPolyPolygon(rUnitPolyPolygon) @@ -114,7 +114,7 @@ namespace drawinglayer bool SdrPathPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrPathPrimitive2D& rCompare = (SdrPathPrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index 2f91466d1d2f..04e02be419fa 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -128,7 +128,7 @@ namespace drawinglayer double fCornerRadiusX, double fCornerRadiusY, bool bTextFrame) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute), mfCornerRadiusX(fCornerRadiusX), @@ -139,7 +139,7 @@ namespace drawinglayer bool SdrRectanglePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrRectanglePrimitive2D& rCompare = (SdrRectanglePrimitive2D&)rPrimitive; diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index 08944592f028..012928fec8d0 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -109,7 +109,7 @@ namespace drawinglayer SdrTextPrimitive2D::SdrTextPrimitive2D( const SdrText* pSdrText, const OutlinerParaObject& rOutlinerParaObject) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), mrSdrText(const_cast< SdrText* >(pSdrText)), maOutlinerParaObject(rOutlinerParaObject), mxLastVisualizingPage(), @@ -133,7 +133,7 @@ namespace drawinglayer bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrTextPrimitive2D& rCompare = (SdrTextPrimitive2D&)rPrimitive; @@ -244,7 +244,7 @@ namespace drawinglayer } // call parent - return BufDecPrimitive2D::get2DDecomposition(rViewInformation); + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); } } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 484bca5157c4..76c29de8d480 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -66,7 +66,7 @@ namespace { - drawinglayer::primitive2d::Primitive2DSequence impConvertVectorToPrimitive2DSequence(const std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* >& rPrimitiveVector) + drawinglayer::primitive2d::Primitive2DSequence impConvertVectorToPrimitive2DSequence(const std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rPrimitiveVector) { const sal_Int32 nCount(rPrimitiveVector.size()); drawinglayer::primitive2d::Primitive2DSequence aRetval(nCount); @@ -108,9 +108,9 @@ namespace class impTextBreakupHandler { private: - std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* > maTextPortionPrimitives; - std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* > maLinePrimitives; - std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* > maParagraphPrimitives; + std::vector< drawinglayer::primitive2d::BasePrimitive2D* > maTextPortionPrimitives; + std::vector< drawinglayer::primitive2d::BasePrimitive2D* > maLinePrimitives; + std::vector< drawinglayer::primitive2d::BasePrimitive2D* > maParagraphPrimitives; SdrOutliner& mrOutliner; basegfx::B2DHomMatrix maNewTransformA; @@ -129,7 +129,7 @@ namespace bool impIsUnderlineAbove(const Font& rFont) const; void impCreateTextPortionPrimitive(const DrawPortionInfo& rInfo); - drawinglayer::primitive2d::BufDecPrimitive2D* impCheckFieldPrimitive(drawinglayer::primitive2d::BufDecPrimitive2D* pPrimitive, const DrawPortionInfo& rInfo) const; + drawinglayer::primitive2d::BasePrimitive2D* impCheckFieldPrimitive(drawinglayer::primitive2d::BasePrimitive2D* pPrimitive, const DrawPortionInfo& rInfo) const; void impFlushTextPortionPrimitivesToLinePrimitives(); void impFlushLinePrimitivesToParagraphPrimitives(); void impHandleDrawPortionInfo(const DrawPortionInfo& rInfo); @@ -288,7 +288,7 @@ namespace const basegfx::BColor aBFontColor(aFontColor.getBColor()); // prepare new primitive - drawinglayer::primitive2d::BufDecPrimitive2D* pNewPrimitive = 0; + drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = 0; const bool bDecoratedIsNeeded( UNDERLINE_NONE != rInfo.mrFont.GetOverline() || UNDERLINE_NONE != rInfo.mrFont.GetUnderline() @@ -467,7 +467,7 @@ namespace } } - drawinglayer::primitive2d::BufDecPrimitive2D* impTextBreakupHandler::impCheckFieldPrimitive(drawinglayer::primitive2d::BufDecPrimitive2D* pPrimitive, const DrawPortionInfo& rInfo) const + drawinglayer::primitive2d::BasePrimitive2D* impTextBreakupHandler::impCheckFieldPrimitive(drawinglayer::primitive2d::BasePrimitive2D* pPrimitive, const DrawPortionInfo& rInfo) const { if(rInfo.mpFieldData) { @@ -566,7 +566,7 @@ namespace // embed in TextHierarchyBulletPrimitive2D const drawinglayer::primitive2d::Primitive2DSequence aNewSequence(&aNewReference, 1); - drawinglayer::primitive2d::BufDecPrimitive2D* pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(aNewSequence); + drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(aNewSequence); // add to output maTextPortionPrimitives.push_back(pNewPrimitive); diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index 68c16ecf3007..05c21c606711 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -231,8 +231,8 @@ namespace class impPolygonParagraphHandler { const drawinglayer::attribute::SdrFormTextAttribute& mrSdrFormTextAttribute; // FormText parameters - std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* >& mrDecomposition; // destination primitive list - std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* >& mrShadowDecomposition; // destination primitive list for shadow + std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* >& mrDecomposition; // destination primitive list + std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* >& mrShadowDecomposition; // destination primitive list for shadow Reference < com::sun::star::i18n::XBreakIterator > mxBreak; // break iterator double getParagraphTextLength(const ::std::vector< const impPathTextPortion* >& rTextPortions) @@ -271,8 +271,8 @@ namespace public: impPolygonParagraphHandler( const drawinglayer::attribute::SdrFormTextAttribute& rSdrFormTextAttribute, - std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* >& rDecomposition, - std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* >& rShadowDecomposition) + std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* >& rDecomposition, + std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* >& rShadowDecomposition) : mrSdrFormTextAttribute(rSdrFormTextAttribute), mrDecomposition(rDecomposition), mrShadowDecomposition(rShadowDecomposition) @@ -571,7 +571,7 @@ namespace const basegfx::B2DHomMatrix& rTransform, const drawinglayer::attribute::LineAttribute& rLineAttribute, const drawinglayer::attribute::StrokeAttribute& rStrokeAttribute, - std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* >& rTarget) + std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* >& rTarget) { for(basegfx::B2DPolyPolygonVector::const_iterator aPolygon(rB2DPolyPolyVector.begin()); aPolygon != rB2DPolyPolyVector.end(); aPolygon++) { @@ -591,10 +591,10 @@ namespace } drawinglayer::primitive2d::Primitive2DSequence impAddPathTextOutlines( - const std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* >& rSource, + const std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* >& rSource, const drawinglayer::attribute::SdrFormTextOutlineAttribute& rOutlineAttribute) { - std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* > aNewPrimitives; + std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aNewPrimitives; for(sal_uInt32 a(0L); a < rSource.size(); a++) { @@ -611,7 +611,7 @@ namespace if(aB2DPolyPolyVector.size()) { // create stroke primitives - std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* > aStrokePrimitives; + std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* > aStrokePrimitives; impAddPolygonStrokePrimitives( aB2DPolyPolyVector, aPolygonTransform, @@ -710,8 +710,8 @@ bool SdrTextObj::impDecomposePathTextPrimitive( if(nLoopCount) { // prepare common decomposition stuff - std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* > aRegularDecomposition; - std::vector< drawinglayer::primitive2d::BufDecPrimitive2D* > aShadowDecomposition; + std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* > aRegularDecomposition; + std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* > aShadowDecomposition; impPolygonParagraphHandler aPolygonParagraphHandler( rFormTextAttribute, aRegularDecomposition, aShadowDecomposition); sal_uInt32 a; diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index 197d71c65b45..c6a572928892 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -64,7 +64,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrCellPrimitive2D : public BufDecPrimitive2D + class SdrCellPrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DHomMatrix maTransform; @@ -78,7 +78,7 @@ namespace drawinglayer SdrCellPrimitive2D( const basegfx::B2DHomMatrix& rTransform, const attribute::SdrFillTextAttribute& rSdrFTAttribute) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maSdrFTAttribute(rSdrFTAttribute) { @@ -132,7 +132,7 @@ namespace drawinglayer bool SdrCellPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrCellPrimitive2D& rCompare = (SdrCellPrimitive2D&)rPrimitive; @@ -155,7 +155,7 @@ namespace drawinglayer { namespace primitive2d { - class SdrBorderlinePrimitive2D : public BufDecPrimitive2D + class SdrBorderlinePrimitive2D : public BufferedDecompositionPrimitive2D { private: basegfx::B2DHomMatrix maTransform; @@ -187,7 +187,7 @@ namespace drawinglayer bool bRightIsOutside, bool bTopIsOutside, bool bInTwips) - : BufDecPrimitive2D(), + : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maLeftLine(rLeftLine), maBottomLine(rBottomLine), @@ -462,7 +462,7 @@ namespace drawinglayer bool SdrBorderlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BufDecPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const SdrBorderlinePrimitive2D& rCompare = (SdrBorderlinePrimitive2D&)rPrimitive; -- cgit v1.2.3 From a0f979d5bf4428f0110c408cc32d1ba670394f07 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 17 Sep 2009 17:20:13 +0200 Subject: #i97509# added base class for 3d primitive, re-structured group primitives, added documentation --- .../primitive2d/animatedprimitive2d.hxx | 4 +- .../primitive2d/backgroundcolorprimitive2d.hxx | 2 +- .../drawinglayer/primitive2d/baseprimitive2d.hxx | 42 ++++++++--------- .../primitive2d/borderlineprimitive2d.hxx | 2 +- .../primitive2d/controlprimitive2d.hxx | 4 +- .../primitive2d/embedded3dprimitive2d.hxx | 2 +- .../primitive2d/fillbitmapprimitive2d.hxx | 2 +- .../primitive2d/fillgradientprimitive2d.hxx | 2 +- .../primitive2d/fillhatchprimitive2d.hxx | 2 +- .../primitive2d/graphicprimitive2d.hxx | 2 +- .../drawinglayer/primitive2d/gridprimitive2d.hxx | 2 +- .../drawinglayer/primitive2d/groupprimitive2d.hxx | 11 +++++ .../primitive2d/helplineprimitive2d.hxx | 2 +- .../primitive2d/markerarrayprimitive2d.hxx | 2 +- .../drawinglayer/primitive2d/mediaprimitive2d.hxx | 2 +- .../primitive2d/pagepreviewprimitive2d.hxx | 2 +- .../primitive2d/polygonprimitive2d.hxx | 8 ++-- .../primitive2d/polypolygonprimitive2d.hxx | 14 +++--- .../drawinglayer/primitive2d/primitivetools2d.hxx | 8 ++-- .../drawinglayer/primitive2d/sceneprimitive2d.hxx | 4 +- .../primitive2d/textdecoratedprimitive2d.hxx | 2 +- .../primitive2d/texteffectprimitive2d.hxx | 2 +- .../drawinglayer/primitive2d/textprimitive2d.hxx | 2 +- .../primitive2d/wrongspellprimitive2d.hxx | 2 +- .../drawinglayer/primitive3d/baseprimitive3d.hxx | 33 ++++++++------ .../drawinglayer/primitive3d/groupprimitive3d.hxx | 26 ++++++++--- .../primitive3d/hatchtextureprimitive3d.hxx | 17 ++++++- .../primitive3d/hittestprimitive3d.hxx | 9 ++-- .../primitive3d/polygonprimitive3d.hxx | 6 +-- .../primitive3d/polygontubeprimitive3d.hxx | 2 +- .../primitive3d/polypolygonprimitive3d.hxx | 2 +- .../primitive3d/sdrcubeprimitive3d.hxx | 2 +- .../primitive3d/sdrextrudeprimitive3d.hxx | 2 +- .../primitive3d/sdrlatheprimitive3d.hxx | 2 +- .../primitive3d/sdrpolypolygonprimitive3d.hxx | 2 +- .../drawinglayer/primitive3d/sdrprimitive3d.hxx | 6 ++- .../primitive3d/sdrsphereprimitive3d.hxx | 2 +- .../primitive3d/textureprimitive3d.hxx | 15 ++----- .../drawinglayer/processor2d/baseprocessor2d.hxx | 2 +- .../drawinglayer/processor2d/canvasprocessor.hxx | 2 +- .../drawinglayer/processor3d/baseprocessor3d.hxx | 2 +- .../processor3d/geometry2dextractor.hxx | 2 +- .../drawinglayer/processor3d/shadow3dextractor.hxx | 2 +- .../source/primitive2d/animatedprimitive2d.cxx | 4 +- .../primitive2d/backgroundcolorprimitive2d.cxx | 8 ++-- .../source/primitive2d/baseprimitive2d.cxx | 18 ++++---- .../source/primitive2d/borderlineprimitive2d.cxx | 2 +- .../source/primitive2d/controlprimitive2d.cxx | 8 ++-- .../source/primitive2d/embedded3dprimitive2d.cxx | 2 +- .../source/primitive2d/fillbitmapprimitive2d.cxx | 2 +- .../source/primitive2d/fillgradientprimitive2d.cxx | 2 +- .../source/primitive2d/fillhatchprimitive2d.cxx | 2 +- .../source/primitive2d/graphicprimitive2d.cxx | 2 +- .../source/primitive2d/gridprimitive2d.cxx | 8 ++-- .../source/primitive2d/helplineprimitive2d.cxx | 10 ++--- .../source/primitive2d/markerarrayprimitive2d.cxx | 2 +- .../source/primitive2d/mediaprimitive2d.cxx | 2 +- .../source/primitive2d/pagepreviewprimitive2d.cxx | 2 +- .../source/primitive2d/polygonprimitive2d.cxx | 14 +++--- .../source/primitive2d/polypolygonprimitive2d.cxx | 14 +++--- .../source/primitive2d/primitivetools2d.cxx | 12 ++--- .../source/primitive2d/sceneprimitive2d.cxx | 8 ++-- .../primitive2d/textdecoratedprimitive2d.cxx | 2 +- .../source/primitive2d/texteffectprimitive2d.cxx | 8 ++-- .../source/primitive2d/textprimitive2d.cxx | 2 +- .../source/primitive2d/wrongspellprimitive2d.cxx | 2 +- .../source/primitive3d/baseprimitive3d.cxx | 22 ++++----- .../source/primitive3d/groupprimitive3d.cxx | 16 +++---- .../source/primitive3d/hatchtextureprimitive3d.cxx | 24 +++++++--- .../source/primitive3d/hittestprimitive3d.cxx | 12 ++--- .../source/primitive3d/polygonprimitive3d.cxx | 12 ++--- .../source/primitive3d/polygontubeprimitive3d.cxx | 12 ++--- .../source/primitive3d/polypolygonprimitive3d.cxx | 4 +- .../source/primitive3d/sdrcubeprimitive3d.cxx | 2 +- .../source/primitive3d/sdrdecompositiontools3d.cxx | 2 +- .../source/primitive3d/sdrextrudeprimitive3d.cxx | 6 +-- .../source/primitive3d/sdrlatheprimitive3d.cxx | 6 +-- .../primitive3d/sdrpolypolygonprimitive3d.cxx | 2 +- drawinglayer/source/primitive3d/sdrprimitive3d.cxx | 4 +- .../source/primitive3d/sdrsphereprimitive3d.cxx | 2 +- .../source/primitive3d/textureprimitive3d.cxx | 52 +++++++++------------- .../source/processor2d/baseprocessor2d.cxx | 6 +-- .../source/processor3d/baseprocessor3d.cxx | 4 +- .../source/processor3d/defaultprocessor3d.cxx | 2 +- .../source/processor3d/shadow3dextractor.cxx | 4 +- .../source/processor3d/zbufferprocessor3d.cxx | 2 +- svx/inc/svx/sdr/overlay/overlaytools.hxx | 10 ++--- .../svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx | 2 +- .../sdr/primitive2d/sdrconnectorprimitive2d.hxx | 2 +- .../sdr/primitive2d/sdrcustomshapeprimitive2d.hxx | 2 +- .../svx/sdr/primitive2d/sdrellipseprimitive2d.hxx | 4 +- svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx | 2 +- .../svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx | 2 +- svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx | 2 +- .../sdr/primitive2d/sdrolecontentprimitive2d.hxx | 2 +- svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx | 2 +- .../sdr/primitive2d/sdrrectangleprimitive2d.hxx | 2 +- svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx | 8 ++-- svx/source/engine3d/helperhittest3d.cxx | 4 +- svx/source/engine3d/helperminimaldepth3d.cxx | 4 +- .../sdr/contact/viewcontactofsdrcaptionobj.cxx | 2 +- svx/source/sdr/contact/viewobjectcontact.cxx | 2 +- .../sdr/contact/viewobjectcontactofpageobj.cxx | 2 +- .../sdr/contact/viewobjectcontactofunocontrol.cxx | 4 +- svx/source/sdr/overlay/overlaytools.cxx | 10 ++--- .../sdr/primitive2d/sdrcaptionprimitive2d.cxx | 2 +- .../sdr/primitive2d/sdrconnectorprimitive2d.cxx | 2 +- .../sdr/primitive2d/sdrcustomshapeprimitive2d.cxx | 2 +- .../sdr/primitive2d/sdrdecompositiontools.cxx | 2 +- .../sdr/primitive2d/sdrellipseprimitive2d.cxx | 4 +- svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx | 2 +- .../sdr/primitive2d/sdrmeasureprimitive2d.cxx | 4 +- svx/source/sdr/primitive2d/sdrole2primitive2d.cxx | 4 +- .../sdr/primitive2d/sdrolecontentprimitive2d.cxx | 2 +- svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx | 2 +- .../sdr/primitive2d/sdrrectangleprimitive2d.cxx | 2 +- svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx | 14 +++--- svx/source/svdraw/svdotextpathdecomposition.cxx | 18 ++++---- svx/source/table/viewcontactoftableobj.cxx | 8 ++-- 119 files changed, 384 insertions(+), 347 deletions(-) (limited to 'drawinglayer/inc/drawinglayer/primitive2d') diff --git a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx index 296d56efe6d8..1fcde759ed68 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx @@ -99,7 +99,7 @@ namespace drawinglayer { protected: // create local decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: AnimatedBlinkPrimitive2D( @@ -163,7 +163,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: AnimatedInterpolatePrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx index 5731a1e45ee6..7b998fd3e749 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx @@ -56,7 +56,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: BackgroundColorPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx index 416fdd2d9816..f41863f36992 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx @@ -106,7 +106,7 @@ namespace drawinglayer unique UNO APIs may be defined/implemented for these set to allow more intense work with primitives using UNO. - Current five Basic Primitives are: + Current Basic 2D Primitives are: - BitmapPrimitive2D (bitmap data, evtl. with alpha) - MetafilePrimitive2D (VCL Metafile, currently no decomposition, but planned, so may vanish) @@ -119,13 +119,7 @@ namespace drawinglayer A renderer implementing support for this minimal set of primitives can completely render primitive-based visualisations. Of course, he also has to take states into account - which are representated by the following GroupPrimitive2D derivations: - - - AlphaPrimitive2D (objects with freely defined transparence) - - InvertPrimitive2D (for XOR) - - MaskPrimitive2D (for masking) - - ModifiedColorPrimitive2D (for a stack of color modifications) - - TransformPrimitive2D (for a transformation stack) + which are representated by GroupPrimitive2D derivations, see groupprimitive2d.hxx To support getting the geometric BoundRect, getB2DRange is used. The default implementation will use the get2DDecomposition result and merge a range from the @@ -214,9 +208,9 @@ namespace drawinglayer primitive implementations which support a decomposition as base class. The buffering is done by holding the last decomposition in the local parameter - maLocal2DDecomposition. The default implementation of get2DDecomposition checks - if maLocal2DDecomposition is empty. If yes, it uses createLocal2DDecomposition - to create the content. In all cases, maLocal2DDecomposition is returned. + maBuffered2DDecomposition. The default implementation of get2DDecomposition checks + if maBuffered2DDecomposition is empty. If yes, it uses create2DDecomposition + to create the content. In all cases, maBuffered2DDecomposition is returned. For view-dependent primitives derived from Primitive2DBufferDecomposition more needs to be done when the decomposition depends on parts of the parameter ViewInformation2D. @@ -227,39 +221,39 @@ namespace drawinglayer (this may be a complete local copy of ViewInformation2D) (b) If a buffered decomposition exists, ckeck if one of the new local parameters differs from the corresponding locally remembered (as member) ones. If yes, - clear maLocal2DDecomposition - (d) call baseclass::get2DDecomposition which will use createLocal2DDecomposition - to fill maLocal2DDecomposition if it's empty + clear maBuffered2DDecomposition + (d) call baseclass::get2DDecomposition which will use create2DDecomposition + to fill maBuffered2DDecomposition if it's empty (e) copy the new local parameters to the corresponding locally remembered ones to identify if a new decomposition is needed at the next call - (f) return maLocal2DDecomposition + (f) return maBuffered2DDecomposition */ class BufferedDecompositionPrimitive2D : public BasePrimitive2D { private: - /// a sequence used for buffering the last createLocal2DDecomposition() result - Primitive2DSequence maLocal2DDecomposition; + /// a sequence used for buffering the last create2DDecomposition() result + Primitive2DSequence maBuffered2DDecomposition; protected: - /** access methods to maLocal2DDecomposition. The usage of this methods may allow + /** access methods to maBuffered2DDecomposition. The usage of this methods may allow later thread-safe stuff to be added if needed. Only to be used by getDecomposition() implementations for buffering the last decomposition. */ - const Primitive2DSequence& getLocal2DDecomposition() const { return maLocal2DDecomposition; } - void setLocal2DDecomposition(const Primitive2DSequence& rNew) { maLocal2DDecomposition = rNew; } + const Primitive2DSequence& getBuffered2DDecomposition() const { return maBuffered2DDecomposition; } + void setBuffered2DDecomposition(const Primitive2DSequence& rNew) { maBuffered2DDecomposition = rNew; } /** method which is to be used to implement the local decomposition of a 2D primitive. The default implementation will just return an empty decomposition */ - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: // constructor/destructor BufferedDecompositionPrimitive2D(); - /** The getDecomposition default implementation will on demand use createLocal2DDecomposition() if - maLocal2DDecomposition is empty. It will set maLocal2DDecomposition to this obtained decomposition + /** The getDecomposition default implementation will on demand use create2DDecomposition() if + maBuffered2DDecomposition is empty. It will set maBuffered2DDecomposition to this obtained decomposition to buffer it. If the decomposition is also ViewInformation2D-dependent, this method needs to be overloaded and the ViewInformation2D for the last decomposition need to be remembered, too, and be used in the next call to decide if the buffered decomposition may be reused or not. @@ -282,7 +276,7 @@ namespace drawinglayer // get B2DRange from a given Primitive2DSequence basegfx::B2DRange getB2DRangeFromPrimitive2DSequence(const Primitive2DSequence& rCandidate, const geometry::ViewInformation2D& aViewInformation); - // compare two Primitive2DReferences for equality, including trying to get implementations (BufferedDecompositionPrimitive2D) + // compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D) // and using compare operator bool arePrimitive2DReferencesEqual(const Primitive2DReference& rA, const Primitive2DReference& rB); diff --git a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx index 88ca4c02935b..209b0ed17e40 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx @@ -107,7 +107,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: BorderLinePrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx index 591407302a37..974faf506da8 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx @@ -64,13 +64,13 @@ namespace drawinglayer // and from thereon always used and returned by getXControl() void createXControl(); - // single local decompositions, used from createLocal2DDecomposition() + // single local decompositions, used from create2DDecomposition() Primitive2DReference createBitmapDecomposition(const geometry::ViewInformation2D& rViewInformation) const; Primitive2DReference createPlaceholderDecomposition(const geometry::ViewInformation2D& rViewInformation) const; protected: // local decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: ControlPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx index aef3c0173b43..86540d53e325 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx @@ -85,7 +85,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: Embedded3DPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx index 012824f187bd..c2d305b78c11 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx @@ -55,7 +55,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: FillBitmapPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx index fbf4e7c34a3f..f995bb487b33 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx @@ -54,7 +54,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: FillGradientPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx index 10cb9a622140..6181630e948d 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx @@ -55,7 +55,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: FillHatchPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx index cfc29ac8d06e..33923eebc259 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx @@ -55,7 +55,7 @@ namespace drawinglayer protected: // local decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: GraphicPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx index 1b1325c4b4f9..d2b90e271cda 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx @@ -68,7 +68,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: GridPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx index bf30efb66311..cd6efef472bb 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx @@ -63,6 +63,17 @@ namespace drawinglayer In most cases the decomposition is straightforward, so by default this primitive will not buffer the result and is not derived from BufferedDecompositionPrimitive2D, but from BasePrimitive2D. + + A renderer has to take GroupPrimitive2D derivations into account which + are used to hold a state. + + Current Basic 2D StatePrimitives are: + + - AlphaPrimitive2D (objects with freely defined transparence) + - InvertPrimitive2D (for XOR) + - MaskPrimitive2D (for masking) + - ModifiedColorPrimitive2D (for a stack of color modifications) + - TransformPrimitive2D (for a transformation stack) */ class GroupPrimitive2D : public BasePrimitive2D { diff --git a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx index 53abdfa133c8..0ba83b2c383a 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx @@ -70,7 +70,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: HelplinePrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx index 02f254368bc1..77f450403302 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx @@ -55,7 +55,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: MarkerArrayPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx index f5d21fa40e3e..da8e49b644c6 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx @@ -56,7 +56,7 @@ namespace drawinglayer protected: // local decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: MediaPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx index f44de611d609..52ed2435f5e7 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx @@ -75,7 +75,7 @@ namespace drawinglayer protected: // local decomposition. Implementation will just return children - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PagePreviewPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx index c82f54fdfab0..4e04786fb2e5 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -94,7 +94,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolygonMarkerPrimitive2D( @@ -140,7 +140,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolygonStrokePrimitive2D( @@ -184,7 +184,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolygonWavePrimitive2D( @@ -231,7 +231,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolygonStrokeArrowPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index d152b962de25..516210a6a081 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -59,7 +59,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor); @@ -97,7 +97,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonMarkerPrimitive2D( @@ -140,7 +140,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonStrokePrimitive2D( @@ -184,7 +184,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonStrokeArrowPrimitive2D( @@ -264,7 +264,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonGradientPrimitive2D( @@ -298,7 +298,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonHatchPrimitive2D( @@ -332,7 +332,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: PolyPolygonBitmapPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx index 3a0977003915..f7e9b1dcac0b 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx @@ -41,7 +41,7 @@ ////////////////////////////////////////////////////////////////////////////// // tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent // regarding the size of a discrete unit. The implementation of get2DDecomposition -// guards the buffered local decomposition and ensures that a createLocal2DDecomposition +// guards the buffered local decomposition and ensures that a create2DDecomposition // implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit() namespace drawinglayer @@ -53,7 +53,7 @@ namespace drawinglayer private: // the last used fDiscreteUnit definitions for decomposition. Since this // is checked and updated from get2DDecomposition() it will be current and - // usable in createLocal2DDecomposition() + // usable in create2DDecomposition() double mfDiscreteUnit; public: @@ -75,7 +75,7 @@ namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// // tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent // regarding the viewport. The implementation of get2DDecomposition -// guards the buffered local decomposition and ensures that a createLocal2DDecomposition +// guards the buffered local decomposition and ensures that a create2DDecomposition // implementation may use an up-to-date Viewport accessible using getViewport() namespace drawinglayer @@ -87,7 +87,7 @@ namespace drawinglayer private: // the last used Viewport definition for decomposition. Since this // is checked and updated from get2DDecomposition() it will be current and - // usable in createLocal2DDecomposition() + // usable in create2DDecomposition() basegfx::B2DRange maViewport; public: diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx index 0f8e55492688..f190c3e6c1e1 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx @@ -80,11 +80,11 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: // public helpers - // Geometry extractor. Shadow will be added as in createLocal2DDecomposition, but + // Geometry extractor. Shadow will be added as in create2DDecomposition, but // the 3D content is not converted to a bitmap visualisation but to projected 2D gemetry. This // helper is useful e.g. for Contour extraction or HitTests. Primitive2DSequence getGeometry2D(const geometry::ViewInformation2D& rViewInformation) const; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx index 5328b29e963a..536b267f2fbd 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx @@ -151,7 +151,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: TextDecoratedPortionPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx index 2a9c890b2b3d..19f910f3444d 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx @@ -71,7 +71,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: TextEffectPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx index 775fa2bd36e5..14b44f80dbfe 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx @@ -140,7 +140,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: TextSimplePortionPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx index bddb951bea9c..6bf84a401891 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx @@ -57,7 +57,7 @@ namespace drawinglayer protected: // create local decomposition - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: WrongSpellPrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx index 4dc5a7da4acb..73d28c82ebda 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx @@ -79,7 +79,12 @@ namespace drawinglayer /** Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D The description/functionality is identical with the 2D case in baseprimitive2d.hxx, - please see there for detailed information + please see there for detailed information. + + Current Basic 3D Primitives are: + + - PolygonHairlinePrimitive3D (for 3D hairlines) + - PolyPolygonMaterialPrimitive3D (for 3D filled plane polygons) */ class BasePrimitive3D : private boost::noncopyable, @@ -96,7 +101,7 @@ namespace drawinglayer /** the ==operator is mainly needed to allow testing newly-created high level primitives against their last incarnation which buffers/holds the decompositionsThe default implementation uses getPrimitive3DID()-calls to test if it's the same ID at last. Overloaded implementation are then - based on this implementation + based on this implementation. */ virtual bool operator==( const BasePrimitive3D& rPrimitive ) const; bool operator!=( const BasePrimitive3D& rPrimitive ) const { return !operator==(rPrimitive); } @@ -133,7 +138,7 @@ namespace drawinglayer } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// -// BufDecPrimitive3D class +// BufferedDecompositionPrimitive3D class namespace drawinglayer { @@ -144,32 +149,32 @@ namespace drawinglayer The description/functionality is identical with the 2D case in baseprimitive2d.hxx, please see there for detailed information */ - class BufDecPrimitive3D + class BufferedDecompositionPrimitive3D : public BasePrimitive3D { private: - /// a sequence used for buffering the last createLocal3DDecomposition() result - Primitive3DSequence maLocal3DDecomposition; + /// a sequence used for buffering the last create3DDecomposition() result + Primitive3DSequence maBuffered3DDecomposition; protected: - /** access methods to maLocal3DDecomposition. The usage of this methods may allow + /** access methods to maBuffered3DDecomposition. The usage of this methods may allow later thread-safe stuff to be added if needed. Only to be used by getDecomposition() implementations for buffering the last decomposition. */ - const Primitive3DSequence& getLocal3DDecomposition() const { return maLocal3DDecomposition; } - void setLocal3DDecomposition(const Primitive3DSequence& rNew) { maLocal3DDecomposition = rNew; } + const Primitive3DSequence& getBuffered3DDecomposition() const { return maBuffered3DDecomposition; } + void setBuffered3DDecomposition(const Primitive3DSequence& rNew) { maBuffered3DDecomposition = rNew; } /** method which is to be used to implement the local decomposition of a 2D primitive. The default implementation will just return an empty decomposition */ - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: // constructor - BufDecPrimitive3D(); + BufferedDecompositionPrimitive3D(); - /** The getDecomposition default implementation will on demand use createLocal3DDecomposition() if - maLocal3DDecomposition is empty. It will set maLocal3DDecomposition to this obtained decomposition + /** The getDecomposition default implementation will on demand use create3DDecomposition() if + maBuffered3DDecomposition is empty. It will set maBuffered3DDecomposition to this obtained decomposition to buffer it. If the decomposition is also ViewInformation-dependent, this method needs to be overloaded and the ViewInformation for the last decomposition needs to be remembered, too, and be used in the next call to decide if the buffered decomposition may be reused or not. @@ -192,7 +197,7 @@ namespace drawinglayer // get range3D from a given Primitive3DSequence basegfx::B3DRange getB3DRangeFromPrimitive3DSequence(const Primitive3DSequence& rCandidate, const geometry::ViewInformation3D& aViewInformation); - // compare two Primitive2DReferences for equality, including trying to get implementations (BufferedDecompositionPrimitive2D) + // compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D) // and using compare operator bool arePrimitive3DReferencesEqual(const Primitive3DReference& rA, const Primitive3DReference& rB); diff --git a/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx index 93ca09af8e93..6912ff25b04d 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx @@ -44,16 +44,29 @@ namespace drawinglayer { namespace primitive3d { - class GroupPrimitive3D : public BufDecPrimitive3D + /** Baseclass for all grouping 3D primitives + + The description/functionality is identical with the 2D case in groupprimitive2d.hxx, + please see there for detailed information. + + Current Basic 3D StatePrimitives are: + + - ModifiedColorPrimitive3D (for a stack of color modifications) + - ShadowPrimitive3D (for 3D objects with shadow; this is a special case + since the shadow of a 3D primitive is a 2D primitive set) + - TexturePrimitive3D (with the following variations) + - GradientTexturePrimitive3D (for 3D gradient fill) + - BitmapTexturePrimitive3D (for 3D Bitmap fill) + - AlphaTexturePrimitive3D (for 3D transparence) + - HatchTexturePrimitive3D (for 3D hatch fill) + - TransformPrimitive3D (for a transformation stack) + */ + class GroupPrimitive3D : public BasePrimitive3D { private: // the children. Declared private since this shall never be changed at all after construction Primitive3DSequence maChildren; - protected: - // local decomposition. Implementation will just return children - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - public: // constructor GroupPrimitive3D(const Primitive3DSequence& rChildren); @@ -64,6 +77,9 @@ namespace drawinglayer // compare operator virtual bool operator==( const BasePrimitive3D& rPrimitive ) const; + // local decomposition. Implementation will just return children + virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + // provide unique ID DeclPrimitrive3DIDBlock() }; diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx index a8ce982f3560..2e1d7e0b5fe4 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx @@ -44,14 +44,24 @@ namespace drawinglayer { namespace primitive3d { + /** HatchTexturePrimitive3D is derived from GroupPrimitive3D, but implements + a decomposition which is complicated enough for buffering. Since the group + primitive has no default buffering, it is necessary here to add a local + buffering mechanism for the decomposition + */ class HatchTexturePrimitive3D : public TexturePrimitive3D { private: attribute::FillHatchAttribute maHatch; + Primitive3DSequence maBuffered3DDecomposition; protected: - // local decomposition. - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + /// helper: local decomposition + Primitive3DSequence impCreate3DDecomposition() const; + + /// local access methods to maBufferedDecomposition + const Primitive3DSequence& getBuffered3DDecomposition() const { return maBuffered3DDecomposition; } + void setBuffered3DDecomposition(const Primitive3DSequence& rNew) { maBuffered3DDecomposition = rNew; } public: HatchTexturePrimitive3D( @@ -67,6 +77,9 @@ namespace drawinglayer // compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; + // local decomposition. + virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + // provide unique ID DeclPrimitrive3DIDBlock() }; diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx index f79fe21dd920..0c5082699e8d 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx @@ -56,11 +56,6 @@ namespace drawinglayer // use it and it's children subcontent. class HitTestPrimitive3D : public GroupPrimitive3D { - protected: - // local decomposition. Implementation will return empty Primitive3DSequence - // since this is no visualisation data - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - public: HitTestPrimitive3D(const Primitive3DSequence& rChildren); @@ -69,6 +64,10 @@ namespace drawinglayer // the local implementation will return the children's range virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; + // local decomposition. Implementation will return empty Primitive3DSequence + // since this is no visualisation data + virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + // provide unique ID DeclPrimitrive3DIDBlock() }; diff --git a/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx index b54f5e6c6119..9b97f60d3642 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx @@ -48,7 +48,7 @@ namespace drawinglayer { namespace primitive3d { - class PolygonHairlinePrimitive3D : public BufDecPrimitive3D + class PolygonHairlinePrimitive3D : public BasePrimitive3D { private: basegfx::B3DPolygon maPolygon; @@ -81,7 +81,7 @@ namespace drawinglayer { namespace primitive3d { - class PolygonStrokePrimitive3D : public BufDecPrimitive3D + class PolygonStrokePrimitive3D : public BufferedDecompositionPrimitive3D { private: basegfx::B3DPolygon maPolygon; @@ -90,7 +90,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: PolygonStrokePrimitive3D( diff --git a/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx index 1fa43c0e27fc..5ce81e8c7ad6 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx @@ -62,7 +62,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: PolygonTubePrimitive3D( diff --git a/drawinglayer/inc/drawinglayer/primitive3d/polypolygonprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/polypolygonprimitive3d.hxx index 2069ab08cdb2..1c5b9e400bbb 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/polypolygonprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/polypolygonprimitive3d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive3d { - class PolyPolygonMaterialPrimitive3D : public BufDecPrimitive3D + class PolyPolygonMaterialPrimitive3D : public BasePrimitive3D { private: basegfx::B3DPolyPolygon maPolyPolygon; diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx index 13ccc8d80411..42a9ab94f327 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx @@ -48,7 +48,7 @@ namespace drawinglayer { protected: // local decomposition. - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: SdrCubePrimitive3D( diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx index e3b96a1b0d3e..a5975b050797 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx @@ -77,7 +77,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: SdrExtrudePrimitive3D( diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx index 0925d798a52a..7d80cbde015c 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx @@ -91,7 +91,7 @@ namespace drawinglayer const basegfx::B2DPoint& rEnd) const; // local decomposition. - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: SdrLathePrimitive3D( diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx index bd020022f12f..b0d7cc5c26a2 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx @@ -52,7 +52,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: SdrPolyPolygonPrimitive3D( diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx index 729de313267a..d2296968a000 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx @@ -47,9 +47,13 @@ namespace drawinglayer { + /** base class for the more complicated geometric primitives, so + derive from buffered primitive to allow overloading of + create3DDecomposition there + */ namespace primitive3d { - class SdrPrimitive3D : public BufDecPrimitive3D + class SdrPrimitive3D : public BufferedDecompositionPrimitive3D { private: basegfx::B3DHomMatrix maTransform; diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx index 38a0f94ee07b..3e6349df0bb9 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx @@ -52,7 +52,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: SdrSpherePrimitive3D( diff --git a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx index c351fcd0aff0..a0c18f34788e 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx @@ -88,10 +88,6 @@ namespace drawinglayer private: double mfTransparence; - protected: - // local decomposition. - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - public: UnifiedAlphaTexturePrimitive3D( double fTransparence, @@ -103,6 +99,9 @@ namespace drawinglayer // compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; + // local decomposition. + virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + // provide unique ID DeclPrimitrive3DIDBlock() }; @@ -120,10 +119,6 @@ namespace drawinglayer private: attribute::FillGradientAttribute maGradient; - protected: - // local decomposition. - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - public: GradientTexturePrimitive3D( const attribute::FillGradientAttribute& rGradient, @@ -155,10 +150,6 @@ namespace drawinglayer private: attribute::FillBitmapAttribute maBitmap; - protected: - // local decomposition. - virtual Primitive3DSequence createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - public: BitmapTexturePrimitive3D( const attribute::FillBitmapAttribute& rBitmap, diff --git a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx index 5139b4d72119..fceae8dbeb31 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx @@ -57,7 +57,7 @@ namespace drawinglayer } // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BufferedDecompositionPrimitive2D-based. + // virtual render method when the primitive implementation is BasePrimitive2D-based. // Default implementation does nothing virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); diff --git a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx index ac15ec5f12cf..0c356e731169 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx @@ -103,7 +103,7 @@ namespace drawinglayer LanguageType meLang; // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BufferedDecompositionPrimitive2D-based. + // virtual render method when the primitive implementation is BasePrimitive2D-based. virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); // direct primitive renderer support diff --git a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx index 8e2023c7e1bc..effc509d9981 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx @@ -57,7 +57,7 @@ namespace drawinglayer } // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BufDecPrimitive3D-based. + // virtual render method when the primitive implementation is BasePrimitive3D-based. // Default implementation does nothing virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); diff --git a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx index e43fc0d7d8b3..457ede952ccd 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx @@ -61,7 +61,7 @@ namespace drawinglayer basegfx::BColorModifierStack maBColorModifierStack; // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BufDecPrimitive3D-based. + // virtual render method when the primitive implementation is BasePrimitive3D-based. virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: diff --git a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx index ddb1d0179073..abb92693a037 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx @@ -89,7 +89,7 @@ namespace drawinglayer basegfx::B2DPolyPolygon impDoShadowProjection(const basegfx::B3DPolyPolygon& rSource); // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BufDecPrimitive3D-based. + // virtual render method when the primitive implementation is BasePrimitive3D-based. virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx index d2b824962fbf..b99168d1cb1e 100644 --- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx @@ -114,7 +114,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence AnimatedBlinkPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence AnimatedBlinkPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { if(getChildren().hasElements()) { @@ -178,7 +178,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence AnimatedInterpolatePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence AnimatedInterpolatePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { const sal_uInt32 nSize(maMatrixStack.size()); diff --git a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx index 723a684c51ec..d425b1ea3138 100644 --- a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx @@ -54,7 +54,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence BackgroundColorPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence BackgroundColorPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { if(!rViewInformation.getViewport().isEmpty()) { @@ -98,13 +98,13 @@ namespace drawinglayer { ::osl::MutexGuard aGuard( m_aMutex ); - if(getLocal2DDecomposition().hasElements() && (maLastViewport != rViewInformation.getViewport())) + if(getBuffered2DDecomposition().hasElements() && (maLastViewport != rViewInformation.getViewport())) { // conditions of last local decomposition have changed, delete - const_cast< BackgroundColorPrimitive2D* >(this)->setLocal2DDecomposition(Primitive2DSequence()); + const_cast< BackgroundColorPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); } - if(!getLocal2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().hasElements()) { // remember ViewRange const_cast< BackgroundColorPrimitive2D* >(this)->maLastViewport = rViewInformation.getViewport(); diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx b/drawinglayer/source/primitive2d/baseprimitive2d.cxx index db391ab1b548..dffde631b8c3 100644 --- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx @@ -94,14 +94,14 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence BufferedDecompositionPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence BufferedDecompositionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { return Primitive2DSequence(); } BufferedDecompositionPrimitive2D::BufferedDecompositionPrimitive2D() : BasePrimitive2D(), - maLocal2DDecomposition() + maBuffered2DDecomposition() { } @@ -109,13 +109,13 @@ namespace drawinglayer { ::osl::MutexGuard aGuard( m_aMutex ); - if(!getLocal2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().hasElements()) { - const Primitive2DSequence aNewSequence(createLocal2DDecomposition(rViewInformation)); - const_cast< BufferedDecompositionPrimitive2D* >(this)->setLocal2DDecomposition(aNewSequence); + const Primitive2DSequence aNewSequence(create2DDecomposition(rViewInformation)); + const_cast< BufferedDecompositionPrimitive2D* >(this)->setBuffered2DDecomposition(aNewSequence); } - return getLocal2DDecomposition(); + return getBuffered2DDecomposition(); } } // end of namespace primitive2d } // end of namespace drawinglayer @@ -135,7 +135,7 @@ namespace drawinglayer if(rCandidate.is()) { // try to get C++ implementation base - const BufferedDecompositionPrimitive2D* pCandidate(dynamic_cast< BufferedDecompositionPrimitive2D* >(rCandidate.get())); + const BasePrimitive2D* pCandidate(dynamic_cast< BasePrimitive2D* >(rCandidate.get())); if(pCandidate) { @@ -185,8 +185,8 @@ namespace drawinglayer return true; } - const BufferedDecompositionPrimitive2D* pA(dynamic_cast< const BufferedDecompositionPrimitive2D* >(rxA.get())); - const BufferedDecompositionPrimitive2D* pB(dynamic_cast< const BufferedDecompositionPrimitive2D* >(rxB.get())); + const BasePrimitive2D* pA(dynamic_cast< const BasePrimitive2D* >(rxA.get())); + const BasePrimitive2D* pB(dynamic_cast< const BasePrimitive2D* >(rxB.get())); const bool bAEqualZero(pA == 0L); if(bAEqualZero != (pB == 0L)) diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx index 205f11d688b0..1341a22f0d89 100644 --- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx @@ -49,7 +49,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence BorderLinePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence BorderLinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DSequence xRetval; diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index 46392106f410..d3ddf3c8657f 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -266,7 +266,7 @@ namespace drawinglayer return xRetval; } - Primitive2DSequence ControlPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence ControlPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { // try to create a bitmap decomposition. If that fails for some reason, // at least create a replacement decomposition. @@ -365,16 +365,16 @@ namespace drawinglayer ::osl::MutexGuard aGuard( m_aMutex ); const basegfx::B2DVector aNewScaling(rViewInformation.getObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0)); - if(getLocal2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().hasElements()) { if(!maLastViewScaling.equal(aNewScaling)) { // conditions of last local decomposition have changed, delete - const_cast< ControlPrimitive2D* >(this)->setLocal2DDecomposition(Primitive2DSequence()); + const_cast< ControlPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); } } - if(!getLocal2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().hasElements()) { // remember ViewTransformation const_cast< ControlPrimitive2D* >(this)->maLastViewScaling = aNewScaling; diff --git a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx index c796048a4bf3..0c0a863733de 100644 --- a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx @@ -84,7 +84,7 @@ namespace drawinglayer return maShadowPrimitives.hasElements(); } - Primitive2DSequence Embedded3DPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence Embedded3DPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { // use info to create a yellow 2d rectangle, similar to empty 3d scenes and/or groups const basegfx::B2DRange aLocal2DRange(getB2DRange(rViewInformation)); diff --git a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx index 636c798f448c..57d5d7c00c7c 100644 --- a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx @@ -54,7 +54,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence FillBitmapPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence FillBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const Size aTileSizePixel(getFillBitmap().getBitmap().GetSizePixel()); Primitive2DSequence aRetval; diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx index 283123621cee..2bc280b577fd 100644 --- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx @@ -54,7 +54,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence FillGradientPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence FillGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const attribute::GradientStyle aGradientStyle(maFillGradient.getStyle()); ::std::vector< basegfx::B2DHomMatrix > aMatrices; diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx index 1446e5677cdf..9e6e69516d43 100644 --- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx @@ -55,7 +55,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence FillHatchPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence FillHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // create hatch const basegfx::BColor aHatchColor(maFillHatch.getColor()); diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index 8f1e138d4ca4..b28bc2147187 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -211,7 +211,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence GraphicPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence GraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DSequence aRetval; diff --git a/drawinglayer/source/primitive2d/gridprimitive2d.cxx b/drawinglayer/source/primitive2d/gridprimitive2d.cxx index 083b5adefa9c..a449fa396c68 100644 --- a/drawinglayer/source/primitive2d/gridprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/gridprimitive2d.cxx @@ -53,7 +53,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence GridPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence GridPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { Primitive2DSequence aRetval; @@ -299,16 +299,16 @@ namespace drawinglayer { ::osl::MutexGuard aGuard( m_aMutex ); - if(getLocal2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().hasElements()) { if(maLastViewport != rViewInformation.getViewport() || maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation()) { // conditions of last local decomposition have changed, delete - const_cast< GridPrimitive2D* >(this)->setLocal2DDecomposition(Primitive2DSequence()); + const_cast< GridPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); } } - if(!getLocal2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().hasElements()) { // remember ViewRange and ViewTransformation const_cast< GridPrimitive2D* >(this)->maLastObjectToViewTransformation = rViewInformation.getObjectToViewTransformation(); diff --git a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx index 3b67c7714796..251ac110acd6 100644 --- a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx @@ -54,9 +54,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence HelplinePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence HelplinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - std::vector< BufferedDecompositionPrimitive2D* > aTempPrimitiveTarget; + std::vector< BasePrimitive2D* > aTempPrimitiveTarget; if(!rViewInformation.getViewport().isEmpty() && !getDirection().equalZero()) { @@ -200,16 +200,16 @@ namespace drawinglayer { ::osl::MutexGuard aGuard( m_aMutex ); - if(getLocal2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().hasElements()) { if(maLastViewport != rViewInformation.getViewport() || maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation()) { // conditions of last local decomposition have changed, delete - const_cast< HelplinePrimitive2D* >(this)->setLocal2DDecomposition(Primitive2DSequence()); + const_cast< HelplinePrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); } } - if(!getLocal2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().hasElements()) { // remember ViewRange and ViewTransformation const_cast< HelplinePrimitive2D* >(this)->maLastObjectToViewTransformation = rViewInformation.getObjectToViewTransformation(); diff --git a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx index b61f5df4bb5f..acb2335c0d1f 100644 --- a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx @@ -55,7 +55,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence MarkerArrayPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence MarkerArrayPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { Primitive2DSequence xRetval; const std::vector< basegfx::B2DPoint >& rPositions = getPositions(); diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx index df95b7a87c29..ba8f81448968 100644 --- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx @@ -53,7 +53,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence MediaPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence MediaPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { Primitive2DSequence xRetval(1); diff --git a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx index 496415efdba4..ba879d9056c9 100644 --- a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx @@ -53,7 +53,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PagePreviewPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence PagePreviewPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { Primitive2DSequence xRetval; Primitive2DSequence aContent(getPageContent()); diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index 4a3678645571..69cbd046efd2 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -110,7 +110,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolygonMarkerPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence PolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { // calculate logic DashLength const basegfx::B2DVector aDashVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(getDiscreteDashLength(), 0.0)); @@ -198,7 +198,7 @@ namespace drawinglayer ::osl::MutexGuard aGuard( m_aMutex ); bool bNeedNewDecomposition(false); - if(getLocal2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().hasElements()) { if(rViewInformation.getInverseObjectToViewTransformation() != maLastInverseObjectToViewTransformation) { @@ -209,10 +209,10 @@ namespace drawinglayer if(bNeedNewDecomposition) { // conditions of last local decomposition have changed, delete - const_cast< PolygonMarkerPrimitive2D* >(this)->setLocal2DDecomposition(Primitive2DSequence()); + const_cast< PolygonMarkerPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); } - if(!getLocal2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().hasElements()) { // remember last used InverseObjectToViewTransformation PolygonMarkerPrimitive2D* pThat = const_cast< PolygonMarkerPrimitive2D* >(this); @@ -235,7 +235,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolygonStrokePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence PolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { if(getB2DPolygon().count()) { @@ -392,7 +392,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolygonWavePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence PolygonWavePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DSequence aRetval; @@ -505,7 +505,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolygonStrokeArrowPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence PolygonStrokeArrowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // copy local polygon, it may be changed basegfx::B2DPolygon aLocalPolygon(getB2DPolygon()); diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index 163c3a8691aa..7c8688fed31f 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -57,7 +57,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonHairlinePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence PolyPolygonHairlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); const sal_uInt32 nCount(aPolyPolygon.count()); @@ -117,7 +117,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonMarkerPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence PolyPolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); const sal_uInt32 nCount(aPolyPolygon.count()); @@ -185,7 +185,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonStrokePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence PolyPolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); const sal_uInt32 nCount(aPolyPolygon.count()); @@ -268,7 +268,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonStrokeArrowPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence PolyPolygonStrokeArrowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); const sal_uInt32 nCount(aPolyPolygon.count()); @@ -404,7 +404,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonGradientPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // create SubSequence with FillGradientPrimitive2D const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); @@ -451,7 +451,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonHatchPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // create SubSequence with FillHatchPrimitive2D const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); @@ -498,7 +498,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonBitmapPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence PolyPolygonBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // create SubSequence with FillBitmapPrimitive2D const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); diff --git a/drawinglayer/source/primitive2d/primitivetools2d.cxx b/drawinglayer/source/primitive2d/primitivetools2d.cxx index b441bb1b89ff..30af3a998daf 100644 --- a/drawinglayer/source/primitive2d/primitivetools2d.cxx +++ b/drawinglayer/source/primitive2d/primitivetools2d.cxx @@ -53,13 +53,13 @@ namespace drawinglayer // get the current DiscreteUnit const double fDiscreteUnit((rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength()); - if(getLocal2DDecomposition().hasElements() && !basegfx::fTools::equal(fDiscreteUnit, getDiscreteUnit())) + if(getBuffered2DDecomposition().hasElements() && !basegfx::fTools::equal(fDiscreteUnit, getDiscreteUnit())) { // conditions of last local decomposition have changed, delete - const_cast< DiscreteMetricDependentPrimitive2D* >(this)->setLocal2DDecomposition(Primitive2DSequence()); + const_cast< DiscreteMetricDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); } - if(!getLocal2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().hasElements()) { // remember new valid DiscreteUnit const_cast< DiscreteMetricDependentPrimitive2D* >(this)->mfDiscreteUnit = fDiscreteUnit; @@ -84,13 +84,13 @@ namespace drawinglayer // get the current Viewport const basegfx::B2DRange& rViewport = rViewInformation.getViewport(); - if(getLocal2DDecomposition().hasElements() && !rViewport.equal(getViewport())) + if(getBuffered2DDecomposition().hasElements() && !rViewport.equal(getViewport())) { // conditions of last local decomposition have changed, delete - const_cast< ViewportDependentPrimitive2D* >(this)->setLocal2DDecomposition(Primitive2DSequence()); + const_cast< ViewportDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); } - if(!getLocal2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().hasElements()) { // remember new valid DiscreteUnit const_cast< ViewportDependentPrimitive2D* >(this)->maViewport = rViewport; diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 935b5a14c2d9..cfeb5e35edc5 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -158,7 +158,7 @@ namespace drawinglayer } } - Primitive2DSequence ScenePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence ScenePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { Primitive2DSequence aRetval; @@ -365,7 +365,7 @@ namespace drawinglayer bool bNeedNewDecomposition(false); bool bDiscreteSizesAreCalculated(false); - if(getLocal2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().hasElements()) { basegfx::B2DRange aVisibleDiscreteRange; calculateDsicreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); @@ -392,10 +392,10 @@ namespace drawinglayer if(bNeedNewDecomposition) { // conditions of last local decomposition have changed, delete - const_cast< ScenePrimitive2D* >(this)->setLocal2DDecomposition(Primitive2DSequence()); + const_cast< ScenePrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); } - if(!getLocal2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().hasElements()) { if(!bDiscreteSizesAreCalculated) { diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index 695c92d2b951..787e221c406f 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -602,7 +602,7 @@ namespace drawinglayer } } - Primitive2DSequence TextDecoratedPortionPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence TextDecoratedPortionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { std::vector< Primitive2DReference > aNewPrimitives; basegfx::DecomposedB2DHomMatrixContainer aDecTrans(getTextTransform()); diff --git a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx index 22e51ae6f630..a2bbdb90889a 100644 --- a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx @@ -50,7 +50,7 @@ namespace drawinglayer { static double fDiscreteSize(1.1); - Primitive2DSequence TextEffectPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence TextEffectPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { Primitive2DSequence aRetval; @@ -218,16 +218,16 @@ namespace drawinglayer { ::osl::MutexGuard aGuard( m_aMutex ); - if(getLocal2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().hasElements()) { if(maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation()) { // conditions of last local decomposition have changed, delete - const_cast< TextEffectPrimitive2D* >(this)->setLocal2DDecomposition(Primitive2DSequence()); + const_cast< TextEffectPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); } } - if(!getLocal2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().hasElements()) { // remember ViewRange and ViewTransformation const_cast< TextEffectPrimitive2D* >(this)->maLastObjectToViewTransformation = rViewInformation.getObjectToViewTransformation(); diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index b74c4eabf898..819f94759ae0 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -181,7 +181,7 @@ namespace drawinglayer } } - Primitive2DSequence TextSimplePortionPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence TextSimplePortionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DSequence aRetval; diff --git a/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx b/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx index 07022229bfa8..4d50cb78da06 100644 --- a/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx @@ -48,7 +48,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence WrongSpellPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence WrongSpellPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // ATM this decompose is view-independent, what the original VCL-Display is not. To mimic // the old behaviour here if wanted it is necessary to add get2DDecomposition and implement diff --git a/drawinglayer/source/primitive3d/baseprimitive3d.cxx b/drawinglayer/source/primitive3d/baseprimitive3d.cxx index 57a016851af9..c30545e4f7c3 100644 --- a/drawinglayer/source/primitive3d/baseprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/baseprimitive3d.cxx @@ -94,28 +94,28 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence BufDecPrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + Primitive3DSequence BufferedDecompositionPrimitive3D::create3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { return Primitive3DSequence(); } - BufDecPrimitive3D::BufDecPrimitive3D() + BufferedDecompositionPrimitive3D::BufferedDecompositionPrimitive3D() : BasePrimitive3D(), - maLocal3DDecomposition() + maBuffered3DDecomposition() { } - Primitive3DSequence BufDecPrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const + Primitive3DSequence BufferedDecompositionPrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); - if(!getLocal3DDecomposition().hasElements()) + if(!getBuffered3DDecomposition().hasElements()) { - const Primitive3DSequence aNewSequence(createLocal3DDecomposition(rViewInformation)); - const_cast< BufDecPrimitive3D* >(this)->setLocal3DDecomposition(aNewSequence); + const Primitive3DSequence aNewSequence(create3DDecomposition(rViewInformation)); + const_cast< BufferedDecompositionPrimitive3D* >(this)->setBuffered3DDecomposition(aNewSequence); } - return getLocal3DDecomposition(); + return getBuffered3DDecomposition(); } } // end of namespace primitive3d } // end of namespace drawinglayer @@ -135,7 +135,7 @@ namespace drawinglayer if(rCandidate.is()) { // try to get C++ implementation base - const BufDecPrimitive3D* pCandidate(dynamic_cast< BufDecPrimitive3D* >(rCandidate.get())); + const BasePrimitive3D* pCandidate(dynamic_cast< BasePrimitive3D* >(rCandidate.get())); if(pCandidate) { @@ -185,8 +185,8 @@ namespace drawinglayer return true; } - const BufDecPrimitive3D* pA(dynamic_cast< const BufDecPrimitive3D* >(rxA.get())); - const BufDecPrimitive3D* pB(dynamic_cast< const BufDecPrimitive3D* >(rxB.get())); + const BasePrimitive3D* pA(dynamic_cast< const BasePrimitive3D* >(rxA.get())); + const BasePrimitive3D* pB(dynamic_cast< const BasePrimitive3D* >(rxB.get())); const bool bAEqualZero(pA == 0L); if(bAEqualZero != (pB == 0L)) diff --git a/drawinglayer/source/primitive3d/groupprimitive3d.cxx b/drawinglayer/source/primitive3d/groupprimitive3d.cxx index ae2a6fa8c75a..17736a276b38 100644 --- a/drawinglayer/source/primitive3d/groupprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/groupprimitive3d.cxx @@ -49,14 +49,8 @@ namespace drawinglayer { namespace primitive3d { - /// default: just return children, so all renderers not supporting group will use it's content - Primitive3DSequence GroupPrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const - { - return getChildren(); - } - GroupPrimitive3D::GroupPrimitive3D( const Primitive3DSequence& rChildren ) - : BufDecPrimitive3D(), + : BasePrimitive3D(), maChildren(rChildren) { } @@ -67,7 +61,7 @@ namespace drawinglayer */ bool GroupPrimitive3D::operator==( const BasePrimitive3D& rPrimitive ) const { - if(BufDecPrimitive3D::operator==(rPrimitive)) + if(BasePrimitive3D::operator==(rPrimitive)) { const GroupPrimitive3D& rCompare = static_cast< const GroupPrimitive3D& >(rPrimitive); @@ -77,6 +71,12 @@ namespace drawinglayer return false; } + /// default: just return children, so all renderers not supporting group will use it's content + Primitive3DSequence GroupPrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + { + return getChildren(); + } + // provide unique ID ImplPrimitrive3DIDBlock(GroupPrimitive3D, PRIMITIVE3D_ID_GROUPPRIMITIVE3D) diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx index a0d202dc9dbe..381b70d4f6cc 100644 --- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx @@ -59,7 +59,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence HatchTexturePrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + Primitive3DSequence HatchTexturePrimitive3D::impCreate3DDecomposition() const { Primitive3DSequence aRetval; @@ -76,12 +76,12 @@ namespace drawinglayer if(xReference.is()) { - // try to cast to BufferedDecompositionPrimitive2D implementation - const BufDecPrimitive3D* pBasePrimitive = dynamic_cast< const BufDecPrimitive3D* >(xReference.get()); + // try to cast to BasePrimitive2D implementation + const BasePrimitive3D* pBasePrimitive = dynamic_cast< const BasePrimitive3D* >(xReference.get()); if(pBasePrimitive) { - // it is a BufDecPrimitive3D implementation, use getPrimitive3DID() call for switch + // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch // not all content is needed, remove transparencies and ModifiedColorPrimitives switch(pBasePrimitive->getPrimitive3DID()) { @@ -287,7 +287,8 @@ namespace drawinglayer bool bModulate, bool bFilter) : TexturePrimitive3D(rChildren, rTextureSize, bModulate, bFilter), - maHatch(rHatch) + maHatch(rHatch), + maBuffered3DDecomposition() { } @@ -303,6 +304,19 @@ namespace drawinglayer return false; } + Primitive3DSequence HatchTexturePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + { + ::osl::MutexGuard aGuard( m_aMutex ); + + if(!getBuffered3DDecomposition().hasElements()) + { + const Primitive3DSequence aNewSequence(impCreate3DDecomposition()); + const_cast< HatchTexturePrimitive3D* >(this)->setBuffered3DDecomposition(aNewSequence); + } + + return getBuffered3DDecomposition(); + } + // provide unique ID ImplPrimitrive3DIDBlock(HatchTexturePrimitive3D, PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D) diff --git a/drawinglayer/source/primitive3d/hittestprimitive3d.cxx b/drawinglayer/source/primitive3d/hittestprimitive3d.cxx index 9288b3a79219..65aede8142aa 100644 --- a/drawinglayer/source/primitive3d/hittestprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/hittestprimitive3d.cxx @@ -49,12 +49,6 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence HitTestPrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const - { - // return empty sequence - return Primitive3DSequence(); - } - HitTestPrimitive3D::HitTestPrimitive3D( const Primitive3DSequence& rChildren) : GroupPrimitive3D(rChildren) @@ -66,6 +60,12 @@ namespace drawinglayer return getB3DRangeFromPrimitive3DSequence(getChildren(), rViewInformation); } + Primitive3DSequence HitTestPrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + { + // return empty sequence + return Primitive3DSequence(); + } + // provide unique ID ImplPrimitrive3DIDBlock(HitTestPrimitive3D, PRIMITIVE3D_ID_HITTESTPRIMITIVE3D) diff --git a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx index 9fba5c97cd93..ee38b8782cff 100644 --- a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx @@ -56,7 +56,7 @@ namespace drawinglayer PolygonHairlinePrimitive3D::PolygonHairlinePrimitive3D( const basegfx::B3DPolygon& rPolygon, const basegfx::BColor& rBColor) - : BufDecPrimitive3D(), + : BasePrimitive3D(), maPolygon(rPolygon), maBColor(rBColor) { @@ -64,7 +64,7 @@ namespace drawinglayer bool PolygonHairlinePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const { - if(BufDecPrimitive3D::operator==(rPrimitive)) + if(BasePrimitive3D::operator==(rPrimitive)) { const PolygonHairlinePrimitive3D& rCompare = (PolygonHairlinePrimitive3D&)rPrimitive; @@ -92,7 +92,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence PolygonStrokePrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + Primitive3DSequence PolygonStrokePrimitive3D::create3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { Primitive3DSequence aRetval; @@ -145,7 +145,7 @@ namespace drawinglayer const basegfx::B3DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute) - : BufDecPrimitive3D(), + : BufferedDecompositionPrimitive3D(), maPolygon(rPolygon), maLineAttribute(rLineAttribute), maStrokeAttribute(rStrokeAttribute) @@ -155,7 +155,7 @@ namespace drawinglayer PolygonStrokePrimitive3D::PolygonStrokePrimitive3D( const basegfx::B3DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute) - : BufDecPrimitive3D(), + : BufferedDecompositionPrimitive3D(), maPolygon(rPolygon), maLineAttribute(rLineAttribute), maStrokeAttribute() @@ -164,7 +164,7 @@ namespace drawinglayer bool PolygonStrokePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const { - if(BufDecPrimitive3D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive3D::operator==(rPrimitive)) { const PolygonStrokePrimitive3D& rCompare = (PolygonStrokePrimitive3D&)rPrimitive; diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx index 5ce26203a703..d95473a27805 100644 --- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx @@ -178,7 +178,7 @@ namespace drawinglayer { // nSegments is for whole circle, adapt to half circle const sal_uInt32 nVerSeg(nSegments >> 1L); - std::vector< BufDecPrimitive3D* > aResultVector; + std::vector< BasePrimitive3D* > aResultVector; if(nVerSeg) { @@ -196,7 +196,7 @@ namespace drawinglayer { const basegfx::B3DPolygon aPartPolygon(aSphere.getB3DPolygon(a)); const basegfx::B3DPolyPolygon aPartPolyPolygon(aPartPolygon); - BufDecPrimitive3D* pNew = new PolyPolygonMaterialPrimitive3D(aPartPolyPolygon, rMaterial, false); + BasePrimitive3D* pNew = new PolyPolygonMaterialPrimitive3D(aPartPolyPolygon, rMaterial, false); aResultVector.push_back(pNew); } } @@ -345,7 +345,7 @@ namespace drawinglayer if(aNewPolygon.count()) { const basegfx::B3DPolyPolygon aNewPolyPolygon(aNewPolygon); - BufDecPrimitive3D* pNew = new PolyPolygonMaterialPrimitive3D(aNewPolyPolygon, rMaterial, false); + BasePrimitive3D* pNew = new PolyPolygonMaterialPrimitive3D(aNewPolyPolygon, rMaterial, false); aResultVector.push_back(pNew); } @@ -359,7 +359,7 @@ namespace drawinglayer // create primitive const basegfx::B3DPolyPolygon aMiterPolyPolygon(aMiterPolygon); - BufDecPrimitive3D* pNew = new PolyPolygonMaterialPrimitive3D(aMiterPolyPolygon, rMaterial, false); + BasePrimitive3D* pNew = new PolyPolygonMaterialPrimitive3D(aMiterPolyPolygon, rMaterial, false); aResultVector.push_back(pNew); } @@ -417,10 +417,10 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence PolygonTubePrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + Primitive3DSequence PolygonTubePrimitive3D::create3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { const sal_uInt32 nPointCount(getB3DPolygon().count()); - std::vector< BufDecPrimitive3D* > aResultVector; + std::vector< BasePrimitive3D* > aResultVector; if(0L != nPointCount) { diff --git a/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx index a80d757ee4a0..f05a85869cbf 100644 --- a/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx @@ -55,7 +55,7 @@ namespace drawinglayer const basegfx::B3DPolyPolygon& rPolyPolygon, const attribute::MaterialAttribute3D& rMaterial, bool bDoubleSided) - : BufDecPrimitive3D(), + : BasePrimitive3D(), maPolyPolygon(rPolyPolygon), maMaterial(rMaterial), mbDoubleSided(bDoubleSided) @@ -64,7 +64,7 @@ namespace drawinglayer bool PolyPolygonMaterialPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const { - if(BufDecPrimitive3D::operator==(rPrimitive)) + if(BasePrimitive3D::operator==(rPrimitive)) { const PolyPolygonMaterialPrimitive3D& rCompare = (PolyPolygonMaterialPrimitive3D&)rPrimitive; diff --git a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx index 1d5401533e00..739914562071 100644 --- a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx @@ -56,7 +56,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence SdrCubePrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + Primitive3DSequence SdrCubePrimitive3D::create3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { const basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); Primitive3DSequence aRetval; diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx index 00a53b2f6578..df682ab04e6f 100644 --- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx @@ -221,7 +221,7 @@ namespace drawinglayer { bool bModulate(::com::sun::star::drawing::TextureMode_MODULATE == aSdr3DObjectAttribute.getTextureMode()); bool bFilter(aSdr3DObjectAttribute.getTextureFilter()); - BufDecPrimitive3D* pNewTexturePrimitive3D = 0L; + BasePrimitive3D* pNewTexturePrimitive3D = 0L; if(rFill.isGradient()) { diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx index bc99bab20740..3554e9266ec1 100644 --- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx @@ -57,7 +57,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence SdrExtrudePrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const + Primitive3DSequence SdrExtrudePrimitive3D::create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const { Primitive3DSequence aRetval; @@ -510,14 +510,14 @@ namespace drawinglayer if(getSdr3DObjectAttribute().getReducedLineGeometry()) { if(!mpLastRLGViewInformation || - (getLocal3DDecomposition().hasElements() + (getBuffered3DDecomposition().hasElements() && *mpLastRLGViewInformation != rViewInformation)) { // conditions of last local decomposition with reduced lines have changed. Remember // new one and clear current decompositiopn ::osl::Mutex m_mutex; SdrExtrudePrimitive3D* pThat = const_cast< SdrExtrudePrimitive3D* >(this); - pThat->setLocal3DDecomposition(Primitive3DSequence()); + pThat->setBuffered3DDecomposition(Primitive3DSequence()); delete pThat->mpLastRLGViewInformation; pThat->mpLastRLGViewInformation = new geometry::ViewInformation3D(rViewInformation); } diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx index 852a08642375..5e6c34e644de 100644 --- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx @@ -57,7 +57,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence SdrLathePrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const + Primitive3DSequence SdrLathePrimitive3D::create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const { Primitive3DSequence aRetval; @@ -369,14 +369,14 @@ namespace drawinglayer if(getSdr3DObjectAttribute().getReducedLineGeometry()) { if(!mpLastRLGViewInformation || - (getLocal3DDecomposition().hasElements() + (getBuffered3DDecomposition().hasElements() && *mpLastRLGViewInformation != rViewInformation)) { // conditions of last local decomposition with reduced lines have changed. Remember // new one and clear current decompositiopn ::osl::Mutex m_mutex; SdrLathePrimitive3D* pThat = const_cast< SdrLathePrimitive3D* >(this); - pThat->setLocal3DDecomposition(Primitive3DSequence()); + pThat->setBuffered3DDecomposition(Primitive3DSequence()); delete pThat->mpLastRLGViewInformation; pThat->mpLastRLGViewInformation = new geometry::ViewInformation3D(rViewInformation); } diff --git a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx index 5a12bc35a454..69049fb7b24d 100644 --- a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx @@ -53,7 +53,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence SdrPolyPolygonPrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + Primitive3DSequence SdrPolyPolygonPrimitive3D::create3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { Primitive3DSequence aRetval; diff --git a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx index dcef40ac3cdc..f8489b6418ff 100644 --- a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx @@ -103,7 +103,7 @@ namespace drawinglayer const basegfx::B2DVector& rTextureSize, const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute) - : BufDecPrimitive3D(), + : BufferedDecompositionPrimitive3D(), maTransform(rTransform), maTextureSize(rTextureSize), maSdrLFSAttribute(rSdrLFSAttribute), @@ -113,7 +113,7 @@ namespace drawinglayer bool SdrPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const { - if(BufDecPrimitive3D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive3D::operator==(rPrimitive)) { const SdrPrimitive3D& rCompare = static_cast< const SdrPrimitive3D& >(rPrimitive); diff --git a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx index 61d14181a8e8..663ae6ad0d37 100644 --- a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx @@ -56,7 +56,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence SdrSpherePrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + Primitive3DSequence SdrSpherePrimitive3D::create3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { Primitive3DSequence aRetval; const basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx b/drawinglayer/source/primitive3d/textureprimitive3d.cxx index b5195811472b..16f33435a38b 100644 --- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx @@ -81,7 +81,27 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence UnifiedAlphaTexturePrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + UnifiedAlphaTexturePrimitive3D::UnifiedAlphaTexturePrimitive3D( + double fTransparence, + const Primitive3DSequence& rChildren) + : TexturePrimitive3D(rChildren, basegfx::B2DVector(), false, false), + mfTransparence(fTransparence) + { + } + + bool UnifiedAlphaTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const + { + if(TexturePrimitive3D::operator==(rPrimitive)) + { + const UnifiedAlphaTexturePrimitive3D& rCompare = (UnifiedAlphaTexturePrimitive3D&)rPrimitive; + + return (getTransparence() == rCompare.getTransparence()); + } + + return false; + } + + Primitive3DSequence UnifiedAlphaTexturePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { if(0.0 == getTransparence()) { @@ -103,26 +123,6 @@ namespace drawinglayer } } - UnifiedAlphaTexturePrimitive3D::UnifiedAlphaTexturePrimitive3D( - double fTransparence, - const Primitive3DSequence& rChildren) - : TexturePrimitive3D(rChildren, basegfx::B2DVector(), false, false), - mfTransparence(fTransparence) - { - } - - bool UnifiedAlphaTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const - { - if(TexturePrimitive3D::operator==(rPrimitive)) - { - const UnifiedAlphaTexturePrimitive3D& rCompare = (UnifiedAlphaTexturePrimitive3D&)rPrimitive; - - return (getTransparence() == rCompare.getTransparence()); - } - - return false; - } - // provide unique ID ImplPrimitrive3DIDBlock(UnifiedAlphaTexturePrimitive3D, PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D) @@ -135,11 +135,6 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence GradientTexturePrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const - { - return getChildren(); - } - GradientTexturePrimitive3D::GradientTexturePrimitive3D( const attribute::FillGradientAttribute& rGradient, const Primitive3DSequence& rChildren, @@ -175,11 +170,6 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence BitmapTexturePrimitive3D::createLocal3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const - { - return getChildren(); - } - BitmapTexturePrimitive3D::BitmapTexturePrimitive3D( const attribute::FillBitmapAttribute& rBitmap, const Primitive3DSequence& rChildren, diff --git a/drawinglayer/source/processor2d/baseprocessor2d.cxx b/drawinglayer/source/processor2d/baseprocessor2d.cxx index 28023c8b253f..76f66b85c9fa 100644 --- a/drawinglayer/source/processor2d/baseprocessor2d.cxx +++ b/drawinglayer/source/processor2d/baseprocessor2d.cxx @@ -74,12 +74,12 @@ namespace drawinglayer if(xReference.is()) { - // try to cast to BufferedDecompositionPrimitive2D implementation - const primitive2d::BufferedDecompositionPrimitive2D* pBasePrimitive = dynamic_cast< const primitive2d::BufferedDecompositionPrimitive2D* >(xReference.get()); + // try to cast to BasePrimitive2D implementation + const primitive2d::BasePrimitive2D* pBasePrimitive = dynamic_cast< const primitive2d::BasePrimitive2D* >(xReference.get()); if(pBasePrimitive) { - // it is a BufferedDecompositionPrimitive2D implementation, use local processor + // it is a BasePrimitive2D implementation, use local processor processBasePrimitive2D(*pBasePrimitive); } else diff --git a/drawinglayer/source/processor3d/baseprocessor3d.cxx b/drawinglayer/source/processor3d/baseprocessor3d.cxx index 532b792379a2..7d630f2522be 100644 --- a/drawinglayer/source/processor3d/baseprocessor3d.cxx +++ b/drawinglayer/source/processor3d/baseprocessor3d.cxx @@ -74,8 +74,8 @@ namespace drawinglayer if(xReference.is()) { - // try to cast to BufDecPrimitive3D implementation - const primitive3d::BufDecPrimitive3D* pBasePrimitive = dynamic_cast< const primitive3d::BufDecPrimitive3D* >(xReference.get()); + // try to cast to BasePrimitive3D implementation + const primitive3d::BasePrimitive3D* pBasePrimitive = dynamic_cast< const primitive3d::BasePrimitive3D* >(xReference.get()); if(pBasePrimitive) { diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index d5658b966fe8..5f35960323fe 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -468,7 +468,7 @@ namespace drawinglayer void DefaultProcessor3D::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive) { - // it is a BufDecPrimitive3D implementation, use getPrimitive3DID() call for switch + // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch switch(rBasePrimitive.getPrimitive3DID()) { case PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D : diff --git a/drawinglayer/source/processor3d/shadow3dextractor.cxx b/drawinglayer/source/processor3d/shadow3dextractor.cxx index 166620666300..5e6678fc3a8e 100644 --- a/drawinglayer/source/processor3d/shadow3dextractor.cxx +++ b/drawinglayer/source/processor3d/shadow3dextractor.cxx @@ -60,10 +60,10 @@ namespace drawinglayer namespace processor3d { // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BufDecPrimitive3D-based. + // virtual render method when the primitive implementation is BasePrimitive3D-based. void Shadow3DExtractingProcessor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) { - // it is a BufDecPrimitive3D implementation, use getPrimitive3DID() call for switch + // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch switch(rCandidate.getPrimitive3DID()) { case PRIMITIVE3D_ID_SHADOWPRIMITIVE3D : diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx index f8f1056fbaac..48c1bee86575 100644 --- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx +++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx @@ -486,7 +486,7 @@ namespace drawinglayer // the processing method for a single, known primitive void ZBufferProcessor3D::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive) { - // it is a BufDecPrimitive3D implementation, use getPrimitive3DID() call for switch + // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch switch(rBasePrimitive.getPrimitive3DID()) { case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D : diff --git a/svx/inc/svx/sdr/overlay/overlaytools.hxx b/svx/inc/svx/sdr/overlay/overlaytools.hxx index f02cf44297f9..830f3dc12586 100644 --- a/svx/inc/svx/sdr/overlay/overlaytools.hxx +++ b/svx/inc/svx/sdr/overlay/overlaytools.hxx @@ -58,7 +58,7 @@ namespace drawinglayer sal_uInt16 mnCenterY; protected: - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: OverlayBitmapExPrimitive( @@ -99,7 +99,7 @@ namespace drawinglayer double mfDiscreteDashLength; protected: - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: OverlayCrosshairPrimitive( @@ -148,7 +148,7 @@ namespace drawinglayer double mfRotation; protected: - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: OverlayHatchRectanglePrimitive( @@ -206,7 +206,7 @@ namespace drawinglayer double mfDiscreteDashLength; protected: - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: OverlayHelplineStripedPrimitive( @@ -251,7 +251,7 @@ namespace drawinglayer double mfDiscreteDashLength; protected: - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: OverlayRollingRectanglePrimitive( diff --git a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx index 26ce0fc0673a..177c42bfff17 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx @@ -57,7 +57,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrCaptionPrimitive2D( diff --git a/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx index a7465c1c7a4a..5523480f1f51 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx @@ -53,7 +53,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrConnectorPrimitive2D( diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx index 64716b479ce7..feedfefc0fe6 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx @@ -59,7 +59,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrCustomShapePrimitive2D( diff --git a/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx index bcaf0aa22ea0..1d11c27ede71 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx @@ -53,7 +53,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrEllipsePrimitive2D( @@ -91,7 +91,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrEllipseSegmentPrimitive2D( diff --git a/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx index c3cdf4080f84..787c230d7b3d 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx @@ -57,7 +57,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrGrafPrimitive2D( diff --git a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx index 7244e4d2a743..7cc0f6dde9a5 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx @@ -88,7 +88,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrMeasurePrimitive2D( diff --git a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx index 7fcde5221f87..d1b473bd4f5a 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx @@ -55,7 +55,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrOle2Primitive2D( diff --git a/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx index c6349fe7d39c..fb14a6192873 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx @@ -58,7 +58,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrOleContentPrimitive2D( diff --git a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx index bb0731cea3d1..d6de666d901f 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx @@ -55,7 +55,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrPathPrimitive2D( diff --git a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx index 1a34d4b35a28..2f4bd690d8de 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx @@ -61,7 +61,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrRectanglePrimitive2D( diff --git a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx index 35b0f42eaa6e..d1bdfdfc5038 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx @@ -138,7 +138,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrContourTextPrimitive2D( @@ -180,7 +180,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrPathTextPrimitive2D( @@ -224,7 +224,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrBlockTextPrimitive2D( @@ -267,7 +267,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrStretchTextPrimitive2D( diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx index c2729e95dc93..e2bbe430987d 100644 --- a/svx/source/engine3d/helperhittest3d.cxx +++ b/svx/source/engine3d/helperhittest3d.cxx @@ -100,7 +100,7 @@ namespace drawinglayer basegfx::B3DHomMatrix maCombinedTransform; // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BufDecPrimitive3D-based. + // virtual render method when the primitive implementation is BasePrimitive3D-based. virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -120,7 +120,7 @@ namespace drawinglayer void CutFindProcessor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) { - // it is a BufDecPrimitive3D implementation, use getPrimitive3DID() call for switch + // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch switch(rCandidate.getPrimitive3DID()) { case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D : diff --git a/svx/source/engine3d/helperminimaldepth3d.cxx b/svx/source/engine3d/helperminimaldepth3d.cxx index 965343009b21..35ebb4dec0f6 100644 --- a/svx/source/engine3d/helperminimaldepth3d.cxx +++ b/svx/source/engine3d/helperminimaldepth3d.cxx @@ -55,7 +55,7 @@ namespace drawinglayer double mfMinimalDepth; // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BufDecPrimitive3D-based. + // virtual render method when the primitive implementation is BasePrimitive3D-based. virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -70,7 +70,7 @@ namespace drawinglayer void MinimalDephInViewExtractor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) { - // it is a BufDecPrimitive3D implementation, use getPrimitive3DID() call for switch + // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch switch(rCandidate.getPrimitive3DID()) { case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D : diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx index 381b86f0f4c5..e8aace40eac5 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx @@ -164,7 +164,7 @@ namespace sdr const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); aObjectMatrix.translate(nXDist, nYDist); - // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::createLocal2DDecomposition) + // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::create2DDecomposition) basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), fCornerRadiusX, fCornerRadiusY)); // create the specialized shadow primitive diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index 6b6e4e5e641a..f265af141ef1 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -78,7 +78,7 @@ namespace unsigned mbGraphicAnimationAllowed : 1; // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BufferedDecompositionPrimitive2D-based. + // virtual render method when the primitive implementation is BasePrimitive2D-based. virtual void processBasePrimitive2D(const drawinglayer::primitive2d::BasePrimitive2D& rCandidate); public: diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index cb410cb7ef5f..f81824c1012c 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -153,7 +153,7 @@ namespace sdr // would be possible, but would require the internal transformation // which maps between the page visualisation object and the page // content, including the aspect ratios (for details see in - // PagePreviewPrimitive2D::createLocal2DDecomposition) + // PagePreviewPrimitive2D::create2DDecomposition) basegfx::B2DRange(), GetXDrawPageForSdrPage(const_cast< SdrPage* >(pStartPage)), diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 652b9f5ee56f..b50426f7b65d 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -790,7 +790,7 @@ namespace sdr { namespace contact { ) const; virtual ::drawinglayer::primitive2d::Primitive2DSequence - createLocal2DDecomposition( + create2DDecomposition( const ::drawinglayer::geometry::ViewInformation2D& rViewInformation ) const; @@ -1486,7 +1486,7 @@ namespace sdr { namespace contact { } //-------------------------------------------------------------------- - ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::createLocal2DDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const + ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::create2DDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const { // force control here to make it a VCL ChildWindow. Will be fetched // and used below by getExistentControl() diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx index 7abb56785666..6755d09fb34b 100644 --- a/svx/source/sdr/overlay/overlaytools.cxx +++ b/svx/source/sdr/overlay/overlaytools.cxx @@ -59,7 +59,7 @@ namespace drawinglayer mnCenterY(nCenterY) {} - Primitive2DSequence OverlayBitmapExPrimitive::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence OverlayBitmapExPrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DSequence aRetval; const Size aBitmapSize(getBitmapEx().GetSizePixel()); @@ -129,7 +129,7 @@ namespace drawinglayer mfDiscreteDashLength(fDiscreteDashLength) {} - Primitive2DSequence OverlayCrosshairPrimitive::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence OverlayCrosshairPrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // use the prepared Viewport information accessible using getViewport() Primitive2DSequence aRetval; @@ -208,7 +208,7 @@ namespace drawinglayer mfRotation(fRotation) {} - Primitive2DSequence OverlayHatchRectanglePrimitive::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence OverlayHatchRectanglePrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DSequence aRetval; @@ -301,7 +301,7 @@ namespace drawinglayer mfDiscreteDashLength(fDiscreteDashLength) {} - Primitive2DSequence OverlayHelplineStripedPrimitive::createLocal2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence OverlayHelplineStripedPrimitive::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { // use the prepared Viewport information accessible using getViewport() Primitive2DSequence aRetval; @@ -417,7 +417,7 @@ namespace drawinglayer mfDiscreteDashLength(fDiscreteDashLength) {} - Primitive2DSequence OverlayRollingRectanglePrimitive::createLocal2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence OverlayRollingRectanglePrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // use the prepared Viewport information accessible using getViewport() Primitive2DSequence aRetval; diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx index 8fb3ba8790bc..174320380432 100644 --- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrCaptionPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrCaptionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; Primitive2DSequence aHitTestContent; diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx index 406ddc4986e5..ceb05c758887 100644 --- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrConnectorPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrConnectorPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index 01002e133f84..aacfca368e0d 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrCustomShapePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrCustomShapePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval(getSubPrimitives()); diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 639ec09f6a34..3fbcc15dd473 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -137,7 +137,7 @@ namespace drawinglayer // create line and stroke attribute const attribute::LineAttribute aLineAttribute(rLine.getColor(), rLine.getWidth(), rLine.getJoin()); const attribute::StrokeAttribute aStrokeAttribute(rLine.getDotDashArray(), rLine.getFullDotDashLen()); - BufferedDecompositionPrimitive2D* pNewLinePrimitive = 0L; + BasePrimitive2D* pNewLinePrimitive = 0L; if(!rUnitPolygon.isClosed() && pStroke) { diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx index 8aa644da938e..1c2cc70842d2 100644 --- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx @@ -50,7 +50,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrEllipsePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrEllipsePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; @@ -140,7 +140,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrEllipseSegmentPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrEllipseSegmentPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index 3cc4e7b865d4..5d37483d4e2a 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -44,7 +44,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrGrafPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrGrafPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 1fcd1047c5ef..4623182ace23 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -83,7 +83,7 @@ namespace drawinglayer return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *getSdrLSTAttribute().getLine(), &aLineStartEnd); } - Primitive2DSequence SdrMeasurePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const + Primitive2DSequence SdrMeasurePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; SdrBlockTextPrimitive2D* pBlockText = 0L; @@ -424,7 +424,7 @@ namespace drawinglayer // apply to existing text primitive SdrTextPrimitive2D* pNewBlockText = pBlockText->createTransformedClone(aChange); - OSL_ENSURE(pNewBlockText, "SdrMeasurePrimitive2D::createLocal2DDecomposition: Could not create transformed clone of text primitive (!)"); + OSL_ENSURE(pNewBlockText, "SdrMeasurePrimitive2D::create2DDecomposition: Could not create transformed clone of text primitive (!)"); delete pBlockText; // add to local primitives diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index 78978202f20b..d16b6d813c62 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -46,9 +46,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrOle2Primitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrOle2Primitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { - // to take care of getSdrLFSTAttribute() later, the same as in SdrGrafPrimitive2D::createLocal2DDecomposition + // to take care of getSdrLFSTAttribute() later, the same as in SdrGrafPrimitive2D::create2DDecomposition // should happen. For the moment we only need the OLE itself // Added complete primitive preparation using getSdrLFSTAttribute() now. To not do stuff which is not needed now, it // may be supressed by using a static bool. The paint version only supported text. diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index a2039e1923fa..57e685313586 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrOleContentPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrOleContentPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; const SdrOle2Obj* pSource = (mpSdrOle2Obj.is() ? static_cast< SdrOle2Obj* >(mpSdrOle2Obj.get()) : 0); diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx index 7e18afafb5f2..3e9976cac83a 100644 --- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrPathPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrPathPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index 04e02be419fa..42fc8beabc8c 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrRectanglePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrRectanglePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; Primitive2DSequence aHitTestContent; diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index 012928fec8d0..a39fb2d6c2a1 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -155,7 +155,7 @@ namespace drawinglayer sal_Int16 nCurrentlyValidPageNumber(0); sal_Int16 nCurrentlyValidPageCount(0); - if(getLocal2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().hasElements()) { bool bDoDelete(getLastSpellCheck() != bCurrentSpellCheck); @@ -209,11 +209,11 @@ namespace drawinglayer if(bDoDelete) { - const_cast< SdrTextPrimitive2D* >(this)->setLocal2DDecomposition(Primitive2DSequence()); + const_cast< SdrTextPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); } } - if(!getLocal2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().hasElements()) { if(!bCurrentlyVisualizingPageIsSet && mbContainsPageField) { @@ -255,7 +255,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrContourTextPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const + Primitive2DSequence SdrContourTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; const bool bCurrentSpellCheck(getSdrText() @@ -316,7 +316,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrPathTextPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const + Primitive2DSequence SdrPathTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; const bool bCurrentSpellCheck(getSdrText() @@ -380,7 +380,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrBlockTextPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const + Primitive2DSequence SdrBlockTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; const bool bCurrentSpellCheck(getSdrText() @@ -449,7 +449,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrStretchTextPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const + Primitive2DSequence SdrStretchTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; const bool bCurrentSpellCheck(getSdrText() diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index 05c21c606711..f3bdeeb4811c 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -231,8 +231,8 @@ namespace class impPolygonParagraphHandler { const drawinglayer::attribute::SdrFormTextAttribute& mrSdrFormTextAttribute; // FormText parameters - std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* >& mrDecomposition; // destination primitive list - std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* >& mrShadowDecomposition; // destination primitive list for shadow + std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrDecomposition; // destination primitive list + std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrShadowDecomposition; // destination primitive list for shadow Reference < com::sun::star::i18n::XBreakIterator > mxBreak; // break iterator double getParagraphTextLength(const ::std::vector< const impPathTextPortion* >& rTextPortions) @@ -271,8 +271,8 @@ namespace public: impPolygonParagraphHandler( const drawinglayer::attribute::SdrFormTextAttribute& rSdrFormTextAttribute, - std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* >& rDecomposition, - std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* >& rShadowDecomposition) + std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rDecomposition, + std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rShadowDecomposition) : mrSdrFormTextAttribute(rSdrFormTextAttribute), mrDecomposition(rDecomposition), mrShadowDecomposition(rShadowDecomposition) @@ -571,7 +571,7 @@ namespace const basegfx::B2DHomMatrix& rTransform, const drawinglayer::attribute::LineAttribute& rLineAttribute, const drawinglayer::attribute::StrokeAttribute& rStrokeAttribute, - std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* >& rTarget) + std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rTarget) { for(basegfx::B2DPolyPolygonVector::const_iterator aPolygon(rB2DPolyPolyVector.begin()); aPolygon != rB2DPolyPolyVector.end(); aPolygon++) { @@ -591,7 +591,7 @@ namespace } drawinglayer::primitive2d::Primitive2DSequence impAddPathTextOutlines( - const std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* >& rSource, + const std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rSource, const drawinglayer::attribute::SdrFormTextOutlineAttribute& rOutlineAttribute) { std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aNewPrimitives; @@ -611,7 +611,7 @@ namespace if(aB2DPolyPolyVector.size()) { // create stroke primitives - std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* > aStrokePrimitives; + std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aStrokePrimitives; impAddPolygonStrokePrimitives( aB2DPolyPolyVector, aPolygonTransform, @@ -710,8 +710,8 @@ bool SdrTextObj::impDecomposePathTextPrimitive( if(nLoopCount) { // prepare common decomposition stuff - std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* > aRegularDecomposition; - std::vector< drawinglayer::primitive2d::BufferedDecompositionPrimitive2D* > aShadowDecomposition; + std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aRegularDecomposition; + std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aShadowDecomposition; impPolygonParagraphHandler aPolygonParagraphHandler( rFormTextAttribute, aRegularDecomposition, aShadowDecomposition); sal_uInt32 a; diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index c6a572928892..a8396e4eff16 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -72,7 +72,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrCellPrimitive2D( @@ -95,7 +95,7 @@ namespace drawinglayer DeclPrimitrive2DIDBlock() }; - Primitive2DSequence SdrCellPrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrCellPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; @@ -173,7 +173,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive2DSequence createLocal2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; public: SdrBorderlinePrimitive2D( @@ -282,7 +282,7 @@ namespace drawinglayer return (double)nValue; } - Primitive2DSequence SdrBorderlinePrimitive2D::createLocal2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + Primitive2DSequence SdrBorderlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence xRetval(4); sal_uInt32 nInsert(0); -- cgit v1.2.3 From 256427a28d4ba3de573c81d64b5fbbe1cb354b01 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 22 Sep 2009 18:14:05 +0200 Subject: #i97509# continued matrix tooling and adapting the usages now to all the ooo code --- .../drawinglayer/primitive2d/alphaprimitive2d.hxx | 22 +++++++-- .../primitive2d/animatedprimitive2d.hxx | 39 +-------------- .../drawinglayer/primitive2d/bitmapprimitive2d.hxx | 21 ++++++-- .../primitive2d/polypolygonprimitive2d.hxx | 18 ++++--- .../primitive2d/textdecoratedprimitive2d.hxx | 12 ++--- .../source/primitive2d/animatedprimitive2d.cxx | 51 ++++--------------- .../source/primitive2d/controlprimitive2d.cxx | 9 ++-- .../source/primitive2d/graphicprimitive2d.cxx | 18 ++++--- .../source/primitive2d/gridprimitive2d.cxx | 7 ++- .../source/primitive2d/pagepreviewprimitive2d.cxx | 7 +-- .../source/primitive2d/polypolygonprimitive2d.cxx | 25 +++++----- .../primitive2d/textdecoratedprimitive2d.cxx | 29 +++++------ .../source/primitive2d/texteffectprimitive2d.cxx | 8 +-- .../source/primitive2d/textprimitive2d.cxx | 16 ++---- .../source/processor2d/canvasprocessor.cxx | 29 +++++------ .../source/processor2d/vclhelperbitmaprender.cxx | 20 ++++---- .../source/processor2d/vclpixelprocessor2d.cxx | 16 ++---- drawinglayer/source/processor2d/vclprocessor2d.cxx | 37 +++++++++----- drawinglayer/source/texture/texture.cxx | 6 +-- svx/source/cui/tplneend.cxx | 9 ++-- svx/source/engine3d/view3d.cxx | 11 ++--- svx/source/sdr/contact/viewcontactofgraphic.cxx | 37 +++++--------- .../sdr/contact/viewcontactofsdrcaptionobj.cxx | 28 +++-------- svx/source/sdr/contact/viewcontactofsdrcircobj.cxx | 28 +++-------- .../sdr/contact/viewcontactofsdrobjcustomshape.cxx | 18 +++---- svx/source/sdr/contact/viewcontactofsdrole2obj.cxx | 10 ++-- svx/source/sdr/contact/viewcontactofsdrpathobj.cxx | 33 ++++++------- svx/source/sdr/contact/viewcontactofsdrrectobj.cxx | 28 +++-------- svx/source/sdr/overlay/overlaytools.cxx | 8 ++- .../sdr/primitive2d/sdrdecompositiontools.cxx | 33 ++++++------- .../sdr/primitive2d/sdrellipseprimitive2d.cxx | 10 ++-- .../sdr/primitive2d/sdrmeasureprimitive2d.cxx | 7 ++- .../sdr/primitive2d/sdrolecontentprimitive2d.cxx | 12 ++--- svx/source/svdraw/gradtrns.cxx | 25 ++-------- svx/source/svdraw/svddrgmt.cxx | 34 +++++-------- svx/source/svdraw/svdfmtf.cxx | 34 +++---------- svx/source/svdraw/svdoashp.cxx | 31 +++--------- svx/source/svdraw/svdobj.cxx | 24 +-------- svx/source/svdraw/svdocirc.cxx | 36 +++++--------- svx/source/svdraw/svdomeas.cxx | 13 +---- svx/source/svdraw/svdopath.cxx | 57 ++++++---------------- svx/source/svdraw/svdotext.cxx | 39 +++------------ svx/source/svdraw/svdotextdecomposition.cxx | 35 +++++-------- svx/source/svdraw/svdovirt.cxx | 5 +- svx/source/unodraw/unoshape.cxx | 11 ++--- 45 files changed, 351 insertions(+), 655 deletions(-) (limited to 'drawinglayer/inc/drawinglayer/primitive2d') diff --git a/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx index 6fdf3200543c..79518eb82358 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx @@ -44,23 +44,37 @@ namespace drawinglayer { namespace primitive2d { + /** AlphaPrimitive2D class + + This is the basic primitive for applying freely defined transparence + to freely defined content. The basic idea is to associate a content + which is defined as a sequence of primitives and hold as child content + in the GroupPrimitive2D with an alpha channel also defined as a sequence + of primitives and hold in the Alpha member. + + The basic definition is to use the Alpha content as Alpha-Mask by + interpreting the Alpha-content not as RGB, but as Luminance alpha mask + using the common RGB_to_luminance definition as e.g. used by VCL + */ class AlphaPrimitive2D : public GroupPrimitive2D { private: - Primitive2DSequence maAlpha; // transparence sequence + /// The Alpha-Mask who's RGB-Values are interpreted as Luminance + Primitive2DSequence maAlpha; public: + /// constructor AlphaPrimitive2D( const Primitive2DSequence& rChildren, const Primitive2DSequence& rAlpha); - // get data + /// data read access const Primitive2DSequence& getAlpha() const { return maAlpha; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx index 1fcde759ed68..e505594b2a76 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx @@ -38,6 +38,7 @@ #include #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines @@ -113,42 +114,6 @@ namespace drawinglayer } // end of namespace primitive2d } // end of namespace drawinglayer -////////////////////////////////////////////////////////////////////////////// -// helper class for AnimatedInterpolatePrimitive2D - -namespace drawinglayer -{ - namespace primitive2d - { - class BufferedMatrixDecompose - { - private: - // the matrix itself - basegfx::B2DHomMatrix maB2DHomMatrix; - - // the decomposition - basegfx::B2DVector maScale; - basegfx::B2DVector maTranslate; - double mfRotate; - double mfShearX; - - // flag if already decomposed, used by ensureDecompose() - bool mbDecomposed; - - public: - BufferedMatrixDecompose(const basegfx::B2DHomMatrix& rMatrix); - void ensureDecompose() const; - - // data access - const basegfx::B2DHomMatrix& getB2DHomMatrix() const { return maB2DHomMatrix; } - const basegfx::B2DVector& getScale() const { return maScale; } - const basegfx::B2DVector& getTranslate() const { return maTranslate; } - double getRotate() const { return mfRotate; } - double getShearX() const { return mfShearX; } - }; - } // end of anonymous namespace -} // end of namespace drawinglayer - ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -159,7 +124,7 @@ namespace drawinglayer { private: // the transformations - std::vector< BufferedMatrixDecompose > maMatrixStack; + std::vector< basegfx::tools::B2DHomMatrixBufferedDecompose > maMatrixStack; protected: // create local decomposition diff --git a/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx index d295c6ab4b89..f5de130febf9 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx @@ -47,28 +47,41 @@ namespace drawinglayer { namespace primitive2d { + /** BitmapPrimitive2D class + + This class is the central primitive for Bitmap-based primitives. + It provides RGBA-based bitmaps, currently using a BitmapEx from VCL. + This may change in the future to any other, maybe more general base + class providing 24bit RGBA. + */ class BitmapPrimitive2D : public BasePrimitive2D { private: + /// the RGBA Bitmap-data BitmapEx maBitmapEx; + + /** the object transformation from unit coordinates, defining + size, shear, rotate and position + */ basegfx::B2DHomMatrix maTransform; public: + /// constructor BitmapPrimitive2D( const BitmapEx& rBitmapEx, const basegfx::B2DHomMatrix& rTransform); - // get data + /// data read access const BitmapEx& getBitmapEx() const { return maBitmapEx; } const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index 516210a6a081..0a288cd2ac65 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -257,9 +257,10 @@ namespace drawinglayer { namespace primitive2d { - class PolyPolygonGradientPrimitive2D : public PolyPolygonColorPrimitive2D + class PolyPolygonGradientPrimitive2D : public BufferedDecompositionPrimitive2D { private: + basegfx::B2DPolyPolygon maPolyPolygon; attribute::FillGradientAttribute maFillGradient; protected: @@ -269,10 +270,10 @@ namespace drawinglayer public: PolyPolygonGradientPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, - const basegfx::BColor& rBColor, const attribute::FillGradientAttribute& rFillGradient); // get data + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; } // compare operator @@ -291,10 +292,12 @@ namespace drawinglayer { namespace primitive2d { - class PolyPolygonHatchPrimitive2D : public PolyPolygonColorPrimitive2D + class PolyPolygonHatchPrimitive2D : public BufferedDecompositionPrimitive2D { private: + basegfx::B2DPolyPolygon maPolyPolygon; attribute::FillHatchAttribute maFillHatch; + basegfx::BColor maBackgroundColor; protected: // local decomposition. @@ -303,10 +306,12 @@ namespace drawinglayer public: PolyPolygonHatchPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, - const basegfx::BColor& rBColor, + const basegfx::BColor& rBackgroundColor, const attribute::FillHatchAttribute& rFillHatch); // get data + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } + const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; } const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; } // compare operator @@ -325,9 +330,10 @@ namespace drawinglayer { namespace primitive2d { - class PolyPolygonBitmapPrimitive2D : public PolyPolygonColorPrimitive2D + class PolyPolygonBitmapPrimitive2D : public BufferedDecompositionPrimitive2D { private: + basegfx::B2DPolyPolygon maPolyPolygon; attribute::FillBitmapAttribute maFillBitmap; protected: @@ -337,10 +343,10 @@ namespace drawinglayer public: PolyPolygonBitmapPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, - const basegfx::BColor& rBColor, const attribute::FillBitmapAttribute& rFillBitmap); // get data + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } const attribute::FillBitmapAttribute& getFillBitmap() const { return maFillBitmap; } // compare operator diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx index 536b267f2fbd..fb72500fcb38 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx @@ -41,9 +41,9 @@ ////////////////////////////////////////////////////////////////////////////// // predeclarations -namespace basegfx { - class DecomposedB2DHomMatrixContainer; -} // end of namespace basegfx +namespace basegfx { namespace tools { + class B2DHomMatrixBufferedOnDemandDecompose; +}} namespace com { namespace sun { namespace star { namespace i18n { struct Boundary; @@ -125,7 +125,7 @@ namespace drawinglayer // helper methods void impCreateTextLine( std::vector< Primitive2DReference >& rTarget, - basegfx::DecomposedB2DHomMatrixContainer& rDecTrans, + basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans, const basegfx::B2DHomMatrix &rUnscaledTransform, FontUnderline eLineStyle, double fLineOffset, @@ -135,7 +135,7 @@ namespace drawinglayer void impCreateGeometryContent( std::vector< Primitive2DReference >& rTarget, - basegfx::DecomposedB2DHomMatrixContainer& rDecTrans, + basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans, const String& rText, xub_StrLen aTextPosition, xub_StrLen aTextLength, @@ -147,7 +147,7 @@ namespace drawinglayer void impSplitSingleWords( std::vector< Primitive2DReference >& rTarget, - basegfx::DecomposedB2DHomMatrixContainer& rDecTrans) const; + basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans) const; protected: // local decomposition. diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx index b99168d1cb1e..402fe45126cd 100644 --- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx @@ -143,35 +143,6 @@ namespace drawinglayer } // end of namespace primitive2d } // end of namespace drawinglayer -////////////////////////////////////////////////////////////////////////////// -// helper class for AnimatedInterpolatePrimitive2D - -namespace drawinglayer -{ - namespace primitive2d - { - BufferedMatrixDecompose::BufferedMatrixDecompose(const basegfx::B2DHomMatrix& rMatrix) - : maB2DHomMatrix(rMatrix), - maScale(0.0, 0.0), - maTranslate(0.0, 0.0), - mfRotate(0.0), - mfShearX(0.0), - mbDecomposed(false) - { - } - - void BufferedMatrixDecompose::ensureDecompose() const - { - if(!mbDecomposed) - { - BufferedMatrixDecompose* pThis = const_cast< BufferedMatrixDecompose* >(this); - maB2DHomMatrix.decompose(pThis->maScale, pThis->maTranslate, pThis->mfRotate, pThis->mfShearX); - pThis->mbDecomposed = true; - } - } - } // end of anonymous namespace -} // end of namespace drawinglayer - ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -199,21 +170,18 @@ namespace drawinglayer const sal_uInt32 nIndA(sal_uInt32(floor(fIndex))); const double fOffset(fIndex - (double)nIndA); basegfx::B2DHomMatrix aTargetTransform; + std::vector< basegfx::tools::B2DHomMatrixBufferedDecompose >::const_iterator aMatA(maMatrixStack.begin() + nIndA); if(basegfx::fTools::equalZero(fOffset)) { // use matrix from nIndA directly - aTargetTransform = maMatrixStack[nIndA].getB2DHomMatrix(); + aTargetTransform = aMatA->getB2DHomMatrix(); } else { - // interpolate. Get involved matrices and ensure they are decomposed + // interpolate. Get involved buffered decomposed matrices const sal_uInt32 nIndB((nIndA + 1L) % nSize); - std::vector< BufferedMatrixDecompose >::const_iterator aMatA(maMatrixStack.begin() + nIndA); - std::vector< BufferedMatrixDecompose >::const_iterator aMatB(maMatrixStack.begin() + nIndB); - - aMatA->ensureDecompose(); - aMatB->ensureDecompose(); + std::vector< basegfx::tools::B2DHomMatrixBufferedDecompose >::const_iterator aMatB(maMatrixStack.begin() + nIndB); // interpolate for fOffset [0.0 .. 1.0[ const basegfx::B2DVector aScale(basegfx::interpolate(aMatA->getScale(), aMatB->getScale(), fOffset)); @@ -222,10 +190,8 @@ namespace drawinglayer const double fShearX(((aMatB->getShearX() - aMatA->getShearX()) * fOffset) + aMatA->getShearX()); // build matrix for state - aTargetTransform.scale(aScale.getX(), aScale.getY()); - aTargetTransform.shearX(fShearX); - aTargetTransform.rotate(fRotate); - aTargetTransform.translate(aTranslate.getX(), aTranslate.getY()); + aTargetTransform = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, fShearX, fRotate, aTranslate); } // create new transform primitive reference, return new sequence @@ -246,12 +212,13 @@ namespace drawinglayer : AnimatedSwitchPrimitive2D(rAnimationEntry, rChildren, bIsTextAnimation), maMatrixStack() { - // copy matrices + // copy matrices to locally pre-decomposed matrix stack const sal_uInt32 nCount(rmMatrixStack.size()); + maMatrixStack.reserve(nCount); for(sal_uInt32 a(0L); a < nCount; a++) { - maMatrixStack.push_back(BufferedMatrixDecompose(rmMatrixStack[a])); + maMatrixStack.push_back(basegfx::tools::B2DHomMatrixBufferedDecompose(rmMatrixStack[a])); } } diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index d3ddf3c8657f..5d536fa8812f 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -54,6 +54,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -230,12 +231,8 @@ namespace drawinglayer } // short form for scale and translate transformation - basegfx::B2DHomMatrix aBitmapTransform; - - aBitmapTransform.set(0L, 0L, aBitmapSizeLogic.getX()); - aBitmapTransform.set(1L, 1L, aBitmapSizeLogic.getY()); - aBitmapTransform.set(0L, 2L, aTranslate.getX()); - aBitmapTransform.set(1L, 2L, aTranslate.getY()); + const basegfx::B2DHomMatrix aBitmapTransform(basegfx::tools::createScaleTranslateB2DHomMatrix( + aBitmapSizeLogic.getX(), aBitmapSizeLogic.getY(), aTranslate.getX(), aTranslate.getY())); // create primitive xRetval = new BitmapPrimitive2D(BitmapEx(aContent), aBitmapTransform); diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index b28bc2147187..9b2b305f069b 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -288,7 +288,9 @@ namespace drawinglayer getTransform().decompose(aScale, aTranslate, fRotate, fShearX); // create ranges. The current object range is just scale and translate - const basegfx::B2DRange aCurrent(aTranslate.getX(), aTranslate.getY(), aTranslate.getX() + aScale.getX(), aTranslate.getY() + aScale.getY()); + const basegfx::B2DRange aCurrent( + aTranslate.getX(), aTranslate.getY(), + aTranslate.getX() + aScale.getX(), aTranslate.getY() + aScale.getY()); // calculate scalings between real image size and logic object size. This // is necessary since the crop values are relative to original bitmap size @@ -338,11 +340,15 @@ namespace drawinglayer // build new object transformation for transform primitive which contains xPrimitive basegfx::B2DHomMatrix aNewObjectTransform(getTransform()); aNewObjectTransform.invert(); - aNewObjectTransform.scale(aCropped.getWidth(), aCropped.getHeight()); - aNewObjectTransform.translate(aCropped.getMinX() - aCurrent.getMinX(), aCropped.getMinY() - aCurrent.getMinY()); - aNewObjectTransform.shearX(fShearX); - aNewObjectTransform.rotate(fRotate); - aNewObjectTransform.translate(aTranslate.getX(), aTranslate.getY()); + aNewObjectTransform = basegfx::tools::createScaleTranslateB2DHomMatrix( + aCropped.getWidth(), aCropped.getHeight(), + aCropped.getMinX() - aCurrent.getMinX(), aCropped.getMinY() - aCurrent.getMinY()) + * aNewObjectTransform; + + // add shear, rotate and translate using combined matrix to speedup + const basegfx::B2DHomMatrix aCombinedMatrix(basegfx::tools::createShearXRotateTranslateB2DHomMatrix( + fShearX, fRotate, aTranslate.getX(), aTranslate.getY())); + aNewObjectTransform = aCombinedMatrix * aNewObjectTransform; // prepare TransformPrimitive2D with xPrimitive const Primitive2DReference xTransformPrimitive(new TransformPrimitive2D(aNewObjectTransform, Primitive2DSequence(&xPrimitive, 1L))); diff --git a/drawinglayer/source/primitive2d/gridprimitive2d.cxx b/drawinglayer/source/primitive2d/gridprimitive2d.cxx index a449fa396c68..d2bd4b9d5243 100644 --- a/drawinglayer/source/primitive2d/gridprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/gridprimitive2d.cxx @@ -42,6 +42,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -65,10 +66,8 @@ namespace drawinglayer getTransform().decompose(aScale, aTranslate, fRotate, fShearX); // create grid matrix which transforms from scaled logic to view - basegfx::B2DHomMatrix aRST; - aRST.shearX(fShearX); - aRST.rotate(fRotate); - aRST.translate(aTranslate.getX(), aTranslate.getY()); + basegfx::B2DHomMatrix aRST(basegfx::tools::createShearXRotateTranslateB2DHomMatrix( + fShearX, fRotate, aTranslate.getX(), aTranslate.getY())); aRST *= rViewInformation.getObjectToViewTransformation(); // get step widths diff --git a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx index ba879d9056c9..b747c79ee0c7 100644 --- a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx @@ -42,6 +42,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -112,9 +113,9 @@ namespace drawinglayer } // add the missing object transformation aspects - aPageTrans.shearX(fShearX); - aPageTrans.rotate(fRotate); - aPageTrans.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aCombined(basegfx::tools::createShearXRotateTranslateB2DHomMatrix( + fShearX, fRotate, aTranslate.getX(), aTranslate.getY())); + aPageTrans = aCombined * aPageTrans; } else { diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index 7c8688fed31f..55c334434c70 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -420,16 +420,16 @@ namespace drawinglayer PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, - const basegfx::BColor& rBColor, const attribute::FillGradientAttribute& rFillGradient) - : PolyPolygonColorPrimitive2D(rPolyPolygon, rBColor), + : BufferedDecompositionPrimitive2D(), + maPolyPolygon(rPolyPolygon), maFillGradient(rFillGradient) { } bool PolyPolygonGradientPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(PolyPolygonColorPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const PolyPolygonGradientPrimitive2D& rCompare = (PolyPolygonGradientPrimitive2D&)rPrimitive; @@ -455,7 +455,7 @@ namespace drawinglayer { // create SubSequence with FillHatchPrimitive2D const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); - FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBColor(), getFillHatch()); + FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBackgroundColor(), getFillHatch()); const Primitive2DReference xSubRef(pNewHatch); const Primitive2DSequence aSubSequence(&xSubRef, 1L); @@ -467,20 +467,23 @@ namespace drawinglayer PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, - const basegfx::BColor& rBColor, + const basegfx::BColor& rBackgroundColor, const attribute::FillHatchAttribute& rFillHatch) - : PolyPolygonColorPrimitive2D(rPolyPolygon, rBColor), + : BufferedDecompositionPrimitive2D(), + maPolyPolygon(rPolyPolygon), + maBackgroundColor(rBackgroundColor), maFillHatch(rFillHatch) { } bool PolyPolygonHatchPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(PolyPolygonColorPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const PolyPolygonHatchPrimitive2D& rCompare = (PolyPolygonHatchPrimitive2D&)rPrimitive; - return (getFillHatch() == rCompare.getFillHatch()); + return (getBackgroundColor() == rCompare.getBackgroundColor() + && getFillHatch() == rCompare.getFillHatch()); } return false; @@ -519,16 +522,16 @@ namespace drawinglayer PolyPolygonBitmapPrimitive2D::PolyPolygonBitmapPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, - const basegfx::BColor& rBColor, const attribute::FillBitmapAttribute& rFillBitmap) - : PolyPolygonColorPrimitive2D(rPolyPolygon, rBColor), + : BufferedDecompositionPrimitive2D(), + maPolyPolygon(rPolyPolygon), maFillBitmap(rFillBitmap) { } bool PolyPolygonBitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(PolyPolygonColorPrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const PolyPolygonBitmapPrimitive2D& rCompare = (PolyPolygonBitmapPrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index 787e221c406f..d06bac973a18 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -57,7 +57,7 @@ namespace drawinglayer { void TextDecoratedPortionPrimitive2D::impCreateTextLine( std::vector< Primitive2DReference >& rTarget, - basegfx::DecomposedB2DHomMatrixContainer& rDecTrans, + basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans, const basegfx::B2DHomMatrix &rUnscaledTransform, FontUnderline eLineStyle, double fLineOffset, @@ -248,10 +248,9 @@ namespace drawinglayer fLineDist = 6.3 * fLineHeight; } - basegfx::B2DHomMatrix aTransform; - // move base point of text to 0.0 and de-rotate - aTransform.translate(-rDecTrans.getTranslate().getX(), -rDecTrans.getTranslate().getY()); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( + -rDecTrans.getTranslate().getX(), -rDecTrans.getTranslate().getY())); aTransform.rotate(-rDecTrans.getRotate()); // translate in Y by offset @@ -269,7 +268,7 @@ namespace drawinglayer void TextDecoratedPortionPrimitive2D::impCreateGeometryContent( std::vector< Primitive2DReference >& rTarget, - basegfx::DecomposedB2DHomMatrixContainer& rDecTrans, + basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans, const String& rText, xub_StrLen aTextPosition, xub_StrLen aTextLength, @@ -295,13 +294,11 @@ namespace drawinglayer if(bUnderlineUsed || bStrikeoutUsed || bOverlineUsed) { // common preparations - basegfx::B2DHomMatrix aUnscaledTransform; TextLayouterDevice aTextLayouter; // unscaled is needed since scale contains already the font size - aUnscaledTransform.shearX(rDecTrans.getShearX()); - aUnscaledTransform.rotate(rDecTrans.getRotate()); - aUnscaledTransform.translate(rDecTrans.getTranslate().getX(), rDecTrans.getTranslate().getY()); + const basegfx::B2DHomMatrix aUnscaledTransform(basegfx::tools::createShearXRotateTranslateB2DHomMatrix( + rDecTrans.getShearX(), rDecTrans.getRotate(), rDecTrans.getTranslate())); // TextLayouterDevice is needed to get metrics for text decorations like // underline/strikeout/emphasis marks from it. For setup, the font size is needed @@ -416,10 +413,10 @@ namespace drawinglayer // double line, create 2nd primitive with offset using TransformPrimitive based on // already created NewPrimitive const double fLineDist(2.0 * fStrikeoutHeight); - basegfx::B2DHomMatrix aTransform; // move base point of text to 0.0 and de-rotate - aTransform.translate(-rDecTrans.getTranslate().getX(), -rDecTrans.getTranslate().getY()); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( + -rDecTrans.getTranslate().getX(), -rDecTrans.getTranslate().getY())); aTransform.rotate(-rDecTrans.getRotate()); // translate in Y by offset @@ -469,7 +466,7 @@ namespace drawinglayer void TextDecoratedPortionPrimitive2D::impSplitSingleWords( std::vector< Primitive2DReference >& rTarget, - basegfx::DecomposedB2DHomMatrixContainer& rDecTrans) const + basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans) const { // break iterator support // made static so it only needs to be fetched once, even with many single @@ -586,7 +583,7 @@ namespace drawinglayer // create geometry content for the single word. Do not forget // to use the new transformation - basegfx::DecomposedB2DHomMatrixContainer aDecTrans(aNewTransform); + basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose aDecTrans(aNewTransform); impCreateGeometryContent(rTarget, aDecTrans, getText(), nNewTextStart, nNewTextEnd - nNewTextStart, aNewDXArray, aNewFontAttributes); @@ -605,7 +602,7 @@ namespace drawinglayer Primitive2DSequence TextDecoratedPortionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { std::vector< Primitive2DReference > aNewPrimitives; - basegfx::DecomposedB2DHomMatrixContainer aDecTrans(getTextTransform()); + basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose aDecTrans(getTextTransform()); Primitive2DSequence aRetval; // create basic geometry such as SimpleTextPrimitive, Overline, Underline, @@ -669,8 +666,8 @@ namespace drawinglayer static basegfx::BColor aShadowColor(0.3, 0.3, 0.3); // preapare shadow transform matrix - basegfx::B2DHomMatrix aShadowTransform; - aShadowTransform.translate(fTextShadowOffset, fTextShadowOffset); + const basegfx::B2DHomMatrix aShadowTransform(basegfx::tools::createTranslateB2DHomMatrix( + fTextShadowOffset, fTextShadowOffset)); // create shadow primitive aShadow = Primitive2DReference(new ShadowPrimitive2D( diff --git a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx index a2bbdb90889a..5e98a9d6d34b 100644 --- a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx @@ -41,6 +41,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -68,13 +69,12 @@ namespace drawinglayer case TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED_DEFAULT: { // prepare transform of sub-group back to (0,0) and align to X-Axis - basegfx::B2DHomMatrix aBackTransform; - aBackTransform.translate(-getRotationCenter().getX(), -getRotationCenter().getY()); + basegfx::B2DHomMatrix aBackTransform(basegfx::tools::createTranslateB2DHomMatrix( + -getRotationCenter().getX(), -getRotationCenter().getY())); aBackTransform.rotate(-getDirection()); // prepare transform of sub-group back to it's position and rotation - basegfx::B2DHomMatrix aForwardTransform; - aForwardTransform.rotate(getDirection()); + basegfx::B2DHomMatrix aForwardTransform(basegfx::tools::createRotateB2DHomMatrix(getDirection())); aForwardTransform.translate(getRotationCenter().getX(), getRotationCenter().getY()); // create transformation for one discrete unit diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index 819f94759ae0..c60aadd63ac0 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -42,6 +42,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -171,11 +172,8 @@ namespace drawinglayer if(nCount) { // prepare object transformation for polygons - rTransformation.identity(); - rTransformation.scale(aScale.getX(), aScale.getY()); - rTransformation.shearX(fShearX); - rTransformation.rotate(fRotate); - rTransformation.translate(aTranslate.getX(), aTranslate.getY()); + rTransformation = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, fShearX, fRotate, aTranslate); } } } @@ -324,12 +322,8 @@ namespace drawinglayer } #endif // prepare object transformation for range - basegfx::B2DHomMatrix aRangeTransformation; - - aRangeTransformation.scale(aScale.getX(), aScale.getY()); - aRangeTransformation.shearX(fShearX); - aRangeTransformation.rotate(fRotate); - aRangeTransformation.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aRangeTransformation(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, fShearX, fRotate, aTranslate)); // apply range transformation to it aNewRange.transform(aRangeTransformation); diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx index 9285102cbb80..20d07add629c 100644 --- a/drawinglayer/source/processor2d/canvasprocessor.cxx +++ b/drawinglayer/source/processor2d/canvasprocessor.cxx @@ -76,6 +76,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -1341,10 +1342,9 @@ namespace drawinglayer // prepare discrete offset for XBitmap, do not forget that the buffer bitmap // may be truncated to discrete visible pixels - basegfx::B2DHomMatrix aDiscreteOffset; - aDiscreteOffset.translate( + const basegfx::B2DHomMatrix aDiscreteOffset(basegfx::tools::createTranslateB2DHomMatrix( aDiscreteRange.getMinX() > 0.0 ? -aDiscreteRange.getMinX() : 0.0, - aDiscreteRange.getMinY() > 0.0 ? -aDiscreteRange.getMinY() : 0.0); + aDiscreteRange.getMinY() > 0.0 ? -aDiscreteRange.getMinY() : 0.0)); // create new local ViewInformation2D with new transformation const geometry::ViewInformation2D aViewInformation2D( @@ -1600,16 +1600,14 @@ namespace drawinglayer // adapt object's transformation to the correct scale basegfx::B2DVector aScale, aTranslate; double fRotate, fShearX; - basegfx::B2DHomMatrix aNewMatrix; const Size aSizePixel(aModifiedBitmapEx.GetSizePixel()); if(0 != aSizePixel.Width() && 0 != aSizePixel.Height()) { rBitmapCandidate.getTransform().decompose(aScale, aTranslate, fRotate, fShearX); - aNewMatrix.scale(aScale.getX() / aSizePixel.Width(), aScale.getY() / aSizePixel.Height()); - aNewMatrix.shearX(fShearX); - aNewMatrix.rotate(fRotate); - aNewMatrix.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aNewMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aScale.getX() / aSizePixel.Width(), aScale.getY() / aSizePixel.Height(), + fShearX, fRotate, aTranslate.getX(), aTranslate.getY())); canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation() * aNewMatrix); @@ -1658,10 +1656,9 @@ namespace drawinglayer // prepare discrete offset for XBitmap, do not forget that the buffer bitmap // may be truncated to discrete visible pixels - basegfx::B2DHomMatrix aDiscreteOffset; - aDiscreteOffset.translate( + const basegfx::B2DHomMatrix aDiscreteOffset(basegfx::tools::createTranslateB2DHomMatrix( aDiscreteRange.getMinX() > 0.0 ? -aDiscreteRange.getMinX() : 0.0, - aDiscreteRange.getMinY() > 0.0 ? -aDiscreteRange.getMinY() : 0.0); + aDiscreteRange.getMinY() > 0.0 ? -aDiscreteRange.getMinY() : 0.0)); // create new local ViewInformation2D with new transformation const geometry::ViewInformation2D aViewInformation2D( @@ -1821,13 +1818,9 @@ namespace drawinglayer { // create texture matrix from texture to object (where object is unit square here), // so use values directly - basegfx::B2DHomMatrix aTextureMatrix; - aTextureMatrix.scale( - rFillBitmapAttribute.getSize().getX(), - rFillBitmapAttribute.getSize().getY()); - aTextureMatrix.translate( - rFillBitmapAttribute.getTopLeft().getX(), - rFillBitmapAttribute.getTopLeft().getY()); + const basegfx::B2DHomMatrix aTextureMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix( + rFillBitmapAttribute.getSize().getX(), rFillBitmapAttribute.getSize().getY(), + rFillBitmapAttribute.getTopLeft().getX(), rFillBitmapAttribute.getTopLeft().getY())); // create and fill texture rendering::Texture aTexture; diff --git a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx index 1488cd4fd054..216139653692 100644 --- a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx +++ b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx @@ -43,6 +43,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // support for different kinds of bitmap rendering using vcl @@ -84,10 +85,9 @@ namespace drawinglayer else { // if rotated, create the unrotated output rectangle for the GraphicManager paint - basegfx::B2DHomMatrix aSimpleObjectMatrix; - - aSimpleObjectMatrix.scale(fabs(aScale.getX()), fabs(aScale.getY())); - aSimpleObjectMatrix.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aSimpleObjectMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix( + fabs(aScale.getX()), fabs(aScale.getY()), + aTranslate.getX(), aTranslate.getY())); aOutlineRange.transform(aSimpleObjectMatrix); } @@ -190,11 +190,11 @@ namespace drawinglayer } // build transform from pixel in aDestination to pixel in rBitmapEx - basegfx::B2DHomMatrix aTransform; - // from relative in aCroppedRectPixel to relative in aDestRectPixel // No need to take bNeedToReduce into account, TopLeft is unchanged - aTransform.translate(aCroppedRectPixel.Left() - aDestRectPixel.Left(), aCroppedRectPixel.Top() - aDestRectPixel.Top()); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( + aCroppedRectPixel.Left() - aDestRectPixel.Left(), + aCroppedRectPixel.Top() - aDestRectPixel.Top())); // from relative in aDestRectPixel to absolute Logic. Here it // is essential to adapt to reduce factor (if used) @@ -207,8 +207,10 @@ namespace drawinglayer fAdaptedDRPHeight *= fReduceFactor; } - aTransform.scale(aDestRectLogic.getWidth() / fAdaptedDRPWidth, aDestRectLogic.getHeight() / fAdaptedDRPHeight); - aTransform.translate(aDestRectLogic.Left(), aDestRectLogic.Top()); + aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix( + aDestRectLogic.getWidth() / fAdaptedDRPWidth, aDestRectLogic.getHeight() / fAdaptedDRPHeight, + aDestRectLogic.Left(), aDestRectLogic.Top()) + * aTransform; // from absolute in Logic to unified object coordinates (0.0 .. 1.0 in x and y) basegfx::B2DHomMatrix aInvBitmapTransform(rTransform); diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 549e44ece967..540c28d685d4 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -67,6 +67,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -204,18 +205,8 @@ namespace drawinglayer } case PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D : { - if(getOptionsDrawinglayer().IsAntiAliasing()) - { - // For AA, direct render has to be avoided since it uses XOR maskings which will not - // work with AA. Instead, the decompose which uses MaskPrimitive2D with fillings is - // used - process(rCandidate.get2DDecomposition(getViewInformation2D())); - } - else - { - // direct draw of gradient - RenderPolyPolygonGradientPrimitive2D(static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate)); - } + // direct draw of gradient + RenderPolyPolygonGradientPrimitive2D(static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate)); break; } case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D : @@ -522,7 +513,6 @@ namespace drawinglayer // restore AA setting mpOutputDevice->SetAntialiasing(nOriginalAA); - break; } case PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D : diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index adc33c4d676d..fc57e5299662 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -596,21 +596,32 @@ namespace drawinglayer basegfx::BColor aStartColor(maBColorModifierStack.getModifiedColor(rGradient.getStartColor())); basegfx::BColor aEndColor(maBColorModifierStack.getModifiedColor(rGradient.getEndColor())); basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon()); - aLocalPolyPolygon.transform(maCurrentTransformation); - if(aStartColor == aEndColor) - { - // no gradient at all, draw as polygon - mpOutputDevice->SetLineColor(); - mpOutputDevice->SetFillColor(Color(aStartColor)); - mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); - } - else + if(aLocalPolyPolygon.count()) { - impDrawGradientToOutDev( - *mpOutputDevice, aLocalPolyPolygon, rGradient.getStyle(), rGradient.getSteps(), - aStartColor, aEndColor, rGradient.getBorder(), - -rGradient.getAngle(), rGradient.getOffsetX(), rGradient.getOffsetY(), false); + aLocalPolyPolygon.transform(maCurrentTransformation); + + if(aStartColor == aEndColor) + { + // no gradient at all, draw as polygon in AA and non-AA case + mpOutputDevice->SetLineColor(); + mpOutputDevice->SetFillColor(Color(aStartColor)); + mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); + } + else if(getOptionsDrawinglayer().IsAntiAliasing()) + { + // For AA, direct render has to be avoided since it uses XOR maskings which will not + // work with AA. Instead, the decompose which uses MaskPrimitive2D with fillings is + // used + process(rPolygonCandidate.get2DDecomposition(getViewInformation2D())); + } + else + { + impDrawGradientToOutDev( + *mpOutputDevice, aLocalPolyPolygon, rGradient.getStyle(), rGradient.getSteps(), + aStartColor, aEndColor, rGradient.getBorder(), + -rGradient.getAngle(), rGradient.getOffsetX(), rGradient.getOffsetY(), false); + } } } diff --git a/drawinglayer/source/texture/texture.cxx b/drawinglayer/source/texture/texture.cxx index 4f784c71897f..1cc6730da33c 100644 --- a/drawinglayer/source/texture/texture.cxx +++ b/drawinglayer/source/texture/texture.cxx @@ -39,6 +39,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -596,9 +597,8 @@ namespace drawinglayer basegfx::B2DPoint aCenter(0.5, 0.5); aCenter *= maTextureTransform; - maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); - maTextureTransform.rotate(fAngle); - maTextureTransform.translate(aCenter.getX(), aCenter.getY()); + maTextureTransform = basegfx::tools::createRotateAroundPoint(aCenter, fAngle) + * maTextureTransform; } // add object translate diff --git a/svx/source/cui/tplneend.cxx b/svx/source/cui/tplneend.cxx index c83a88956273..c55914e125a4 100644 --- a/svx/source/cui/tplneend.cxx +++ b/svx/source/cui/tplneend.cxx @@ -51,9 +51,6 @@ #include "tabline.hrc" #include "helpid.hrc" - - - #include #include #include "drawitem.hxx" @@ -69,6 +66,7 @@ #include #include #include +#include #define DLGWIN this->GetParent()->GetParent() @@ -465,9 +463,8 @@ IMPL_LINK( SvxLineEndDefTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) basegfx::B2DRange aNewRange(basegfx::tools::getRange(aNewPolyPolygon)); // Normalisieren - basegfx::B2DHomMatrix aMatrix; - aMatrix.translate(-aNewRange.getMinX(), -aNewRange.getMinY()); - aNewPolyPolygon.transform(aMatrix); + aNewPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix( + -aNewRange.getMinX(), -aNewRange.getMinY())); // Loeschen des angelegten PolyObjektes SdrObject::Free( pConvPolyObj ); diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 06d4cf5bbe95..3f89d202b6ba 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -77,6 +77,7 @@ #include #include #include +#include #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue() @@ -185,9 +186,8 @@ void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirr // buld transfoprmation: translate and rotate so that given edge is // on x axis, them mirror in y and translate back const basegfx::B2DVector aEdge(aMirrorAxisB.X() - aMirrorAxisA.X(), aMirrorAxisB.Y() - aMirrorAxisA.Y()); - basegfx::B2DHomMatrix aMatrixTransform; - - aMatrixTransform.translate(-aMirrorAxisA.X(), -aMirrorAxisA.Y()); + basegfx::B2DHomMatrix aMatrixTransform(basegfx::tools::createTranslateB2DHomMatrix( + -aMirrorAxisA.X(), -aMirrorAxisA.Y())); aMatrixTransform.rotate(-atan2(aEdge.getY(), aEdge.getX())); aMatrixTransform.scale(1.0, -1.0); aMatrixTransform.rotate(atan2(aEdge.getY(), aEdge.getX())); @@ -932,9 +932,8 @@ void E3dView::ConvertMarkedObjTo3D(BOOL bExtrude, basegfx::B2DPoint aPnt1, baseg if(fRot3D != 0.0) { - aLatheMat.translate(-aPnt2.getX(), -aPnt2.getY()); - aLatheMat.rotate(-fRot3D); - aLatheMat.translate(aPnt2.getX(), aPnt2.getY()); + aLatheMat = basegfx::tools::createRotateAroundPoint(aPnt2, -fRot3D) + * aLatheMat; } } diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index b083a1014299..0733c85e1135 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -52,18 +52,16 @@ #include "svdstr.hrc" #include #include - #include #include #include #include #include #include - #include #include #include -//#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -148,11 +146,9 @@ namespace sdr { // create the EmptyPresObj fallback visualisation. The fallback graphic // is already provided in rGraphicObject in this case, use it - aSmallerMatrix.scale(aPrefSize.getWidth(), aPrefSize.getHeight()); - aSmallerMatrix.translate(fOffsetX, fOffsetY); - aSmallerMatrix.shearX(fShearX); - aSmallerMatrix.rotate(fRotate); - aSmallerMatrix.translate(aTranslate.getX(), aTranslate.getY()); + aSmallerMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix(aPrefSize.getWidth(), aPrefSize.getHeight(), fOffsetX, fOffsetY); + aSmallerMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate) + * aSmallerMatrix; const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); const drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0); @@ -241,12 +237,8 @@ namespace sdr && basegfx::fTools::lessOrEqual(fWidth, aScale.getX()) && basegfx::fTools::lessOrEqual(fHeight, aScale.getY())) { - basegfx::B2DHomMatrix aBitmapMatrix; - - aBitmapMatrix.scale(fWidth, fHeight); - aBitmapMatrix.shearX(fShearX); - aBitmapMatrix.rotate(fRotate); - aBitmapMatrix.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aBitmapMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + fWidth, fHeight, fShearX, fRotate, aTranslate.getX(), aTranslate.getY())); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, drawinglayer::primitive2d::Primitive2DReference( @@ -293,12 +285,8 @@ namespace sdr if(pSdrText && pOPO) { // directly use the remaining space as TextRangeTransform - basegfx::B2DHomMatrix aTextRangeTransform; - - aTextRangeTransform.scale(aScale.getX(), aScale.getY()); - aTextRangeTransform.shearX(fShearX); - aTextRangeTransform.rotate(fRotate); - aTextRangeTransform.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aTextRangeTransform(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, fShearX, fRotate, aTranslate)); // directly create temp SdrBlockTextPrimitive2D drawinglayer::primitive2d::SdrBlockTextPrimitive2D aBlockTextPrimitive( @@ -376,7 +364,6 @@ namespace sdr // which will use the primitive data we just create in the near future const Rectangle& rRectangle = GetGrafObject().GetGeoRect(); const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - basegfx::B2DHomMatrix aObjectMatrix; // look for mirroring const GeoStat& rGeoStat(GetGrafObject().GetGeoStat()); @@ -407,10 +394,10 @@ namespace sdr // fill object matrix const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0); - aObjectMatrix.scale(aObjectRange.getWidth(), aObjectRange.getHeight()); - aObjectMatrix.shearX(fShearX); - aObjectMatrix.rotate(fRotate); - aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); // get the current, unchenged graphic obect from SdrGrafObj const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx index e8aace40eac5..edf5295461da 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx @@ -37,6 +37,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // includes for special text box shadow (SC) @@ -83,30 +84,13 @@ namespace sdr const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); const GeoStat& rGeoStat(rCaptionObj.GetGeoStat()); - ::basegfx::B2DHomMatrix aObjectMatrix; // fill object matrix - if(!::basegfx::fTools::equalZero(aObjectRange.getWidth())) - { - aObjectMatrix.set(0, 0, aObjectRange.getWidth()); - } - - if(!::basegfx::fTools::equalZero(aObjectRange.getHeight())) - { - aObjectMatrix.set(1, 1, aObjectRange.getHeight()); - } - - if(rGeoStat.nShearWink) - { - aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); + basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); // calculate corner radius double fCornerRadiusX; diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx index 1366ed26ca1a..24f1625065c9 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx @@ -39,6 +39,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -73,30 +74,13 @@ namespace sdr const Rectangle& rRectangle = GetCircObj().GetGeoRect(); const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); const GeoStat& rGeoStat(GetCircObj().GetGeoStat()); - ::basegfx::B2DHomMatrix aObjectMatrix; // fill object matrix - if(!::basegfx::fTools::equalZero(aObjectRange.getWidth())) - { - aObjectMatrix.set(0, 0, aObjectRange.getWidth()); - } - - if(!::basegfx::fTools::equalZero(aObjectRange.getHeight())) - { - aObjectMatrix.set(1, 1, aObjectRange.getHeight()); - } - - if(rGeoStat.nShearWink) - { - aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); // create primitive data const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier()); diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 0f4716e2d513..4850b91ca2a1 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -39,6 +39,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -82,18 +83,11 @@ namespace sdr basegfx::B2DHomMatrix aRotMatrix; aRotMatrix.translate(-aObjectRange.getMinimum().getX(), -aObjectRange.getMinimum().getY()); - - if(rGeoStat.nShearWink) - { - aRotMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aRotMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - aRotMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY()); + aRotMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix( + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY()) + * aRotMatrix; aRotObjectRange.transform(aRotMatrix); // add negative translation part diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index 3c239b12113c..c3c08a7a0dc1 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -46,6 +46,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -88,12 +89,9 @@ namespace sdr const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat()); const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); - basegfx::B2DHomMatrix aObjectMatrix; - - aObjectMatrix.scale(aObjectRange.getWidth(), aObjectRange.getHeight()); - aObjectMatrix.shearX(fShearX); - aObjectMatrix.rotate(fRotate); - aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); // Prepare attribute settings, will be used soon anyways const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet(); diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx index 0f818ff40f7a..3c8449bae7f6 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx @@ -38,6 +38,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -98,9 +99,11 @@ namespace sdr aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon); // #i102548# fill objectMatrix with rotation and offset (no shear for lines) - aObjectMatrix.scale(aLine.getLength(), 1.0); - aObjectMatrix.rotate(atan2(aLine.getY(), aLine.getX())); - aObjectMatrix.translate(aStart.getX(), aStart.getY()); + aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aLine.getLength(), 1.0, + 0.0, + atan2(aLine.getY(), aLine.getX()), + aStart.getX(), aStart.getY()); } else { @@ -110,22 +113,14 @@ namespace sdr const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); const double fWidth(aObjectRange.getWidth()); const double fHeight(aObjectRange.getHeight()); - - aObjectMatrix.scale( - basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth, - basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight); - - if(rGeoStat.nShearWink) - { - aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); + const double fScaleX(basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth); + const double fScaleY(basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight); + + aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + fScaleX, fScaleY, + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY()); // ceate unit polygon from object's absolute path basegfx::B2DHomMatrix aInverse(aObjectMatrix); diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index 8ba8ae8ab4c9..fa2717052368 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -39,6 +39,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -73,30 +74,13 @@ namespace sdr const Rectangle& rRectangle = GetRectObj().GetGeoRect(); const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); - ::basegfx::B2DHomMatrix aObjectMatrix; // fill object matrix - if(!::basegfx::fTools::equalZero(aObjectRange.getWidth())) - { - aObjectMatrix.set(0, 0, aObjectRange.getWidth()); - } - - if(!::basegfx::fTools::equalZero(aObjectRange.getHeight())) - { - aObjectMatrix.set(1, 1, aObjectRange.getHeight()); - } - - if(rGeoStat.nShearWink) - { - aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY()); + basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); // calculate corner radius sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue()); diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx index 6755d09fb34b..22b273a2a0e4 100644 --- a/svx/source/sdr/overlay/overlaytools.cxx +++ b/svx/source/sdr/overlay/overlaytools.cxx @@ -40,6 +40,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -230,11 +231,8 @@ namespace drawinglayer if(!basegfx::fTools::equalZero(getRotation())) { - basegfx::B2DHomMatrix aTransform; - - aTransform.translate(-getObjectRange().getMinX(), -getObjectRange().getMinY()); - aTransform.rotate(getRotation()); - aTransform.translate(getObjectRange().getMinX(), getObjectRange().getMinY()); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createRotateAroundPoint( + getObjectRange().getMinX(), getObjectRange().getMinY(), getRotation())); aHatchPolyPolygon.transform(aTransform); } diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 3fbcc15dd473..1edf702f083e 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -79,7 +79,7 @@ namespace drawinglayer if(rFill.isGradient()) { - pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, rFill.getColor(), *rFill.getGradient()); + pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, *rFill.getGradient()); } else if(rFill.isHatch()) { @@ -88,7 +88,7 @@ namespace drawinglayer else if(rFill.isBitmap()) { const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon)); - pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getColor(), rFill.getBitmap()->getFillBitmapAttribute(aRange)); + pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap()->getFillBitmapAttribute(aRange)); } else { @@ -191,19 +191,17 @@ namespace drawinglayer // scale outline to object's size to allow growing with value relative to that size // and also to keep aspect ratio - basegfx::B2DHomMatrix aScaleTransform; - aScaleTransform.set(0, 0, fabs(aScale.getX())); - aScaleTransform.set(1, 1, fabs(aScale.getY())); basegfx::B2DPolyPolygon aScaledUnitPolyPolygon(rUnitPolyPolygon); - aScaledUnitPolyPolygon.transform(aScaleTransform); + aScaledUnitPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix( + fabs(aScale.getX()), fabs(aScale.getY()))); // grow the polygon. To shrink, use negative value (half width) aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(pStroke->getWidth() * 0.5)); // scale back to unit polygon - aScaleTransform.set(0, 0, 0.0 != aScale.getX() ? 1.0 / aScale.getX() : 1.0); - aScaleTransform.set(1, 1, 0.0 != aScale.getY() ? 1.0 / aScale.getY() : 1.0); - aScaledUnitPolyPolygon.transform(aScaleTransform); + aScaledUnitPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix( + 0.0 != aScale.getX() ? 1.0 / aScale.getX() : 1.0, + 0.0 != aScale.getY() ? 1.0 / aScale.getY() : 1.0)); // create with unit polygon pNew = new SdrContourTextPrimitive2D( @@ -264,17 +262,16 @@ namespace drawinglayer aTextAnchorRange.expand(aBottomRight); // now create a transformation from this basic range (aTextAnchorRange) - aAnchorTransform.identity(); - aAnchorTransform.scale(aTextAnchorRange.getWidth(), aTextAnchorRange.getHeight()); - aAnchorTransform.translate(aTextAnchorRange.getMinX(), aTextAnchorRange.getMinY()); + aAnchorTransform = basegfx::tools::createScaleTranslateB2DHomMatrix( + aTextAnchorRange.getWidth(), aTextAnchorRange.getHeight(), + aTextAnchorRange.getMinX(), aTextAnchorRange.getMinY()); // apply mirroring aAnchorTransform.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0); // apply object's other transforms - aAnchorTransform.shearX(fShearX); - aAnchorTransform.rotate(fRotate); - aAnchorTransform.translate(aTranslate.getX(), aTranslate.getY()); + aAnchorTransform = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate) + * aAnchorTransform; if(rText.isFitToSize()) { @@ -336,10 +333,8 @@ namespace drawinglayer aAnchorTransform.decompose(aScale, aTranslate, fRotate, fShearX); // build transform from scaled only to full AnchorTransform and inverse - basegfx::B2DHomMatrix aSRT; - aSRT.shearX(fShearX); - aSRT.rotate(fRotate); - aSRT.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aSRT(basegfx::tools::createShearXRotateTranslateB2DHomMatrix( + fShearX, fRotate, aTranslate)); basegfx::B2DHomMatrix aISRT(aSRT); aISRT.invert(); diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx index 1c2cc70842d2..5cc259d3092c 100644 --- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx @@ -39,6 +39,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -61,11 +62,7 @@ namespace drawinglayer ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitCircle(1)); // scale and move UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1) - ::basegfx::B2DHomMatrix aUnitCorrectionMatrix; - aUnitCorrectionMatrix.set(0, 0, 0.5); - aUnitCorrectionMatrix.set(1, 1, 0.5); - aUnitCorrectionMatrix.set(0, 2, 0.5); - aUnitCorrectionMatrix.set(1, 2, 0.5); + const basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); // apply to the geometry aUnitOutline.transform(aUnitCorrectionMatrix); @@ -146,7 +143,6 @@ namespace drawinglayer // create unit outline polygon ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle)); - ::basegfx::B2DHomMatrix aUnitCorrectionMatrix; if(mbCloseSegment) { @@ -161,7 +157,7 @@ namespace drawinglayer } // move and scale UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1) - aUnitCorrectionMatrix.translate(1.0, 1.0); + basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createTranslateB2DHomMatrix(1.0, 1.0)); aUnitCorrectionMatrix.scale(0.5, 0.5); // apply to the geometry diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 4623182ace23..bbb08654baa2 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -40,6 +40,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -95,10 +96,8 @@ namespace drawinglayer const double fAngle(atan2(aLine.getY(), aLine.getX())); bool bAutoUpsideDown(false); const attribute::SdrTextAttribute* pTextAttribute = getSdrLSTAttribute().getText(); - - basegfx::B2DHomMatrix aObjectMatrix; - aObjectMatrix.rotate(fAngle); - aObjectMatrix.translate(getStart().getX(), getStart().getY()); + const basegfx::B2DHomMatrix aObjectMatrix( + basegfx::tools::createShearXRotateTranslateB2DHomMatrix(0.0, fAngle, getStart())); if(pTextAttribute) { diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index 57e685313586..97d309f0f0e7 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -39,6 +39,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -105,13 +106,10 @@ namespace drawinglayer if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0)) { // if content fits into frame, create it - basegfx::B2DHomMatrix aInnerObjectMatrix; - - aInnerObjectMatrix.scale(aPrefSize.getWidth(), aPrefSize.getHeight()); - aInnerObjectMatrix.translate(fOffsetX, fOffsetY); - aInnerObjectMatrix.shearX(fShearX); - aInnerObjectMatrix.rotate(fRotate); - aInnerObjectMatrix.translate(aTranslate.getX(), aTranslate.getY()); + basegfx::B2DHomMatrix aInnerObjectMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix( + aPrefSize.getWidth(), aPrefSize.getHeight(), fOffsetX, fOffsetY)); + aInnerObjectMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate) + * aInnerObjectMatrix; const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive( new drawinglayer::primitive2d::GraphicPrimitive2D( diff --git a/svx/source/svdraw/gradtrns.cxx b/svx/source/svdraw/gradtrns.cxx index 0e62aa9ed75f..5f607cd20bb6 100644 --- a/svx/source/svdraw/gradtrns.cxx +++ b/svx/source/svdraw/gradtrns.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include // FRound ////////////////////////////////////////////////////////////////////////////// @@ -81,11 +82,7 @@ void GradTransformer::GradToVec(GradTransGradient& rG, GradTransVector& rV, cons if(rG.aGradient.GetAngle()) { const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0); - basegfx::B2DHomMatrix aTransformation; - - aTransformation.translate(-aCenter.getX(), -aCenter.getY()); - aTransformation.rotate(-fAngle); - aTransformation.translate(aCenter.getX(), aCenter.getY()); + const basegfx::B2DHomMatrix aTransformation(basegfx::tools::createRotateAroundPoint(aCenter, -fAngle)); aStartPos *= aTransformation; aEndPos *= aTransformation; @@ -108,11 +105,7 @@ void GradTransformer::GradToVec(GradTransGradient& rG, GradTransVector& rV, cons if(rG.aGradient.GetAngle()) { const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0); - basegfx::B2DHomMatrix aTransformation; - - aTransformation.translate(-aCenter.getX(), -aCenter.getY()); - aTransformation.rotate(-fAngle); - aTransformation.translate(aCenter.getX(), aCenter.getY()); + const basegfx::B2DHomMatrix aTransformation(basegfx::tools::createRotateAroundPoint(aCenter, -fAngle)); aStartPos *= aTransformation; aEndPos *= aTransformation; @@ -136,11 +129,7 @@ void GradTransformer::GradToVec(GradTransGradient& rG, GradTransVector& rV, cons if(rG.aGradient.GetAngle()) { const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0); - basegfx::B2DHomMatrix aTransformation; - - aTransformation.translate(-aEndPos.getX(), -aEndPos.getY()); - aTransformation.rotate(-fAngle); - aTransformation.translate(aEndPos.getX(), aEndPos.getY()); + const basegfx::B2DHomMatrix aTransformation(basegfx::tools::createRotateAroundPoint(aEndPos, -fAngle)); aStartPos *= aTransformation; aEndPos *= aTransformation; @@ -175,11 +164,7 @@ void GradTransformer::GradToVec(GradTransGradient& rG, GradTransVector& rV, cons if(rG.aGradient.GetAngle()) { const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0); - basegfx::B2DHomMatrix aTransformation; - - aTransformation.translate(-aEndPos.getX(), -aEndPos.getY()); - aTransformation.rotate(-fAngle); - aTransformation.translate(aEndPos.getX(), aEndPos.getY()); + const basegfx::B2DHomMatrix aTransformation(basegfx::tools::createRotateAroundPoint(aEndPos, -fAngle)); aStartPos *= aTransformation; aEndPos *= aTransformation; diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index e427e42d80ab..254e5daa741f 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -84,6 +84,7 @@ #include #include #include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -575,9 +576,8 @@ void SdrDragMethod::applyCurrentTransformationToSdrObject(SdrObject& rTarget) const double fScaleY(fabs(aScale.getY()) / (basegfx::fTools::equalZero(aPolyRange.getHeight()) ? 1.0 : aPolyRange.getHeight())); // prepare transform matrix for polygon - basegfx::B2DHomMatrix aPolyTransform; - - aPolyTransform.translate(-aPolyRange.getMinX(), -aPolyRange.getMinY()); + basegfx::B2DHomMatrix aPolyTransform(basegfx::tools::createTranslateB2DHomMatrix( + -aPolyRange.getMinX(), -aPolyRange.getMinY())); aPolyTransform.scale(fScaleX, fScaleY); // normally the poly should be moved back, but the translation is in the object @@ -1392,11 +1392,7 @@ bool SdrDragMove::BeginSdrDrag() basegfx::B2DHomMatrix SdrDragMove::getCurrentTransformation() { - basegfx::B2DHomMatrix aRetval; - - aRetval.translate(DragStat().GetDX(), DragStat().GetDY()); - - return aRetval; + return basegfx::tools::createTranslateB2DHomMatrix(DragStat().GetDX(), DragStat().GetDY()); } void SdrDragMove::ImpCheckSnap(const Point& rPt) @@ -1721,9 +1717,8 @@ bool SdrDragResize::BeginSdrDrag() basegfx::B2DHomMatrix SdrDragResize::getCurrentTransformation() { - basegfx::B2DHomMatrix aRetval; - - aRetval.translate(-DragStat().Ref1().X(), -DragStat().Ref1().Y()); + basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix( + -DragStat().Ref1().X(), -DragStat().Ref1().Y())); aRetval.scale(aXFact, aYFact); aRetval.translate(DragStat().Ref1().X(), DragStat().Ref1().Y()); @@ -2007,13 +2002,9 @@ bool SdrDragRotate::BeginSdrDrag() basegfx::B2DHomMatrix SdrDragRotate::getCurrentTransformation() { - basegfx::B2DHomMatrix aRetval; - - aRetval.translate(-DragStat().GetRef1().X(), -DragStat().GetRef1().Y()); - aRetval.rotate(-atan2(nSin, nCos)); - aRetval.translate(DragStat().GetRef1().X(), DragStat().GetRef1().Y()); - - return aRetval; + return basegfx::tools::createRotateAroundPoint( + DragStat().GetRef1().X(), DragStat().GetRef1().Y(), + -atan2(nSin, nCos)); } void SdrDragRotate::MoveSdrDrag(const Point& rPnt_) @@ -2163,9 +2154,8 @@ bool SdrDragShear::BeginSdrDrag() basegfx::B2DHomMatrix SdrDragShear::getCurrentTransformation() { - basegfx::B2DHomMatrix aRetval; - - aRetval.translate(-DragStat().GetRef1().X(), -DragStat().GetRef1().Y()); + basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix( + -DragStat().GetRef1().X(), -DragStat().GetRef1().Y())); if (bResize) { @@ -2463,7 +2453,7 @@ basegfx::B2DHomMatrix SdrDragMirror::getCurrentTransformation() const double fDeltaY(DragStat().GetRef2().Y() - DragStat().GetRef1().Y()); const double fRotation(atan2(fDeltaY, fDeltaX)); - aRetval.translate(-DragStat().GetRef1().X(), -DragStat().GetRef1().Y()); + aRetval = basegfx::tools::createTranslateB2DHomMatrix(-DragStat().GetRef1().X(), -DragStat().GetRef1().Y()); aRetval.rotate(-fRotation); aRetval.scale(1.0, -1.0); aRetval.rotate(fRotation); diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 30c3ff62531a..0cc1e347c949 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -46,7 +46,6 @@ #include #include #include - #include #include #include @@ -55,9 +54,7 @@ #include #include #include - #include - #include #include #include @@ -73,9 +70,8 @@ #include #include #include // FRound - -// #i73407# #include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -385,12 +381,10 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaLineAction& rAct) if(!aStart.equal(aEnd)) { basegfx::B2DPolygon aLine; - basegfx::B2DHomMatrix aTransform; + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); aLine.append(aStart); aLine.append(aEnd); - aTransform.scale(fScaleX, fScaleY); - aTransform.translate(aOfs.X(), aOfs.Y()); aLine.transform(aTransform); const LineInfo& rLineInfo = rAct.GetLineInfo(); @@ -581,10 +575,7 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction& rAct ) if(aSource.count()) { - basegfx::B2DHomMatrix aTransform; - - aTransform.scale(fScaleX, fScaleY); - aTransform.translate(aOfs.X(), aOfs.Y()); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); aSource.transform(aTransform); } @@ -618,10 +609,7 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaPolygonAction& rAct ) if(aSource.count()) { - basegfx::B2DHomMatrix aTransform; - - aTransform.scale(fScaleX, fScaleY); - aTransform.translate(aOfs.X(), aOfs.Y()); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); aSource.transform(aTransform); if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource))) @@ -643,10 +631,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaPolyPolygonAction& rAct) if(aSource.count()) { - basegfx::B2DHomMatrix aTransform; - - aTransform.scale(fScaleX, fScaleY); - aTransform.translate(aOfs.X(), aOfs.Y()); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); aSource.transform(aTransform); if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) @@ -791,9 +776,7 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaHatchAction& rAct ) if(aSource.count()) { - basegfx::B2DHomMatrix aTransform; - aTransform.scale(fScaleX, fScaleY); - aTransform.translate(aOfs.X(), aOfs.Y()); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); aSource.transform(aTransform); if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) @@ -886,10 +869,7 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM if(aSource.count()) { - basegfx::B2DHomMatrix aTransform; - - aTransform.scale(fScaleX, fScaleY); - aTransform.translate(aOfs.X(), aOfs.Y()); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); aSource.transform(aTransform); if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index dab855fa6f41..4f0dc646376f 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -94,6 +94,7 @@ #include #include #include +#include // #104018# replace macros above with type-safe methods inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); } @@ -3438,31 +3439,11 @@ sal_Bool SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, ba } // build matrix - rMatrix.identity(); - - if(!basegfx::fTools::equal(aScale.getX(), 1.0) || !basegfx::fTools::equal(aScale.getY(), 1.0)) - { - rMatrix.scale(aScale.getX(), aScale.getY()); - } - - if(!basegfx::fTools::equalZero(fShearX)) - { - rMatrix.shearX(tan(fShearX)); - } - - if(!basegfx::fTools::equalZero(fRotate)) - { - // #i78696# - // fRotate is from the old GeoStat struct and thus mathematically wrong orientated. For - // the linear combination of matrices it needed to be fixed in the API, so it needs to - // be mirrored here - rMatrix.rotate(-fRotate); - } - - if(!aTranslate.equalZero()) - { - rMatrix.translate(aTranslate.getX(), aTranslate.getY()); - } + rMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, + basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX), + basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate, + aTranslate); return sal_False; } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 7ba4aec3e565..293317cf2a93 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -68,9 +68,6 @@ #include // NotPersistItems #include #include - -//////////////////////////////////////////////////////////////////////////////////////////////////// - #include #include #include @@ -98,8 +95,6 @@ #include #include // FRound #include - -// #97849# #include #include #include @@ -107,8 +102,6 @@ #include #include #include - -// #110094# #include #include #include @@ -120,7 +113,6 @@ #include #include #include - #include #include #include @@ -128,10 +120,8 @@ #include "svx/svdotable.hxx" #include "svx/shapepropertynotifier.hxx" #include - -// --> OD 2009-07-10 #i73249# #include -// <-- +#include using namespace ::com::sun::star; @@ -3056,17 +3046,7 @@ sal_Bool SdrObject::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B } // build matrix - rMatrix.identity(); - - if(1.0 != aScale.getX() || 1.0 != aScale.getY()) - { - rMatrix.scale(aScale.getX(), aScale.getY()); - } - - if(0.0 != aTranslate.getX() || 0.0 != aTranslate.getY()) - { - rMatrix.translate(aTranslate.getX(), aTranslate.getY()); - } + rMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix(aScale, aTranslate); return sal_False; } diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index 6af31224ee45..88cab2851359 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -61,6 +61,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -238,11 +239,10 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrObjKind eCicrleKind, c aCircPolygon.removeDoublePoints(); // needs own scaling and translation from unit circle to target size - basegfx::B2DHomMatrix aMatrix; const basegfx::B2DPoint aCenter(aRange.getCenter()); - - aMatrix.scale(aRange.getWidth() / 2.0, aRange.getHeight() / 2.0); - aMatrix.translate(aCenter.getX(), aCenter.getY()); + const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix( + aRange.getWidth() / 2.0, aRange.getHeight() / 2.0, + aCenter.getX(), aCenter.getY())); aCircPolygon.transform(aMatrix); } else @@ -277,26 +277,16 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrObjKind eCicrleKind, c // #i76950# if(aGeo.nShearWink || aGeo.nDrehWink) { - const basegfx::B2DPoint aTopLeft(aRange.getMinimum()); - basegfx::B2DHomMatrix aMatrix; - // translate top left to (0,0) - aMatrix.translate(-aTopLeft.getX(), -aTopLeft.getY()); - - // shear (if needed) - if(aGeo.nShearWink) - { - aMatrix.shearX(tan((36000 - aGeo.nShearWink) * F_PI18000)); - } - - // rotate (if needed) - if(aGeo.nDrehWink) - { - aMatrix.rotate((36000 - aGeo.nDrehWink) * F_PI18000); - } - - // back to top left - aMatrix.translate(aTopLeft.getX(), aTopLeft.getY()); + const basegfx::B2DPoint aTopLeft(aRange.getMinimum()); + basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix( + -aTopLeft.getX(), -aTopLeft.getY())); + + // shear, rotate and back to top left (if needed) + aMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix( + aGeo.nShearWink ? tan((36000 - aGeo.nShearWink) * F_PI18000) : 0.0, + aGeo.nDrehWink ? (36000 - aGeo.nDrehWink) * F_PI18000 : 0.0, + aTopLeft) * aMatrix; // apply transformation aCircPolygon.transform(aMatrix); diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index 330b7f5c37f6..90f3870c058e 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -71,6 +71,7 @@ #include #include #include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1456,17 +1457,7 @@ sal_Bool SdrMeasureObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegf } // build return value matrix - rMatrix.identity(); - - if(!basegfx::fTools::equal(aScale.getX(), 1.0) || !basegfx::fTools::equal(aScale.getY(), 1.0)) - { - rMatrix.scale(aScale.getX(), aScale.getY()); - } - - if(!aTranslate.equalZero()) - { - rMatrix.translate(aTranslate.getX(), aTranslate.getY()); - } + rMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix(aScale, aTranslate); return sal_True; } diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 1e9c9b57c52d..e30b0aacf75d 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -56,7 +56,6 @@ #include #include #include - #include #include #include // FRound @@ -77,10 +76,9 @@ inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); } #include #include #include - -// #i89784# #include #include +#include using namespace sdr; @@ -2291,9 +2289,7 @@ Pointer SdrPathObj::GetCreatePointer() const void SdrPathObj::NbcMove(const Size& rSiz) { - basegfx::B2DHomMatrix aTrans; - aTrans.translate(rSiz.Width(), rSiz.Height()); - maPathPolygon.transform(aTrans); + maPathPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(rSiz.Width(), rSiz.Height())); // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints) SdrTextObj::NbcMove(rSiz); @@ -2301,10 +2297,9 @@ void SdrPathObj::NbcMove(const Size& rSiz) void SdrPathObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) { - basegfx::B2DHomMatrix aTrans; - aTrans.translate(-rRef.X(), -rRef.Y()); - aTrans.scale(double(xFact), double(yFact)); - aTrans.translate(rRef.X(), rRef.Y()); + basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-rRef.X(), -rRef.Y())); + aTrans = basegfx::tools::createScaleTranslateB2DHomMatrix( + double(xFact), double(yFact), rRef.X(), rRef.Y()) * aTrans; maPathPolygon.transform(aTrans); // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints) @@ -2313,10 +2308,8 @@ void SdrPathObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract void SdrPathObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs) { - basegfx::B2DHomMatrix aTrans; - aTrans.translate(-rRef.X(), -rRef.Y()); - aTrans.rotate(-nWink * nPi180); // Thank JOE, the angles are defined mirrored to the mathematical meanings - aTrans.translate(rRef.X(), rRef.Y()); + // Thank JOE, the angles are defined mirrored to the mathematical meanings + const basegfx::B2DHomMatrix aTrans(basegfx::tools::createRotateAroundPoint(rRef.X(), rRef.Y(), -nWink * nPi180)); maPathPolygon.transform(aTrans); // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints) @@ -2325,8 +2318,7 @@ void SdrPathObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs) void SdrPathObj::NbcShear(const Point& rRefPnt, long nAngle, double fTan, FASTBOOL bVShear) { - basegfx::B2DHomMatrix aTrans; - aTrans.translate(-rRefPnt.X(), -rRefPnt.Y()); + basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-rRefPnt.X(), -rRefPnt.Y())); if(bVShear) { @@ -2347,11 +2339,10 @@ void SdrPathObj::NbcShear(const Point& rRefPnt, long nAngle, double fTan, FASTBO void SdrPathObj::NbcMirror(const Point& rRefPnt1, const Point& rRefPnt2) { - basegfx::B2DHomMatrix aTrans; const double fDiffX(rRefPnt2.X() - rRefPnt1.X()); const double fDiffY(rRefPnt2.Y() - rRefPnt1.Y()); const double fRot(atan2(fDiffY, fDiffX)); - aTrans.translate(-rRefPnt1.X(), -rRefPnt1.Y()); + basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-rRefPnt1.X(), -rRefPnt1.Y())); aTrans.rotate(-fRot); aTrans.scale(1.0, -1.0); aTrans.rotate(fRot); @@ -2935,31 +2926,11 @@ sal_Bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx:: } // build return value matrix - rMatrix.identity(); - - if(!basegfx::fTools::equal(aScale.getX(), 1.0) || !basegfx::fTools::equal(aScale.getY(), 1.0)) - { - rMatrix.scale(aScale.getX(), aScale.getY()); - } - - if(!basegfx::fTools::equalZero(fShearX)) - { - rMatrix.shearX(tan(fShearX)); - } - - if(!basegfx::fTools::equalZero(fRotate)) - { - // #i78696# - // fRotate is from the old GeoStat and thus mathematically wrong orientated. For - // the linear combination of matrices it needed to be fixed in the API, so it needs to - // be mirrored here - rMatrix.rotate(-fRotate); - } - - if(!aTranslate.equalZero()) - { - rMatrix.translate(aTranslate.getX(), aTranslate.getY()); - } + rMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, + basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX), + basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate, + aTranslate); return sal_True; } diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 6b2f02299d4a..a6f15ab27802 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -63,17 +63,14 @@ #include #include #include - -// #110496# #include - -// #111111# #include #include #include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -737,9 +734,9 @@ void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, Rectangle& rAncho { basegfx::B2DPolyPolygon aXorPolyPolygon(TakeXorPoly()); basegfx::B2DPolyPolygon* pContourPolyPolygon = 0L; - basegfx::B2DHomMatrix aMatrix; + basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix( + -rAnchorRect.Left(), -rAnchorRect.Top())); - aMatrix.translate(-rAnchorRect.Left(), -rAnchorRect.Top()); if(aGeo.nDrehWink) { // Unrotate! @@ -1735,31 +1732,11 @@ sal_Bool SdrTextObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx:: } // build matrix - rMatrix.identity(); - - if(!basegfx::fTools::equal(aScale.getX(), 1.0) || !basegfx::fTools::equal(aScale.getY(), 1.0)) - { - rMatrix.scale(aScale.getX(), aScale.getY()); - } - - if(!basegfx::fTools::equalZero(fShearX)) - { - rMatrix.shearX(tan(fShearX)); - } - - if(!basegfx::fTools::equalZero(fRotate)) - { - // #i78696# - // fRotate is from the old GeoStat and thus mathematically wrong orientated. For - // the linear combination of matrices it needed to be fixed in the API, so it needs to - // be mirrored here - rMatrix.rotate(-fRotate); - } - - if(!aTranslate.equalZero()) - { - rMatrix.translate(aTranslate.getX(), aTranslate.getY()); - } + rMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, + basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX), + basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate, + aTranslate); return sal_False; } diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 76c29de8d480..a10d2c258fb7 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -60,6 +60,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // helpers @@ -676,9 +677,7 @@ bool SdrTextObj::impDecomposeContourTextPrimitive( // prepare contour polygon, force to non-mirrored for layouting basegfx::B2DPolyPolygon aPolyPolygon(rSdrContourTextPrimitive.getUnitPolyPolygon()); - basegfx::B2DHomMatrix aTransform; - aTransform.scale(fabs(aScale.getX()), fabs(aScale.getY())); - aPolyPolygon.transform(aTransform); + aPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(fabs(aScale.getX()), fabs(aScale.getY()))); // prepare outliner SdrOutliner& rOutliner = ImpGetDrawOutliner(); @@ -693,19 +692,17 @@ bool SdrTextObj::impDecomposeContourTextPrimitive( // prepare matrices to apply to newly created primitives basegfx::B2DHomMatrix aNewTransformA; - basegfx::B2DHomMatrix aNewTransformB; // mirroring. We are now in the polygon sizes. When mirroring in X and Y, // move the null point which was top left to bottom right. const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0)); const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0)); - aNewTransformB.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0); // in-between the translations of the single primitives will take place. Afterwards, // the object's transformations need to be applied - aNewTransformB.shearX(fShearX); - aNewTransformB.rotate(fRotate); - aNewTransformB.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aNewTransformB(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0, + fShearX, fRotate, aTranslate.getX(), aTranslate.getY())); // now break up text primitives. impTextBreakupHandler aConverter(rOutliner); @@ -882,26 +879,22 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( // prepare matrices to apply to newly created primitives. aNewTransformA // will get coordinates in aOutlinerScale size and positive in X, Y. - basegfx::B2DHomMatrix aNewTransformA; - basegfx::B2DHomMatrix aNewTransformB; - - // translate relative to given primitive to get same rotation and shear + // Translate relative to given primitive to get same rotation and shear // as the master shape we are working on. For vertical, use the top-right // corner const double fStartInX(bVerticalWritintg ? aAdjustTranslate.getX() + aOutlinerScale.getX() : aAdjustTranslate.getX()); - aNewTransformA.translate(fStartInX, aAdjustTranslate.getY()); + basegfx::B2DHomMatrix aNewTransformA(basegfx::tools::createTranslateB2DHomMatrix(fStartInX, aAdjustTranslate.getY())); // mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y, // move the null point which was top left to bottom right. const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0)); const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0)); - aNewTransformB.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0); // in-between the translations of the single primitives will take place. Afterwards, // the object's transformations need to be applied - aNewTransformB.shearX(fShearX); - aNewTransformB.rotate(fRotate); - aNewTransformB.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aNewTransformB(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0, + fShearX, fRotate, aTranslate.getX(), aTranslate.getY())); // now break up text primitives. impTextBreakupHandler aConverter(rOutliner); @@ -956,7 +949,6 @@ bool SdrTextObj::impDecomposeStretchTextPrimitive( // prepare matrices to apply to newly created primitives basegfx::B2DHomMatrix aNewTransformA; - basegfx::B2DHomMatrix aNewTransformB; // #i101957# Check for vertical text. If used, aNewTransformA // needs to translate the text initially around object width to orient @@ -978,13 +970,12 @@ bool SdrTextObj::impDecomposeStretchTextPrimitive( // move the null point which was top left to bottom right. const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0)); const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0)); - aNewTransformB.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0); // in-between the translations of the single primitives will take place. Afterwards, // the object's transformations need to be applied - aNewTransformB.shearX(fShearX); - aNewTransformB.rotate(fRotate); - aNewTransformB.translate(aTranslate.getX(), aTranslate.getY()); + const basegfx::B2DHomMatrix aNewTransformB(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0, + fShearX, fRotate, aTranslate.getX(), aTranslate.getY())); // now break up text primitives. impTextBreakupHandler aConverter(rOutliner); diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx index 18840cde18e0..523eb6b4b2c3 100644 --- a/svx/source/svdraw/svdovirt.cxx +++ b/svx/source/svdraw/svdovirt.cxx @@ -40,6 +40,7 @@ #include #include #include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -216,9 +217,7 @@ basegfx::B2DPolyPolygon SdrVirtObj::TakeXorPoly() const if(aAnchor.X() || aAnchor.Y()) { - basegfx::B2DHomMatrix aMatrix; - aMatrix.translate(aAnchor.X(), aAnchor.Y()); - aPolyPolygon.transform(aMatrix); + aPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(aAnchor.X(), aAnchor.Y())); } return aPolyPolygon; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 3f7f58a1e9ad..b83253968601 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -98,6 +98,7 @@ #include "unomaster.hxx" #include #include +#include #include @@ -2516,10 +2517,7 @@ bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper if( mpModel->IsWriter() ) { Point aPoint( mpObj->GetAnchorPos() ); - - basegfx::B2DHomMatrix aMatrix; - aMatrix.translate( aPoint.X(), aPoint.Y() ); - aNewPolyPolygon.transform( aMatrix ); + aNewPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(aPoint.X(), aPoint.Y())); } pEdgeObj->SetEdgeTrackPath( aNewPolyPolygon ); return true; @@ -2952,10 +2950,7 @@ bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper if( mpModel->IsWriter() ) { Point aPoint( mpObj->GetAnchorPos() ); - - basegfx::B2DHomMatrix aMatrix; - aMatrix.translate( -aPoint.X(), -aPoint.Y() ); - aPolyPoly.transform( aMatrix ); + aPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(-aPoint.X(), -aPoint.Y())); } drawing::PolyPolygonBezierCoords aRetval; SvxConvertB2DPolyPolygonToPolyPolygonBezier( aPolyPoly, aRetval); -- cgit v1.2.3 From 2d634e6084547875a170d8350850110238b9e55c Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 29 Sep 2009 15:35:35 +0200 Subject: #i105323# speedup of 3D handling mostly for CustomShapes; HitTest and interactions optimized --- .../drawinglayer/geometry/viewinformation2d.hxx | 7 + .../drawinglayer/primitive2d/sceneprimitive2d.hxx | 3 +- .../processor2d/hittestprocessor2d.hxx | 2 + .../drawinglayer/processor2d/vclprocessor2d.hxx | 2 + .../processor3d/cutfindprocessor3d.hxx | 86 +++++++++ drawinglayer/prj/d.lst | 2 + drawinglayer/source/geometry/viewinformation2d.cxx | 40 ++++- .../source/primitive2d/sceneprimitive2d.cxx | 42 +++-- .../source/processor2d/contourextractor2d.cxx | 9 +- .../source/processor2d/hittestprocessor2d.cxx | 131 ++++++++++++-- .../source/processor2d/vclpixelprocessor2d.cxx | 6 + drawinglayer/source/processor2d/vclprocessor2d.cxx | 92 ++++++++++ .../source/processor3d/cutfindprocessor3d.cxx | 199 +++++++++++++++++++++ drawinglayer/source/processor3d/makefile.mk | 1 + .../sdr/primitive2d/sdrcustomshapeprimitive2d.hxx | 8 +- .../svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx | 25 +-- svx/source/customshapes/EnhancedCustomShape2d.cxx | 11 +- svx/source/customshapes/EnhancedCustomShape3d.cxx | 8 +- svx/source/engine3d/helperhittest3d.cxx | 183 +------------------ .../sdr/contact/viewcontactofsdrobjcustomshape.cxx | 14 +- svx/source/sdr/overlay/overlaymanager.cxx | 16 ++ .../sdr/primitive2d/sdrcustomshapeprimitive2d.cxx | 24 ++- .../sdr/primitive2d/sdrmeasureprimitive2d.cxx | 28 +-- 23 files changed, 692 insertions(+), 247 deletions(-) create mode 100644 drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx create mode 100644 drawinglayer/source/processor3d/cutfindprocessor3d.cxx (limited to 'drawinglayer/inc/drawinglayer/primitive2d') diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx index 94a5623a2a77..0a87b268c8b1 100644 --- a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx +++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx @@ -149,6 +149,13 @@ namespace drawinglayer /// On-demand prepared Viewport in discrete units for convenience const basegfx::B2DRange& getDiscreteViewport() const; + /** support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This + is used e.g. to allow to lower display quality for OverlayPrimitives and + may lead to simpler decompositions in the local create2DDecomposition + implementations of the primitives + */ + bool getReducedDisplayQuality() const; + /** Get the uno::Sequence< beans::PropertyValue > which contains all ViewInformation Use this call if You need to extract all contained ViewInformation. The ones diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx index f190c3e6c1e1..1cb433e6bff1 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx @@ -87,7 +87,8 @@ namespace drawinglayer // Geometry extractor. Shadow will be added as in create2DDecomposition, but // the 3D content is not converted to a bitmap visualisation but to projected 2D gemetry. This // helper is useful e.g. for Contour extraction or HitTests. - Primitive2DSequence getGeometry2D(const geometry::ViewInformation2D& rViewInformation) const; + Primitive2DSequence getGeometry2D() const; + Primitive2DSequence getShadow2D(const geometry::ViewInformation2D& rViewInformation) const; // constructor/destructor ScenePrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx index 1eeaefd2dade..c0ab33052883 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx @@ -43,6 +43,7 @@ namespace basegfx { class B2DPolygon; } namespace basegfx { class B2DPolyPolygon; } +namespace drawinglayer { namespace primitive2d { class ScenePrimitive2D; }} ////////////////////////////////////////////////////////////////////////////// @@ -80,6 +81,7 @@ namespace drawinglayer bool checkFillHitWithTolerance( const basegfx::B2DPolyPolygon& rPolyPolygon, double fDiscreteHitTolerance); + void check3DHit(const primitive2d::ScenePrimitive2D& rCandidate); public: HitTestProcessor2D( diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx index e29b413190ab..66ca140c2e56 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx @@ -51,6 +51,7 @@ namespace drawinglayer { namespace primitive2d { class BitmapPrimitive2D; class FillBitmapPrimitive2D; class PolyPolygonGradientPrimitive2D; + class PolyPolygonBitmapPrimitive2D; class PolyPolygonColorPrimitive2D; class MetafilePrimitive2D; class MaskPrimitive2D; @@ -100,6 +101,7 @@ namespace drawinglayer void RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate); void RenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate); void RenderPolyPolygonGradientPrimitive2D(const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate); + void RenderPolyPolygonBitmapPrimitive2D(const primitive2d::PolyPolygonBitmapPrimitive2D& rPolygonCandidate); void RenderPolyPolygonColorPrimitive2D(const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate); void RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rPolygonCandidate); void RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate); diff --git a/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx new file mode 100644 index 000000000000..8a800d6d24b1 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: zbufferprocessor3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-06-24 15:30:18 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX +#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +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; + + // bitfield + bool mbAnyHit : 1; + + // 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, + bool bAnyHit); + + // data access + const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return maResult; } + bool getAnyHit() const { return mbAnyHit; } + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX + +// eof diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst index 0068b32c24ae..1ba3c2e7b614 100644 --- a/drawinglayer/prj/d.lst +++ b/drawinglayer/prj/d.lst @@ -90,6 +90,8 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor2d mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor3d ..\inc\drawinglayer\processor3d\baseprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\baseprocessor3d.hxx +..\inc\drawinglayer\processor3d\cutfindprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\cutfindprocessor3d.hxx +..\inc\drawinglayer\processor3d\defaultprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\defaultprocessor3d.hxx ..\inc\drawinglayer\processor3d\zbufferprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\zbufferprocessor3d.hxx ..\inc\drawinglayer\processor3d\tbufferprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\tbufferprocessor3d.hxx diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index 372de9936935..e03c946edf9e 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -81,12 +81,18 @@ namespace drawinglayer basegfx::B2DRange maDiscreteViewport; // the DrawPage which is target of visualisation. This is needed e.g. for - // the view-dependent decomposition of PageNumber TextFields + // the view-dependent decomposition of PageNumber TextFields. + // This parameter is buffered here, but mainly resides in mxExtendedInformation, + // so it will be interpreted, but held there. It will also not be added + // to mxExtendedInformation in impFillViewInformationFromContent (it's there already) uno::Reference< drawing::XDrawPage > mxVisualizedPage; // the point in time double mfViewTime; + // bitfield + bool mbReducedDisplayQuality : 1; + // the complete PropertyValue representation (if already created) uno::Sequence< beans::PropertyValue > mxViewInformation; @@ -125,6 +131,12 @@ namespace drawinglayer return s_sNameProperty; } + const ::rtl::OUString& getNamePropertyReducedDisplayQuality() + { + static ::rtl::OUString s_sNameProperty(RTL_CONSTASCII_USTRINGPARAM("ReducedDisplayQuality")); + return s_sNameProperty; + } + void impInterpretPropertyValues(const uno::Sequence< beans::PropertyValue >& rViewParameters) { if(rViewParameters.hasElements()) @@ -139,7 +151,17 @@ namespace drawinglayer { const beans::PropertyValue& rProp = rViewParameters[a]; - if(rProp.Name == getNamePropertyObjectTransformation()) + if(rProp.Name == getNamePropertyReducedDisplayQuality()) + { + // extra information; add to filtered information + mxExtendedInformation[nExtendedInsert++] = rProp; + + // for performance reasons, also cache content locally + sal_Bool bSalBool; + rProp.Value >>= bSalBool; + mbReducedDisplayQuality = bSalBool; + } + else if(rProp.Name == getNamePropertyObjectTransformation()) { com::sun::star::geometry::AffineMatrix2D aAffineMatrix2D; rProp.Value >>= aAffineMatrix2D; @@ -185,6 +207,7 @@ namespace drawinglayer const bool bViewportUsed(!maViewport.isEmpty()); const bool bTimeUsed(0.0 < mfViewTime); const bool bVisualizedPageUsed(mxVisualizedPage.is()); + const bool bReducedDisplayQualityUsed(true == mbReducedDisplayQuality); const bool bExtraInformation(mxExtendedInformation.hasElements()); sal_uInt32 nIndex(0); const sal_uInt32 nCount( @@ -193,6 +216,7 @@ namespace drawinglayer (bViewportUsed ? 1 : 0) + (bTimeUsed ? 1 : 0) + (bVisualizedPageUsed ? 1 : 0) + + (bReducedDisplayQualityUsed ? 1 : 0) + (bExtraInformation ? mxExtendedInformation.getLength() : 0)); mxViewInformation.realloc(nCount); @@ -265,6 +289,7 @@ namespace drawinglayer maDiscreteViewport(), mxVisualizedPage(rxDrawPage), mfViewTime(fViewTime), + mbReducedDisplayQuality(false), mxViewInformation(), mxExtendedInformation() { @@ -281,6 +306,7 @@ namespace drawinglayer maDiscreteViewport(), mxVisualizedPage(), mfViewTime(), + mbReducedDisplayQuality(false), mxViewInformation(rViewParameters), mxExtendedInformation() { @@ -355,6 +381,11 @@ namespace drawinglayer return mxVisualizedPage; } + bool getReducedDisplayQuality() const + { + return mbReducedDisplayQuality; + } + const uno::Sequence< beans::PropertyValue >& getViewInformationSequence() const { if(!mxViewInformation.hasElements()) @@ -501,6 +532,11 @@ namespace drawinglayer return mpViewInformation2D->getDiscreteViewport(); } + bool ViewInformation2D::getReducedDisplayQuality() const + { + return mpViewInformation2D->getReducedDisplayQuality(); + } + const uno::Sequence< beans::PropertyValue >& ViewInformation2D::getViewInformationSequence() const { return mpViewInformation2D->getViewInformationSequence(); diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index cfeb5e35edc5..7fa9fdec336c 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -200,6 +200,17 @@ namespace drawinglayer fViewSizeY *= fReduceFactor; } + if(rViewInformation.getReducedDisplayQuality()) + { + // when reducing the visualisation is allowed (e.g. an OverlayObject + // only needed for dragging), reduce resolution extra + // to speed up dragging interactions (1/4th currently) + const double fReducedVisualisationFactor(0.25); + fReduceFactor *= fReducedVisualisationFactor; + fViewSizeX *= fReducedVisualisationFactor; + fViewSizeY *= fReducedVisualisationFactor; + } + // calculate logic render size in world coordinates for usage in renderer basegfx::B2DVector aLogicRenderSize( aDiscreteRange.getWidth() * fReduceFactor, @@ -207,9 +218,8 @@ namespace drawinglayer aLogicRenderSize *= rViewInformation.getInverseObjectToViewTransformation(); // determine the oversample value - static bool bDoOversample(false); static sal_uInt16 nDefaultOversampleValue(3); - const sal_uInt16 nOversampleValue((bDoOversample || aDrawinglayerOpt.IsAntiAliasing()) ? nDefaultOversampleValue : 0); + const sal_uInt16 nOversampleValue(aDrawinglayerOpt.IsAntiAliasing() ? nDefaultOversampleValue : 0); // use default 3D primitive processor to create BitmapEx for aUnitVisiblePart and process processor3d::ZBufferProcessor3D aZBufferProcessor3D( @@ -262,17 +272,10 @@ namespace drawinglayer return aRetval; } - Primitive2DSequence ScenePrimitive2D::getGeometry2D(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence ScenePrimitive2D::getGeometry2D() const { Primitive2DSequence aRetval; - // create 2D shadows from contained 3D primitives - if(impGetShadow3D(rViewInformation)) - { - // add extracted 2d shadows (before 3d scene creations itself) - aRetval = maShadowPrimitives; - } - // create 2D projected geometry from 3D geometry if(getChildren3D().hasElements()) { @@ -284,9 +287,22 @@ namespace drawinglayer // process local primitives aGeometryProcessor.process(getChildren3D()); - // fetch result and append - Primitive2DSequence a2DExtractedPrimitives(aGeometryProcessor.getPrimitive2DSequence()); - appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, a2DExtractedPrimitives); + // fetch result + aRetval = aGeometryProcessor.getPrimitive2DSequence(); + } + + return aRetval; + } + + Primitive2DSequence ScenePrimitive2D::getShadow2D(const geometry::ViewInformation2D& rViewInformation) const + { + Primitive2DSequence aRetval; + + // create 2D shadows from contained 3D primitives + if(impGetShadow3D(rViewInformation)) + { + // add extracted 2d shadows (before 3d scene creations itself) + aRetval = maShadowPrimitives; } return aRetval; diff --git a/drawinglayer/source/processor2d/contourextractor2d.cxx b/drawinglayer/source/processor2d/contourextractor2d.cxx index 2813b8081584..3225651a6754 100644 --- a/drawinglayer/source/processor2d/contourextractor2d.cxx +++ b/drawinglayer/source/processor2d/contourextractor2d.cxx @@ -162,7 +162,8 @@ namespace drawinglayer { // 2D Scene primitive containing 3D stuff; extract 2D contour in world coordinates const primitive2d::ScenePrimitive2D& rScenePrimitive2DCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); - const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D(getViewInformation2D())); + const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D()); + const primitive2d::Primitive2DSequence xExtracted2DSceneShadow(rScenePrimitive2DCandidate.getShadow2D(getViewInformation2D())); // proccess content if(xExtracted2DSceneGeometry.hasElements()) @@ -170,6 +171,12 @@ namespace drawinglayer process(xExtracted2DSceneGeometry); } + // proccess content + if(xExtracted2DSceneShadow.hasElements()) + { + process(xExtracted2DSceneShadow); + } + break; } case PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D : diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index 808ea70155a9..98bbe2a82cb8 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -48,6 +48,8 @@ #include #include #include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -164,6 +166,108 @@ namespace drawinglayer return bRetval; } + void HitTestProcessor2D::check3DHit(const primitive2d::ScenePrimitive2D& rCandidate) + { + // calculate relative point in unified 2D scene + const basegfx::B2DPoint aLogicHitPosition(getViewInformation2D().getInverseObjectToViewTransformation() * getDiscreteHitPosition()); + basegfx::B2DHomMatrix aInverseSceneTransform(rCandidate.getObjectTransformation()); + aInverseSceneTransform.invert(); + const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * aLogicHitPosition); + + // check if test point is inside scene's unified area at all + if(aRelativePoint.getX() >= 0.0 && aRelativePoint.getX() <= 1.0 + && aRelativePoint.getY() >= 0.0 && aRelativePoint.getY() <= 1.0) + { + // get 3D view information + const geometry::ViewInformation3D& rObjectViewInformation3D = rCandidate.getViewInformation3D(); + + // create HitPoint Front and Back, transform to object coordinates + basegfx::B3DHomMatrix aViewToObject(rObjectViewInformation3D.getObjectToView()); + aViewToObject.invert(); + const basegfx::B3DPoint aFront(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 0.0)); + const basegfx::B3DPoint aBack(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 1.0)); + + if(!aFront.equal(aBack)) + { + const primitive3d::Primitive3DSequence& rPrimitives = rCandidate.getChildren3D(); + + if(rPrimitives.hasElements()) + { + // make BoundVolume empty and overlapping test for speedup + const basegfx::B3DRange aObjectRange( + drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence( + rPrimitives, rObjectViewInformation3D)); + + if(!aObjectRange.isEmpty()) + { + const basegfx::B3DRange aFrontBackRange(aFront, aBack); + + if(aObjectRange.overlaps(aFrontBackRange)) + { + // bound volumes hit, geometric cut tests needed + drawinglayer::processor3d::CutFindProcessor aCutFindProcessor( + rObjectViewInformation3D, + aFront, + aBack, + true); + aCutFindProcessor.process(rPrimitives); + + mbHit = (0 != aCutFindProcessor.getCutPoints().size()); + } + } + } + } + } + + // This is needed to check hit with 3D shadows, too. HitTest is without shadow + // to keep compatible with previous versions. Keeping here as reference + // + // if(!getHit()) + // { + // // if scene has shadow, check hit with shadow, too + // const primitive2d::Primitive2DSequence xExtracted2DSceneShadow(rCandidate.getShadow2D(getViewInformation2D())); + // + // if(xExtracted2DSceneShadow.hasElements()) + // { + // // proccess extracted 2D content + // process(xExtracted2DSceneShadow); + // } + // } + + if(!getHit()) + { + // empty 3D scene; Check for border hit + basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + aOutline.transform(rCandidate.getObjectTransformation()); + + mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); + } + + // This is what the previous version did. Keeping it here for reference + // + // // 2D Scene primitive containing 3D stuff; extract 2D contour in world coordinates + // // This may be refined later to an own 3D HitTest renderer which processes the 3D + // // geometry directly + // const primitive2d::ScenePrimitive2D& rScenePrimitive2DCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); + // const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D()); + // const primitive2d::Primitive2DSequence xExtracted2DSceneShadow(rScenePrimitive2DCandidate.getShadow2D(getViewInformation2D())); + // + // if(xExtracted2DSceneGeometry.hasElements() || xExtracted2DSceneShadow.hasElements()) + // { + // // proccess extracted 2D content + // process(xExtracted2DSceneGeometry); + // process(xExtracted2DSceneShadow); + // } + // else + // { + // // empty 3D scene; Check for border hit + // const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); + // basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); + // + // mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); + // } + } + void HitTestProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) { if(getHit()) @@ -334,25 +438,8 @@ namespace drawinglayer { if(!getHitTextOnly()) { - // 2D Scene primitive containing 3D stuff; extract 2D contour in world coordinates - // This may be refined later to an own 3D HitTest renderer which processes the 3D - // geometry directly - const primitive2d::ScenePrimitive2D& rScenePrimitive2DCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); - const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D(getViewInformation2D())); - - if(xExtracted2DSceneGeometry.hasElements()) - { - // proccess extracted 2D content - process(xExtracted2DSceneGeometry); - } - else - { - // empty 3D scene; Check for border hit - const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); - - mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); - } + const primitive2d::ScenePrimitive2D& rCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); + check3DHit(rCandidate); } break; @@ -365,6 +452,12 @@ namespace drawinglayer // ignorable primitives break; } + case PRIMITIVE2D_ID_SHADOWPRIMITIVE2D : + { + // Ignore shadows; we do not want to have shadows hittable. + // Remove this one to make shadows hittable on demand. + break; + } case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D : case PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D : { diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 540c28d685d4..b1d91ebc86fc 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -209,6 +209,12 @@ namespace drawinglayer RenderPolyPolygonGradientPrimitive2D(static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate)); break; } + case PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D : + { + // direct draw of bitmap + RenderPolyPolygonBitmapPrimitive2D(static_cast< const primitive2d::PolyPolygonBitmapPrimitive2D& >(rCandidate)); + break; + } case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D : { // direct draw of PolyPolygon with color diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index fc57e5299662..16ef4cb2feb3 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -625,6 +625,98 @@ namespace drawinglayer } } + // direct draw of bitmap + void VclProcessor2D::RenderPolyPolygonBitmapPrimitive2D(const primitive2d::PolyPolygonBitmapPrimitive2D& rPolygonCandidate) + { + bool bDone(false); + const basegfx::B2DPolyPolygon& rPolyPolygon = rPolygonCandidate.getB2DPolyPolygon(); + + if(rPolyPolygon.count()) + { + const attribute::FillBitmapAttribute& rFillBitmapAttribute = rPolygonCandidate.getFillBitmap(); + const Bitmap& rBitmap = rFillBitmapAttribute.getBitmap(); + + if(rBitmap.IsEmpty()) + { + // empty bitmap, done + bDone = true; + } + else + { + // try to catch cases where the bitmap will be color-modified to a single + // color (e.g. shadow). This would NOT be optimizable with an alpha channel + // at the Bitmap which we do not have here. When this should change, this + // optimization has to be reworked accordingly. + const sal_uInt32 nBColorModifierStackCount(maBColorModifierStack.count()); + + if(nBColorModifierStackCount) + { + const basegfx::BColorModifier& rTopmostModifier = maBColorModifierStack.getBColorModifier(nBColorModifierStackCount - 1); + + if(basegfx::BCOLORMODIFYMODE_REPLACE == rTopmostModifier.getMode()) + { + // the bitmap fill is in unified color, so we can replace it with + // a single polygon fill. The form of the fill depends on tiling + if(rFillBitmapAttribute.getTiling()) + { + // with tiling, fill the whole PolyPolygon with the modifier color + basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolyPolygon); + + aLocalPolyPolygon.transform(maCurrentTransformation); + mpOutputDevice->SetLineColor(); + mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor())); + mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); + } + else + { + // without tiling, only the area common to the bitmap tile and the + // PolyPolygon is filled. Create the bitmap tile area in object + // coordinates. For this, the object transformation needs to be created + // from the already scaled PolyPolygon. The tile area in object + // coordinates wil always be non-rotated, so it's not necessary to + // work with a polygon here + basegfx::B2DRange aTileRange(rFillBitmapAttribute.getTopLeft(), + rFillBitmapAttribute.getTopLeft() + rFillBitmapAttribute.getSize()); + const basegfx::B2DRange aPolyPolygonRange(rPolyPolygon.getB2DRange()); + basegfx::B2DHomMatrix aNewObjectTransform; + + aNewObjectTransform.set(0, 0, aPolyPolygonRange.getWidth()); + aNewObjectTransform.set(1, 1, aPolyPolygonRange.getHeight()); + aNewObjectTransform.set(0, 2, aPolyPolygonRange.getMinX()); + aNewObjectTransform.set(1, 2, aPolyPolygonRange.getMinY()); + aTileRange.transform(aNewObjectTransform); + + // now clip the object polyPolygon against the tile range + // to get the common area (OR) + basegfx::B2DPolyPolygon aTarget = basegfx::tools::clipPolyPolygonOnRange(rPolyPolygon, aTileRange, true, false); + + if(aTarget.count()) + { + aTarget.transform(maCurrentTransformation); + mpOutputDevice->SetLineColor(); + mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor())); + mpOutputDevice->DrawPolyPolygon(aTarget); + } + } + + bDone = true; + } + } + } + } + else + { + // empty polyPolygon, done + bDone = true; + } + + if(!bDone) + { + // use default decomposition + process(rPolygonCandidate.get2DDecomposition(getViewInformation2D())); + } + } + // direct draw of PolyPolygon with color void VclProcessor2D::RenderPolyPolygonColorPrimitive2D(const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate) { diff --git a/drawinglayer/source/processor3d/cutfindprocessor3d.cxx b/drawinglayer/source/processor3d/cutfindprocessor3d.cxx new file mode 100644 index 000000000000..42e2e1565803 --- /dev/null +++ b/drawinglayer/source/processor3d/cutfindprocessor3d.cxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: zbufferprocessor3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-06-24 15:31:09 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor3d + { + CutFindProcessor::CutFindProcessor(const geometry::ViewInformation3D& rViewInformation, + const basegfx::B3DPoint& rFront, + const basegfx::B3DPoint& rBack, + bool bAnyHit) + : BaseProcessor3D(rViewInformation), + maFront(rFront), + maBack(rBack), + maResult(), + maCombinedTransform(), + mbAnyHit(bAnyHit) + { + } + + void CutFindProcessor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) + { + if(getAnyHit() && maResult.size()) + { + // stop processing as soon as a hit was recognized + return; + } + + // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch + switch(rCandidate.getPrimitive3DID()) + { + 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 + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/processor3d/makefile.mk b/drawinglayer/source/processor3d/makefile.mk index 8ca0097c435a..2ae2ae52f2f2 100644 --- a/drawinglayer/source/processor3d/makefile.mk +++ b/drawinglayer/source/processor3d/makefile.mk @@ -46,6 +46,7 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES= \ $(SLO)$/baseprocessor3d.obj \ + $(SLO)$/cutfindprocessor3d.obj \ $(SLO)$/defaultprocessor3d.obj \ $(SLO)$/shadow3dextractor.obj \ $(SLO)$/geometry2dextractor.obj \ diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx index feedfefc0fe6..033d5c0160e1 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx @@ -57,6 +57,10 @@ namespace drawinglayer // that the text needs to be block formatted unsigned mbWordWrap : 1; + // defines that the object contains/is a 3D AutoShape. Needed for + // making exceptions with shadow generation + unsigned mb3DShape : 1; + protected: // local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; @@ -66,13 +70,15 @@ namespace drawinglayer const attribute::SdrShadowTextAttribute& rSdrSTAttribute, const Primitive2DSequence& rSubPrimitives, const basegfx::B2DHomMatrix& rTextBox, - bool bWordWrap); + bool bWordWrap, + bool b3DShape); // data access const attribute::SdrShadowTextAttribute& getSdrSTAttribute() const { return maSdrSTAttribute; } const Primitive2DSequence& getSubPrimitives() const { return maSubPrimitives; } const basegfx::B2DHomMatrix& getTextBox() const { return maTextBox; } bool getWordWrap() const { return mbWordWrap; } + bool get3DShape() const { return mb3DShape; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx index 7cc0f6dde9a5..3e998f23fd2b 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx @@ -39,19 +39,19 @@ ////////////////////////////////////////////////////////////////////////////// // predefines -namespace drawinglayer -{ - namespace primitive2d +namespace drawinglayer { namespace primitive2d { + enum MeasureTextPosition { - enum MeasureTextPosition - { - MEASURETEXTPOSITION_AUTOMATIC, - MEASURETEXTPOSITION_NEGATIVE, - MEASURETEXTPOSITION_CENTERED, - MEASURETEXTPOSITION_POSITIVE - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer + MEASURETEXTPOSITION_AUTOMATIC, + MEASURETEXTPOSITION_NEGATIVE, + MEASURETEXTPOSITION_CENTERED, + MEASURETEXTPOSITION_POSITIVE + }; +}} + +namespace drawinglayer { namespace attribute { + class SdrLineAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -80,6 +80,7 @@ namespace drawinglayer // internal decomposition helper Primitive2DReference impCreatePart( + const attribute::SdrLineAttribute& rLineAttribute, const basegfx::B2DHomMatrix& rObjectMatrix, const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd, diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index f066cd6a4729..450d82d9f61f 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -689,7 +689,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() ); diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index 3bfa7afb7f6a..07f7c2ab6bea 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -327,8 +327,12 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con //SJ: vertical writing is not required, by removing this item no outliner is created aSet.ClearItem( SDRATTR_TEXTDIRECTION ); - // For primitive rendering, shadow handling is done completely based on the geometry, so i removed it here - aSet.ClearItem(SDRATTR_SHADOW); + // #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; diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx index e2bbe430987d..ad70d3399c8f 100644 --- a/svx/source/engine3d/helperhittest3d.cxx +++ b/svx/source/engine3d/helperhittest3d.cxx @@ -36,18 +36,10 @@ #include #include #include -#include -#include -#include -#include -#include +#include #include #include -#include -#include -#include #include -#include ////////////////////////////////////////////////////////////////////////////// @@ -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 getPrimitive3DID() call for switch - switch(rCandidate.getPrimitive3DID()) - { - 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/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 4850b91ca2a1..09bbe11bd780 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -40,6 +40,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -122,6 +123,7 @@ namespace sdr // create Primitive2DSequence from sub-geometry const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); + bool b3DShape(false); if(pSdrObjRepresentation) { @@ -130,6 +132,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); } @@ -204,7 +212,11 @@ namespace sdr // create primitive const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrCustomShapePrimitive2D( - *pAttribute, xGroup, aTextBoxMatrix, bWordWrap)); + *pAttribute, + xGroup, + aTextBoxMatrix, + bWordWrap, + b3DShape)); 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/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index aacfca368e0d..029d29f22468 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -62,7 +62,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; @@ -72,12 +85,14 @@ namespace drawinglayer const attribute::SdrShadowTextAttribute& rSdrSTAttribute, const Primitive2DSequence& rSubPrimitives, const basegfx::B2DHomMatrix& rTextBox, - bool bWordWrap) + bool bWordWrap, + bool b3DShape) : BufferedDecompositionPrimitive2D(), maSdrSTAttribute(rSdrSTAttribute), maSubPrimitives(rSubPrimitives), maTextBox(rTextBox), - mbWordWrap(bWordWrap) + mbWordWrap(bWordWrap), + mb3DShape(b3DShape) { } @@ -90,7 +105,8 @@ namespace drawinglayer return (getSdrSTAttribute() == rCompare.getSdrSTAttribute() && getSubPrimitives() == rCompare.getSubPrimitives() && getTextBox() == rCompare.getTextBox() - && getWordWrap() == rCompare.getWordWrap()); + && getWordWrap() == rCompare.getWordWrap() + && get3DShape() == rCompare.get3DShape()); } return false; diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index bbb08654baa2..8397f6a47c7c 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -53,27 +53,29 @@ namespace drawinglayer namespace primitive2d { Primitive2DReference SdrMeasurePrimitive2D::impCreatePart( + const attribute::SdrLineAttribute& rLineAttribute, const basegfx::B2DHomMatrix& rObjectMatrix, const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd, bool bLeftActive, bool bRightActive) const { + const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); basegfx::B2DPolygon aPolygon; + aPolygon.append(rStart); aPolygon.append(rEnd); - if(!getSdrLSTAttribute().getLineStartEnd() || (!bLeftActive && !bRightActive)) + if(!pLineStartEnd || (!bLeftActive && !bRightActive)) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *getSdrLSTAttribute().getLine(), 0L); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, 0); } if(bLeftActive && bRightActive) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *getSdrLSTAttribute().getLine(), getSdrLSTAttribute().getLineStartEnd()); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, pLineStartEnd); } - const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); const basegfx::B2DPolyPolygon aEmpty; const attribute::SdrLineStartEndAttribute aLineStartEnd( bLeftActive ? pLineStartEnd->getStartPolyPolygon() : aEmpty, bRightActive ? pLineStartEnd->getEndPolyPolygon() : aEmpty, @@ -81,7 +83,7 @@ namespace drawinglayer bLeftActive ? pLineStartEnd->isStartActive() : false, bRightActive ? pLineStartEnd->isEndActive() : false, bLeftActive ? pLineStartEnd->isStartCentered() : false, bRightActive? pLineStartEnd->isEndCentered() : false); - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, *getSdrLSTAttribute().getLine(), &aLineStartEnd); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, &aLineStartEnd); } Primitive2DSequence SdrMeasurePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const @@ -273,12 +275,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainLeftLeft(aMainLeft.getX() - fLenLeft, aMainLeft.getY()); const basegfx::B2DPoint aMainRightRight(aMainRight.getX() + fLenRight, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainRight, aMainRightRight, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false)); if(!bMainLineSplitted || MEASURETEXTPOSITION_CENTERED != eHorizontal) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeft, aMainRight, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(* pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false)); } } else @@ -289,12 +291,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainInnerLeft(aMainLeft.getX() + fHalfLength, aMainLeft.getY()); const basegfx::B2DPoint aMainInnerRight(aMainRight.getX() - fHalfLength, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainInnerRight, aMainRight, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true)); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aMainLeft, aMainRight, true, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true)); } } @@ -307,13 +309,13 @@ namespace drawinglayer const basegfx::B2DPoint aLeftUp(0.0, fTopEdge); const basegfx::B2DPoint aLeftDown(0.0, fBottomLeft); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aLeftDown, aLeftUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false)); // right help line const basegfx::B2DPoint aRightUp(fDistance, fTopEdge); const basegfx::B2DPoint aRightDown(fDistance, fBottomRight); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(aObjectMatrix, aRightDown, aRightUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false)); // text horizontal position if(MEASURETEXTPOSITION_NEGATIVE == eHorizontal) -- cgit v1.2.3 From 78fb1283ea0f5a059740790e3933fe60b520c7cf Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 29 Sep 2009 18:33:34 +0200 Subject: #i97509# corrected usage of create/get/2D/3DDecomposition for all derivations --- .../primitive2d/animatedprimitive2d.hxx | 12 ++--- .../primitive3d/polygontubeprimitive3d.hxx | 18 ++++++- .../source/primitive2d/animatedprimitive2d.cxx | 56 ++++++++++----------- .../source/primitive3d/polygontubeprimitive3d.cxx | 16 +++++- svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx | 7 ++- svx/source/sdr/primitive2d/sdrole2primitive2d.cxx | 58 +++++++++++----------- 6 files changed, 98 insertions(+), 69 deletions(-) (limited to 'drawinglayer/inc/drawinglayer/primitive2d') diff --git a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx index e505594b2a76..c42853fe54b2 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx @@ -99,15 +99,15 @@ namespace drawinglayer class AnimatedBlinkPrimitive2D : public AnimatedSwitchPrimitive2D { protected: - // create local decomposition - virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - public: AnimatedBlinkPrimitive2D( const animation::AnimationEntry& rAnimationEntry, const Primitive2DSequence& rChildren, bool bIsTextAnimation); + // create local decomposition + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + // provide unique ID DeclPrimitrive2DIDBlock() }; @@ -127,9 +127,6 @@ namespace drawinglayer std::vector< basegfx::tools::B2DHomMatrixBufferedDecompose > maMatrixStack; protected: - // create local decomposition - virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - public: AnimatedInterpolatePrimitive2D( const std::vector< basegfx::B2DHomMatrix >& rmMatrixStack, @@ -137,6 +134,9 @@ namespace drawinglayer const Primitive2DSequence& rChildren, bool bIsTextAnimation); + // create local decomposition + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + // provide unique ID DeclPrimitrive2DIDBlock() }; diff --git a/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx index 5ce81e8c7ad6..695d16ec7cf5 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx @@ -55,14 +55,25 @@ namespace drawinglayer class PolygonTubePrimitive3D : public PolygonHairlinePrimitive3D { private: + // hold the last decompositon since it's expensive + Primitive3DSequence maLast3DDecomposition; + + // visualisation parameters double mfRadius; double mfDegreeStepWidth; double mfMiterMinimumAngle; basegfx::B2DLineJoin maLineJoin; protected: + /** access methods to maLast3DDecomposition. The usage of this methods may allow + later thread-safe stuff to be added if needed. Only to be used by getDecomposition() + implementations for buffering the last decomposition. + */ + const Primitive3DSequence& getLast3DDecomposition() const { return maLast3DDecomposition; } + void setLast3DDecomposition(const Primitive3DSequence& rNew) { maLast3DDecomposition = rNew; } + // local decomposition. - virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + Primitive3DSequence impCreate3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: PolygonTubePrimitive3D( @@ -81,6 +92,11 @@ namespace drawinglayer // compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; + /** local decomposition. Use own buffering since we are not derived from + BufferedDecompositionPrimitive3D + */ + virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + // provide unique ID DeclPrimitrive3DIDBlock() }; diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx index 402fe45126cd..df38c627ec9f 100644 --- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx @@ -114,7 +114,15 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence AnimatedBlinkPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + AnimatedBlinkPrimitive2D::AnimatedBlinkPrimitive2D( + const animation::AnimationEntry& rAnimationEntry, + const Primitive2DSequence& rChildren, + bool bIsTextAnimation) + : AnimatedSwitchPrimitive2D(rAnimationEntry, rChildren, bIsTextAnimation) + { + } + + Primitive2DSequence AnimatedBlinkPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { if(getChildren().hasElements()) { @@ -129,14 +137,6 @@ namespace drawinglayer return Primitive2DSequence(); } - AnimatedBlinkPrimitive2D::AnimatedBlinkPrimitive2D( - const animation::AnimationEntry& rAnimationEntry, - const Primitive2DSequence& rChildren, - bool bIsTextAnimation) - : AnimatedSwitchPrimitive2D(rAnimationEntry, rChildren, bIsTextAnimation) - { - } - // provide unique ID ImplPrimitrive2DIDBlock(AnimatedBlinkPrimitive2D, PRIMITIVE2D_ID_ANIMATEDBLINKPRIMITIVE2D) @@ -149,7 +149,25 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence AnimatedInterpolatePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + AnimatedInterpolatePrimitive2D::AnimatedInterpolatePrimitive2D( + const std::vector< basegfx::B2DHomMatrix >& rmMatrixStack, + const animation::AnimationEntry& rAnimationEntry, + const Primitive2DSequence& rChildren, + bool bIsTextAnimation) + : AnimatedSwitchPrimitive2D(rAnimationEntry, rChildren, bIsTextAnimation), + maMatrixStack() + { + // copy matrices to locally pre-decomposed matrix stack + const sal_uInt32 nCount(rmMatrixStack.size()); + maMatrixStack.reserve(nCount); + + for(sal_uInt32 a(0L); a < nCount; a++) + { + maMatrixStack.push_back(basegfx::tools::B2DHomMatrixBufferedDecompose(rmMatrixStack[a])); + } + } + + Primitive2DSequence AnimatedInterpolatePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { const sal_uInt32 nSize(maMatrixStack.size()); @@ -204,24 +222,6 @@ namespace drawinglayer } } - AnimatedInterpolatePrimitive2D::AnimatedInterpolatePrimitive2D( - const std::vector< basegfx::B2DHomMatrix >& rmMatrixStack, - const animation::AnimationEntry& rAnimationEntry, - const Primitive2DSequence& rChildren, - bool bIsTextAnimation) - : AnimatedSwitchPrimitive2D(rAnimationEntry, rChildren, bIsTextAnimation), - maMatrixStack() - { - // copy matrices to locally pre-decomposed matrix stack - const sal_uInt32 nCount(rmMatrixStack.size()); - maMatrixStack.reserve(nCount); - - for(sal_uInt32 a(0L); a < nCount; a++) - { - maMatrixStack.push_back(basegfx::tools::B2DHomMatrixBufferedDecompose(rmMatrixStack[a])); - } - } - // provide unique ID ImplPrimitrive2DIDBlock(AnimatedInterpolatePrimitive2D, PRIMITIVE2D_ID_ANIMATEDINTERPOLATEPRIMITIVE2D) diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx index d95473a27805..de28e3ad74e5 100644 --- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx @@ -417,7 +417,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence PolygonTubePrimitive3D::create3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + Primitive3DSequence PolygonTubePrimitive3D::impCreate3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { const sal_uInt32 nPointCount(getB3DPolygon().count()); std::vector< BasePrimitive3D* > aResultVector; @@ -541,6 +541,7 @@ namespace drawinglayer double fDegreeStepWidth, double fMiterMinimumAngle) : PolygonHairlinePrimitive3D(rPolygon, rBColor), + maLast3DDecomposition(), mfRadius(fRadius), mfDegreeStepWidth(fDegreeStepWidth), mfMiterMinimumAngle(fMiterMinimumAngle), @@ -563,6 +564,19 @@ namespace drawinglayer return false; } + Primitive3DSequence PolygonTubePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const + { + ::osl::MutexGuard aGuard( m_aMutex ); + + if(!getLast3DDecomposition().hasElements()) + { + const Primitive3DSequence aNewSequence(impCreate3DDecomposition(rViewInformation)); + const_cast< PolygonTubePrimitive3D* >(this)->setLast3DDecomposition(aNewSequence); + } + + return getLast3DDecomposition(); + } + // provide unique ID ImplPrimitrive3DIDBlock(PolygonTubePrimitive3D, PRIMITIVE3D_ID_POLYGONTUBEPRIMITIVE3D) diff --git a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx index d1b473bd4f5a..2deaf474e12e 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx @@ -53,10 +53,6 @@ namespace drawinglayer basegfx::B2DHomMatrix maTransform; attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute; - protected: - // local decomposition. - virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; - public: SdrOle2Primitive2D( const Primitive2DSequence& rOLEContent, @@ -71,6 +67,9 @@ namespace drawinglayer // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + // local decomposition. + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + // provide unique ID DeclPrimitrive2DIDBlock() }; diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index d16b6d813c62..86f7f0990de8 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -46,7 +46,35 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SdrOle2Primitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const + SdrOle2Primitive2D::SdrOle2Primitive2D( + const Primitive2DSequence& rOLEContent, + const basegfx::B2DHomMatrix& rTransform, + const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute) + : BasePrimitive2D(), + maOLEContent(rOLEContent), + maTransform(rTransform), + maSdrLFSTAttribute(rSdrLFSTAttribute) + { + } + + bool SdrOle2Primitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(BasePrimitive2D::operator==(rPrimitive)) + { + const SdrOle2Primitive2D& rCompare = (SdrOle2Primitive2D&)rPrimitive; + + if(getOLEContent() == rCompare.getOLEContent() + && getTransform() == rCompare.getTransform() + && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()) + { + return true; + } + } + + return false; + } + + Primitive2DSequence SdrOle2Primitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { // to take care of getSdrLFSTAttribute() later, the same as in SdrGrafPrimitive2D::create2DDecomposition // should happen. For the moment we only need the OLE itself @@ -122,34 +150,6 @@ namespace drawinglayer return aRetval; } - SdrOle2Primitive2D::SdrOle2Primitive2D( - const Primitive2DSequence& rOLEContent, - const basegfx::B2DHomMatrix& rTransform, - const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute) - : BasePrimitive2D(), - maOLEContent(rOLEContent), - maTransform(rTransform), - maSdrLFSTAttribute(rSdrLFSTAttribute) - { - } - - bool SdrOle2Primitive2D::operator==(const BasePrimitive2D& rPrimitive) const - { - if(BasePrimitive2D::operator==(rPrimitive)) - { - const SdrOle2Primitive2D& rCompare = (SdrOle2Primitive2D&)rPrimitive; - - if(getOLEContent() == rCompare.getOLEContent() - && getTransform() == rCompare.getTransform() - && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()) - { - return true; - } - } - - return false; - } - // provide unique ID ImplPrimitrive2DIDBlock(SdrOle2Primitive2D, PRIMITIVE2D_ID_SDROLE2PRIMITIVE2D) -- cgit v1.2.3 From 407f7ae14844d0e55b9f0f87a19a7208762b05ed Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 7 Oct 2009 14:25:40 +0200 Subject: #i105323# added FastPath for 3D scene HitTest for 3d CustomShapes by re-using the buffered last render result from the ScenePrimitive2D --- .../drawinglayer/primitive2d/sceneprimitive2d.hxx | 17 ++- .../source/primitive2d/sceneprimitive2d.cxx | 116 +++++++++----- .../source/processor2d/hittestprocessor2d.cxx | 169 +++++++++++---------- svx/inc/svx/svddrgmt.hxx | 20 +++ svx/source/svdraw/svddrgmt.cxx | 50 +++++- 5 files changed, 255 insertions(+), 117 deletions(-) (limited to 'drawinglayer/inc/drawinglayer/primitive2d') diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx index 1cb433e6bff1..a86e32adca26 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx @@ -41,6 +41,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -70,9 +71,13 @@ namespace drawinglayer double mfOldDiscreteSizeY; basegfx::B2DRange maOldUnitVisiblePart; + // the last created BitmapEx, e.g. for fast HitTest. This does not really need + // memory since BitmapEx is internally RefCounted + BitmapEx maOldRenderedBitmap; + // private helpers bool impGetShadow3D(const geometry::ViewInformation2D& rViewInformation) const; - void calculateDsicreteSizes( + void calculateDiscreteSizes( const geometry::ViewInformation2D& rViewInformation, basegfx::B2DRange& rDiscreteRange, basegfx::B2DRange& rVisibleDiscreteRange, @@ -90,6 +95,16 @@ namespace drawinglayer Primitive2DSequence getGeometry2D() const; Primitive2DSequence getShadow2D(const geometry::ViewInformation2D& rViewInformation) const; + // Fast HitTest which uses the last buffered BitmapEx from the last + // rendered area if available. The return value describes if the check + // could be done with the current information, so do NOT use o_rResult + // when it returns false. o_rResult will be changed on return true and + // then contains a definitive answer if content of this scene is hit or + // not. On return false, it is normally necessary to use the geometric + // HitTest (see CutFindProcessor usages). The given HitPoint + // has to be in logic coordinates in scene's ObjectCoordinateSystem. + bool tryToCheckLastVisualisationDirectHit(const basegfx::B2DPoint& rLogicHitPoint, bool& o_rResult) const; + // constructor/destructor ScenePrimitive2D( const primitive3d::Primitive3DSequence& rxChildren3D, diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 7fa9fdec336c..6b346d5abdc0 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -100,7 +100,7 @@ namespace drawinglayer return maShadowPrimitives.hasElements(); } - void ScenePrimitive2D::calculateDsicreteSizes( + void ScenePrimitive2D::calculateDiscreteSizes( const geometry::ViewInformation2D& rViewInformation, basegfx::B2DRange& rDiscreteRange, basegfx::B2DRange& rVisibleDiscreteRange, @@ -110,23 +110,12 @@ namespace drawinglayer rDiscreteRange = basegfx::B2DRange(0.0, 0.0, 1.0, 1.0); rDiscreteRange.transform(rViewInformation.getObjectToViewTransformation() * getObjectTransformation()); - // force to discrete expanded bounds (it grows, so expanding works perfectly well) - rDiscreteRange.expand(basegfx::B2DTuple(floor(rDiscreteRange.getMinX()), floor(rDiscreteRange.getMinY()))); - rDiscreteRange.expand(basegfx::B2DTuple(ceil(rDiscreteRange.getMaxX()), ceil(rDiscreteRange.getMaxY()))); - // clip it against discrete Viewport (if set) rVisibleDiscreteRange = rDiscreteRange; if(!rViewInformation.getViewport().isEmpty()) { rVisibleDiscreteRange.intersect(rViewInformation.getDiscreteViewport()); - - if(!rVisibleDiscreteRange.isEmpty()) - { - // force to discrete expanded bounds, too - rVisibleDiscreteRange.expand(basegfx::B2DTuple(floor(rVisibleDiscreteRange.getMinX()), floor(rVisibleDiscreteRange.getMinY()))); - rVisibleDiscreteRange.expand(basegfx::B2DTuple(ceil(rVisibleDiscreteRange.getMaxX()), ceil(rVisibleDiscreteRange.getMaxY()))); - } } if(rVisibleDiscreteRange.isEmpty()) @@ -177,11 +166,11 @@ namespace drawinglayer } } - // get the involved ranges (see helper method calculateDsicreteSizes for details) + // get the involved ranges (see helper method calculateDiscreteSizes for details) basegfx::B2DRange aDiscreteRange; basegfx::B2DRange aVisibleDiscreteRange; basegfx::B2DRange aUnitVisibleRange; - calculateDsicreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); + calculateDiscreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); if(!aVisibleDiscreteRange.isEmpty()) { @@ -204,11 +193,25 @@ namespace drawinglayer { // when reducing the visualisation is allowed (e.g. an OverlayObject // only needed for dragging), reduce resolution extra - // to speed up dragging interactions (1/4th currently) - const double fReducedVisualisationFactor(0.25); - fReduceFactor *= fReducedVisualisationFactor; - fViewSizeX *= fReducedVisualisationFactor; - fViewSizeY *= fReducedVisualisationFactor; + // to speed up dragging interactions + const double fArea(fViewSizeX * fViewSizeY); + double fReducedVisualisationFactor(1.0 / (sqrt(fArea) * (1.0 / 170.0))); + + if(fReducedVisualisationFactor > 1.0) + { + fReducedVisualisationFactor = 1.0; + } + else if(fReducedVisualisationFactor < 0.20) + { + fReducedVisualisationFactor = 0.20; + } + + if(fReducedVisualisationFactor != 1.0) + { + fReduceFactor *= fReducedVisualisationFactor; + fViewSizeX *= fReducedVisualisationFactor; + fViewSizeY *= fReducedVisualisationFactor; + } } // calculate logic render size in world coordinates for usage in renderer @@ -234,18 +237,16 @@ namespace drawinglayer aZBufferProcessor3D.processNonTransparent(getChildren3D()); aZBufferProcessor3D.processTransparent(getChildren3D()); - const BitmapEx aNewBitmap(aZBufferProcessor3D.getBitmapEx()); - const Size aBitmapSizePixel(aNewBitmap.GetSizePixel()); + const_cast< ScenePrimitive2D* >(this)->maOldRenderedBitmap = aZBufferProcessor3D.getBitmapEx(); + const Size aBitmapSizePixel(maOldRenderedBitmap.GetSizePixel()); if(aBitmapSizePixel.getWidth() && aBitmapSizePixel.getHeight()) { // create transform for the created bitmap in discrete coordinates first. - // #i97772# Do not forget to apply evtl. render size reduction to scaling basegfx::B2DHomMatrix aNew2DTransform; - const double fSizeReductionFactor(1.0 / fReduceFactor); - aNew2DTransform.set(0, 0, (double)(aBitmapSizePixel.getWidth() - 1) * fSizeReductionFactor); - aNew2DTransform.set(1, 1, (double)(aBitmapSizePixel.getHeight() - 1) * fSizeReductionFactor); + aNew2DTransform.set(0, 0, aVisibleDiscreteRange.getWidth()); + aNew2DTransform.set(1, 1, aVisibleDiscreteRange.getHeight()); aNew2DTransform.set(0, 2, aVisibleDiscreteRange.getMinX()); aNew2DTransform.set(1, 2, aVisibleDiscreteRange.getMinY()); @@ -253,7 +254,7 @@ namespace drawinglayer aNew2DTransform *= rViewInformation.getInverseObjectToViewTransformation(); // create bitmap primitive and add - const Primitive2DReference xRef(new BitmapPrimitive2D(aNewBitmap, aNew2DTransform)); + const Primitive2DReference xRef(new BitmapPrimitive2D(maOldRenderedBitmap, aNew2DTransform)); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xRef); // test: Allow to add an outline in the debugger when tests are needed @@ -308,6 +309,47 @@ namespace drawinglayer return aRetval; } + bool ScenePrimitive2D::tryToCheckLastVisualisationDirectHit(const basegfx::B2DPoint& rLogicHitPoint, bool& o_rResult) const + { + if(!maOldRenderedBitmap.IsEmpty() && !maOldUnitVisiblePart.isEmpty()) + { + basegfx::B2DHomMatrix aInverseSceneTransform(getObjectTransformation()); + aInverseSceneTransform.invert(); + const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * rLogicHitPoint); + + if(maOldUnitVisiblePart.isInside(aRelativePoint)) + { + // calculate coordinates relative to visualized part + double fDivisorX(maOldUnitVisiblePart.getWidth()); + double fDivisorY(maOldUnitVisiblePart.getHeight()); + + if(basegfx::fTools::equalZero(fDivisorX)) + { + fDivisorX = 1.0; + } + + if(basegfx::fTools::equalZero(fDivisorY)) + { + fDivisorY = 1.0; + } + + const double fRelativeX((aRelativePoint.getX() - maOldUnitVisiblePart.getMinX()) / fDivisorX); + const double fRelativeY((aRelativePoint.getY() - maOldUnitVisiblePart.getMinY()) / fDivisorY); + + // combine with real BitmapSizePixel to get bitmap coordinates + const Size aBitmapSizePixel(maOldRenderedBitmap.GetSizePixel()); + const sal_Int32 nX(basegfx::fround(fRelativeX * aBitmapSizePixel.Width())); + const sal_Int32 nY(basegfx::fround(fRelativeY * aBitmapSizePixel.Height())); + + // try to get a statement about transparency in that pixel + o_rResult = (0xff != maOldRenderedBitmap.GetTransparency(nX, nY)); + return true; + } + } + + return false; + } + ScenePrimitive2D::ScenePrimitive2D( const primitive3d::Primitive3DSequence& rxChildren3D, const attribute::SdrSceneAttribute& rSdrSceneAttribute, @@ -324,7 +366,8 @@ namespace drawinglayer mbShadow3DChecked(false), mfOldDiscreteSizeX(0.0), mfOldDiscreteSizeY(0.0), - maOldUnitVisiblePart() + maOldUnitVisiblePart(), + maOldRenderedBitmap() { } @@ -375,7 +418,7 @@ namespace drawinglayer { ::osl::MutexGuard aGuard( m_aMutex ); - // get the involved ranges (see helper method calculateDsicreteSizes for details) + // get the involved ranges (see helper method calculateDiscreteSizes for details) basegfx::B2DRange aDiscreteRange; basegfx::B2DRange aUnitVisibleRange; bool bNeedNewDecomposition(false); @@ -384,21 +427,22 @@ namespace drawinglayer if(getBuffered2DDecomposition().hasElements()) { basegfx::B2DRange aVisibleDiscreteRange; - calculateDsicreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); + calculateDiscreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); bDiscreteSizesAreCalculated = true; - // display has changed and cannot be reused when resolution did change - if(!basegfx::fTools::equal(aDiscreteRange.getWidth(), mfOldDiscreteSizeX) || - !basegfx::fTools::equal(aDiscreteRange.getHeight(), mfOldDiscreteSizeY)) + // needs to be painted when the new part is not part of the last + // decomposition + if(!maOldUnitVisiblePart.isInside(aUnitVisibleRange)) { bNeedNewDecomposition = true; } + // display has changed and cannot be reused when resolution got bigger. It + // can be reused when resolution got smaller, though. if(!bNeedNewDecomposition) { - // needs to be painted when the new part is not part of the last - // decomposition - if(!maOldUnitVisiblePart.isInside(aUnitVisibleRange)) + if(basegfx::fTools::more(aDiscreteRange.getWidth(), mfOldDiscreteSizeX) || + basegfx::fTools::more(aDiscreteRange.getHeight(), mfOldDiscreteSizeY)) { bNeedNewDecomposition = true; } @@ -416,7 +460,7 @@ namespace drawinglayer if(!bDiscreteSizesAreCalculated) { basegfx::B2DRange aVisibleDiscreteRange; - calculateDsicreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); + calculateDiscreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); } // remember last used NewDiscreteSize and NewUnitVisiblePart diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index 98bbe2a82cb8..09eb6e3e71f6 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -170,102 +170,113 @@ namespace drawinglayer { // calculate relative point in unified 2D scene const basegfx::B2DPoint aLogicHitPosition(getViewInformation2D().getInverseObjectToViewTransformation() * getDiscreteHitPosition()); - basegfx::B2DHomMatrix aInverseSceneTransform(rCandidate.getObjectTransformation()); - aInverseSceneTransform.invert(); - const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * aLogicHitPosition); - // check if test point is inside scene's unified area at all - if(aRelativePoint.getX() >= 0.0 && aRelativePoint.getX() <= 1.0 - && aRelativePoint.getY() >= 0.0 && aRelativePoint.getY() <= 1.0) - { - // get 3D view information - const geometry::ViewInformation3D& rObjectViewInformation3D = rCandidate.getViewInformation3D(); + // use bitmap check in ScenePrimitive2D + bool bTryFastResult(false); - // create HitPoint Front and Back, transform to object coordinates - basegfx::B3DHomMatrix aViewToObject(rObjectViewInformation3D.getObjectToView()); - aViewToObject.invert(); - const basegfx::B3DPoint aFront(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 0.0)); - const basegfx::B3DPoint aBack(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 1.0)); + if(rCandidate.tryToCheckLastVisualisationDirectHit(aLogicHitPosition, bTryFastResult)) + { + mbHit = bTryFastResult; + } + else + { + basegfx::B2DHomMatrix aInverseSceneTransform(rCandidate.getObjectTransformation()); + aInverseSceneTransform.invert(); + const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * aLogicHitPosition); - if(!aFront.equal(aBack)) + // check if test point is inside scene's unified area at all + if(aRelativePoint.getX() >= 0.0 && aRelativePoint.getX() <= 1.0 + && aRelativePoint.getY() >= 0.0 && aRelativePoint.getY() <= 1.0) { - const primitive3d::Primitive3DSequence& rPrimitives = rCandidate.getChildren3D(); + // get 3D view information + const geometry::ViewInformation3D& rObjectViewInformation3D = rCandidate.getViewInformation3D(); + + // create HitPoint Front and Back, transform to object coordinates + basegfx::B3DHomMatrix aViewToObject(rObjectViewInformation3D.getObjectToView()); + aViewToObject.invert(); + const basegfx::B3DPoint aFront(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 0.0)); + const basegfx::B3DPoint aBack(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 1.0)); - if(rPrimitives.hasElements()) + if(!aFront.equal(aBack)) { - // make BoundVolume empty and overlapping test for speedup - const basegfx::B3DRange aObjectRange( - drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence( - rPrimitives, rObjectViewInformation3D)); + const primitive3d::Primitive3DSequence& rPrimitives = rCandidate.getChildren3D(); - if(!aObjectRange.isEmpty()) + if(rPrimitives.hasElements()) { - const basegfx::B3DRange aFrontBackRange(aFront, aBack); + // make BoundVolume empty and overlapping test for speedup + const basegfx::B3DRange aObjectRange( + drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence( + rPrimitives, rObjectViewInformation3D)); - if(aObjectRange.overlaps(aFrontBackRange)) + if(!aObjectRange.isEmpty()) { - // bound volumes hit, geometric cut tests needed - drawinglayer::processor3d::CutFindProcessor aCutFindProcessor( - rObjectViewInformation3D, - aFront, - aBack, - true); - aCutFindProcessor.process(rPrimitives); - - mbHit = (0 != aCutFindProcessor.getCutPoints().size()); + const basegfx::B3DRange aFrontBackRange(aFront, aBack); + + if(aObjectRange.overlaps(aFrontBackRange)) + { + // bound volumes hit, geometric cut tests needed + drawinglayer::processor3d::CutFindProcessor aCutFindProcessor( + rObjectViewInformation3D, + aFront, + aBack, + true); + aCutFindProcessor.process(rPrimitives); + + mbHit = (0 != aCutFindProcessor.getCutPoints().size()); + } } } } } - } - // This is needed to check hit with 3D shadows, too. HitTest is without shadow - // to keep compatible with previous versions. Keeping here as reference - // - // if(!getHit()) - // { - // // if scene has shadow, check hit with shadow, too - // const primitive2d::Primitive2DSequence xExtracted2DSceneShadow(rCandidate.getShadow2D(getViewInformation2D())); - // - // if(xExtracted2DSceneShadow.hasElements()) - // { - // // proccess extracted 2D content - // process(xExtracted2DSceneShadow); - // } - // } - - if(!getHit()) - { - // empty 3D scene; Check for border hit - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); - aOutline.transform(rCandidate.getObjectTransformation()); + // This is needed to check hit with 3D shadows, too. HitTest is without shadow + // to keep compatible with previous versions. Keeping here as reference + // + // if(!getHit()) + // { + // // if scene has shadow, check hit with shadow, too + // const primitive2d::Primitive2DSequence xExtracted2DSceneShadow(rCandidate.getShadow2D(getViewInformation2D())); + // + // if(xExtracted2DSceneShadow.hasElements()) + // { + // // proccess extracted 2D content + // process(xExtracted2DSceneShadow); + // } + // } + + if(!getHit()) + { + // empty 3D scene; Check for border hit + basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + aOutline.transform(rCandidate.getObjectTransformation()); - mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); - } + mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); + } - // This is what the previous version did. Keeping it here for reference - // - // // 2D Scene primitive containing 3D stuff; extract 2D contour in world coordinates - // // This may be refined later to an own 3D HitTest renderer which processes the 3D - // // geometry directly - // const primitive2d::ScenePrimitive2D& rScenePrimitive2DCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); - // const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D()); - // const primitive2d::Primitive2DSequence xExtracted2DSceneShadow(rScenePrimitive2DCandidate.getShadow2D(getViewInformation2D())); - // - // if(xExtracted2DSceneGeometry.hasElements() || xExtracted2DSceneShadow.hasElements()) - // { - // // proccess extracted 2D content - // process(xExtracted2DSceneGeometry); - // process(xExtracted2DSceneShadow); - // } - // else - // { - // // empty 3D scene; Check for border hit - // const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); - // basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); - // - // mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); - // } + // This is what the previous version did. Keeping it here for reference + // + // // 2D Scene primitive containing 3D stuff; extract 2D contour in world coordinates + // // This may be refined later to an own 3D HitTest renderer which processes the 3D + // // geometry directly + // const primitive2d::ScenePrimitive2D& rScenePrimitive2DCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); + // const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D()); + // const primitive2d::Primitive2DSequence xExtracted2DSceneShadow(rScenePrimitive2DCandidate.getShadow2D(getViewInformation2D())); + // + // if(xExtracted2DSceneGeometry.hasElements() || xExtracted2DSceneShadow.hasElements()) + // { + // // proccess extracted 2D content + // process(xExtracted2DSceneGeometry); + // process(xExtracted2DSceneShadow); + // } + // else + // { + // // empty 3D scene; Check for border hit + // const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); + // basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); + // + // mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); + // } + } } void HitTestProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) 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/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 254e5daa741f..b953e68a753d 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -207,6 +207,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) @@ -319,6 +345,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()); @@ -360,7 +393,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) @@ -1349,6 +1382,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())); -- cgit v1.2.3 From 95ccca996e41c0ff9fa70fb5007f06796a98bc1c Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 28 Oct 2009 16:56:00 +0100 Subject: #i105323# added documentation to primitives --- .../drawinglayer/primitive2d/alphaprimitive2d.hxx | 19 ++- .../primitive2d/animatedprimitive2d.hxx | 67 ++++++--- .../primitive2d/backgroundcolorprimitive2d.hxx | 27 +++- .../drawinglayer/primitive2d/baseprimitive2d.hxx | 23 +-- .../primitive2d/borderlineprimitive2d.hxx | 29 +++- .../drawinglayer/primitive2d/chartprimitive2d.hxx | 6 + .../primitive2d/controlprimitive2d.hxx | 47 +++--- .../primitive2d/embedded3dprimitive2d.hxx | 53 ++++--- .../primitive2d/fillbitmapprimitive2d.hxx | 27 +++- .../primitive2d/fillgradientprimitive2d.hxx | 22 ++- .../primitive2d/fillhatchprimitive2d.hxx | 27 +++- .../primitive2d/graphicprimitive2d.hxx | 31 +++- .../drawinglayer/primitive2d/gridprimitive2d.hxx | 34 +++-- .../drawinglayer/primitive2d/groupprimitive2d.hxx | 16 ++- .../primitive2d/helplineprimitive2d.hxx | 34 ++++- .../primitive2d/hittestprimitive2d.hxx | 34 +++-- .../drawinglayer/primitive2d/invertprimitive2d.hxx | 13 +- .../primitive2d/markerarrayprimitive2d.hxx | 29 +++- .../drawinglayer/primitive2d/maskprimitive2d.hxx | 22 ++- .../drawinglayer/primitive2d/mediaprimitive2d.hxx | 27 +++- .../primitive2d/metafileprimitive2d.hxx | 32 ++++- .../primitive2d/modifiedcolorprimitive2d.hxx | 25 +++- .../primitive2d/pagepreviewprimitive2d.hxx | 41 +++--- .../primitive2d/pointarrayprimitive2d.hxx | 26 +++- .../primitive2d/polygonprimitive2d.hxx | 113 +++++++++++---- .../primitive2d/polypolygonprimitive2d.hxx | 158 ++++++++++++++++----- .../drawinglayer/primitive2d/primitivetools2d.hxx | 46 +++--- .../drawinglayer/primitive2d/sceneprimitive2d.hxx | 93 +++++++----- .../drawinglayer/primitive2d/shadowprimitive2d.hxx | 28 +++- .../primitive2d/structuretagprimitive2d.hxx | 28 ++-- .../primitive2d/textdecoratedprimitive2d.hxx | 36 +++-- .../primitive2d/texteffectprimitive2d.hxx | 34 +++-- .../primitive2d/texthierarchyprimitive2d.hxx | 94 ++++++++---- .../drawinglayer/primitive2d/textlayoutdevice.hxx | 31 ++-- .../drawinglayer/primitive2d/textprimitive2d.hxx | 77 +++++++--- .../primitive2d/transformprimitive2d.hxx | 29 +++- .../primitive2d/unifiedalphaprimitive2d.hxx | 21 ++- .../primitive2d/wrongspellprimitive2d.hxx | 26 +++- .../drawinglayer/primitive3d/baseprimitive3d.hxx | 25 ++-- .../drawinglayer/primitive3d/groupprimitive3d.hxx | 16 ++- .../primitive3d/hatchtextureprimitive3d.hxx | 16 ++- .../primitive3d/hittestprimitive3d.hxx | 38 ++--- .../primitive3d/modifiedcolorprimitive3d.hxx | 15 +- .../primitive3d/polygonprimitive3d.hxx | 41 ++++-- .../primitive3d/polygontubeprimitive3d.hxx | 20 ++- .../primitive3d/polypolygonprimitive3d.hxx | 22 ++- .../primitive3d/sdrcubeprimitive3d.hxx | 15 +- .../primitive3d/sdrdecompositiontools3d.hxx | 1 + .../primitive3d/sdrextrudelathetools3d.hxx | 10 +- .../primitive3d/sdrextrudeprimitive3d.hxx | 36 +++-- .../primitive3d/sdrlatheprimitive3d.hxx | 38 +++-- .../primitive3d/sdrpolypolygonprimitive3d.hxx | 23 ++- .../drawinglayer/primitive3d/sdrprimitive3d.hxx | 22 +-- .../primitive3d/sdrsphereprimitive3d.hxx | 18 ++- .../drawinglayer/primitive3d/shadowprimitive3d.hxx | 20 ++- .../primitive3d/textureprimitive3d.hxx | 74 +++++++--- .../primitive3d/transformprimitive3d.hxx | 19 ++- 57 files changed, 1447 insertions(+), 547 deletions(-) (limited to 'drawinglayer/inc/drawinglayer/primitive2d') diff --git a/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx index 79518eb82358..10288b70bd1b 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx @@ -54,7 +54,12 @@ namespace drawinglayer The basic definition is to use the Alpha content as Alpha-Mask by interpreting the Alpha-content not as RGB, but as Luminance alpha mask - using the common RGB_to_luminance definition as e.g. used by VCL + using the common RGB_to_luminance definition as e.g. used by VCL. + + The defining geometry is the Range of the child primitive sequence, + this means the renderers will/shall use this geometric information for + rendering, not the alpha one. The alpha one should/will be clipped + accordingly. */ class AlphaPrimitive2D : public GroupPrimitive2D { @@ -63,7 +68,17 @@ namespace drawinglayer Primitive2DSequence maAlpha; public: - /// constructor + /** constructor + + @param rChildren + The content which is defined to have a transparency. The + range of this primitive is defined by this content + + @param rAlpha + The definition of the Alpha-channel for this primitive. It + will be interpreted as mask by interpreting as gray values + using the common RGB_to_luminance definitions + */ AlphaPrimitive2D( const Primitive2DSequence& rChildren, const Primitive2DSequence& rAlpha); diff --git a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx index c42853fe54b2..cd6133dc54d8 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/animatedprimitive2d.hxx @@ -52,39 +52,59 @@ namespace drawinglayer { namespace primitive2d { + /** AnimatedSwitchPrimitive2D class + + This is the basic class for simple, animated primitives. The basic idea + is to have an animation definition (AnimationEntry) who's basic + functionality is to return a state value for any given animation time in + the range of [0.0 .. 1.0]. Depending on the state, the decomposition + calculates an index, which of the members of the child vector is to + be visualized. + + An example: For blinking, the Child vector should exist of two entries; + for values of [0.0 .. 0.5] the first, else the last entry will be used. + This mechanism is not limited to two entries, though. + */ class AnimatedSwitchPrimitive2D : public GroupPrimitive2D { private: - // the animation definition which allows translation of a point in time - // to an animation state [0.0 .. 1.0]. This member contains a cloned - // definition and is owned by this implementation + /** + The animation definition which allows translation of a point in time + to an animation state [0.0 .. 1.0]. This member contains a cloned + definition and is owned by this implementation. + */ animation::AnimationEntry* mpAnimationEntry; - // bitfield - // flag if this is a text or graphic animation. Necessary since SdrViews need to differentiate - // between both types if they are on/off + /// bitfield + /** flag if this is a text or graphic animation. Necessary since SdrViews need to differentiate + between both types if they are on/off + */ unsigned mbIsTextAnimation : 1; public: + /// constructor AnimatedSwitchPrimitive2D( const animation::AnimationEntry& rAnimationEntry, const Primitive2DSequence& rChildren, bool bIsTextAnimation); + + /// destructor - needed due to mpAnimationEntry virtual ~AnimatedSwitchPrimitive2D(); - // get data + /// data read access const animation::AnimationEntry& getAnimationEntry() const { return *mpAnimationEntry; } bool isTextAnimation() const { return mbIsTextAnimation; } bool isGraphicAnimation() const { return !isTextAnimation(); } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() - // The getDecomposition is overloaded here since the decompose is dependent of the point in time, - // so the default implementation is nut useful here, it needs to be handled locally + /** The getDecomposition is overloaded here since the decompose is dependent of the point in time, + so the default implementation is nut useful here, it needs to be handled locally + */ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; }; } // end of namespace primitive2d @@ -96,19 +116,26 @@ namespace drawinglayer { namespace primitive2d { + /** AnimatedBlinkPrimitive2D class + + Basically the same mechanism as in AnimatedSwitchPrimitive2D, but the + decomposition is specialized in delivering the children in the + range [0.0.. 0.5] and an empty sequence else + */ class AnimatedBlinkPrimitive2D : public AnimatedSwitchPrimitive2D { protected: public: + /// constructor AnimatedBlinkPrimitive2D( const animation::AnimationEntry& rAnimationEntry, const Primitive2DSequence& rChildren, bool bIsTextAnimation); - // create local decomposition + /// create local decomposition virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -120,24 +147,32 @@ namespace drawinglayer { namespace primitive2d { + /** AnimatedInterpolatePrimitive2D class + + Specialized on multi-step animations based on matrix transformations. The + Child sequelce will be embedded in a matrix transformation. That transformation + will be linearly combined from the decomposed values and the animation value + to allow a smooth animation. + */ class AnimatedInterpolatePrimitive2D : public AnimatedSwitchPrimitive2D { private: - // the transformations + /// the transformations std::vector< basegfx::tools::B2DHomMatrixBufferedDecompose > maMatrixStack; protected: public: + /// constructor AnimatedInterpolatePrimitive2D( const std::vector< basegfx::B2DHomMatrix >& rmMatrixStack, const animation::AnimationEntry& rAnimationEntry, const Primitive2DSequence& rChildren, bool bIsTextAnimation); - // create local decomposition + /// create local decomposition virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx index 7b998fd3e749..82a568fc9ea1 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx @@ -46,35 +46,48 @@ namespace drawinglayer { namespace primitive2d { + /** AnimatedInterpolatePrimitive2D class + + This primitive is defined to fill the whole visible Viewport with + the given color (and thus decomposes to a filled polygon). This + makes it a view-depnendent primitive by definition. It only has + a valid decomposition if a valid Viewport is given in the + ViewInformation2D at decomposition time. + + It will try to buffer it's last decomposition using maLastViewport + to detect changes in the get2DDecomposition call. + */ class BackgroundColorPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the fill color to use basegfx::BColor maBColor; - // the last used viewInformation, used from getDecomposition for buffering + /// the last used viewInformation, used from getDecomposition for buffering basegfx::B2DRange maLastViewport; protected: - // create local decomposition + /// create local decomposition virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor BackgroundColorPrimitive2D( const basegfx::BColor& rBColor); - // get data + /// data read access const basegfx::BColor& getBColor() const { return maBColor; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get 2d range + /// get B2Drange virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() - // Overload standard getDecomposition call to be view-dependent here + /// Overload standard getDecomposition call to be view-dependent here virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx index f41863f36992..6cf45ffefe54 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx @@ -76,7 +76,9 @@ namespace drawinglayer { namespace primitive2d { - /** Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D + /** BasePrimitive2D class + + Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D This class is strongly virtual due to the lack of getPrimitiveID() implementation. This is by purpose, this base class shall not be incarnated and be used directly as @@ -201,7 +203,9 @@ namespace drawinglayer { namespace primitive2d { - /** Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D + /** BufferedDecompositionPrimitive2D class + + Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D which want to buffer the decomoposition result Buffering the decomposition is the most-used buffering and is thus used my most @@ -270,23 +274,24 @@ namespace drawinglayer { namespace primitive2d { - // get B2DRange from a given Primitive2DReference + /// get B2DRange from a given Primitive2DReference basegfx::B2DRange getB2DRangeFromPrimitive2DReference(const Primitive2DReference& rCandidate, const geometry::ViewInformation2D& aViewInformation); - // get B2DRange from a given Primitive2DSequence + /// get B2DRange from a given Primitive2DSequence basegfx::B2DRange getB2DRangeFromPrimitive2DSequence(const Primitive2DSequence& rCandidate, const geometry::ViewInformation2D& aViewInformation); - // compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D) - // and using compare operator + /** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D) + and using compare operator + */ bool arePrimitive2DReferencesEqual(const Primitive2DReference& rA, const Primitive2DReference& rB); - // compare two Primitive2DReferences for equality, uses arePrimitive2DReferencesEqual internally + /// compare two Primitive2DReferences for equality, uses arePrimitive2DReferencesEqual internally bool arePrimitive2DSequencesEqual(const Primitive2DSequence& rA, const Primitive2DSequence& rB); - // concatenate sequence + /// concatenate sequence void appendPrimitive2DSequenceToPrimitive2DSequence(Primitive2DSequence& rDest, const Primitive2DSequence& rSource); - // concatenate single Primitive2D + /// concatenate single Primitive2D void appendPrimitive2DReferenceToPrimitive2DSequence(Primitive2DSequence& rDest, const Primitive2DReference& rSource); } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx index 209b0ed17e40..b13528184f3b 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx @@ -46,25 +46,41 @@ namespace drawinglayer { namespace primitive2d { + /** BorderLinePrimitive2D class + + This is the basic primitive to build frames around objects, e.g. tables. + It defines a single or double line from Start to nd using the LeftWidth, + Distance and RightWidth definitions. + The LineStart/End overlap is defined by the Extend(Inner|Outer)(Start|End) + definitions. + */ class BorderLinePrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the line definition basegfx::B2DPoint maStart; basegfx::B2DPoint maEnd; + + /// the widths of single/double line double mfLeftWidth; double mfDistance; double mfRightWidth; + + /// edge overlap sizes double mfExtendInnerStart; double mfExtendInnerEnd; double mfExtendOuterStart; double mfExtendOuterEnd; + + /// the line color basegfx::BColor maRGBColor; - // bitfield + /// bitfield + /// flags to influence inside/outside creation unsigned mbCreateInside : 1; unsigned mbCreateOutside : 1; - // helpers + /// local helpers double getCorrectedLeftWidth() const { return basegfx::fTools::equal(1.0, mfLeftWidth) ? 0.0 : mfLeftWidth; @@ -106,10 +122,11 @@ namespace drawinglayer } protected: - // create local decomposition + /// create local decomposition virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor BorderLinePrimitive2D( const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd, @@ -124,7 +141,7 @@ namespace drawinglayer bool bCreateOutside, const basegfx::BColor& rRGBColor); - // get data + /// data read access const basegfx::B2DPoint& getStart() const { return maStart; } const basegfx::B2DPoint& getEnd() const { return maEnd; } double getLeftWidth() const { return mfLeftWidth; } @@ -138,10 +155,10 @@ namespace drawinglayer bool getCreateOutside() const { return mbCreateOutside; } const basegfx::BColor& getRGBColor() const { return maRGBColor; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx index 95c53347debb..b153e04ee1cb 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx @@ -46,6 +46,12 @@ namespace drawinglayer { namespace primitive2d { + /** ChartPrimitive2D class + + This is a helper primitive which decomposes to the ChartMetaFile + visualisation. It is used to allow specific renderers to do something + direct for visualising the chart. + */ class ChartPrimitive2D : public GroupPrimitive2D { private: diff --git a/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx index 974faf506da8..5dd55405adf7 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/controlprimitive2d.hxx @@ -47,63 +47,74 @@ namespace drawinglayer { namespace primitive2d { + /** ControlPrimitive2D class + + Base class for ControlPrimitive handling. It decoposes to a + graphical representation (Bitmap data) of the control. This + representation is limited to a quadratic pixel maximum defined + in the applicatin settings. + */ class ControlPrimitive2D : public BufferedDecompositionPrimitive2D { private: - // object's base data + /// object's base data basegfx::B2DHomMatrix maTransform; com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > mxControlModel; - // the created an cached awt::XControl + /// the created an cached awt::XControl com::sun::star::uno::Reference< com::sun::star::awt::XControl > mxXControl; - // the last used scaling, used from getDecomposition for buffering + /// the last used scaling, used from getDecomposition for buffering basegfx::B2DVector maLastViewScaling; - // used from getXControl() to create a local awt::XControl which is remembered in mxXControl - // and from thereon always used and returned by getXControl() + /** used from getXControl() to create a local awt::XControl which is remembered in mxXControl + and from thereon always used and returned by getXControl() + */ void createXControl(); - // single local decompositions, used from create2DDecomposition() + /// single local decompositions, used from create2DDecomposition() Primitive2DReference createBitmapDecomposition(const geometry::ViewInformation2D& rViewInformation) const; Primitive2DReference createPlaceholderDecomposition(const geometry::ViewInformation2D& rViewInformation) const; protected: - // local decomposition + /// local decomposition virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor ControlPrimitive2D( const basegfx::B2DHomMatrix& rTransform, const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& rxControlModel); - // constructor with an additional XControl as parameter to allow to hand it over at incarnation time - // if it exists. This will avoid to create a 2nd one on demand in createXControl() - // and thus double the XControls. + /** constructor with an additional XControl as parameter to allow to hand it over at incarnation time + if it exists. This will avoid to create a 2nd one on demand in createXControl() + and thus double the XControls. + */ ControlPrimitive2D( const basegfx::B2DHomMatrix& rTransform, const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& rxControlModel, const com::sun::star::uno::Reference< com::sun::star::awt::XControl >& rxXControl); - // get data + /// data read access const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& getControlModel() const { return mxControlModel; } - // mxControl access. This will on demand create the awt::XControl using createXControl() - // if it does not exist. It may already have been created or even handed over at - // incarnation + /** mxControl access. This will on demand create the awt::XControl using createXControl() + if it does not exist. It may already have been created or even handed over at + incarnation + */ const com::sun::star::uno::Reference< com::sun::star::awt::XControl >& getXControl() const; - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() - // Overload standard getDecomposition call to be view-dependent here + /// Overload standard getDecomposition call to be view-dependent here virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx index 86540d53e325..c27b6874891f 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx @@ -42,52 +42,65 @@ #include ////////////////////////////////////////////////////////////////////////////// -// BackgroundColorPrimitive2D class +// Embedded3DPrimitive2D class namespace drawinglayer { namespace primitive2d { + /** Embedded3DPrimitive2D class + + This is a helper primitive which allows embedding of single 3D + primitives to the 2D primitive logic. It will get the scene it's + involved and thus the 3D transformation. With this information it + is able to provide 2D range data for a 3D primitive. + + This primitive will not be visualized and decomposes to a yellow + 2D rectangle to visualize that this should never be visualized + */ class Embedded3DPrimitive2D : public BufferedDecompositionPrimitive2D { private: - // the sequence of 3d primitives + /// the sequence of 3d primitives primitive3d::Primitive3DSequence mxChildren3D; - // the 2D scene object transformation + /// the 2D scene object transformation basegfx::B2DHomMatrix maObjectTransformation; - // the 3D transformations + /// the 3D transformations geometry::ViewInformation3D maViewInformation3D; - // if the embedded 3D primitives contain shadow, these parameters are needed - // to extract the shadow wich is a sequence od 2D primitives and may expand - // the 2D range. Since every single 3D object in a scene may individually - // have shadow or not, these values need to be provided and prepared. The shadow - // distance itself (a 2D transformation) is part of the 3D shadow definition + /** if the embedded 3D primitives contain shadow, these parameters are needed + to extract the shadow wich is a sequence od 2D primitives and may expand + the 2D range. Since every single 3D object in a scene may individually + have shadow or not, these values need to be provided and prepared. The shadow + distance itself (a 2D transformation) is part of the 3D shadow definition + */ basegfx::B3DVector maLightNormal; double mfShadowSlant; basegfx::B3DRange maScene3DRange; - // the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked) + /// the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked) Primitive2DSequence maShadowPrimitives; - // #i96669# add simple range buffering for this primitive + /// #i96669# add simple range buffering for this primitive basegfx::B2DRange maB2DRange; - // bitfield - // flag if given 3D geometry is already cheched for shadow definitions and 2d shadows - // are created in maShadowPrimitives + /// bitfield + /** flag if given 3D geometry is already cheched for shadow definitions and 2d shadows + are created in maShadowPrimitives + */ unsigned mbShadow3DChecked : 1; - // private helpers + /// private helpers bool impGetShadow3D(const geometry::ViewInformation2D& rViewInformation) const; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor Embedded3DPrimitive2D( const primitive3d::Primitive3DSequence& rxChildren3D, const basegfx::B2DHomMatrix& rObjectTransformation, @@ -96,7 +109,7 @@ namespace drawinglayer double fShadowSlant, const basegfx::B3DRange& rScene3DRange); - // get data + /// get data const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; } const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; } @@ -104,13 +117,13 @@ namespace drawinglayer double getShadowSlant() const { return mfShadowSlant; } const basegfx::B3DRange& getScene3DRange() const { return maScene3DRange; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx index c2d305b78c11..7d2b084a9356 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx @@ -47,32 +47,49 @@ namespace drawinglayer { namespace primitive2d { + /** FillBitmapPrimitive2D class + + This class defines a bitmap filling for a rectangular area. The + Range is defined by the Transformation, the fill by the FillBitmapAttribute. + There, the fill consists of a Bitmap (not transparent) defining the fill data + and a Point/Vector pair defining the relative position/size [0.0 .. 1.0] + inside the area where the bitmap is positioned. A flag defines then if this + is tiled or not. + + Renderers should handle this primitive; it has a geometrically correct + decomposition, but on pixel oututs the areas where the tiled pieces are + aligned tend to show up (one overlapping or empty pixel) + */ class FillBitmapPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the geometric definition basegfx::B2DHomMatrix maTransformation; + + /// the fill attributes attribute::FillBitmapAttribute maFillBitmap; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor FillBitmapPrimitive2D( const basegfx::B2DHomMatrix& rTransformation, const attribute::FillBitmapAttribute& rFillBitmap); - // get data + /// data read access const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; } const attribute::FillBitmapAttribute& getFillBitmap() const { return maFillBitmap; } - // compare operator + /// compare operator virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx index f995bb487b33..d6853e69b149 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx @@ -46,32 +46,44 @@ namespace drawinglayer { namespace primitive2d { + /** FillGradientPrimitive2D class + + This class defines a gradient filling for a rectangular area. The + Range is defined by the Transformation, the gradient by the FillGradientAttribute. + + The decomposition will deliver the decomposed gradient, e.g. for an ellipse + gradient the various ellipses in various color steps will be created. + */ class FillGradientPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the geometric definition basegfx::B2DRange maObjectRange; + + /// the gradient definition attribute::FillGradientAttribute maFillGradient; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor FillGradientPrimitive2D( const basegfx::B2DRange& rObjectRange, const attribute::FillGradientAttribute& rFillGradient); - // get data + /// data read access const basegfx::B2DRange& getObjectRange() const { return maObjectRange; } const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx index 6181630e948d..1df3bb103eb0 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx @@ -40,41 +40,56 @@ #include ////////////////////////////////////////////////////////////////////////////// -// FillbitmapPrimitive2D class +// FillHatchPrimitive2D class namespace drawinglayer { namespace primitive2d { + /** FillHatchPrimitive2D class + + This class defines a hatch filling for a rectangular area. The + Range is defined by the Transformation, the hatch by the FillHatchAttribute. + If the background is to be filled, a flag in FillHatchAttribute is set and + the BColor defines the background color. + + The decomposition will deliver the hatch lines. + */ class FillHatchPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the geometric definition basegfx::B2DRange maObjectRange; + + /// the hatch definition attribute::FillHatchAttribute maFillHatch; + + /// hatch background color (if used) basegfx::BColor maBColor; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor FillHatchPrimitive2D( const basegfx::B2DRange& rObjectRange, const basegfx::BColor& rBColor, const attribute::FillHatchAttribute& rFillHatch); - // get data + /// data read access const basegfx::B2DRange& getObjectRange() const { return maObjectRange; } const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; } const basegfx::BColor& getBColor() const { return maBColor; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx index 33923eebc259..e6adcacc97e0 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx @@ -46,18 +46,39 @@ namespace drawinglayer { namespace primitive2d { + /** GraphicPrimitive2D class + + Primitive to hold graphics defined by GraphicObject and GraphicAttr + combination. This includes MetaFiles and diverse pixel-oriented graphic + formats. It even includes animated GIFs, Croppings and other changes + defined in GraphicAttr. + + This makes the decomposition contain a wide variety of possibilites, + too. From a simple BitmapPrimitive over AnimatedSwitchPrimitive2D, + MetafilePrimitive2D (with and without embedding in a masking when e.g. + the Metafile is bigger than the geometry) and embeddings in + TransformPrimitive2D and MaskPrimitive2D for croppings. + + The primitive geometry area is defined by Transform. + */ class GraphicPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the geometric definition basegfx::B2DHomMatrix maTransform; + + /// the GraphicObject with all it's content possibilities GraphicObject maGraphicObject; + + /// The GraphicAttr with all it's modification possibilities GraphicAttr maGraphicAttr; protected: - // local decomposition + /// local decomposition virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor(s) GraphicPrimitive2D( const basegfx::B2DHomMatrix& rTransform, const GraphicObject& rGraphicObject, @@ -66,19 +87,19 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rTransform, const GraphicObject& rGraphicObject); - // get data + /// data read access const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } const GraphicObject& getGraphicObject() const { return maGraphicObject; } const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; } bool isTransparent() const; - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx index d2b90e271cda..4ba83fc75c88 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx @@ -48,29 +48,47 @@ namespace drawinglayer { namespace primitive2d { + /** GridPrimitive2D class + + This primitive is specialized to Grid visualisation. The graphic definition + (Transform) contains the whole grid area, but will of course be combined + with the visible area (Viewport) when decomposed. Also a reolution-dependent + point reduction is used to not create too much grid visualisation data. This + makes this primitive highly view-dependent and it dynamically buffers + the last decomposition dependent from the Viewport used. + */ class GridPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// The geometry definition for the grid area basegfx::B2DHomMatrix maTransform; + + /// grid layout definitions double mfWidth; double mfHeight; double mfSmallestViewDistance; double mfSmallestSubdivisionViewDistance; sal_uInt32 mnSubdivisionsX; sal_uInt32 mnSubdivisionsY; + + /// Grid color for single-pixel grid points basegfx::BColor maBColor; + + /// The Bitmap (with alpha) for grid cross points BitmapEx maCrossMarker; - // the last used object to view transformtion and the last Viewport, - // used from getDecomposition for decide buffering + /** the last used object to view transformtion and the last Viewport, + used from getDecomposition for decide buffering + */ basegfx::B2DHomMatrix maLastObjectToViewTransformation; basegfx::B2DRange maLastViewport; protected: - // create local decomposition + /// create local decomposition virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor GridPrimitive2D( const basegfx::B2DHomMatrix& rTransform, double fWidth, @@ -82,7 +100,7 @@ namespace drawinglayer const basegfx::BColor& rBColor, const BitmapEx& rCrossMarker); - // get data + /// data read access const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } double getWidth() const { return mfWidth; } double getHeight() const { return mfHeight; } @@ -93,16 +111,16 @@ namespace drawinglayer const basegfx::BColor& getBColor() const { return maBColor; } const BitmapEx& getCrossMarker() const { return maCrossMarker; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get 2d range + /// get 2d range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() - // Overload standard getDecomposition call to be view-dependent here + /// Overload standard getDecomposition call to be view-dependent here virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx index cd6efef472bb..89b49420a3e7 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx @@ -45,7 +45,9 @@ namespace drawinglayer { namespace primitive2d { - /** Baseclass for all grouping 2D primitives + /** GroupPrimitive2D class + + Baseclass for all grouping 2D primitives The grouping primitive in it's basic form is capable of holding a child primitive content and returns it on decomposition on default. @@ -78,23 +80,23 @@ namespace drawinglayer class GroupPrimitive2D : public BasePrimitive2D { private: - // the children. Declared private since this shall never be changed at all after construction + /// the children. Declared private since this shall never be changed at all after construction Primitive2DSequence maChildren; public: - // constructor + /// constructor GroupPrimitive2D(const Primitive2DSequence& rChildren); - // data access + /// data read access const Primitive2DSequence& getChildren() const { return maChildren; } - // compare operator + /// compare operator virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; - // local decomposition. Implementation will just return children + /// local decomposition. Implementation will just return children virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx index 0ba83b2c383a..a1171cb846e0 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx @@ -47,32 +47,52 @@ namespace drawinglayer { namespace primitive2d { + /** HelplineStyle2D definition + + The available styles of Helplines + */ enum HelplineStyle2D { HELPLINESTYLE2D_POINT, HELPLINESTYLE2D_LINE }; + /** HelplinePrimitive2D class + + This primitive provides a view-dependent helpline definition. The Helpline + is defined by a line equation (Point and vector) and a style. When the style + is a line, dependent from Viewport the visible part of that Helpline is + constructed. For Point, a cross is constructed. This primitive is highly + view-dependent. + + The visualisation uses the two given colors to create a dashed line with + the given dash length. + */ class HelplinePrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// Helpline geometry definition basegfx::B2DPoint maPosition; basegfx::B2DVector maDirection; HelplineStyle2D meStyle; + + /// Helpline style definition basegfx::BColor maRGBColA; basegfx::BColor maRGBColB; double mfDiscreteDashLength; - // the last used object to view transformtion and the last Viewport, - // used from getDecomposition for decide buffering + /** the last used object to view transformtion and the last Viewport, + used from getDecomposition for decide buffering + */ basegfx::B2DHomMatrix maLastObjectToViewTransformation; basegfx::B2DRange maLastViewport; protected: - // create local decomposition + /// create local decomposition virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor HelplinePrimitive2D( const basegfx::B2DPoint& rPosition, const basegfx::B2DVector& rDirection, @@ -81,7 +101,7 @@ namespace drawinglayer const basegfx::BColor& aRGBColB, double fDiscreteDashLength); - // get data + /// data read access const basegfx::B2DPoint getPosition() const { return maPosition; } const basegfx::B2DVector getDirection() const { return maDirection; } HelplineStyle2D getStyle() const { return meStyle; } @@ -89,13 +109,13 @@ namespace drawinglayer const basegfx::BColor& getRGBColB() const { return maRGBColB; } double getDiscreteDashLength() const { return mfDiscreteDashLength; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() - // Overload standard getDecomposition call to be view-dependent here + /// Overload standard getDecomposition call to be view-dependent here virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx index 1df9ca2111af..3b69c685c985 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx @@ -44,29 +44,35 @@ namespace drawinglayer { namespace primitive2d { - // This primitive is used to represent geometry for non-visible objects, - // e.g. a PresObj's outline. To still be able to use primitives for HitTest - // functionality, the 2d decompositions will produce an as much as possible - // simplified line geometry encapsulated in this primtive when there is no - // line geometry. In a further enchanced version this may change to 'if neither - // filled nor lines' creation criteria. The whole primitive decomposes to nothing, - // so no one not knowing it will be influenced. Only helper processors for hit test - // (and maybe BoundRect extractors) will use it and it's children subcontent. + /** HitTestPrimitive2D class + + This primitive is used to represent geometry for non-visible objects, + e.g. a PresObj's outline. To still be able to use primitives for HitTest + functionality, the 2d decompositions will produce an as much as possible + simplified line geometry encapsulated in this primtive when there is no + line geometry. In a further enchanced version this may change to 'if neither + filled nor lines' creation criteria. The whole primitive decomposes to nothing, + so no one not knowing it will be influenced. Only helper processors for hit test + (and maybe BoundRect extractors) will use it and it's children subcontent. + */ class HitTestPrimitive2D : public GroupPrimitive2D { public: + /// constructor HitTestPrimitive2D(const Primitive2DSequence& rChildren); - // despite returning an empty decomposition since it's no visualisation data, - // range calculation is intended to use invisible replacement geometry, so - // the local implementation will return the children's range + /** despite returning an empty decomposition since it's no visualisation data, + range calculation is intended to use invisible replacement geometry, so + the local implementation will return the children's range + */ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // local decomposition. Implementation will return empty Primitive2DSequence - // since this is no visualisation data + /** local decomposition. Implementation will return empty Primitive2DSequence + since this is no visualisation data + */ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx index ae7a316e03da..9ba7e7796395 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx @@ -44,12 +44,23 @@ namespace drawinglayer { namespace primitive2d { + /** HitTestPrimitive2D class + + This is a helper class which encapsulates geometry that should be + painted XOR, e.g. old cursor visualisations. It decomposes to + it's content, so when not supporting it, the contained geometry + will be visualized normally. + Unfortunately this is still needed, but hard to support on various + systems. XOR painting needs read access to the target, so modern + graphic systems tend to not support it anymore. + */ class InvertPrimitive2D : public GroupPrimitive2D { public: + /// constructor InvertPrimitive2D(const Primitive2DSequence& rChildren); - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx index 77f450403302..cc4c054f8bb3 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx @@ -41,38 +41,55 @@ #include ////////////////////////////////////////////////////////////////////////////// -// MarkerPrimitive2D class +// MarkerArrayPrimitive2D class namespace drawinglayer { namespace primitive2d { + /** MarkerArrayPrimitive2D class + + This primtive defines an array of markers. Their size is defined + in pixels and independent from the view transformation which makes + this primitive highly view-dependent. It is also transformation + invariant, so that the bitmap is always visualized unscaled and + unrotated. + It is used e.g. for grid position visualisation. The given Bitmap + (with alpha) is defined to be visible centered at each of the given + positions. + It decomposes to the needed number of BitmapPrimitive2D's, so it would + be efficient to handle it directly in a renderer. + */ class MarkerArrayPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the positions for the marker std::vector< basegfx::B2DPoint > maPositions; + + /// the marker definintion to visualize BitmapEx maMarker; protected: - // create local decomposition + /// create local decomposition virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor MarkerArrayPrimitive2D( const std::vector< basegfx::B2DPoint >& rPositions, const BitmapEx& rMarker); - // get data + /// data read access const std::vector< basegfx::B2DPoint >& getPositions() const { return maPositions; } const BitmapEx& getMarker() const { return maMarker; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/maskprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/maskprimitive2d.hxx index 9be17376941e..72d5bd3b9b6b 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/maskprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/maskprimitive2d.hxx @@ -45,23 +45,39 @@ namespace drawinglayer { namespace primitive2d { + /** MaskPrimitive2D class + + This is the central masking primitive. It's a grouping + primitive and contains a PolyPolygon which defines the visible + area. Only visualisation parts of the Child primitive sequence + inside of the mask PolyPolygon is defined to be visible. + + This primitive should be handled by a renderer. If it is not handled, + it decomposes to it's Child content, and thus the visualisation would + contaiun no clips. + + The geometrc range of this primitive is completely defined by the Mask + PolyPolygon since by definition nothing outside of the mask is visible. + */ class MaskPrimitive2D : public GroupPrimitive2D { private: + /// the mask PolyPolygon basegfx::B2DPolyPolygon maMask; public: + /// constructor MaskPrimitive2D( const basegfx::B2DPolyPolygon& rMask, const Primitive2DSequence& rChildren); - // get data + /// data read access const basegfx::B2DPolyPolygon& getMask() const { return maMask; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx index da8e49b644c6..e5f884f09294 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx @@ -46,38 +46,55 @@ namespace drawinglayer { namespace primitive2d { + /** MediaPrimitive2D class + + This is a unified primitive for Media visualisation, e.g. animations + or sounds. It's geometry is defined by Transform. For conveinience, + it also contains a discrete border size (aka Pixels) which will be added + if used. This makes it a view-dependent primitive. It also gets a filled + background and the decomposition will try to create a graphic representation + if te content (defined by the URL), e.g. a still frome for animated stuff. + */ class MediaPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the geometry definition basegfx::B2DHomMatrix maTransform; + + /// the content definition rtl::OUString maURL; + + /// style: background color basegfx::BColor maBackgroundColor; + + /// discrete border (in 'pixels') sal_uInt32 mnDiscreteBorder; protected: - // local decomposition + /// local decomposition virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor MediaPrimitive2D( const basegfx::B2DHomMatrix& rTransform, const rtl::OUString& rURL, const basegfx::BColor& rBackgroundColor, sal_uInt32 nDiscreteBorder); - // get data + /// data read access const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } const rtl::OUString& getURL() const { return maURL; } const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; } sal_uInt32 getDiscreteBorder() const { return mnDiscreteBorder; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx index 23eb5dd1b36e..039db9387024 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx @@ -47,28 +47,52 @@ namespace drawinglayer { namespace primitive2d { + /** MediaPrimitive2D class + + This is the MetaFile representing primitive. It's geometry is defined + by MetaFileTransform. The content (defined by MetaFile) will be scaled + to the geometric definiton by using PrefMapMode and PrefSize of the + Metafile. + + It has shown that this not always guarantees that all Metafile content + is inside the geometric definition, but this primitive defines that this + is the case to allow a getB2DRange implementation. If it cannot be + guaranteed that the Metafile is inside the geometric definition, it should + be embedded to a MaskPrimitive2D. + + This primitive has no decomposition yet, so when not supported by a renderer, + it will not be visualized. + + In the future, a decomposition implementation would be appreciated and would + have many advantages; Metafile would no longer have to be rendered by + sub-systems and a standard way for converting Metafiles would exist. + */ class MetafilePrimitive2D : public BasePrimitive2D { private: + /// the geometry definition basegfx::B2DHomMatrix maMetaFileTransform; + + /// the content definition GDIMetaFile maMetaFile; public: + /// constructor MetafilePrimitive2D( const basegfx::B2DHomMatrix& rMetaFileTransform, const GDIMetaFile& rMetaFile); - // get data + /// data read access const basegfx::B2DHomMatrix& getTransform() const { return maMetaFileTransform; } const GDIMetaFile& getMetaFile() const { return maMetaFile; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx index 903ba89c9a5b..e93dd523e0b7 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx @@ -45,23 +45,42 @@ namespace drawinglayer { namespace primitive2d { + /** ModifiedColorPrimitive2D class + + This primitive is a grouping primitive and allows to define + how the colors of it's child content shall be modified for + visualisation. This can be (and is) used e.g. for generic shadow + visualisation by forcing all color usages of the contained + sub-content to the shadow color. + + For the possibilities of color modifications, please refer + to the basegfx::BColorModifier definitions in basegfx. For + processing there is tooling in basegfx to build a stack of + BColorModifiers to always be able to proccess the correct + colors. + + If a renderer does not handle this primitive, the content will + be visualized unchanged. + */ class ModifiedColorPrimitive2D : public GroupPrimitive2D { private: + /// The ColorModifier to use basegfx::BColorModifier maColorModifier; public: + /// constructor ModifiedColorPrimitive2D( const Primitive2DSequence& rChildren, const basegfx::BColorModifier& rColorModifier); - // get data + /// data read access const basegfx::BColorModifier& getColorModifier() const { return maColorModifier; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx index 52ed2435f5e7..5eca0ac2ab13 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx @@ -46,38 +46,43 @@ namespace drawinglayer { namespace primitive2d { - // This primitive is needed to have the correct XDrawPage as ViewInformation for decomposing - // the page contents (given as PageContent here) if these contain e.g. - // view-dependent (in this case XDrawPage-dependent) text fields like PageNumber. If You want - // those primitives to be visualized correctly, Your renderer needs to locally correct it's - // ViewInformation2D to reference the new XDrawPage. + /** PagePreviewPrimitive2D class + + This primitive is needed to have the correct XDrawPage as ViewInformation for decomposing + the page contents (given as PageContent here) if these contain e.g. + view-dependent (in this case XDrawPage-dependent) text fields like PageNumber. If You want + those primitives to be visualized correctly, Your renderer needs to locally correct it's + ViewInformation2D to reference the new XDrawPage. + */ class PagePreviewPrimitive2D : public BufferedDecompositionPrimitive2D { private: - // the XDrawPage visualized by this primitive. When we go forward with primitives - // this will not only be used by the renderers to provide the correct decompose - // graphic attribute context, but also to completely create the page's sub-content. + /** the XDrawPage visualized by this primitive. When we go forward with primitives + this will not only be used by the renderers to provide the correct decompose + graphic attribute context, but also to completely create the page's sub-content. + */ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxDrawPage; - // the PageContent + /// the PageContent Primitive2DSequence maPageContent; - // the own geometry + /// the own geometry basegfx::B2DHomMatrix maTransform; - // content width and height + /// content width and height double mfContentWidth; double mfContentHeight; - // bitfield - // flag to allow keeping the aspect ratio + /// bitfield + /// flag to allow keeping the aspect ratio unsigned mbKeepAspectRatio : 1; protected: - // local decomposition. Implementation will just return children + /// local decomposition. Implementation will just return children virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor PagePreviewPrimitive2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage, const basegfx::B2DHomMatrix& rTransform, @@ -86,7 +91,7 @@ namespace drawinglayer const Primitive2DSequence& rPageContent, bool bKeepAspectRatio); - // get data + /// data read access const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& getXDrawPage() const { return mxDrawPage; } const Primitive2DSequence& getPageContent() const { return maPageContent; } const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } @@ -94,13 +99,13 @@ namespace drawinglayer double getContentHeight() const { return mfContentHeight; } bool getKeepAspectRatio() const { return mbKeepAspectRatio; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // own getB2DRange + /// own getB2DRange virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx index 7e82f53c2401..793c96444bac 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/pointarrayprimitive2d.hxx @@ -40,37 +40,51 @@ #include ////////////////////////////////////////////////////////////////////////////// -// MarkerPrimitive2D class +// PointArrayPrimitive2D class namespace drawinglayer { namespace primitive2d { + /** PointArrayPrimitive2D class + + This primitive defines single,discrete 'pixels' for the given + positions in the given color. This makes it view-dependent since + the logic size of a 'pixel' depends on the view transformation. + + This is one of the non-decomposable primitives, so a renderer + should proccess it (Currently it is only used for grid visualisation, + but this may change). + */ class PointArrayPrimitive2D : public BasePrimitive2D { private: + /// the array of positions std::vector< basegfx::B2DPoint > maPositions; + + /// the color to use basegfx::BColor maRGBColor; - // #i96669# add simple range buffering for this primitive + /// #i96669# add simple range buffering for this primitive basegfx::B2DRange maB2DRange; public: + /// constructor PointArrayPrimitive2D( const std::vector< basegfx::B2DPoint >& rPositions, const basegfx::BColor& rRGBColor); - // get data + /// data read access const std::vector< basegfx::B2DPoint >& getPositions() const { return maPositions; } const basegfx::BColor& getRGBColor() const { return maRGBColor; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx index 4e04786fb2e5..4c6f5b49bf01 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -49,26 +49,40 @@ namespace drawinglayer { namespace primitive2d { + /** PolygonHairlinePrimitive2D class + + This primitive defines a Hairline. Since hairlines are view-dependent, + this primitive is view-dependent, too. + + This is one of the non-decomposable primitives, so a renderer + should proccess it. + */ class PolygonHairlinePrimitive2D : public BasePrimitive2D { private: + /// the hairline geometry basegfx::B2DPolygon maPolygon; + + /// the hairline color basegfx::BColor maBColor; public: - PolygonHairlinePrimitive2D(const basegfx::B2DPolygon& rPolygon, const basegfx::BColor& rBColor); + /// constructor + PolygonHairlinePrimitive2D( + const basegfx::B2DPolygon& rPolygon, + const basegfx::BColor& rBColor); - // get data + /// data read access const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } const basegfx::BColor& getBColor() const { return maBColor; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -81,44 +95,59 @@ namespace drawinglayer { namespace primitive2d { + /** PolygonMarkerPrimitive2D class + + This primitive defines a two-colored marker hairline which is + dashed with the given dash length. Since hairlines are view-dependent, + this primitive is view-dependent, too. + + It will be decomposed to the needed PolygonHairlinePrimitive2D if + not handled directly by a renderer. + */ class PolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the marker hairline geometry basegfx::B2DPolygon maPolygon; + + /// the two colors basegfx::BColor maRGBColorA; basegfx::BColor maRGBColorB; + + /// the dash distance in 'pixels' double mfDiscreteDashLength; - // decomposition is view-dependent, remember last InverseObjectToViewTransformation + /// decomposition is view-dependent, remember last InverseObjectToViewTransformation basegfx::B2DHomMatrix maLastInverseObjectToViewTransformation; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor PolygonMarkerPrimitive2D( const basegfx::B2DPolygon& rPolygon, const basegfx::BColor& rRGBColorA, const basegfx::BColor& rRGBColorB, double fDiscreteDashLength); - // get data + /// data read access const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } double getDiscreteDashLength() const { return mfDiscreteDashLength; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // get local decomposition. Overloaded since this decomposition is view-dependent + /// get local decomposition. Overloaded since this decomposition is view-dependent virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -131,39 +160,52 @@ namespace drawinglayer { namespace primitive2d { + /** PolygonStrokePrimitive2D class + + This primitive defines a line with line width, line join, line color + and stroke attributes. It will be decomposed dependent on the definition + to the needed primitives, e.g. filled PolyPolygons for fat lines. + */ class PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the line geometry basegfx::B2DPolygon maPolygon; + + /// the line attributes like width, join and color attribute::LineAttribute maLineAttribute; + + /// the line stroking (if used) attribute::StrokeAttribute maStrokeAttribute; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor PolygonStrokePrimitive2D( const basegfx::B2DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute); + /// constructor without stroking PolygonStrokePrimitive2D( const basegfx::B2DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute); - // get data + /// data read access basegfx::B2DPolygon getB2DPolygon() const { return maPolygon; } const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -176,17 +218,24 @@ namespace drawinglayer { namespace primitive2d { + /** PolygonWavePrimitive2D class + + This primitive defines a waveline based on a PolygonStrokePrimitive2D + where the wave is defined by wave width and wave length. + */ class PolygonWavePrimitive2D : public PolygonStrokePrimitive2D { private: + /// wave definition double mfWaveWidth; double mfWaveHeight; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor PolygonWavePrimitive2D( const basegfx::B2DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute, @@ -194,23 +243,24 @@ namespace drawinglayer double fWaveWidth, double fWaveHeight); + /// constructor without stroking PolygonWavePrimitive2D( const basegfx::B2DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute, double fWaveWidth, double fWaveHeight); - // get data + /// data read access double getWaveWidth() const { return mfWaveWidth; } double getWaveHeight() const { return mfWaveHeight; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -223,17 +273,25 @@ namespace drawinglayer { namespace primitive2d { + /** PolygonStrokeArrowPrimitive2D class + + This primitive defines a PolygonStrokePrimitive2D which is extended + eventually by start and end definitions which are normally used for + arrows. + */ class PolygonStrokeArrowPrimitive2D : public PolygonStrokePrimitive2D { private: + /// geometric definitions for line start and end attribute::LineStartEndAttribute maStart; attribute::LineStartEndAttribute maEnd; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor PolygonStrokeArrowPrimitive2D( const basegfx::B2DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute, @@ -241,23 +299,24 @@ namespace drawinglayer const attribute::LineStartEndAttribute& rStart, const attribute::LineStartEndAttribute& rEnd); + /// constructor without stroking PolygonStrokeArrowPrimitive2D( const basegfx::B2DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute, const attribute::LineStartEndAttribute& rStart, const attribute::LineStartEndAttribute& rEnd); - // get data + /// data read access const attribute::LineStartEndAttribute& getStart() const { return maStart; } const attribute::LineStartEndAttribute& getEnd() const { return maEnd; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index 0a288cd2ac65..8c0512402120 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -51,30 +51,40 @@ namespace drawinglayer { namespace primitive2d { + /** PolyPolygonHairlinePrimitive2D class + + This primitive defines a multi-PolygonHairlinePrimitive2D and is + just for convenience. The definition is not different from the single + defined PolygonHairlinePrimitive2Ds. + */ class PolyPolygonHairlinePrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the hairline geometry basegfx::B2DPolyPolygon maPolyPolygon; + + /// the hairline color basegfx::BColor maBColor; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor); - // get data + /// data read access basegfx::B2DPolyPolygon getB2DPolyPolygon() const { return maPolyPolygon; } const basegfx::BColor& getBColor() const { return maBColor; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -87,38 +97,50 @@ namespace drawinglayer { namespace primitive2d { + /** PolyPolygonMarkerPrimitive2D class + + This primitive defines a multi-PolygonMarkerPrimitive2D and is + just for convenience. The definition is not different from the single + defined PolygonMarkerPrimitive2Ds. + */ class PolyPolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the marker hairline geometry basegfx::B2DPolyPolygon maPolyPolygon; + + /// the two colors basegfx::BColor maRGBColorA; basegfx::BColor maRGBColorB; + + /// the dash distance in 'pixels' double mfDiscreteDashLength; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor PolyPolygonMarkerPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rRGBColorA, const basegfx::BColor& rRGBColorB, double fDiscreteDashLength); - // get data + // data read access basegfx::B2DPolyPolygon getB2DPolyPolygon() const { return maPolyPolygon; } const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } double getDiscreteDashLength() const { return mfDiscreteDashLength; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -131,39 +153,52 @@ namespace drawinglayer { namespace primitive2d { + /** PolyPolygonStrokePrimitive2D class + + This primitive defines a multi-PolygonStrokePrimitive2D and is + just for convenience. The definition is not different from the single + defined PolygonStrokePrimitive2Ds. + */ class PolyPolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the line geometry basegfx::B2DPolyPolygon maPolyPolygon; + + /// the line attributes like width, join and color attribute::LineAttribute maLineAttribute; + + /// the line stroking (if used) attribute::StrokeAttribute maStrokeAttribute; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor PolyPolygonStrokePrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute); + /// constructor without stroking PolyPolygonStrokePrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, const attribute::LineAttribute& rLineAttribute); - // get data + /// data read access basegfx::B2DPolyPolygon getB2DPolyPolygon() const { return maPolyPolygon; } const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -176,17 +211,25 @@ namespace drawinglayer { namespace primitive2d { + /** PolyPolygonStrokePrimitive2D class + + This primitive defines a multi-PolygonStrokeArrowPrimitive2D and is + just for convenience. The definition is not different from the single + defined PolygonStrokeArrowPrimitive2Ds. + */ class PolyPolygonStrokeArrowPrimitive2D : public PolyPolygonStrokePrimitive2D { private: + /// geometric definitions for line start and end attribute::LineStartEndAttribute maStart; attribute::LineStartEndAttribute maEnd; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor PolyPolygonStrokeArrowPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, const attribute::LineAttribute& rLineAttribute, @@ -194,23 +237,24 @@ namespace drawinglayer const attribute::LineStartEndAttribute& rStart, const attribute::LineStartEndAttribute& rEnd); + /// constructor without stroking PolyPolygonStrokeArrowPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, const attribute::LineAttribute& rLineAttribute, const attribute::LineStartEndAttribute& rStart, const attribute::LineStartEndAttribute& rEnd); - // get data + /// data read access const attribute::LineStartEndAttribute& getStart() const { return maStart; } const attribute::LineStartEndAttribute& getEnd() const { return maEnd; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -223,28 +267,38 @@ namespace drawinglayer { namespace primitive2d { + /** PolyPolygonColorPrimitive2D class + + This primitive defines a PolyPolygon filled with a single color. + This is one of the non-decomposable primitives, so a renderer + should proccess it. + */ class PolyPolygonColorPrimitive2D : public BasePrimitive2D { private: + /// the PolyPolygon geometry basegfx::B2DPolyPolygon maPolyPolygon; + + /// the polygon fill color basegfx::BColor maBColor; public: + /// constructor PolyPolygonColorPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor); - // get data + /// data read access const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } const basegfx::BColor& getBColor() const { return maBColor; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -257,29 +311,39 @@ namespace drawinglayer { namespace primitive2d { + /** PolyPolygonColorPrimitive2D class + + This primitive defines a PolyPolygon filled with a gradient. The + decomosition will create a MaskPrimitive2D containing a + FillGradientPrimitive2D. + */ class PolyPolygonGradientPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the PolyPolygon geometry basegfx::B2DPolyPolygon maPolyPolygon; + + /// the gradient definition attribute::FillGradientAttribute maFillGradient; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor PolyPolygonGradientPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, const attribute::FillGradientAttribute& rFillGradient); - // get data + /// data read access const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -292,32 +356,44 @@ namespace drawinglayer { namespace primitive2d { + /** PolyPolygonHatchPrimitive2D class + + This primitive defines a PolyPolygon filled with a hatch. The + decomosition will create a MaskPrimitive2D containing a + FillHatchPrimitive2D. + */ class PolyPolygonHatchPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the PolyPolygon geometry basegfx::B2DPolyPolygon maPolyPolygon; + + /// the hatch definition attribute::FillHatchAttribute maFillHatch; + + /// the hatch background color (if used) basegfx::BColor maBackgroundColor; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor PolyPolygonHatchPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBackgroundColor, const attribute::FillHatchAttribute& rFillHatch); - // get data + /// data read access const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; } const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -330,29 +406,39 @@ namespace drawinglayer { namespace primitive2d { + /** PolyPolygonBitmapPrimitive2D class + + This primitive defines a PolyPolygon filled with bitmap data + (including alpha). The decomosition will create a MaskPrimitive2D + containing a FillBitmapPrimitive2D. + */ class PolyPolygonBitmapPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// the PolyPolygon geometry basegfx::B2DPolyPolygon maPolyPolygon; + + /// the bitmap fill definition (may include tiling) attribute::FillBitmapAttribute maFillBitmap; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor PolyPolygonBitmapPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, const attribute::FillBitmapAttribute& rFillBitmap); - // get data + /// data read access const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } const attribute::FillBitmapAttribute& getFillBitmap() const { return maFillBitmap; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx index f7e9b1dcac0b..77d56ca8026f 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx @@ -39,68 +39,78 @@ #include ////////////////////////////////////////////////////////////////////////////// -// tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent -// regarding the size of a discrete unit. The implementation of get2DDecomposition -// guards the buffered local decomposition and ensures that a create2DDecomposition -// implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit() namespace drawinglayer { namespace primitive2d { + /** DiscreteMetricDependentPrimitive2D class + + tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent + regarding the size of a discrete unit. The implementation of get2DDecomposition + guards the buffered local decomposition and ensures that a create2DDecomposition + implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit() + */ class DiscreteMetricDependentPrimitive2D : public BufferedDecompositionPrimitive2D { private: - // the last used fDiscreteUnit definitions for decomposition. Since this - // is checked and updated from get2DDecomposition() it will be current and - // usable in create2DDecomposition() + /** the last used fDiscreteUnit definitions for decomposition. Since this + is checked and updated from get2DDecomposition() it will be current and + usable in create2DDecomposition() + */ double mfDiscreteUnit; public: + /// constructor DiscreteMetricDependentPrimitive2D() : BufferedDecompositionPrimitive2D(), mfDiscreteUnit(0.0) { } - // data access + /// data read access double getDiscreteUnit() const { return mfDiscreteUnit; } - // get local decomposition. Overloaded since this decomposition is view-dependent + /// get local decomposition. Overloaded since this decomposition is view-dependent virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; }; } // end of namespace primitive2d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// -// tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent -// regarding the viewport. The implementation of get2DDecomposition -// guards the buffered local decomposition and ensures that a create2DDecomposition -// implementation may use an up-to-date Viewport accessible using getViewport() namespace drawinglayer { namespace primitive2d { + /** ViewportDependentPrimitive2D class + + tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent + regarding the viewport. The implementation of get2DDecomposition + guards the buffered local decomposition and ensures that a create2DDecomposition + implementation may use an up-to-date Viewport accessible using getViewport() + */ class ViewportDependentPrimitive2D : public BufferedDecompositionPrimitive2D { private: - // the last used Viewport definition for decomposition. Since this - // is checked and updated from get2DDecomposition() it will be current and - // usable in create2DDecomposition() + /** the last used Viewport definition for decomposition. Since this + is checked and updated from get2DDecomposition() it will be current and + usable in create2DDecomposition() + */ basegfx::B2DRange maViewport; public: + /// constructor ViewportDependentPrimitive2D() : BufferedDecompositionPrimitive2D(), maViewport() { } - // data access + /// data read access const basegfx::B2DRange& getViewport() const { return maViewport; } - // get local decomposition. Overloaded since this decomposition is view-dependent + /// get local decomposition. Overloaded since this decomposition is view-dependent virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx index a86e32adca26..65d2bdf67f92 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx @@ -49,33 +49,60 @@ namespace drawinglayer { namespace primitive2d { + /** ScenePrimitive2D class + + This primitive defines a 3D scene as a 2D primitive and is the anchor point + for a 3D visualisation. The decomposition is view-dependent and will try to + re-use already rendered 3D content. + + The rendering is done using the default-3D renderer from basegfx which supports + AntiAliasing. + + The 2D primitive's geometric range is defined completely by the + ObjectTransformation combined with evtl. 2D shadows from the 3D objects. The + shadows of 3D objects are 2D polygons, projected with the 3D transformation. + + This is the class a renderer may process directly when he wants to implement + an own (e.g. system-specific) 3D renderer. + */ class ScenePrimitive2D : public BufferedDecompositionPrimitive2D { private: - primitive3d::Primitive3DSequence mxChildren3D; // the 3d sub-primitives - attribute::SdrSceneAttribute maSdrSceneAttribute; // 3d scene attribute set - attribute::SdrLightingAttribute maSdrLightingAttribute; // lighting attribute set - basegfx::B2DHomMatrix maObjectTransformation; // object transformation for scene for 2d definition - geometry::ViewInformation3D maViewInformation3D; // scene transformation set and object transformation + /// the 3D geometry definition + primitive3d::Primitive3DSequence mxChildren3D; + + /// 3D scene attribute set + attribute::SdrSceneAttribute maSdrSceneAttribute; + + /// lighting attribute set + attribute::SdrLightingAttribute maSdrLightingAttribute; + + /// object transformation for scene for 2D definition + basegfx::B2DHomMatrix maObjectTransformation; + + /// scene transformation set and object transformation + geometry::ViewInformation3D maViewInformation3D; - // the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked) + /// the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked) Primitive2DSequence maShadowPrimitives; - // bitfield - // flag if given 3D geometry is already cheched for shadow definitions and 2d shadows - // are created in maShadowPrimitives + /// bitfield + /** flag if given 3D geometry is already cheched for shadow definitions and 2d shadows + are created in maShadowPrimitives + */ unsigned mbShadow3DChecked : 1; - // the last used NewDiscreteSize and NewUnitVisiblePart definitions for decomposition + /// the last used NewDiscreteSize and NewUnitVisiblePart definitions for decomposition double mfOldDiscreteSizeX; double mfOldDiscreteSizeY; basegfx::B2DRange maOldUnitVisiblePart; - // the last created BitmapEx, e.g. for fast HitTest. This does not really need - // memory since BitmapEx is internally RefCounted + /** the last created BitmapEx, e.g. for fast HitTest. This does not really need + memory since BitmapEx is internally RefCounted + */ BitmapEx maOldRenderedBitmap; - // private helpers + /// private helpers bool impGetShadow3D(const geometry::ViewInformation2D& rViewInformation) const; void calculateDiscreteSizes( const geometry::ViewInformation2D& rViewInformation, @@ -84,28 +111,30 @@ namespace drawinglayer basegfx::B2DRange& rUnitVisibleRange) const; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: - // public helpers - // Geometry extractor. Shadow will be added as in create2DDecomposition, but - // the 3D content is not converted to a bitmap visualisation but to projected 2D gemetry. This - // helper is useful e.g. for Contour extraction or HitTests. + /// public helpers + /** Geometry extractor. Shadow will be added as in create2DDecomposition, but + the 3D content is not converted to a bitmap visualisation but to projected 2D gemetry. This + helper is useful e.g. for Contour extraction or HitTests. + */ Primitive2DSequence getGeometry2D() const; Primitive2DSequence getShadow2D(const geometry::ViewInformation2D& rViewInformation) const; - // Fast HitTest which uses the last buffered BitmapEx from the last - // rendered area if available. The return value describes if the check - // could be done with the current information, so do NOT use o_rResult - // when it returns false. o_rResult will be changed on return true and - // then contains a definitive answer if content of this scene is hit or - // not. On return false, it is normally necessary to use the geometric - // HitTest (see CutFindProcessor usages). The given HitPoint - // has to be in logic coordinates in scene's ObjectCoordinateSystem. + /** Fast HitTest which uses the last buffered BitmapEx from the last + rendered area if available. The return value describes if the check + could be done with the current information, so do NOT use o_rResult + when it returns false. o_rResult will be changed on return true and + then contains a definitive answer if content of this scene is hit or + not. On return false, it is normally necessary to use the geometric + HitTest (see CutFindProcessor usages). The given HitPoint + has to be in logic coordinates in scene's ObjectCoordinateSystem. + */ bool tryToCheckLastVisualisationDirectHit(const basegfx::B2DPoint& rLogicHitPoint, bool& o_rResult) const; - // constructor/destructor + /// constructor ScenePrimitive2D( const primitive3d::Primitive3DSequence& rxChildren3D, const attribute::SdrSceneAttribute& rSdrSceneAttribute, @@ -113,23 +142,23 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rObjectTransformation, const geometry::ViewInformation3D& rViewInformation3D); - // get data + /// data ead access const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; } const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return maSdrSceneAttribute; } const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return maSdrLightingAttribute; } const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() - // get local decomposition. Overloaded since this decomposition is view-dependent + /// get local decomposition. Overloaded since this decomposition is view-dependent virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/shadowprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/shadowprimitive2d.hxx index 3da621f5f174..0e3f7258441a 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/shadowprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/shadowprimitive2d.hxx @@ -46,32 +46,50 @@ namespace drawinglayer { namespace primitive2d { + /** ShadowPrimitive2D class + + This primitive defines a generic shadow geometry construction + for 2D objects. It decomposes to a TransformPrimitive2D embedded + into a ModifiedColorPrimitive2D. + + It's for primtive usage convenience, so that not everyone has + to implement the generic shadow construction by himself. + + The same geometry as sequence of primitives is used as geometry and + as shadow. Since these are RefCounted Uno-Api objects, no extra objects + are needed for the shadow itself; all the local decompositions of the + original geometry can be reused from the renderer for shadow visualisation. + */ class ShadowPrimitive2D : public GroupPrimitive2D { private: + /// the shadow transformation, normally just an offset basegfx::B2DHomMatrix maShadowTransform; + + /// the shadow color to which all geometry is to be forced basegfx::BColor maShadowColor; public: + /// constructor ShadowPrimitive2D( const basegfx::B2DHomMatrix& rShadowTransform, const basegfx::BColor& rShadowColor, const Primitive2DSequence& rChildren); - // get data + /// data read access const basegfx::B2DHomMatrix& getShadowTransform() const { return maShadowTransform; } const basegfx::BColor& getShadowColor() const { return maShadowColor; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // create decomposition + /// create decomposition virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/structuretagprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/structuretagprimitive2d.hxx index 9ccb91e7bebd..c86e4c91bb86 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/structuretagprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/structuretagprimitive2d.hxx @@ -45,30 +45,34 @@ namespace drawinglayer { namespace primitive2d { - // This class is used to provode simple support for adding grouped - // pdf writer structured element information like used in sd from - // unomodel.cxx where a ViewObjectContactRedirector is used to add - // such information for diverse objects. - // This primitive encapsulates these and the VCLPdfRenderer uses it - // to apply the needed infos directly to the pdf export in a compatible - // way. - // If a renderer ignores this, it just decomposes to it's child - // content. + /** StructureTagPrimitive2D class + + This class is used to provode simple support for adding grouped + pdf writer structured element information like used in sd from + unomodel.cxx where a ViewObjectContactRedirector is used to add + such information for diverse objects. + This primitive encapsulates these and the VCLPdfRenderer uses it + to apply the needed infos directly to the pdf export in a compatible + way. + If a renderer ignores this, it just decomposes to it's child + content. + */ class StructureTagPrimitive2D : public GroupPrimitive2D { private: - // the PDF structure element this grouping represents + /// the PDF structure element this grouping represents vcl::PDFWriter::StructElement maStructureElement; public: + /// constructor StructureTagPrimitive2D( const vcl::PDFWriter::StructElement& rStructureElement, const Primitive2DSequence& rChildren); - // data access + /// data read access const vcl::PDFWriter::StructElement& getStructureElement() const { return maStructureElement; } - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx index fb72500fcb38..4f33c8a7d48b 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx @@ -55,7 +55,10 @@ namespace drawinglayer { namespace primitive2d { - // This is used for both underline and overline + /** FontUnderline definition + + This is used for both underline and overline + */ enum FontUnderline { FONT_UNDERLINE_NONE, @@ -78,6 +81,7 @@ namespace drawinglayer FONT_UNDERLINE_BOLDWAVE }; + /** FontStrikeout definition */ enum FontStrikeout { FONT_STRIKEOUT_NONE, @@ -88,6 +92,7 @@ namespace drawinglayer FONT_STRIKEOUT_X }; + /** FontEmphasisMark definition */ enum FontEmphasisMark { FONT_EMPHASISMARK_NONE, @@ -97,6 +102,7 @@ namespace drawinglayer FONT_EMPHASISMARK_ACCENT }; + /** FontRelief definition */ enum FontRelief { FONT_RELIEF_NONE, @@ -104,9 +110,17 @@ namespace drawinglayer FONT_RELIEF_ENGRAVED }; + /** TextDecoratedPortionPrimitive2D class + + This primitive expands the TextSimplePortionPrimitive2D by common + decorations used in the office. It can be decomposed and will create + a TextSimplePortionPrimitive2D and all the contained decorations (if used) + as geometry. + */ class TextDecoratedPortionPrimitive2D : public TextSimplePortionPrimitive2D { private: + /// decoration definitions basegfx::BColor maOverlineColor; basegfx::BColor maTextlineColor; FontUnderline meFontOverline; @@ -115,14 +129,14 @@ namespace drawinglayer FontEmphasisMark meFontEmphasisMark; FontRelief meFontRelief; - // bitfield + /// bitfield unsigned mbUnderlineAbove : 1; unsigned mbWordLineMode : 1; unsigned mbEmphasisMarkAbove : 1; unsigned mbEmphasisMarkBelow : 1; unsigned mbShadow : 1; - // helper methods + /// helper methods void impCreateTextLine( std::vector< Primitive2DReference >& rTarget, basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans, @@ -150,13 +164,14 @@ namespace drawinglayer basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans) const; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor TextDecoratedPortionPrimitive2D( - // TextSimplePortionPrimitive2D parameters + /// TextSimplePortionPrimitive2D parameters const basegfx::B2DHomMatrix& rNewTransform, const String& rText, xub_StrLen aTextPosition, @@ -166,7 +181,7 @@ namespace drawinglayer const ::com::sun::star::lang::Locale& rLocale, const basegfx::BColor& rFontColor, - // local parameters + /// local parameters const basegfx::BColor& rOverlineColor, const basegfx::BColor& rTextlineColor, FontUnderline eFontOverline = FONT_UNDERLINE_NONE, @@ -180,7 +195,7 @@ namespace drawinglayer FontRelief eFontRelief = FONT_RELIEF_NONE, bool bShadow = false); - // get data + /// data read access FontUnderline getFontOverline() const { return meFontOverline; } FontUnderline getFontUnderline() const { return meFontUnderline; } FontStrikeout getFontStrikeout() const { return meFontStrikeout; } @@ -188,20 +203,19 @@ namespace drawinglayer FontRelief getFontRelief() const { return meFontRelief; } basegfx::BColor getOverlineColor() const { return maOverlineColor; } basegfx::BColor getTextlineColor() const { return maTextlineColor; } - bool getUnderlineAbove() const { return mbUnderlineAbove; } bool getWordLineMode() const { return mbWordLineMode; } bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; } bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; } bool getShadow() const { return mbShadow; } - // compare operator + /// compare operator virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx index 19f910f3444d..77b64d16ea24 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/texteffectprimitive2d.hxx @@ -45,6 +45,7 @@ namespace drawinglayer { namespace primitive2d { + /** TextEffectStyle2D definition */ enum TextEffectStyle2D { TEXTEFFECTSTYLE2D_RELIEF_EMBOSSED_DEFAULT, @@ -54,50 +55,59 @@ namespace drawinglayer TEXTEFFECTSTYLE2D_OUTLINE }; + /** TextEffectPrimitive2D class + + This primitive embeds text primitives (normally, as can be seen can + also be used for any other primitives) which have some TextEffect applied + and create the needed geometry and embedding on decomposition. + */ class TextEffectPrimitive2D : public BufferedDecompositionPrimitive2D { private: - // the text content + /// the text (or other) content Primitive2DSequence maTextContent; - // the style to apply, the direction and the rotation center + /// the style to apply, the direction and the rotation center const basegfx::B2DPoint maRotationCenter; double mfDirection; TextEffectStyle2D meTextEffectStyle2D; - // the last used object to view transformtion used from getDecomposition - // for decide buffering + /** the last used object to view transformtion used from getDecomposition + for decide buffering + */ basegfx::B2DHomMatrix maLastObjectToViewTransformation; protected: - // create local decomposition + /// create local decomposition virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// construcor TextEffectPrimitive2D( const Primitive2DSequence& rTextContent, const basegfx::B2DPoint& rRotationCenter, double fDirection, TextEffectStyle2D eTextEffectStyle2D); - // get data + /// data read access const Primitive2DSequence& getTextContent() const { return maTextContent; } const basegfx::B2DPoint& getRotationCenter() const { return maRotationCenter; } double getDirection() const { return mfDirection; } TextEffectStyle2D getTextEffectStyle2D() const { return meTextEffectStyle2D; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // own get range implementation to solve more effective. Content is by definition displaced - // by a fixed discrete unit, thus the contained geometry needs only once be asked for it's - // own basegfx::B2DRange + /** own get range implementation to solve more effective. Content is by definition displaced + by a fixed discrete unit, thus the contained geometry needs only once be asked for it's + own basegfx::B2DRange + */ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() - // Overload standard getDecomposition call to be view-dependent here + /// Overload standard getDecomposition call to be view-dependent here virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx index 1160704c0fa3..3f9c02b6e9bd 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx @@ -45,17 +45,23 @@ namespace drawinglayer { namespace primitive2d { - // text format hierarchy helper class. It decomposes to it's - // content, so all direct renderers may ignore it. If You need - // to know more about line hierarchies You may react on it and - // also need to take care that the source of data uses it. + /** TextHierarchyLinePrimitive2D class + + Text format hierarchy helper class. It decomposes to it's + content, so all direct renderers may ignore it. If You need + to know more about line hierarchies You may react on it and + also need to take care that the source of data uses it. + + This primitive encapsulates text lines. + */ class TextHierarchyLinePrimitive2D : public GroupPrimitive2D { private: public: + /// constructor TextHierarchyLinePrimitive2D(const Primitive2DSequence& rChildren); - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -67,14 +73,18 @@ namespace drawinglayer { namespace primitive2d { - // see TextHierarchyLinePrimitive2D comment + /** TextHierarchyBulletPrimitive2D class + + This primitive encapsulates text bullets. + */ class TextHierarchyBulletPrimitive2D : public GroupPrimitive2D { private: public: + /// constructor TextHierarchyBulletPrimitive2D(const Primitive2DSequence& rChildren); - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -86,14 +96,18 @@ namespace drawinglayer { namespace primitive2d { - // see TextHierarchyLinePrimitive2D comment + /** TextHierarchyParagraphPrimitive2D class + + This primitive encapsulates text paragraphs. + */ class TextHierarchyParagraphPrimitive2D : public GroupPrimitive2D { private: public: + /// constructor TextHierarchyParagraphPrimitive2D(const Primitive2DSequence& rChildren); - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -105,14 +119,18 @@ namespace drawinglayer { namespace primitive2d { - // see TextHierarchyLinePrimitive2D comment + /** TextHierarchyBlockPrimitive2D class + + This primitive encapsulates text blocks. + */ class TextHierarchyBlockPrimitive2D : public GroupPrimitive2D { private: public: + /// constructor TextHierarchyBlockPrimitive2D(const Primitive2DSequence& rChildren); - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -124,19 +142,28 @@ namespace drawinglayer { namespace primitive2d { - // type enum + /** FieldType definition */ enum FieldType { - FIELD_TYPE_COMMON, // unspecified. If more info is needed for a FieldType, - // create a new type and it's handling - FIELD_TYPE_PAGE, // uses "FIELD_SEQ_BEGIN;PageField" -> special handling - FIELD_TYPE_URL // uses URL as string -> special handling + /** unspecified. If more info is needed for a FieldType, + create a new type and it's handling + */ + FIELD_TYPE_COMMON, + + /** uses "FIELD_SEQ_BEGIN;PageField" -> special handling */ + FIELD_TYPE_PAGE, + + /** uses URL as string -> special handling */ + FIELD_TYPE_URL }; - // see TextHierarchyLinePrimitive2D comment. - // Also: This type uses a type enum to transport the encapsulated field - // type. Also added is a String which is type-dependent. E.g. for URL - // fields, it contains the URL. + /** TextHierarchyFieldPrimitive2D class + + This primitive encapsulates text fields. + Also: This type uses a type enum to transport the encapsulated field + type. Also added is a String which is type-dependent. E.g. for URL + fields, it contains the URL. + */ class TextHierarchyFieldPrimitive2D : public GroupPrimitive2D { private: @@ -144,19 +171,20 @@ namespace drawinglayer rtl::OUString maString; public: + /// constructor TextHierarchyFieldPrimitive2D( const Primitive2DSequence& rChildren, const FieldType& rFieldType, const rtl::OUString& rString); - // get data + /// data read access FieldType getType() const { return meType; } const rtl::OUString& getString() const { return maString; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d @@ -168,20 +196,24 @@ 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 + /** TextHierarchyEditPrimitive2D class + + #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: + /// constructor TextHierarchyEditPrimitive2D(const Primitive2DSequence& rChildren); - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx index df09718a7582..e0e2b6bbc4cb 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx @@ -66,15 +66,24 @@ namespace drawinglayer { namespace primitive2d { + /** TextLayouterDevice class + + This helper class exists to isolate all accesses to VCL + text formatting/handling functionality for primitive implementations. + When in the future FontHandling may move to an own library independent + from VCL, primitives will be prepared. + */ class TextLayouterDevice { - // internally used VirtualDevice + /// internally used VirtualDevice VirtualDevice& mrDevice; public: + /// constructor/destructor TextLayouterDevice(); ~TextLayouterDevice(); + /// tooling methods void setFont(const Font& rFont); void setFontAttributes( const FontAttributes& rFontAttributes, @@ -116,11 +125,12 @@ namespace drawinglayer { namespace primitive2d { - // Create a VCL-Font based on the definitions in FontAttributes - // and the given FontScaling. The FontScaling defines the FontHeight - // (fFontScaleY) and the FontWidth (fFontScaleX). The combination of - // both defines FontStretching, where no stretching happens at - // fFontScaleY == fFontScaleX + /** Create a VCL-Font based on the definitions in FontAttributes + and the given FontScaling. The FontScaling defines the FontHeight + (fFontScaleY) and the FontWidth (fFontScaleX). The combination of + both defines FontStretching, where no stretching happens at + fFontScaleY == fFontScaleX + */ Font getVclFontFromFontAttributes( const FontAttributes& rFontAttributes, double fFontScaleX, @@ -128,10 +138,11 @@ namespace drawinglayer double fFontRotation, const ::com::sun::star::lang::Locale & rLocale); - // Generate FontAttributes DataSet derived from the given VCL-Font. - // The FontScaling with fFontScaleY, fFontScaleX relationship (see - // above) will be set in return parameter o_rSize to allow further - // processing + /** Generate FontAttributes DataSet derived from the given VCL-Font. + The FontScaling with fFontScaleY, fFontScaleX relationship (see + above) will be set in return parameter o_rSize to allow further + processing + */ FontAttributes getFontAttributesFromVclFont( basegfx::B2DVector& o_rSize, const Font& rFont, diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx index 25b11d7cbf29..43e06ecc3b53 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx @@ -60,15 +60,20 @@ namespace drawinglayer { namespace primitive2d { + /** FontAttributes class + + This attribute class is able to hold all parameters needed/used + to completely define the parametrisation of a text portion. + */ class FontAttributes { private: - // core data + /// core data String maFamilyName; // Font Family Name String maStyleName; // Font Style Name sal_uInt16 mnWeight; // Font weight - // bitfield + /// bitfield unsigned mbSymbol : 1; // Symbol Font Flag unsigned mbVertical : 1; // Vertical Text Flag unsigned mbItalic : 1; // Italic Flag @@ -78,6 +83,7 @@ namespace drawinglayer // TODO: pair kerning and CJK kerning public: + /// constructor FontAttributes( const String& rFamilyName, const String& rStyleName, @@ -100,10 +106,10 @@ namespace drawinglayer { } - // compare operator + /// compare operator bool operator==(const FontAttributes& rCompare) const; - // data access + /// data read access const String& getFamilyName() const { return maFamilyName; } const String& getStyleName() const { return maStyleName; } sal_uInt16 getWeight() const { return mnWeight; } @@ -123,26 +129,52 @@ namespace drawinglayer { namespace primitive2d { + /** TextSimplePortionPrimitive2D class + + This is the basic primitive for representing a text portion. It contains + all needed information. If it is not handled by a renderer, it's decomposition + will provide the text PolyPolygon outlines as filled polygons, correctly + transformed. + + To get better text quality, it is suggested to handle tis primitive directly + in a renderer. In that case, e.g. hintings on the system can be supported. + */ class TextSimplePortionPrimitive2D : public BufferedDecompositionPrimitive2D { private: - basegfx::B2DHomMatrix maTextTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range - String maText; // the text, used from maTextPosition up to maTextPosition + maTextLength - xub_StrLen maTextPosition; // the index from where on maText is used - xub_StrLen maTextLength; // the length for maText usage, starting from maTextPosition - ::std::vector< double > maDXArray; // the DX array scale-independent in unit coordinates - FontAttributes maFontAttributes; // the font to use - ::com::sun::star::lang::Locale maLocale; // the Locale for the text - basegfx::BColor maFontColor; // font color - - // #i96669# add simple range buffering for this primitive + /// text range transformation from unit range ([0.0 .. 1.0]) to text range + basegfx::B2DHomMatrix maTextTransform; + + /// The text, used from maTextPosition up to maTextPosition + maTextLength + String maText; + + /// The index from where on maText is used + xub_StrLen maTextPosition; + + /// The length for maText usage, starting from maTextPosition + xub_StrLen maTextLength; + + /// The DX array scale-independent in unit coordinates + ::std::vector< double > maDXArray; + + /// The font to use + FontAttributes maFontAttributes; + + /// The Locale for the text + ::com::sun::star::lang::Locale maLocale; + + /// font color + basegfx::BColor maFontColor; + + /// #i96669# add simple range buffering for this primitive basegfx::B2DRange maB2DRange; protected: - // local decomposition. + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor TextSimplePortionPrimitive2D( const basegfx::B2DHomMatrix& rNewTransform, const String& rText, @@ -153,12 +185,13 @@ namespace drawinglayer const ::com::sun::star::lang::Locale& rLocale, const basegfx::BColor& rFontColor); - // helpers - // get text outlines as polygons and their according ObjectTransformation. Handles all - // the necessary VCL outline extractins, scaling adaptions and other stuff. + /// helpers + /** get text outlines as polygons and their according ObjectTransformation. Handles all + the necessary VCL outline extractins, scaling adaptions and other stuff. + */ void getTextOutlinesAndTransformation(basegfx::B2DPolyPolygonVector& rTarget, basegfx::B2DHomMatrix& rTransformation) const; - // get data + /// data read access const basegfx::B2DHomMatrix& getTextTransform() const { return maTextTransform; } const String& getText() const { return maText; } xub_StrLen getTextPosition() const { return maTextPosition; } @@ -168,13 +201,13 @@ namespace drawinglayer const ::com::sun::star::lang::Locale& getLocale() const { return maLocale; } const basegfx::BColor& getFontColor() const { return maFontColor; } - // compare operator + /// compare operator virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/transformprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/transformprimitive2d.hxx index 1646667342af..1723cc708ea8 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/transformprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/transformprimitive2d.hxx @@ -45,26 +45,47 @@ namespace drawinglayer { namespace primitive2d { + /** TransformPrimitive2D class + + This is one of the basic grouping primitives and it provides + embedding a sequence of primitives (a geometry) into a + transformation. All renderers have to handle this, usually by + building a current transformation stack (linear combination) + and applying this to all to-be-rendered geometry. If not handling + this, the output will be mostly wrong since this primitive is + widely used. + + It does transform by embedding an existing geometry into a + transformation as Child-content. This allows re-usage of the + refcounted Uno-Api primitives and their existung, buffered + decompositions. + + It could e.g. be used to show a single object geometry in 1000 + different, transformed states without the need to create those + thousand primitive contents. + */ class TransformPrimitive2D : public GroupPrimitive2D { private: + // the transformation to apply to the child geometry basegfx::B2DHomMatrix maTransformation; public: + /// constructor TransformPrimitive2D( const basegfx::B2DHomMatrix& rTransformation, const Primitive2DSequence& rChildren); - // get data + /// data read access const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // get range + /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx index d7ca69129e02..6e8970e7bee5 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx @@ -44,26 +44,37 @@ namespace drawinglayer { namespace primitive2d { + /** UnifiedAlphaPrimitive2D class + + This primitive encapsualtes a child hierarchy and defines + that it shall be visualized with the given transparency. That + transparency is unique for all contained geometry, so that + e.g. overlapping polygons in the child geometry will not show + regions of combined transparency, but be all rendered with the + defined, single transparency. + */ class UnifiedAlphaPrimitive2D : public GroupPrimitive2D { private: - double mfAlpha; // unified transparence + /// the unified alpha transparence + double mfAlpha; public: + /// constructor UnifiedAlphaPrimitive2D( const Primitive2DSequence& rChildren, double fAlpha); - // get data + /// data read access double getAlpha() const { return mfAlpha; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // create decomposition + /// create decomposition virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx index 6bf84a401891..3ceae01ed3b2 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/wrongspellprimitive2d.hxx @@ -47,35 +47,53 @@ namespace drawinglayer { namespace primitive2d { + /** WrongSpellPrimitive2D class + + This is a helper primitive to hold evtl. WrongSpell visualisations + in the sequence of primitives. The primitive holds this information + separated form the TextPortions to where it belongs to tot expand the + TextSimplePortionPrimitive2D more as needed. + + A renderer who does not want to visualize this (if contained at all) + can detect and ignore this primitive. If it's decomposition is used, + it will be visualized as red wavelines. + + The geometric definition defines a line on the X-Axis (no Y-coordinates) + which will when transformed by Transformation, create the coordinate data. + */ class WrongSpellPrimitive2D : public BufferedDecompositionPrimitive2D { private: + /// geometry definition basegfx::B2DHomMatrix maTransformation; double mfStart; double mfStop; + + /// color (usually red) basegfx::BColor maColor; protected: - // create local decomposition + /// create local decomposition virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: + /// constructor WrongSpellPrimitive2D( const basegfx::B2DHomMatrix& rTransformation, double fStart, double fStop, const basegfx::BColor& rColor); - // get data + /// data read access const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; } double getStart() const { return mfStart; } double getStop() const { return mfStop; } const basegfx::BColor& getColor() const { return maColor; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive2DIDBlock() }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx index 73d28c82ebda..9bf56edb2c53 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx @@ -76,7 +76,9 @@ namespace drawinglayer { namespace primitive3d { - /** Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D + /** BasePrimitive3D class + + Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D The description/functionality is identical with the 2D case in baseprimitive2d.hxx, please see there for detailed information. @@ -85,6 +87,8 @@ namespace drawinglayer - PolygonHairlinePrimitive3D (for 3D hairlines) - PolyPolygonMaterialPrimitive3D (for 3D filled plane polygons) + + That's all for 3D! */ class BasePrimitive3D : private boost::noncopyable, @@ -144,7 +148,9 @@ namespace drawinglayer { namespace primitive3d { - /** Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D + /** BufferedDecompositionPrimitive3D class + + Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D The description/functionality is identical with the 2D case in baseprimitive2d.hxx, please see there for detailed information @@ -191,23 +197,24 @@ namespace drawinglayer { namespace primitive3d { - // get B3DRange from a given Primitive3DReference + /// get B3DRange from a given Primitive3DReference basegfx::B3DRange getB3DRangeFromPrimitive3DReference(const Primitive3DReference& rCandidate, const geometry::ViewInformation3D& aViewInformation); - // get range3D from a given Primitive3DSequence + /// get range3D from a given Primitive3DSequence basegfx::B3DRange getB3DRangeFromPrimitive3DSequence(const Primitive3DSequence& rCandidate, const geometry::ViewInformation3D& aViewInformation); - // compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D) - // and using compare operator + /** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D) + and using compare operator + */ bool arePrimitive3DReferencesEqual(const Primitive3DReference& rA, const Primitive3DReference& rB); - // compare two Primitive3DReferences for equality, uses arePrimitive3DReferencesEqual internally + /// compare two Primitive3DReferences for equality, uses arePrimitive3DReferencesEqual internally bool arePrimitive3DSequencesEqual(const Primitive3DSequence& rA, const Primitive3DSequence& rB); - // concatenate sequence + /// concatenate sequence void appendPrimitive3DSequenceToPrimitive3DSequence(Primitive3DSequence& rDest, const Primitive3DSequence& rSource); - // concatenate single Primitive3D + /// concatenate single Primitive3D void appendPrimitive3DReferenceToPrimitive3DSequence(Primitive3DSequence& rDest, const Primitive3DReference& rSource); } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx index 6912ff25b04d..69e406c75d67 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx @@ -44,7 +44,9 @@ namespace drawinglayer { namespace primitive3d { - /** Baseclass for all grouping 3D primitives + /** GroupPrimitive3D class + + Baseclass for all grouping 3D primitives The description/functionality is identical with the 2D case in groupprimitive2d.hxx, please see there for detailed information. @@ -64,23 +66,23 @@ namespace drawinglayer class GroupPrimitive3D : public BasePrimitive3D { private: - // the children. Declared private since this shall never be changed at all after construction + /// the children. Declared private since this shall never be changed at all after construction Primitive3DSequence maChildren; public: - // constructor + /// constructor GroupPrimitive3D(const Primitive3DSequence& rChildren); - // data access + /// data read access Primitive3DSequence getChildren() const { return maChildren; } - // compare operator + /// compare operator virtual bool operator==( const BasePrimitive3D& rPrimitive ) const; - // local decomposition. Implementation will just return children + /// local decomposition. Implementation will just return children virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx index 2e1d7e0b5fe4..2675a1284779 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx @@ -44,7 +44,9 @@ namespace drawinglayer { namespace primitive3d { - /** HatchTexturePrimitive3D is derived from GroupPrimitive3D, but implements + /** HatchTexturePrimitive3D class + + HatchTexturePrimitive3D is derived from GroupPrimitive3D, but implements a decomposition which is complicated enough for buffering. Since the group primitive has no default buffering, it is necessary here to add a local buffering mechanism for the decomposition @@ -52,7 +54,10 @@ namespace drawinglayer class HatchTexturePrimitive3D : public TexturePrimitive3D { private: + /// the hatch definition attribute::FillHatchAttribute maHatch; + + /// the buffered decomposed hatch Primitive3DSequence maBuffered3DDecomposition; protected: @@ -64,6 +69,7 @@ namespace drawinglayer void setBuffered3DDecomposition(const Primitive3DSequence& rNew) { maBuffered3DDecomposition = rNew; } public: + /// constructor HatchTexturePrimitive3D( const attribute::FillHatchAttribute& rHatch, const Primitive3DSequence& rChildren, @@ -71,16 +77,16 @@ namespace drawinglayer bool bModulate, bool bFilter); - // get data + /// data read access const attribute::FillHatchAttribute& getHatch() const { return maHatch; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // local decomposition. + /// local decomposition. virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx index 0c5082699e8d..4779241033b0 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx @@ -44,31 +44,37 @@ namespace drawinglayer { namespace primitive3d { - // This primitive is used to represent geometry for non-visible objects, - // e.g. a 3D cube without fill attributes. To still be able to use - // primitives for HitTest functionality, the 3d decompositions produce - // an as much as possible simplified fill geometry encapsulated in this - // primtive when there is no fill geometry. Currently, the 3d hit test - // uses only areas, so maybe in a further enchanced version this will change - // to 'if neither filled nor lines' creation criteria. The whole primitive - // decomposes to nothing, so no one not knowing it will be influenced. Only - // helper processors for hit test (and maybe BoundRect extractors) will - // use it and it's children subcontent. + /** HitTestPrimitive3D class + + This primitive is used to represent geometry for non-visible objects, + e.g. a 3D cube without fill attributes. To still be able to use + primitives for HitTest functionality, the 3d decompositions produce + an as much as possible simplified fill geometry encapsulated in this + primtive when there is no fill geometry. Currently, the 3d hit test + uses only areas, so maybe in a further enchanced version this will change + to 'if neither filled nor lines' creation criteria. The whole primitive + decomposes to nothing, so no one not knowing it will be influenced. Only + helper processors for hit test (and maybe BoundRect extractors) will + use it and it's children subcontent. + */ class HitTestPrimitive3D : public GroupPrimitive3D { public: + /// constructor HitTestPrimitive3D(const Primitive3DSequence& rChildren); - // despite returning an empty decomposition since it's no visualisation data, - // range calculation is intended to use invisible replacement geometry, so - // the local implementation will return the children's range + /** despite returning an empty decomposition since it's no visualisation data, + range calculation is intended to use invisible replacement geometry, so + the local implementation will return the children's range + */ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; - // local decomposition. Implementation will return empty Primitive3DSequence - // since this is no visualisation data + /** local decomposition. Implementation will return empty Primitive3DSequence + since this is no visualisation data + */ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx index 0771e8117fc5..3840bf71a397 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx @@ -45,23 +45,32 @@ namespace drawinglayer { namespace primitive3d { + /** ModifiedColorPrimitive3D class + + This primitive is a grouping primitive and allows to define + how the colors of it's child content shall be modified for + visualisation. Please see the ModifiedColorPrimitive2D + description for more info. + */ class ModifiedColorPrimitive3D : public GroupPrimitive3D { private: + /// The ColorModifier to use basegfx::BColorModifier maColorModifier; public: + /// constructor ModifiedColorPrimitive3D( const Primitive3DSequence& rChildren, const basegfx::BColorModifier& rColorModifier); - // get data + /// data read access const basegfx::BColorModifier& getColorModifier() const { return maColorModifier; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx index 9b97f60d3642..c73850e4f794 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx @@ -48,28 +48,40 @@ namespace drawinglayer { namespace primitive3d { + /** PolygonHairlinePrimitive3D class + + This primitive defines a Hairline in 3D. Since hairlines are view-dependent, + this primitive is view-dependent, too. + + This is one of the non-decomposable 3D primitives, so a renderer + should proccess it. + */ class PolygonHairlinePrimitive3D : public BasePrimitive3D { private: + /// the hairline geometry basegfx::B3DPolygon maPolygon; + + /// the hairline color basegfx::BColor maBColor; public: + /// constructor PolygonHairlinePrimitive3D( const basegfx::B3DPolygon& rPolygon, const basegfx::BColor& rBColor); - // get data + /// data read access const basegfx::B3DPolygon& getB3DPolygon() const { return maPolygon; } const basegfx::BColor& getBColor() const { return maBColor; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // get range + /// get range virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d @@ -81,36 +93,49 @@ namespace drawinglayer { namespace primitive3d { + /** PolygonStrokePrimitive3D class + + This primitive defines a 3D line with line width, line join, line color + and stroke attributes. It will be decomposed dependent on the definition + to the needed primitives, e.g. filled Tubes for fat lines. + */ class PolygonStrokePrimitive3D : public BufferedDecompositionPrimitive3D { private: + /// the line geometry basegfx::B3DPolygon maPolygon; + + /// the line attributes like width, join and color attribute::LineAttribute maLineAttribute; + + /// the line stroking (if used) attribute::StrokeAttribute maStrokeAttribute; protected: - // local decomposition. + /// local decomposition. virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: + /// constructor PolygonStrokePrimitive3D( const basegfx::B3DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute); + /// constructor without stroking PolygonStrokePrimitive3D( const basegfx::B3DPolygon& rPolygon, const attribute::LineAttribute& rLineAttribute); - // get data + /// data read access basegfx::B3DPolygon getB3DPolygon() const { return maPolygon; } const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx index 695d16ec7cf5..f5d45f7c1639 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx @@ -52,13 +52,20 @@ namespace drawinglayer { namespace primitive3d { + /** PolygonStrokePrimitive3D class + + This 3D primitive extends a 3D hairline to a 3D tube which is + e.g. used for fat lines in 3D. It's decomposition will create all + 3D objects needed for the line tubes and the edge roundings + in full 3D. + */ class PolygonTubePrimitive3D : public PolygonHairlinePrimitive3D { private: - // hold the last decompositon since it's expensive + /// hold the last decompositon since it's expensive Primitive3DSequence maLast3DDecomposition; - // visualisation parameters + /// visualisation parameters double mfRadius; double mfDegreeStepWidth; double mfMiterMinimumAngle; @@ -72,10 +79,11 @@ namespace drawinglayer const Primitive3DSequence& getLast3DDecomposition() const { return maLast3DDecomposition; } void setLast3DDecomposition(const Primitive3DSequence& rNew) { maLast3DDecomposition = rNew; } - // local decomposition. + /// local decomposition. Primitive3DSequence impCreate3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: + /// constructor PolygonTubePrimitive3D( const basegfx::B3DPolygon& rPolygon, const basegfx::BColor& rBColor, @@ -83,13 +91,13 @@ namespace drawinglayer double fDegreeStepWidth = 10.0 * F_PI180, double fMiterMinimumAngle = 15.0 * F_PI180); - // get data + /// data read access double getRadius() const { return mfRadius; } double getDegreeStepWidth() const { return mfDegreeStepWidth; } double getMiterMinimumAngle() const { return mfMiterMinimumAngle; } basegfx::B2DLineJoin getLineJoin() const { return maLineJoin; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; /** local decomposition. Use own buffering since we are not derived from @@ -97,7 +105,7 @@ namespace drawinglayer */ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/polypolygonprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/polypolygonprimitive3d.hxx index 1c5b9e400bbb..091e8181e38f 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/polypolygonprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/polypolygonprimitive3d.hxx @@ -46,33 +46,45 @@ namespace drawinglayer { namespace primitive3d { + /** PolyPolygonMaterialPrimitive3D class + + This primitive defines a planar 3D PolyPolygon filled with a single color. + This is one of the non-decomposable primitives, so a renderer + should proccess it. + + It is assumed here that the PolyPolgon is a single plane in 3D. + */ class PolyPolygonMaterialPrimitive3D : public BasePrimitive3D { private: + /// the PolyPolygon geometry basegfx::B3DPolyPolygon maPolyPolygon; + + /// the fill parameters attribute::MaterialAttribute3D maMaterial; - // bitfield + /// bitfield unsigned mbDoubleSided : 1; public: + /// constructor PolyPolygonMaterialPrimitive3D( const basegfx::B3DPolyPolygon& rPolyPolygon, const attribute::MaterialAttribute3D& rMaterial, bool bDoubleSided); - // get data + /// data read access const basegfx::B3DPolyPolygon& getB3DPolyPolygon() const { return maPolyPolygon; } const attribute::MaterialAttribute3D& getMaterial() const { return maMaterial; } bool getDoubleSided() const { return mbDoubleSided; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // get range + /// get range virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx index 42a9ab94f327..b3a57f2677dc 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx @@ -44,26 +44,33 @@ namespace drawinglayer { namespace primitive3d { + /** SdrCubePrimitive3D class + + This 3D primitive expands the SdrPrimitive3D to a 3D cube definition. + The cube is implicitely in unit coordinates and the given transformation + defines it's geometry in space. + */ class SdrCubePrimitive3D : public SdrPrimitive3D { protected: - // local decomposition. + /// local decomposition. virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: + /// constructor SdrCubePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute); - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // get range + /// get range virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx index 772e030781fe..5b793a6928f8 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx @@ -42,6 +42,7 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + namespace basegfx { class B3DPolygon; class B3DPolyPolygon; diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx index 43ae13d4625f..b80198d127d2 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx @@ -53,7 +53,7 @@ namespace drawinglayer { namespace primitive3d { - // Slice3D types + /** SliceType3D definition */ enum SliceType3D { SLICETYPE3D_REGULAR, // normal geoemtry Slice3D @@ -61,7 +61,7 @@ namespace drawinglayer SLICETYPE3D_BACKCAP // back cap }; - // class to hold one Slice3D + /// class to hold one Slice3D class Slice3D { protected: @@ -92,10 +92,10 @@ namespace drawinglayer SliceType3D getSliceType() const { return maSliceType; } }; - // typedef for a group of Slice3Ds + /// typedef for a group of Slice3Ds typedef ::std::vector< Slice3D > Slice3DVector; - // helpers for creation + /// helpers for creation void createLatheSlices( Slice3DVector& rSliceVector, const basegfx::B2DPolyPolygon& rSource, @@ -117,7 +117,7 @@ namespace drawinglayer bool bCloseFront, bool bCloseBack); - // helpers for geometry extraction + /// helpers for geometry extraction basegfx::B3DPolyPolygon extractHorizontalLinesFromSlice(const Slice3DVector& rSliceVector, bool bCloseHorLines); basegfx::B3DPolyPolygon extractVerticalLinesFromSlice(const Slice3DVector& rSliceVector); diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx index a5975b050797..a810e0f5ec8e 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx @@ -45,23 +45,34 @@ namespace drawinglayer { namespace primitive3d { + /** SdrExtrudePrimitive3D class + + This 3D primitive expands the SdrPrimitive3D to a 3D extrude definition. + The given 2D PolyPolygon geometry is imagined as lying on the XY-plane in 3D + and gets extruded in Z-Direction by Depth. + + Various possibilities e.g. for creating diagonals (edge roudings in 3D) + and similar are given. + + The decomposition will create all necessary 3D planes for visualisation. + */ class SdrExtrudePrimitive3D : public SdrPrimitive3D { private: - // geometry helper for slices + /// geometry helper for slices basegfx::B2DPolyPolygon maCorrectedPolyPolygon; Slice3DVector maSlices; - // primitive data + /// primitive geometry data basegfx::B2DPolyPolygon maPolyPolygon; double mfDepth; double mfDiagonal; double mfBackScale; - // decomposition data when ReducedLineGeometry is used, see get3DDecomposition + /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition geometry::ViewInformation3D* mpLastRLGViewInformation; - // bitfield + /// bitfield unsigned mbSmoothNormals : 1; // Plane self unsigned mbSmoothHorizontalNormals : 1; // always unsigned mbSmoothLids : 1; // Front/back @@ -69,17 +80,18 @@ namespace drawinglayer unsigned mbCloseFront : 1; unsigned mbCloseBack : 1; - // create slices + /// create slices void impCreateSlices(); - // get (evtl. create) slices + /// get (evtl. create) slices const Slice3DVector& getSlices() const; protected: - // local decomposition. + /// local decomposition. virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: + /// constructor SdrExtrudePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, @@ -97,7 +109,7 @@ namespace drawinglayer bool bCloseBack); virtual ~SdrExtrudePrimitive3D(); - // data access + /// data read access const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; } double getDepth() const { return mfDepth; } double getDiagonal() const { return mfDiagonal; } @@ -109,16 +121,16 @@ namespace drawinglayer bool getCloseFront() const { return mbCloseFront; } bool getCloseBack() const { return mbCloseBack; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // get range + /// get range virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; - // Overloaded to allow for reduced line mode to decide if to buffer decomposition or not + /// Overloaded to allow for reduced line mode to decide if to buffer decomposition or not virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx index 7d80cbde015c..084ce5bce35e 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx @@ -45,14 +45,25 @@ namespace drawinglayer { namespace primitive3d { + /** SdrLathePrimitive3D class + + This 3D primitive expands the SdrPrimitive3D to a 3D rotation definition. + The given 2D PolyPolygon geometry is imagined as lying on the XY-plane in 3D + and gets rotated around the Y-Axis. + + Various possibilities e.g. for creating diagonals (edge roudings in 3D) + and similar are given. + + The decomposition will create all necessary 3D planes for visualisation. + */ class SdrLathePrimitive3D : public SdrPrimitive3D { private: - // geometry helper for slices + /// geometry helper for slices basegfx::B2DPolyPolygon maCorrectedPolyPolygon; Slice3DVector maSlices; - // primitive data + /// primitive geometry data basegfx::B2DPolyPolygon maPolyPolygon; sal_uInt32 mnHorizontalSegments; sal_uInt32 mnVerticalSegments; @@ -60,10 +71,10 @@ namespace drawinglayer double mfBackScale; double mfRotation; - // decomposition data when ReducedLineGeometry is used, see get3DDecomposition + /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition geometry::ViewInformation3D* mpLastRLGViewInformation; - // bitfield + /// bitfield unsigned mbSmoothNormals : 1; // Plane self unsigned mbSmoothHorizontalNormals : 1; // always unsigned mbSmoothLids : 1; // Front/back @@ -71,14 +82,14 @@ namespace drawinglayer unsigned mbCloseFront : 1; unsigned mbCloseBack : 1; - // create slices + /// create slices void impCreateSlices(); - // get (evtl. create) slices + /// get (evtl. create) slices const Slice3DVector& getSlices() const; protected: - // local helpers + /// local helpers void impCreateOutlines( const geometry::ViewInformation3D& rViewInformation, const basegfx::B3DPolygon& rLoopA, @@ -90,10 +101,11 @@ namespace drawinglayer const basegfx::B2DPoint& rStart, const basegfx::B2DPoint& rEnd) const; - // local decomposition. + /// local decomposition. virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: + /// constructor SdrLathePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, @@ -113,7 +125,7 @@ namespace drawinglayer bool bCloseBack); virtual ~SdrLathePrimitive3D(); - // data access + /// data read access const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; } sal_uInt32 getHorizontalSegments() const { return mnHorizontalSegments; } sal_uInt32 getVerticalSegments() const { return mnVerticalSegments; } @@ -127,16 +139,16 @@ namespace drawinglayer bool getCloseFront() const { return mbCloseFront; } bool getCloseBack() const { return mbCloseBack; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // get range + /// get range virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; - // Overloaded to allow for reduced line mode to decide if to buffer decomposition or not + /// Overloaded to allow for reduced line mode to decide if to buffer decomposition or not virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx index b0d7cc5c26a2..a6c68bd16da8 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx @@ -44,17 +44,28 @@ namespace drawinglayer { namespace primitive3d { + /** SdrPolyPolygonPrimitive3D class + + This 3D primitive defines a PolyPolgon in space which may have + Line- and FillStyles and extra 3D surface attributes. It is assumed + that the given 3D PolyPolgon (which may contain texture and normal + information) is planar in 3D. + + The decomposition will include all needed 3D data for visualisation, + including FatLines and fill styles. + */ class SdrPolyPolygonPrimitive3D : public SdrPrimitive3D { private: - // the polyPolygon evtl with normals and texture coordinates + /// the planar polyPolygon evtl with normals and texture coordinates basegfx::B3DPolyPolygon maPolyPolygon3D; protected: - // local decomposition. + /// local decomposition. virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: + /// constructor SdrPolyPolygonPrimitive3D( const basegfx::B3DPolyPolygon& rPolyPolygon3D, const basegfx::B3DHomMatrix& rTransform, @@ -62,16 +73,16 @@ namespace drawinglayer const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute); - // data access + /// data access const basegfx::B3DPolyPolygon& getPolyPolygon3D() const { return maPolyPolygon3D; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // get range + /// get range virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx index d2296968a000..4dd620848387 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx @@ -47,43 +47,49 @@ namespace drawinglayer { - /** base class for the more complicated geometric primitives, so + /** SdrPrimitive3D class + + Base class for the more complicated geometric primitives, so derive from buffered primitive to allow overloading of - create3DDecomposition there + create3DDecomposition there. */ namespace primitive3d { class SdrPrimitive3D : public BufferedDecompositionPrimitive3D { private: + /// object surface attributes basegfx::B3DHomMatrix maTransform; basegfx::B2DVector maTextureSize; attribute::SdrLineFillShadowAttribute maSdrLFSAttribute; attribute::Sdr3DObjectAttribute maSdr3DObjectAttribute; protected: - // Standard implementation for primitive3D which - // will use maTransform as range and expand by evtl. line width / 2 + /** Standard implementation for primitive3D which + will use maTransform as range and expand by evtl. line width / 2 + */ basegfx::B3DRange getStandard3DRange() const; - // implementation for primitive3D which - // will use given Slice3Ds and expand by evtl. line width / 2 + /** implementation for primitive3D which + will use given Slice3Ds and expand by evtl. line width / 2 + */ basegfx::B3DRange get3DRangeFromSlices(const Slice3DVector& rSlices) const; public: + /// constructor SdrPrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute); - // data access + /// data read access const basegfx::B3DHomMatrix& getTransform() const { return maTransform; } const basegfx::B2DVector& getTextureSize() const { return maTextureSize; } const attribute::SdrLineFillShadowAttribute& getSdrLFSAttribute() const { return maSdrLFSAttribute; } const attribute::Sdr3DObjectAttribute getSdr3DObjectAttribute() const { return maSdr3DObjectAttribute; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx index 3e6349df0bb9..52e646e6b4dc 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx @@ -44,17 +44,25 @@ namespace drawinglayer { namespace primitive3d { + /** SdrSpherePrimitive3D class + + This 3D primitive expands the SdrPrimitive3D to a 3D sphere definition. + The sphere is implicitely in unit coordinates and the given transformation + defines it's geometry in space. + */ class SdrSpherePrimitive3D : public SdrPrimitive3D { private: + /// additional geometry definitions sal_uInt32 mnHorizontalSegments; sal_uInt32 mnVerticalSegments; protected: - // local decomposition. + /// local decomposition. virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: + /// constructor SdrSpherePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, @@ -63,17 +71,17 @@ namespace drawinglayer sal_uInt32 nHorizontalSegments, sal_uInt32 nVerticalSegments); - // data access + /// data read access sal_uInt32 getHorizontalSegments() const { return mnHorizontalSegments; } sal_uInt32 getVerticalSegments() const { return mnVerticalSegments; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // get range + /// get range virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/shadowprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/shadowprimitive3d.hxx index d511c89a9998..cb8e9cd385d0 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/shadowprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/shadowprimitive3d.hxx @@ -46,17 +46,29 @@ namespace drawinglayer { namespace primitive3d { + /** ShadowPrimitive3D class + + This 3D grouping primitive is used to define a shadow for + 3d geometry by embedding it. The shadow of 3D objects are + 2D polygons, so the shadow transformation is a 2D transformation. + + If the Shadow3D flag is set, the shadow definition has to be + combined with the scene and camera definition to create the correct + projected shadow 2D-Polygons. + */ class ShadowPrimitive3D : public GroupPrimitive3D { protected: + /// 2D shadow definition basegfx::B2DHomMatrix maShadowTransform; basegfx::BColor maShadowColor; double mfShadowTransparence; - // bitfield + /// bitfield unsigned mbShadow3D : 1; public: + /// constructor ShadowPrimitive3D( const basegfx::B2DHomMatrix& rShadowTransform, const basegfx::BColor& rShadowColor, @@ -64,16 +76,16 @@ namespace drawinglayer bool bShadow3D, const Primitive3DSequence& rChildren); - // get data + /// data read access const basegfx::B2DHomMatrix& getShadowTransform() const { return maShadowTransform; } const basegfx::BColor& getShadowColor() const { return maShadowColor; } double getShadowTransparence() const { return mfShadowTransparence; } bool getShadow3D() const { return mbShadow3D; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx index a0c18f34788e..052d42f7290e 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx @@ -47,31 +47,39 @@ namespace drawinglayer { namespace primitive3d { + /** TexturePrimitive3D class + + This 3D grouping primitive is used to define a texture for + 3d geometry by embedding it. It is used as bae class for + extended texture definitions + */ class TexturePrimitive3D : public GroupPrimitive3D { private: + /// texture geometry definition basegfx::B2DVector maTextureSize; - // bitfield - // flag if texture shall be modulated with white interpolated color + /// bitfield + /// flag if texture shall be modulated with white interpolated color unsigned mbModulate : 1; - // flag if texture shall be filtered + /// flag if texture shall be filtered unsigned mbFilter : 1; public: + /// constructor TexturePrimitive3D( const Primitive3DSequence& rChildren, const basegfx::B2DVector& rTextureSize, bool bModulate, bool bFilter); - // get data + /// data read access const basegfx::B2DVector& getTextureSize() const { return maTextureSize; } bool getModulate() const { return mbModulate; } bool getFilter() const { return mbFilter; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; }; } // end of namespace primitive3d @@ -83,26 +91,34 @@ namespace drawinglayer { namespace primitive3d { + /** UnifiedAlphaTexturePrimitive3D class + + This 3D primitive expands TexturePrimitive3D to a unified + alpha (transparence) texture definition. All 3D primitives + embedded here will be shown with the given transparency. + */ class UnifiedAlphaTexturePrimitive3D : public TexturePrimitive3D { private: + /// transparency definition double mfTransparence; public: + /// constructor UnifiedAlphaTexturePrimitive3D( double fTransparence, const Primitive3DSequence& rChildren); - // get data + /// data read access double getTransparence() const { return mfTransparence; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // local decomposition. + /// local decomposition. virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d @@ -114,12 +130,20 @@ namespace drawinglayer { namespace primitive3d { + /** GradientTexturePrimitive3D class + + This 3D primitive expands TexturePrimitive3D to a gradient texture + definition. All 3D primitives embedded here will be shown with the + defined gradient. + */ class GradientTexturePrimitive3D : public TexturePrimitive3D { private: + /// the gradient definition attribute::FillGradientAttribute maGradient; public: + /// constructor GradientTexturePrimitive3D( const attribute::FillGradientAttribute& rGradient, const Primitive3DSequence& rChildren, @@ -127,13 +151,13 @@ namespace drawinglayer bool bModulate, bool bFilter); - // get data + /// data read access const attribute::FillGradientAttribute& getGradient() const { return maGradient; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d @@ -145,12 +169,20 @@ namespace drawinglayer { namespace primitive3d { + /** BitmapTexturePrimitive3D class + + This 3D primitive expands TexturePrimitive3D to a bitmap texture + definition. All 3D primitives embedded here will be shown with the + defined bitmap (maybe tiled if defined). + */ class BitmapTexturePrimitive3D : public TexturePrimitive3D { private: + /// bitmap fill attribute attribute::FillBitmapAttribute maBitmap; public: + /// constructor BitmapTexturePrimitive3D( const attribute::FillBitmapAttribute& rBitmap, const Primitive3DSequence& rChildren, @@ -158,13 +190,13 @@ namespace drawinglayer bool bModulate, bool bFilter); - // get data + /// data read access const attribute::FillBitmapAttribute& getBitmap() const { return maBitmap; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d @@ -176,18 +208,26 @@ namespace drawinglayer { namespace primitive3d { + /** AlphaTexturePrimitive3D class + + This 3D primitive expands TexturePrimitive3D to a alpha texture + definition. For alpha definition, a gradient is used. The values in + that gradient will be interpreted as luminance Alpha-Values. All 3D + primitives embedded here will be shown with the defined transparence. + */ class AlphaTexturePrimitive3D : public GradientTexturePrimitive3D { public: + /// constructor AlphaTexturePrimitive3D( const attribute::FillGradientAttribute& rGradient, const Primitive3DSequence& rChildren, const basegfx::B2DVector& rTextureSize); - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d diff --git a/drawinglayer/inc/drawinglayer/primitive3d/transformprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/transformprimitive3d.hxx index 720f28445dec..bbf2b8444969 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/transformprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/transformprimitive3d.hxx @@ -45,26 +45,37 @@ namespace drawinglayer { namespace primitive3d { + /** TransformPrimitive3D class + + This is one of the basic grouping 3D primitives and it provides + embedding a sequence of primitives (a geometry) into a + 3D transformation. + + Please see the description for TransformPrimitive2D since these + primitives are pretty similar. + */ class TransformPrimitive3D : public GroupPrimitive3D { private: + // the 3D transformation to apply basegfx::B3DHomMatrix maTransformation; public: + /// constructor TransformPrimitive3D( const basegfx::B3DHomMatrix& rTransformation, const Primitive3DSequence& rChildren); - // get data + /// data read access const basegfx::B3DHomMatrix& getTransformation() const { return maTransformation; } - // compare operator + /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; - // get range + /// get range virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; - // provide unique ID + /// provide unique ID DeclPrimitrive3DIDBlock() }; } // end of namespace primitive3d -- cgit v1.2.3 From 15dcfdd7c813c4158a18c52c7ba22c14c7dac996 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 12 Nov 2009 11:26:43 +0100 Subject: aw078 #i106541# commited in-between stable version with already advanced metafile decomposition for security reasons --- .../drawinglayer/attribute/fillbitmapattribute.hxx | 12 +- .../inc/drawinglayer/attribute/fontattribute.hxx | 116 + .../primitive2d/discretebitmapprimitive2d.hxx | 93 + .../primitive2d/drawinglayer_primitivetypes2d.hxx | 5 + .../primitive2d/fillgradientprimitive2d.hxx | 29 +- .../drawinglayer/primitive2d/invertprimitive2d.hxx | 2 +- .../primitive2d/metafileprimitive2d.hxx | 5 +- .../drawinglayer/primitive2d/primitivetools2d.hxx | 83 + .../primitive2d/textdecoratedprimitive2d.hxx | 82 +- .../primitive2d/textenumsprimitive2d.hxx | 110 + .../drawinglayer/primitive2d/textlayoutdevice.hxx | 21 +- .../primitive2d/textlineprimitive2d.hxx | 99 + .../drawinglayer/primitive2d/textprimitive2d.hxx | 80 +- .../primitive2d/textstrikeoutprimitive2d.hxx | 167 ++ .../primitive2d/wallpaperprimitive2d.hxx | 102 + .../primitive3d/textureprimitive3d.hxx | 6 +- .../processor2d/vclmetafileprocessor2d.hxx | 2 +- drawinglayer/prj/d.lst | 2 + .../source/attribute/fillbitmapattribute.cxx | 16 +- drawinglayer/source/attribute/fontattribute.cxx | 63 + drawinglayer/source/attribute/makefile.mk | 1 + .../source/attribute/sdrfillbitmapattribute.cxx | 2 +- .../source/primitive2d/bitmapprimitive2d.cxx | 4 +- .../primitive2d/discretebitmapprimitive2d.cxx | 124 + .../source/primitive2d/fillbitmapprimitive2d.cxx | 6 +- .../source/primitive2d/fillgradientprimitive2d.cxx | 174 +- .../source/primitive2d/graphicprimitive2d.cxx | 504 +++- drawinglayer/source/primitive2d/makefile.mk | 4 + .../source/primitive2d/metafileprimitive2d.cxx | 2485 +++++++++++++++++++- .../source/primitive2d/primitivetools2d.cxx | 72 + .../primitive2d/textdecoratedprimitive2d.cxx | 403 +--- .../source/primitive2d/textlayoutdevice.cxx | 48 +- .../source/primitive2d/textlineprimitive2d.cxx | 317 +++ .../source/primitive2d/textprimitive2d.cxx | 41 +- .../primitive2d/textstrikeoutprimitive2d.cxx | 294 +++ .../source/primitive2d/wallpaperprimitive2d.cxx | 276 +++ .../source/primitive3d/textureprimitive3d.cxx | 6 +- .../source/processor2d/canvasprocessor.cxx | 18 +- .../source/processor2d/vclmetafileprocessor2d.cxx | 52 +- .../source/processor2d/vclpixelprocessor2d.cxx | 25 +- drawinglayer/source/processor2d/vclprocessor2d.cxx | 61 +- .../source/processor3d/defaultprocessor3d.cxx | 6 +- svx/source/sdr/overlay/overlayselection.cxx | 11 +- svx/source/svdraw/svdfmtf.cxx | 18 +- svx/source/svdraw/svdograf.cxx | 2 +- svx/source/svdraw/svdotextdecomposition.cxx | 65 +- svx/source/svdraw/svdotextpathdecomposition.cxx | 8 +- 47 files changed, 5363 insertions(+), 759 deletions(-) create mode 100644 drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/textenumsprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/textlineprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/wallpaperprimitive2d.hxx create mode 100644 drawinglayer/source/attribute/fontattribute.cxx create mode 100644 drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx create mode 100644 drawinglayer/source/primitive2d/textlineprimitive2d.cxx create mode 100644 drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx create mode 100644 drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx (limited to 'drawinglayer/inc/drawinglayer/primitive2d') diff --git a/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx index 4e316232bd81..376e1d626927 100644 --- a/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx @@ -36,7 +36,7 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX -#include +#include #include #include @@ -56,7 +56,7 @@ namespace drawinglayer { class FillBitmapAttribute { - Bitmap maBitmap; + BitmapEx maBitmapEx; basegfx::B2DPoint maTopLeft; basegfx::B2DVector maSize; @@ -64,11 +64,15 @@ namespace drawinglayer unsigned mbTiling : 1; public: - FillBitmapAttribute(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize, bool bTiling); + FillBitmapAttribute( + const BitmapEx& rBitmapEx, + const basegfx::B2DPoint& rTopLeft, + const basegfx::B2DVector& rSize, + bool bTiling); bool operator==(const FillBitmapAttribute& rCandidate) const; // data access - const Bitmap& getBitmap() const { return maBitmap; } + const BitmapEx& getBitmapEx() const { return maBitmapEx; } const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; } const basegfx::B2DVector& getSize() const { return maSize; } bool getTiling() const { return mbTiling; } diff --git a/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx new file mode 100644 index 000000000000..f34ee913418f --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: strokeattribute.hxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + /** FontAttribute class + + This attribute class is able to hold all parameters needed/used + to completely define the parametrisation of a text portion. + */ + class FontAttribute + { + private: + /// core data + String maFamilyName; // Font Family Name + String maStyleName; // Font Style Name + sal_uInt16 mnWeight; // Font weight + + /// bitfield + unsigned mbSymbol : 1; // Symbol Font Flag + unsigned mbVertical : 1; // Vertical Text Flag + unsigned mbItalic : 1; // Italic Flag + unsigned mbOutline : 1; // Outline Flag + unsigned mbRTL : 1; // RTL Flag + unsigned mbBiDiStrong : 1; // BiDi Flag + // TODO: pair kerning and CJK kerning + + public: + /// constructor + FontAttribute( + const String& rFamilyName, + const String& rStyleName, + sal_uInt16 nWeight, + bool bSymbol = false, + bool bVertical = false, + bool bItalic = false, + bool bOutline = false, + bool bRTL = false, + bool bBiDiStrong = false) + : maFamilyName(rFamilyName), + maStyleName(rStyleName), + mnWeight(nWeight), + mbSymbol(bSymbol), + mbVertical(bVertical), + mbItalic(bItalic), + mbOutline(bOutline), + mbRTL(bRTL), + mbBiDiStrong(bBiDiStrong) + { + } + + /// compare operator + bool operator==(const FontAttribute& rCompare) const; + + /// data read access + const String& getFamilyName() const { return maFamilyName; } + const String& getStyleName() const { return maStyleName; } + sal_uInt16 getWeight() const { return mnWeight; } + bool getSymbol() const { return mbSymbol; } + bool getVertical() const { return mbVertical; } + bool getItalic() const { return mbItalic; } + bool getOutline() const { return mbOutline; } + bool getRTL() const { return mbRTL; } + bool getBiDiStrong() const { return mbBiDiStrong; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx new file mode 100644 index 000000000000..04ddb73460fa --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: bitmapprimitive2d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETEBITMAPPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETEBITMAPPRIMITIVE2D_HXX + +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// DiscreteBitmapPrimitive2D class + +namespace drawinglayer +{ + namespace primitive2d + { + /** DiscreteBitmapPrimitive2D class + + This class defines a view-dependent BitmapPrimitive which has a + logic position for the top-left position and is always to be + painted in 1:1 pixel resolution. It will never be sheared, rotated + or scaled with the view. + */ + class DiscreteBitmapPrimitive2D : public ObjectAndViewTransformationDependentPrimitive2D + { + private: + /// the RGBA Bitmap-data + BitmapEx maBitmapEx; + + /** the top-left object position */ + basegfx::B2DPoint maTopLeft; + + protected: + /// local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + /// constructor + DiscreteBitmapPrimitive2D( + const BitmapEx& rBitmapEx, + const basegfx::B2DPoint& rTopLeft); + + /// data read access + const BitmapEx& getBitmapEx() const { return maBitmapEx; } + const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + /// provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETEBITMAPPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index 8d5d089f5800..477c3a19042a 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -103,6 +103,11 @@ #define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52) #define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53) #define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54) +#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55) +#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56) +#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57) +#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58) +#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx index d6853e69b149..0fd084c6fad0 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx @@ -40,7 +40,12 @@ #include ////////////////////////////////////////////////////////////////////////////// -// FillbitmapPrimitive2D class +// predefines + +namespace basegfx { class B2DPolygon; } + +////////////////////////////////////////////////////////////////////////////// +// FillGradientPrimitive2D class namespace drawinglayer { @@ -53,6 +58,12 @@ namespace drawinglayer The decomposition will deliver the decomposed gradient, e.g. for an ellipse gradient the various ellipses in various color steps will be created. + + I have added functionality to create both versions of filled decompositions: + Those who overlap and non-overlapping ones. The overlapping version is the + default one since it works with and without AntiAliasing. The non-overlapping + version is used in the MetafilePrimitive2D decomposition when the old XOR + paint was recorded. */ class FillGradientPrimitive2D : public BufferedDecompositionPrimitive2D { @@ -63,7 +74,23 @@ namespace drawinglayer /// the gradient definition attribute::FillGradientAttribute maFillGradient; + /// local helpers + void generateMatricesAndColors( + std::vector< basegfx::B2DHomMatrix >& rMatrices, + std::vector< basegfx::BColor >& rColors) const; + Primitive2DSequence createOverlappingFill( + const std::vector< basegfx::B2DHomMatrix >& rMatrices, + const std::vector< basegfx::BColor >& rColors, + const basegfx::B2DPolygon& rUnitPolygon) const; + Primitive2DSequence createNonOverlappingFill( + const std::vector< basegfx::B2DHomMatrix >& rMatrices, + const std::vector< basegfx::BColor >& rColors, + const basegfx::B2DPolygon& rUnitPolygon) const; + protected: + /// local helper + Primitive2DSequence createFill(bool bOverlapping) const; + /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx index 9ba7e7796395..85f1c6510c5a 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx @@ -44,7 +44,7 @@ namespace drawinglayer { namespace primitive2d { - /** HitTestPrimitive2D class + /** InvertPrimitive2D class This is a helper class which encapsulates geometry that should be painted XOR, e.g. old cursor visualisations. It decomposes to diff --git a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx index 039db9387024..0cbd7e4628cb 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx @@ -67,7 +67,7 @@ namespace drawinglayer have many advantages; Metafile would no longer have to be rendered by sub-systems and a standard way for converting Metafiles would exist. */ - class MetafilePrimitive2D : public BasePrimitive2D + class MetafilePrimitive2D : public BufferedDecompositionPrimitive2D { private: /// the geometry definition @@ -76,6 +76,9 @@ namespace drawinglayer /// the content definition GDIMetaFile maMetaFile; + protected: + /// local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: /// constructor MetafilePrimitive2D( diff --git a/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx index 77d56ca8026f..a095c558ba12 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx @@ -37,6 +37,7 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -118,6 +119,88 @@ namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// +namespace drawinglayer +{ + namespace primitive2d + { + /** ViewTransformationDependentPrimitive2D class + + tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent + regarding the complete Viewtransformation. The implementation of get2DDecomposition + guards the buffered local decomposition and ensures that a create2DDecomposition + implementation may use an up-to-date ViewTransformation accessible using getViewTransformation() + */ + class ViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + /** the last used ViewTransformation definition for decomposition. Since this + is checked and updated from get2DDecomposition() it will be current and + usable in create2DDecomposition() + */ + basegfx::B2DHomMatrix maViewTransformation; + + public: + /// constructor + ViewTransformationDependentPrimitive2D() + : BufferedDecompositionPrimitive2D(), + maViewTransformation() + { + } + + /// data read access + const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; } + + /// get local decomposition. Overloaded since this decomposition is view-dependent + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + /** ObjectAndViewTransformationDependentPrimitive2D class + + tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent + and Object-Transform dependent. The implementation of get2DDecomposition + guards the buffered local decomposition and ensures that a create2DDecomposition + implementation may use an up-to-date ViewTransformation accessible using getViewTransformation() + and an object transformation via getObjectTransformation() + */ + class ObjectAndViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + /** the last used ViewTransformation and the last ObjectTransformation + definition for decomposition. Since this is checked and updated from + get2DDecomposition() it will be current and usable in create2DDecomposition() + */ + basegfx::B2DHomMatrix maViewTransformation; + basegfx::B2DHomMatrix maObjectTransformation; + + public: + /// constructor + ObjectAndViewTransformationDependentPrimitive2D() + : BufferedDecompositionPrimitive2D(), + maViewTransformation(), + maObjectTransformation() + { + } + + /// data read access + const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; } + const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } + + /// get local decomposition. Overloaded since this decomposition is view-dependent + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx index 4f33c8a7d48b..6c7ea8bd24c5 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx @@ -37,6 +37,7 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX #include +#include ////////////////////////////////////////////////////////////////////////////// // predeclarations @@ -55,61 +56,6 @@ namespace drawinglayer { namespace primitive2d { - /** FontUnderline definition - - This is used for both underline and overline - */ - enum FontUnderline - { - FONT_UNDERLINE_NONE, - FONT_UNDERLINE_SINGLE, - FONT_UNDERLINE_DOUBLE, - FONT_UNDERLINE_DOTTED, - FONT_UNDERLINE_DASH, - FONT_UNDERLINE_LONGDASH, - FONT_UNDERLINE_DASHDOT, - FONT_UNDERLINE_DASHDOTDOT, - FONT_UNDERLINE_SMALLWAVE, - FONT_UNDERLINE_WAVE, - FONT_UNDERLINE_DOUBLEWAVE, - FONT_UNDERLINE_BOLD, - FONT_UNDERLINE_BOLDDOTTED, - FONT_UNDERLINE_BOLDDASH, - FONT_UNDERLINE_BOLDLONGDASH, - FONT_UNDERLINE_BOLDDASHDOT, - FONT_UNDERLINE_BOLDDASHDOTDOT, - FONT_UNDERLINE_BOLDWAVE - }; - - /** FontStrikeout definition */ - enum FontStrikeout - { - FONT_STRIKEOUT_NONE, - FONT_STRIKEOUT_SINGLE, - FONT_STRIKEOUT_DOUBLE, - FONT_STRIKEOUT_BOLD, - FONT_STRIKEOUT_SLASH, - FONT_STRIKEOUT_X - }; - - /** FontEmphasisMark definition */ - enum FontEmphasisMark - { - FONT_EMPHASISMARK_NONE, - FONT_EMPHASISMARK_DOT, - FONT_EMPHASISMARK_CIRCLE, - FONT_EMPHASISMARK_DISC, - FONT_EMPHASISMARK_ACCENT - }; - - /** FontRelief definition */ - enum FontRelief - { - FONT_RELIEF_NONE, - FONT_RELIEF_EMBOSSED, - FONT_RELIEF_ENGRAVED - }; - /** TextDecoratedPortionPrimitive2D class This primitive expands the TextSimplePortionPrimitive2D by common @@ -123,8 +69,8 @@ namespace drawinglayer /// decoration definitions basegfx::BColor maOverlineColor; basegfx::BColor maTextlineColor; - FontUnderline meFontOverline; - FontUnderline meFontUnderline; + TextLine meFontOverline; + TextLine meFontUnderline; FontStrikeout meFontStrikeout; FontEmphasisMark meFontEmphasisMark; FontRelief meFontRelief; @@ -137,16 +83,6 @@ namespace drawinglayer unsigned mbShadow : 1; /// helper methods - void impCreateTextLine( - std::vector< Primitive2DReference >& rTarget, - basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans, - const basegfx::B2DHomMatrix &rUnscaledTransform, - FontUnderline eLineStyle, - double fLineOffset, - double fLineHeight, - double fLineWidth, - const basegfx::BColor& rLineColor) const; - void impCreateGeometryContent( std::vector< Primitive2DReference >& rTarget, basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans, @@ -154,7 +90,7 @@ namespace drawinglayer xub_StrLen aTextPosition, xub_StrLen aTextLength, const ::std::vector< double >& rDXArray, - const FontAttributes& rFontAttributes) const; + const attribute::FontAttribute& rFontAttribute) const; void impCorrectTextBoundary( ::com::sun::star::i18n::Boundary& rNextWordBoundary) const; @@ -177,15 +113,15 @@ namespace drawinglayer xub_StrLen aTextPosition, xub_StrLen aTextLength, const ::std::vector< double >& rDXArray, - const FontAttributes& rFontAttributes, + const attribute::FontAttribute& rFontAttribute, const ::com::sun::star::lang::Locale& rLocale, const basegfx::BColor& rFontColor, /// local parameters const basegfx::BColor& rOverlineColor, const basegfx::BColor& rTextlineColor, - FontUnderline eFontOverline = FONT_UNDERLINE_NONE, - FontUnderline eFontUnderline = FONT_UNDERLINE_NONE, + TextLine eFontOverline = TEXT_LINE_NONE, + TextLine eFontUnderline = TEXT_LINE_NONE, bool bUnderlineAbove = false, FontStrikeout eFontStrikeout = FONT_STRIKEOUT_NONE, bool bWordLineMode = false, @@ -196,8 +132,8 @@ namespace drawinglayer bool bShadow = false); /// data read access - FontUnderline getFontOverline() const { return meFontOverline; } - FontUnderline getFontUnderline() const { return meFontUnderline; } + TextLine getFontOverline() const { return meFontOverline; } + TextLine getFontUnderline() const { return meFontUnderline; } FontStrikeout getFontStrikeout() const { return meFontStrikeout; } FontEmphasisMark getFontEmphasisMark() const { return meFontEmphasisMark; } FontRelief getFontRelief() const { return meFontRelief; } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textenumsprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textenumsprimitive2d.hxx new file mode 100644 index 000000000000..ec2f7e656b40 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/textenumsprimitive2d.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: wrongspellprimitive2d.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTENUMSPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTENUMSPRIMITIVE2D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + /** TextLine definition + + This is used for both underline and overline + */ + enum TextLine + { + TEXT_LINE_NONE, + TEXT_LINE_SINGLE, + TEXT_LINE_DOUBLE, + TEXT_LINE_DOTTED, + TEXT_LINE_DASH, + TEXT_LINE_LONGDASH, + TEXT_LINE_DASHDOT, + TEXT_LINE_DASHDOTDOT, + TEXT_LINE_SMALLWAVE, + TEXT_LINE_WAVE, + TEXT_LINE_DOUBLEWAVE, + TEXT_LINE_BOLD, + TEXT_LINE_BOLDDOTTED, + TEXT_LINE_BOLDDASH, + TEXT_LINE_BOLDLONGDASH, + TEXT_LINE_BOLDDASHDOT, + TEXT_LINE_BOLDDASHDOTDOT, + TEXT_LINE_BOLDWAVE + }; + + /** FontStrikeout definition */ + enum FontStrikeout + { + FONT_STRIKEOUT_NONE, + FONT_STRIKEOUT_SINGLE, + FONT_STRIKEOUT_DOUBLE, + FONT_STRIKEOUT_BOLD, + FONT_STRIKEOUT_SLASH, + FONT_STRIKEOUT_X + }; + + /** FontEmphasisMark definition */ + enum FontEmphasisMark + { + FONT_EMPHASISMARK_NONE, + FONT_EMPHASISMARK_DOT, + FONT_EMPHASISMARK_CIRCLE, + FONT_EMPHASISMARK_DISC, + FONT_EMPHASISMARK_ACCENT + }; + + /** FontRelief definition */ + enum FontRelief + { + FONT_RELIEF_NONE, + FONT_RELIEF_EMBOSSED, + FONT_RELIEF_ENGRAVED + }; + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTENUMSPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx index e0e2b6bbc4cb..f454459211df 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx @@ -50,8 +50,8 @@ class Font; class String; class OutputDevice; -namespace drawinglayer { namespace primitive2d { - class FontAttributes; +namespace drawinglayer { namespace attribute { + class FontAttribute; }} namespace basegfx { @@ -85,8 +85,8 @@ namespace drawinglayer /// tooling methods void setFont(const Font& rFont); - void setFontAttributes( - const FontAttributes& rFontAttributes, + void setFontAttribute( + const attribute::FontAttribute& rFontAttribute, double fFontScaleX, double fFontScaleY, const ::com::sun::star::lang::Locale & rLocale); @@ -114,6 +114,9 @@ namespace drawinglayer const String& rText, xub_StrLen nIndex, xub_StrLen nLength) const; + + double getFontAscent() const; + double getFontDescent() const; }; } // end of namespace primitive2d } // end of namespace drawinglayer @@ -125,25 +128,25 @@ namespace drawinglayer { namespace primitive2d { - /** Create a VCL-Font based on the definitions in FontAttributes + /** Create a VCL-Font based on the definitions in FontAttribute and the given FontScaling. The FontScaling defines the FontHeight (fFontScaleY) and the FontWidth (fFontScaleX). The combination of both defines FontStretching, where no stretching happens at fFontScaleY == fFontScaleX */ - Font getVclFontFromFontAttributes( - const FontAttributes& rFontAttributes, + Font getVclFontFromFontAttribute( + const attribute::FontAttribute& rFontAttribute, double fFontScaleX, double fFontScaleY, double fFontRotation, const ::com::sun::star::lang::Locale & rLocale); - /** Generate FontAttributes DataSet derived from the given VCL-Font. + /** Generate FontAttribute DataSet derived from the given VCL-Font. The FontScaling with fFontScaleY, fFontScaleX relationship (see above) will be set in return parameter o_rSize to allow further processing */ - FontAttributes getFontAttributesFromVclFont( + attribute::FontAttribute getFontAttributeFromVclFont( basegfx::B2DVector& o_rSize, const Font& rFont, bool bRTL, diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlineprimitive2d.hxx new file mode 100644 index 000000000000..a103d607e85f --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/textlineprimitive2d.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textdecoratedprimitive2d.hxx,v $ + * + * $Revision: 1.6 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTLINEPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTLINEPRIMITIVE2D_HXX + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class TextLinePrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + /// geometric definitions + basegfx::B2DHomMatrix maObjectTransformation; + double mfWidth; + double mfOffset; + double mfHeight; + + /// decoration definitions + TextLine meTextLine; + basegfx::BColor maLineColor; + + protected: + /// local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + /// constructor + TextLinePrimitive2D( + const basegfx::B2DHomMatrix& rObjectTransformation, + double fWidth, + double fOffset, + double fHeight, + TextLine eTextLine, + const basegfx::BColor& rLineColor); + + /// data read access + const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } + double getWidth() const { return mfWidth; } + double getOffset() const { return mfOffset; } + double getHeight() const { return mfHeight; } + TextLine getTextLine() const { return meTextLine; } + const basegfx::BColor& getLineColor() const { return maLineColor; } + + /// compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + /// provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTLINEPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx index 43e06ecc3b53..bbcd8e335e23 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textprimitive2d.hxx @@ -43,6 +43,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines @@ -56,75 +57,6 @@ class OutputDevice; ////////////////////////////////////////////////////////////////////////////// -namespace drawinglayer -{ - namespace primitive2d - { - /** FontAttributes class - - This attribute class is able to hold all parameters needed/used - to completely define the parametrisation of a text portion. - */ - class FontAttributes - { - private: - /// core data - String maFamilyName; // Font Family Name - String maStyleName; // Font Style Name - sal_uInt16 mnWeight; // Font weight - - /// bitfield - unsigned mbSymbol : 1; // Symbol Font Flag - unsigned mbVertical : 1; // Vertical Text Flag - unsigned mbItalic : 1; // Italic Flag - unsigned mbOutline : 1; // Outline Flag - unsigned mbRTL : 1; // RTL Flag - unsigned mbBiDiStrong : 1; // BiDi Flag - // TODO: pair kerning and CJK kerning - - public: - /// constructor - FontAttributes( - const String& rFamilyName, - const String& rStyleName, - sal_uInt16 nWeight, - bool bSymbol = false, - bool bVertical = false, - bool bItalic = false, - bool bOutline = false, - bool bRTL = false, - bool bBiDiStrong = false) - : maFamilyName(rFamilyName), - maStyleName(rStyleName), - mnWeight(nWeight), - mbSymbol(bSymbol), - mbVertical(bVertical), - mbItalic(bItalic), - mbOutline(bOutline), - mbRTL(bRTL), - mbBiDiStrong(bBiDiStrong) - { - } - - /// compare operator - bool operator==(const FontAttributes& rCompare) const; - - /// data read access - const String& getFamilyName() const { return maFamilyName; } - const String& getStyleName() const { return maStyleName; } - sal_uInt16 getWeight() const { return mnWeight; } - bool getSymbol() const { return mbSymbol; } - bool getVertical() const { return mbVertical; } - bool getItalic() const { return mbItalic; } - bool getOutline() const { return mbOutline; } - bool getRTL() const { return mbRTL; } - bool getBiDiStrong() const { return mbBiDiStrong; } - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - namespace drawinglayer { namespace primitive2d @@ -158,7 +90,7 @@ namespace drawinglayer ::std::vector< double > maDXArray; /// The font to use - FontAttributes maFontAttributes; + attribute::FontAttribute maFontAttribute; /// The Locale for the text ::com::sun::star::lang::Locale maLocale; @@ -181,7 +113,7 @@ namespace drawinglayer xub_StrLen aTextPosition, xub_StrLen aTextLength, const ::std::vector< double >& rDXArray, - const FontAttributes& rFontAttributes, + const attribute::FontAttribute& rFontAttribute, const ::com::sun::star::lang::Locale& rLocale, const basegfx::BColor& rFontColor); @@ -197,7 +129,7 @@ namespace drawinglayer xub_StrLen getTextPosition() const { return maTextPosition; } xub_StrLen getTextLength() const { return maTextLength; } const ::std::vector< double >& getDXArray() const { return maDXArray; } - const FontAttributes& getFontAttributes() const { return maFontAttributes; } + const attribute::FontAttribute& getFontAttribute() const { return maFontAttribute; } const ::com::sun::star::lang::Locale& getLocale() const { return maLocale; } const basegfx::BColor& getFontColor() const { return maFontColor; } @@ -210,6 +142,10 @@ namespace drawinglayer /// provide unique ID DeclPrimitrive2DIDBlock() }; + + /// small helper to have a compare operator for Locale + bool LocalesAreEqual(const ::com::sun::star::lang::Locale& rA, const ::com::sun::star::lang::Locale& rB); + } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx new file mode 100644 index 000000000000..562eb681ddae --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx @@ -0,0 +1,167 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textdecoratedprimitive2d.hxx,v $ + * + * $Revision: 1.6 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTSTRIKEOUTPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTSTRIKEOUTPRIMITIVE2D_HXX + +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class BaseTextStrikeoutPrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + /// geometric definitions + basegfx::B2DHomMatrix maObjectTransformation; + double mfWidth; + + /// decoration definitions + basegfx::BColor maFontColor; + + public: + /// constructor + BaseTextStrikeoutPrimitive2D( + const basegfx::B2DHomMatrix& rObjectTransformation, + double fWidth, + const basegfx::BColor& rFontColor); + + /// data read access + const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } + double getWidth() const { return mfWidth; } + const basegfx::BColor& getFontColor() const { return maFontColor; } + + /// compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class TextCharacterStrikeoutPrimitive2D : public BaseTextStrikeoutPrimitive2D + { + private: + sal_Unicode maStrikeoutChar; + attribute::FontAttribute maFontAttribute; + ::com::sun::star::lang::Locale maLocale; + + protected: + /// local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + /// constructor + TextCharacterStrikeoutPrimitive2D( + const basegfx::B2DHomMatrix& rObjectTransformation, + double fWidth, + const basegfx::BColor& rFontColor, + sal_Unicode aStrikeoutChar, + const attribute::FontAttribute& rFontAttribute, + const ::com::sun::star::lang::Locale& rLocale); + + /// data read access + sal_Unicode getStrikeoutChar() const { return maStrikeoutChar; } + const attribute::FontAttribute& getFontAttribute() const { return maFontAttribute; } + const ::com::sun::star::lang::Locale& getLocale() const { return maLocale; } + + /// compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + /// provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class TextGeometryStrikeoutPrimitive2D : public BaseTextStrikeoutPrimitive2D + { + private: + double mfHeight; + double mfOffset; + FontStrikeout meFontStrikeout; + + protected: + /// local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + /// constructor + TextGeometryStrikeoutPrimitive2D( + const basegfx::B2DHomMatrix& rObjectTransformation, + double fWidth, + const basegfx::BColor& rFontColor, + double fHeight, + double fOffset, + FontStrikeout eFontStrikeout); + + /// data read access + double getHeight() const { return mfHeight; } + double getOffset() const { return mfOffset; } + FontStrikeout getFontStrikeout() const { return meFontStrikeout; } + + /// compare operator + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + /// provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTSTRIKEOUTPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/wallpaperprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/wallpaperprimitive2d.hxx new file mode 100644 index 000000000000..ffe47cfe1b72 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/wallpaperprimitive2d.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: bitmapprimitive2d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + /** WallpaperBitmapPrimitive2D class + + This is a specialized primtive for the Wallpaper definitions included in + VCL and Metafiles. The extraordinary about the bitmap definition part of + the Wallpaper is that it uses PIXEL size of the given Bitmap and not + the logic and/or discrete size derived by PrefMapMode/PrefSize methods. + To emulate this, a ViewTransformation dependent primitive is needed which + takes over the correct scaling(s). + + Since a specialized primitive is needed anyways, i opted to also add the + layouting which is dependent from WallpaperStyle; thus it does not need + to be handled anywhere else in the future. + */ + class WallpaperBitmapPrimitive2D : public ViewTransformationDependentPrimitive2D + { + private: + basegfx::B2DRange maObjectRange; + BitmapEx maBitmapEx; + WallpaperStyle meWallpaperStyle; + + protected: + /// create local decomposition + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + /// constructor + WallpaperBitmapPrimitive2D( + const basegfx::B2DRange& rObjectRange, + const BitmapEx& rBitmapEx, + WallpaperStyle eWallpaperStyle); + + /// data read access + const basegfx::B2DRange& getLocalObjectRange() const { return maObjectRange; } + const BitmapEx& getBitmapEx() const { return maBitmapEx ; } + WallpaperStyle getWallpaperStyle() const { return meWallpaperStyle; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + /// get B2Drange + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + /// provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx index 052d42f7290e..f8b81e357ea5 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx @@ -179,19 +179,19 @@ namespace drawinglayer { private: /// bitmap fill attribute - attribute::FillBitmapAttribute maBitmap; + attribute::FillBitmapAttribute maFillBitmapAttribute; public: /// constructor BitmapTexturePrimitive3D( - const attribute::FillBitmapAttribute& rBitmap, + const attribute::FillBitmapAttribute& rFillBitmapAttribute, const Primitive3DSequence& rChildren, const basegfx::B2DVector& rTextureSize, bool bModulate, bool bFilter); /// data read access - const attribute::FillBitmapAttribute& getBitmap() const { return maBitmap; } + const attribute::FillBitmapAttribute& getFillBitmapAttribute() const { return maFillBitmapAttribute; } /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx index f0d0ff881bc5..38e7e5143b8a 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx @@ -97,7 +97,7 @@ namespace drawinglayer basegfx::B2DPolyPolygon maClipPolyPolygon; // the target MetaFile - GDIMetaFile& mrMetaFile; + GDIMetaFile* mpMetaFile; // do not allow embedding SvtGraphicFills into each other, // use a counter to prevent that diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst index 1ba3c2e7b614..ee5b96d98a03 100644 --- a/drawinglayer/prj/d.lst +++ b/drawinglayer/prj/d.lst @@ -39,6 +39,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\sceneprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\sceneprimitive2d.hxx ..\inc\drawinglayer\primitive2d\shadowprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\shadowprimitive2d.hxx ..\inc\drawinglayer\primitive2d\structuretagprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\structuretagprimitive2d.hxx +..\inc\drawinglayer\primitive2d\textenumsprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textenumsprimitive2d.hxx ..\inc\drawinglayer\primitive2d\texteffectprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\texteffectprimitive2d.hxx ..\inc\drawinglayer\primitive2d\textlayoutdevice.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textlayoutdevice.hxx ..\inc\drawinglayer\primitive2d\textprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textprimitive2d.hxx @@ -98,6 +99,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor3d mkdir: %_DEST%\inc%_EXT%\drawinglayer\attribute ..\inc\drawinglayer\attribute\fillattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillattribute.hxx ..\inc\drawinglayer\attribute\fillbitmapattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillbitmapattribute.hxx +..\inc\drawinglayer\attribute\fontattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fontattribute.hxx ..\inc\drawinglayer\attribute\materialattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\materialattribute3d.hxx ..\inc\drawinglayer\attribute\sdrallattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrallattribute3d.hxx ..\inc\drawinglayer\attribute\sdrattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrattribute.hxx diff --git a/drawinglayer/source/attribute/fillbitmapattribute.cxx b/drawinglayer/source/attribute/fillbitmapattribute.cxx index 539e85ab2733..99afb234bda5 100644 --- a/drawinglayer/source/attribute/fillbitmapattribute.cxx +++ b/drawinglayer/source/attribute/fillbitmapattribute.cxx @@ -44,8 +44,12 @@ namespace drawinglayer { namespace attribute { - FillBitmapAttribute::FillBitmapAttribute(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize, bool bTiling) - : maBitmap(rBitmap), + FillBitmapAttribute::FillBitmapAttribute( + const BitmapEx& rBitmapEx, + const basegfx::B2DPoint& rTopLeft, + const basegfx::B2DVector& rSize, + bool bTiling) + : maBitmapEx(rBitmapEx), maTopLeft(rTopLeft), maSize(rSize), mbTiling(bTiling) @@ -54,10 +58,10 @@ namespace drawinglayer bool FillBitmapAttribute::operator==(const FillBitmapAttribute& rCandidate) const { - return (maBitmap == rCandidate.maBitmap - && maTopLeft == rCandidate.maTopLeft - && maSize == rCandidate.maSize - && mbTiling == rCandidate.mbTiling); + return (getBitmapEx() == rCandidate.getBitmapEx() + && getTopLeft() == rCandidate.getTopLeft() + && getSize() == rCandidate.getSize() + && getTiling() == rCandidate.getTiling()); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/fontattribute.cxx b/drawinglayer/source/attribute/fontattribute.cxx new file mode 100644 index 000000000000..5163e2f6a59a --- /dev/null +++ b/drawinglayer/source/attribute/fontattribute.cxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: strokeattribute.cxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + bool FontAttribute::operator==(const FontAttribute& rCompare) const + { + return (getFamilyName() == rCompare.getFamilyName() + && getStyleName() == rCompare.getStyleName() + && getWeight() == rCompare.getWeight() + && getSymbol() == rCompare.getSymbol() + && getVertical() == rCompare.getVertical() + && getItalic() == rCompare.getItalic() + && getOutline() == rCompare.getOutline() + && getRTL() == rCompare.getRTL() + && getBiDiStrong() == rCompare.getBiDiStrong()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/makefile.mk b/drawinglayer/source/attribute/makefile.mk index fa91224e64b6..65f899f67177 100644 --- a/drawinglayer/source/attribute/makefile.mk +++ b/drawinglayer/source/attribute/makefile.mk @@ -47,6 +47,7 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES= \ $(SLO)$/fillattribute.obj \ $(SLO)$/fillbitmapattribute.obj \ + $(SLO)$/fontattribute.obj \ $(SLO)$/materialattribute3d.obj \ $(SLO)$/sdrallattribute3d.obj \ $(SLO)$/sdrattribute.obj \ diff --git a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx index c35d0ba5c15f..d7e9090b0f62 100644 --- a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx +++ b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx @@ -228,7 +228,7 @@ namespace drawinglayer aBitmapSize.setY(aBitmapSize.getY() / fRangeHeight); } - return FillBitmapAttribute(aBitmap, aBitmapTopLeft, aBitmapSize, mbTiling); + return FillBitmapAttribute(BitmapEx(aBitmap), aBitmapTopLeft, aBitmapSize, mbTiling); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx index 5900900bcf06..43de0ef3b514 100644 --- a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx @@ -65,8 +65,8 @@ namespace drawinglayer { const BitmapPrimitive2D& rCompare = (BitmapPrimitive2D&)rPrimitive; - return (maBitmapEx == rCompare.maBitmapEx - && maTransform == rCompare.maTransform); + return (getBitmapEx() == rCompare.getBitmapEx() + && getTransform() == rCompare.getTransform()); } return false; diff --git a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx new file mode 100644 index 000000000000..6e3a5b8e516e --- /dev/null +++ b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: bitmapprimitive2d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence DiscreteBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + // use getViewTransformation() and getObjectTransformation() from + // ObjectAndViewTransformationDependentPrimitive2D to create a BitmapPrimitive2D + // with the correct mapping + Primitive2DSequence xRetval; + + if(!getBitmapEx().IsEmpty()) + { + // get discrete size + const Size& rSizePixel = getBitmapEx().GetSizePixel(); + const basegfx::B2DVector aDiscreteSize(rSizePixel.Width(), rSizePixel.Height()); + + // get inverse ViewTransformation + basegfx::B2DHomMatrix aInverseViewTransformation(getViewTransformation()); + aInverseViewTransformation.invert(); + + // get size and position in world coordinates + const basegfx::B2DVector aWorldSize(aInverseViewTransformation * aDiscreteSize); + const basegfx::B2DPoint aWorldTopLeft(getObjectTransformation() * getTopLeft()); + + // build object matrix in world coordinates so that the top-left + // position remains, but eventual transformations (e.g. rotations) + // in the ObjectToView stack remain and get correctly applied + basegfx::B2DHomMatrix aObjectTransform; + + aObjectTransform.set(0, 0, aWorldSize.getX()); + aObjectTransform.set(1, 1, aWorldSize.getY()); + aObjectTransform.set(0, 2, aWorldTopLeft.getX()); + aObjectTransform.set(1, 2, aWorldTopLeft.getY()); + + // get inverse ObjectTransformation + basegfx::B2DHomMatrix aInverseObjectTransformation(getObjectTransformation()); + aInverseObjectTransformation.invert(); + + // transform to object coordinate system + aObjectTransform = aInverseObjectTransformation * aObjectTransform; + + // create BitmapPrimitive2D with now object-local coordinate data + const Primitive2DReference xRef(new BitmapPrimitive2D(getBitmapEx(), aObjectTransform)); + xRetval = Primitive2DSequence(&xRef, 1); + } + + return xRetval; + } + + DiscreteBitmapPrimitive2D::DiscreteBitmapPrimitive2D( + const BitmapEx& rBitmapEx, + const basegfx::B2DPoint& rTopLeft) + : ObjectAndViewTransformationDependentPrimitive2D(), + maBitmapEx(rBitmapEx), + maTopLeft(rTopLeft) + { + } + + bool DiscreteBitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(ObjectAndViewTransformationDependentPrimitive2D::operator==(rPrimitive)) + { + const DiscreteBitmapPrimitive2D& rCompare = (DiscreteBitmapPrimitive2D&)rPrimitive; + + return (getBitmapEx() == rCompare.getBitmapEx() + && getTopLeft() == rCompare.getTopLeft()); + } + + return false; + } + + // provide unique ID + ImplPrimitrive2DIDBlock(DiscreteBitmapPrimitive2D, PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx index 57d5d7c00c7c..ab9e9d19f6d2 100644 --- a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx @@ -56,7 +56,7 @@ namespace drawinglayer { Primitive2DSequence FillBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - const Size aTileSizePixel(getFillBitmap().getBitmap().GetSizePixel()); + const Size aTileSizePixel(getFillBitmap().getBitmapEx().GetSizePixel()); Primitive2DSequence aRetval; // is there a tile with some size at all? @@ -79,7 +79,7 @@ namespace drawinglayer aNewMatrix *= getTransformation(); // create bitmap primitive and add to result - const Primitive2DReference xRef(new BitmapPrimitive2D(BitmapEx(getFillBitmap().getBitmap()), aNewMatrix)); + const Primitive2DReference xRef(new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aNewMatrix)); aRetval[a] = xRef; } } @@ -94,7 +94,7 @@ namespace drawinglayer aObjectTransform *= getTransformation(); // create bitmap primitive and add exclusive to decomposition (hand over ownership) - const Primitive2DReference xRef(new BitmapPrimitive2D(BitmapEx(getFillBitmap().getBitmap()), aObjectTransform)); + const Primitive2DReference xRef(new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aObjectTransform)); aRetval = Primitive2DSequence(&xRef, 1L); } } diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx index 2bc280b577fd..625dae6cb93a 100644 --- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx @@ -54,37 +54,27 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence FillGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void FillGradientPrimitive2D::generateMatricesAndColors( + std::vector< basegfx::B2DHomMatrix >& rMatrices, + std::vector< basegfx::BColor >& rColors) const { - const attribute::GradientStyle aGradientStyle(maFillGradient.getStyle()); - ::std::vector< basegfx::B2DHomMatrix > aMatrices; - ::std::vector< basegfx::BColor > aColors; - basegfx::B2DPolygon aUnitPolygon; - sal_uInt32 nSteps(maFillGradient.getSteps()); - - if(attribute::GRADIENTSTYLE_RADIAL == aGradientStyle || attribute::GRADIENTSTYLE_ELLIPTICAL == aGradientStyle) - { - const basegfx::B2DPoint aCircleCenter(0.5, 0.5); - aUnitPolygon = basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5); - } - else - { - aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); - } + rMatrices.clear(); + rColors.clear(); // make sure steps is not too high/low const basegfx::BColor aStart(maFillGradient.getStartColor()); const basegfx::BColor aEnd(maFillGradient.getEndColor()); const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5)); + sal_uInt32 nSteps(maFillGradient.getSteps()); - if(nSteps == 0L) + if(nSteps == 0) { nSteps = nMaxSteps; } - if(nSteps < 2L) + if(nSteps < 2) { - nSteps = 2L; + nSteps = 2; } if(nSteps > nMaxSteps) @@ -92,78 +82,180 @@ namespace drawinglayer nSteps = nMaxSteps; } - switch(aGradientStyle) + switch(maFillGradient.getStyle()) { case attribute::GRADIENTSTYLE_LINEAR: { texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), -maFillGradient.getAngle()); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); + aGradient.appendTransformations(rMatrices); + aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_AXIAL: { texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), -maFillGradient.getAngle()); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); + aGradient.appendTransformations(rMatrices); + aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_RADIAL: { texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY()); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); + aGradient.appendTransformations(rMatrices); + aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_ELLIPTICAL: { texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle()); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); + aGradient.appendTransformations(rMatrices); + aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_SQUARE: { texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle()); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); + aGradient.appendTransformations(rMatrices); + aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_RECT: { texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle()); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); + aGradient.appendTransformations(rMatrices); + aGradient.appendColors(rColors); break; } } + } + Primitive2DSequence FillGradientPrimitive2D::createOverlappingFill( + const std::vector< basegfx::B2DHomMatrix >& rMatrices, + const std::vector< basegfx::BColor >& rColors, + const basegfx::B2DPolygon& rUnitPolygon) const + { // prepare return value - Primitive2DSequence aRetval(aColors.size() ? aMatrices.size() + 1L : aMatrices.size()); + Primitive2DSequence aRetval(rColors.size() ? rMatrices.size() + 1 : rMatrices.size()); // create solid fill with start color - if(aColors.size()) + if(rColors.size()) { // create primitive - const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getObjectRange())), aColors[0L])); - aRetval[0L] = xRef; + const Primitive2DReference xRef( + new PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getObjectRange())), + rColors[0])); + aRetval[0] = xRef; } // create solid fill steps - for(sal_uInt32 a(0L); a < aMatrices.size(); a++) + for(sal_uInt32 a(0); a < rMatrices.size(); a++) { // create part polygon - basegfx::B2DPolygon aNewPoly(aUnitPolygon); - aNewPoly.transform(aMatrices[a]); + basegfx::B2DPolygon aNewPoly(rUnitPolygon); + aNewPoly.transform(rMatrices[a]); // create solid fill - const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aNewPoly), aColors[a + 1L])); - aRetval[a + 1L] = xRef; + const Primitive2DReference xRef( + new PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aNewPoly), + rColors[a + 1])); + aRetval[a + 1] = xRef; + } + + return aRetval; + } + + Primitive2DSequence FillGradientPrimitive2D::createNonOverlappingFill( + const std::vector< basegfx::B2DHomMatrix >& rMatrices, + const std::vector< basegfx::BColor >& rColors, + const basegfx::B2DPolygon& rUnitPolygon) const + { + // prepare return value + Primitive2DSequence aRetval; + const sal_uInt32 nMatricesSize(rMatrices.size()); + + if(nMatricesSize) + { + basegfx::B2DPolygon aOuterPoly(rUnitPolygon); + aOuterPoly.transform(rMatrices[0]); + basegfx::B2DPolyPolygon aCombinedPolyPoly(aOuterPoly); + const sal_uInt32 nEntryCount(rColors.size() ? rMatrices.size() + 1 : rMatrices.size()); + sal_uInt32 nIndex(0); + + aRetval.realloc(nEntryCount); + + if(rColors.size()) + { + basegfx::B2DRange aOuterPolyRange(aOuterPoly.getB2DRange()); + aOuterPolyRange.expand(getObjectRange()); + aCombinedPolyPoly.append(basegfx::tools::createPolygonFromRect(aOuterPolyRange)); + aRetval[nIndex++] = Primitive2DReference(new PolyPolygonColorPrimitive2D(aCombinedPolyPoly, rColors[0])); + aCombinedPolyPoly = basegfx::B2DPolyPolygon(aOuterPoly); + } + + for(sal_uInt32 a(1); a < nMatricesSize - 1; a++) + { + basegfx::B2DPolygon aInnerPoly(rUnitPolygon); + aInnerPoly.transform(rMatrices[a]); + aCombinedPolyPoly.append(aInnerPoly); + aRetval[nIndex++] = Primitive2DReference(new PolyPolygonColorPrimitive2D(aCombinedPolyPoly, rColors[a])); + aCombinedPolyPoly = basegfx::B2DPolyPolygon(aInnerPoly); + } + + if(rColors.size()) + { + aRetval[nIndex] = Primitive2DReference(new PolyPolygonColorPrimitive2D( + aCombinedPolyPoly, rColors[rColors.size() - 1])); + } } return aRetval; } + Primitive2DSequence FillGradientPrimitive2D::createFill(bool bOverlapping) const + { + // prepare shape of the Unit Polygon + basegfx::B2DPolygon aUnitPolygon; + + if(attribute::GRADIENTSTYLE_RADIAL == maFillGradient.getStyle() + || attribute::GRADIENTSTYLE_ELLIPTICAL == maFillGradient.getStyle()) + { + const basegfx::B2DPoint aCircleCenter(0.5, 0.5); + aUnitPolygon = basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5); + } + else + { + aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); + } + + // get the transform matrices and colors (where colors + // will have one more entry that matrices) + std::vector< basegfx::B2DHomMatrix > aMatrices; + std::vector< basegfx::BColor > aColors; + generateMatricesAndColors(aMatrices, aColors); + + if(bOverlapping) + { + return createOverlappingFill(aMatrices, aColors, aUnitPolygon); + } + else + { + return createNonOverlappingFill(aMatrices, aColors, aUnitPolygon); + } + } + + Primitive2DSequence FillGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + // default creates overlapping fill which works with AntiAliasing and without. + // The non-overlapping version does not create single filled polygons, but + // PolyPolygons where each one describes a 'ring' for the gradient such + // that the rings will not overlap. This is useful fir the old XOR-paint + // 'trick' of VCL which is recorded in Metafiles; so this version may be + // used from the MetafilePrimitive2D in it's decomposition. + return createFill(true); + } + FillGradientPrimitive2D::FillGradientPrimitive2D( const basegfx::B2DRange& rObjectRange, const attribute::FillGradientAttribute& rFillGradient) diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index d5282116d46f..eca68858cbb5 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -207,23 +207,54 @@ namespace ////////////////////////////////////////////////////////////////////////////// +#include +#include +#include + namespace drawinglayer { namespace primitive2d { - Primitive2DSequence GraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence GraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { Primitive2DSequence aRetval; if(255L != getGraphicAttr().GetTransparency()) { - // get transformed graphic. Suppress rotation and cropping, only filtering is needed - // here (and may be replaced later on). Cropping is handled below as mask primitive (if set) + Primitive2DReference xPrimitive; + + // do not apply mirroring from GraphicAttr to the Metafile by calling + // GetTransformedGraphic, this will try to mirror the Metafile using Scale() + // at the Metafile. This again calls Scale at the single MetaFile actions, + // but this implementation never worked. I reworked that implementations, + // but for security reasons i will try not to use it. + basegfx::B2DHomMatrix aTransform(getTransform()); + + if(getGraphicAttr().IsMirrored()) + { + // content needs mirroring + const bool bHMirr(getGraphicAttr().GetMirrorFlags() & BMP_MIRROR_HORZ); + const bool bVMirr(getGraphicAttr().GetMirrorFlags() & BMP_MIRROR_VERT); + + // mirror by applying negative scale to the unit primitive and + // applying the object transformation on it. + aTransform = basegfx::tools::createScaleB2DHomMatrix( + bHMirr ? -1.0 : 1.0, + bVMirr ? -1.0 : 1.0); + aTransform.translate( + bHMirr ? 1.0 : 0.0, + bVMirr ? 1.0 : 0.0); + aTransform = getTransform() * aTransform; + } + + // Get transformed graphic. Suppress rotation and cropping, only filtering is needed + // here (and may be replaced later on). Cropping is handled below as mask primitive (if set). + // Also need to suppress mirroring, it is part of the transformation now (see above). GraphicAttr aSuppressGraphicAttr(getGraphicAttr()); - aSuppressGraphicAttr.SetCrop(0L, 0L, 0L, 0L); + aSuppressGraphicAttr.SetCrop(0, 0, 0, 0); aSuppressGraphicAttr.SetRotation(0); - Graphic aTransformedGraphic(getGraphicObject().GetTransformedGraphic(&aSuppressGraphicAttr)); - Primitive2DReference xPrimitive; + aSuppressGraphicAttr.SetMirrorFlags(0); + const Graphic aTransformedGraphic(getGraphicObject().GetTransformedGraphic(&aSuppressGraphicAttr)); switch(aTransformedGraphic.GetType()) { @@ -244,7 +275,7 @@ namespace drawinglayer { animation::AnimationEntryFixed aTime((double)aData.stepTime(a), (double)a / (double)aData.count()); aAnimationLoop.append(aTime); - const Primitive2DReference xRef(new BitmapPrimitive2D(aData.stepBitmapEx(a), getTransform())); + const Primitive2DReference xRef(new BitmapPrimitive2D(aData.stepBitmapEx(a), aTransform)); aBitmapPrimitives[a] = xRef; } @@ -258,7 +289,7 @@ namespace drawinglayer } else { - xPrimitive = Primitive2DReference(new BitmapPrimitive2D(aTransformedGraphic.GetBitmapEx(), getTransform())); + xPrimitive = Primitive2DReference(new BitmapPrimitive2D(aTransformedGraphic.GetBitmapEx(), aTransform)); } break; @@ -267,35 +298,440 @@ namespace drawinglayer case GRAPHIC_GDIMETAFILE : { // create MetafilePrimitive2D - const GDIMetaFile& rMetafile = aTransformedGraphic.GetGDIMetaFile(); - - xPrimitive = Primitive2DReference( - new MetafilePrimitive2D( - getTransform(), - rMetafile)); - - // #i100357# find out if clipping is needed for this primitive. Unfortunately, - // there exist Metafiles who's content is bigger than the proposed PrefSize set - // at them. This is an error, but we need to work around this - const Size aMetaFilePrefSize(rMetafile.GetPrefSize()); - const Size aMetaFileRealSize( - const_cast< GDIMetaFile& >(rMetafile).GetBoundRect( - *Application::GetDefaultDevice()).GetSize()); - - if(aMetaFileRealSize.getWidth() > aMetaFilePrefSize.getWidth() - || aMetaFileRealSize.getHeight() > aMetaFilePrefSize.getHeight()) + static bool bDoTest(false); + + if(bDoTest) + { + GDIMetaFile aMtf; + VirtualDevice aOut; + const basegfx::B2DRange aRange(getB2DRange(rViewInformation)); + const Rectangle aRectangle( + basegfx::fround(aRange.getMinX()), basegfx::fround(aRange.getMinY()), + basegfx::fround(aRange.getMaxX()), basegfx::fround(aRange.getMaxY())); + const Point aOrigin(aRectangle.TopLeft()); + const Fraction aScaleX(aRectangle.getWidth()); + const Fraction aScaleY(aRectangle.getHeight()); + MapMode aMapMode(MAP_100TH_MM, aOrigin, aScaleX, aScaleY); + + Size aDummySize(2, 2); + aOut.SetOutputSizePixel(aDummySize); + aOut.EnableOutput(FALSE); + aOut.SetMapMode(aMapMode); + + aMtf.Clear(); + aMtf.Record(&aOut); + + const Fraction aNeutralFraction(1, 1); + const MapMode aRelativeMapMode( + MAP_RELATIVE, + Point(-aRectangle.Left(), -aRectangle.Top()), + aNeutralFraction, aNeutralFraction); + aOut.SetMapMode(aRelativeMapMode); + + if(false) + { + const sal_Int32 nHor(aRectangle.getWidth() / 4); + const sal_Int32 nVer(aRectangle.getHeight() / 4); + const Rectangle aCenteredRectangle( + aRectangle.Left() + nHor, aRectangle.Top() + nVer, + aRectangle.Right() - nHor, aRectangle.Bottom() - nVer); + aOut.SetClipRegion(aCenteredRectangle); + } + + if(false) + { + const Rectangle aRightRectangle(aRectangle.TopCenter(), aRectangle.BottomRight()); + aOut.IntersectClipRegion(aRightRectangle); + } + + if(false) + { + const Rectangle aRightRectangle(aRectangle.TopCenter(), aRectangle.BottomRight()); + const Rectangle aBottomRectangle(aRectangle.LeftCenter(), aRectangle.BottomRight()); + Region aRegion(aRightRectangle); + aRegion.Intersect(aBottomRectangle); + aOut.IntersectClipRegion(aRegion); + } + + if(false) + { + const sal_Int32 nHor(aRectangle.getWidth() / 10); + const sal_Int32 nVer(aRectangle.getHeight() / 10); + aOut.MoveClipRegion(nHor, nVer); + } + + if(false) + { + Wallpaper aWallpaper(Color(COL_BLACK)); + aOut.DrawWallpaper(aRectangle, aWallpaper); + } + + if(false) + { + Wallpaper aWallpaper(Gradient(GRADIENT_LINEAR, Color(COL_RED), Color(COL_GREEN))); + aOut.DrawWallpaper(aRectangle, aWallpaper); + } + + if(false) + { + SvFileStream aRead((const String&)String(ByteString( "c:\\test.png" ), RTL_TEXTENCODING_UTF8), STREAM_READ); + vcl::PNGReader aPNGReader(aRead); + BitmapEx aBitmapEx(aPNGReader.Read()); + Wallpaper aWallpaper(aBitmapEx); + aOut.DrawWallpaper(aRectangle, aWallpaper); + } + + if(false) + { + const double fHor(aRectangle.getWidth()); + const double fVer(aRectangle.getHeight()); + Color aColor(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)); + + for(sal_uInt32 a(0); a < 5000; a++) + { + const Point aPoint( + aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)), + aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0))); + + if(!(a % 3)) + { + aColor = Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)); + } + + aOut.DrawPixel(aPoint, aColor); + } + } + + if(false) + { + const double fHor(aRectangle.getWidth()); + const double fVer(aRectangle.getHeight()); + + aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.SetFillColor(); + + for(sal_uInt32 a(0); a < 5000; a++) + { + const Point aPoint( + aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)), + aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0))); + aOut.DrawPixel(aPoint); + } + } + + if(false) + { + const double fHor(aRectangle.getWidth()); + const double fVer(aRectangle.getHeight()); + + aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.SetFillColor(); + + Point aStart( + aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)), + aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0))); + Point aStop( + aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)), + aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0))); + + LineInfo aLineInfo(LINE_SOLID, basegfx::fround(fHor / 50.0)); + bool bUseLineInfo(false); + + for(sal_uInt32 a(0); a < 20; a++) + { + if(!(a%6)) + { + bUseLineInfo = !bUseLineInfo; + } + + if(!(a%4)) + { + aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + } + + if(a%3) + { + aStart = aStop; + aStop = Point( + aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)), + aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0))); + } + else + { + aStart = Point( + aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)), + aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0))); + aStop = Point( + aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)), + aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0))); + } + + if(bUseLineInfo) + { + aOut.DrawLine(aStart, aStop, aLineInfo); + } + else + { + aOut.DrawLine(aStart, aStop); + } + } + } + + if(false) + { + aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.DrawRect(aRectangle); + } + + if(false) + { + aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + const sal_uInt32 nHor(aRectangle.getWidth() / 10); + const sal_uInt32 nVer(aRectangle.getHeight() / 10); + aOut.DrawRect(aRectangle, nHor, nVer); + } + + if(false) + { + aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.DrawEllipse(aRectangle); + } + + if(false) + { + aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.DrawArc(aRectangle, aRectangle.TopLeft(), aRectangle.BottomCenter()); + } + + if(false) + { + aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.DrawPie(aRectangle, aRectangle.TopLeft(), aRectangle.BottomCenter()); + } + + if(false) + { + aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.DrawChord(aRectangle, aRectangle.TopLeft(), aRectangle.BottomCenter()); + } + + if(false) + { + const double fHor(aRectangle.getWidth()); + const double fVer(aRectangle.getHeight()); + + for(sal_uInt32 b(0); b < 5; b++) + { + const sal_uInt32 nCount(basegfx::fround(rand() * (20 / 32767.0))); + const bool bClose(basegfx::fround(rand() / 32767.0)); + Polygon aPolygon(nCount + (bClose ? 1 : 0)); + + for(sal_uInt32 a(0); a < nCount; a++) + { + const Point aPoint( + aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)), + aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0))); + aPolygon[a] = aPoint; + } + + if(bClose) + { + aPolygon[aPolygon.GetSize() - 1] = aPolygon[0]; + } + + aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + + if(!(b%2)) + { + const LineInfo aLineInfo(LINE_SOLID, basegfx::fround(fHor / 50.0)); + aOut.DrawPolyLine(aPolygon, aLineInfo); + } + else + { + aOut.DrawPolyLine(aPolygon); + } + } + } + + if(false) + { + const double fHor(aRectangle.getWidth()); + const double fVer(aRectangle.getHeight()); + + for(sal_uInt32 b(0); b < 5; b++) + { + const sal_uInt32 nCount(basegfx::fround(rand() * (20 / 32767.0))); + const bool bClose(basegfx::fround(rand() / 32767.0)); + Polygon aPolygon(nCount + (bClose ? 1 : 0)); + + for(sal_uInt32 a(0); a < nCount; a++) + { + const Point aPoint( + aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)), + aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0))); + aPolygon[a] = aPoint; + } + + if(bClose) + { + aPolygon[aPolygon.GetSize() - 1] = aPolygon[0]; + } + + aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.DrawPolygon(aPolygon); + } + } + + if(false) + { + const double fHor(aRectangle.getWidth()); + const double fVer(aRectangle.getHeight()); + PolyPolygon aPolyPolygon; + + for(sal_uInt32 b(0); b < 3; b++) + { + const sal_uInt32 nCount(basegfx::fround(rand() * (6 / 32767.0))); + const bool bClose(basegfx::fround(rand() / 32767.0)); + Polygon aPolygon(nCount + (bClose ? 1 : 0)); + + for(sal_uInt32 a(0); a < nCount; a++) + { + const Point aPoint( + aRectangle.Left() + basegfx::fround(rand() * (fHor / 32767.0)), + aRectangle.Top() + basegfx::fround(rand() * (fVer / 32767.0))); + aPolygon[a] = aPoint; + } + + if(bClose) + { + aPolygon[aPolygon.GetSize() - 1] = aPolygon[0]; + } + + aPolyPolygon.Insert(aPolygon); + } + + aOut.SetLineColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.SetFillColor(Color(basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0))); + aOut.DrawPolyPolygon(aPolyPolygon); + } + + if(false) + { + SvFileStream aRead((const String&)String(ByteString( "c:\\test.png" ), RTL_TEXTENCODING_UTF8), STREAM_READ); + vcl::PNGReader aPNGReader(aRead); + BitmapEx aBitmapEx(aPNGReader.Read()); + aOut.DrawBitmapEx(aRectangle.TopLeft(), aBitmapEx); + } + + if(false) + { + SvFileStream aRead((const String&)String(ByteString( "c:\\test.png" ), RTL_TEXTENCODING_UTF8), STREAM_READ); + vcl::PNGReader aPNGReader(aRead); + BitmapEx aBitmapEx(aPNGReader.Read()); + aOut.DrawBitmapEx(aRectangle.TopLeft(), aRectangle.GetSize(), aBitmapEx); + } + + if(false) + { + SvFileStream aRead((const String&)String(ByteString( "c:\\test.png" ), RTL_TEXTENCODING_UTF8), STREAM_READ); + vcl::PNGReader aPNGReader(aRead); + BitmapEx aBitmapEx(aPNGReader.Read()); + const Size aSizePixel(aBitmapEx.GetSizePixel()); + aOut.DrawBitmapEx( + aRectangle.TopLeft(), + aRectangle.GetSize(), + Point(0, 0), + Size(aSizePixel.Width() /2, aSizePixel.Height() / 2), + aBitmapEx); + } + + if(false) + { + const double fHor(aRectangle.getWidth()); + const double fVer(aRectangle.getHeight()); + const Point aPointA( + aRectangle.Left() + basegfx::fround(fHor * 0.2), + aRectangle.Top() + basegfx::fround(fVer * 0.3)); + const Point aPointB( + aRectangle.Left() + basegfx::fround(fHor * 0.2), + aRectangle.Top() + basegfx::fround(fVer * 0.5)); + const Point aPointC( + aRectangle.Left() + basegfx::fround(fHor * 0.2), + aRectangle.Top() + basegfx::fround(fVer * 0.7)); + const String aText(ByteString("Hello, World!"), RTL_TEXTENCODING_UTF8); + + const String aFontName(ByteString("Comic Sans MS"), RTL_TEXTENCODING_UTF8); + Font aFont(aFontName, Size(0, 1000)); + aFont.SetAlign(ALIGN_BASELINE); + aFont.SetColor(COL_RED); + //sal_Int32* pDXArray = new sal_Int32[aText.Len()]; + + aFont.SetOutline(true); + aOut.SetFont(aFont); + aOut.DrawText(aPointA, aText, 0, aText.Len()); + + aFont.SetShadow(true); + aOut.SetFont(aFont); + aOut.DrawText(aPointB, aText, 0, aText.Len()); + + aFont.SetRelief(RELIEF_EMBOSSED); + aOut.SetFont(aFont); + aOut.DrawText(aPointC, aText, 0, aText.Len()); + + //delete pDXArray; + } + + aMtf.Stop(); + aMtf.WindStart(); + aMtf.SetPrefMapMode(MapMode(MAP_100TH_MM)); + aMtf.SetPrefSize(Size(aRectangle.getWidth(), aRectangle.getHeight())); + + xPrimitive = Primitive2DReference( + new MetafilePrimitive2D( + aTransform, + aMtf)); + } + else { - // clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon - const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1); - basegfx::B2DPolygon aMaskPolygon( - basegfx::tools::createPolygonFromRect( - basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); - aMaskPolygon.transform(getTransform()); + const Graphic aGraphic(getGraphicObject().GetGraphic()); + const GDIMetaFile& rMetafile = aTransformedGraphic.GetGDIMetaFile(); xPrimitive = Primitive2DReference( - new MaskPrimitive2D( - basegfx::B2DPolyPolygon(aMaskPolygon), - aChildContent)); + new MetafilePrimitive2D( + aTransform, + rMetafile)); + + // #i100357# find out if clipping is needed for this primitive. Unfortunately, + // there exist Metafiles who's content is bigger than the proposed PrefSize set + // at them. This is an error, but we need to work around this + const Size aMetaFilePrefSize(rMetafile.GetPrefSize()); + const Size aMetaFileRealSize( + const_cast< GDIMetaFile& >(rMetafile).GetBoundRect( + *Application::GetDefaultDevice()).GetSize()); + + if(aMetaFileRealSize.getWidth() > aMetaFilePrefSize.getWidth() + || aMetaFileRealSize.getHeight() > aMetaFilePrefSize.getHeight()) + { + // clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon + const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1); + basegfx::B2DPolygon aMaskPolygon( + basegfx::tools::createPolygonFromRect( + basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + aMaskPolygon.transform(aTransform); + + xPrimitive = Primitive2DReference( + new MaskPrimitive2D( + basegfx::B2DPolyPolygon(aMaskPolygon), + aChildContent)); + } } break; diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk index e10d1ddbcc71..5da4d9c35587 100644 --- a/drawinglayer/source/primitive2d/makefile.mk +++ b/drawinglayer/source/primitive2d/makefile.mk @@ -53,6 +53,7 @@ SLOFILES= \ $(SLO)$/borderlineprimitive2d.obj \ $(SLO)$/chartprimitive2d.obj \ $(SLO)$/controlprimitive2d.obj \ + $(SLO)$/discretebitmapprimitive2d.obj \ $(SLO)$/embedded3dprimitive2d.obj \ $(SLO)$/fillbitmapprimitive2d.obj \ $(SLO)$/fillgradientprimitive2d.obj \ @@ -78,11 +79,14 @@ SLOFILES= \ $(SLO)$/structuretagprimitive2d.obj \ $(SLO)$/texteffectprimitive2d.obj \ $(SLO)$/textlayoutdevice.obj \ + $(SLO)$/textlineprimitive2d.obj \ $(SLO)$/textprimitive2d.obj \ + $(SLO)$/textstrikeoutprimitive2d.obj \ $(SLO)$/textdecoratedprimitive2d.obj \ $(SLO)$/texthierarchyprimitive2d.obj \ $(SLO)$/transformprimitive2d.obj \ $(SLO)$/unifiedalphaprimitive2d.obj \ + $(SLO)$/wallpaperprimitive2d.obj \ $(SLO)$/wrongspellprimitive2d.obj # --- Targets ---------------------------------- diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 2d1c0428a6a3..a12172939e99 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -39,6 +39,36 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -46,14 +76,2465 @@ using namespace com::sun::star; ////////////////////////////////////////////////////////////////////////////// +namespace +{ + class PropertyHolder + { + private: + basegfx::B2DHomMatrix maTransformation; + MapUnit maMapUnit; + + basegfx::BColor maLineColor; + basegfx::BColor maFillColor; + basegfx::BColor maTextColor; + basegfx::BColor maTextFillColor; + basegfx::BColor maTextLineColor; + basegfx::BColor maOverlineColor; + + Region maRegion; + Font maFont; + RasterOp maRasterOp; + sal_uInt32 mnLayoutMode; + LanguageType maLanguageType; + + /// bitfield + bool mbLineColor : 1; + bool mbFillColor : 1; + bool mbTextColor : 1; + bool mbTextFillColor : 1; + bool mbTextLineColor : 1; + bool mbOverlineColor : 1; + bool mbRegion : 1; + + public: + PropertyHolder() + : maTransformation(), + maMapUnit(MAP_100TH_MM), + maLineColor(), + maFillColor(), + maTextColor(COL_BLACK), + maTextFillColor(), + maTextLineColor(), + maOverlineColor(), + maRegion(), + maFont(), + maRasterOp(ROP_OVERPAINT), + mnLayoutMode(0), + maLanguageType(0), + mbLineColor(false), + mbFillColor(false), + mbTextColor(true), + mbTextFillColor(false), + mbTextLineColor(false), + mbOverlineColor(false), + mbRegion(false) + { + } + + ~PropertyHolder() + { + } + + const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; } + void setTransformation(const basegfx::B2DHomMatrix& rNew) { if(rNew != maTransformation) maTransformation = rNew; } + + MapUnit getMapUnit() const { return maMapUnit; } + void setMapUnit(MapUnit eNew) { if(eNew != maMapUnit) maMapUnit = eNew; } + + const basegfx::BColor& getLineColor() const { return maLineColor; } + void setLineColor(const basegfx::BColor& rNew) { if(rNew != maLineColor) maLineColor = rNew; } + bool getLineColorActive() const { return mbLineColor; } + void setLineColorActive(bool bNew) { if(bNew != mbLineColor) mbLineColor = bNew; } + + const basegfx::BColor& getFillColor() const { return maFillColor; } + void setFillColor(const basegfx::BColor& rNew) { if(rNew != maFillColor) maFillColor = rNew; } + bool getFillColorActive() const { return mbFillColor; } + void setFillColorActive(bool bNew) { if(bNew != mbFillColor) mbFillColor = bNew; } + + const basegfx::BColor& getTextColor() const { return maTextColor; } + void setTextColor(const basegfx::BColor& rNew) { if(rNew != maTextColor) maTextColor = rNew; } + bool getTextColorActive() const { return mbTextColor; } + void setTextColorActive(bool bNew) { if(bNew != mbTextColor) mbTextColor = bNew; } + + const basegfx::BColor& getTextFillColor() const { return maTextFillColor; } + void setTextFillColor(const basegfx::BColor& rNew) { if(rNew != maTextFillColor) maTextFillColor = rNew; } + bool getTextFillColorActive() const { return mbTextFillColor; } + void setTextFillColorActive(bool bNew) { if(bNew != mbTextFillColor) mbTextFillColor = bNew; } + + const basegfx::BColor& getTextLineColor() const { return maTextLineColor; } + void setTextLineColor(const basegfx::BColor& rNew) { if(rNew != maTextLineColor) maTextLineColor = rNew; } + bool getTextLineColorActive() const { return mbTextLineColor; } + void setTextLineColorActive(bool bNew) { if(bNew != mbTextLineColor) mbTextLineColor = bNew; } + + const basegfx::BColor& getOverlineColor() const { return maOverlineColor; } + void setOverlineColor(const basegfx::BColor& rNew) { if(rNew != maOverlineColor) maOverlineColor = rNew; } + bool getOverlineColorActive() const { return mbOverlineColor; } + void setOverlineColorActive(bool bNew) { if(bNew != mbOverlineColor) mbOverlineColor = bNew; } + + const Region& getRegion() const { return maRegion; } + void setRegion(const Region& rRegion) { if(rRegion != maRegion) maRegion = rRegion; } + bool getRegionActive() const { return mbRegion; } + void setRegionActive(bool bNew) { if(bNew != mbRegion) mbRegion = bNew; } + + const Font& getFont() const { return maFont; } + void setFont(const Font& rFont) { if(rFont != maFont) maFont = rFont; } + + const RasterOp& getRasterOp() const { return maRasterOp; } + void setRasterOp(const RasterOp& rRasterOp) { if(rRasterOp != maRasterOp) maRasterOp = rRasterOp; } + bool isRasterOpInvert() const { return (ROP_XOR == maRasterOp || ROP_INVERT == maRasterOp); } + bool isRasterOpForceBlack() const { return ROP_0 == maRasterOp; } + bool isRasterOpActive() const { return isRasterOpInvert() || isRasterOpForceBlack(); } + + sal_uInt32 getLayoutMode() const { return mnLayoutMode; } + void setLayoutMode(sal_uInt32 nNew) { if(nNew != mnLayoutMode) mnLayoutMode = nNew; } + + LanguageType getLanguageType() const { return maLanguageType; } + void setLanguageType(LanguageType aNew) { if(aNew != maLanguageType) maLanguageType = aNew; } + + bool getLineOrFillActive() const { return (mbLineColor || mbFillColor); } + }; +} // end of anonymous namespace + +////////////////////////////////////////////////////////////////////////////// + +namespace +{ + class PropertyHolders + { + private: + std::vector< PropertyHolder* > maPropertyHolders; + + public: + PropertyHolders() + { + maPropertyHolders.push_back(new PropertyHolder()); + } + + sal_uInt32 size() + { + return maPropertyHolders.size(); + } + + void Push() + { + OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: PUSH with no property holders (!)"); + maPropertyHolders.push_back(new PropertyHolder(*maPropertyHolders[maPropertyHolders.size() - 1])); + } + + void Pop() + { + OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: POP with no property holders (!)"); + if(maPropertyHolders.size()) + { + delete maPropertyHolders[maPropertyHolders.size() - 1]; + maPropertyHolders.pop_back(); + } + } + + PropertyHolder& Current() + { + OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: CURRENT with no property holders (!)"); + return *maPropertyHolders[maPropertyHolders.size() - 1]; + } + + ~PropertyHolders() + { + while(maPropertyHolders.size()) + { + Pop(); + } + } + }; +} // end of anonymous namespace + +////////////////////////////////////////////////////////////////////////////// + +namespace +{ + basegfx::B2DPolyPolygon getB2DPolyPolygonFromRegion(const Region& rRegion) + { + basegfx::B2DPolyPolygon aRetval; + + if(!rRegion.IsEmpty()) + { + Region aRegion(rRegion); + aRetval = aRegion.GetB2DPolyPolygon(); + + if(!aRetval.count()) + { + RegionHandle aRegionHandle(aRegion.BeginEnumRects()); + Rectangle aRegionRectangle; + + while(aRegion.GetEnumRects(aRegionHandle, aRegionRectangle)) + { + if(!aRegionRectangle.IsEmpty()) + { + const basegfx::B2DRange aRegionRange( + aRegionRectangle.Left(), aRegionRectangle.Top(), + aRegionRectangle.Right(), aRegionRectangle.Bottom()); + aRetval.append(basegfx::tools::createPolygonFromRect(aRegionRange)); + } + } + + aRegion.EndEnumRects(aRegionHandle); + } + } + + return aRetval; + } +} // end of anonymous namespace + +////////////////////////////////////////////////////////////////////////////// + +namespace +{ + class TargetHolder + { + private: + std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aTargets; + + public: + TargetHolder() + : aTargets() + { + } + + ~TargetHolder() + { + const sal_uInt32 nCount(aTargets.size()); + + for(sal_uInt32 a(0); a < nCount; a++) + { + delete aTargets[a]; + } + } + + sal_uInt32 size() + { + return aTargets.size(); + } + + void append(drawinglayer::primitive2d::BasePrimitive2D* pCandidate) + { + if(pCandidate) + { + aTargets.push_back(pCandidate); + } + } + + drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequence(const PropertyHolder& rPropertyHolder) + { + const sal_uInt32 nCount(aTargets.size()); + drawinglayer::primitive2d::Primitive2DSequence xRetval(nCount); + + for(sal_uInt32 a(0); a < nCount; a++) + { + xRetval[a] = aTargets[a]; + } + + // All Targets were pointers, but do not need to be deleted since they + // were converted to UNO API references now, so they stay as long as + // referenced. Do NOT delete the C++ implementation classes here, but clear + // the buffer to not delete them in the destructor. + aTargets.clear(); + + if(xRetval.hasElements() && rPropertyHolder.getRegionActive()) + { + const Region& rRegion = rPropertyHolder.getRegion(); + + if(!rRegion.IsEmpty()) + { + basegfx::B2DPolyPolygon aClipPolyPolygon(getB2DPolyPolygonFromRegion(rRegion)); + + if(aClipPolyPolygon.count()) + { + aClipPolyPolygon.transform(rPropertyHolder.getTransformation()); + + const drawinglayer::primitive2d::Primitive2DReference xMask( + new drawinglayer::primitive2d::MaskPrimitive2D( + aClipPolyPolygon, + xRetval)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xMask, 1); + } + } + } + + return xRetval; + } + }; +} // end of anonymous namespace + +////////////////////////////////////////////////////////////////////////////// + +namespace +{ + class TargetHolders + { + private: + std::vector< TargetHolder* > maTargetHolders; + + public: + TargetHolders() + { + maTargetHolders.push_back(new TargetHolder()); + } + + sal_uInt32 size() + { + return maTargetHolders.size(); + } + + void Push() + { + maTargetHolders.push_back(new TargetHolder()); + } + + void Pop() + { + OSL_ENSURE(maTargetHolders.size(), "TargetHolders: POP with no property holders (!)"); + if(maTargetHolders.size()) + { + delete maTargetHolders[maTargetHolders.size() - 1]; + maTargetHolders.pop_back(); + } + } + + TargetHolder& Current() + { + OSL_ENSURE(maTargetHolders.size(), "TargetHolders: CURRENT with no property holders (!)"); + return *maTargetHolders[maTargetHolders.size() - 1]; + } + + ~TargetHolders() + { + while(maTargetHolders.size()) + { + Pop(); + } + } + }; +} // end of anonymous namespace + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + /** NonOverlappingFillGradientPrimitive2D class + + This is a special version of the FillGradientPrimitive2D which decomposes + to a non-overlapping geometry version of the gradient. This needs to be + used to support the old XOR paint-'trick'. + + It does not need an own identifier since a renderer who wants to interpret + it itself may do so. It just overloads the decomposition of the C++ + implementation class to do an alternative decomposition. + */ + class NonOverlappingFillGradientPrimitive2D : public FillGradientPrimitive2D + { + protected: + /// local decomposition. + virtual Primitive2DSequence create2DDecomposition( + const geometry::ViewInformation2D& rViewInformation) const; + + public: + /// constructor + NonOverlappingFillGradientPrimitive2D( + const basegfx::B2DRange& rObjectRange, + const attribute::FillGradientAttribute& rFillGradient) + : FillGradientPrimitive2D(rObjectRange, rFillGradient) + { + } + }; + + Primitive2DSequence NonOverlappingFillGradientPrimitive2D::create2DDecomposition( + const geometry::ViewInformation2D& /*rViewInformation*/) const + { + return createFill(false); + } + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace +{ + basegfx::B2DHomMatrix getTransformFromMapMode(const MapMode& rMapMode) + { + basegfx::B2DHomMatrix aMapping; + const Fraction aNoScale(1, 1); + const Point& rOrigin(rMapMode.GetOrigin()); + + if(0 != rOrigin.X() || 0 != rOrigin.Y()) + { + aMapping.translate(rOrigin.X(), rOrigin.Y()); + } + + if(rMapMode.GetScaleX() != aNoScale || rMapMode.GetScaleY() != aNoScale) + { + aMapping.scale( + double(rMapMode.GetScaleX()), + double(rMapMode.GetScaleY())); + } + + return aMapping; + } + + void createPointArrayPrimitive( + const std::vector< basegfx::B2DPoint >& rPositions, + TargetHolder& rTarget, + PropertyHolder& rProperties, + basegfx::BColor aBColor) + { + if(rPositions.size()) + { + if(rProperties.getTransformation().isIdentity()) + { + rTarget.append( + new drawinglayer::primitive2d::PointArrayPrimitive2D( + rPositions, + aBColor)); + } + else + { + std::vector< basegfx::B2DPoint > aPositions(rPositions); + + for(sal_uInt32 a(0); a < aPositions.size(); a++) + { + aPositions[a] = rProperties.getTransformation() * aPositions[a]; + } + + rTarget.append( + new drawinglayer::primitive2d::PointArrayPrimitive2D( + aPositions, + aBColor)); + } + } + } + + void createHairlinePrimitive( + const basegfx::B2DPolygon& rLinePolygon, + TargetHolder& rTarget, + PropertyHolder& rProperties) + { + if(rLinePolygon.count()) + { + basegfx::B2DPolygon aLinePolygon(rLinePolygon); + aLinePolygon.transform(rProperties.getTransformation()); + rTarget.append( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + aLinePolygon, + rProperties.getLineColor())); + } + } + + void createFillPrimitive( + const basegfx::B2DPolyPolygon& rFillPolyPolygon, + TargetHolder& rTarget, + PropertyHolder& rProperties) + { + if(rFillPolyPolygon.count()) + { + basegfx::B2DPolyPolygon aFillPolyPolygon(rFillPolyPolygon); + aFillPolyPolygon.transform(rProperties.getTransformation()); + rTarget.append( + new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( + aFillPolyPolygon, + rProperties.getFillColor())); + } + } + + void createLinePrimitive( + const basegfx::B2DPolygon& rLinePolygon, + const LineInfo& rLineInfo, + TargetHolder& rTarget, + PropertyHolder& rProperties) + { + if(rLinePolygon.count()) + { + const bool bDashDotUsed(LINE_DASH == rLineInfo.GetStyle()); + const bool bWidthUsed(rLineInfo.GetWidth() > 1); + + if(bDashDotUsed || bWidthUsed) + { + basegfx::B2DPolygon aLinePolygon(rLinePolygon); + aLinePolygon.transform(rProperties.getTransformation()); + const drawinglayer::attribute::LineAttribute aLineAttribute( + rProperties.getLineColor(), + bWidthUsed ? rLineInfo.GetWidth() : 0.0, + rLineInfo.GetLineJoin()); + + if(bDashDotUsed) + { + ::std::vector< double > fDotDashArray; + const double fDashLen(rLineInfo.GetDashLen()); + const double fDotLen(rLineInfo.GetDotLen()); + const double fDistance(rLineInfo.GetDistance()); + + for(sal_uInt16 a(0); a < rLineInfo.GetDashCount(); a++) + { + fDotDashArray.push_back(fDashLen); + fDotDashArray.push_back(fDistance); + } + + for(sal_uInt16 b(0); b < rLineInfo.GetDotCount(); b++) + { + fDotDashArray.push_back(fDotLen); + fDotDashArray.push_back(fDistance); + } + + const double fAccumulated(::std::accumulate(fDotDashArray.begin(), fDotDashArray.end(), 0.0)); + const drawinglayer::attribute::StrokeAttribute aStrokeAttribute( + fDotDashArray, + fAccumulated); + + rTarget.append( + new drawinglayer::primitive2d::PolygonStrokePrimitive2D( + aLinePolygon, + aLineAttribute, + aStrokeAttribute)); + } + else + { + rTarget.append( + new drawinglayer::primitive2d::PolygonStrokePrimitive2D( + aLinePolygon, + aLineAttribute)); + } + } + else + { + createHairlinePrimitive(rLinePolygon, rTarget, rProperties); + } + } + } + + void createHairlineAndFillPrimitive( + const basegfx::B2DPolygon& rPolygon, + TargetHolder& rTarget, + PropertyHolder& rProperties) + { + if(rProperties.getFillColorActive()) + { + createFillPrimitive(basegfx::B2DPolyPolygon(rPolygon), rTarget, rProperties); + } + + if(rProperties.getLineColorActive()) + { + createHairlinePrimitive(rPolygon, rTarget, rProperties); + } + } + + void createHairlineAndFillPrimitive( + const basegfx::B2DPolyPolygon& rPolyPolygon, + TargetHolder& rTarget, + PropertyHolder& rProperties) + { + if(rProperties.getFillColorActive()) + { + createFillPrimitive(rPolyPolygon, rTarget, rProperties); + } + + if(rProperties.getLineColorActive()) + { + for(sal_uInt32 a(0); a < rPolyPolygon.count(); a++) + { + createHairlinePrimitive(rPolyPolygon.getB2DPolygon(a), rTarget, rProperties); + } + } + } + + void createBitmapExPrimitive( + const BitmapEx& rBitmapEx, + const Point& rPoint, + TargetHolder& rTarget, + PropertyHolder& rProperties) + { + if(!rBitmapEx.IsEmpty()) + { + basegfx::B2DPoint aPoint(rPoint.X(), rPoint.Y()); + aPoint = rProperties.getTransformation() * aPoint; + + rTarget.append( + new drawinglayer::primitive2d::DiscreteBitmapPrimitive2D( + rBitmapEx, + aPoint)); + } + } + + void createBitmapExPrimitive( + const BitmapEx& rBitmapEx, + const Point& rPoint, + const Size& rSize, + TargetHolder& rTarget, + PropertyHolder& rProperties) + { + if(!rBitmapEx.IsEmpty()) + { + basegfx::B2DHomMatrix aObjectTransform; + + aObjectTransform.set(0, 0, rSize.Width()); + aObjectTransform.set(1, 1, rSize.Height()); + aObjectTransform.set(0, 2, rPoint.X()); + aObjectTransform.set(1, 2, rPoint.Y()); + + aObjectTransform = rProperties.getTransformation() * aObjectTransform; + + rTarget.append( + new drawinglayer::primitive2d::BitmapPrimitive2D( + rBitmapEx, + aObjectTransform)); + } + } + + BitmapEx createMaskBmpEx(const Bitmap& rBitmap, const Color& rMaskColor) + { + const Color aWhite(COL_WHITE); + BitmapPalette aBiLevelPalette(2); + + aBiLevelPalette[0] = aWhite; + aBiLevelPalette[1] = rMaskColor; + + Bitmap aMask(rBitmap.CreateMask(aWhite)); + Bitmap aSolid(rBitmap.GetSizePixel(), 1, &aBiLevelPalette); + + aSolid.Erase(rMaskColor); + + return BitmapEx(aSolid, aMask); + } + + drawinglayer::attribute::FillGradientAttribute createFillGradientAttribute(const Gradient& rGradient) + { + const Color aStartColor(rGradient.GetStartColor()); + const sal_uInt16 nStartIntens(rGradient.GetStartIntensity()); + basegfx::BColor aStart(aStartColor.getBColor()); + + if(nStartIntens != 100) + { + const basegfx::BColor aBlack; + aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01); + } + + const Color aEndColor(rGradient.GetEndColor()); + const sal_uInt16 nEndIntens(rGradient.GetEndIntensity()); + basegfx::BColor aEnd(aEndColor.getBColor()); + + if(nEndIntens != 100) + { + const basegfx::BColor aBlack; + aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01); + } + + drawinglayer::attribute::GradientStyle aGradientStyle(drawinglayer::attribute::GRADIENTSTYLE_RECT); + + switch(rGradient.GetStyle()) + { + case GRADIENT_LINEAR : + { + aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_LINEAR; + break; + } + case GRADIENT_AXIAL : + { + aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_AXIAL; + break; + } + case GRADIENT_RADIAL : + { + aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_RADIAL; + break; + } + case GRADIENT_ELLIPTICAL : + { + aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_ELLIPTICAL; + break; + } + case GRADIENT_SQUARE : + { + aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_SQUARE; + break; + } + default : // GRADIENT_RECT + { + aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_RECT; + break; + } + } + + return drawinglayer::attribute::FillGradientAttribute( + aGradientStyle, + (double)rGradient.GetBorder() * 0.01, + (double)rGradient.GetOfsX() * 0.01, + (double)rGradient.GetOfsY() * 0.01, + (double)rGradient.GetAngle() * F_PI1800, + aStart, + aEnd, + rGradient.GetSteps()); + } + + drawinglayer::attribute::FillHatchAttribute createFillHatchAttribute(const Hatch& rHatch) + { + drawinglayer::attribute::HatchStyle aHatchStyle(drawinglayer::attribute::HATCHSTYLE_SINGLE); + + switch(rHatch.GetStyle()) + { + default : // case HATCH_SINGLE : + { + aHatchStyle = drawinglayer::attribute::HATCHSTYLE_SINGLE; + } + case HATCH_DOUBLE : + { + aHatchStyle = drawinglayer::attribute::HATCHSTYLE_DOUBLE; + } + case HATCH_TRIPLE : + { + aHatchStyle = drawinglayer::attribute::HATCHSTYLE_TRIPLE; + } + } + + return drawinglayer::attribute::FillHatchAttribute( + aHatchStyle, + (double)rHatch.GetDistance(), + (double)rHatch.GetAngle() * F_PI1800, + rHatch.GetColor().getBColor(), + false); + } + + void HandleNewClipRegion( + const Region* pRegion, + TargetHolders& rTargetHolders, + PropertyHolders& rPropertyHolders) + { + // process evtl. created primitives which belong to the current region settings + if(rPropertyHolders.Current().getRegionActive() && rTargetHolders.size() > 1) + { + drawinglayer::primitive2d::Primitive2DSequence aSubContent; + + if(!rPropertyHolders.Current().getRegion().IsEmpty() && rTargetHolders.Current().size()) + { + aSubContent = rTargetHolders.Current().getPrimitive2DSequence(rPropertyHolders.Current()); + } + + rTargetHolders.Pop(); + + if(aSubContent.hasElements()) + { + rTargetHolders.Current().append( + new drawinglayer::primitive2d::GroupPrimitive2D( + aSubContent)); + } + } + + // apply new settings + const bool bNewActive(pRegion); + rPropertyHolders.Current().setRegionActive(bNewActive); + + if(bNewActive) + { + rPropertyHolders.Current().setRegion(*pRegion); + + // prepare new content holder for new active region + rTargetHolders.Push(); + } + } + + void HandleNewRasterOp( + RasterOp aRasterOp, + TargetHolders& rTargetHolders, + PropertyHolders& rPropertyHolders) + { + // check if currently active + if(rPropertyHolders.Current().isRasterOpActive() && rTargetHolders.size() > 1) + { + drawinglayer::primitive2d::Primitive2DSequence aSubContent; + + if(rTargetHolders.Current().size()) + { + aSubContent = rTargetHolders.Current().getPrimitive2DSequence(rPropertyHolders.Current()); + } + + rTargetHolders.Pop(); + + if(aSubContent.hasElements()) + { + if(rPropertyHolders.Current().isRasterOpForceBlack()) + { + // force content to black + rTargetHolders.Current().append( + new drawinglayer::primitive2d::ModifiedColorPrimitive2D( + aSubContent, + basegfx::BColorModifier(basegfx::BColor(0.0, 0.0, 0.0)))); + } + else // if(rPropertyHolders.Current().isRasterOpInvert()) + { + // invert content + rTargetHolders.Current().append( + new drawinglayer::primitive2d::InvertPrimitive2D( + aSubContent)); + } + } + } + + // apply new settings + rPropertyHolders.Current().setRasterOp(aRasterOp); + + // check if now active + if(rPropertyHolders.Current().isRasterOpActive()) + { + // prepare new content holder for new invert + rTargetHolders.Push(); + } + } + + drawinglayer::primitive2d::BasePrimitive2D* CreateColorWallpaper( + const basegfx::B2DRange& rRange, + const basegfx::BColor& rColor, + PropertyHolder& rPropertyHolder) + { + basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(rRange)); + aOutline.transform(rPropertyHolder.getTransformation()); + + return new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aOutline), + rColor); + } + + drawinglayer::primitive2d::BasePrimitive2D* CreateGradientWallpaper( + const basegfx::B2DRange& rRange, + const Gradient& rGradient, + PropertyHolder& rPropertyHolder) + { + const drawinglayer::attribute::FillGradientAttribute aAttribute(createFillGradientAttribute(rGradient)); + + if(aAttribute.getStartColor() == aAttribute.getEndColor()) + { + // not really a gradient. Create filled rectangle + return CreateColorWallpaper(rRange, aAttribute.getStartColor(), rPropertyHolder); + } + else + { + // really a gradient + drawinglayer::primitive2d::BasePrimitive2D* pRetval = + new drawinglayer::primitive2d::FillGradientPrimitive2D( + rRange, + aAttribute); + + if(!rPropertyHolder.getTransformation().isIdentity()) + { + const drawinglayer::primitive2d::Primitive2DReference xPrim(pRetval); + const drawinglayer::primitive2d::Primitive2DSequence xSeq(&xPrim, 1); + + pRetval = new drawinglayer::primitive2d::TransformPrimitive2D( + rPropertyHolder.getTransformation(), + xSeq); + } + + return pRetval; + } + } + + void CreateAndAppendBitmapWallpaper( + basegfx::B2DRange aWallpaperRange, + const Wallpaper& rWallpaper, + TargetHolder& rTarget, + PropertyHolder& rProperty) + { + const BitmapEx aBitmapEx(rWallpaper.GetBitmap()); + const WallpaperStyle eWallpaperStyle(rWallpaper.GetStyle()); + + // if bitmap visualisation is transparent, maybe background + // needs to be filled. Create background + if(aBitmapEx.IsTransparent() + || (WALLPAPER_TILE != eWallpaperStyle && WALLPAPER_SCALE != eWallpaperStyle)) + { + if(rWallpaper.IsGradient()) + { + rTarget.append( + CreateGradientWallpaper( + aWallpaperRange, + rWallpaper.GetGradient(), + rProperty)); + } + else if(!rWallpaper.GetColor().GetTransparency()) + { + rTarget.append( + CreateColorWallpaper( + aWallpaperRange, + rWallpaper.GetColor().getBColor(), + rProperty)); + } + } + + // use wallpaper rect if set + if(rWallpaper.IsRect() && !rWallpaper.GetRect().IsEmpty()) + { + aWallpaperRange = basegfx::B2DRange( + rWallpaper.GetRect().Left(), rWallpaper.GetRect().Top(), + rWallpaper.GetRect().Right(), rWallpaper.GetRect().Bottom()); + } + + drawinglayer::primitive2d::BasePrimitive2D* pBitmapWallpaperFill = + new drawinglayer::primitive2d::WallpaperBitmapPrimitive2D( + aWallpaperRange, + aBitmapEx, + eWallpaperStyle); + + if(rProperty.getTransformation().isIdentity()) + { + // add directly + rTarget.append(pBitmapWallpaperFill); + } + else + { + // when a transformation is set, embed to it + const drawinglayer::primitive2d::Primitive2DReference xPrim(pBitmapWallpaperFill); + + rTarget.append( + new drawinglayer::primitive2d::TransformPrimitive2D( + rProperty.getTransformation(), + drawinglayer::primitive2d::Primitive2DSequence(&xPrim, 1))); + } + } + + drawinglayer::primitive2d::TextLine mapTextLineStyle(FontUnderline eLineStyle) + { + switch(eLineStyle) + { + case UNDERLINE_SINGLE: return drawinglayer::primitive2d::TEXT_LINE_SINGLE; + case UNDERLINE_DOUBLE: return drawinglayer::primitive2d::TEXT_LINE_DOUBLE; + case UNDERLINE_DOTTED: return drawinglayer::primitive2d::TEXT_LINE_DOTTED; + case UNDERLINE_DASH: return drawinglayer::primitive2d::TEXT_LINE_DASH; + case UNDERLINE_LONGDASH: return drawinglayer::primitive2d::TEXT_LINE_LONGDASH; + case UNDERLINE_DASHDOT: return drawinglayer::primitive2d::TEXT_LINE_DASHDOT; + case UNDERLINE_DASHDOTDOT: return drawinglayer::primitive2d::TEXT_LINE_DASHDOTDOT; + case UNDERLINE_SMALLWAVE: return drawinglayer::primitive2d::TEXT_LINE_SMALLWAVE; + case UNDERLINE_WAVE: return drawinglayer::primitive2d::TEXT_LINE_WAVE; + case UNDERLINE_DOUBLEWAVE: return drawinglayer::primitive2d::TEXT_LINE_DOUBLEWAVE; + case UNDERLINE_BOLD: return drawinglayer::primitive2d::TEXT_LINE_BOLD; + case UNDERLINE_BOLDDOTTED: return drawinglayer::primitive2d::TEXT_LINE_BOLDDOTTED; + case UNDERLINE_BOLDDASH: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASH; + case UNDERLINE_BOLDLONGDASH: return drawinglayer::primitive2d::TEXT_LINE_BOLDLONGDASH; + case UNDERLINE_BOLDDASHDOT: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASHDOT; + case UNDERLINE_BOLDDASHDOTDOT: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASHDOTDOT; + case UNDERLINE_BOLDWAVE: return drawinglayer::primitive2d::TEXT_LINE_BOLDWAVE; + // FontUnderline_FORCE_EQUAL_SIZE, UNDERLINE_DONTKNOW, UNDERLINE_NONE + default: return drawinglayer::primitive2d::TEXT_LINE_NONE; + } + } + + bool isUnderlineAbove(const Font& rFont) + { + if(!rFont.IsVertical()) + { + return false; + } + + if((LANGUAGE_JAPANESE == rFont.GetLanguage()) || (LANGUAGE_JAPANESE == rFont.GetCJKContextLanguage())) + { + // the underline is right for Japanese only + return true; + } + + return false; + } + + void proccessMetaTextAction( + const Point& rTextStartPosition, + const XubString& rText, + sal_uInt16 nTextStart, + sal_uInt16 nTextLength, + sal_Int32* pDXArray, + TargetHolder& rTarget, + PropertyHolder& rProperty) + { + drawinglayer::primitive2d::BasePrimitive2D* pResult = 0; + const Font& rFont = rProperty.getFont(); + std::vector< double > aDXArray; + + if(nTextLength) + { + // get current font and create FontScaling and FontAttribute + basegfx::B2DVector aFontScaling; + const drawinglayer::attribute::FontAttribute aFontAttribute( + drawinglayer::primitive2d::getFontAttributeFromVclFont( + aFontScaling, + rFont, + 0 != (rProperty.getLayoutMode() & TEXT_LAYOUT_BIDI_RTL), + 0 != (rProperty.getLayoutMode() & TEXT_LAYOUT_BIDI_STRONG))); + + // create TextTransform + basegfx::B2DHomMatrix aTextTransform; + + // add FontScaling + aTextTransform.scale(aFontScaling.getX(), aFontScaling.getY()); + + // take text align into account + if(ALIGN_BASELINE != rFont.GetAlign()) + { + drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice; + aTextLayouterDevice.setFont(rFont); + + if(ALIGN_TOP == rFont.GetAlign()) + { + aTextTransform.translate( + 0.0, + aTextLayouterDevice.getFontAscent()); + } + else // ALIGN_BOTTOM + { + aTextTransform.translate( + 0.0, + -aTextLayouterDevice.getFontDescent()); + } + } + + // add FontRotation (if used) + if(rFont.GetOrientation()) + { + aTextTransform.rotate(-rFont.GetOrientation() * F_PI1800); + } + + // add TextStartPosition + aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y()); + + // preapare DXArray (if used) + if(pDXArray && nTextLength) + { + aDXArray.reserve(nTextLength); + + for(xub_StrLen a(0); a < nTextLength; a++) + { + aDXArray.push_back((double)(*(pDXArray + a))); + } + } + + // prepare FontColor and Locale + const basegfx::BColor aFontColor(rProperty.getTextColor()); + const com::sun::star::lang::Locale aLocale(MsLangId::convertLanguageToLocale(rProperty.getLanguageType())); + const bool bWordLineMode(rFont.IsWordLineMode()); + + const bool bDecoratedIsNeeded( + UNDERLINE_NONE != rFont.GetOverline() + || UNDERLINE_NONE != rFont.GetUnderline() + || STRIKEOUT_NONE != rFont.GetStrikeout() + || EMPHASISMARK_NONE != (rFont.GetEmphasisMark() & EMPHASISMARK_STYLE) + || RELIEF_NONE != rFont.GetRelief() + || rFont.IsShadow() + || bWordLineMode); + + if(bDecoratedIsNeeded) + { + // prepare overline and underline data + const drawinglayer::primitive2d::TextLine eFontOverline(mapTextLineStyle(rFont.GetOverline())); + const drawinglayer::primitive2d::TextLine eFontUnderline(mapTextLineStyle(rFont.GetUnderline())); + + // check UndelineAbove + const bool bUnderlineAbove(drawinglayer::primitive2d::TEXT_LINE_NONE != eFontUnderline && isUnderlineAbove(rFont)); + + // prepare strikeout data + drawinglayer::primitive2d::FontStrikeout eFontStrikeout(drawinglayer::primitive2d::FONT_STRIKEOUT_NONE); + + switch(rFont.GetStrikeout()) + { + case STRIKEOUT_SINGLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SINGLE; break; + case STRIKEOUT_DOUBLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_DOUBLE; break; + case STRIKEOUT_BOLD: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_BOLD; break; + case STRIKEOUT_SLASH: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SLASH; break; + case STRIKEOUT_X: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_X; break; + default : break; // FontStrikeout_FORCE_EQUAL_SIZE, STRIKEOUT_NONE, STRIKEOUT_DONTKNOW + } + + // prepare emphasis mark data + drawinglayer::primitive2d::FontEmphasisMark eFontEmphasisMark(drawinglayer::primitive2d::FONT_EMPHASISMARK_NONE); + + switch(rFont.GetEmphasisMark() & EMPHASISMARK_STYLE) + { + case EMPHASISMARK_DOT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DOT; break; + case EMPHASISMARK_CIRCLE : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_CIRCLE; break; + case EMPHASISMARK_DISC : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DISC; break; + case EMPHASISMARK_ACCENT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_ACCENT; break; + } + + const bool bEmphasisMarkAbove(rFont.GetEmphasisMark() & EMPHASISMARK_POS_ABOVE); + const bool bEmphasisMarkBelow(rFont.GetEmphasisMark() & EMPHASISMARK_POS_BELOW); + + // prepare font relief data + drawinglayer::primitive2d::FontRelief eFontRelief(drawinglayer::primitive2d::FONT_RELIEF_NONE); + + switch(rFont.GetRelief()) + { + case RELIEF_EMBOSSED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_EMBOSSED; break; + case RELIEF_ENGRAVED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_ENGRAVED; break; + default : break; // RELIEF_NONE, FontRelief_FORCE_EQUAL_SIZE + } + + // prepare shadow/outline data + const bool bShadow(rFont.IsShadow()); + + // TextDecoratedPortionPrimitive2D is needed, create one + pResult = new drawinglayer::primitive2d::TextDecoratedPortionPrimitive2D( + + // attributes for TextSimplePortionPrimitive2D + aTextTransform, + rText, + nTextStart, + nTextLength, + aDXArray, + aFontAttribute, + aLocale, + aFontColor, + + // attributes for TextDecoratedPortionPrimitive2D + rProperty.getOverlineColorActive() ? rProperty.getOverlineColor() : aFontColor, + rProperty.getTextLineColorActive() ? rProperty.getTextLineColor() : aFontColor, + eFontOverline, + eFontUnderline, + bUnderlineAbove, + eFontStrikeout, + bWordLineMode, + eFontEmphasisMark, + bEmphasisMarkAbove, + bEmphasisMarkBelow, + eFontRelief, + bShadow); + } + else + { + // TextSimplePortionPrimitive2D is enough + pResult = new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( + aTextTransform, + rText, + nTextStart, + nTextLength, + aDXArray, + aFontAttribute, + aLocale, + aFontColor); + } + } + + if(pResult && rProperty.getTextFillColorActive()) + { + drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice; + const bool bRotated(rFont.GetOrientation()); + + if(bRotated) + { + // use unrotated font + Font aUnrotatedFont(rFont); + aUnrotatedFont.SetOrientation(0); + aTextLayouterDevice.setFont(aUnrotatedFont); + } + else + { + aTextLayouterDevice.setFont(rFont); + } + + // get base range + basegfx::B2DRange aTextRange( + aTextLayouterDevice.getTextBoundRect( + rText, nTextStart, nTextLength)); + + if(aDXArray.size()) + { + // use the last entry in DXArray to correct the width + aTextRange = basegfx::B2DRange( + aTextRange.getMinX(), + aTextRange.getMinY(), + aTextRange.getMinX() + aDXArray[aDXArray.size() - 1], + aTextRange.getMaxY()); + } + + // create Transform. Scale and Alignment are already applied. + basegfx::B2DHomMatrix aTextTransform; + + if(bRotated) + { + aTextTransform.rotate(-rFont.GetOrientation() * F_PI1800); + } + + aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y()); + + // prepare Primitive2DSequence, put text in foreground + drawinglayer::primitive2d::Primitive2DSequence aSequence(2); + aSequence[1] = drawinglayer::primitive2d::Primitive2DReference(pResult); + + // prepare filled polygon + basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aTextRange)); + aOutline.transform(aTextTransform); + + aSequence[0] = drawinglayer::primitive2d::Primitive2DReference( + new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aOutline), + rProperty.getTextFillColor())); + + // set as group at pResult + pResult = new drawinglayer::primitive2d::GroupPrimitive2D(aSequence); + } + + if(pResult) + { + // add created text primitive to target + if(rProperty.getTransformation().isIdentity()) + { + rTarget.append(pResult); + } + else + { + // when a transformation is set, embed to it + const drawinglayer::primitive2d::Primitive2DReference aReference(pResult); + + rTarget.append( + new drawinglayer::primitive2d::TransformPrimitive2D( + rProperty.getTransformation(), + drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1))); + } + } + } + + void interpretMetafile( + const GDIMetaFile& rMetaFile, + TargetHolders& rTargetHolders, + PropertyHolders& rPropertyHolders, + const drawinglayer::geometry::ViewInformation2D& rViewInformation) + { + const sal_uInt32 nCount(rMetaFile.GetActionCount()); + + for(sal_uInt32 a(0); a < nCount; a++) + { + MetaAction* pAction = rMetaFile.GetAction(a); + + switch(pAction->GetType()) + { + case META_NULL_ACTION : + { + /** SIMPLE, DONE */ + break; + } + case META_PIXEL_ACTION : + { + /** CHECKED, WORKS WELL */ + std::vector< basegfx::B2DPoint > aPositions; + Color aLastColor(COL_BLACK); + + while(META_PIXEL_ACTION == pAction->GetType() && a < nCount) + { + const MetaPixelAction* pA = (const MetaPixelAction*)pAction; + + if(pA->GetColor() != aLastColor) + { + if(aPositions.size()) + { + createPointArrayPrimitive(aPositions, rTargetHolders.Current(), rPropertyHolders.Current(), aLastColor.getBColor()); + aPositions.clear(); + } + + aLastColor = pA->GetColor(); + } + + const Point& rPoint = pA->GetPoint(); + aPositions.push_back(basegfx::B2DPoint(rPoint.X(), rPoint.Y())); + a++; if(a < nCount) pAction = rMetaFile.GetAction(a); + } + + a--; + + if(aPositions.size()) + { + createPointArrayPrimitive(aPositions, rTargetHolders.Current(), rPropertyHolders.Current(), aLastColor.getBColor()); + } + + break; + } + case META_POINT_ACTION : + { + /** CHECKED, WORKS WELL */ + if(rPropertyHolders.Current().getLineColorActive()) + { + std::vector< basegfx::B2DPoint > aPositions; + + while(META_POINT_ACTION == pAction->GetType() && a < nCount) + { + const MetaPointAction* pA = (const MetaPointAction*)pAction; + const Point& rPoint = pA->GetPoint(); + aPositions.push_back(basegfx::B2DPoint(rPoint.X(), rPoint.Y())); + a++; if(a < nCount) pAction = rMetaFile.GetAction(a); + } + + a--; + + if(aPositions.size()) + { + createPointArrayPrimitive(aPositions, rTargetHolders.Current(), rPropertyHolders.Current(), rPropertyHolders.Current().getLineColor()); + } + } + + break; + } + case META_LINE_ACTION : + { + /** CHECKED, WORKS WELL */ + if(rPropertyHolders.Current().getLineColorActive()) + { + basegfx::B2DPolygon aLinePolygon; + LineInfo aLineInfo; + + while(META_LINE_ACTION == pAction->GetType() && a < nCount) + { + const MetaLineAction* pA = (const MetaLineAction*)pAction; + const Point& rStartPoint = pA->GetStartPoint(); + const Point& rEndPoint = pA->GetEndPoint(); + const basegfx::B2DPoint aStart(rStartPoint.X(), rStartPoint.Y()); + const basegfx::B2DPoint aEnd(rEndPoint.X(), rEndPoint.Y()); + + if(aLinePolygon.count()) + { + if(pA->GetLineInfo() == aLineInfo + && aStart == aLinePolygon.getB2DPoint(aLinePolygon.count() - 1)) + { + aLinePolygon.append(aEnd); + } + else + { + aLineInfo.SetLineJoin(basegfx::B2DLINEJOIN_NONE); // It were lines; force to NONE + createLinePrimitive(aLinePolygon, aLineInfo, rTargetHolders.Current(), rPropertyHolders.Current()); + aLinePolygon.clear(); + aLineInfo = pA->GetLineInfo(); + aLinePolygon.append(aStart); + aLinePolygon.append(aEnd); + } + } + else + { + aLineInfo = pA->GetLineInfo(); + aLinePolygon.append(aStart); + aLinePolygon.append(aEnd); + } + + a++; if(a < nCount) pAction = rMetaFile.GetAction(a); + } + + a--; + + if(aLinePolygon.count()) + { + aLineInfo.SetLineJoin(basegfx::B2DLINEJOIN_NONE); // It were lines; force to NONE + createLinePrimitive(aLinePolygon, aLineInfo, rTargetHolders.Current(), rPropertyHolders.Current()); + } + } + + break; + } + case META_RECT_ACTION : + { + /** CHECKED, WORKS WELL */ + if(rPropertyHolders.Current().getLineOrFillActive()) + { + const MetaRectAction* pA = (const MetaRectAction*)pAction; + const Rectangle& rRectangle = pA->GetRect(); + + if(!rRectangle.IsEmpty()) + { + const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + + if(!aRange.isEmpty()) + { + const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); + createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current()); + } + } + } + + break; + } + case META_ROUNDRECT_ACTION : + { + /** CHECKED, WORKS WELL */ + /** The original OutputDevice::DrawRect paints nothing when nHor or nVer is zero; but just + because the tools::Polygon operator creating the rounding does produce nonsense. I assume + this an error and create an unrounded rectangle in that case (implicit in + createPolygonFromRect) + */ + if(rPropertyHolders.Current().getLineOrFillActive()) + { + const MetaRoundRectAction* pA = (const MetaRoundRectAction*)pAction; + const Rectangle& rRectangle = pA->GetRect(); + + if(!rRectangle.IsEmpty()) + { + const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + + if(!aRange.isEmpty()) + { + const sal_uInt32 nHor(pA->GetHorzRound()); + const sal_uInt32 nVer(pA->GetVertRound()); + basegfx::B2DPolygon aOutline; + + if(nHor || nVer) + { + double fRadiusX((nHor * 2.0) / (aRange.getWidth() > 0.0 ? aRange.getWidth() : 1.0)); + double fRadiusY((nVer * 2.0) / (aRange.getHeight() > 0.0 ? aRange.getHeight() : 1.0)); + fRadiusX = std::max(0.0, std::min(1.0, fRadiusX)); + fRadiusY = std::max(0.0, std::min(1.0, fRadiusY)); + + aOutline = basegfx::tools::createPolygonFromRect(aRange, fRadiusX, fRadiusY); + } + else + { + aOutline = basegfx::tools::createPolygonFromRect(aRange); + } + + createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current()); + } + } + } + + break; + } + case META_ELLIPSE_ACTION : + { + /** CHECKED, WORKS WELL */ + if(rPropertyHolders.Current().getLineOrFillActive()) + { + const MetaEllipseAction* pA = (const MetaEllipseAction*)pAction; + const Rectangle& rRectangle = pA->GetRect(); + + if(!rRectangle.IsEmpty()) + { + const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + + if(!aRange.isEmpty()) + { + const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromEllipse( + aRange.getCenter(), aRange.getWidth() * 0.5, aRange.getHeight() * 0.5)); + + createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current()); + } + } + } + + break; + } + case META_ARC_ACTION : + { + /** CHECKED, WORKS WELL */ + if(rPropertyHolders.Current().getLineColorActive()) + { + const MetaArcAction* pA = (const MetaArcAction*)pAction; + const Polygon aToolsPoly(pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_ARC); + const basegfx::B2DPolygon aOutline(aToolsPoly.getB2DPolygon()); + + createHairlinePrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current()); + } + + break; + } + case META_PIE_ACTION : + { + /** CHECKED, WORKS WELL */ + if(rPropertyHolders.Current().getLineOrFillActive()) + { + const MetaPieAction* pA = (const MetaPieAction*)pAction; + const Polygon aToolsPoly(pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_PIE); + const basegfx::B2DPolygon aOutline(aToolsPoly.getB2DPolygon()); + + createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current()); + } + + break; + } + case META_CHORD_ACTION : + { + /** CHECKED, WORKS WELL */ + if(rPropertyHolders.Current().getLineOrFillActive()) + { + const MetaChordAction* pA = (const MetaChordAction*)pAction; + const Polygon aToolsPoly(pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_CHORD); + const basegfx::B2DPolygon aOutline(aToolsPoly.getB2DPolygon()); + + createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current()); + } + + break; + } + case META_POLYLINE_ACTION : + { + /** CHECKED, WORKS WELL */ + if(rPropertyHolders.Current().getLineColorActive()) + { + const MetaPolyLineAction* pA = (const MetaPolyLineAction*)pAction; + createLinePrimitive(pA->GetPolygon().getB2DPolygon(), pA->GetLineInfo(), rTargetHolders.Current(), rPropertyHolders.Current()); + } + + break; + } + case META_POLYGON_ACTION : + { + /** CHECKED, WORKS WELL */ + if(rPropertyHolders.Current().getLineOrFillActive()) + { + const MetaPolygonAction* pA = (const MetaPolygonAction*)pAction; + basegfx::B2DPolygon aOutline(pA->GetPolygon().getB2DPolygon()); + + // the metafile play interprets the polygons from MetaPolygonAction + // always as closed and always paints an edge from last to first point, + // so force to closed here to emulate that + if(aOutline.count() > 1 && !aOutline.isClosed()) + { + aOutline.setClosed(true); + } + + createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current()); + } + + break; + } + case META_POLYPOLYGON_ACTION : + { + /** CHECKED, WORKS WELL */ + if(rPropertyHolders.Current().getLineOrFillActive()) + { + const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*)pAction; + basegfx::B2DPolyPolygon aPolyPolygonOutline(pA->GetPolyPolygon().getB2DPolyPolygon()); + + // the metafile play interprets the single polygons from MetaPolyPolygonAction + // always as closed and always paints an edge from last to first point, + // so force to closed here to emulate that + for(sal_uInt32 a(0); a < aPolyPolygonOutline.count(); a++) + { + basegfx::B2DPolygon aPolygonOutline(aPolyPolygonOutline.getB2DPolygon(a)); + + if(aPolygonOutline.count() > 1 && !aPolygonOutline.isClosed()) + { + aPolygonOutline.setClosed(true); + aPolyPolygonOutline.setB2DPolygon(a, aPolygonOutline); + } + } + + createHairlineAndFillPrimitive(aPolyPolygonOutline, rTargetHolders.Current(), rPropertyHolders.Current()); + } + + break; + } + case META_TEXT_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaTextAction* pA = (const MetaTextAction*)pAction; + + if(pA->GetLen() && rPropertyHolders.Current().getTextColorActive()) + { + proccessMetaTextAction( + pA->GetPoint(), + pA->GetText(), + pA->GetIndex(), + pA->GetLen(), + 0, + rTargetHolders.Current(), + rPropertyHolders.Current()); + } + + break; + } + case META_TEXTARRAY_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaTextArrayAction* pA = (const MetaTextArrayAction*)pAction; + + if(pA->GetLen() && rPropertyHolders.Current().getTextColorActive()) + { + proccessMetaTextAction( + pA->GetPoint(), + pA->GetText(), + pA->GetIndex(), + pA->GetLen(), + pA->GetDXArray(), + rTargetHolders.Current(), + rPropertyHolders.Current()); + } + + break; + } + case META_STRETCHTEXT_ACTION : + { + /** NEEDS IMPLEMENTATION */ + OSL_ENSURE(false, "META_STRETCHTEXT_ACTION requested (!)"); + // use OutputDevice::GetTextArray() to map the... + const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pAction; + break; + } + case META_TEXTRECT_ACTION : + { + /** NEEDS IMPLEMENTATION */ + OSL_ENSURE(false, "META_TEXTRECT_ACTION requested (!)"); + const MetaTextRectAction* pA = (const MetaTextRectAction*)pAction; + break; + } + case META_BMP_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaBmpAction* pA = (const MetaBmpAction*)pAction; + const BitmapEx aBitmapEx(pA->GetBitmap()); + + createBitmapExPrimitive(aBitmapEx, pA->GetPoint(), rTargetHolders.Current(), rPropertyHolders.Current()); + + break; + } + case META_BMPSCALE_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*)pAction; + const Bitmap aBitmapEx(pA->GetBitmap()); + + createBitmapExPrimitive(aBitmapEx, pA->GetPoint(), pA->GetSize(), rTargetHolders.Current(), rPropertyHolders.Current()); + + break; + } + case META_BMPSCALEPART_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*)pAction; + const Bitmap& rBitmap = pA->GetBitmap(); + + if(!rBitmap.IsEmpty()) + { + Bitmap aCroppedBitmap(rBitmap); + const Rectangle aCropRectangle(pA->GetSrcPoint(), pA->GetSrcSize()); + + if(!aCropRectangle.IsEmpty()) + { + aCroppedBitmap.Crop(aCropRectangle); + } + + const BitmapEx aCroppedBitmapEx(aCroppedBitmap); + createBitmapExPrimitive(aCroppedBitmapEx, pA->GetDestPoint(), pA->GetDestSize(), rTargetHolders.Current(), rPropertyHolders.Current()); + } + + break; + } + case META_BMPEX_ACTION : + { + /** CHECKED, WORKS WELL: Simply same as META_BMP_ACTION */ + const MetaBmpExAction* pA = (const MetaBmpExAction*)pAction; + const BitmapEx& rBitmapEx = pA->GetBitmapEx(); + + createBitmapExPrimitive(rBitmapEx, pA->GetPoint(), rTargetHolders.Current(), rPropertyHolders.Current()); + + break; + } + case META_BMPEXSCALE_ACTION : + { + /** CHECKED, WORKS WELL: Simply same as META_BMPSCALE_ACTION */ + const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*)pAction; + const BitmapEx& rBitmapEx = pA->GetBitmapEx(); + + createBitmapExPrimitive(rBitmapEx, pA->GetPoint(), pA->GetSize(), rTargetHolders.Current(), rPropertyHolders.Current()); + + break; + } + case META_BMPEXSCALEPART_ACTION : + { + /** CHECKED, WORKS WELL: Simply same as META_BMPSCALEPART_ACTION */ + const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*)pAction; + const BitmapEx& rBitmapEx = pA->GetBitmapEx(); + + if(!rBitmapEx.IsEmpty()) + { + BitmapEx aCroppedBitmapEx(rBitmapEx); + const Rectangle aCropRectangle(pA->GetSrcPoint(), pA->GetSrcSize()); + + if(!aCropRectangle.IsEmpty()) + { + aCroppedBitmapEx.Crop(aCropRectangle); + } + + createBitmapExPrimitive(aCroppedBitmapEx, pA->GetDestPoint(), pA->GetDestSize(), rTargetHolders.Current(), rPropertyHolders.Current()); + } + + break; + } + case META_MASK_ACTION : + { + /** CHECKED, WORKS WELL: Simply same as META_BMP_ACTION */ + const MetaMaskAction* pA = (const MetaMaskAction*)pAction; + const BitmapEx aBitmapEx(createMaskBmpEx(pA->GetBitmap(), pA->GetColor())); + + createBitmapExPrimitive(aBitmapEx, pA->GetPoint(), rTargetHolders.Current(), rPropertyHolders.Current()); + + break; + } + case META_MASKSCALE_ACTION : + { + /** CHECKED, WORKS WELL: Simply same as META_BMPSCALE_ACTION */ + const MetaMaskScaleAction* pA = (const MetaMaskScaleAction*)pAction; + const BitmapEx aBitmapEx(createMaskBmpEx(pA->GetBitmap(), pA->GetColor())); + + createBitmapExPrimitive(aBitmapEx, pA->GetPoint(), pA->GetSize(), rTargetHolders.Current(), rPropertyHolders.Current()); + + break; + } + case META_MASKSCALEPART_ACTION : + { + /** CHECKED, WORKS WELL: Simply same as META_BMPSCALEPART_ACTION */ + const MetaMaskScalePartAction* pA = (const MetaMaskScalePartAction*)pAction; + const Bitmap& rBitmap = pA->GetBitmap(); + + if(!rBitmap.IsEmpty()) + { + Bitmap aCroppedBitmap(rBitmap); + const Rectangle aCropRectangle(pA->GetSrcPoint(), pA->GetSrcSize()); + + if(!aCropRectangle.IsEmpty()) + { + aCroppedBitmap.Crop(aCropRectangle); + } + + const BitmapEx aCroppedBitmapEx(createMaskBmpEx(aCroppedBitmap, pA->GetColor())); + createBitmapExPrimitive(aCroppedBitmapEx, pA->GetDestPoint(), pA->GetDestSize(), rTargetHolders.Current(), rPropertyHolders.Current()); + } + + break; + } + case META_GRADIENT_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaGradientAction* pA = (const MetaGradientAction*)pAction; + const Rectangle& rRectangle = pA->GetRect(); + + if(!rRectangle.IsEmpty()) + { + basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + + if(!aRange.isEmpty()) + { + const Gradient& rGradient = pA->GetGradient(); + const drawinglayer::attribute::FillGradientAttribute aAttribute(createFillGradientAttribute(rGradient)); + + if(aAttribute.getStartColor() == aAttribute.getEndColor()) + { + // not really a gradient. Create filled rectangle + const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); + createFillPrimitive(basegfx::B2DPolyPolygon(aOutline), rTargetHolders.Current(), rPropertyHolders.Current()); + } + else + { + // really a gradient + aRange.transform(rPropertyHolders.Current().getTransformation()); + + if(rPropertyHolders.Current().isRasterOpInvert()) + { + // use a special version of FillGradientPrimitive2D which creates + // non-overlapping geometry on decomposition to makethe old XOR + // paint 'trick' work. + rTargetHolders.Current().append( + new drawinglayer::primitive2d::NonOverlappingFillGradientPrimitive2D( + aRange, + aAttribute)); + } + else + { + rTargetHolders.Current().append( + new drawinglayer::primitive2d::FillGradientPrimitive2D( + aRange, + aAttribute)); + } + } + } + } + + break; + } + case META_HATCH_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaHatchAction* pA = (const MetaHatchAction*)pAction; + basegfx::B2DPolyPolygon aOutline(pA->GetPolyPolygon().getB2DPolyPolygon()); + + if(aOutline.count()) + { + const Hatch& rHatch = pA->GetHatch(); + const drawinglayer::attribute::FillHatchAttribute aAttribute(createFillHatchAttribute(rHatch)); + + aOutline.transform(rPropertyHolders.Current().getTransformation()); + + const basegfx::B2DRange aObjectRange(aOutline.getB2DRange()); + const drawinglayer::primitive2d::Primitive2DReference aFillHatch( + new drawinglayer::primitive2d::FillHatchPrimitive2D( + aObjectRange, + basegfx::BColor(), + aAttribute)); + + rTargetHolders.Current().append( + new drawinglayer::primitive2d::MaskPrimitive2D( + aOutline, + drawinglayer::primitive2d::Primitive2DSequence(&aFillHatch, 1))); + } + + break; + } + case META_WALLPAPER_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaWallpaperAction* pA = (const MetaWallpaperAction*)pAction; + Rectangle aWallpaperRectangle(pA->GetRect()); + + if(!aWallpaperRectangle.IsEmpty()) + { + const Wallpaper& rWallpaper = pA->GetWallpaper(); + const WallpaperStyle eWallpaperStyle(rWallpaper.GetStyle()); + basegfx::B2DRange aWallpaperRange( + aWallpaperRectangle.Left(), aWallpaperRectangle.Top(), + aWallpaperRectangle.Right(), aWallpaperRectangle.Bottom()); + + if(WALLPAPER_NULL != eWallpaperStyle) + { + if(rWallpaper.IsBitmap()) + { + // create bitmap background + CreateAndAppendBitmapWallpaper( + aWallpaperRange, + rWallpaper, + rTargetHolders.Current(), + rPropertyHolders.Current()); + } + else if(rWallpaper.IsGradient()) + { + // create gradient background + rTargetHolders.Current().append( + CreateGradientWallpaper( + aWallpaperRange, + rWallpaper.GetGradient(), + rPropertyHolders.Current())); + } + else if(!rWallpaper.GetColor().GetTransparency()) + { + // create color background + rTargetHolders.Current().append( + CreateColorWallpaper( + aWallpaperRange, + rWallpaper.GetColor().getBColor(), + rPropertyHolders.Current())); + } + } + } + + break; + } + case META_CLIPREGION_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaClipRegionAction* pA = (const MetaClipRegionAction*)pAction; + + if(pA->IsClipping()) + { + // new clipping + HandleNewClipRegion(&pA->GetRegion(), rTargetHolders, rPropertyHolders); + } + else + { + // end clipping + HandleNewClipRegion(0, rTargetHolders, rPropertyHolders); + } + + break; + } + case META_ISECTRECTCLIPREGION_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*)pAction; + const Rectangle& rRectangle = pA->GetRect(); + + if(rRectangle.IsEmpty()) + { + // intersect with empty rectangle will always give empty + // region; start new clipping with empty region + const Region aNewRegion; + HandleNewClipRegion(&aNewRegion, rTargetHolders, rPropertyHolders); + } + else + { + if(rPropertyHolders.Current().getRegionActive()) + { + if(rPropertyHolders.Current().getRegion().IsEmpty()) + { + // nothing to do, empty active clip region will stay + // empty when intersecting + } + else + { + // AND existing region and new rectangle + const basegfx::B2DPolyPolygon aOriginalPolyPolygon( + getB2DPolyPolygonFromRegion(rPropertyHolders.Current().getRegion())); + basegfx::B2DPolyPolygon aClippedPolyPolygon; + + if(aOriginalPolyPolygon.count()) + { + const basegfx::B2DRange aIntersectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + aClippedPolyPolygon = basegfx::tools::clipPolyPolygonOnRange( + aOriginalPolyPolygon, aIntersectRange, true, false); + } + + if(aClippedPolyPolygon != aOriginalPolyPolygon) + { + // start new clipping with intersected region + const Region aNewRegion(aClippedPolyPolygon); + HandleNewClipRegion(&aNewRegion, rTargetHolders, rPropertyHolders); + } + } + } + else + { + // start new clipping with rectangle + const Region aNewRegion(rRectangle); + HandleNewClipRegion(&aNewRegion, rTargetHolders, rPropertyHolders); + } + } + + break; + } + case META_ISECTREGIONCLIPREGION_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaISectRegionClipRegionAction* pA = (const MetaISectRegionClipRegionAction*)pAction; + const Region& rNewRegion = pA->GetRegion(); + + if(rNewRegion.IsEmpty()) + { + // intersect with empty region will always give empty + // region; start new clipping with empty region + const Region aNewRegion; + HandleNewClipRegion(&aNewRegion, rTargetHolders, rPropertyHolders); + } + else + { + if(rPropertyHolders.Current().getRegionActive()) + { + if(rPropertyHolders.Current().getRegion().IsEmpty()) + { + // nothing to do, empty active clip region will stay empty + // when intersecting with any region + } + else + { + // AND existing and new region + const basegfx::B2DPolyPolygon aOriginalPolyPolygon( + getB2DPolyPolygonFromRegion(rPropertyHolders.Current().getRegion())); + basegfx::B2DPolyPolygon aClippedPolyPolygon; + + if(aOriginalPolyPolygon.count()) + { + const basegfx::B2DPolyPolygon aClipPolyPolygon( + getB2DPolyPolygonFromRegion(rNewRegion)); + + if(aClipPolyPolygon.count()) + { + aClippedPolyPolygon = basegfx::tools::clipPolyPolygonOnPolyPolygon( + aOriginalPolyPolygon, aClipPolyPolygon, true, false); + } + } + + if(aClippedPolyPolygon != aOriginalPolyPolygon) + { + // start new clipping with intersected region + const Region aNewRegion(aClippedPolyPolygon); + HandleNewClipRegion(&aNewRegion, rTargetHolders, rPropertyHolders); + } + } + } + else + { + // start new clipping with new region + HandleNewClipRegion(&rNewRegion, rTargetHolders, rPropertyHolders); + } + } + + break; + } + case META_MOVECLIPREGION_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaMoveClipRegionAction* pA = (const MetaMoveClipRegionAction*)pAction; + + if(rPropertyHolders.Current().getRegionActive()) + { + if(rPropertyHolders.Current().getRegion().IsEmpty()) + { + // nothing to do + } + else + { + // move using old interface + Region aRegion(rPropertyHolders.Current().getRegion()); + + const sal_Int32 nHor(pA->GetHorzMove()); + const sal_Int32 nVer(pA->GetVertMove()); + + if(0 != nHor || 0 != nVer) + { + aRegion.Move(nHor, nVer); + HandleNewClipRegion(&aRegion, rTargetHolders, rPropertyHolders); + } + } + } + + break; + } + case META_LINECOLOR_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaLineColorAction* pA = (const MetaLineColorAction*)pAction; + const bool bActive(pA->IsSetting()); + + rPropertyHolders.Current().setLineColorActive(bActive); + if(bActive) + rPropertyHolders.Current().setLineColor(pA->GetColor().getBColor()); + + break; + } + case META_FILLCOLOR_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaFillColorAction* pA = (const MetaFillColorAction*)pAction; + const bool bActive(pA->IsSetting()); + + rPropertyHolders.Current().setFillColorActive(bActive); + if(bActive) + rPropertyHolders.Current().setFillColor(pA->GetColor().getBColor()); + + break; + } + case META_TEXTCOLOR_ACTION : + { + /** SIMPLE, DONE */ + const MetaTextColorAction* pA = (const MetaTextColorAction*)pAction; + const bool bActivate(COL_TRANSPARENT != pA->GetColor().GetColor()); + + rPropertyHolders.Current().setTextColorActive(bActivate); + rPropertyHolders.Current().setTextColor(pA->GetColor().getBColor()); + + break; + } + case META_TEXTFILLCOLOR_ACTION : + { + /** SIMPLE, DONE */ + const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*)pAction; + const bool bWithColorArgument(pA->IsSetting()); + + if(bWithColorArgument) + { + // emulate OutputDevice::SetTextFillColor(...) WITH argument + const Color& rFontFillColor = pA->GetColor(); + rPropertyHolders.Current().setTextFillColor(rFontFillColor.getBColor()); + rPropertyHolders.Current().setTextFillColorActive(COL_TRANSPARENT != rFontFillColor.GetColor()); + } + else + { + // emulate SetFillColor() <- NO argument (!) + rPropertyHolders.Current().setTextFillColorActive(false); + } + + break; + } + case META_TEXTALIGN_ACTION : + { + /** SIMPLE, DONE */ + const MetaTextAlignAction* pA = (const MetaTextAlignAction*)pAction; + const TextAlign aNewTextAlign = pA->GetTextAlign(); + + // TextAlign is applied to the current font (as in + // OutputDevice::SetTextAlign which would be used when + // playing the Metafile) + if(rPropertyHolders.Current().getFont().GetAlign() != aNewTextAlign) + { + Font aNewFont(rPropertyHolders.Current().getFont()); + aNewFont.SetAlign(aNewTextAlign); + rPropertyHolders.Current().setFont(aNewFont); + } + + break; + } + case META_MAPMODE_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaMapModeAction* pA = (const MetaMapModeAction*)pAction; + const MapMode& rMapMode = pA->GetMapMode(); + basegfx::B2DHomMatrix aMapping; + + if(MAP_RELATIVE == rMapMode.GetMapUnit()) + { + aMapping = getTransformFromMapMode(rMapMode); + } + else + { + switch(rMapMode.GetMapUnit()) + { + case MAP_100TH_MM : + { + if(MAP_TWIP == rPropertyHolders.Current().getMapUnit()) + { + // MAP_TWIP -> MAP_100TH_MM + const double fTwipTo100thMm(127.0 / 72.0); + aMapping.scale(fTwipTo100thMm, fTwipTo100thMm); + } + break; + } + case MAP_TWIP : + { + if(MAP_100TH_MM == rPropertyHolders.Current().getMapUnit()) + { + // MAP_100TH_MM -> MAP_TWIP + const double f100thMmToTwip(72.0 / 127.0); + aMapping.scale(f100thMmToTwip, f100thMmToTwip); + } + break; + } + default : + { + OSL_ENSURE(false, "interpretMetafile: META_MAPMODE_ACTION with unsupported MapUnit (!)"); + break; + } + } + + aMapping = getTransformFromMapMode(rMapMode) * aMapping; + rPropertyHolders.Current().setMapUnit(rMapMode.GetMapUnit()); + } + + if(!aMapping.isIdentity()) + { + aMapping = aMapping * rPropertyHolders.Current().getTransformation(); + rPropertyHolders.Current().setTransformation(aMapping); + } + + break; + } + case META_FONT_ACTION : + { + /** SIMPLE, DONE */ + const MetaFontAction* pA = (const MetaFontAction*)pAction; + rPropertyHolders.Current().setFont(pA->GetFont()); + + // older Metafiles have no META_TEXTCOLOR_ACTION which defines + // the FontColor now, so use the Font's color when not transparent + const Color& rFontColor = pA->GetFont().GetColor(); + const bool bActivate(COL_TRANSPARENT != rFontColor.GetColor()); + + if(bActivate) + { + rPropertyHolders.Current().setTextColor(rFontColor.getBColor()); + } + + // caution: do NOT decativate here on transparet, see + // OutputDevice::SetFont(..) for more info + // rPropertyHolders.Current().setTextColorActive(bActivate); + + // for fill color emulate a MetaTextFillColorAction with !transparent as bool, + // see OutputDevice::SetFont(..) the if(mpMetaFile) case + if(bActivate) + { + const Color& rFontFillColor = pA->GetFont().GetFillColor(); + rPropertyHolders.Current().setTextFillColor(rFontFillColor.getBColor()); + rPropertyHolders.Current().setTextFillColorActive(COL_TRANSPARENT != rFontFillColor.GetColor()); + } + else + { + rPropertyHolders.Current().setTextFillColorActive(false); + } + + break; + } + case META_PUSH_ACTION : + { + /** CHECKED, WORKS WELL */ + rPropertyHolders.Push(); + + break; + } + case META_POP_ACTION : + { + /** CHECKED, WORKS WELL */ + if(rPropertyHolders.Current().getRegionActive()) + { + // end clipping + HandleNewClipRegion(0, rTargetHolders, rPropertyHolders); + } + + if(rPropertyHolders.Current().isRasterOpActive()) + { + // end RasterOp + HandleNewRasterOp(ROP_OVERPAINT, rTargetHolders, rPropertyHolders); + } + + rPropertyHolders.Pop(); + + if(rPropertyHolders.Current().isRasterOpActive()) + { + // start RasterOp + HandleNewRasterOp(rPropertyHolders.Current().getRasterOp(), rTargetHolders, rPropertyHolders); + } + + if(rPropertyHolders.Current().getRegionActive()) + { + // start clipping + HandleNewClipRegion(&rPropertyHolders.Current().getRegion(), rTargetHolders, rPropertyHolders); + } + + break; + } + case META_RASTEROP_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaRasterOpAction* pA = (const MetaRasterOpAction*)pAction; + const RasterOp aRasterOp = pA->GetRasterOp(); + + HandleNewRasterOp(pA->GetRasterOp(), rTargetHolders, rPropertyHolders); + + break; + } + case META_TRANSPARENT_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaTransparentAction* pA = (const MetaTransparentAction*)pAction; + const basegfx::B2DPolyPolygon aOutline(pA->GetPolyPolygon().getB2DPolyPolygon()); + + if(aOutline.count()) + { + const sal_uInt16 nTransparence(pA->GetTransparence()); + + if(0 == nTransparence) + { + // not transparent + createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current()); + } + else if(nTransparence >= 100) + { + // fully or more than transparent + } + else + { + // transparent. Create new target + rTargetHolders.Push(); + + // create primitives there and get them + createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current()); + const drawinglayer::primitive2d::Primitive2DSequence aSubContent( + rTargetHolders.Current().getPrimitive2DSequence(rPropertyHolders.Current())); + + // back to old target + rTargetHolders.Pop(); + + if(aSubContent.hasElements()) + { + rTargetHolders.Current().append( + new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + aSubContent, + nTransparence * 0.01)); + } + } + } + + break; + } + case META_EPS_ACTION : + { + /** NEEDS IMPLEMENTATION */ + OSL_ENSURE(false, "META_EPS_ACTION requested (!)"); + const MetaEPSAction* pA = (const MetaEPSAction*)pAction; + break; + } + case META_REFPOINT_ACTION : + { + /** SIMPLE, DONE */ + // only used for hatch and line pattern offsets + // const MetaRefPointAction* pA = (const MetaRefPointAction*)pAction; + break; + } + case META_TEXTLINECOLOR_ACTION : + { + /** SIMPLE, DONE */ + const MetaTextLineColorAction* pA = (const MetaTextLineColorAction*)pAction; + const bool bActive(pA->IsSetting()); + + rPropertyHolders.Current().setTextLineColorActive(bActive); + if(bActive) + rPropertyHolders.Current().setTextLineColor(pA->GetColor().getBColor()); + + break; + } + case META_TEXTLINE_ACTION : + { + /** NEEDS IMPLEMENTATION */ + OSL_ENSURE(false, "META_TEXTLINE_ACTION requested (!)"); + // actually creates overline, underline and strikeouts, so + // these should be isolated from TextDecoratedPortionPrimitive2D + // to own primitives... + const MetaTextLineAction* pA = (const MetaTextLineAction*)pAction; + break; + } + case META_FLOATTRANSPARENT_ACTION : + { + /** CHECKED, WORKS WELL */ + const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*)pAction; + const Rectangle aTargetRectangle(pA->GetPoint(), pA->GetSize()); + + if(!aTargetRectangle.IsEmpty()) + { + const GDIMetaFile& rContent = pA->GetGDIMetaFile(); + + if(rContent.GetActionCount()) + { + // create the sub-content + drawinglayer::primitive2d::Primitive2DSequence xSubContent; + { + rTargetHolders.Push(); + interpretMetafile(rContent, rTargetHolders, rPropertyHolders, rViewInformation); + xSubContent = rTargetHolders.Current().getPrimitive2DSequence(rPropertyHolders.Current()); + rTargetHolders.Pop(); + } + + if(xSubContent.hasElements()) + { + // check if gradient is a real gradient + const Gradient& rGradient = pA->GetGradient(); + const drawinglayer::attribute::FillGradientAttribute aAttribute(createFillGradientAttribute(rGradient)); + + if(aAttribute.getStartColor() == aAttribute.getEndColor()) + { + // not really a gradient; create UnifiedAlphaPrimitive2D + rTargetHolders.Current().append( + new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + xSubContent, + aAttribute.getStartColor().luminance())); + } + else + { + // really a gradient. Create gradient sub-content (with correct scaling) + basegfx::B2DRange aRange( + aTargetRectangle.Left(), aTargetRectangle.Top(), + aTargetRectangle.Right(), aTargetRectangle.Bottom()); + aRange.transform(rPropertyHolders.Current().getTransformation()); + + // prepare gradient for alpha content + const drawinglayer::primitive2d::Primitive2DReference xAlpha( + new drawinglayer::primitive2d::FillGradientPrimitive2D( + aRange, + aAttribute)); + + // create alpha primitive + rTargetHolders.Current().append( + new drawinglayer::primitive2d::AlphaPrimitive2D( + xSubContent, + drawinglayer::primitive2d::Primitive2DSequence(&xAlpha, 1))); + } + } + } + } + + break; + } + case META_GRADIENTEX_ACTION : + { + /** SIMPLE, DONE */ + // This is only a data holder which is interpreted inside comment actions + // const MetaGradientExAction* pA = (const MetaGradientExAction*)pAction; + break; + } + case META_LAYOUTMODE_ACTION : + { + /** SIMPLE, DONE */ + const MetaLayoutModeAction* pA = (const MetaLayoutModeAction*)pAction; + rPropertyHolders.Current().setLayoutMode(pA->GetLayoutMode()); + break; + } + case META_TEXTLANGUAGE_ACTION : + { + /** SIMPLE, DONE */ + const MetaTextLanguageAction* pA = (const MetaTextLanguageAction*)pAction; + rPropertyHolders.Current().setLanguageType(pA->GetTextLanguage()); + break; + } + case META_OVERLINECOLOR_ACTION : + { + /** SIMPLE, DONE */ + const MetaOverlineColorAction* pA = (const MetaOverlineColorAction*)pAction; + const bool bActive(pA->IsSetting()); + + rPropertyHolders.Current().setOverlineColorActive(bActive); + if(bActive) + rPropertyHolders.Current().setOverlineColor(pA->GetColor().getBColor()); + + break; + } + case META_COMMENT_ACTION : + { + /** NEEDS IMPLEMENTATION */ + OSL_ENSURE(false, "META_COMMENT_ACTION requested (!)"); + const MetaCommentAction* pA = (const MetaCommentAction*)pAction; + break; + } + default: + { + OSL_ENSURE(false, "Unknown MetaFile Action (!)"); + break; + } + } + } + } +} // end of anonymous namespace + +////////////////////////////////////////////////////////////////////////////// + namespace drawinglayer { namespace primitive2d { + Primitive2DSequence MetafilePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + TargetHolders aTargetHolders; + PropertyHolders aPropertyHolders; + + interpretMetafile(getMetaFile(), aTargetHolders, aPropertyHolders, rViewInformation); + Primitive2DSequence xRetval = aTargetHolders.Current().getPrimitive2DSequence(aPropertyHolders.Current()); + + if(xRetval.hasElements()) + { + Rectangle aMtfTarget(getMetaFile().GetPrefMapMode().GetOrigin(), getMetaFile().GetPrefSize()); + + if(MAP_PIXEL == getMetaFile().GetPrefMapMode().GetMapUnit()) + { + aMtfTarget = Application::GetDefaultDevice()->PixelToLogic(aMtfTarget, MAP_100TH_MM); + } + else + { + aMtfTarget = Application::GetDefaultDevice()->LogicToLogic(aMtfTarget, getMetaFile().GetPrefMapMode(), MAP_100TH_MM); + } + + basegfx::B2DHomMatrix aAdaptedTransform; + + aAdaptedTransform.translate(-aMtfTarget.Left(), -aMtfTarget.Top()); + aAdaptedTransform.scale( + aMtfTarget.getWidth() ? 1.0 / aMtfTarget.getWidth() : 1.0, + aMtfTarget.getHeight() ? 1.0 / aMtfTarget.getHeight() : 1.0); + aAdaptedTransform = getTransform() * aAdaptedTransform; + + const Primitive2DReference aEmbeddedTransform( + new TransformPrimitive2D( + aAdaptedTransform, + xRetval)); + + xRetval = Primitive2DSequence(&aEmbeddedTransform, 1); + } + + return xRetval; + } + MetafilePrimitive2D::MetafilePrimitive2D( const basegfx::B2DHomMatrix& rMetaFileTransform, const GDIMetaFile& rMetaFile) - : BasePrimitive2D(), + : BufferedDecompositionPrimitive2D(), maMetaFileTransform(rMetaFileTransform), maMetaFile(rMetaFile) { @@ -61,7 +2542,7 @@ namespace drawinglayer bool MetafilePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { const MetafilePrimitive2D& rCompare = (MetafilePrimitive2D&)rPrimitive; diff --git a/drawinglayer/source/primitive2d/primitivetools2d.cxx b/drawinglayer/source/primitive2d/primitivetools2d.cxx index 30af3a998daf..2b25590bf1f4 100644 --- a/drawinglayer/source/primitive2d/primitivetools2d.cxx +++ b/drawinglayer/source/primitive2d/primitivetools2d.cxx @@ -102,5 +102,77 @@ namespace drawinglayer } // end of namespace primitive2d } // end of namespace drawinglayer +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence ViewTransformationDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + ::osl::MutexGuard aGuard( m_aMutex ); + + // get the current ViewTransformation + const basegfx::B2DHomMatrix& rViewTransformation = rViewInformation.getViewTransformation(); + + if(getBuffered2DDecomposition().hasElements() && rViewTransformation != getViewTransformation()) + { + // conditions of last local decomposition have changed, delete + const_cast< ViewTransformationDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + } + + if(!getBuffered2DDecomposition().hasElements()) + { + // remember new valid ViewTransformation + const_cast< ViewTransformationDependentPrimitive2D* >(this)->maViewTransformation = rViewTransformation; + } + + // call base implementation + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + } + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence ObjectAndViewTransformationDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + ::osl::MutexGuard aGuard( m_aMutex ); + + // get the current ViewTransfromation + const basegfx::B2DHomMatrix& rViewTransformation = rViewInformation.getViewTransformation(); + + if(getBuffered2DDecomposition().hasElements() && rViewTransformation != getViewTransformation()) + { + // conditions of last local decomposition have changed, delete + const_cast< ObjectAndViewTransformationDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + } + + // get the current ObjectTransformation + const basegfx::B2DHomMatrix& rObjectTransformation = rViewInformation.getObjectTransformation(); + + if(getBuffered2DDecomposition().hasElements() && rObjectTransformation != getObjectTransformation()) + { + // conditions of last local decomposition have changed, delete + const_cast< ObjectAndViewTransformationDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + } + + if(!getBuffered2DDecomposition().hasElements()) + { + // remember new valid ViewTransformation, and ObjectTransformation + const_cast< ObjectAndViewTransformationDependentPrimitive2D* >(this)->maViewTransformation = rViewTransformation; + const_cast< ObjectAndViewTransformationDependentPrimitive2D* >(this)->maObjectTransformation = rObjectTransformation; + } + + // call base implementation + return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + } + } // end of namespace primitive2d +} // end of namespace drawinglayer + ////////////////////////////////////////////////////////////////////////////// // eof diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index 49ffab60778a..9403df5376aa 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -48,6 +48,8 @@ #include #include #include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -55,217 +57,6 @@ namespace drawinglayer { namespace primitive2d { - void TextDecoratedPortionPrimitive2D::impCreateTextLine( - std::vector< Primitive2DReference >& rTarget, - basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans, - const basegfx::B2DHomMatrix &rUnscaledTransform, - FontUnderline eLineStyle, - double fLineOffset, - double fLineHeight, - double fLineWidth, - const basegfx::BColor& rLineColor) const - { - bool bDoubleLine(false); - bool bWaveLine(false); - bool bBoldLine(false); - const int* pDotDashArray(0); - basegfx::B2DLineJoin eLineJoin(basegfx::B2DLINEJOIN_NONE); - - static const int aDottedArray[] = { 1, 1, 0}; // DOTTED LINE - static const int aDotDashArray[] = { 1, 1, 4, 1, 0}; // DASHDOT - static const int aDashDotDotArray[] = { 1, 1, 1, 1, 4, 1, 0}; // DASHDOTDOT - static const int aDashedArray[] = { 5, 2, 0}; // DASHED LINE - static const int aLongDashArray[] = { 7, 2, 0}; // LONGDASH - - switch(eLineStyle) - { - default: // case FONT_UNDERLINE_SINGLE: - { - break; - } - case FONT_UNDERLINE_DOUBLE: - { - bDoubleLine = true; - break; - } - case FONT_UNDERLINE_DOTTED: - { - pDotDashArray = aDottedArray; - break; - } - case FONT_UNDERLINE_DASH: - { - pDotDashArray = aDashedArray; - break; - } - case FONT_UNDERLINE_LONGDASH: - { - pDotDashArray = aLongDashArray; - break; - } - case FONT_UNDERLINE_DASHDOT: - { - pDotDashArray = aDotDashArray; - break; - } - case FONT_UNDERLINE_DASHDOTDOT: - { - pDotDashArray = aDashDotDotArray; - break; - } - case FONT_UNDERLINE_SMALLWAVE: - { - bWaveLine = true; - break; - } - case FONT_UNDERLINE_WAVE: - { - bWaveLine = true; - break; - } - case FONT_UNDERLINE_DOUBLEWAVE: - { - bDoubleLine = true; - bWaveLine = true; - break; - } - case FONT_UNDERLINE_BOLD: - { - bBoldLine = true; - break; - } - case FONT_UNDERLINE_BOLDDOTTED: - { - bBoldLine = true; - pDotDashArray = aDottedArray; - break; - } - case FONT_UNDERLINE_BOLDDASH: - { - bBoldLine = true; - pDotDashArray = aDashedArray; - break; - } - case FONT_UNDERLINE_BOLDLONGDASH: - { - bBoldLine = true; - pDotDashArray = aLongDashArray; - break; - } - case FONT_UNDERLINE_BOLDDASHDOT: - { - bBoldLine = true; - pDotDashArray = aDotDashArray; - break; - } - case FONT_UNDERLINE_BOLDDASHDOTDOT: - { - bBoldLine = true; - pDotDashArray = aDashDotDotArray; - break; - } - case FONT_UNDERLINE_BOLDWAVE: - { - bWaveLine = true; - bBoldLine = true; - break; - } - } - - if(bBoldLine) - { - fLineHeight *= 2.0; - } - - if(bDoubleLine) - { - fLineOffset -= 0.50 * fLineHeight; - fLineHeight *= 0.64; - } - - if(bWaveLine) - { - eLineJoin = basegfx::B2DLINEJOIN_ROUND; - fLineHeight *= 0.25; - } - - // prepare Line and Stroke Attributes - const attribute::LineAttribute aLineAttribute(rLineColor, fLineHeight, eLineJoin); - attribute::StrokeAttribute aStrokeAttribute; - - if(pDotDashArray) - { - ::std::vector< double > aDoubleArray; - - for(const int* p = pDotDashArray; *p; ++p) - { - aDoubleArray.push_back((double)(*p) * fLineHeight); - } - - aStrokeAttribute = attribute::StrokeAttribute(aDoubleArray); - } - - // create base polygon and new primitive - basegfx::B2DPolygon aLine; - Primitive2DReference aNewPrimitive; - - aLine.append(basegfx::B2DPoint(0.0, fLineOffset)); - aLine.append(basegfx::B2DPoint(fLineWidth, fLineOffset)); - aLine.transform(rUnscaledTransform); - - if(bWaveLine) - { - double fWaveWidth(10.6 * fLineHeight); - - if(FONT_UNDERLINE_SMALLWAVE == eLineStyle) - { - fWaveWidth *= 0.7; - } - else if(FONT_UNDERLINE_WAVE == eLineStyle) - { - // extra multiply to get the same WaveWidth as with the bold version - fWaveWidth *= 2.0; - } - - aNewPrimitive = Primitive2DReference(new PolygonWavePrimitive2D(aLine, aLineAttribute, aStrokeAttribute, fWaveWidth, fWaveWidth * 0.5)); - } - else - { - aNewPrimitive = Primitive2DReference(new PolygonStrokePrimitive2D(aLine, aLineAttribute, aStrokeAttribute)); - } - - // add primitive - rTarget.push_back(aNewPrimitive); - - if(bDoubleLine) - { - // double line, create 2nd primitive with offset using TransformPrimitive based on - // already created NewPrimitive - double fLineDist(2.3 * fLineHeight); - - if(bWaveLine) - { - fLineDist = 6.3 * fLineHeight; - } - - // move base point of text to 0.0 and de-rotate - basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( - -rDecTrans.getTranslate().getX(), -rDecTrans.getTranslate().getY())); - aTransform.rotate(-rDecTrans.getRotate()); - - // translate in Y by offset - aTransform.translate(0.0, fLineDist); - - // move back and rotate - aTransform.rotate(rDecTrans.getRotate()); - aTransform.translate(rDecTrans.getTranslate().getX(), rDecTrans.getTranslate().getY()); - - // add transform primitive - const Primitive2DSequence aContent(&aNewPrimitive, 1); - rTarget.push_back(Primitive2DReference(new TransformPrimitive2D(aTransform, aContent))); - } - } - void TextDecoratedPortionPrimitive2D::impCreateGeometryContent( std::vector< Primitive2DReference >& rTarget, basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans, @@ -273,7 +64,7 @@ namespace drawinglayer xub_StrLen aTextPosition, xub_StrLen aTextLength, const ::std::vector< double >& rDXArray, - const FontAttributes& rFontAttributes) const + const attribute::FontAttribute& rFontAttribute) const { // create the SimpleTextPrimitive needed in any case rTarget.push_back(Primitive2DReference( @@ -283,13 +74,13 @@ namespace drawinglayer aTextPosition, aTextLength, rDXArray, - rFontAttributes, + rFontAttribute, getLocale(), getFontColor()))); // see if something else needs to be done - const bool bOverlineUsed(FONT_UNDERLINE_NONE != getFontOverline()); - const bool bUnderlineUsed(FONT_UNDERLINE_NONE != getFontUnderline()); + const bool bOverlineUsed(TEXT_LINE_NONE != getFontOverline()); + const bool bUnderlineUsed(TEXT_LINE_NONE != getFontUnderline()); const bool bStrikeoutUsed(FONT_STRIKEOUT_NONE != getFontStrikeout()); if(bUnderlineUsed || bStrikeoutUsed || bOverlineUsed) @@ -303,8 +94,8 @@ namespace drawinglayer // TextLayouterDevice is needed to get metrics for text decorations like // underline/strikeout/emphasis marks from it. For setup, the font size is needed - aTextLayouter.setFontAttributes( - getFontAttributes(), + aTextLayouter.setFontAttribute( + getFontAttribute(), rDecTrans.getScale().getX(), rDecTrans.getScale().getY(), getLocale()); @@ -332,15 +123,27 @@ namespace drawinglayer if(bOverlineUsed) { // create primitive geometry for overline - impCreateTextLine(rTarget, rDecTrans, aUnscaledTransform, getFontOverline(), aTextLayouter.getOverlineOffset(), - aTextLayouter.getOverlineHeight(), fTextWidth, getOverlineColor()); + rTarget.push_back(Primitive2DReference( + new TextLinePrimitive2D( + rDecTrans.getB2DHomMatrix(), + fTextWidth, + aTextLayouter.getOverlineOffset(), + aTextLayouter.getOverlineHeight(), + getFontOverline(), + getOverlineColor()))); } if(bUnderlineUsed) { // create primitive geometry for underline - impCreateTextLine(rTarget, rDecTrans, aUnscaledTransform, getFontUnderline(), aTextLayouter.getUnderlineOffset(), - aTextLayouter.getUnderlineHeight(), fTextWidth, getTextlineColor()); + rTarget.push_back(Primitive2DReference( + new TextLinePrimitive2D( + rDecTrans.getB2DHomMatrix(), + fTextWidth, + aTextLayouter.getUnderlineOffset(), + aTextLayouter.getUnderlineHeight(), + getFontUnderline(), + getTextlineColor()))); } if(bStrikeoutUsed) @@ -350,97 +153,27 @@ namespace drawinglayer { // strikeout with character const sal_Unicode aStrikeoutChar(FONT_STRIKEOUT_SLASH == getFontStrikeout() ? '/' : 'X'); - const String aSingleCharString(aStrikeoutChar); - const double fStrikeCharWidth(aTextLayouter.getTextWidth(aSingleCharString, 0, 1)); - const double fStrikeCharCount(fabs(fTextWidth/fStrikeCharWidth)); - const sal_uInt32 nStrikeCharCount(static_cast< sal_uInt32 >(fStrikeCharCount + 0.5)); - std::vector aDXArray(nStrikeCharCount); - String aStrikeoutString; - - for(sal_uInt32 a(0); a < nStrikeCharCount; a++) - { - aStrikeoutString += aSingleCharString; - aDXArray[a] = (a + 1) * fStrikeCharWidth; - } rTarget.push_back(Primitive2DReference( - new TextSimplePortionPrimitive2D( + new TextCharacterStrikeoutPrimitive2D( rDecTrans.getB2DHomMatrix(), - aStrikeoutString, - 0, - aStrikeoutString.Len(), - aDXArray, - rFontAttributes, - getLocale(), - getFontColor()))); + fTextWidth, + getFontColor(), + aStrikeoutChar, + getFontAttribute(), + getLocale()))); } else { // strikeout with geometry - double fStrikeoutHeight(aTextLayouter.getUnderlineHeight()); - double fStrikeoutOffset(aTextLayouter.getStrikeoutOffset()); - bool bDoubleLine(false); - - // set line attribute - switch(getFontStrikeout()) - { - default : // case primitive2d::FONT_STRIKEOUT_SINGLE: - { - break; - } - case primitive2d::FONT_STRIKEOUT_DOUBLE: - { - bDoubleLine = true; - break; - } - case primitive2d::FONT_STRIKEOUT_BOLD: - { - fStrikeoutHeight *= 2.0; - break; - } - } - - if(bDoubleLine) - { - fStrikeoutOffset -= 0.50 * fStrikeoutHeight; - fStrikeoutHeight *= 0.64; - } - - // create base polygon and new primitive - basegfx::B2DPolygon aStrikeoutLine; - - aStrikeoutLine.append(basegfx::B2DPoint(0.0, -fStrikeoutOffset)); - aStrikeoutLine.append(basegfx::B2DPoint(fTextWidth, -fStrikeoutOffset)); - aStrikeoutLine.transform(aUnscaledTransform); - - const attribute::LineAttribute aLineAttribute(getFontColor(), fStrikeoutHeight, basegfx::B2DLINEJOIN_NONE); - Primitive2DReference aNewPrimitive(new PolygonStrokePrimitive2D(aStrikeoutLine, aLineAttribute)); - - // add primitive - rTarget.push_back(aNewPrimitive); - - if(bDoubleLine) - { - // double line, create 2nd primitive with offset using TransformPrimitive based on - // already created NewPrimitive - const double fLineDist(2.0 * fStrikeoutHeight); - - // move base point of text to 0.0 and de-rotate - basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( - -rDecTrans.getTranslate().getX(), -rDecTrans.getTranslate().getY())); - aTransform.rotate(-rDecTrans.getRotate()); - - // translate in Y by offset - aTransform.translate(0.0, -fLineDist); - - // move back and rotate - aTransform.rotate(rDecTrans.getRotate()); - aTransform.translate(rDecTrans.getTranslate().getX(), rDecTrans.getTranslate().getY()); - - // add transform primitive - const Primitive2DSequence aContent(&aNewPrimitive, 1); - rTarget.push_back(Primitive2DReference(new TransformPrimitive2D(aTransform, aContent))); - } + rTarget.push_back(Primitive2DReference( + new TextGeometryStrikeoutPrimitive2D( + rDecTrans.getB2DHomMatrix(), + fTextWidth, + getFontColor(), + aTextLayouter.getUnderlineHeight(), + aTextLayouter.getStrikeoutOffset(), + getFontStrikeout()))); } } } @@ -507,21 +240,21 @@ namespace drawinglayer impCorrectTextBoundary(aNextWordBoundary); // prepare new font attributes WITHOUT outline - const FontAttributes aNewFontAttributes( - getFontAttributes().getFamilyName(), - getFontAttributes().getStyleName(), - getFontAttributes().getWeight(), - getFontAttributes().getSymbol(), - getFontAttributes().getVertical(), - getFontAttributes().getItalic(), + const attribute::FontAttribute aNewFontAttribute( + getFontAttribute().getFamilyName(), + getFontAttribute().getStyleName(), + getFontAttribute().getWeight(), + getFontAttribute().getSymbol(), + getFontAttribute().getVertical(), + getFontAttribute().getItalic(), false, // no outline anymore, handled locally - getFontAttributes().getRTL(), - getFontAttributes().getBiDiStrong()); + getFontAttribute().getRTL(), + getFontAttribute().getBiDiStrong()); if(aNextWordBoundary.startPos == getTextPosition() && aNextWordBoundary.endPos == getTextLength()) { // it IS only a single word, handle as one word - impCreateGeometryContent(rTarget, rDecTrans, getText(), getTextPosition(), getTextLength(), getDXArray(), aNewFontAttributes); + impCreateGeometryContent(rTarget, rDecTrans, getText(), getTextPosition(), getTextLength(), getDXArray(), aNewFontAttribute); } else { @@ -532,8 +265,8 @@ namespace drawinglayer if(bNoDXArray) { // ..but only completely when no DXArray - aTextLayouter.setFontAttributes( - getFontAttributes(), + aTextLayouter.setFontAttribute( + getFontAttribute(), rDecTrans.getScale().getX(), rDecTrans.getScale().getY(), getLocale()); @@ -612,7 +345,7 @@ namespace drawinglayer basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose aDecTrans(aNewTransform); impCreateGeometryContent(rTarget, aDecTrans, getText(), nNewTextStart, - nNewTextEnd - nNewTextStart, aNewDXArray, aNewFontAttributes); + nNewTextEnd - nNewTextStart, aNewDXArray, aNewFontAttribute); if(aNextWordBoundary.endPos >= getTextPosition() + getTextLength()) { @@ -659,19 +392,19 @@ namespace drawinglayer else { // prepare new font attributes WITHOUT outline - const FontAttributes aNewFontAttributes( - getFontAttributes().getFamilyName(), - getFontAttributes().getStyleName(), - getFontAttributes().getWeight(), - getFontAttributes().getSymbol(), - getFontAttributes().getVertical(), - getFontAttributes().getItalic(), + const attribute::FontAttribute aNewFontAttribute( + getFontAttribute().getFamilyName(), + getFontAttribute().getStyleName(), + getFontAttribute().getWeight(), + getFontAttribute().getSymbol(), + getFontAttribute().getVertical(), + getFontAttribute().getItalic(), false, // no outline anymore, handled locally - getFontAttributes().getRTL(), - getFontAttributes().getBiDiStrong()); + getFontAttribute().getRTL(), + getFontAttribute().getBiDiStrong()); // handle as one word - impCreateGeometryContent(aNewPrimitives, aDecTrans, getText(), getTextPosition(), getTextLength(), getDXArray(), aNewFontAttributes); + impCreateGeometryContent(aNewPrimitives, aDecTrans, getText(), getTextPosition(), getTextLength(), getDXArray(), aNewFontAttribute); } // convert to Primitive2DSequence @@ -693,7 +426,7 @@ namespace drawinglayer // outline AND shadow depend on NO FontRelief (see dialog) const bool bHasFontRelief(FONT_RELIEF_NONE != getFontRelief()); const bool bHasShadow(!bHasFontRelief && getShadow()); - const bool bHasOutline(!bHasFontRelief && getFontAttributes().getOutline()); + const bool bHasOutline(!bHasFontRelief && getFontAttribute().getOutline()); if(bHasShadow || bHasFontRelief || bHasOutline) { @@ -792,15 +525,15 @@ namespace drawinglayer xub_StrLen aTextPosition, xub_StrLen aTextLength, const ::std::vector< double >& rDXArray, - const FontAttributes& rFontAttributes, + const attribute::FontAttribute& rFontAttribute, const ::com::sun::star::lang::Locale& rLocale, const basegfx::BColor& rFontColor, // local parameters const basegfx::BColor& rOverlineColor, const basegfx::BColor& rTextlineColor, - FontUnderline eFontOverline, - FontUnderline eFontUnderline, + TextLine eFontOverline, + TextLine eFontUnderline, bool bUnderlineAbove, FontStrikeout eFontStrikeout, bool bWordLineMode, @@ -809,7 +542,7 @@ namespace drawinglayer bool bEmphasisMarkBelow, FontRelief eFontRelief, bool bShadow) - : TextSimplePortionPrimitive2D(rNewTransform, rText, aTextPosition, aTextLength, rDXArray, rFontAttributes, rLocale, rFontColor), + : TextSimplePortionPrimitive2D(rNewTransform, rText, aTextPosition, aTextLength, rDXArray, rFontAttribute, rLocale, rFontColor), maOverlineColor(rOverlineColor), maTextlineColor(rTextlineColor), meFontOverline(eFontOverline), @@ -854,8 +587,8 @@ namespace drawinglayer basegfx::B2DRange TextDecoratedPortionPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { const bool bDecoratedIsNeeded( - FONT_UNDERLINE_NONE != getFontOverline() - || FONT_UNDERLINE_NONE != getFontUnderline() + TEXT_LINE_NONE != getFontOverline() + || TEXT_LINE_NONE != getFontUnderline() || FONT_STRIKEOUT_NONE != getFontStrikeout() || FONT_EMPHASISMARK_NONE != getFontEmphasisMark() || FONT_RELIEF_NONE != getFontRelief() diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index e321783c8406..f24398a1a6ac 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -167,14 +167,14 @@ namespace drawinglayer mrDevice.SetFont( rFont ); } - void TextLayouterDevice::setFontAttributes( - const FontAttributes& rFontAttributes, + void TextLayouterDevice::setFontAttribute( + const attribute::FontAttribute& rFontAttribute, double fFontScaleX, double fFontScaleY, const ::com::sun::star::lang::Locale& rLocale) { - setFont(getVclFontFromFontAttributes( - rFontAttributes, + setFont(getVclFontFromFontAttribute( + rFontAttribute, fFontScaleX, fFontScaleY, 0.0, @@ -297,6 +297,18 @@ namespace drawinglayer return basegfx::B2DRange(); } + + double TextLayouterDevice::getFontAscent() const + { + const ::FontMetric& rMetric = mrDevice.GetFontMetric(); + return rMetric.GetAscent(); + } + + double TextLayouterDevice::getFontDescent() const + { + const ::FontMetric& rMetric = mrDevice.GetFontMetric(); + return rMetric.GetDescent(); + } } // end of namespace primitive2d } // end of namespace drawinglayer @@ -307,8 +319,8 @@ namespace drawinglayer { namespace primitive2d { - Font getVclFontFromFontAttributes( - const FontAttributes& rFontAttributes, + Font getVclFontFromFontAttribute( + const attribute::FontAttribute& rFontAttribute, double fFontScaleX, double fFontScaleY, double fFontRotation, @@ -324,8 +336,8 @@ namespace drawinglayer // is wanted, that width needs to be adapted using FontMetric again to get a // width of the unscaled font Font aRetval( - rFontAttributes.getFamilyName(), - rFontAttributes.getStyleName(), + rFontAttribute.getFamilyName(), + rFontAttribute.getStyleName(), Size(0, nHeight)); #else // for non-WIN32 systems things are easier since these accept a Font creation @@ -334,17 +346,17 @@ namespace drawinglayer // Font would be recorded in a MetaFile (The MetaFile FontAction WILL record a // set FontWidth; import that in a WIN32 system, and trouble is there) Font aRetval( - rFontAttributes.getFamilyName(), - rFontAttributes.getStyleName(), + rFontAttribute.getFamilyName(), + rFontAttribute.getStyleName(), Size(bFontIsScaled ? nWidth : 0, nHeight)); #endif - // define various other FontAttributes + // define various other FontAttribute aRetval.SetAlign(ALIGN_BASELINE); - aRetval.SetCharSet(rFontAttributes.getSymbol() ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE); - aRetval.SetVertical(rFontAttributes.getVertical() ? TRUE : FALSE); - aRetval.SetWeight(static_cast(rFontAttributes.getWeight())); - aRetval.SetItalic(rFontAttributes.getItalic() ? ITALIC_NORMAL : ITALIC_NONE); - aRetval.SetOutline(rFontAttributes.getOutline()); + aRetval.SetCharSet(rFontAttribute.getSymbol() ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE); + aRetval.SetVertical(rFontAttribute.getVertical() ? TRUE : FALSE); + aRetval.SetWeight(static_cast(rFontAttribute.getWeight())); + aRetval.SetItalic(rFontAttribute.getItalic() ? ITALIC_NORMAL : ITALIC_NONE); + aRetval.SetOutline(rFontAttribute.getOutline()); aRetval.SetLanguage(MsLangId::convertLocaleToLanguage(rLocale)); #ifdef WIN32 @@ -371,13 +383,13 @@ namespace drawinglayer return aRetval; } - FontAttributes getFontAttributesFromVclFont( + attribute::FontAttribute getFontAttributeFromVclFont( basegfx::B2DVector& o_rSize, const Font& rFont, bool bRTL, bool bBiDiStrong) { - const FontAttributes aRetval( + const attribute::FontAttribute aRetval( rFont.GetName(), rFont.GetStyleName(), static_cast(rFont.GetWeight()), diff --git a/drawinglayer/source/primitive2d/textlineprimitive2d.cxx b/drawinglayer/source/primitive2d/textlineprimitive2d.cxx new file mode 100644 index 000000000000..45b2809be2ce --- /dev/null +++ b/drawinglayer/source/primitive2d/textlineprimitive2d.cxx @@ -0,0 +1,317 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textdecoratedprimitive2d.cxx,v $ + * + * $Revision: 1.12 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence TextLinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + Primitive2DSequence xRetval; + + if(TEXT_LINE_NONE != getTextLine()) + { + bool bDoubleLine(false); + bool bWaveLine(false); + bool bBoldLine(false); + const int* pDotDashArray(0); + basegfx::B2DLineJoin eLineJoin(basegfx::B2DLINEJOIN_NONE); + double fOffset(getOffset()); + double fHeight(getHeight()); + + static const int aDottedArray[] = { 1, 1, 0}; // DOTTED LINE + static const int aDotDashArray[] = { 1, 1, 4, 1, 0}; // DASHDOT + static const int aDashDotDotArray[] = { 1, 1, 1, 1, 4, 1, 0}; // DASHDOTDOT + static const int aDashedArray[] = { 5, 2, 0}; // DASHED LINE + static const int aLongDashArray[] = { 7, 2, 0}; // LONGDASH + + // get decomposition + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + getObjectTransformation().decompose(aScale, aTranslate, fRotate, fShearX); + + switch(getTextLine()) + { + default: // case TEXT_LINE_SINGLE: + { + break; + } + case TEXT_LINE_DOUBLE: + { + bDoubleLine = true; + break; + } + case TEXT_LINE_DOTTED: + { + pDotDashArray = aDottedArray; + break; + } + case TEXT_LINE_DASH: + { + pDotDashArray = aDashedArray; + break; + } + case TEXT_LINE_LONGDASH: + { + pDotDashArray = aLongDashArray; + break; + } + case TEXT_LINE_DASHDOT: + { + pDotDashArray = aDotDashArray; + break; + } + case TEXT_LINE_DASHDOTDOT: + { + pDotDashArray = aDashDotDotArray; + break; + } + case TEXT_LINE_SMALLWAVE: + { + bWaveLine = true; + break; + } + case TEXT_LINE_WAVE: + { + bWaveLine = true; + break; + } + case TEXT_LINE_DOUBLEWAVE: + { + bDoubleLine = true; + bWaveLine = true; + break; + } + case TEXT_LINE_BOLD: + { + bBoldLine = true; + break; + } + case TEXT_LINE_BOLDDOTTED: + { + bBoldLine = true; + pDotDashArray = aDottedArray; + break; + } + case TEXT_LINE_BOLDDASH: + { + bBoldLine = true; + pDotDashArray = aDashedArray; + break; + } + case TEXT_LINE_BOLDLONGDASH: + { + bBoldLine = true; + pDotDashArray = aLongDashArray; + break; + } + case TEXT_LINE_BOLDDASHDOT: + { + bBoldLine = true; + pDotDashArray = aDotDashArray; + break; + } + case TEXT_LINE_BOLDDASHDOTDOT: + { + bBoldLine = true; + pDotDashArray = aDashDotDotArray; + break; + } + case TEXT_LINE_BOLDWAVE: + { + bWaveLine = true; + bBoldLine = true; + break; + } + } + + if(bBoldLine) + { + fHeight *= 2.0; + } + + if(bDoubleLine) + { + fOffset -= 0.50 * fHeight; + fHeight *= 0.64; + } + + if(bWaveLine) + { + eLineJoin = basegfx::B2DLINEJOIN_ROUND; + fHeight *= 0.25; + } + + // prepare Line and Stroke Attributes + const attribute::LineAttribute aLineAttribute(getLineColor(), fHeight, eLineJoin); + attribute::StrokeAttribute aStrokeAttribute; + + if(pDotDashArray) + { + ::std::vector< double > aDoubleArray; + + for(const int* p = pDotDashArray; *p; ++p) + { + aDoubleArray.push_back((double)(*p) * fHeight); + } + + aStrokeAttribute = attribute::StrokeAttribute(aDoubleArray); + } + + // create base polygon and new primitive + basegfx::B2DPolygon aLine; + Primitive2DReference aNewPrimitive; + + aLine.append(basegfx::B2DPoint(0.0, fOffset)); + aLine.append(basegfx::B2DPoint(getWidth(), fOffset)); + + const basegfx::B2DHomMatrix aUnscaledTransform( + basegfx::tools::createShearXRotateTranslateB2DHomMatrix( + fShearX, fRotate, aTranslate)); + + aLine.transform(aUnscaledTransform); + + if(bWaveLine) + { + double fWaveWidth(10.6 * fHeight); + + if(TEXT_LINE_SMALLWAVE == getTextLine()) + { + fWaveWidth *= 0.7; + } + else if(TEXT_LINE_WAVE == getTextLine()) + { + // extra multiply to get the same WaveWidth as with the bold version + fWaveWidth *= 2.0; + } + + aNewPrimitive = Primitive2DReference(new PolygonWavePrimitive2D(aLine, aLineAttribute, aStrokeAttribute, fWaveWidth, fWaveWidth * 0.5)); + } + else + { + aNewPrimitive = Primitive2DReference(new PolygonStrokePrimitive2D(aLine, aLineAttribute, aStrokeAttribute)); + } + + // add primitive + appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, aNewPrimitive); + + if(bDoubleLine) + { + // double line, create 2nd primitive with offset using TransformPrimitive based on + // already created NewPrimitive + double fLineDist(2.3 * fHeight); + + if(bWaveLine) + { + fLineDist = 6.3 * fHeight; + } + + // move base point of text to 0.0 and de-rotate + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( + -aTranslate.getX(), -aTranslate.getY())); + aTransform.rotate(-fRotate); + + // translate in Y by offset + aTransform.translate(0.0, fLineDist); + + // move back and rotate + aTransform.rotate(fRotate); + aTransform.translate(aTranslate.getX(), aTranslate.getY()); + + // add transform primitive + const Primitive2DSequence aContent(&aNewPrimitive, 1); + appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + Primitive2DReference(new TransformPrimitive2D(aTransform, aContent))); + } + } + + return xRetval; + } + + TextLinePrimitive2D::TextLinePrimitive2D( + const basegfx::B2DHomMatrix& rObjectTransformation, + double fWidth, + double fOffset, + double fHeight, + TextLine eTextLine, + const basegfx::BColor& rLineColor) + : BufferedDecompositionPrimitive2D(), + maObjectTransformation(rObjectTransformation), + mfWidth(fWidth), + mfOffset(fOffset), + mfHeight(fHeight), + meTextLine(eTextLine), + maLineColor(rLineColor) + { + } + + bool TextLinePrimitive2D::operator==( const BasePrimitive2D& rPrimitive ) const + { + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) + { + const TextLinePrimitive2D& rCompare = (TextLinePrimitive2D&)rPrimitive; + + return (getObjectTransformation() == rCompare.getObjectTransformation() + && getWidth() == rCompare.getWidth() + && getOffset() == rCompare.getOffset() + && getHeight() == rCompare.getHeight() + && getTextLine() == rCompare.getTextLine() + && getLineColor() == rCompare.getLineColor()); + } + + return false; + } + + // provide unique ID + ImplPrimitrive2DIDBlock(TextLinePrimitive2D, PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index 6caafd1911ce..61a0c6d15897 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -50,27 +50,6 @@ using namespace com::sun::star; ////////////////////////////////////////////////////////////////////////////// -namespace drawinglayer -{ - namespace primitive2d - { - bool FontAttributes::operator==(const FontAttributes& rCompare) const - { - return (getFamilyName() == rCompare.getFamilyName() - && getStyleName() == rCompare.getStyleName() - && getWeight() == rCompare.getWeight() - && getSymbol() == rCompare.getSymbol() - && getVertical() == rCompare.getVertical() - && getItalic() == rCompare.getItalic() - && getOutline() == rCompare.getOutline() - && getRTL() == rCompare.getRTL() - && getBiDiStrong() == rCompare.getBiDiStrong()); - } - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - namespace { // adapts fontScale for usage with TextLayouter. Input is rScale which is the extracted @@ -156,8 +135,8 @@ namespace drawinglayer // prepare textlayoutdevice TextLayouterDevice aTextLayouter; - aTextLayouter.setFontAttributes( - getFontAttributes(), + aTextLayouter.setFontAttribute( + getFontAttribute(), aFontScale.getX(), aFontScale.getY(), getLocale()); @@ -236,7 +215,7 @@ namespace drawinglayer aRetval[a] = new PolyPolygonColorPrimitive2D(rPolyPolygon, getFontColor()); } - if(getFontAttributes().getOutline()) + if(getFontAttribute().getOutline()) { // decompose polygon transformation to single values basegfx::B2DVector aScale, aTranslate; @@ -264,7 +243,7 @@ namespace drawinglayer xub_StrLen aTextPosition, xub_StrLen aTextLength, const ::std::vector< double >& rDXArray, - const FontAttributes& rFontAttributes, + const attribute::FontAttribute& rFontAttribute, const ::com::sun::star::lang::Locale& rLocale, const basegfx::BColor& rFontColor) : BufferedDecompositionPrimitive2D(), @@ -273,7 +252,7 @@ namespace drawinglayer maTextPosition(aTextPosition), maTextLength(aTextLength), maDXArray(rDXArray), - maFontAttributes(rFontAttributes), + maFontAttribute(rFontAttribute), maLocale(rLocale), maFontColor(rFontColor), maB2DRange() @@ -285,7 +264,7 @@ namespace drawinglayer #endif } - bool impLocalesAreEqual(const ::com::sun::star::lang::Locale& rA, const ::com::sun::star::lang::Locale& rB) + bool LocalesAreEqual(const ::com::sun::star::lang::Locale& rA, const ::com::sun::star::lang::Locale& rB) { return (rA.Language == rB.Language && rA.Country == rB.Country @@ -303,8 +282,8 @@ namespace drawinglayer && getTextPosition() == rCompare.getTextPosition() && getTextLength() == rCompare.getTextLength() && getDXArray() == rCompare.getDXArray() - && getFontAttributes() == rCompare.getFontAttributes() - && impLocalesAreEqual(getLocale(), rCompare.getLocale()) + && getFontAttribute() == rCompare.getFontAttribute() + && LocalesAreEqual(getLocale(), rCompare.getLocale()) && getFontColor() == rCompare.getFontColor()); } @@ -330,8 +309,8 @@ namespace drawinglayer // prepare textlayoutdevice TextLayouterDevice aTextLayouter; - aTextLayouter.setFontAttributes( - getFontAttributes(), + aTextLayouter.setFontAttribute( + getFontAttribute(), aFontScale.getX(), aFontScale.getY(), getLocale()); diff --git a/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx b/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx new file mode 100644 index 000000000000..8b7d664dd62a --- /dev/null +++ b/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx @@ -0,0 +1,294 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textdecoratedprimitive2d.cxx,v $ + * + * $Revision: 1.12 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + BaseTextStrikeoutPrimitive2D::BaseTextStrikeoutPrimitive2D( + const basegfx::B2DHomMatrix& rObjectTransformation, + double fWidth, + const basegfx::BColor& rFontColor) + : BufferedDecompositionPrimitive2D(), + maObjectTransformation(rObjectTransformation), + mfWidth(fWidth), + maFontColor(rFontColor) + { + } + + bool BaseTextStrikeoutPrimitive2D::operator==( const BasePrimitive2D& rPrimitive ) const + { + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) + { + const BaseTextStrikeoutPrimitive2D& rCompare = (BaseTextStrikeoutPrimitive2D&)rPrimitive; + + return (getObjectTransformation() == rCompare.getObjectTransformation() + && getWidth() == rCompare.getWidth() + && getFontColor() == rCompare.getFontColor()); + } + + return false; + } + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence TextCharacterStrikeoutPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + // strikeout with character + const String aSingleCharString(getStrikeoutChar()); + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + + // get decomposition + getObjectTransformation().decompose(aScale, aTranslate, fRotate, fShearX); + + // prepare TextLayouter + TextLayouterDevice aTextLayouter; + + aTextLayouter.setFontAttribute( + getFontAttribute(), + aScale.getX(), + aScale.getY(), + getLocale()); + + const double fStrikeCharWidth(aTextLayouter.getTextWidth(aSingleCharString, 0, 1)); + const double fStrikeCharCount(fabs(getWidth()/fStrikeCharWidth)); + const sal_uInt32 nStrikeCharCount(static_cast< sal_uInt32 >(fStrikeCharCount + 0.5)); + std::vector aDXArray(nStrikeCharCount); + String aStrikeoutString; + + for(sal_uInt32 a(0); a < nStrikeCharCount; a++) + { + aStrikeoutString += aSingleCharString; + aDXArray[a] = (a + 1) * fStrikeCharWidth; + } + + Primitive2DReference xReference( + new TextSimplePortionPrimitive2D( + getObjectTransformation(), + aStrikeoutString, + 0, + aStrikeoutString.Len(), + aDXArray, + getFontAttribute(), + getLocale(), + getFontColor())); + + return Primitive2DSequence(&xReference, 1); + } + + TextCharacterStrikeoutPrimitive2D::TextCharacterStrikeoutPrimitive2D( + const basegfx::B2DHomMatrix& rObjectTransformation, + double fWidth, + const basegfx::BColor& rFontColor, + sal_Unicode aStrikeoutChar, + const attribute::FontAttribute& rFontAttribute, + const ::com::sun::star::lang::Locale& rLocale) + : BaseTextStrikeoutPrimitive2D(rObjectTransformation, fWidth, rFontColor), + maStrikeoutChar(aStrikeoutChar), + maFontAttribute(rFontAttribute), + maLocale(rLocale) + { + } + + bool TextCharacterStrikeoutPrimitive2D::operator==( const BasePrimitive2D& rPrimitive ) const + { + if(BaseTextStrikeoutPrimitive2D::operator==(rPrimitive)) + { + const TextCharacterStrikeoutPrimitive2D& rCompare = (TextCharacterStrikeoutPrimitive2D&)rPrimitive; + + return (getStrikeoutChar() == rCompare.getStrikeoutChar() + && getFontAttribute() == rCompare.getFontAttribute() + && LocalesAreEqual(getLocale(), rCompare.getLocale())); + } + + return false; + } + + // provide unique ID + ImplPrimitrive2DIDBlock(TextCharacterStrikeoutPrimitive2D, PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence TextGeometryStrikeoutPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + OSL_ENSURE(FONT_STRIKEOUT_SLASH != getFontStrikeout() && FONT_STRIKEOUT_X != getFontStrikeout(), + "Wrong FONT_STRIKEOUT type; a TextCharacterStrikeoutPrimitive2D should be used (!)"); + + // strikeout with geometry + double fStrikeoutHeight(getHeight()); + double fStrikeoutOffset(getOffset()); + bool bDoubleLine(false); + + // get decomposition + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + getObjectTransformation().decompose(aScale, aTranslate, fRotate, fShearX); + + // set line attribute + switch(getFontStrikeout()) + { + default : // case primitive2d::FONT_STRIKEOUT_SINGLE: + { + break; + } + case primitive2d::FONT_STRIKEOUT_DOUBLE: + { + bDoubleLine = true; + break; + } + case primitive2d::FONT_STRIKEOUT_BOLD: + { + fStrikeoutHeight *= 2.0; + break; + } + } + + if(bDoubleLine) + { + fStrikeoutOffset -= 0.50 * fStrikeoutHeight; + fStrikeoutHeight *= 0.64; + } + + // create base polygon and new primitive + basegfx::B2DPolygon aStrikeoutLine; + + aStrikeoutLine.append(basegfx::B2DPoint(0.0, -fStrikeoutOffset)); + aStrikeoutLine.append(basegfx::B2DPoint(getWidth(), -fStrikeoutOffset)); + + const basegfx::B2DHomMatrix aUnscaledTransform( + basegfx::tools::createShearXRotateTranslateB2DHomMatrix( + fShearX, fRotate, aTranslate)); + + aStrikeoutLine.transform(aUnscaledTransform); + + // add primitive + const attribute::LineAttribute aLineAttribute(getFontColor(), fStrikeoutHeight, basegfx::B2DLINEJOIN_NONE); + Primitive2DSequence xRetval(1); + xRetval[0] = Primitive2DReference(new PolygonStrokePrimitive2D(aStrikeoutLine, aLineAttribute)); + + if(bDoubleLine) + { + // double line, create 2nd primitive with offset using TransformPrimitive based on + // already created NewPrimitive + const double fLineDist(2.0 * fStrikeoutHeight); + + // move base point of text to 0.0 and de-rotate + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( + -aTranslate.getX(), -aTranslate.getY())); + aTransform.rotate(-fRotate); + + // translate in Y by offset + aTransform.translate(0.0, -fLineDist); + + // move back and rotate + aTransform.rotate(fRotate); + aTransform.translate(aTranslate.getX(), aTranslate.getY()); + + // add transform primitive + appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + Primitive2DReference( + new TransformPrimitive2D( + aTransform, + xRetval))); + } + + return xRetval; + } + + TextGeometryStrikeoutPrimitive2D::TextGeometryStrikeoutPrimitive2D( + const basegfx::B2DHomMatrix& rObjectTransformation, + double fWidth, + const basegfx::BColor& rFontColor, + double fHeight, + double fOffset, + FontStrikeout eFontStrikeout) + : BaseTextStrikeoutPrimitive2D(rObjectTransformation, fWidth, rFontColor), + mfHeight(fHeight), + mfOffset(fOffset), + meFontStrikeout(eFontStrikeout) + { + } + + bool TextGeometryStrikeoutPrimitive2D::operator==( const BasePrimitive2D& rPrimitive ) const + { + if(BaseTextStrikeoutPrimitive2D::operator==(rPrimitive)) + { + const TextGeometryStrikeoutPrimitive2D& rCompare = (TextGeometryStrikeoutPrimitive2D&)rPrimitive; + + return (getHeight() == rCompare.getHeight() + && getOffset() == rCompare.getOffset() + && getFontStrikeout() == rCompare.getFontStrikeout()); + } + + return false; + } + + // provide unique ID + ImplPrimitrive2DIDBlock(TextGeometryStrikeoutPrimitive2D, PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx new file mode 100644 index 000000000000..621b0b25ad98 --- /dev/null +++ b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx @@ -0,0 +1,276 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: bitmapprimitive2d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence WallpaperBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + Primitive2DSequence aRetval; + + if(!getLocalObjectRange().isEmpty() && !getBitmapEx().IsEmpty()) + { + // get bitmap PIXEL size + const Size& rPixelSize = getBitmapEx().GetSizePixel(); + + if(rPixelSize.Width() > 0 && rPixelSize.Height() > 0) + { + if(WALLPAPER_SCALE == getWallpaperStyle()) + { + // shortcut for scale; use simple BitmapPrimitive2D + basegfx::B2DHomMatrix aObjectTransform; + + aObjectTransform.set(0, 0, getLocalObjectRange().getWidth()); + aObjectTransform.set(1, 1, getLocalObjectRange().getHeight()); + aObjectTransform.set(0, 2, getLocalObjectRange().getMinX()); + aObjectTransform.set(1, 2, getLocalObjectRange().getMinY()); + + Primitive2DReference xReference( + new BitmapPrimitive2D( + getBitmapEx(), + aObjectTransform)); + + aRetval = Primitive2DSequence(&xReference, 1); + } + else + { + // transform to logic size + basegfx::B2DHomMatrix aInverseViewTransformation(getViewTransformation()); + aInverseViewTransformation.invert(); + basegfx::B2DVector aLogicSize(rPixelSize.Width(), rPixelSize.Height()); + aLogicSize = aInverseViewTransformation * aLogicSize; + + // apply laout + basegfx::B2DPoint aTargetTopLeft(getLocalObjectRange().getMinimum()); + bool bUseTargetTopLeft(true); + bool bNeedsClipping(false); + + switch(getWallpaperStyle()) + { + default: //case WALLPAPER_TILE :, also WALLPAPER_NULL and WALLPAPER_APPLICATIONGRADIENT + { + bUseTargetTopLeft = false; + break; + } + case WALLPAPER_SCALE : + { + // handled by shortcut above + break; + } + case WALLPAPER_TOPLEFT : + { + // nothing to do + break; + } + case WALLPAPER_TOP : + { + const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter()); + aTargetTopLeft.setX(aCenter.getX() - (aLogicSize.getX() * 0.5)); + break; + } + case WALLPAPER_TOPRIGHT : + { + aTargetTopLeft.setX(getLocalObjectRange().getMaxX() - aLogicSize.getX()); + break; + } + case WALLPAPER_LEFT : + { + const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter()); + aTargetTopLeft.setY(aCenter.getY() - (aLogicSize.getY() * 0.5)); + break; + } + case WALLPAPER_CENTER : + { + const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter()); + aTargetTopLeft = aCenter - (aLogicSize * 0.5); + break; + } + case WALLPAPER_RIGHT : + { + const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter()); + aTargetTopLeft.setX(getLocalObjectRange().getMaxX() - aLogicSize.getX()); + aTargetTopLeft.setY(aCenter.getY() - (aLogicSize.getY() * 0.5)); + break; + } + case WALLPAPER_BOTTOMLEFT : + { + aTargetTopLeft.setY(getLocalObjectRange().getMaxY() - aLogicSize.getY()); + break; + } + case WALLPAPER_BOTTOM : + { + const basegfx::B2DPoint aCenter(getLocalObjectRange().getCenter()); + aTargetTopLeft.setX(aCenter.getX() - (aLogicSize.getX() * 0.5)); + aTargetTopLeft.setY(getLocalObjectRange().getMaxY() - aLogicSize.getY()); + break; + } + case WALLPAPER_BOTTOMRIGHT : + { + aTargetTopLeft = getLocalObjectRange().getMaximum() - aLogicSize; + break; + } + } + + if(bUseTargetTopLeft) + { + // fill target range + const basegfx::B2DRange aTargetRange(aTargetTopLeft, aTargetTopLeft + aLogicSize); + + // create aligned, single BitmapPrimitive2D + basegfx::B2DHomMatrix aObjectTransform; + + aObjectTransform.set(0, 0, aTargetRange.getWidth()); + aObjectTransform.set(1, 1, aTargetRange.getHeight()); + aObjectTransform.set(0, 2, aTargetRange.getMinX()); + aObjectTransform.set(1, 2, aTargetRange.getMinY()); + + Primitive2DReference xReference( + new BitmapPrimitive2D( + getBitmapEx(), + aObjectTransform)); + aRetval = Primitive2DSequence(&xReference, 1); + + // clip when not completely inside object range + bNeedsClipping = !getLocalObjectRange().isInside(aTargetRange); + } + else + { + // WALLPAPER_TILE, WALLPAPER_NULL, WALLPAPER_APPLICATIONGRADIENT + // convert to relative positions + const basegfx::B2DVector aRelativeSize( + aLogicSize.getX() / (getLocalObjectRange().getWidth() ? getLocalObjectRange().getWidth() : 1.0), + aLogicSize.getY() / (getLocalObjectRange().getHeight() ? getLocalObjectRange().getHeight() : 1.0)); + basegfx::B2DPoint aRelativeTopLeft(0.0, 0.0); + + if(WALLPAPER_TILE != getWallpaperStyle()) + { + aRelativeTopLeft.setX(0.5 - aRelativeSize.getX()); + aRelativeTopLeft.setY(0.5 - aRelativeSize.getY()); + } + + // prepare FillBitmapAttribute + const attribute::FillBitmapAttribute aFillBitmapAttribute( + getBitmapEx(), + aRelativeTopLeft, + aRelativeSize, + true); + + // create ObjectTransform + basegfx::B2DHomMatrix aObjectTransform; + + aObjectTransform.set(0, 0, getLocalObjectRange().getWidth()); + aObjectTransform.set(1, 1, getLocalObjectRange().getHeight()); + aObjectTransform.set(0, 2, getLocalObjectRange().getMinX()); + aObjectTransform.set(1, 2, getLocalObjectRange().getMinY()); + + // create FillBitmapPrimitive + const drawinglayer::primitive2d::Primitive2DReference xFillBitmap( + new drawinglayer::primitive2d::FillBitmapPrimitive2D( + aObjectTransform, + aFillBitmapAttribute)); + aRetval = Primitive2DSequence(&xFillBitmap, 1); + + // always embed tiled fill to clipping + bNeedsClipping = true; + } + + if(bNeedsClipping) + { + // embed to clipping; this is necessary for tiled fills + const basegfx::B2DPolyPolygon aPolyPolygon(basegfx::tools::createPolygonFromRect(getLocalObjectRange())); + const drawinglayer::primitive2d::Primitive2DReference xClippedFill( + new drawinglayer::primitive2d::MaskPrimitive2D( + aPolyPolygon, + aRetval)); + aRetval = Primitive2DSequence(&xClippedFill, 1); + } + } + } + } + + return aRetval; + } + + WallpaperBitmapPrimitive2D::WallpaperBitmapPrimitive2D( + const basegfx::B2DRange& rObjectRange, + const BitmapEx& rBitmapEx, + WallpaperStyle eWallpaperStyle) + : ViewTransformationDependentPrimitive2D(), + maObjectRange(rObjectRange), + maBitmapEx(rBitmapEx), + meWallpaperStyle(eWallpaperStyle) + { + } + + bool WallpaperBitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(ViewTransformationDependentPrimitive2D::operator==(rPrimitive)) + { + const WallpaperBitmapPrimitive2D& rCompare = (WallpaperBitmapPrimitive2D&)rPrimitive; + + return (getLocalObjectRange() == rCompare.getLocalObjectRange() + && getBitmapEx() == rCompare.getBitmapEx() + && getWallpaperStyle() == rCompare.getWallpaperStyle()); + } + + return false; + } + + basegfx::B2DRange WallpaperBitmapPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + return getLocalObjectRange(); + } + + // provide unique ID + ImplPrimitrive2DIDBlock(WallpaperBitmapPrimitive2D, PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D) + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx b/drawinglayer/source/primitive3d/textureprimitive3d.cxx index 16f33435a38b..deeed95a71fd 100644 --- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx @@ -171,12 +171,12 @@ namespace drawinglayer namespace primitive3d { BitmapTexturePrimitive3D::BitmapTexturePrimitive3D( - const attribute::FillBitmapAttribute& rBitmap, + const attribute::FillBitmapAttribute& rFillBitmapAttribute, const Primitive3DSequence& rChildren, const basegfx::B2DVector& rTextureSize, bool bModulate, bool bFilter) : TexturePrimitive3D(rChildren, rTextureSize, bModulate, bFilter), - maBitmap(rBitmap) + maFillBitmapAttribute(rFillBitmapAttribute) { } @@ -186,7 +186,7 @@ namespace drawinglayer { const BitmapTexturePrimitive3D& rCompare = (BitmapTexturePrimitive3D&)rPrimitive; - return (getBitmap() == rCompare.getBitmap()); + return (getFillBitmapAttribute() == rCompare.getFillBitmapAttribute()); } return false; diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx index 20d07add629c..649c208a6db5 100644 --- a/drawinglayer/source/processor2d/canvasprocessor.cxx +++ b/drawinglayer/source/processor2d/canvasprocessor.cxx @@ -676,7 +676,7 @@ using namespace com::sun::star; // directdraw of text simple portion void canvasProcessor::impRender_STXP(const textSimplePortionPrimitive& rTextCandidate) { - const fontAttributes& rFontAttrs( rTextCandidate.getFontAttributes() ); + const fontAttributes& rFontAttrs( rTextCandidate.getFontAttribute() ); rendering::FontRequest aFontRequest; aFontRequest.FontDescription.FamilyName = rFontAttrs.maFamilyName; @@ -1517,16 +1517,16 @@ namespace drawinglayer } else { - const primitive2d::FontAttributes& rFontAttrs(rTextCandidate.getFontAttributes()); + const attribute::FontAttribute& rFontAttr(rTextCandidate.getFontAttribute()); rendering::FontRequest aFontRequest; - aFontRequest.FontDescription.FamilyName = rFontAttrs.getFamilyName(); - aFontRequest.FontDescription.StyleName = rFontAttrs.getStyleName(); - aFontRequest.FontDescription.IsSymbolFont = rFontAttrs.getSymbol() ? util::TriState_YES : util::TriState_NO; - aFontRequest.FontDescription.IsVertical = rFontAttrs.getVertical() ? util::TriState_YES : util::TriState_NO; + aFontRequest.FontDescription.FamilyName = rFontAttr.getFamilyName(); + aFontRequest.FontDescription.StyleName = rFontAttr.getStyleName(); + aFontRequest.FontDescription.IsSymbolFont = rFontAttr.getSymbol() ? util::TriState_YES : util::TriState_NO; + aFontRequest.FontDescription.IsVertical = rFontAttr.getVertical() ? util::TriState_YES : util::TriState_NO; // TODO(F2): improve vclenum->panose conversion - aFontRequest.FontDescription.FontDescription.Weight = static_cast< sal_uInt8 >(rFontAttrs.getWeight()); - aFontRequest.FontDescription.FontDescription.Letterform = rFontAttrs.getItalic() ? 9 : 0; + aFontRequest.FontDescription.FontDescription.Weight = static_cast< sal_uInt8 >(rFontAttr.getWeight()); + aFontRequest.FontDescription.FontDescription.Letterform = rFontAttr.getItalic() ? 9 : 0; // init CellSize to 1.0, else a default font height will be used aFontRequest.CellSize = 1.0; @@ -1795,7 +1795,7 @@ namespace drawinglayer if(rFillBitmapAttribute.getTiling()) { // apply possible color modification to Bitmap - const BitmapEx aChangedBitmapEx(impModifyBitmapEx(maBColorModifierStack, BitmapEx(rFillBitmapAttribute.getBitmap()))); + const BitmapEx aChangedBitmapEx(impModifyBitmapEx(maBColorModifierStack, rFillBitmapAttribute.getBitmapEx())); if(aChangedBitmapEx.IsEmpty()) { diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 8b47368a58b9..062af73f5f0a 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -113,6 +113,7 @@ namespace drawinglayer { // Prepare VDev, MetaFile and connections OutputDevice* pLastOutputDevice = mpOutputDevice; + GDIMetaFile* pLastMetafile = mpMetaFile; basegfx::B2DRange aPrimitiveRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rContent, getViewInformation2D())); // transform primitive range with current transformation (e.g shadow offset) @@ -125,6 +126,7 @@ namespace drawinglayer MapMode aNewMapMode(pLastOutputDevice->GetMapMode()); mpOutputDevice = &aContentVDev; + mpMetaFile = &o_rContentMetafile; aContentVDev.EnableOutput(false); aContentVDev.SetMapMode(pLastOutputDevice->GetMapMode()); o_rContentMetafile.Record(&aContentVDev); @@ -145,6 +147,7 @@ namespace drawinglayer o_rContentMetafile.SetPrefMapMode(aNewMapMode); o_rContentMetafile.SetPrefSize(aPrimitiveRectangle.GetSize()); mpOutputDevice = pLastOutputDevice; + mpMetaFile = pLastMetafile; return aPrimitiveRectangle; } @@ -219,7 +222,7 @@ namespace drawinglayer SvMemoryStream aMemStm; aMemStm << *pSvtGraphicFill; - mrMetaFile.AddAction(new MetaCommentAction("XPATHFILL_SEQ_BEGIN", 0, static_cast< const BYTE* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END))); + mpMetaFile->AddAction(new MetaCommentAction("XPATHFILL_SEQ_BEGIN", 0, static_cast< const BYTE* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END))); mnSvtGraphicFillCount++; } } @@ -229,7 +232,7 @@ namespace drawinglayer if(pSvtGraphicFill && mnSvtGraphicFillCount) { mnSvtGraphicFillCount--; - mrMetaFile.AddAction(new MetaCommentAction("XPATHFILL_SEQ_END")); + mpMetaFile->AddAction(new MetaCommentAction("XPATHFILL_SEQ_END")); delete pSvtGraphicFill; } } @@ -372,7 +375,7 @@ namespace drawinglayer SvMemoryStream aMemStm; aMemStm << *pSvtGraphicStroke; - mrMetaFile.AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_BEGIN", 0, static_cast< const BYTE* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END))); + mpMetaFile->AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_BEGIN", 0, static_cast< const BYTE* >(aMemStm.GetData()), aMemStm.Seek(STREAM_SEEK_TO_END))); mnSvtGraphicStrokeCount++; } } @@ -382,7 +385,7 @@ namespace drawinglayer if(pSvtGraphicStroke && mnSvtGraphicStrokeCount) { mnSvtGraphicStrokeCount--; - mrMetaFile.AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_END")); + mpMetaFile->AddAction(new MetaCommentAction("XPATHSTROKE_SEQ_END")); delete pSvtGraphicStroke; } } @@ -392,7 +395,7 @@ namespace drawinglayer VclMetafileProcessor2D::VclMetafileProcessor2D(const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev) : VclProcessor2D(rViewInformation, rOutDev), - mrMetaFile(*rOutDev.GetConnectMetaFile()), + mpMetaFile(rOutDev.GetConnectMetaFile()), mnSvtGraphicFillCount(0), mnSvtGraphicStrokeCount(0), mfCurrentUnifiedTransparence(0.0), @@ -816,19 +819,19 @@ namespace drawinglayer { default : // case drawinglayer::primitive2d::FIELD_TYPE_COMMON : { - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringCommon)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringCommon)); break; } case drawinglayer::primitive2d::FIELD_TYPE_PAGE : { - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringPage)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringPage)); break; } case drawinglayer::primitive2d::FIELD_TYPE_URL : { const rtl::OUString& rURL = rFieldPrimitive.getString(); const String aOldString(rURL); - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringCommon, 0, reinterpret_cast< const BYTE* >(aOldString.GetBuffer()), 2 * aOldString.Len())); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringCommon, 0, reinterpret_cast< const BYTE* >(aOldString.GetBuffer()), 2 * aOldString.Len())); break; } } @@ -838,7 +841,7 @@ namespace drawinglayer process(rContent); // for the end comment the type is not relevant yet, they are all the same. Just add. - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringEnd)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringEnd)); if(mpPDFExtOutDevData && drawinglayer::primitive2d::FIELD_TYPE_URL == rFieldPrimitive.getType()) { @@ -863,7 +866,7 @@ namespace drawinglayer // process recursively and add MetaFile comment process(rLinePrimitive.get2DDecomposition(getViewInformation2D())); - mrMetaFile.AddAction(new MetaCommentAction(aCommentString)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentString)); break; } @@ -876,7 +879,7 @@ namespace drawinglayer // process recursively and add MetaFile comment process(rBulletPrimitive.get2DDecomposition(getViewInformation2D())); - mrMetaFile.AddAction(new MetaCommentAction(aCommentString)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentString)); break; } @@ -893,7 +896,7 @@ namespace drawinglayer // process recursively and add MetaFile comment process(rParagraphPrimitive.get2DDecomposition(getViewInformation2D())); - mrMetaFile.AddAction(new MetaCommentAction(aCommentString)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentString)); if(mpPDFExtOutDevData) { @@ -910,9 +913,9 @@ namespace drawinglayer static const ByteString aCommentStringB("XTEXT_PAINTSHAPE_END"); // add MetaFile comment, process recursively and add MetaFile comment - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringA)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringA)); process(rBlockPrimitive.get2DDecomposition(getViewInformation2D())); - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringB)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringB)); break; } @@ -965,17 +968,17 @@ namespace drawinglayer // create the entries for the respective break positions if(i == nNextCellBreak) { - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringA, i - nTextPosition)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringA, i - nTextPosition)); nNextCellBreak = mxBreakIterator->nextCharacters(rTxt, i, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); } if(i == nNextWordBoundary.endPos) { - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringB, i - nTextPosition)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringB, i - nTextPosition)); nNextWordBoundary = mxBreakIterator->getWordBoundary(rTxt, i + 1, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True); } if(i == nNextSentenceBreak) { - mrMetaFile.AddAction(new MetaCommentAction(aCommentStringC, i - nTextPosition)); + mpMetaFile->AddAction(new MetaCommentAction(aCommentStringC, i - nTextPosition)); nNextSentenceBreak = mxBreakIterator->endOfSentence(rTxt, i + 1, rLocale); } } @@ -1042,7 +1045,7 @@ namespace drawinglayer { const Polygon aToolsPolygon(aCandidate); - mrMetaFile.AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo)); + mpMetaFile->AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo)); } } } @@ -1107,7 +1110,7 @@ namespace drawinglayer { const Polygon aToolsPolygon(aCandidate); - mrMetaFile.AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo)); + mpMetaFile->AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo)); } } @@ -1172,8 +1175,8 @@ namespace drawinglayer const basegfx::B2DPoint aFillBitmapTopLeft(rFillBitmapAttribute.getTopLeft() * aOutlineSize); // the scaling needs scale from pixel to logic coordinate system - const Bitmap& rBitmap = rFillBitmapAttribute.getBitmap(); - Size aBmpSizePixel(rBitmap.GetSizePixel()); + const BitmapEx& rBitmapEx = rFillBitmapAttribute.getBitmapEx(); + Size aBmpSizePixel(rBitmapEx.GetSizePixel()); if(!aBmpSizePixel.Width()) { @@ -1197,7 +1200,7 @@ namespace drawinglayer aTransform.matrix[5] = aFillBitmapTopLeft.getY(); // setup fill graphic like in impgrfll - Graphic aFillGraphic = Graphic(rBitmap); + Graphic aFillGraphic = Graphic(rBitmapEx); aFillGraphic.SetPrefMapMode(MapMode(MAP_PIXEL)); aFillGraphic.SetPrefSize(aBmpSizePixel); @@ -1551,7 +1554,10 @@ namespace drawinglayer // svae old mfCurrentUnifiedTransparence and set new one // so that contained SvtGraphicStroke may use the current one const double fLastCurrentUnifiedTransparence(mfCurrentUnifiedTransparence); - mfCurrentUnifiedTransparence = rUniAlphaCandidate.getAlpha(); + // #i105377# paint the content metafile opaque as the transparency gets + // split of into the gradient below + // mfCurrentUnifiedTransparence = rUniAlphaCandidate.getAlpha(); + mfCurrentUnifiedTransparence = 0; // various content, create content-metafile GDIMetaFile aContentMetafile; diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index b1d91ebc86fc..51192f2dc72f 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -232,8 +232,16 @@ namespace drawinglayer mpOutputDevice->SetAntialiasing(nOldAntiAliase | ANTIALIASING_PIXELSNAPHAIRLINE); } - // direct draw of MetaFile - RenderMetafilePrimitive2D(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate)); + static bool bTestMetaFilePrimitiveDecomposition(true); + if(bTestMetaFilePrimitiveDecomposition) + { + process(rCandidate.get2DDecomposition(getViewInformation2D())); + } + else + { + // direct draw of MetaFile + RenderMetafilePrimitive2D(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate)); + } if(bForceLineSnap) { @@ -535,23 +543,18 @@ namespace drawinglayer case PRIMITIVE2D_ID_INVERTPRIMITIVE2D : { // invert primitive (currently only used for HighContrast fallback for selection in SW and SC). - // Set OutDev to XOR + // Set OutDev to XOR and switch AA off (XOR does not work with AA) mpOutputDevice->Push(); mpOutputDevice->SetRasterOp( ROP_XOR ); - - // force paint color to white by using ColorModifierStack - const basegfx::BColor aColWhite(1.0, 1.0, 1.0); - const basegfx::BColorModifier aColorModifier(aColWhite, 0.0, basegfx::BCOLORMODIFYMODE_REPLACE); - maBColorModifierStack.push(aColorModifier); + const sal_uInt16 nAntiAliasing(mpOutputDevice->GetAntialiasing()); + mpOutputDevice->SetAntialiasing(nAntiAliasing & ~ANTIALIASING_ENABLE_B2DDRAW); // process content recursively process(rCandidate.get2DDecomposition(getViewInformation2D())); - // restore ColorModifierStack - maBColorModifierStack.pop(); - // restore OutDev mpOutputDevice->Pop(); + mpOutputDevice->SetAntialiasing(nAntiAliasing); break; } default : diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index eb5b4b0fbd30..127d4845e672 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -63,6 +63,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // control support @@ -99,31 +100,31 @@ namespace drawinglayer using ::com::sun::star::awt::XWindow; using ::com::sun::star::awt::PosSize::POSSIZE; - static FontUnderline mapTextLineStyle(primitive2d::FontUnderline eLineStyle) + static FontUnderline mapTextLineStyle(drawinglayer::primitive2d::TextLine eLineStyle) { switch(eLineStyle) { default: DBG_WARNING1( "DrawingLayer: Unknown text line style attribute (%d)!", eLineStyle ); // fall through - case primitive2d::FONT_UNDERLINE_NONE: return UNDERLINE_NONE; - case primitive2d::FONT_UNDERLINE_SINGLE: return UNDERLINE_SINGLE; - case primitive2d::FONT_UNDERLINE_DOUBLE: return UNDERLINE_DOUBLE; - case primitive2d::FONT_UNDERLINE_DOTTED: return UNDERLINE_DOTTED; - case primitive2d::FONT_UNDERLINE_DASH: return UNDERLINE_DASH; - case primitive2d::FONT_UNDERLINE_LONGDASH: return UNDERLINE_LONGDASH; - case primitive2d::FONT_UNDERLINE_DASHDOT: return UNDERLINE_DASHDOT; - case primitive2d::FONT_UNDERLINE_DASHDOTDOT: return UNDERLINE_DASHDOTDOT; - case primitive2d::FONT_UNDERLINE_SMALLWAVE: return UNDERLINE_SMALLWAVE; - case primitive2d::FONT_UNDERLINE_WAVE: return UNDERLINE_WAVE; - case primitive2d::FONT_UNDERLINE_DOUBLEWAVE: return UNDERLINE_DOUBLEWAVE; - case primitive2d::FONT_UNDERLINE_BOLD: return UNDERLINE_BOLD; - case primitive2d::FONT_UNDERLINE_BOLDDOTTED: return UNDERLINE_BOLDDOTTED; - case primitive2d::FONT_UNDERLINE_BOLDDASH: return UNDERLINE_BOLDDASH; - case primitive2d::FONT_UNDERLINE_BOLDLONGDASH: return UNDERLINE_LONGDASH; - case primitive2d::FONT_UNDERLINE_BOLDDASHDOT: return UNDERLINE_BOLDDASHDOT; - case primitive2d::FONT_UNDERLINE_BOLDDASHDOTDOT:return UNDERLINE_BOLDDASHDOT; - case primitive2d::FONT_UNDERLINE_BOLDWAVE: return UNDERLINE_BOLDWAVE; + case primitive2d::TEXT_LINE_NONE: return UNDERLINE_NONE; + case primitive2d::TEXT_LINE_SINGLE: return UNDERLINE_SINGLE; + case primitive2d::TEXT_LINE_DOUBLE: return UNDERLINE_DOUBLE; + case primitive2d::TEXT_LINE_DOTTED: return UNDERLINE_DOTTED; + case primitive2d::TEXT_LINE_DASH: return UNDERLINE_DASH; + case primitive2d::TEXT_LINE_LONGDASH: return UNDERLINE_LONGDASH; + case primitive2d::TEXT_LINE_DASHDOT: return UNDERLINE_DASHDOT; + case primitive2d::TEXT_LINE_DASHDOTDOT: return UNDERLINE_DASHDOTDOT; + case primitive2d::TEXT_LINE_SMALLWAVE: return UNDERLINE_SMALLWAVE; + case primitive2d::TEXT_LINE_WAVE: return UNDERLINE_WAVE; + case primitive2d::TEXT_LINE_DOUBLEWAVE: return UNDERLINE_DOUBLEWAVE; + case primitive2d::TEXT_LINE_BOLD: return UNDERLINE_BOLD; + case primitive2d::TEXT_LINE_BOLDDOTTED: return UNDERLINE_BOLDDOTTED; + case primitive2d::TEXT_LINE_BOLDDASH: return UNDERLINE_BOLDDASH; + case primitive2d::TEXT_LINE_BOLDLONGDASH: return UNDERLINE_LONGDASH; + case primitive2d::TEXT_LINE_BOLDDASHDOT: return UNDERLINE_BOLDDASHDOT; + case primitive2d::TEXT_LINE_BOLDDASHDOTDOT:return UNDERLINE_BOLDDASHDOT; + case primitive2d::TEXT_LINE_BOLDWAVE: return UNDERLINE_BOLDWAVE; } } @@ -157,8 +158,8 @@ namespace drawinglayer if(basegfx::fTools::more(aFontScaling.getX(), 0.0) && basegfx::fTools::more(aFontScaling.getY(), 0.0)) { // Get the VCL font (use FontHeight as FontWidth) - Font aFont(primitive2d::getVclFontFromFontAttributes( - rTextCandidate.getFontAttributes(), + Font aFont(primitive2d::getVclFontFromFontAttribute( + rTextCandidate.getFontAttribute(), aFontScaling.getX(), aFontScaling.getY(), fRotate, @@ -176,7 +177,7 @@ namespace drawinglayer mpOutputDevice->SetTextLineColor( Color(aTextlineColor) ); // set Overline attribute - FontUnderline eFontOverline = mapTextLineStyle( pTCPP->getFontOverline() ); + const FontUnderline eFontOverline(mapTextLineStyle( pTCPP->getFontOverline() )); if( eFontOverline != UNDERLINE_NONE ) { aFont.SetOverline( eFontOverline ); @@ -187,7 +188,7 @@ namespace drawinglayer } // set Underline attribute - FontUnderline eFontUnderline = mapTextLineStyle( pTCPP->getFontUnderline() ); + const FontUnderline eFontUnderline(mapTextLineStyle( pTCPP->getFontUnderline() )); if( eFontUnderline != UNDERLINE_NONE ) { aFont.SetUnderline( eFontUnderline ); @@ -282,7 +283,7 @@ namespace drawinglayer const Point aStartPoint(basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY())); const sal_uInt32 nOldLayoutMode(mpOutputDevice->GetLayoutMode()); - if(rTextCandidate.getFontAttributes().getRTL()) + if(rTextCandidate.getFontAttribute().getRTL()) { sal_uInt32 nRTLLayoutMode(nOldLayoutMode & ~(TEXT_LAYOUT_COMPLEX_DISABLED|TEXT_LAYOUT_BIDI_STRONG)); nRTLLayoutMode |= TEXT_LAYOUT_BIDI_RTL|TEXT_LAYOUT_TEXTORIGIN_LEFT; @@ -310,7 +311,7 @@ namespace drawinglayer rTextCandidate.getTextLength()); } - if(rTextCandidate.getFontAttributes().getRTL()) + if(rTextCandidate.getFontAttribute().getRTL()) { mpOutputDevice->SetLayoutMode(nOldLayoutMode); } @@ -428,7 +429,7 @@ namespace drawinglayer { // no shear or rotate, draw direct in pixel coordinates bPrimitiveAccepted = true; - BitmapEx aBitmapEx(rFillBitmapAttribute.getBitmap()); + BitmapEx aBitmapEx(rFillBitmapAttribute.getBitmapEx()); bool bPainted(false); if(maBColorModifierStack.count()) @@ -585,9 +586,9 @@ namespace drawinglayer if(rPolyPolygon.count()) { const attribute::FillBitmapAttribute& rFillBitmapAttribute = rPolygonCandidate.getFillBitmap(); - const Bitmap& rBitmap = rFillBitmapAttribute.getBitmap(); + const BitmapEx& rBitmapEx = rFillBitmapAttribute.getBitmapEx(); - if(rBitmap.IsEmpty()) + if(rBitmapEx.IsEmpty()) { // empty bitmap, done bDone = true; @@ -679,7 +680,9 @@ namespace drawinglayer aLocalPolyPolygon.transform(maCurrentTransformation); mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); - if(mnPolygonStrokePrimitive2D && getOptionsDrawinglayer().IsAntiAliasing()) + if(mnPolygonStrokePrimitive2D + && getOptionsDrawinglayer().IsAntiAliasing() + && (mpOutputDevice->GetAntialiasing() & ANTIALIASING_ENABLE_B2DDRAW)) { // when AA is on and this filled polygons are the result of stroked line geometry, // draw the geometry once extra as lines to avoid AA 'gaps' between partial polygons diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index 5f35960323fe..1be93d83b9a9 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -234,19 +234,19 @@ namespace drawinglayer texture::GeoTexSvx* pOldTex = mpGeoTexSvx; // create texture - const attribute::FillBitmapAttribute& rFillBitmapAttribute = rPrimitive.getBitmap(); + const attribute::FillBitmapAttribute& rFillBitmapAttribute = rPrimitive.getFillBitmapAttribute(); if(rFillBitmapAttribute.getTiling()) { mpGeoTexSvx = new texture::GeoTexSvxBitmapTiled( - rFillBitmapAttribute.getBitmap(), + rFillBitmapAttribute.getBitmapEx().GetBitmap(), rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(), rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize()); } else { mpGeoTexSvx = new texture::GeoTexSvxBitmap( - rFillBitmapAttribute.getBitmap(), + rFillBitmapAttribute.getBitmapEx().GetBitmap(), rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(), rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize()); } diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx index 2411ca3c31b4..b788de195903 100644 --- a/svx/source/sdr/overlay/overlayselection.cxx +++ b/svx/source/sdr/overlay/overlayselection.cxx @@ -113,9 +113,16 @@ namespace sdr if(nCount) { // create range primitives - const basegfx::BColor aRGBColor(getBaseColor().getBColor()); + const bool bInvert(OVERLAY_INVERT == maLastOverlayType); + basegfx::BColor aRGBColor(getBaseColor().getBColor()); aRetval.realloc(nCount); + if(bInvert) + { + // force color to white for invert to get a full invert + aRGBColor = basegfx::BColor(1.0, 1.0, 1.0); + } + for(sal_uInt32 a(0);a < nCount; a++) { const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(maRanges[a])); @@ -125,7 +132,7 @@ namespace sdr aRGBColor)); } - if(OVERLAY_INVERT == maLastOverlayType) + if(bInvert) { // embed all in invert primitive const drawinglayer::primitive2d::Primitive2DReference aInvert( diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 94d62794a397..43fb95f31d40 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -920,9 +920,6 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM if(aSource.count()) { - const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); - aSource.transform(aTransform); - if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) { const Gradient& rGrad = pAct->GetGradient(); @@ -943,7 +940,20 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM aXGradient.SetEndIntens(rGrad.GetEndIntensity()); aXGradient.SetSteps(rGrad.GetSteps()); - SetAttributes(pPath); + if(aVD.IsLineColor()) + { + // switch line off; when there was one there will be a + // META_POLYLINE_ACTION following creating another object + const Color aLineColor(aVD.GetLineColor()); + aVD.SetLineColor(); + SetAttributes(pPath); + aVD.SetLineColor(aLineColor); + } + else + { + SetAttributes(pPath); + } + aGradAttr.Put(XFillStyleItem(XFILL_GRADIENT)); aGradAttr.Put(XFillGradientItem(&pModel->GetItemPool(), aXGradient)); pPath->SetMergedItemSet(aGradAttr); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 3f5da01e101b..38f9907e04d5 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -682,7 +682,7 @@ void SdrGrafObj::operator=( const SdrObject& rObj ) const SdrGrafObj& rGraf = (SdrGrafObj&) rObj; - pGraphic->SetGraphic( rGraf.GetGraphic() ); + pGraphic->SetGraphic( rGraf.GetGraphic(), &rGraf.GetGraphicObject() ); aCropRect = rGraf.aCropRect; aFileName = rGraf.aFileName; aFilterName = rGraf.aFilterName; diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 3f9cb0bd0d73..d45eb70f2f3f 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -80,29 +80,29 @@ namespace return aRetval; } - static drawinglayer::primitive2d::FontUnderline mapTextLineStyle(FontUnderline eLineStyle) + static drawinglayer::primitive2d::TextLine mapTextLineStyle(FontUnderline eLineStyle) { switch(eLineStyle) { - case UNDERLINE_SINGLE: return drawinglayer::primitive2d::FONT_UNDERLINE_SINGLE; - case UNDERLINE_DOUBLE: return drawinglayer::primitive2d::FONT_UNDERLINE_DOUBLE; - case UNDERLINE_DOTTED: return drawinglayer::primitive2d::FONT_UNDERLINE_DOTTED; - case UNDERLINE_DASH: return drawinglayer::primitive2d::FONT_UNDERLINE_DASH; - case UNDERLINE_LONGDASH: return drawinglayer::primitive2d::FONT_UNDERLINE_LONGDASH; - case UNDERLINE_DASHDOT: return drawinglayer::primitive2d::FONT_UNDERLINE_DASHDOT; - case UNDERLINE_DASHDOTDOT: return drawinglayer::primitive2d::FONT_UNDERLINE_DASHDOTDOT; - case UNDERLINE_SMALLWAVE: return drawinglayer::primitive2d::FONT_UNDERLINE_SMALLWAVE; - case UNDERLINE_WAVE: return drawinglayer::primitive2d::FONT_UNDERLINE_WAVE; - case UNDERLINE_DOUBLEWAVE: return drawinglayer::primitive2d::FONT_UNDERLINE_DOUBLEWAVE; - case UNDERLINE_BOLD: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLD; - case UNDERLINE_BOLDDOTTED: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDDOTTED; - case UNDERLINE_BOLDDASH: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDDASH; - case UNDERLINE_BOLDLONGDASH: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDLONGDASH; - case UNDERLINE_BOLDDASHDOT: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDDASHDOT; - case UNDERLINE_BOLDDASHDOTDOT: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDDASHDOTDOT; - case UNDERLINE_BOLDWAVE: return drawinglayer::primitive2d::FONT_UNDERLINE_BOLDWAVE; + case UNDERLINE_SINGLE: return drawinglayer::primitive2d::TEXT_LINE_SINGLE; + case UNDERLINE_DOUBLE: return drawinglayer::primitive2d::TEXT_LINE_DOUBLE; + case UNDERLINE_DOTTED: return drawinglayer::primitive2d::TEXT_LINE_DOTTED; + case UNDERLINE_DASH: return drawinglayer::primitive2d::TEXT_LINE_DASH; + case UNDERLINE_LONGDASH: return drawinglayer::primitive2d::TEXT_LINE_LONGDASH; + case UNDERLINE_DASHDOT: return drawinglayer::primitive2d::TEXT_LINE_DASHDOT; + case UNDERLINE_DASHDOTDOT: return drawinglayer::primitive2d::TEXT_LINE_DASHDOTDOT; + case UNDERLINE_SMALLWAVE: return drawinglayer::primitive2d::TEXT_LINE_SMALLWAVE; + case UNDERLINE_WAVE: return drawinglayer::primitive2d::TEXT_LINE_WAVE; + case UNDERLINE_DOUBLEWAVE: return drawinglayer::primitive2d::TEXT_LINE_DOUBLEWAVE; + case UNDERLINE_BOLD: return drawinglayer::primitive2d::TEXT_LINE_BOLD; + case UNDERLINE_BOLDDOTTED: return drawinglayer::primitive2d::TEXT_LINE_BOLDDOTTED; + case UNDERLINE_BOLDDASH: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASH; + case UNDERLINE_BOLDLONGDASH: return drawinglayer::primitive2d::TEXT_LINE_BOLDLONGDASH; + case UNDERLINE_BOLDDASHDOT: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASHDOT; + case UNDERLINE_BOLDDASHDOTDOT: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASHDOTDOT; + case UNDERLINE_BOLDWAVE: return drawinglayer::primitive2d::TEXT_LINE_BOLDWAVE; // FontUnderline_FORCE_EQUAL_SIZE, UNDERLINE_DONTKNOW, UNDERLINE_NONE - default: return drawinglayer::primitive2d::FONT_UNDERLINE_NONE; + default: return drawinglayer::primitive2d::TEXT_LINE_NONE; } } @@ -217,8 +217,8 @@ namespace if(rInfo.mrText.Len() && rInfo.mnTextLen) { basegfx::B2DVector aFontScaling; - drawinglayer::primitive2d::FontAttributes aFontAttributes( - drawinglayer::primitive2d::getFontAttributesFromVclFont( + drawinglayer::attribute::FontAttribute aFontAttribute( + drawinglayer::primitive2d::getFontAttributeFromVclFont( aFontScaling, rInfo.mrFont, rInfo.IsRTL(), @@ -296,6 +296,11 @@ namespace const Color aFontColor(rInfo.mrFont.GetColor()); const basegfx::BColor aBFontColor(aFontColor.getBColor()); + // prepare wordLineMode (for underline and strikeout) + // NOT for bullet texts. It is set (this may be an error by itself), but needs to be suppressed to hinder e.g. '1)' + // to be splitted which would not look like the original + const bool bWordLineMode(rInfo.mrFont.IsWordLineMode() && !rInfo.mbEndOfBullet); + // prepare new primitive drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = 0; const bool bDecoratedIsNeeded( @@ -304,7 +309,8 @@ namespace || STRIKEOUT_NONE != rInfo.mrFont.GetStrikeout() || EMPHASISMARK_NONE != (rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE) || RELIEF_NONE != rInfo.mrFont.GetRelief() - || rInfo.mrFont.IsShadow()); + || rInfo.mrFont.IsShadow() + || bWordLineMode); if(bDecoratedIsNeeded) { @@ -316,11 +322,11 @@ namespace const basegfx::BColor aBOverlineColor((0xffffffff == aOverlineColor.GetColor()) ? aBFontColor : aOverlineColor.getBColor()); // prepare overline and underline data - const drawinglayer::primitive2d::FontUnderline eFontOverline(mapTextLineStyle(rInfo.mrFont.GetOverline())); - const drawinglayer::primitive2d::FontUnderline eFontUnderline(mapTextLineStyle(rInfo.mrFont.GetUnderline())); + const drawinglayer::primitive2d::TextLine eFontOverline(mapTextLineStyle(rInfo.mrFont.GetOverline())); + const drawinglayer::primitive2d::TextLine eFontUnderline(mapTextLineStyle(rInfo.mrFont.GetUnderline())); // check UndelineAbove - const bool bUnderlineAbove(drawinglayer::primitive2d::FONT_UNDERLINE_NONE != eFontUnderline && impIsUnderlineAbove(rInfo.mrFont)); + const bool bUnderlineAbove(drawinglayer::primitive2d::TEXT_LINE_NONE != eFontUnderline && impIsUnderlineAbove(rInfo.mrFont)); // prepare strikeout data drawinglayer::primitive2d::FontStrikeout eFontStrikeout(drawinglayer::primitive2d::FONT_STRIKEOUT_NONE); @@ -335,11 +341,6 @@ namespace default : break; // FontStrikeout_FORCE_EQUAL_SIZE, STRIKEOUT_NONE, STRIKEOUT_DONTKNOW } - // prepare wordLineMode (for underline and strikeout) - // NOT for bullet texts. It is set (this may be an error by itself), but needs to be suppressed to hinder e.g. '1)' - // to be splitted which would not look like the original - const bool bWordLineMode(rInfo.mrFont.IsWordLineMode() && !rInfo.mbEndOfBullet); - // prepare emphasis mark data drawinglayer::primitive2d::FontEmphasisMark eFontEmphasisMark(drawinglayer::primitive2d::FONT_EMPHASISMARK_NONE); @@ -376,7 +377,7 @@ namespace rInfo.mnTextStart, rInfo.mnTextLen, aDXArray, - aFontAttributes, + aFontAttribute, rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale(), aBFontColor, @@ -403,7 +404,7 @@ namespace rInfo.mnTextStart, rInfo.mnTextLen, aDXArray, - aFontAttributes, + aFontAttribute, rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale(), aBFontColor); } diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index f6a30d40b3d5..42215d35bad8 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -366,8 +366,8 @@ namespace { const impPathTextPortion* pCandidate = rTextPortions[a]; basegfx::B2DVector aFontScaling; - const drawinglayer::primitive2d::FontAttributes aCandidateFontAttributes( - drawinglayer::primitive2d::getFontAttributesFromVclFont( + const drawinglayer::attribute::FontAttribute aCandidateFontAttribute( + drawinglayer::primitive2d::getFontAttributeFromVclFont( aFontScaling, pCandidate->getFont(), pCandidate->isRTL(), @@ -520,7 +520,7 @@ namespace nPortionIndex, nNextGlyphLen, aNewDXArray, - aCandidateFontAttributes, + aCandidateFontAttribute, pCandidate->getLocale(), aRGBShadowColor); @@ -545,7 +545,7 @@ namespace nPortionIndex, nNextGlyphLen, aNewDXArray, - aCandidateFontAttributes, + aCandidateFontAttribute, pCandidate->getLocale(), aRGBColor); -- cgit v1.2.3 From 1d11db194dd5d81983f934ac93a214bf38af58ae Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 17 Nov 2009 13:39:34 +0100 Subject: #i106541# Metafile decompose done --- .../inc/drawinglayer/attribute/fontattribute.hxx | 13 + .../primitive2d/backgroundcolorprimitive2d.hxx | 2 +- .../primitive2d/drawinglayer_primitivetypes2d.hxx | 1 + .../drawinglayer/primitive2d/epsprimitive2d.hxx | 96 +++ .../primitive2d/textdecoratedprimitive2d.hxx | 18 +- .../primitive2d/textenumsprimitive2d.hxx | 47 +- .../primitive2d/textstrikeoutprimitive2d.hxx | 6 +- .../drawinglayer/processor2d/vclprocessor2d.hxx | 2 + drawinglayer/source/primitive2d/epsprimitive2d.cxx | 111 +++ .../source/primitive2d/graphicprimitive2d.cxx | 28 + drawinglayer/source/primitive2d/makefile.mk | 2 + .../source/primitive2d/metafileprimitive2d.cxx | 832 ++++++++++++++++----- .../primitive2d/textdecoratedprimitive2d.cxx | 54 +- .../source/primitive2d/textenumsprimitive2d.cxx | 129 ++++ .../primitive2d/textstrikeoutprimitive2d.cxx | 18 +- .../source/processor2d/vclmetafileprocessor2d.cxx | 6 + .../source/processor2d/vclpixelprocessor2d.cxx | 7 + drawinglayer/source/processor2d/vclprocessor2d.cxx | 101 ++- svx/source/svdraw/svdotextdecomposition.cxx | 70 +- 19 files changed, 1194 insertions(+), 349 deletions(-) create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/epsprimitive2d.hxx create mode 100644 drawinglayer/source/primitive2d/epsprimitive2d.cxx create mode 100644 drawinglayer/source/primitive2d/textenumsprimitive2d.cxx (limited to 'drawinglayer/inc/drawinglayer/primitive2d') diff --git a/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx index f34ee913418f..d8eed659f5e7 100644 --- a/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx @@ -92,6 +92,19 @@ namespace drawinglayer { } + FontAttribute() + : maFamilyName(), + maStyleName(), + mnWeight(0), + mbSymbol(false), + mbVertical(false), + mbItalic(false), + mbOutline(false), + mbRTL(false), + mbBiDiStrong(false) + { + } + /// compare operator bool operator==(const FontAttribute& rCompare) const; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx index 82a568fc9ea1..85cf5e236d4f 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace primitive2d { - /** AnimatedInterpolatePrimitive2D class + /** BackgroundColorPrimitive2D class This primitive is defined to fill the whole visible Viewport with the given color (and thus decomposes to a filled polygon). This diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index 477c3a19042a..d287482389b5 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -108,6 +108,7 @@ #define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57) #define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58) #define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59) +#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/epsprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/epsprimitive2d.hxx new file mode 100644 index 000000000000..0ebb29e153ec --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/epsprimitive2d.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: backgroundcolorprimitive2d.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EPSPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EPSPRIMITIVE2D_HXX + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + /** EpsPrimitive2D class */ + class EpsPrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + /// the geometry definition + basegfx::B2DHomMatrix maEpsTransform; + + /// the Eps content definition + GfxLink maGfxLink; + + /// the replacement content definition + GDIMetaFile maMetaFile; + + protected: + /// create local decomposition + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + /// constructor + EpsPrimitive2D( + const basegfx::B2DHomMatrix& rEpsTransform, + const GfxLink& rGfxLink, + const GDIMetaFile& rMetaFile); + + /// data read access + const basegfx::B2DHomMatrix& getEpsTransform() const { return maEpsTransform; } + const GfxLink& getGfxLink() const { return maGfxLink; } + const GDIMetaFile& getMetaFile() const { return maMetaFile; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + /// get B2Drange + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + /// provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EPSPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx index 6c7ea8bd24c5..fe41c2e1824a 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx @@ -71,9 +71,9 @@ namespace drawinglayer basegfx::BColor maTextlineColor; TextLine meFontOverline; TextLine meFontUnderline; - FontStrikeout meFontStrikeout; - FontEmphasisMark meFontEmphasisMark; - FontRelief meFontRelief; + TextStrikeout meTextStrikeout; + TextEmphasisMark meTextEmphasisMark; + TextRelief meTextRelief; /// bitfield unsigned mbUnderlineAbove : 1; @@ -123,20 +123,20 @@ namespace drawinglayer TextLine eFontOverline = TEXT_LINE_NONE, TextLine eFontUnderline = TEXT_LINE_NONE, bool bUnderlineAbove = false, - FontStrikeout eFontStrikeout = FONT_STRIKEOUT_NONE, + TextStrikeout eTextStrikeout = TEXT_STRIKEOUT_NONE, bool bWordLineMode = false, - FontEmphasisMark eFontEmphasisMark = FONT_EMPHASISMARK_NONE, + TextEmphasisMark eTextEmphasisMark = TEXT_EMPHASISMARK_NONE, bool bEmphasisMarkAbove = true, bool bEmphasisMarkBelow = false, - FontRelief eFontRelief = FONT_RELIEF_NONE, + TextRelief eTextRelief = TEXT_RELIEF_NONE, bool bShadow = false); /// data read access TextLine getFontOverline() const { return meFontOverline; } TextLine getFontUnderline() const { return meFontUnderline; } - FontStrikeout getFontStrikeout() const { return meFontStrikeout; } - FontEmphasisMark getFontEmphasisMark() const { return meFontEmphasisMark; } - FontRelief getFontRelief() const { return meFontRelief; } + TextStrikeout getTextStrikeout() const { return meTextStrikeout; } + TextEmphasisMark getTextEmphasisMark() const { return meTextEmphasisMark; } + TextRelief getTextRelief() const { return meTextRelief; } basegfx::BColor getOverlineColor() const { return maOverlineColor; } basegfx::BColor getTextlineColor() const { return maTextlineColor; } bool getUnderlineAbove() const { return mbUnderlineAbove; } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textenumsprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textenumsprimitive2d.hxx index ec2f7e656b40..b0e7dc8c241e 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textenumsprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textenumsprimitive2d.hxx @@ -37,6 +37,7 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTENUMSPRIMITIVE2D_HXX #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -70,33 +71,41 @@ namespace drawinglayer TEXT_LINE_BOLDWAVE }; + /** helper to convert LineStyle */ + TextLine mapFontUnderlineToTextLine(FontUnderline eLineStyle); + FontUnderline mapTextLineToFontUnderline(TextLine eLineStyle); + /** FontStrikeout definition */ - enum FontStrikeout + enum TextStrikeout { - FONT_STRIKEOUT_NONE, - FONT_STRIKEOUT_SINGLE, - FONT_STRIKEOUT_DOUBLE, - FONT_STRIKEOUT_BOLD, - FONT_STRIKEOUT_SLASH, - FONT_STRIKEOUT_X + TEXT_STRIKEOUT_NONE, + TEXT_STRIKEOUT_SINGLE, + TEXT_STRIKEOUT_DOUBLE, + TEXT_STRIKEOUT_BOLD, + TEXT_STRIKEOUT_SLASH, + TEXT_STRIKEOUT_X }; - /** FontEmphasisMark definition */ - enum FontEmphasisMark + /** helper to convert FontStrikeout */ + TextStrikeout mapFontStrikeoutToTextStrikeout(::FontStrikeout eFontStrikeout); + ::FontStrikeout mapTextStrikeoutToFontStrikeout(TextStrikeout eFontStrikeout); + + /** TextEmphasisMark definition */ + enum TextEmphasisMark { - FONT_EMPHASISMARK_NONE, - FONT_EMPHASISMARK_DOT, - FONT_EMPHASISMARK_CIRCLE, - FONT_EMPHASISMARK_DISC, - FONT_EMPHASISMARK_ACCENT + TEXT_EMPHASISMARK_NONE, + TEXT_EMPHASISMARK_DOT, + TEXT_EMPHASISMARK_CIRCLE, + TEXT_EMPHASISMARK_DISC, + TEXT_EMPHASISMARK_ACCENT }; - /** FontRelief definition */ - enum FontRelief + /** TextRelief definition */ + enum TextRelief { - FONT_RELIEF_NONE, - FONT_RELIEF_EMBOSSED, - FONT_RELIEF_ENGRAVED + TEXT_RELIEF_NONE, + TEXT_RELIEF_EMBOSSED, + TEXT_RELIEF_ENGRAVED }; } // end of namespace primitive2d diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx index 562eb681ddae..34d7d31fb93a 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx @@ -129,7 +129,7 @@ namespace drawinglayer private: double mfHeight; double mfOffset; - FontStrikeout meFontStrikeout; + TextStrikeout meTextStrikeout; protected: /// local decomposition. @@ -143,12 +143,12 @@ namespace drawinglayer const basegfx::BColor& rFontColor, double fHeight, double fOffset, - FontStrikeout eFontStrikeout); + TextStrikeout eTextStrikeout); /// data read access double getHeight() const { return mfHeight; } double getOffset() const { return mfOffset; } - FontStrikeout getFontStrikeout() const { return meFontStrikeout; } + TextStrikeout getTextStrikeout() const { return meTextStrikeout; } /// compare operator virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx index 66ca140c2e56..ff77cc3fd5d0 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx @@ -64,6 +64,7 @@ namespace drawinglayer { namespace primitive2d { class PolygonStrokePrimitive2D; class ControlPrimitive2D; class PagePreviewPrimitive2D; + class EpsPrimitive2D; }} ////////////////////////////////////////////////////////////////////////////// @@ -113,6 +114,7 @@ namespace drawinglayer void RenderMarkerArrayPrimitive2D(const primitive2d::MarkerArrayPrimitive2D& rMarkerArrayCandidate); void RenderPointArrayPrimitive2D(const primitive2d::PointArrayPrimitive2D& rPointArrayCandidate); void RenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokeCandidate); + void RenderEpsPrimitive2D(const primitive2d::EpsPrimitive2D& rEpsPrimitive2D); ///////////////////////////////////////////////////////////////////////////// // DrawMode adaption support diff --git a/drawinglayer/source/primitive2d/epsprimitive2d.cxx b/drawinglayer/source/primitive2d/epsprimitive2d.cxx new file mode 100644 index 000000000000..dc8128ab1386 --- /dev/null +++ b/drawinglayer/source/primitive2d/epsprimitive2d.cxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: backgroundcolorprimitive2d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence EpsPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + Primitive2DSequence xRetval; + const GDIMetaFile& rSubstituteContent = getMetaFile(); + + if(rSubstituteContent.GetActionCount()) + { + // the default decomposition will use the Metafile replacement visualisation. + // To really use the Eps data, a renderer has to know and interpret this primitive + // directly. + xRetval.realloc(1); + + xRetval[0] = Primitive2DReference( + new MetafilePrimitive2D( + getEpsTransform(), + rSubstituteContent)); + } + + return xRetval; + } + + EpsPrimitive2D::EpsPrimitive2D( + const basegfx::B2DHomMatrix& rEpsTransform, + const GfxLink& rGfxLink, + const GDIMetaFile& rMetaFile) + : BufferedDecompositionPrimitive2D(), + maEpsTransform(rEpsTransform), + maGfxLink(rGfxLink), + maMetaFile(rMetaFile) + { + } + + bool EpsPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) + { + const EpsPrimitive2D& rCompare = (EpsPrimitive2D&)rPrimitive; + + return (getEpsTransform() == rCompare.getEpsTransform() + && getGfxLink().IsEqual(rCompare.getGfxLink()) + && getMetaFile() == rCompare.getMetaFile()); + } + + return false; + } + + basegfx::B2DRange EpsPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + // use own implementation to quickly answer the getB2DRange question. + basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0); + aRetval.transform(getEpsTransform()); + + return aRetval; + } + + // provide unique ID + ImplPrimitrive2DIDBlock(EpsPrimitive2D, PRIMITIVE2D_ID_EPSPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index eca68858cbb5..d7d3929a7a56 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -689,6 +689,34 @@ namespace drawinglayer //delete pDXArray; } + if(false) + { + const double fHor(aRectangle.getWidth()); + const double fVer(aRectangle.getHeight()); + const Point aPointA( + aRectangle.Left() + basegfx::fround(fHor * 0.2), + aRectangle.Top() + basegfx::fround(fVer * 0.3)); + const Point aPointB( + aRectangle.Left() + basegfx::fround(fHor * 0.2), + aRectangle.Top() + basegfx::fround(fVer * 0.5)); + const Point aPointC( + aRectangle.Left() + basegfx::fround(fHor * 0.2), + aRectangle.Top() + basegfx::fround(fVer * 0.7)); + const String aText(ByteString("Hello, World!"), RTL_TEXTENCODING_UTF8); + + const String aFontName(ByteString("Comic Sans MS"), RTL_TEXTENCODING_UTF8); + Font aFont(aFontName, Size(0, 1000)); + aFont.SetAlign(ALIGN_BASELINE); + aFont.SetColor(COL_RED); + + aOut.SetFont(aFont); + const sal_Int32 nWidth(aOut.GetTextWidth(aText, 0, aText.Len())); + aOut.DrawText(aPointA, aText, 0, aText.Len()); + aOut.DrawTextLine(aPointA, nWidth, STRIKEOUT_SINGLE, UNDERLINE_SINGLE, UNDERLINE_SMALLWAVE); + aOut.DrawTextLine(aPointB, nWidth, STRIKEOUT_SINGLE, UNDERLINE_SINGLE, UNDERLINE_SMALLWAVE); + aOut.DrawTextLine(aPointC, nWidth, STRIKEOUT_SINGLE, UNDERLINE_SINGLE, UNDERLINE_SMALLWAVE); + } + aMtf.Stop(); aMtf.WindStart(); aMtf.SetPrefMapMode(MapMode(MAP_100TH_MM)); diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk index 5da4d9c35587..c9a3cc191a35 100644 --- a/drawinglayer/source/primitive2d/makefile.mk +++ b/drawinglayer/source/primitive2d/makefile.mk @@ -55,6 +55,7 @@ SLOFILES= \ $(SLO)$/controlprimitive2d.obj \ $(SLO)$/discretebitmapprimitive2d.obj \ $(SLO)$/embedded3dprimitive2d.obj \ + $(SLO)$/epsprimitive2d.obj \ $(SLO)$/fillbitmapprimitive2d.obj \ $(SLO)$/fillgradientprimitive2d.obj \ $(SLO)$/fillhatchprimitive2d.obj \ @@ -78,6 +79,7 @@ SLOFILES= \ $(SLO)$/shadowprimitive2d.obj \ $(SLO)$/structuretagprimitive2d.obj \ $(SLO)$/texteffectprimitive2d.obj \ + $(SLO)$/textenumsprimitive2d.obj \ $(SLO)$/textlayoutdevice.obj \ $(SLO)$/textlineprimitive2d.obj \ $(SLO)$/textprimitive2d.obj \ diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index a12172939e99..8434146c6f3a 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -68,6 +68,9 @@ #include #include #include +#include +#include +#include #include ////////////////////////////////////////////////////////////////////////////// @@ -78,12 +81,20 @@ using namespace com::sun::star; namespace { + /** helper class for graphic context + + This class allows to hold a complete status of classic + VCL OutputDevice stati. This data is needed for correct + interpretation of the MetaFile action flow. + */ class PropertyHolder { private: + /// current transformation (aka MapMode) basegfx::B2DHomMatrix maTransformation; MapUnit maMapUnit; + /// current colors basegfx::BColor maLineColor; basegfx::BColor maFillColor; basegfx::BColor maTextColor; @@ -91,13 +102,16 @@ namespace basegfx::BColor maTextLineColor; basegfx::BColor maOverlineColor; + /// clipping, font, etc. Region maRegion; Font maFont; RasterOp maRasterOp; sal_uInt32 mnLayoutMode; LanguageType maLanguageType; + sal_uInt16 mnPushFlags; /// bitfield + /// contains all active markers bool mbLineColor : 1; bool mbFillColor : 1; bool mbTextColor : 1; @@ -121,6 +135,7 @@ namespace maRasterOp(ROP_OVERPAINT), mnLayoutMode(0), maLanguageType(0), + mnPushFlags(0), mbLineColor(false), mbFillColor(false), mbTextColor(true), @@ -135,6 +150,7 @@ namespace { } + /// read/write accesses const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; } void setTransformation(const basegfx::B2DHomMatrix& rNew) { if(rNew != maTransformation) maTransformation = rNew; } @@ -191,6 +207,9 @@ namespace LanguageType getLanguageType() const { return maLanguageType; } void setLanguageType(LanguageType aNew) { if(aNew != maLanguageType) maLanguageType = aNew; } + sal_uInt16 getPushFlags() const { return mnPushFlags; } + void setPushFlags(sal_uInt16 nNew) { if(nNew != mnPushFlags) mnPushFlags = nNew; } + bool getLineOrFillActive() const { return (mbLineColor || mbFillColor); } }; } // end of anonymous namespace @@ -199,6 +218,15 @@ namespace namespace { + /** stack for properites + + This class builds a stack based on the PropertyHolder + class. It encapsulates the pointer/new/delete usage to + make it safe and implements the push/pop as needed by a + VCL Metafile interpreter. The critical part here are the + flag values VCL OutputDevice uses here; not all stuff is + pushed and thus needs to be copied at pop. + */ class PropertyHolders { private: @@ -215,33 +243,127 @@ namespace return maPropertyHolders.size(); } - void Push() + void Push(sal_uInt16 nPushFlags) { - OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: PUSH with no property holders (!)"); - maPropertyHolders.push_back(new PropertyHolder(*maPropertyHolders[maPropertyHolders.size() - 1])); + if(nPushFlags) + { + OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: PUSH with no property holders (!)"); + PropertyHolder* pNew = new PropertyHolder(*maPropertyHolders.back()); + pNew->setPushFlags(nPushFlags); + maPropertyHolders.push_back(pNew); + } } void Pop() { OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: POP with no property holders (!)"); - if(maPropertyHolders.size()) + const sal_uInt32 nSize(maPropertyHolders.size()); + + if(nSize) { - delete maPropertyHolders[maPropertyHolders.size() - 1]; - maPropertyHolders.pop_back(); + const PropertyHolder* pTip = maPropertyHolders.back(); + const sal_uInt16 nPushFlags(pTip->getPushFlags()); + + if(nPushFlags) + { + if(nSize > 1) + { + // copy back content for all non-set flags + PropertyHolder* pLast = maPropertyHolders[nSize - 2]; + + if(PUSH_ALL != nPushFlags) + { + if(!(nPushFlags & PUSH_LINECOLOR )) + { + pLast->setLineColor(pTip->getLineColor()); + pLast->setLineColorActive(pTip->getLineColorActive()); + } + if(!(nPushFlags & PUSH_FILLCOLOR )) + { + pLast->setFillColor(pTip->getFillColor()); + pLast->setFillColorActive(pTip->getFillColorActive()); + } + if(!(nPushFlags & PUSH_FONT )) + { + pLast->setFont(pTip->getFont()); + } + if(!(nPushFlags & PUSH_TEXTCOLOR )) + { + pLast->setTextColor(pTip->getTextColor()); + pLast->setTextColorActive(pTip->getTextColorActive()); + } + if(!(nPushFlags & PUSH_MAPMODE )) + { + pLast->setTransformation(pTip->getTransformation()); + pLast->setMapUnit(pTip->getMapUnit()); + } + if(!(nPushFlags & PUSH_CLIPREGION )) + { + pLast->setRegion(pTip->getRegion()); + pLast->setRegionActive(pTip->getRegionActive()); + } + if(!(nPushFlags & PUSH_RASTEROP )) + { + pLast->setRasterOp(pTip->getRasterOp()); + } + if(!(nPushFlags & PUSH_TEXTFILLCOLOR )) + { + pLast->setTextFillColor(pTip->getTextFillColor()); + pLast->setTextFillColorActive(pTip->getTextFillColorActive()); + } + if(!(nPushFlags & PUSH_TEXTALIGN )) + { + if(pLast->getFont().GetAlign() != pTip->getFont().GetAlign()) + { + Font aFont(pLast->getFont()); + aFont.SetAlign(pTip->getFont().GetAlign()); + pLast->setFont(aFont); + } + } + if(!(nPushFlags & PUSH_REFPOINT )) + { + // not supported + } + if(!(nPushFlags & PUSH_TEXTLINECOLOR )) + { + pLast->setTextLineColor(pTip->getTextLineColor()); + pLast->setTextLineColorActive(pTip->getTextLineColorActive()); + } + if(!(nPushFlags & PUSH_TEXTLAYOUTMODE )) + { + pLast->setLayoutMode(pTip->getLayoutMode()); + } + if(!(nPushFlags & PUSH_TEXTLANGUAGE )) + { + pLast->setLanguageType(pTip->getLanguageType()); + } + if(!(nPushFlags & PUSH_OVERLINECOLOR )) + { + pLast->setOverlineColor(pTip->getOverlineColor()); + pLast->setOverlineColorActive(pTip->getOverlineColorActive()); + } + } + } + + // execute the pop + delete maPropertyHolders.back(); + maPropertyHolders.pop_back(); + } } } PropertyHolder& Current() { OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: CURRENT with no property holders (!)"); - return *maPropertyHolders[maPropertyHolders.size() - 1]; + return *maPropertyHolders.back(); } ~PropertyHolders() { while(maPropertyHolders.size()) { - Pop(); + delete maPropertyHolders.back(); + maPropertyHolders.pop_back(); } } }; @@ -251,6 +373,13 @@ namespace namespace { + /** helper to convert a Region to a B2DPolyPolygon + when it does not yet contain one. In the future + this may be expanded to merge the polygons created + from rectangles or use a special algo to directly turn + the spans of regions to a single, already merged + PolyPolygon. + */ basegfx::B2DPolyPolygon getB2DPolyPolygonFromRegion(const Region& rRegion) { basegfx::B2DPolyPolygon aRetval; @@ -288,6 +417,12 @@ namespace namespace { + /** Helper class to buffer and hold a Primive target vector. It + encapsulates the new/delete functionality and aloows to work + on pointers of the implementation classes. All data will + be converted to uno sequences of uno references when accessing the + data. + */ class TargetHolder { private: @@ -369,6 +504,7 @@ namespace namespace { + /** Helper class which builds a stack on the TargetHolder class */ class TargetHolders { private: @@ -395,7 +531,7 @@ namespace OSL_ENSURE(maTargetHolders.size(), "TargetHolders: POP with no property holders (!)"); if(maTargetHolders.size()) { - delete maTargetHolders[maTargetHolders.size() - 1]; + delete maTargetHolders.back(); maTargetHolders.pop_back(); } } @@ -403,14 +539,15 @@ namespace TargetHolder& Current() { OSL_ENSURE(maTargetHolders.size(), "TargetHolders: CURRENT with no property holders (!)"); - return *maTargetHolders[maTargetHolders.size() - 1]; + return *maTargetHolders.back(); } ~TargetHolders() { while(maTargetHolders.size()) { - Pop(); + delete maTargetHolders.back(); + maTargetHolders.pop_back(); } } }; @@ -461,6 +598,7 @@ namespace drawinglayer namespace { + /** helper to convert a MapMode to a transformation */ basegfx::B2DHomMatrix getTransformFromMapMode(const MapMode& rMapMode) { basegfx::B2DHomMatrix aMapping; @@ -482,6 +620,7 @@ namespace return aMapping; } + /** helper to create a PointArrayPrimitive2D based on current context */ void createPointArrayPrimitive( const std::vector< basegfx::B2DPoint >& rPositions, TargetHolder& rTarget, @@ -514,6 +653,7 @@ namespace } } + /** helper to create a PolygonHairlinePrimitive2D based on current context */ void createHairlinePrimitive( const basegfx::B2DPolygon& rLinePolygon, TargetHolder& rTarget, @@ -530,6 +670,7 @@ namespace } } + /** helper to create a PolyPolygonColorPrimitive2D based on current context */ void createFillPrimitive( const basegfx::B2DPolyPolygon& rFillPolyPolygon, TargetHolder& rTarget, @@ -546,6 +687,7 @@ namespace } } + /** helper to create a PolygonStrokePrimitive2D based on current context */ void createLinePrimitive( const basegfx::B2DPolygon& rLinePolygon, const LineInfo& rLineInfo, @@ -611,6 +753,7 @@ namespace } } + /** helper to create needed line and fill primitives based on current context */ void createHairlineAndFillPrimitive( const basegfx::B2DPolygon& rPolygon, TargetHolder& rTarget, @@ -627,6 +770,7 @@ namespace } } + /** helper to create needed line and fill primitives based on current context */ void createHairlineAndFillPrimitive( const basegfx::B2DPolyPolygon& rPolyPolygon, TargetHolder& rTarget, @@ -646,6 +790,12 @@ namespace } } + /** helper to create DiscreteBitmapPrimitive2D based on current context. + The DiscreteBitmapPrimitive2D is especially created for this usage + since no other usage defines a bitmap visualisation based on top-left + position and size in pixels. At the end it will create a view-dependent + transformed embedding of a BitmapPrimitive2D. + */ void createBitmapExPrimitive( const BitmapEx& rBitmapEx, const Point& rPoint, @@ -664,6 +814,7 @@ namespace } } + /** helper to create BitmapPrimitive2D based on current context */ void createBitmapExPrimitive( const BitmapEx& rBitmapEx, const Point& rPoint, @@ -689,6 +840,10 @@ namespace } } + /** helper to create a regular BotmapEx from a MaskAction (definitions + which use a bitmap without alpha but define one of the colors as + transparent) + */ BitmapEx createMaskBmpEx(const Bitmap& rBitmap, const Color& rMaskColor) { const Color aWhite(COL_WHITE); @@ -705,6 +860,9 @@ namespace return BitmapEx(aSolid, aMask); } + /** helper to convert from a VCL Gradient definition to the corresponding + data for primitive representation + */ drawinglayer::attribute::FillGradientAttribute createFillGradientAttribute(const Gradient& rGradient) { const Color aStartColor(rGradient.GetStartColor()); @@ -774,6 +932,9 @@ namespace rGradient.GetSteps()); } + /** helper to convert from a VCL Hatch definition to the corresponding + data for primitive representation + */ drawinglayer::attribute::FillHatchAttribute createFillHatchAttribute(const Hatch& rHatch) { drawinglayer::attribute::HatchStyle aHatchStyle(drawinglayer::attribute::HATCHSTYLE_SINGLE); @@ -802,6 +963,12 @@ namespace false); } + /** helper to take needed action on ClipRegion change. This method needs to be called + on any Region change, e.g. at the obvious actions doing this, but also at pop-calls + whcih change the Region of the current context. It takes care of creating the + current embeddec context, set the new Region at the context and eventually prepare + a new target for embracing new geometry to the current region + */ void HandleNewClipRegion( const Region* pRegion, TargetHolders& rTargetHolders, @@ -828,7 +995,7 @@ namespace } // apply new settings - const bool bNewActive(pRegion); + const bool bNewActive(pRegion && !pRegion->IsEmpty()); rPropertyHolders.Current().setRegionActive(bNewActive); if(bNewActive) @@ -840,6 +1007,12 @@ namespace } } + /** helper to handle the change of RasterOp. It takes care of encapsulating all current + geometry to the current RasterOp (if changed) and needs to be called on any RasterOp + change. It will also start a new geometry target to embrace to the new RasterOp if + a changuing RasterOp is used. Currently, ROP_XOR and ROP_INVERT are supported using + InvertPrimitive2D, and ROP_0 by using a ModifiedColorPrimitive2D to force to black paint + */ void HandleNewRasterOp( RasterOp aRasterOp, TargetHolders& rTargetHolders, @@ -888,6 +1061,9 @@ namespace } } + /** helper to create needed data to emulate the VCL Wallpaper Metafile action. + It is a quite mighty action. This helper is for simple color filled background. + */ drawinglayer::primitive2d::BasePrimitive2D* CreateColorWallpaper( const basegfx::B2DRange& rRange, const basegfx::BColor& rColor, @@ -901,6 +1077,9 @@ namespace rColor); } + /** helper to create needed data to emulate the VCL Wallpaper Metafile action. + It is a quite mighty action. This helper is for gradient filled background. + */ drawinglayer::primitive2d::BasePrimitive2D* CreateGradientWallpaper( const basegfx::B2DRange& rRange, const Gradient& rGradient, @@ -935,6 +1114,12 @@ namespace } } + /** helper to create needed data to emulate the VCL Wallpaper Metafile action. + It is a quite mighty action. This helper decides if color and/or gradient + background is needed for the wnated bitmap fill and then creates the needed + WallpaperBitmapPrimitive2D. This primitive was created for this purpose and + takes over all needed logic of orientations and tiling. + */ void CreateAndAppendBitmapWallpaper( basegfx::B2DRange aWallpaperRange, const Wallpaper& rWallpaper, @@ -998,32 +1183,7 @@ namespace } } - drawinglayer::primitive2d::TextLine mapTextLineStyle(FontUnderline eLineStyle) - { - switch(eLineStyle) - { - case UNDERLINE_SINGLE: return drawinglayer::primitive2d::TEXT_LINE_SINGLE; - case UNDERLINE_DOUBLE: return drawinglayer::primitive2d::TEXT_LINE_DOUBLE; - case UNDERLINE_DOTTED: return drawinglayer::primitive2d::TEXT_LINE_DOTTED; - case UNDERLINE_DASH: return drawinglayer::primitive2d::TEXT_LINE_DASH; - case UNDERLINE_LONGDASH: return drawinglayer::primitive2d::TEXT_LINE_LONGDASH; - case UNDERLINE_DASHDOT: return drawinglayer::primitive2d::TEXT_LINE_DASHDOT; - case UNDERLINE_DASHDOTDOT: return drawinglayer::primitive2d::TEXT_LINE_DASHDOTDOT; - case UNDERLINE_SMALLWAVE: return drawinglayer::primitive2d::TEXT_LINE_SMALLWAVE; - case UNDERLINE_WAVE: return drawinglayer::primitive2d::TEXT_LINE_WAVE; - case UNDERLINE_DOUBLEWAVE: return drawinglayer::primitive2d::TEXT_LINE_DOUBLEWAVE; - case UNDERLINE_BOLD: return drawinglayer::primitive2d::TEXT_LINE_BOLD; - case UNDERLINE_BOLDDOTTED: return drawinglayer::primitive2d::TEXT_LINE_BOLDDOTTED; - case UNDERLINE_BOLDDASH: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASH; - case UNDERLINE_BOLDLONGDASH: return drawinglayer::primitive2d::TEXT_LINE_BOLDLONGDASH; - case UNDERLINE_BOLDDASHDOT: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASHDOT; - case UNDERLINE_BOLDDASHDOTDOT: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASHDOTDOT; - case UNDERLINE_BOLDWAVE: return drawinglayer::primitive2d::TEXT_LINE_BOLDWAVE; - // FontUnderline_FORCE_EQUAL_SIZE, UNDERLINE_DONTKNOW, UNDERLINE_NONE - default: return drawinglayer::primitive2d::TEXT_LINE_NONE; - } - } - + /** helper to decide UnderlineAbove for text primitives */ bool isUnderlineAbove(const Font& rFont) { if(!rFont.IsVertical()) @@ -1040,6 +1200,53 @@ namespace return false; } + void createFontAttributeTransformAndAlignment( + drawinglayer::attribute::FontAttribute& rFontAttribute, + basegfx::B2DHomMatrix& rTextTransform, + basegfx::B2DVector& rAlignmentOffset, + PropertyHolder& rProperty) + { + const Font& rFont = rProperty.getFont(); + basegfx::B2DVector aFontScaling; + + rFontAttribute = drawinglayer::attribute::FontAttribute( + drawinglayer::primitive2d::getFontAttributeFromVclFont( + aFontScaling, + rFont, + 0 != (rProperty.getLayoutMode() & TEXT_LAYOUT_BIDI_RTL), + 0 != (rProperty.getLayoutMode() & TEXT_LAYOUT_BIDI_STRONG))); + + // add FontScaling + rTextTransform.scale(aFontScaling.getX(), aFontScaling.getY()); + + // take text align into account + if(ALIGN_BASELINE != rFont.GetAlign()) + { + drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice; + aTextLayouterDevice.setFont(rFont); + + if(ALIGN_TOP == rFont.GetAlign()) + { + rAlignmentOffset.setY(aTextLayouterDevice.getFontAscent()); + } + else // ALIGN_BOTTOM + { + rAlignmentOffset.setY(-aTextLayouterDevice.getFontDescent()); + } + + rTextTransform.translate(rAlignmentOffset.getX(), rAlignmentOffset.getY()); + } + + // add FontRotation (if used) + if(rFont.GetOrientation()) + { + rTextTransform.rotate(-rFont.GetOrientation() * F_PI1800); + } + } + + /** helper which takes complete care for creating the needed text primitives. It + takes care of decorated stuff and all the geometry adaptions needed + */ void proccessMetaTextAction( const Point& rTextStartPosition, const XubString& rText, @@ -1052,49 +1259,19 @@ namespace drawinglayer::primitive2d::BasePrimitive2D* pResult = 0; const Font& rFont = rProperty.getFont(); std::vector< double > aDXArray; + basegfx::B2DVector aAlignmentOffset(0.0, 0.0); if(nTextLength) { - // get current font and create FontScaling and FontAttribute - basegfx::B2DVector aFontScaling; - const drawinglayer::attribute::FontAttribute aFontAttribute( - drawinglayer::primitive2d::getFontAttributeFromVclFont( - aFontScaling, - rFont, - 0 != (rProperty.getLayoutMode() & TEXT_LAYOUT_BIDI_RTL), - 0 != (rProperty.getLayoutMode() & TEXT_LAYOUT_BIDI_STRONG))); - - // create TextTransform + drawinglayer::attribute::FontAttribute aFontAttribute; basegfx::B2DHomMatrix aTextTransform; - // add FontScaling - aTextTransform.scale(aFontScaling.getX(), aFontScaling.getY()); - - // take text align into account - if(ALIGN_BASELINE != rFont.GetAlign()) - { - drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice; - aTextLayouterDevice.setFont(rFont); - - if(ALIGN_TOP == rFont.GetAlign()) - { - aTextTransform.translate( - 0.0, - aTextLayouterDevice.getFontAscent()); - } - else // ALIGN_BOTTOM - { - aTextTransform.translate( - 0.0, - -aTextLayouterDevice.getFontDescent()); - } - } - - // add FontRotation (if used) - if(rFont.GetOrientation()) - { - aTextTransform.rotate(-rFont.GetOrientation() * F_PI1800); - } + // fill parameters derived from current font + createFontAttributeTransformAndAlignment( + aFontAttribute, + aTextTransform, + aAlignmentOffset, + rProperty); // add TextStartPosition aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y()); @@ -1126,47 +1303,35 @@ namespace if(bDecoratedIsNeeded) { - // prepare overline and underline data - const drawinglayer::primitive2d::TextLine eFontOverline(mapTextLineStyle(rFont.GetOverline())); - const drawinglayer::primitive2d::TextLine eFontUnderline(mapTextLineStyle(rFont.GetUnderline())); + // prepare overline, underline and srikeout data + const drawinglayer::primitive2d::TextLine eFontOverline(drawinglayer::primitive2d::mapFontUnderlineToTextLine(rFont.GetOverline())); + const drawinglayer::primitive2d::TextLine eFontUnderline(drawinglayer::primitive2d::mapFontUnderlineToTextLine(rFont.GetUnderline())); + const drawinglayer::primitive2d::TextStrikeout eTextStrikeout(drawinglayer::primitive2d::mapFontStrikeoutToTextStrikeout(rFont.GetStrikeout())); // check UndelineAbove const bool bUnderlineAbove(drawinglayer::primitive2d::TEXT_LINE_NONE != eFontUnderline && isUnderlineAbove(rFont)); - // prepare strikeout data - drawinglayer::primitive2d::FontStrikeout eFontStrikeout(drawinglayer::primitive2d::FONT_STRIKEOUT_NONE); - - switch(rFont.GetStrikeout()) - { - case STRIKEOUT_SINGLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SINGLE; break; - case STRIKEOUT_DOUBLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_DOUBLE; break; - case STRIKEOUT_BOLD: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_BOLD; break; - case STRIKEOUT_SLASH: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SLASH; break; - case STRIKEOUT_X: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_X; break; - default : break; // FontStrikeout_FORCE_EQUAL_SIZE, STRIKEOUT_NONE, STRIKEOUT_DONTKNOW - } - // prepare emphasis mark data - drawinglayer::primitive2d::FontEmphasisMark eFontEmphasisMark(drawinglayer::primitive2d::FONT_EMPHASISMARK_NONE); + drawinglayer::primitive2d::TextEmphasisMark eTextEmphasisMark(drawinglayer::primitive2d::TEXT_EMPHASISMARK_NONE); switch(rFont.GetEmphasisMark() & EMPHASISMARK_STYLE) { - case EMPHASISMARK_DOT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DOT; break; - case EMPHASISMARK_CIRCLE : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_CIRCLE; break; - case EMPHASISMARK_DISC : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DISC; break; - case EMPHASISMARK_ACCENT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_ACCENT; break; + case EMPHASISMARK_DOT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DOT; break; + case EMPHASISMARK_CIRCLE : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_CIRCLE; break; + case EMPHASISMARK_DISC : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DISC; break; + case EMPHASISMARK_ACCENT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_ACCENT; break; } const bool bEmphasisMarkAbove(rFont.GetEmphasisMark() & EMPHASISMARK_POS_ABOVE); const bool bEmphasisMarkBelow(rFont.GetEmphasisMark() & EMPHASISMARK_POS_BELOW); // prepare font relief data - drawinglayer::primitive2d::FontRelief eFontRelief(drawinglayer::primitive2d::FONT_RELIEF_NONE); + drawinglayer::primitive2d::TextRelief eTextRelief(drawinglayer::primitive2d::TEXT_RELIEF_NONE); switch(rFont.GetRelief()) { - case RELIEF_EMBOSSED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_EMBOSSED; break; - case RELIEF_ENGRAVED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_ENGRAVED; break; + case RELIEF_EMBOSSED : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_EMBOSSED; break; + case RELIEF_ENGRAVED : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_ENGRAVED; break; default : break; // RELIEF_NONE, FontRelief_FORCE_EQUAL_SIZE } @@ -1192,12 +1357,12 @@ namespace eFontOverline, eFontUnderline, bUnderlineAbove, - eFontStrikeout, + eTextStrikeout, bWordLineMode, - eFontEmphasisMark, + eTextEmphasisMark, bEmphasisMarkAbove, bEmphasisMarkBelow, - eFontRelief, + eTextRelief, bShadow); } else @@ -1217,61 +1382,57 @@ namespace if(pResult && rProperty.getTextFillColorActive()) { + // text background is requested, add and encapsulate both to new primitive drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice; - const bool bRotated(rFont.GetOrientation()); + aTextLayouterDevice.setFont(rFont); + + // get text width + double fTextWidth(0.0); - if(bRotated) + if(aDXArray.empty()) { - // use unrotated font - Font aUnrotatedFont(rFont); - aUnrotatedFont.SetOrientation(0); - aTextLayouterDevice.setFont(aUnrotatedFont); + fTextWidth = aTextLayouterDevice.getTextWidth(rText, nTextStart, nTextLength); } else { - aTextLayouterDevice.setFont(rFont); + fTextWidth = aDXArray.back(); } - // get base range - basegfx::B2DRange aTextRange( - aTextLayouterDevice.getTextBoundRect( - rText, nTextStart, nTextLength)); - - if(aDXArray.size()) + if(basegfx::fTools::more(fTextWidth, 0.0)) { - // use the last entry in DXArray to correct the width - aTextRange = basegfx::B2DRange( - aTextRange.getMinX(), - aTextRange.getMinY(), - aTextRange.getMinX() + aDXArray[aDXArray.size() - 1], - aTextRange.getMaxY()); - } + // build text range + const basegfx::B2DRange aTextRange( + 0.0, -aTextLayouterDevice.getFontAscent(), + fTextWidth, aTextLayouterDevice.getFontDescent()); - // create Transform. Scale and Alignment are already applied. - basegfx::B2DHomMatrix aTextTransform; + // create Transform + basegfx::B2DHomMatrix aTextTransform; - if(bRotated) - { - aTextTransform.rotate(-rFont.GetOrientation() * F_PI1800); - } + aTextTransform.translate(aAlignmentOffset.getX(), aAlignmentOffset.getY()); - aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y()); + if(rFont.GetOrientation()) + { + aTextTransform.rotate(-rFont.GetOrientation() * F_PI1800); + } - // prepare Primitive2DSequence, put text in foreground - drawinglayer::primitive2d::Primitive2DSequence aSequence(2); - aSequence[1] = drawinglayer::primitive2d::Primitive2DReference(pResult); + aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y()); - // prepare filled polygon - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aTextRange)); - aOutline.transform(aTextTransform); + // prepare Primitive2DSequence, put text in foreground + drawinglayer::primitive2d::Primitive2DSequence aSequence(2); + aSequence[1] = drawinglayer::primitive2d::Primitive2DReference(pResult); - aSequence[0] = drawinglayer::primitive2d::Primitive2DReference( - new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( - basegfx::B2DPolyPolygon(aOutline), - rProperty.getTextFillColor())); + // prepare filled polygon + basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aTextRange)); + aOutline.transform(aTextTransform); + + aSequence[0] = drawinglayer::primitive2d::Primitive2DReference( + new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aOutline), + rProperty.getTextFillColor())); - // set as group at pResult - pResult = new drawinglayer::primitive2d::GroupPrimitive2D(aSequence); + // set as group at pResult + pResult = new drawinglayer::primitive2d::GroupPrimitive2D(aSequence); + } } if(pResult) @@ -1294,6 +1455,173 @@ namespace } } + /** helper which takes complete care for creating the needed textLine primitives */ + void proccessMetaTextLineAction( + const MetaTextLineAction& rAction, + TargetHolder& rTarget, + PropertyHolder& rProperty) + { + const double fLineWidth(fabs((double)rAction.GetWidth())); + + if(fLineWidth > 0.0) + { + const drawinglayer::primitive2d::TextLine aOverlineMode(drawinglayer::primitive2d::mapFontUnderlineToTextLine(rAction.GetOverline())); + const drawinglayer::primitive2d::TextLine aUnderlineMode(drawinglayer::primitive2d::mapFontUnderlineToTextLine(rAction.GetUnderline())); + const drawinglayer::primitive2d::TextStrikeout aTextStrikeout(drawinglayer::primitive2d::mapFontStrikeoutToTextStrikeout(rAction.GetStrikeout())); + + const bool bOverlineUsed(drawinglayer::primitive2d::TEXT_LINE_NONE != aOverlineMode); + const bool bUnderlineUsed(drawinglayer::primitive2d::TEXT_LINE_NONE != aUnderlineMode); + const bool bStrikeoutUsed(drawinglayer::primitive2d::TEXT_STRIKEOUT_NONE != aTextStrikeout); + + if(bUnderlineUsed || bStrikeoutUsed || bOverlineUsed) + { + std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aTargetVector; + basegfx::B2DVector aAlignmentOffset(0.0, 0.0); + drawinglayer::attribute::FontAttribute aFontAttribute; + basegfx::B2DHomMatrix aTextTransform; + + // fill parameters derived from current font + createFontAttributeTransformAndAlignment( + aFontAttribute, + aTextTransform, + aAlignmentOffset, + rProperty); + + // add TextStartPosition + aTextTransform.translate(rAction.GetStartPoint().X(), rAction.GetStartPoint().Y()); + + // prepare TextLayouter (used in most cases) + drawinglayer::primitive2d::TextLayouterDevice aTextLayouter; + aTextLayouter.setFont(rProperty.getFont()); + + if(bOverlineUsed) + { + // create primitive geometry for overline + aTargetVector.push_back( + new drawinglayer::primitive2d::TextLinePrimitive2D( + aTextTransform, + fLineWidth, + aTextLayouter.getOverlineOffset(), + aTextLayouter.getOverlineHeight(), + aOverlineMode, + rProperty.getOverlineColor())); + } + + if(bUnderlineUsed) + { + // create primitive geometry for underline + aTargetVector.push_back( + new drawinglayer::primitive2d::TextLinePrimitive2D( + aTextTransform, + fLineWidth, + aTextLayouter.getUnderlineOffset(), + aTextLayouter.getUnderlineHeight(), + aUnderlineMode, + rProperty.getTextLineColor())); + } + + if(bStrikeoutUsed) + { + // create primitive geometry for strikeout + if(drawinglayer::primitive2d::TEXT_STRIKEOUT_SLASH == aTextStrikeout + || drawinglayer::primitive2d::TEXT_STRIKEOUT_X == aTextStrikeout) + { + // strikeout with character + const sal_Unicode aStrikeoutChar( + drawinglayer::primitive2d::TEXT_STRIKEOUT_SLASH == aTextStrikeout ? '/' : 'X'); + const com::sun::star::lang::Locale aLocale(MsLangId::convertLanguageToLocale( + rProperty.getLanguageType())); + + aTargetVector.push_back( + new drawinglayer::primitive2d::TextCharacterStrikeoutPrimitive2D( + aTextTransform, + fLineWidth, + rProperty.getTextColor(), + aStrikeoutChar, + aFontAttribute, + aLocale)); + } + else + { + // strikeout with geometry + aTargetVector.push_back( + new drawinglayer::primitive2d::TextGeometryStrikeoutPrimitive2D( + aTextTransform, + fLineWidth, + rProperty.getTextColor(), + aTextLayouter.getUnderlineHeight(), + aTextLayouter.getStrikeoutOffset(), + aTextStrikeout)); + } + } + + if(aTargetVector.size()) + { + // add created text primitive to target + if(rProperty.getTransformation().isIdentity()) + { + for(sal_uInt32 a(0); a < aTargetVector.size(); a++) + { + rTarget.append(aTargetVector[a]); + } + } + else + { + // when a transformation is set, embed to it + drawinglayer::primitive2d::Primitive2DSequence xTargets(aTargetVector.size()); + + for(sal_uInt32 a(0); a < aTargetVector.size(); a++) + { + xTargets[a] = drawinglayer::primitive2d::Primitive2DReference(aTargetVector[a]); + } + + rTarget.append( + new drawinglayer::primitive2d::TransformPrimitive2D( + rProperty.getTransformation(), + xTargets)); + } + } + } + } + + } + + /** This is the main interpreter method. It is designed to handle the given Metafile + completely inside the given context and target. It may use and modify the context and + target. This design allows to call itself recursively wich adapted contexts and + targets as e.g. needed for the META_FLOATTRANSPARENT_ACTION where the content is expressed + as a metafile as sub-content. + + This interpreter is as free of VCL functionality as possible. It uses VCL data classes + (else reading the data would not be possible), but e.g. does NOT use a local OutputDevice + as most other MetaFile interpreters/exporters do to hold and work with the current context. + This is necessary to be able to get away from the strong internal VCL-binding. + + It tries to combine e.g. pixel and/or point actions and to stitch together single line primitives + where possible (which is not trivial with the possible line geometry definitions). + + It tries to handle clipping no longer as Regions and spans of Rectangles, but as PolyPolygon + ClipRegions with (where possible) high precision by using the best possible data quality + from the Region. The Region is unavoidable as data container, but nowadays allows the transport + of Polygon-based clip regions. Where this is not used, a Polygon is constructed from the + Region ranges. All primitive clipping uses the MaskPrimitive2D with Polygon-based clipping. + + I have marked the single MetaActions with: + + SIMPLE, DONE: + Simple, e.g nothing to do or value setting in the context + + CHECKED, WORKS WELL: + Thoroughly tested with extra written test code which created a replacement + Metafile just to test this action in various combinations + + NEEDS IMPLEMENTATION: + Not implemented and asserted, but also no usage found, neither in own Metafile + creations, nor in EMF/WMF imports (checked with a whole bunch of critical EMF/WMF + bugdocs) + + For more commens, see the single action implementations. + */ void interpretMetafile( const GDIMetaFile& rMetaFile, TargetHolders& rTargetHolders, @@ -1891,7 +2219,9 @@ namespace { if(rWallpaper.IsBitmap()) { - // create bitmap background + // create bitmap background. Caution: This + // also will create gradient/color background(s) + // when the bitmap is transparent or not tiled CreateAndAppendBitmapWallpaper( aWallpaperRange, rWallpaper, @@ -2160,6 +2490,9 @@ namespace case META_MAPMODE_ACTION : { /** CHECKED, WORKS WELL */ + // the most necessary MapMode to be interpreted is MAP_RELATIVE, + // but also the others may occur. Even not yet supported ones + // may need to be added here later const MetaMapModeAction* pA = (const MetaMapModeAction*)pAction; const MapMode& rMapMode = pA->GetMapMode(); basegfx::B2DHomMatrix aMapping; @@ -2216,6 +2549,34 @@ namespace /** SIMPLE, DONE */ const MetaFontAction* pA = (const MetaFontAction*)pAction; rPropertyHolders.Current().setFont(pA->GetFont()); + Size aFontSize(pA->GetFont().GetSize()); + + if(0 == aFontSize.Height()) + { + // this should not happen but i got Metafiles where this was the + // case. A height needs to be guessed (similar to OutputDevice::ImplNewFont()) + Font aCorrectedFont(pA->GetFont()); + + if(aFontSize.Width()) + { + // guess width + aFontSize = Size(0, aFontSize.Width() * 3); + } + else + { + // guess 21 pixel + aFontSize = Size(0, 21); + } + + if(aFontSize.Height() < 75) + { + // assume size is in pixels and convert + aFontSize = Application::GetDefaultDevice()->PixelToLogic(aFontSize, MAP_100TH_MM); + } + + aCorrectedFont.SetSize(aFontSize); + rPropertyHolders.Current().setFont(aCorrectedFont); + } // older Metafiles have no META_TEXTCOLOR_ACTION which defines // the FontColor now, so use the Font's color when not transparent @@ -2249,36 +2610,40 @@ namespace case META_PUSH_ACTION : { /** CHECKED, WORKS WELL */ - rPropertyHolders.Push(); + const MetaPushAction* pA = (const MetaPushAction*)pAction; + rPropertyHolders.Push(pA->GetFlags()); break; } case META_POP_ACTION : { /** CHECKED, WORKS WELL */ - if(rPropertyHolders.Current().getRegionActive()) + const bool bRegionMayChange(rPropertyHolders.Current().getPushFlags() & PUSH_CLIPREGION); + const bool bRasterOpMayChange(rPropertyHolders.Current().getPushFlags() & PUSH_RASTEROP); + + if(bRegionMayChange && rPropertyHolders.Current().getRegionActive()) { - // end clipping + // end evtl. clipping HandleNewClipRegion(0, rTargetHolders, rPropertyHolders); } - if(rPropertyHolders.Current().isRasterOpActive()) + if(bRasterOpMayChange && rPropertyHolders.Current().isRasterOpActive()) { - // end RasterOp + // end evtl. RasterOp HandleNewRasterOp(ROP_OVERPAINT, rTargetHolders, rPropertyHolders); } rPropertyHolders.Pop(); - if(rPropertyHolders.Current().isRasterOpActive()) + if(bRasterOpMayChange && rPropertyHolders.Current().isRasterOpActive()) { - // start RasterOp + // start evtl. RasterOp HandleNewRasterOp(rPropertyHolders.Current().getRasterOp(), rTargetHolders, rPropertyHolders); } - if(rPropertyHolders.Current().getRegionActive()) + if(bRegionMayChange && rPropertyHolders.Current().getRegionActive()) { - // start clipping + // start evtl. clipping HandleNewClipRegion(&rPropertyHolders.Current().getRegion(), rTargetHolders, rPropertyHolders); } @@ -2340,15 +2705,42 @@ namespace } case META_EPS_ACTION : { - /** NEEDS IMPLEMENTATION */ - OSL_ENSURE(false, "META_EPS_ACTION requested (!)"); + /** CHECKED, WORKS WELL */ + // To support this action, i have added a EpsPrimitive2D which will + // by default decompose to the Metafile replacement data. To support + // this EPS on screen, the renderer visualizing this has to support + // that primitive and visualize the Eps file (e.g. printing) const MetaEPSAction* pA = (const MetaEPSAction*)pAction; + const Rectangle aRectangle(pA->GetPoint(), pA->GetSize()); + + if(!aRectangle.IsEmpty()) + { + // create object transform + basegfx::B2DHomMatrix aObjectTransform; + + aObjectTransform.set(0, 0, aRectangle.GetWidth()); + aObjectTransform.set(1, 1, aRectangle.GetHeight()); + aObjectTransform.set(0, 2, aRectangle.Left()); + aObjectTransform.set(1, 2, aRectangle.Top()); + + // add current transformation + aObjectTransform = rPropertyHolders.Current().getTransformation() * aObjectTransform; + + // embed using EpsPrimitive + rTargetHolders.Current().append( + new drawinglayer::primitive2d::EpsPrimitive2D( + aObjectTransform, + pA->GetLink(), + pA->GetSubstitute())); + } + break; } case META_REFPOINT_ACTION : { /** SIMPLE, DONE */ - // only used for hatch and line pattern offsets + // only used for hatch and line pattern offsets, pretty much no longer + // supported today // const MetaRefPointAction* pA = (const MetaRefPointAction*)pAction; break; } @@ -2366,12 +2758,21 @@ namespace } case META_TEXTLINE_ACTION : { - /** NEEDS IMPLEMENTATION */ - OSL_ENSURE(false, "META_TEXTLINE_ACTION requested (!)"); + /** CHECKED, WORKS WELL */ // actually creates overline, underline and strikeouts, so // these should be isolated from TextDecoratedPortionPrimitive2D - // to own primitives... + // to own primitives. Done, available now. + // + // This Metaaction seems not to be used (was not used in any + // checked files). It's used in combination with the current + // Font. const MetaTextLineAction* pA = (const MetaTextLineAction*)pAction; + + proccessMetaTextLineAction( + *pA, + rTargetHolders.Current(), + rPropertyHolders.Current()); + break; } case META_FLOATTRANSPARENT_ACTION : @@ -2386,7 +2787,8 @@ namespace if(rContent.GetActionCount()) { - // create the sub-content + // create the sub-content with no embedding specific to the + // sub-metafile, this seems not to be used. drawinglayer::primitive2d::Primitive2DSequence xSubContent; { rTargetHolders.Push(); @@ -2438,7 +2840,8 @@ namespace case META_GRADIENTEX_ACTION : { /** SIMPLE, DONE */ - // This is only a data holder which is interpreted inside comment actions + // This is only a data holder which is interpreted inside comment actions, + // see META_COMMENT_ACTION for more info // const MetaGradientExAction* pA = (const MetaGradientExAction*)pAction; break; } @@ -2470,9 +2873,78 @@ namespace } case META_COMMENT_ACTION : { - /** NEEDS IMPLEMENTATION */ - OSL_ENSURE(false, "META_COMMENT_ACTION requested (!)"); + /** CHECKED, WORKS WELL */ + // I already implemented + // XPATHFILL_SEQ_BEGIN, XPATHFILL_SEQ_END + // XPATHSTROKE_SEQ_BEGIN, XPATHSTROKE_SEQ_END, + // but opted to remove these again; it works well without them + // and makes the code less dependent from those Metafile Add-Ons const MetaCommentAction* pA = (const MetaCommentAction*)pAction; + + if(COMPARE_EQUAL == pA->GetComment().CompareIgnoreCaseToAscii("XGRAD_SEQ_BEGIN")) + { + // XGRAD_SEQ_BEGIN, XGRAD_SEQ_END should be supported since the + // pure recorded paint of the gradients uses the XOR paint functionality + // ('trick'). This is (and will be) broblematic with AntAliasing, so it's + // better to use this info + const MetaGradientExAction* pMetaGradientExAction = 0; + bool bDone(false); + sal_uInt32 b(a + 1); + + for(; !bDone && b < nCount; b++) + { + pAction = rMetaFile.GetAction(b); + + if(META_GRADIENTEX_ACTION == pAction->GetType()) + { + pMetaGradientExAction = (const MetaGradientExAction*)pAction; + } + else if(META_COMMENT_ACTION == pAction->GetType()) + { + if(COMPARE_EQUAL == ((const MetaCommentAction*)pAction)->GetComment().CompareIgnoreCaseToAscii("XGRAD_SEQ_END")) + { + bDone = true; + } + } + } + + if(bDone && pMetaGradientExAction) + { + // consume actions and skip forward + a = b - 1; + + // get geometry data + basegfx::B2DPolyPolygon aPolyPolygon(pMetaGradientExAction->GetPolyPolygon().getB2DPolyPolygon()); + + if(aPolyPolygon.count()) + { + // transform geometry + aPolyPolygon.transform(rPropertyHolders.Current().getTransformation()); + + // get and check if gradient is a real gradient + const Gradient& rGradient = pMetaGradientExAction->GetGradient(); + const drawinglayer::attribute::FillGradientAttribute aAttribute(createFillGradientAttribute(rGradient)); + + if(aAttribute.getStartColor() == aAttribute.getEndColor()) + { + // not really a gradient + rTargetHolders.Current().append( + new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( + aPolyPolygon, + aAttribute.getStartColor())); + } + else + { + // really a gradient + rTargetHolders.Current().append( + new drawinglayer::primitive2d::PolyPolygonGradientPrimitive2D( + aPolyPolygon, + aAttribute)); + } + } + } + } + break; } default: @@ -2493,25 +2965,33 @@ namespace drawinglayer { Primitive2DSequence MetafilePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { + // prepare target and porperties; each will have one default entry TargetHolders aTargetHolders; PropertyHolders aPropertyHolders; + // interpret the Metafile interpretMetafile(getMetaFile(), aTargetHolders, aPropertyHolders, rViewInformation); - Primitive2DSequence xRetval = aTargetHolders.Current().getPrimitive2DSequence(aPropertyHolders.Current()); - if(xRetval.hasElements()) + // get the content. There should be ony one target, as in the start condition, + // but iterating will be the right thing to do when some push/pop is not closed + Primitive2DSequence xRetval; + + while(aTargetHolders.size() > 1) { - Rectangle aMtfTarget(getMetaFile().GetPrefMapMode().GetOrigin(), getMetaFile().GetPrefSize()); + appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, + aTargetHolders.Current().getPrimitive2DSequence(aPropertyHolders.Current())); + aTargetHolders.Pop(); + } - if(MAP_PIXEL == getMetaFile().GetPrefMapMode().GetMapUnit()) - { - aMtfTarget = Application::GetDefaultDevice()->PixelToLogic(aMtfTarget, MAP_100TH_MM); - } - else - { - aMtfTarget = Application::GetDefaultDevice()->LogicToLogic(aMtfTarget, getMetaFile().GetPrefMapMode(), MAP_100TH_MM); - } + appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, + aTargetHolders.Current().getPrimitive2DSequence(aPropertyHolders.Current())); + if(xRetval.hasElements()) + { + // get target size + const Rectangle aMtfTarget(getMetaFile().GetPrefMapMode().GetOrigin(), getMetaFile().GetPrefSize()); + + // create transformation basegfx::B2DHomMatrix aAdaptedTransform; aAdaptedTransform.translate(-aMtfTarget.Left(), -aMtfTarget.Top()); @@ -2520,6 +3000,7 @@ namespace drawinglayer aMtfTarget.getHeight() ? 1.0 / aMtfTarget.getHeight() : 1.0); aAdaptedTransform = getTransform() * aAdaptedTransform; + // embed to target transformation const Primitive2DReference aEmbeddedTransform( new TransformPrimitive2D( aAdaptedTransform, @@ -2555,8 +3036,13 @@ namespace drawinglayer basegfx::B2DRange MetafilePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const { + // use own implementation to quickly answer the getB2DRange question. The + // MetafilePrimitive2D assumes that all geometry is inside of the shape. If + // this is not the case (i have already seen some wrong Metafiles) it should + // be embedded to a MaskPrimitive2D basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0); aRetval.transform(getTransform()); + return aRetval; } diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index 9403df5376aa..f9d245f76a34 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -81,17 +81,13 @@ namespace drawinglayer // see if something else needs to be done const bool bOverlineUsed(TEXT_LINE_NONE != getFontOverline()); const bool bUnderlineUsed(TEXT_LINE_NONE != getFontUnderline()); - const bool bStrikeoutUsed(FONT_STRIKEOUT_NONE != getFontStrikeout()); + const bool bStrikeoutUsed(TEXT_STRIKEOUT_NONE != getTextStrikeout()); if(bUnderlineUsed || bStrikeoutUsed || bOverlineUsed) { // common preparations TextLayouterDevice aTextLayouter; - // unscaled is needed since scale contains already the font size - const basegfx::B2DHomMatrix aUnscaledTransform(basegfx::tools::createShearXRotateTranslateB2DHomMatrix( - rDecTrans.getShearX(), rDecTrans.getRotate(), rDecTrans.getTranslate())); - // TextLayouterDevice is needed to get metrics for text decorations like // underline/strikeout/emphasis marks from it. For setup, the font size is needed aTextLayouter.setFontAttribute( @@ -149,10 +145,10 @@ namespace drawinglayer if(bStrikeoutUsed) { // create primitive geometry for strikeout - if(FONT_STRIKEOUT_SLASH == getFontStrikeout() || FONT_STRIKEOUT_X == getFontStrikeout()) + if(TEXT_STRIKEOUT_SLASH == getTextStrikeout() || TEXT_STRIKEOUT_X == getTextStrikeout()) { // strikeout with character - const sal_Unicode aStrikeoutChar(FONT_STRIKEOUT_SLASH == getFontStrikeout() ? '/' : 'X'); + const sal_Unicode aStrikeoutChar(TEXT_STRIKEOUT_SLASH == getTextStrikeout() ? '/' : 'X'); rTarget.push_back(Primitive2DReference( new TextCharacterStrikeoutPrimitive2D( @@ -173,7 +169,7 @@ namespace drawinglayer getFontColor(), aTextLayouter.getUnderlineHeight(), aTextLayouter.getStrikeoutOffset(), - getFontStrikeout()))); + getTextStrikeout()))); } } } @@ -420,15 +416,15 @@ namespace drawinglayer } } - // Handle Shadow, Outline and FontRelief + // Handle Shadow, Outline and TextRelief if(aRetval.hasElements()) { - // outline AND shadow depend on NO FontRelief (see dialog) - const bool bHasFontRelief(FONT_RELIEF_NONE != getFontRelief()); - const bool bHasShadow(!bHasFontRelief && getShadow()); - const bool bHasOutline(!bHasFontRelief && getFontAttribute().getOutline()); + // outline AND shadow depend on NO TextRelief (see dialog) + const bool bHasTextRelief(TEXT_RELIEF_NONE != getTextRelief()); + const bool bHasShadow(!bHasTextRelief && getShadow()); + const bool bHasOutline(!bHasTextRelief && getFontAttribute().getOutline()); - if(bHasShadow || bHasFontRelief || bHasOutline) + if(bHasShadow || bHasTextRelief || bHasOutline) { Primitive2DReference aShadow; @@ -453,7 +449,7 @@ namespace drawinglayer aRetval)); } - if(bHasFontRelief) + if(bHasTextRelief) { // create emboss using an own helper primitive since this will // be view-dependent @@ -463,7 +459,7 @@ namespace drawinglayer if(bDefaultTextColor) { - if(FONT_RELIEF_ENGRAVED == getFontRelief()) + if(TEXT_RELIEF_ENGRAVED == getTextRelief()) { aTextEffectStyle2D = TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED_DEFAULT; } @@ -474,7 +470,7 @@ namespace drawinglayer } else { - if(FONT_RELIEF_ENGRAVED == getFontRelief()) + if(TEXT_RELIEF_ENGRAVED == getTextRelief()) { aTextEffectStyle2D = TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED; } @@ -535,21 +531,21 @@ namespace drawinglayer TextLine eFontOverline, TextLine eFontUnderline, bool bUnderlineAbove, - FontStrikeout eFontStrikeout, + TextStrikeout eTextStrikeout, bool bWordLineMode, - FontEmphasisMark eFontEmphasisMark, + TextEmphasisMark eTextEmphasisMark, bool bEmphasisMarkAbove, bool bEmphasisMarkBelow, - FontRelief eFontRelief, + TextRelief eTextRelief, bool bShadow) : TextSimplePortionPrimitive2D(rNewTransform, rText, aTextPosition, aTextLength, rDXArray, rFontAttribute, rLocale, rFontColor), maOverlineColor(rOverlineColor), maTextlineColor(rTextlineColor), meFontOverline(eFontOverline), meFontUnderline(eFontUnderline), - meFontStrikeout(eFontStrikeout), - meFontEmphasisMark(eFontEmphasisMark), - meFontRelief(eFontRelief), + meTextStrikeout(eTextStrikeout), + meTextEmphasisMark(eTextEmphasisMark), + meTextRelief(eTextRelief), mbUnderlineAbove(bUnderlineAbove), mbWordLineMode(bWordLineMode), mbEmphasisMarkAbove(bEmphasisMarkAbove), @@ -568,9 +564,9 @@ namespace drawinglayer && getTextlineColor() == rCompare.getTextlineColor() && getFontOverline() == rCompare.getFontOverline() && getFontUnderline() == rCompare.getFontUnderline() - && getFontStrikeout() == rCompare.getFontStrikeout() - && getFontEmphasisMark() == rCompare.getFontEmphasisMark() - && getFontRelief() == rCompare.getFontRelief() + && getTextStrikeout() == rCompare.getTextStrikeout() + && getTextEmphasisMark() == rCompare.getTextEmphasisMark() + && getTextRelief() == rCompare.getTextRelief() && getUnderlineAbove() == rCompare.getUnderlineAbove() && getWordLineMode() == rCompare.getWordLineMode() && getEmphasisMarkAbove() == rCompare.getEmphasisMarkAbove() @@ -589,9 +585,9 @@ namespace drawinglayer const bool bDecoratedIsNeeded( TEXT_LINE_NONE != getFontOverline() || TEXT_LINE_NONE != getFontUnderline() - || FONT_STRIKEOUT_NONE != getFontStrikeout() - || FONT_EMPHASISMARK_NONE != getFontEmphasisMark() - || FONT_RELIEF_NONE != getFontRelief() + || TEXT_STRIKEOUT_NONE != getTextStrikeout() + || TEXT_EMPHASISMARK_NONE != getTextEmphasisMark() + || TEXT_RELIEF_NONE != getTextRelief() || getShadow()); if(bDecoratedIsNeeded) diff --git a/drawinglayer/source/primitive2d/textenumsprimitive2d.cxx b/drawinglayer/source/primitive2d/textenumsprimitive2d.cxx new file mode 100644 index 000000000000..8b24668cb056 --- /dev/null +++ b/drawinglayer/source/primitive2d/textenumsprimitive2d.cxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textprimitive2d.cxx,v $ + * + * $Revision: 1.22 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + TextLine mapFontUnderlineToTextLine(FontUnderline eLineStyle) + { + switch(eLineStyle) + { + case UNDERLINE_SINGLE: return TEXT_LINE_SINGLE; + case UNDERLINE_DOUBLE: return TEXT_LINE_DOUBLE; + case UNDERLINE_DOTTED: return TEXT_LINE_DOTTED; + case UNDERLINE_DASH: return TEXT_LINE_DASH; + case UNDERLINE_LONGDASH: return TEXT_LINE_LONGDASH; + case UNDERLINE_DASHDOT: return TEXT_LINE_DASHDOT; + case UNDERLINE_DASHDOTDOT: return TEXT_LINE_DASHDOTDOT; + case UNDERLINE_SMALLWAVE: return TEXT_LINE_SMALLWAVE; + case UNDERLINE_WAVE: return TEXT_LINE_WAVE; + case UNDERLINE_DOUBLEWAVE: return TEXT_LINE_DOUBLEWAVE; + case UNDERLINE_BOLD: return TEXT_LINE_BOLD; + case UNDERLINE_BOLDDOTTED: return TEXT_LINE_BOLDDOTTED; + case UNDERLINE_BOLDDASH: return TEXT_LINE_BOLDDASH; + case UNDERLINE_BOLDLONGDASH: return TEXT_LINE_BOLDLONGDASH; + case UNDERLINE_BOLDDASHDOT: return TEXT_LINE_BOLDDASHDOT; + case UNDERLINE_BOLDDASHDOTDOT: return TEXT_LINE_BOLDDASHDOTDOT; + case UNDERLINE_BOLDWAVE: return TEXT_LINE_BOLDWAVE; + // FontUnderline_FORCE_EQUAL_SIZE, UNDERLINE_DONTKNOW, UNDERLINE_NONE + default: return TEXT_LINE_NONE; + } + } + + FontUnderline mapTextLineToFontUnderline(TextLine eLineStyle) + { + switch(eLineStyle) + { + default: /*TEXT_LINE_NONE*/ return UNDERLINE_NONE; + case TEXT_LINE_SINGLE: return UNDERLINE_SINGLE; + case TEXT_LINE_DOUBLE: return UNDERLINE_DOUBLE; + case TEXT_LINE_DOTTED: return UNDERLINE_DOTTED; + case TEXT_LINE_DASH: return UNDERLINE_DASH; + case TEXT_LINE_LONGDASH: return UNDERLINE_LONGDASH; + case TEXT_LINE_DASHDOT: return UNDERLINE_DASHDOT; + case TEXT_LINE_DASHDOTDOT: return UNDERLINE_DASHDOTDOT; + case TEXT_LINE_SMALLWAVE: return UNDERLINE_SMALLWAVE; + case TEXT_LINE_WAVE: return UNDERLINE_WAVE; + case TEXT_LINE_DOUBLEWAVE: return UNDERLINE_DOUBLEWAVE; + case TEXT_LINE_BOLD: return UNDERLINE_BOLD; + case TEXT_LINE_BOLDDOTTED: return UNDERLINE_BOLDDOTTED; + case TEXT_LINE_BOLDDASH: return UNDERLINE_BOLDDASH; + case TEXT_LINE_BOLDLONGDASH: return UNDERLINE_LONGDASH; + case TEXT_LINE_BOLDDASHDOT: return UNDERLINE_BOLDDASHDOT; + case TEXT_LINE_BOLDDASHDOTDOT:return UNDERLINE_BOLDDASHDOT; + case TEXT_LINE_BOLDWAVE: return UNDERLINE_BOLDWAVE; + } + } + + TextStrikeout mapFontStrikeoutToTextStrikeout(FontStrikeout eFontStrikeout) + { + switch(eFontStrikeout) + { + case STRIKEOUT_SINGLE: return TEXT_STRIKEOUT_SINGLE; + case STRIKEOUT_DOUBLE: return TEXT_STRIKEOUT_DOUBLE; + case STRIKEOUT_BOLD: return TEXT_STRIKEOUT_BOLD; + case STRIKEOUT_SLASH: return TEXT_STRIKEOUT_SLASH; + case STRIKEOUT_X: return TEXT_STRIKEOUT_X; + // FontStrikeout_FORCE_EQUAL_SIZE, STRIKEOUT_NONE, STRIKEOUT_DONTKNOW + default: return TEXT_STRIKEOUT_NONE; + } + } + + FontStrikeout mapTextStrikeoutToFontStrikeout(TextStrikeout eTextStrikeout) + { + switch(eTextStrikeout) + { + default: /*case primitive2d::TEXT_STRIKEOUT_NONE*/ return STRIKEOUT_NONE; + case TEXT_STRIKEOUT_SINGLE: return STRIKEOUT_SINGLE; + case TEXT_STRIKEOUT_DOUBLE: return STRIKEOUT_DOUBLE; + case TEXT_STRIKEOUT_BOLD: return STRIKEOUT_BOLD; + case TEXT_STRIKEOUT_SLASH: return STRIKEOUT_SLASH; + case TEXT_STRIKEOUT_X: return STRIKEOUT_X; + } + } + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx b/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx index 8b7d664dd62a..936c690d8af5 100644 --- a/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx @@ -172,8 +172,8 @@ namespace drawinglayer { Primitive2DSequence TextGeometryStrikeoutPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - OSL_ENSURE(FONT_STRIKEOUT_SLASH != getFontStrikeout() && FONT_STRIKEOUT_X != getFontStrikeout(), - "Wrong FONT_STRIKEOUT type; a TextCharacterStrikeoutPrimitive2D should be used (!)"); + OSL_ENSURE(TEXT_STRIKEOUT_SLASH != getTextStrikeout() && TEXT_STRIKEOUT_X != getTextStrikeout(), + "Wrong TEXT_STRIKEOUT type; a TextCharacterStrikeoutPrimitive2D should be used (!)"); // strikeout with geometry double fStrikeoutHeight(getHeight()); @@ -186,18 +186,18 @@ namespace drawinglayer getObjectTransformation().decompose(aScale, aTranslate, fRotate, fShearX); // set line attribute - switch(getFontStrikeout()) + switch(getTextStrikeout()) { - default : // case primitive2d::FONT_STRIKEOUT_SINGLE: + default : // case primitive2d::TEXT_STRIKEOUT_SINGLE: { break; } - case primitive2d::FONT_STRIKEOUT_DOUBLE: + case primitive2d::TEXT_STRIKEOUT_DOUBLE: { bDoubleLine = true; break; } - case primitive2d::FONT_STRIKEOUT_BOLD: + case primitive2d::TEXT_STRIKEOUT_BOLD: { fStrikeoutHeight *= 2.0; break; @@ -262,11 +262,11 @@ namespace drawinglayer const basegfx::BColor& rFontColor, double fHeight, double fOffset, - FontStrikeout eFontStrikeout) + TextStrikeout eTextStrikeout) : BaseTextStrikeoutPrimitive2D(rObjectTransformation, fWidth, rFontColor), mfHeight(fHeight), mfOffset(fOffset), - meFontStrikeout(eFontStrikeout) + meTextStrikeout(eTextStrikeout) { } @@ -278,7 +278,7 @@ namespace drawinglayer return (getHeight() == rCompare.getHeight() && getOffset() == rCompare.getOffset() - && getFontStrikeout() == rCompare.getFontStrikeout()); + && getTextStrikeout() == rCompare.getTextStrikeout()); } return false; diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 062af73f5f0a..a99115a095c4 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -74,6 +74,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // for PDFExtOutDevData Graphic support @@ -1805,6 +1806,11 @@ namespace drawinglayer break; } + case PRIMITIVE2D_ID_EPSPRIMITIVE2D : + { + RenderEpsPrimitive2D(static_cast< const primitive2d::EpsPrimitive2D& >(rCandidate)); + break; + } default : { // process recursively diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 51192f2dc72f..5a74b0471b7f 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -68,6 +68,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -235,6 +236,7 @@ namespace drawinglayer static bool bTestMetaFilePrimitiveDecomposition(true); if(bTestMetaFilePrimitiveDecomposition) { + // use new Metafile decomposition process(rCandidate.get2DDecomposition(getViewInformation2D())); } else @@ -557,6 +559,11 @@ namespace drawinglayer mpOutputDevice->SetAntialiasing(nAntiAliasing); break; } + case PRIMITIVE2D_ID_EPSPRIMITIVE2D : + { + RenderEpsPrimitive2D(static_cast< const primitive2d::EpsPrimitive2D& >(rCandidate)); + break; + } default : { // process recursively diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 127d4845e672..40f3eebcc78b 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -64,6 +64,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // control support @@ -100,34 +101,6 @@ namespace drawinglayer using ::com::sun::star::awt::XWindow; using ::com::sun::star::awt::PosSize::POSSIZE; - static FontUnderline mapTextLineStyle(drawinglayer::primitive2d::TextLine eLineStyle) - { - switch(eLineStyle) - { - default: - DBG_WARNING1( "DrawingLayer: Unknown text line style attribute (%d)!", eLineStyle ); - // fall through - case primitive2d::TEXT_LINE_NONE: return UNDERLINE_NONE; - case primitive2d::TEXT_LINE_SINGLE: return UNDERLINE_SINGLE; - case primitive2d::TEXT_LINE_DOUBLE: return UNDERLINE_DOUBLE; - case primitive2d::TEXT_LINE_DOTTED: return UNDERLINE_DOTTED; - case primitive2d::TEXT_LINE_DASH: return UNDERLINE_DASH; - case primitive2d::TEXT_LINE_LONGDASH: return UNDERLINE_LONGDASH; - case primitive2d::TEXT_LINE_DASHDOT: return UNDERLINE_DASHDOT; - case primitive2d::TEXT_LINE_DASHDOTDOT: return UNDERLINE_DASHDOTDOT; - case primitive2d::TEXT_LINE_SMALLWAVE: return UNDERLINE_SMALLWAVE; - case primitive2d::TEXT_LINE_WAVE: return UNDERLINE_WAVE; - case primitive2d::TEXT_LINE_DOUBLEWAVE: return UNDERLINE_DOUBLEWAVE; - case primitive2d::TEXT_LINE_BOLD: return UNDERLINE_BOLD; - case primitive2d::TEXT_LINE_BOLDDOTTED: return UNDERLINE_BOLDDOTTED; - case primitive2d::TEXT_LINE_BOLDDASH: return UNDERLINE_BOLDDASH; - case primitive2d::TEXT_LINE_BOLDLONGDASH: return UNDERLINE_LONGDASH; - case primitive2d::TEXT_LINE_BOLDDASHDOT: return UNDERLINE_BOLDDASHDOT; - case primitive2d::TEXT_LINE_BOLDDASHDOTDOT:return UNDERLINE_BOLDDASHDOT; - case primitive2d::TEXT_LINE_BOLDWAVE: return UNDERLINE_BOLDWAVE; - } - } - ////////////////////////////////////////////////////////////////////////////// // rendering support @@ -177,7 +150,7 @@ namespace drawinglayer mpOutputDevice->SetTextLineColor( Color(aTextlineColor) ); // set Overline attribute - const FontUnderline eFontOverline(mapTextLineStyle( pTCPP->getFontOverline() )); + const FontUnderline eFontOverline(mapTextLineToFontUnderline( pTCPP->getFontOverline() )); if( eFontOverline != UNDERLINE_NONE ) { aFont.SetOverline( eFontOverline ); @@ -188,7 +161,7 @@ namespace drawinglayer } // set Underline attribute - const FontUnderline eFontUnderline(mapTextLineStyle( pTCPP->getFontUnderline() )); + const FontUnderline eFontUnderline(mapTextLineToFontUnderline( pTCPP->getFontUnderline() )); if( eFontUnderline != UNDERLINE_NONE ) { aFont.SetUnderline( eFontUnderline ); @@ -199,35 +172,23 @@ namespace drawinglayer } // set Strikeout attribute - FontStrikeout eFontStrikeout = STRIKEOUT_NONE; - switch( pTCPP->getFontStrikeout() ) - { - default: - DBG_WARNING1( "DrawingLayer: Unknown strikeout attribute (%d)!", pTCPP->getFontStrikeout() ); - // fall through - case primitive2d::FONT_STRIKEOUT_NONE: eFontStrikeout = STRIKEOUT_NONE; break; - case primitive2d::FONT_STRIKEOUT_SINGLE: eFontStrikeout = STRIKEOUT_SINGLE; break; - case primitive2d::FONT_STRIKEOUT_DOUBLE: eFontStrikeout = STRIKEOUT_DOUBLE; break; - case primitive2d::FONT_STRIKEOUT_BOLD: eFontStrikeout = STRIKEOUT_BOLD; break; - case primitive2d::FONT_STRIKEOUT_SLASH: eFontStrikeout = STRIKEOUT_SLASH; break; - case primitive2d::FONT_STRIKEOUT_X: eFontStrikeout = STRIKEOUT_X; break; - } + const FontStrikeout eFontStrikeout(mapTextStrikeoutToFontStrikeout(pTCPP->getTextStrikeout())); if( eFontStrikeout != STRIKEOUT_NONE ) aFont.SetStrikeout( eFontStrikeout ); // set EmphasisMark attribute FontEmphasisMark eFontEmphasisMark = EMPHASISMARK_NONE; - switch( pTCPP->getFontEmphasisMark() ) + switch( pTCPP->getTextEmphasisMark() ) { default: - DBG_WARNING1( "DrawingLayer: Unknown EmphasisMark style (%d)!", pTCPP->getFontEmphasisMark() ); + DBG_WARNING1( "DrawingLayer: Unknown EmphasisMark style (%d)!", pTCPP->getTextEmphasisMark() ); // fall through - case primitive2d::FONT_EMPHASISMARK_NONE: eFontEmphasisMark = EMPHASISMARK_NONE; break; - case primitive2d::FONT_EMPHASISMARK_DOT: eFontEmphasisMark = EMPHASISMARK_DOT; break; - case primitive2d::FONT_EMPHASISMARK_CIRCLE: eFontEmphasisMark = EMPHASISMARK_CIRCLE; break; - case primitive2d::FONT_EMPHASISMARK_DISC: eFontEmphasisMark = EMPHASISMARK_DISC; break; - case primitive2d::FONT_EMPHASISMARK_ACCENT: eFontEmphasisMark = EMPHASISMARK_ACCENT; break; + case primitive2d::TEXT_EMPHASISMARK_NONE: eFontEmphasisMark = EMPHASISMARK_NONE; break; + case primitive2d::TEXT_EMPHASISMARK_DOT: eFontEmphasisMark = EMPHASISMARK_DOT; break; + case primitive2d::TEXT_EMPHASISMARK_CIRCLE: eFontEmphasisMark = EMPHASISMARK_CIRCLE; break; + case primitive2d::TEXT_EMPHASISMARK_DISC: eFontEmphasisMark = EMPHASISMARK_DISC; break; + case primitive2d::TEXT_EMPHASISMARK_ACCENT: eFontEmphasisMark = EMPHASISMARK_ACCENT; break; } if( eFontEmphasisMark != EMPHASISMARK_NONE ) @@ -243,14 +204,14 @@ namespace drawinglayer // set Relief attribute FontRelief eFontRelief = RELIEF_NONE; - switch( pTCPP->getFontRelief() ) + switch( pTCPP->getTextRelief() ) { default: - DBG_WARNING1( "DrawingLayer: Unknown Relief style (%d)!", pTCPP->getFontRelief() ); + DBG_WARNING1( "DrawingLayer: Unknown Relief style (%d)!", pTCPP->getTextRelief() ); // fall through - case primitive2d::FONT_RELIEF_NONE: eFontRelief = RELIEF_NONE; break; - case primitive2d::FONT_RELIEF_EMBOSSED: eFontRelief = RELIEF_EMBOSSED; break; - case primitive2d::FONT_RELIEF_ENGRAVED: eFontRelief = RELIEF_ENGRAVED; break; + case primitive2d::TEXT_RELIEF_NONE: eFontRelief = RELIEF_NONE; break; + case primitive2d::TEXT_RELIEF_EMBOSSED: eFontRelief = RELIEF_EMBOSSED; break; + case primitive2d::TEXT_RELIEF_ENGRAVED: eFontRelief = RELIEF_ENGRAVED; break; } if( eFontRelief != RELIEF_NONE ) @@ -1270,6 +1231,36 @@ namespace drawinglayer } } + void VclProcessor2D::RenderEpsPrimitive2D(const primitive2d::EpsPrimitive2D& rEpsPrimitive2D) + { + // The new decomposition of Metafiles made it necessary to add an Eps + // primitive to handle embedded Eps data. On some devices, this can be + // painted directly (mac, printer). Printer is handled in the + // VclMetafileProcessor2D by not decomposing the Metafiles at all. + // For Mac, the Eps should be painted directly, but unfortunately cannot + // be tested (only in the salgdi layer where true/false is returned). + // To risk nothing currently, always render it using VCL + basegfx::B2DRange aRange(0.0, 0.0, 1.0, 1.0); + aRange.transform(rEpsPrimitive2D.getEpsTransform()); + + if(!aRange.isEmpty()) + { + const Rectangle aRectangle( + (sal_Int32)floor(aRange.getMinX()), (sal_Int32)floor(aRange.getMinY()), + (sal_Int32)ceil(aRange.getMaxX()), (sal_Int32)ceil(aRange.getMaxY())); + + if(!aRectangle.IsEmpty()) + { + const GDIMetaFile& rMetafile = rEpsPrimitive2D.getMetaFile(); + mpOutputDevice->DrawEPS( + aRectangle.TopLeft(), + aRectangle.GetSize(), + rEpsPrimitive2D.getGfxLink(), + rMetafile.GetActionCount() ? const_cast(&rMetafile) : 0); + } + } + } + void VclProcessor2D::adaptLineToFillDrawMode() const { const sal_uInt32 nOriginalDrawMode(mpOutputDevice->GetDrawMode()); diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index d45eb70f2f3f..1e8556aed201 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -80,32 +80,6 @@ namespace return aRetval; } - static drawinglayer::primitive2d::TextLine mapTextLineStyle(FontUnderline eLineStyle) - { - switch(eLineStyle) - { - case UNDERLINE_SINGLE: return drawinglayer::primitive2d::TEXT_LINE_SINGLE; - case UNDERLINE_DOUBLE: return drawinglayer::primitive2d::TEXT_LINE_DOUBLE; - case UNDERLINE_DOTTED: return drawinglayer::primitive2d::TEXT_LINE_DOTTED; - case UNDERLINE_DASH: return drawinglayer::primitive2d::TEXT_LINE_DASH; - case UNDERLINE_LONGDASH: return drawinglayer::primitive2d::TEXT_LINE_LONGDASH; - case UNDERLINE_DASHDOT: return drawinglayer::primitive2d::TEXT_LINE_DASHDOT; - case UNDERLINE_DASHDOTDOT: return drawinglayer::primitive2d::TEXT_LINE_DASHDOTDOT; - case UNDERLINE_SMALLWAVE: return drawinglayer::primitive2d::TEXT_LINE_SMALLWAVE; - case UNDERLINE_WAVE: return drawinglayer::primitive2d::TEXT_LINE_WAVE; - case UNDERLINE_DOUBLEWAVE: return drawinglayer::primitive2d::TEXT_LINE_DOUBLEWAVE; - case UNDERLINE_BOLD: return drawinglayer::primitive2d::TEXT_LINE_BOLD; - case UNDERLINE_BOLDDOTTED: return drawinglayer::primitive2d::TEXT_LINE_BOLDDOTTED; - case UNDERLINE_BOLDDASH: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASH; - case UNDERLINE_BOLDLONGDASH: return drawinglayer::primitive2d::TEXT_LINE_BOLDLONGDASH; - case UNDERLINE_BOLDDASHDOT: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASHDOT; - case UNDERLINE_BOLDDASHDOTDOT: return drawinglayer::primitive2d::TEXT_LINE_BOLDDASHDOTDOT; - case UNDERLINE_BOLDWAVE: return drawinglayer::primitive2d::TEXT_LINE_BOLDWAVE; - // FontUnderline_FORCE_EQUAL_SIZE, UNDERLINE_DONTKNOW, UNDERLINE_NONE - default: return drawinglayer::primitive2d::TEXT_LINE_NONE; - } - } - class impTextBreakupHandler { private: @@ -322,46 +296,40 @@ namespace const basegfx::BColor aBOverlineColor((0xffffffff == aOverlineColor.GetColor()) ? aBFontColor : aOverlineColor.getBColor()); // prepare overline and underline data - const drawinglayer::primitive2d::TextLine eFontOverline(mapTextLineStyle(rInfo.mrFont.GetOverline())); - const drawinglayer::primitive2d::TextLine eFontUnderline(mapTextLineStyle(rInfo.mrFont.GetUnderline())); + const drawinglayer::primitive2d::TextLine eFontOverline( + drawinglayer::primitive2d::mapFontUnderlineToTextLine(rInfo.mrFont.GetOverline())); + const drawinglayer::primitive2d::TextLine eFontUnderline( + drawinglayer::primitive2d::mapFontUnderlineToTextLine(rInfo.mrFont.GetUnderline())); // check UndelineAbove - const bool bUnderlineAbove(drawinglayer::primitive2d::TEXT_LINE_NONE != eFontUnderline && impIsUnderlineAbove(rInfo.mrFont)); + const bool bUnderlineAbove( + drawinglayer::primitive2d::TEXT_LINE_NONE != eFontUnderline && impIsUnderlineAbove(rInfo.mrFont)); // prepare strikeout data - drawinglayer::primitive2d::FontStrikeout eFontStrikeout(drawinglayer::primitive2d::FONT_STRIKEOUT_NONE); - - switch(rInfo.mrFont.GetStrikeout()) - { - case STRIKEOUT_SINGLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SINGLE; break; - case STRIKEOUT_DOUBLE: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_DOUBLE; break; - case STRIKEOUT_BOLD: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_BOLD; break; - case STRIKEOUT_SLASH: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_SLASH; break; - case STRIKEOUT_X: eFontStrikeout = drawinglayer::primitive2d::FONT_STRIKEOUT_X; break; - default : break; // FontStrikeout_FORCE_EQUAL_SIZE, STRIKEOUT_NONE, STRIKEOUT_DONTKNOW - } + const drawinglayer::primitive2d::TextStrikeout eTextStrikeout( + drawinglayer::primitive2d::mapFontStrikeoutToTextStrikeout(rInfo.mrFont.GetStrikeout())); // prepare emphasis mark data - drawinglayer::primitive2d::FontEmphasisMark eFontEmphasisMark(drawinglayer::primitive2d::FONT_EMPHASISMARK_NONE); + drawinglayer::primitive2d::TextEmphasisMark eTextEmphasisMark(drawinglayer::primitive2d::TEXT_EMPHASISMARK_NONE); switch(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE) { - case EMPHASISMARK_DOT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DOT; break; - case EMPHASISMARK_CIRCLE : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_CIRCLE; break; - case EMPHASISMARK_DISC : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_DISC; break; - case EMPHASISMARK_ACCENT : eFontEmphasisMark = drawinglayer::primitive2d::FONT_EMPHASISMARK_ACCENT; break; + case EMPHASISMARK_DOT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DOT; break; + case EMPHASISMARK_CIRCLE : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_CIRCLE; break; + case EMPHASISMARK_DISC : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DISC; break; + case EMPHASISMARK_ACCENT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_ACCENT; break; } const bool bEmphasisMarkAbove(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_ABOVE); const bool bEmphasisMarkBelow(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_BELOW); // prepare font relief data - drawinglayer::primitive2d::FontRelief eFontRelief(drawinglayer::primitive2d::FONT_RELIEF_NONE); + drawinglayer::primitive2d::TextRelief eTextRelief(drawinglayer::primitive2d::TEXT_RELIEF_NONE); switch(rInfo.mrFont.GetRelief()) { - case RELIEF_EMBOSSED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_EMBOSSED; break; - case RELIEF_ENGRAVED : eFontRelief = drawinglayer::primitive2d::FONT_RELIEF_ENGRAVED; break; + case RELIEF_EMBOSSED : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_EMBOSSED; break; + case RELIEF_ENGRAVED : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_ENGRAVED; break; default : break; // RELIEF_NONE, FontRelief_FORCE_EQUAL_SIZE } @@ -387,12 +355,12 @@ namespace eFontOverline, eFontUnderline, bUnderlineAbove, - eFontStrikeout, + eTextStrikeout, bWordLineMode, - eFontEmphasisMark, + eTextEmphasisMark, bEmphasisMarkAbove, bEmphasisMarkBelow, - eFontRelief, + eTextRelief, bShadow); } else -- cgit v1.2.3 From 5a68fee42aa92563adb8fa777bd680105792a89d Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 18 Nov 2009 13:08:25 +0100 Subject: aw078: changes after resync to DEV300m64 --- .../inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx | 6 +++--- drawinglayer/source/geometry/viewinformation2d.cxx | 2 +- drawinglayer/source/primitive2d/epsprimitive2d.cxx | 2 +- drawinglayer/source/primitive2d/metafileprimitive2d.cxx | 10 +++++----- drawinglayer/source/processor2d/hittestprocessor2d.cxx | 5 +++-- svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx | 5 +++-- 6 files changed, 16 insertions(+), 14 deletions(-) (limited to 'drawinglayer/inc/drawinglayer/primitive2d') diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index 8c0512402120..187e89f42e97 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -368,12 +368,12 @@ namespace drawinglayer /// the PolyPolygon geometry basegfx::B2DPolyPolygon maPolyPolygon; - /// the hatch definition - attribute::FillHatchAttribute maFillHatch; - /// the hatch background color (if used) basegfx::BColor maBackgroundColor; + /// the hatch definition + attribute::FillHatchAttribute maFillHatch; + protected: /// local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index e03c946edf9e..3a3fd68831db 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -157,7 +157,7 @@ namespace drawinglayer mxExtendedInformation[nExtendedInsert++] = rProp; // for performance reasons, also cache content locally - sal_Bool bSalBool; + sal_Bool bSalBool(false); rProp.Value >>= bSalBool; mbReducedDisplayQuality = bSalBool; } diff --git a/drawinglayer/source/primitive2d/epsprimitive2d.cxx b/drawinglayer/source/primitive2d/epsprimitive2d.cxx index dc8128ab1386..5854e90cfb9f 100644 --- a/drawinglayer/source/primitive2d/epsprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/epsprimitive2d.cxx @@ -92,7 +92,7 @@ namespace drawinglayer return false; } - basegfx::B2DRange EpsPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + basegfx::B2DRange EpsPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const { // use own implementation to quickly answer the getB2DRange question. basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0); diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 8434146c6f3a..e618093a7457 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -1930,9 +1930,9 @@ namespace // the metafile play interprets the single polygons from MetaPolyPolygonAction // always as closed and always paints an edge from last to first point, // so force to closed here to emulate that - for(sal_uInt32 a(0); a < aPolyPolygonOutline.count(); a++) + for(sal_uInt32 b(0); b < aPolyPolygonOutline.count(); b++) { - basegfx::B2DPolygon aPolygonOutline(aPolyPolygonOutline.getB2DPolygon(a)); + basegfx::B2DPolygon aPolygonOutline(aPolyPolygonOutline.getB2DPolygon(b)); if(aPolygonOutline.count() > 1 && !aPolygonOutline.isClosed()) { @@ -1989,14 +1989,14 @@ namespace /** NEEDS IMPLEMENTATION */ OSL_ENSURE(false, "META_STRETCHTEXT_ACTION requested (!)"); // use OutputDevice::GetTextArray() to map the... - const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pAction; + // const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pAction; break; } case META_TEXTRECT_ACTION : { /** NEEDS IMPLEMENTATION */ OSL_ENSURE(false, "META_TEXTRECT_ACTION requested (!)"); - const MetaTextRectAction* pA = (const MetaTextRectAction*)pAction; + // const MetaTextRectAction* pA = (const MetaTextRectAction*)pAction; break; } case META_BMP_ACTION : @@ -2655,7 +2655,7 @@ namespace const MetaRasterOpAction* pA = (const MetaRasterOpAction*)pAction; const RasterOp aRasterOp = pA->GetRasterOp(); - HandleNewRasterOp(pA->GetRasterOp(), rTargetHolders, rPropertyHolders); + HandleNewRasterOp(aRasterOp, rTargetHolders, rPropertyHolders); break; } diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index 09eb6e3e71f6..ce9cadb6b40a 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -449,8 +449,9 @@ namespace drawinglayer { if(!getHitTextOnly()) { - const primitive2d::ScenePrimitive2D& rCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); - check3DHit(rCandidate); + const primitive2d::ScenePrimitive2D& rScenePrimitive2D( + static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); + check3DHit(rScenePrimitive2D); } break; diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx index 0b2f8bf698c1..72035eb99569 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx @@ -56,13 +56,14 @@ 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; // defines that the object contains/is a 3D AutoShape. Needed for // making exceptions with shadow generation unsigned mb3DShape : 1; + // #SJ# Allow text clipping against TextBox in special cases (used for SC) + unsigned mbForceTextClipToTextRange : 1; + protected: // local decomposition. virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; -- cgit v1.2.3 From 3137d89c8a7632b89f55fdd638bca027593225b3 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Mon, 23 Nov 2009 12:30:29 +0100 Subject: aw078: #i106541# MetaTextRectAction implementation added, corrected/changed FontHandling when no FontSize is given --- .../drawinglayer/primitive2d/textlayoutdevice.hxx | 7 +++ .../source/primitive2d/graphicprimitive2d.cxx | 25 ++++++-- .../source/primitive2d/metafileprimitive2d.cxx | 73 ++++++++++++++++------ .../source/primitive2d/textlayoutdevice.cxx | 10 +++ drawinglayer/source/processor2d/vclprocessor2d.cxx | 25 +++++--- 5 files changed, 108 insertions(+), 32 deletions(-) (limited to 'drawinglayer/inc/drawinglayer/primitive2d') diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx index f454459211df..f3de43c22fd7 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx @@ -49,6 +49,7 @@ class VirtualDevice; class Font; class String; class OutputDevice; +class GDIMetaFile; namespace drawinglayer { namespace attribute { class FontAttribute; @@ -117,6 +118,12 @@ namespace drawinglayer double getFontAscent() const; double getFontDescent() const; + + void addTextRectActions( + const Rectangle& rRectangle, + const String& rText, + sal_uInt16 nStyle, + GDIMetaFile& rGDIMetaFile); }; } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index d7d3929a7a56..d224aca16709 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -55,6 +55,15 @@ #include #include +////////////////////////////////////////////////////////////////////////////// +// includes for testing MetafilePrimitive2D::create2DDecomposition + +#ifdef DBG_UTIL +#include +#include +#include +#endif // DBG_UTIL + ////////////////////////////////////////////////////////////////////////////// namespace @@ -207,10 +216,6 @@ namespace ////////////////////////////////////////////////////////////////////////////// -#include -#include -#include - namespace drawinglayer { namespace primitive2d @@ -297,11 +302,17 @@ namespace drawinglayer case GRAPHIC_GDIMETAFILE : { - // create MetafilePrimitive2D +#ifdef DBG_UTIL static bool bDoTest(false); if(bDoTest) { + // All this is/was test code for testing MetafilePrimitive2D::create2DDecomposition + // extensively. It may be needed again when diverse actions need debugging, so i leave + // it in here, but take it out using DBG_UTIL. + // Use it by compiling with the code, insert any DrawObject, convert to Metafile. The + // debugger will then stop here (when breakpoint set, of course). You may enter single + // parts of actions and/or change to true what You want to check. GDIMetaFile aMtf; VirtualDevice aOut; const basegfx::B2DRange aRange(getB2DRange(rViewInformation)); @@ -729,6 +740,8 @@ namespace drawinglayer } else { +#endif // DBG_UTIL + // create MetafilePrimitive2D const Graphic aGraphic(getGraphicObject().GetGraphic()); const GDIMetaFile& rMetafile = aTransformedGraphic.GetGDIMetaFile(); @@ -760,7 +773,9 @@ namespace drawinglayer basegfx::B2DPolyPolygon(aMaskPolygon), aChildContent)); } +#ifdef DBG_UTIL } +#endif // DBG_UTIL break; } diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index e618093a7457..94e642d06469 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -1994,9 +1994,53 @@ namespace } case META_TEXTRECT_ACTION : { - /** NEEDS IMPLEMENTATION */ - OSL_ENSURE(false, "META_TEXTRECT_ACTION requested (!)"); - // const MetaTextRectAction* pA = (const MetaTextRectAction*)pAction; + /** CHECKED, WORKS WELL */ + // OSL_ENSURE(false, "META_TEXTRECT_ACTION requested (!)"); + const MetaTextRectAction* pA = (const MetaTextRectAction*)pAction; + const Rectangle& rRectangle = pA->GetRect(); + + if(!rRectangle.IsEmpty() && 0 != pA->GetText().Len()) + { + // The problem with this action is that it describes unlayouted text + // and the layout capabilities are in EditEngine/Outliner in SVX. The + // same problem is true for VCL which internally has implementations + // to layout text in this case. There exists even a call + // OutputDevice::AddTextRectActions(...) to create the needed actions + // as 'sub-content' of a Metafile. Unfortunately i do not have an + // OutputDevice here since this interpreter tries to work without + // VCL AFAP. + // Since AddTextRectActions is the only way as long as we do not have + // a simple text layouter available, i will try to add it to the + // TextLayouterDevice isloation. + drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice; + aTextLayouterDevice.setFont(rPropertyHolders.Current().getFont()); + GDIMetaFile aGDIMetaFile; + + aTextLayouterDevice.addTextRectActions( + rRectangle, pA->GetText(), pA->GetStyle(), aGDIMetaFile); + + if(aGDIMetaFile.GetActionCount()) + { + // cerate sub-content + drawinglayer::primitive2d::Primitive2DSequence xSubContent; + { + rTargetHolders.Push(); + interpretMetafile(aGDIMetaFile, rTargetHolders, rPropertyHolders, rViewInformation); + xSubContent = rTargetHolders.Current().getPrimitive2DSequence(rPropertyHolders.Current()); + rTargetHolders.Pop(); + } + + if(xSubContent.hasElements()) + { + // add with transformation + rTargetHolders.Current().append( + new drawinglayer::primitive2d::TransformPrimitive2D( + rPropertyHolders.Current().getTransformation(), + xSubContent)); + } + } + } + break; } case META_BMP_ACTION : @@ -2557,22 +2601,12 @@ namespace // case. A height needs to be guessed (similar to OutputDevice::ImplNewFont()) Font aCorrectedFont(pA->GetFont()); - if(aFontSize.Width()) - { - // guess width - aFontSize = Size(0, aFontSize.Width() * 3); - } - else - { - // guess 21 pixel - aFontSize = Size(0, 21); - } + // guess 16 pixel (as in VCL) + aFontSize = Size(0, 16); - if(aFontSize.Height() < 75) - { - // assume size is in pixels and convert - aFontSize = Application::GetDefaultDevice()->PixelToLogic(aFontSize, MAP_100TH_MM); - } + // convert to target MapUnit if not pixels + aFontSize = Application::GetDefaultDevice()->LogicToLogic( + aFontSize, MAP_PIXEL, rPropertyHolders.Current().getMapUnit()); aCorrectedFont.SetSize(aFontSize); rPropertyHolders.Current().setFont(aCorrectedFont); @@ -2969,6 +3003,9 @@ namespace drawinglayer TargetHolders aTargetHolders; PropertyHolders aPropertyHolders; + // set target MapUnit at Properties + aPropertyHolders.Current().setMapUnit(getMetaFile().GetPrefMapMode().GetMapUnit()); + // interpret the Metafile interpretMetafile(getMetaFile(), aTargetHolders, aPropertyHolders, rViewInformation); diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index f24398a1a6ac..2950427d6b57 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -309,6 +309,16 @@ namespace drawinglayer const ::FontMetric& rMetric = mrDevice.GetFontMetric(); return rMetric.GetDescent(); } + + void TextLayouterDevice::addTextRectActions( + const Rectangle& rRectangle, + const String& rText, + sal_uInt16 nStyle, + GDIMetaFile& rGDIMetaFile) + { + mrDevice.AddTextRectActions( + rRectangle, rText, nStyle, rGDIMetaFile); + } } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 40f3eebcc78b..9def01619286 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -1235,13 +1235,13 @@ namespace drawinglayer { // The new decomposition of Metafiles made it necessary to add an Eps // primitive to handle embedded Eps data. On some devices, this can be - // painted directly (mac, printer). Printer is handled in the - // VclMetafileProcessor2D by not decomposing the Metafiles at all. - // For Mac, the Eps should be painted directly, but unfortunately cannot - // be tested (only in the salgdi layer where true/false is returned). - // To risk nothing currently, always render it using VCL + // painted directly (mac, printer). + // To be able to handle the replacement correctly, i need to handle it myself + // since DrawEPS will not be able e.g. to rotate the replacement. To be able + // to do that, i added a boolean return to OutputDevice::DrawEPS(..) + // to know when EPS was handled directly already. basegfx::B2DRange aRange(0.0, 0.0, 1.0, 1.0); - aRange.transform(rEpsPrimitive2D.getEpsTransform()); + aRange.transform(maCurrentTransformation * rEpsPrimitive2D.getEpsTransform()); if(!aRange.isEmpty()) { @@ -1251,12 +1251,19 @@ namespace drawinglayer if(!aRectangle.IsEmpty()) { - const GDIMetaFile& rMetafile = rEpsPrimitive2D.getMetaFile(); - mpOutputDevice->DrawEPS( + // try to paint EPS directly without fallback visualisation + const bool bEPSPaintedDirectly(mpOutputDevice->DrawEPS( aRectangle.TopLeft(), aRectangle.GetSize(), rEpsPrimitive2D.getGfxLink(), - rMetafile.GetActionCount() ? const_cast(&rMetafile) : 0); + 0)); + + if(!bEPSPaintedDirectly) + { + // use the decomposition which will correctly handle the + // fallback visualisation using full transformation (e.g. rotation) + process(rEpsPrimitive2D.get2DDecomposition(getViewInformation2D())); + } } } } -- cgit v1.2.3 From 3f1ff108b3379c52b3ddb848cc1c603f554d0967 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 24 Nov 2009 12:13:33 +0100 Subject: #i103340# added MaskPrimitive2D::getB2DRange implementation --- drawinglayer/inc/drawinglayer/primitive2d/maskprimitive2d.hxx | 3 +++ drawinglayer/source/primitive2d/maskprimitive2d.cxx | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'drawinglayer/inc/drawinglayer/primitive2d') diff --git a/drawinglayer/inc/drawinglayer/primitive2d/maskprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/maskprimitive2d.hxx index 72d5bd3b9b6b..e5cb12e6e87c 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/maskprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/maskprimitive2d.hxx @@ -77,6 +77,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/source/primitive2d/maskprimitive2d.cxx b/drawinglayer/source/primitive2d/maskprimitive2d.cxx index 20a4c98db67d..b32abae874ca 100644 --- a/drawinglayer/source/primitive2d/maskprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/maskprimitive2d.cxx @@ -69,6 +69,11 @@ namespace drawinglayer return false; } + basegfx::B2DRange MaskPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + return getMask().getB2DRange(); + } + // provide unique ID ImplPrimitrive2DIDBlock(MaskPrimitive2D, PRIMITIVE2D_ID_MASKPRIMITIVE2D) -- cgit v1.2.3