diff options
Diffstat (limited to 'oox/inc/oox/drawingml/fillpropertiesgroupcontext.hxx')
-rw-r--r-- | oox/inc/oox/drawingml/fillpropertiesgroupcontext.hxx | 194 |
1 files changed, 160 insertions, 34 deletions
diff --git a/oox/inc/oox/drawingml/fillpropertiesgroupcontext.hxx b/oox/inc/oox/drawingml/fillpropertiesgroupcontext.hxx index a9e04c1e3309..ab4c1b3e3a9a 100644 --- a/oox/inc/oox/drawingml/fillpropertiesgroupcontext.hxx +++ b/oox/inc/oox/drawingml/fillpropertiesgroupcontext.hxx @@ -31,62 +31,188 @@ #ifndef OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP #define OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP -#include "oox/core/contexthandler.hxx" -#include <com/sun/star/drawing/BitmapMode.hpp> +#include "oox/drawingml/colorchoicecontext.hxx" +#include "oox/drawingml/fillproperties.hxx" -namespace oox { namespace drawingml { +namespace oox { +namespace drawingml { -struct FillProperties; +// ============================================================================ -// --------------------------------------------------------------------- +/** Context handler that imports the a:solidFill element. */ +class SolidFillContext : public ColorContext +{ +public: + explicit SolidFillContext( + ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + FillProperties& rFillProps ); +}; -class FillPropertiesGroupContext : public ::oox::core::ContextHandler +// ============================================================================ + +/** Context handler that imports the a:gradFill element. */ +class GradientFillContext : public ::oox::core::ContextHandler { public: - FillPropertiesGroupContext( ::oox::core::ContextHandler& rParent, FillProperties& rFillProperties, sal_Int32 nContext ) throw(); + explicit GradientFillContext( + ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + GradientFillProperties& rGradientProps ); - static ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > StaticCreateContext( oox::core::ContextHandler& rParent, - ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs, FillProperties& rFillProperties ) - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); -protected: - FillProperties& mrFillProperties; +private: + GradientFillProperties& mrGradientProps; }; -// --------------------------------------------------------------------- +// ============================================================================ -class FillPropertiesContext : public ::oox::core::ContextHandler +/** Context handler that imports the a:pattFill element. */ +class PatternFillContext : public ::oox::core::ContextHandler { public: - FillPropertiesContext( oox::core::ContextHandler& rParent, FillProperties& rFillProperties ) throw(); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) - throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + explicit PatternFillContext( + ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + PatternFillProperties& rPatternProps ); -protected: - FillProperties& mrFillProperties; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + +private: + PatternFillProperties& mrPatternProps; +}; + +// ============================================================================ +// ============================================================================ + +/** Context handler that imports the a:clrChange element containing the colors + of a bitmap color change transformation. */ +class ColorChangeContext : public ::oox::core::ContextHandler +{ +public: + explicit ColorChangeContext( + ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + BlipFillProperties& rBlipProps ); + virtual ~ColorChangeContext(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + +private: + BlipFillProperties& mrBlipProps; + bool mbUseAlpha; }; -// --------------------------------------------------------------------- +// ============================================================================ -class BlipFillPropertiesContext : public FillPropertiesGroupContext +/** Context handler that imports the a:blip element containing the fill bitmap + and bitmap color transformation settings. */ +class BlipContext : public ::oox::core::ContextHandler { public: - BlipFillPropertiesContext( oox::core::ContextHandler& rParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, - FillProperties& rFillProperties ) throw(); + explicit BlipContext( + ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + BlipFillProperties& rBlipProps ); - virtual void SAL_CALL endFastElement( sal_Int32 aElementToken ) - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) - throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); private: - rtl::OUString msEmbed; - rtl::OUString msLink; + BlipFillProperties& mrBlipProps; }; -} } +// ============================================================================ + +/** Context handler that imports the a:blipFill element. */ +class BlipFillContext : public ::oox::core::ContextHandler +{ +public: + explicit BlipFillContext( + ::oox::core::ContextHandler& rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + BlipFillProperties& rBlipProps ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + +private: + BlipFillProperties& mrBlipProps; +}; + +// ============================================================================ +// ============================================================================ + +/** Context handler for elements that contain a fill property element + (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). */ +class FillPropertiesContext : public ::oox::core::ContextHandler +{ +public: + explicit FillPropertiesContext( + ::oox::core::ContextHandler& rParent, + FillProperties& rFillProps ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + + static ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > + createFillContext( + ::oox::core::ContextHandler& rParent, + sal_Int32 nElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs, + FillProperties& rFillProps ); + +protected: + FillProperties& mrFillProps; +}; + +// ============================================================================ + +/** Context handler for elements that contain a fill property element + (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). + + This context handler takes a simple color instead of a fill properties + struct. The imported fill properties are converted automatically to the + best fitting solid color. + */ +class SimpleFillPropertiesContext : private FillProperties, public FillPropertiesContext +{ +public: + explicit SimpleFillPropertiesContext( + ::oox::core::ContextHandler& rParent, + Color& rColor ); + virtual ~SimpleFillPropertiesContext(); + +protected: + Color& mrColor; +}; + +// ============================================================================ + +} // namespace drawingml +} // namespace oox + +#endif -#endif // OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP |