[Libreoffice-commits] core.git: basegfx/Library_basegfx.mk basegfx/source chart2/source cui/source cui/uiconfig drawinglayer/source editeng/source include/basegfx include/drawinglayer include/editeng include/svx include/xmloff officecfg/registry reportdesign/source sc/source sd/source sfx2/source svl/source svx/source sw/inc sw/Library_sw.mk sw/qa sw/sdi sw/source vcl/source xmloff/source

Armin Le Grand alg at apache.org
Fri Mar 28 06:31:36 PDT 2014


 basegfx/Library_basegfx.mk                                   |    1 
 basegfx/source/numeric/ftools.cxx                            |   49 
 chart2/source/controller/main/ShapeController.cxx            |    3 
 cui/source/factory/dlgfact.cxx                               |    4 
 cui/source/factory/dlgfact.hxx                               |    2 
 cui/source/inc/backgrnd.hxx                                  |   16 
 cui/source/inc/cuires.hrc                                    |    1 
 cui/source/inc/cuitabarea.hxx                                |   32 
 cui/source/tabpages/backgrnd.cxx                             |  177 --
 cui/source/tabpages/strings.src                              |    4 
 cui/source/tabpages/tabarea.cxx                              |   13 
 cui/source/tabpages/tparea.cxx                               |  191 ++
 cui/uiconfig/ui/areatabpage.ui                               |   13 
 drawinglayer/source/attribute/sdrfillgraphicattribute.cxx    |   17 
 drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx  |  117 +
 drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx     |   48 
 drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx   |  118 +
 drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx  |   21 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx   |   65 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx      |    2 
 drawinglayer/source/processor3d/defaultprocessor3d.cxx       |   63 
 drawinglayer/source/texture/texture.cxx                      |  230 ++-
 drawinglayer/source/texture/texture3d.cxx                    |   18 
 editeng/source/items/frmitems.cxx                            |   18 
 include/basegfx/numeric/ftools.hxx                           |   12 
 include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx |   25 
 include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx    |   20 
 include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx  |   33 
 include/drawinglayer/texture/texture.hxx                     |   52 
 include/editeng/brushitem.hxx                                |    5 
 include/editeng/unoprnms.hxx                                 |    7 
 include/svx/sdr/primitive2d/sdrattributecreator.hxx          |    4 
 include/svx/sdr/primitive2d/sdrdecompositiontools.hxx        |   21 
 include/svx/svxdlg.hxx                                       |    2 
 include/svx/svxids.hrc                                       |   69 
 include/svx/unoshprp.hxx                                     |   14 
 include/xmloff/txtprmap.hxx                                  |    8 
 include/xmloff/xmltypes.hxx                                  |   10 
 officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu |    1 
 reportdesign/source/ui/misc/UITools.cxx                      |    2 
 sc/source/ui/drawfunc/drawsh.cxx                             |    2 
 sd/source/ui/func/fuarea.cxx                                 |    2 
 sfx2/source/dialog/tabdlg.cxx                                |   12 
 svl/source/undo/undo.cxx                                     |    4 
 svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx |    2 
 svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx        |    1 
 svx/source/sdr/contact/viewcontactofsdrpage.cxx              |    2 
 svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx         |   17 
 svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx       |    1 
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx         |   63 
 svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx         |   24 
 svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx            |   13 
 svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx         |    8 
 svx/source/sdr/primitive2d/sdrole2primitive2d.cxx            |   14 
 svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx            |   12 
 svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx       |   12 
 svx/source/svdraw/svddrgmt.cxx                               |    1 
 svx/source/table/viewcontactoftableobj.cxx                   |    6 
 sw/Library_sw.mk                                             |    2 
 sw/inc/doc.hxx                                               |    7 
 sw/inc/fillattributes.hxx                                    |   72 +
 sw/inc/format.hxx                                            |   36 
 sw/inc/frmatr.hxx                                            |    8 
 sw/inc/frmfmt.hxx                                            |   32 
 sw/inc/hintids.hxx                                           |   18 
 sw/inc/swatrset.hxx                                          |    8 
 sw/inc/unobrushitemhelper.hxx                                |   31 
 sw/inc/unoframe.hxx                                          |    5 
 sw/inc/unomap.hxx                                            |    8 
 sw/inc/unoprnms.hxx                                          |   31 
 sw/qa/complex/checkColor/CheckChangeColor.java               |    3 
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                     |   21 
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                     |    3 
 sw/qa/extras/rtfexport/rtfexport.cxx                         |    6 
 sw/qa/extras/rtfimport/rtfimport.cxx                         |    3 
 sw/qa/unoapi/sw.sce                                          |    6 
 sw/sdi/_frmsh.sdi                                            |   83 +
 sw/source/core/access/accpara.cxx                            |    8 
 sw/source/core/attr/format.cxx                               |  176 ++
 sw/source/core/attr/swatrset.cxx                             |   87 +
 sw/source/core/bastyp/init.cxx                               |   12 
 sw/source/core/doc/docdraw.cxx                               |   74 -
 sw/source/core/doc/docfly.cxx                                |   69 
 sw/source/core/doc/notxtfrm.cxx                              |   21 
 sw/source/core/doc/poolfmt.cxx                               |    4 
 sw/source/core/inc/frame.hxx                                 |   14 
 sw/source/core/inc/frmtool.hxx                               |   15 
 sw/source/core/layout/atrfrm.cxx                             |  133 +
 sw/source/core/layout/fillattributes.cxx                     |  160 ++
 sw/source/core/layout/paintfrm.cxx                           |  631 +++++----
 sw/source/core/layout/wsfrm.cxx                              |    8 
 sw/source/core/text/inftxt.cxx                               |   20 
 sw/source/core/text/porfld.cxx                               |    4 
 sw/source/core/text/txtfly.cxx                               |   14 
 sw/source/core/txtnode/fntcache.cxx                          |    7 
 sw/source/core/uibase/app/docst.cxx                          |   27 
 sw/source/core/uibase/app/docstyle.cxx                       |   70 -
 sw/source/core/uibase/frmdlg/frmmgr.cxx                      |    5 
 sw/source/core/uibase/inc/frmdlg.hxx                         |    4 
 sw/source/core/uibase/inc/frmsh.hxx                          |    8 
 sw/source/core/uibase/inc/tmpdlg.hxx                         |    2 
 sw/source/core/uibase/shells/basesh.cxx                      |   89 +
 sw/source/core/uibase/shells/drawdlg.cxx                     |    2 
 sw/source/core/uibase/shells/frmsh.cxx                       |  211 ++-
 sw/source/core/unocore/unobrushitemhelper.cxx                |  307 ++++
 sw/source/core/unocore/unoframe.cxx                          |  770 +++++++++--
 sw/source/core/unocore/unomap.cxx                            |   66 
 sw/source/core/unocore/unostyle.cxx                          |  397 ++++-
 sw/source/filter/html/css1atr.cxx                            |    2 
 sw/source/filter/html/htmlatr.cxx                            |    2 
 sw/source/filter/ww8/docxattributeoutput.cxx                 |    6 
 sw/source/filter/ww8/ww8atr.cxx                              |    3 
 sw/source/ui/fmtui/tmpdlg.cxx                                |   40 
 sw/source/ui/frmdlg/frmdlg.cxx                               |   67 
 vcl/source/gdi/impgraph.cxx                                  |   22 
 xmloff/source/draw/sdpropls.cxx                              |    6 
 xmloff/source/text/txtexppr.cxx                              |   36 
 xmloff/source/text/txtprhdl.cxx                              |   39 
 xmloff/source/text/txtprmap.cxx                              |   29 
 119 files changed, 4572 insertions(+), 1182 deletions(-)

New commits:
commit 6e61ecd09679a66060f932835622821d39e92f01
Author: Armin Le Grand <alg at apache.org>
Date:   Wed Mar 19 16:17:02 2014 +0000

    Merge back branch alg_writerframes to trunk
    
    (cherry picked from commit b635b4fa4e42053d30ab639643d2236a20243f62)
    
    Conflicts:
    	comphelper/inc/comphelper/TypeGeneration.hxx
    	comphelper/source/property/TypeGeneration.cxx
    	cui/source/factory/dlgfact.hxx
    	cui/source/inc/cuitabarea.hxx
    	cui/source/tabpages/tabarea.cxx
    	cui/source/tabpages/tabarea.hrc
    	cui/source/tabpages/tabarea.src
    	cui/source/tabpages/tparea.cxx
    	drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
    	drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
    	drawinglayer/source/texture/texture.cxx
    	editeng/inc/editeng/unotext.hxx
    	editeng/source/items/frmitems.cxx
    	include/drawinglayer/texture/texture.hxx
    	include/editeng/brushitem.hxx
    	include/svx/sdr/primitive2d/sdrdecompositiontools.hxx
    	include/svx/svxids.hrc
    	include/xmloff/xmltypes.hxx
    	reportdesign/source/ui/misc/UITools.cxx
    	sc/source/ui/drawfunc/drawsh.cxx
    	sfx2/source/dialog/tabdlg.cxx
    	svl/source/undo/undo.cxx
    	svx/inc/svx/unoshprp.hxx
    	sw/Library_sw.mk
    	sw/inc/doc.hxx
    	sw/inc/format.hxx
    	sw/inc/frmfmt.hxx
    	sw/inc/swatrset.hxx
    	sw/inc/unomap.hxx
    	sw/inc/unoprnms.hxx
    	sw/source/core/access/accpara.cxx
    	sw/source/core/attr/format.cxx
    	sw/source/core/attr/swatrset.cxx
    	sw/source/core/doc/docdraw.cxx
    	sw/source/core/doc/docfly.cxx
    	sw/source/core/doc/notxtfrm.cxx
    	sw/source/core/inc/frame.hxx
    	sw/source/core/inc/frmtool.hxx
    	sw/source/core/layout/atrfrm.cxx
    	sw/source/core/layout/paintfrm.cxx
    	sw/source/core/text/inftxt.cxx
    	sw/source/core/text/porfld.cxx
    	sw/source/core/text/txtfly.cxx
    	sw/source/core/txtnode/fntcache.cxx
    	sw/source/core/uibase/app/docst.cxx
    	sw/source/core/uibase/app/docstyle.cxx
    	sw/source/core/uibase/shells/drawdlg.cxx
    	sw/source/core/uibase/shells/frmsh.cxx
    	sw/source/core/unocore/unoframe.cxx
    	sw/source/core/unocore/unomap.cxx
    	sw/source/core/unocore/unoprnms.cxx
    	sw/source/core/unocore/unostyle.cxx
    	sw/source/ui/fmtui/tmpdlg.cxx
    	sw/source/ui/fmtui/tmpdlg.src
    	sw/source/ui/frmdlg/frmdlg.cxx
    	sw/source/ui/frmdlg/frmpage.src
    	sw/source/ui/inc/frmsh.hxx
    	xmloff/source/text/txtprhdl.cxx
    	xmloff/source/text/txtprmap.cxx
    
    Change-Id: Id3ffaa83bb5594d287f1ac8f2c1c9cf55c70946d

diff --git a/basegfx/Library_basegfx.mk b/basegfx/Library_basegfx.mk
index de2430c..3666647 100644
--- a/basegfx/Library_basegfx.mk
+++ b/basegfx/Library_basegfx.mk
@@ -37,6 +37,7 @@ $(eval $(call gb_Library_add_exception_objects,basegfx,\
     basegfx/source/matrix/b2dhommatrix \
     basegfx/source/matrix/b2dhommatrixtools \
     basegfx/source/matrix/b3dhommatrix \
+	basegfx/source/numeric/ftools \
     basegfx/source/pixel/bpixel \
     basegfx/source/point/b2dpoint \
     basegfx/source/point/b2ipoint \
diff --git a/basegfx/source/numeric/ftools.cxx b/basegfx/source/numeric/ftools.cxx
new file mode 100644
index 0000000..a67bc56
--- /dev/null
+++ b/basegfx/source/numeric/ftools.cxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <basegfx/numeric/ftools.hxx>
+#include <algorithm>
+
+namespace basegfx
+{
+    double snapToNearestMultiple(double v, const double fStep)
+    {
+        if(fTools::equalZero(fStep))
+        {
+            // with a zero step, all snaps to 0.0
+            return 0.0;
+        }
+        else
+        {
+            const double fHalfStep(fStep * 0.5);
+            const double fChange(fHalfStep - fmod(v + fHalfStep, fStep));
+
+            if(basegfx::fTools::equal(fabs(v), fabs(fChange)))
+            {
+                return 0.0;
+            }
+            else
+            {
+                return v + fChange;
+            }
+        }
+    }
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx
index e16c664..2f808e0 100644
--- a/chart2/source/controller/main/ShapeController.cxx
+++ b/chart2/source/controller/main/ShapeController.cxx
@@ -307,8 +307,7 @@ void ShapeController::executeDispatch_FormatArea()
             if ( pFact )
             {
                 ::boost::scoped_ptr< AbstractSvxAreaTabDialog > pDlg(
-                    pFact->CreateSvxAreaTabDialog( pParent, &aAttr, &pDrawModelWrapper->getSdrModel(),
-                        pDrawViewWrapper ) );
+                    pFact->CreateSvxAreaTabDialog( pParent, &aAttr, &pDrawModelWrapper->getSdrModel(), true ) );
                 if ( pDlg.get() )
                 {
                     SfxItemPool& rItemPool = pDrawViewWrapper->GetModel()->GetItemPool();
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 35c7152..b358e5c 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1515,9 +1515,9 @@ AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterMos
 AbstractSvxAreaTabDialog* AbstractDialogFactory_Impl::CreateSvxAreaTabDialog( Window* pParent,
                                                             const SfxItemSet* pAttr,
                                                             SdrModel* pModel,
-                                                            const SdrView* pSdrView )
+                                                            bool bShadow)
 {
-    SvxAreaTabDialog* pDlg = new SvxAreaTabDialog( pParent, pAttr, pModel,pSdrView );
+    SvxAreaTabDialog* pDlg = new SvxAreaTabDialog( pParent, pAttr, pModel, bShadow );
     return new AbstractSvxAreaTabDialog_Impl( pDlg );
 }
 
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index feaad78..1cf6b4c 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -660,7 +660,7 @@ public:
     virtual AbstractSvxAreaTabDialog*       CreateSvxAreaTabDialog( Window* pParent,
                                                             const SfxItemSet* pAttr,
                                                             SdrModel* pModel,
-                                                            const SdrView* pSdrView = NULL ) SAL_OVERRIDE;
+                                                            bool bShadow ) SAL_OVERRIDE;
     virtual SfxAbstractTabDialog*           CreateSvxLineTabDialog( Window* pParent, const SfxItemSet* pAttr,
                                                                  SdrModel* pModel,
                                                                  const SdrObject* pObj = NULL,
diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx
index bd247f3..bebea49 100644
--- a/cui/source/inc/backgrnd.hxx
+++ b/cui/source/inc/backgrnd.hxx
@@ -32,8 +32,6 @@ struct SvxBackgroundTable_Impl;
 struct SvxBackgroundPara_Impl;
 struct SvxBackgroundPage_Impl;
 class SvxBrushItem;
-class XFillStyleItem;
-class XFillGradientItem;
 
 /** class SvxBackgroundTabPage --------------------------------------------
 
@@ -87,17 +85,6 @@ private:
     MetricField*            m_pColTransMF;
     CheckBox*               m_pBtnPreview;
 
-    // Gradient controls
-    VclFrame*               m_pBackGroundGradientFrame;
-    GradientLB*             m_pLbGradients;
-    SvxXRectPreview*        m_pCtlPreview;
-
-    // Gradient data
-    XGradientListRef        m_pGradientList;
-    SfxItemPool*            m_pXPool;
-    XFillAttrSetItem        m_aXFillAttr;
-    SfxItemSet&             m_rXFillSet;
-
     // Background Bitmap ----------------------------------
     VclContainer*           m_pBitmapContainer;
     VclContainer*           m_pFileFrame;
@@ -141,8 +128,6 @@ private:
     void                HideColorUI_Impl();
     void                ShowBitmapUI_Impl();
     void                HideBitmapUI_Impl();
-    void                ShowGradientUI_Impl();
-    void                HideGradientUI_Impl();
     sal_Bool                LoadLinkedGraphic_Impl();
     void                RaiseLoadError_Impl();
     void                SetGraphicPosition_Impl( SvxGraphicPosition ePos );
@@ -160,7 +145,6 @@ private:
     DECL_LINK(BackgroundColorHdl_Impl, void *);
     DECL_LINK( TblDestinationHdl_Impl, ListBox* );
     DECL_LINK( ParaDestinationHdl_Impl, ListBox* );
-    DECL_LINK(ModifyGradientHdl_Impl, void *);
 };
 
 #endif // INCLUDED_CUI_SOURCE_INC_BACKGRND_HXX
diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc
index ffad575..6d2df87 100644
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -42,6 +42,7 @@
 // used in "tabpages"
 #define RID_SVXSTRARY_PAPERSIZE_STD         (RID_SVX_START + 142)
 #define RID_SVXSTRARY_PAPERSIZE_DRAW        (RID_SVX_START + 143)
+#define RID_SVXSTR_READ_DATA_ERROR          (RID_SVX_START + 230)
 #define RID_SVXSTR_TABLE_PRESET_NONE        (RID_SVX_START + 969)
 #define RID_SVXSTR_TABLE_PRESET_ONLYOUTER   (RID_SVX_START + 970)
 #define RID_SVXSTR_TABLE_PRESET_OUTERHORI   (RID_SVX_START + 971)
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 6ae9dbc..a5c1a49 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -75,10 +75,7 @@ protected:
     void                SavePalettes();
 
 public:
-    SvxAreaTabDialog( Window* pParent,
-                      const SfxItemSet* pAttr,
-                      SdrModel* pModel,
-                      const SdrView* pSdrView = NULL );
+    SvxAreaTabDialog( Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, bool bShadow );
     ~SvxAreaTabDialog();
 
     void                SetNewColorList( XColorListRef pColTab )
@@ -114,8 +111,8 @@ class SvxTransparenceTabPage : public SvxTabPage
     const SfxItemSet&   rOutAttrs;
     RECT_POINT          eRP;
 
-    sal_uInt16          nPageType;
-    sal_uInt16          nDlgType;
+    sal_uInt16             nPageType;
+    sal_uInt16             nDlgType;
 
     // main selection
     RadioButton*        m_pRbtTransOff;
@@ -238,6 +235,13 @@ private:
     XHatchListRef         pHatchingList;
     XBitmapListRef        pBitmapList;
 
+    // Placeholders for pointer-based entries; these will be inited
+    // to point to these so that the page is usable without that
+    // SvxAreaTabDialog has to call the setter methods (e.g. SetColorChgd).
+    // Without that the pages used in SvxAreaTabDialog are not usable
+    ChangeType          maFixed_ChangeType;
+    sal_Bool            maFixed_sal_Bool;
+
     ChangeType*         pnColorListState;
     ChangeType*         pnBitmapListState;
     ChangeType*         pnGradientListState;
@@ -247,7 +251,7 @@ private:
     sal_uInt16 nDlgType;
     sal_Int32  nPos;
 
-    sal_Bool*               pbAreaTP;
+    sal_Bool*           pbAreaTP;
 
     XOutdevItemPool*    pXPool;
     XFillAttrSetItem    aXFillAttr;
@@ -256,6 +260,14 @@ private:
     SfxMapUnit          ePoolUnit;
     FieldUnit           eFUnit;
 
+    //UUUU
+    bool                mbOfferImportButton;
+    bool                mbPositionsAdapted;
+    bool                mbDirectGraphicSet;
+    Graphic             maDirectGraphic;
+    OUString            maDirectName;
+    PushButton*         m_pBtnImport;
+
     DECL_LINK(SelectDialogTypeHdl_Impl, void *);
     DECL_LINK( ModifyColorHdl_Impl, void * );
     DECL_LINK( ModifyHatchBckgrdColorHdl_Impl, void * );
@@ -264,6 +276,10 @@ private:
     DECL_LINK( ToggleHatchBckgrdColorHdl_Impl, void * );
     DECL_LINK( ModifyBitmapHdl_Impl, void * );
     DECL_LINK( ModifyStepCountHdl_Impl, void * );
+
+    //UUUU
+    DECL_LINK( ClickImportHdl_Impl, void * );
+
     DECL_LINK( ModifyTileHdl_Impl, void * );
     DECL_LINK( ClickScaleHdl_Impl, void * );
     void ClickInvisibleHdl_Impl();
@@ -273,7 +289,7 @@ private:
     void ClickBitmapHdl_Impl();
 
 public:
-    SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs  );
+    SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs );
 
     void    Construct();
 
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index c1d0359..3193f01 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -51,8 +51,6 @@
 #include <sfx2/htmlmode.hxx>
 #include <svtools/controldims.hrc>
 #include <svx/flagsdef.hxx>
-#include <svx/xfillit0.hxx>
-#include <svx/xflgrit.hxx>
 #include <svl/intitem.hxx>
 #include <sfx2/request.hxx>
 #include <svtools/grfmgr.hxx>
@@ -352,9 +350,6 @@ void BackgroundPreviewImpl::DataChanged( const DataChangedEvent& rDCEvt )
 
 SvxBackgroundTabPage::SvxBackgroundTabPage(Window* pParent, const SfxItemSet& rCoreSet)
     : SvxTabPage(pParent, "BackgroundPage", "cui/ui/backgroundpage.ui", rCoreSet)
-    , m_pXPool(rCoreSet.GetPool())
-    , m_aXFillAttr(m_pXPool)
-    , m_rXFillSet(m_aXFillAttr.GetItemSet())
     , nHtmlMode(0)
     , bAllowShowSelector(true)
     , bIsGraphicValid(false)
@@ -381,17 +376,6 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(Window* pParent, const SfxItemSet& rC
     get(m_pColTransMF, "transparencymf");
     get(m_pBtnPreview, "showpreview");
 
-    // Initialize gradient controls
-    get(m_pBackGroundGradientFrame, "backgroundgradientframe");
-    get(m_pLbGradients, "gradientslb");
-    Size aSize = getDrawListBoxOptimalSize(this);
-    m_pLbGradients->set_width_request(aSize.Width());
-    m_pLbGradients->set_height_request(aSize.Height());
-    get(m_pCtlPreview, "previewctl");
-    aSize = getDrawPreviewOptimalSize(this);
-    m_pCtlPreview->set_width_request(aSize.Width());
-    m_pCtlPreview->set_height_request(aSize.Height());
-
     get(m_pBitmapContainer, "graphicgrid");
     get(m_pFileFrame, "fileframe");
     get(m_pBtnBrowse, "browse");
@@ -790,7 +774,6 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet& rCoreSet )
         const SvxBrushItem& rOldItem    = (const SvxBrushItem&)*pOld;
         SvxGraphicPosition  eOldPos     = rOldItem.GetGraphicPos();
         const sal_Bool          bIsBrush    = ( XFILL_SOLID == lcl_getFillStyle(m_pLbSelect) );
-        const bool bIsGradient = ( XFILL_GRADIENT == lcl_getFillStyle(m_pLbSelect) );
 
         // transparency has to be set if enabled, the color not already set to "No fill" and
         if( bColTransparency &&
@@ -798,37 +781,22 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet& rCoreSet )
         {
             aBgdColor.SetTransparency(lcl_PercentToTransparency(static_cast<long>(m_pColTransMF->GetValue())));
         }
-        if (   ( (GPOS_NONE == eOldPos) && (bIsBrush || bIsGradient)  )
-            || ( (GPOS_NONE != eOldPos) && !(bIsBrush || bIsGradient) ) ) // Brush <-> Bitmap changed?
+        if (   ( (GPOS_NONE == eOldPos) && bIsBrush  )
+            || ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap changed?
         {
             // background art hasn't been changed:
 
             if ( (GPOS_NONE == eOldPos) || !m_pLbSelect->IsVisible() )
             {
-                if (bIsBrush)
-                {
-                    // Brush-treatment:
-                    if ( rOldItem.GetColor() != aBgdColor ||
-                            (SFX_ITEM_AVAILABLE >= eOldItemState && !m_pBackgroundColorSet->IsNoSelection()))
-                    {
-                        bModified = true;
-                        rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) );
-                    }
-                    else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, false ) )
-                        rCoreSet.ClearItem( nWhich );
-                    // Handle XFILL_GRADIENT -> XFILL_SOLID
-                    XFillStyleItem aFillStyleItem(XFILL_SOLID, GetWhich(SID_SW_ATTR_FILL_STYLE));
-                    rCoreSet.Put(aFillStyleItem);
-                }
-                else
+                // Brush-treatment:
+                if ( rOldItem.GetColor() != aBgdColor ||
+                     (SFX_ITEM_AVAILABLE >= eOldItemState && !m_pBackgroundColorSet->IsNoSelection()))
                 {
-                    XFillStyleItem aFillStyleItem(((const XFillStyleItem&)m_rXFillSet.Get(XATTR_FILLSTYLE)).GetValue(), GetWhich(SID_SW_ATTR_FILL_STYLE));
-                    rCoreSet.Put(aFillStyleItem);
-
-                    const XFillGradientItem& rFillGradientItem = (const XFillGradientItem&)m_rXFillSet.Get(XATTR_FILLGRADIENT);
-                    XFillGradientItem aFillGradientItem(rFillGradientItem.GetName(), rFillGradientItem.GetGradientValue(), GetWhich(SID_SW_ATTR_FILL_GRADIENT));
-                    rCoreSet.Put(aFillGradientItem);
+                    bModified = true;
+                    rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) );
                 }
+                else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, false ) )
+                    rCoreSet.ClearItem( nWhich );
             }
             else
             {
@@ -875,19 +843,9 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet& rCoreSet )
         }
         else // Brush <-> Bitmap changed!
         {
-            if (bIsBrush || bIsGradient)
+            if ( bIsBrush )
             {
                 rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) );
-                if (bIsGradient)
-                {
-                    // Handle XFILL_BITMAP -> XFILL_GRADIENT
-                    XFillStyleItem aFillStyleItem(((const XFillStyleItem&)m_rXFillSet.Get(XATTR_FILLSTYLE)).GetValue(), GetWhich(SID_SW_ATTR_FILL_STYLE));
-                    rCoreSet.Put(aFillStyleItem);
-
-                    const XFillGradientItem& rFillGradientItem = (const XFillGradientItem&)m_rXFillSet.Get(XATTR_FILLGRADIENT);
-                    XFillGradientItem aFillGradientItem(rFillGradientItem.GetName(), rFillGradientItem.GetGradientValue(), GetWhich(SID_SW_ATTR_FILL_GRADIENT));
-                    rCoreSet.Put(aFillGradientItem);
-                }
             }
             else
             {
@@ -916,7 +874,7 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet& rCoreSet )
                     delete pTmpBrush;
                 }
             }
-            bModified = ( bIsBrush || bIsGradient || m_pBtnLink->IsChecked() || bIsGraphicValid );
+            bModified = ( bIsBrush || m_pBtnLink->IsChecked() || bIsGraphicValid );
         }
     }
     else if ( SID_ATTR_BRUSH_CHAR == nSlot && aBgdColor != Color( COL_WHITE ) )
@@ -1132,7 +1090,6 @@ void SvxBackgroundTabPage::ShowSelector()
         m_pBtnArea->SetClickHdl( HDL(RadioClickHdl_Impl) );
         m_pBtnTile->SetClickHdl( HDL(RadioClickHdl_Impl) );
         m_pBtnPosition->SetClickHdl( HDL(RadioClickHdl_Impl) );
-        m_pLbGradients->SetSelectHdl(HDL(ModifyGradientHdl_Impl));
 
         // delayed loading via timer (because of UI-Update)
         pPageImpl->pLoadTimer = new Timer;
@@ -1221,7 +1178,6 @@ void SvxBackgroundTabPage::ShowColorUI_Impl()
     if (!m_pBackGroundColorFrame->IsVisible())
     {
         HideBitmapUI_Impl();
-        HideGradientUI_Impl();
         m_pBackGroundColorFrame->Show();
 
         if(bColTransparency)
@@ -1252,7 +1208,6 @@ void SvxBackgroundTabPage::ShowBitmapUI_Impl()
          (m_pBackGroundColorFrame->IsVisible() || !m_pFileFrame->IsVisible()))
     {
         HideColorUI_Impl();
-        HideGradientUI_Impl();
 
 
         m_pBitmapContainer->Show();
@@ -1281,36 +1236,6 @@ void SvxBackgroundTabPage::HideBitmapUI_Impl()
     m_pGraphTransFrame->Hide();
 }
 
-void SvxBackgroundTabPage::ShowGradientUI_Impl()
-{
-    if (!m_pBackGroundGradientFrame->IsVisible())
-    {
-        HideColorUI_Impl();
-        HideBitmapUI_Impl();
-
-        m_pBackGroundGradientFrame->Show();
-        if (!m_rXFillSet.HasItem(XATTR_FILLSTYLE) || ((const XFillStyleItem&)m_rXFillSet.Get(XATTR_FILLSTYLE)).GetValue() != XFILL_GRADIENT)
-        {
-            // Frame has no gradient? Then select the first one, just to be able to show something in the preview control.
-            m_pLbGradients->SelectEntryPos(0);
-            ModifyGradientHdl_Impl(this);
-        }
-        else
-        {
-            // It has one, try to select the matching entry in the gradient list box.
-            const XFillGradientItem& rFillGradientItem = (const XFillGradientItem&)m_rXFillSet.Get(XATTR_FILLGRADIENT);
-            m_pLbGradients->SelectEntryByList(m_pGradientList, rFillGradientItem.GetName(), rFillGradientItem.GetGradientValue());
-        }
-    }
-}
-
-void SvxBackgroundTabPage::HideGradientUI_Impl()
-{
-    m_pBackGroundGradientFrame->Hide();
-}
-
-
-
 void SvxBackgroundTabPage::SetGraphicPosition_Impl( SvxGraphicPosition ePos )
 {
     switch ( ePos )
@@ -1409,15 +1334,11 @@ IMPL_LINK_NOARG(SvxBackgroundTabPage, SelectHdl_Impl)
         ShowColorUI_Impl();
         m_pParaLBox->Enable(); // drawing background can't be a bitmap
     }
-    else if ( XFILL_BITMAP == lcl_getFillStyle(m_pLbSelect) )
+    else
     {
         ShowBitmapUI_Impl();
         m_pParaLBox->Enable(false); // drawing background can't be a bitmap
     }
-    else
-    {
-        ShowGradientUI_Impl();
-    }
     return 0;
 }
 
@@ -1490,23 +1411,6 @@ IMPL_LINK( SvxBackgroundTabPage, RadioClickHdl_Impl, RadioButton*, pBtn )
     return 0;
 }
 
-IMPL_LINK_NOARG(SvxBackgroundTabPage, ModifyGradientHdl_Impl)
-{
-    sal_Int32 nPos = m_pLbGradients->GetSelectEntryPos();
-
-    if (nPos != LISTBOX_ENTRY_NOTFOUND)
-    {
-        XGradientEntry* pEntry = m_pGradientList->GetGradient(nPos);
-        m_rXFillSet.Put( XFillStyleItem( XFILL_GRADIENT ) );
-        m_rXFillSet.Put( XFillGradientItem( pEntry->GetName(), pEntry->GetGradient() ) );
-    }
-    m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() );
-    m_pCtlPreview->Invalidate();
-    return 0;
-}
-
-
-
 IMPL_LINK_NOARG(SvxBackgroundTabPage, BrowseHdl_Impl)
 
 /*  [Description]
@@ -1810,36 +1714,25 @@ void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr,
 
     if ( GPOS_NONE == ePos || !m_pLbSelect->IsVisible() )
     {
-        // We don't have a graphic, do we have gradient fill style?
-        if (!m_rXFillSet.HasItem(XATTR_FILLSTYLE) || ((const XFillStyleItem&)m_rXFillSet.Get(XATTR_FILLSTYLE)).GetValue() != XFILL_GRADIENT)
-        {
-            lcl_setFillStyle(m_pLbSelect, XFILL_SOLID);
-            ShowColorUI_Impl();
-            Color aTrColor( COL_TRANSPARENT );
-            aBgdColor = rColor;
-
-            sal_uInt16 nCol = ( aTrColor != aBgdColor ) ?
-                GetItemId_Impl(*m_pBackgroundColorSet, aBgdColor) : 0;
+        lcl_setFillStyle(m_pLbSelect, XFILL_SOLID);
+        ShowColorUI_Impl();
+        Color aTrColor( COL_TRANSPARENT );
+        aBgdColor = rColor;
 
-            if( aTrColor != aBgdColor && nCol == 0)
-            {
-                m_pBackgroundColorSet->SetNoSelection();
-            }
-            else
-            {
-                m_pBackgroundColorSet->SelectItem( nCol );
-            }
+        sal_uInt16 nCol = ( aTrColor != aBgdColor ) ?
+            GetItemId_Impl(*m_pBackgroundColorSet, aBgdColor) : 0;
 
-            m_pPreviewWin1->NotifyChange( aBgdColor );
+        if( aTrColor != aBgdColor && nCol == 0)
+        {
+            m_pBackgroundColorSet->SetNoSelection();
         }
         else
         {
-            // Gradient fill style, then initialize preview with data from Writer.
-            lcl_setFillStyle(m_pLbSelect, XFILL_GRADIENT);
-            ShowGradientUI_Impl();
-            m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() );
-            m_pCtlPreview->Invalidate();
+            m_pBackgroundColorSet->SelectItem( nCol );
         }
+
+        m_pPreviewWin1->NotifyChange( aBgdColor );
+
         if ( m_pLbSelect->IsVisible() ) // initialize graphic part
         {
             aBgdGraphicFilter = "";
@@ -1942,7 +1835,6 @@ void SvxBackgroundTabPage::EnableTransparency(sal_Bool bColor, sal_Bool bGraphic
 void SvxBackgroundTabPage::PageCreated (SfxAllItemSet aSet)
 {
     SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,false);
-    SFX_ITEMSET_ARG (&aSet,pGradientListItem,SvxGradientListItem,SID_GRADIENT_LIST,false);
 
     if (pFlagItem)
     {
@@ -1956,25 +1848,6 @@ void SvxBackgroundTabPage::PageCreated (SfxAllItemSet aSet)
         if ( ( nFlags & SVX_ENABLE_TRANSPARENCY ) == SVX_ENABLE_TRANSPARENCY )
             EnableTransparency(sal_True, sal_True);
     }
-
-    if (pGradientListItem)
-    {
-        // If we get a gradient list, also read fill and gradient style.
-        m_pGradientList = pGradientListItem->GetGradientList();
-        m_pLbGradients->Fill(m_pGradientList);
-        const XFillStyleItem& rFillStyleItem = (const XFillStyleItem&)aSet.Get(SID_SW_ATTR_FILL_STYLE);
-        m_rXFillSet.Put(XFillStyleItem(rFillStyleItem.GetValue()));
-        const XFillGradientItem& rFillGradientItem = (const XFillGradientItem&)aSet.Get(SID_SW_ATTR_FILL_GRADIENT);
-        m_rXFillSet.Put(XFillGradientItem(rFillGradientItem.GetName(), rFillGradientItem.GetGradientValue()));
-    }
-    else
-        // Otherwise hide the gradient UI.
-        for (int i = 0; i < m_pLbSelect->GetEntryCount(); ++i)
-            if ((XFillStyle)(sal_uLong)m_pLbSelect->GetEntryData(i) == XFILL_GRADIENT)
-            {
-                m_pLbSelect->RemoveEntry(i);
-                break;
-            }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/tabpages/strings.src b/cui/source/tabpages/strings.src
index 7eefbe5..9de66cc 100644
--- a/cui/source/tabpages/strings.src
+++ b/cui/source/tabpages/strings.src
@@ -191,5 +191,9 @@ String RID_SVXSTR_DIMENSION_LINE
 {
     Text [en-US ] = "Dimension line";
 };
+String RID_SVXSTR_READ_DATA_ERROR
+{
+    Text [ en-US ] = "The file could not be loaded!" ;
+};
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx
index 2a764fa..bee8f1b 100644
--- a/cui/source/tabpages/tabarea.cxx
+++ b/cui/source/tabpages/tabarea.cxx
@@ -40,7 +40,7 @@ SvxAreaTabDialog::SvxAreaTabDialog
     Window* pParent,
     const SfxItemSet* pAttr,
     SdrModel* pModel,
-    const SdrView* /* pSdrView */
+    bool bShadow
 )
     : SfxTabDialog( pParent,
                   "AreaDialog",
@@ -73,7 +73,16 @@ SvxAreaTabDialog::SvxAreaTabDialog
     mbAreaTP( sal_False )
 {
     m_nAreaTabPage = AddTabPage( "RID_SVXPAGE_AREA", SvxAreaTabPage::Create, 0 );
-    m_nShadowTabPage = AddTabPage( "RID_SVXPAGE_SHADOW", SvxShadowTabPage::Create, 0 );
+
+    if(bShadow)
+    {
+        m_nShadowTabPage = AddTabPage( "RID_SVXPAGE_SHADOW", SvxShadowTabPage::Create, 0 );
+    }
+    else
+    {
+        RemoveTabPage( "RID_SVXPAGE_SHADOW" );
+    }
+
     m_nTransparenceTabPage = AddTabPage( "RID_SVXPAGE_TRANSPARENCE", SvxTransparenceTabPage::Create,  0);
     m_nColorTabPage = AddTabPage( "RID_SVXPAGE_COLOR", SvxColorTabPage::Create, 0 );
     m_nGradientTabPage = AddTabPage( "RID_SVXPAGE_GRADIENT", SvxGradientTabPage::Create, 0 );
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index 43dd000..0005b0f 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -41,6 +41,10 @@
 #include <sfx2/request.hxx>
 #include "paragrph.hrc"
 
+//UUUU
+#include "sfx2/opengrf.hxx"
+#include <vcl/msgbox.hxx>
+
 // static ----------------------------------------------------------------
 
 static sal_uInt16 pAreaRanges[] =
@@ -587,20 +591,35 @@ SvxAreaTabPage::SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
     pHatchingList( NULL ),
     pBitmapList( NULL ),
 
-    pnColorListState( 0 ),
-    pnBitmapListState( 0 ),
-    pnGradientListState( 0 ),
-    pnHatchingListState( 0 ),
+    // local fixed not o be changed values for local pointers
+    maFixed_ChangeType(CT_NONE),
+    maFixed_sal_Bool(false),
+
+    // init with pointers to fixed ChangeType
+    pnColorListState(&maFixed_ChangeType),
+    pnBitmapListState(&maFixed_ChangeType),
+    pnGradientListState(&maFixed_ChangeType),
+    pnHatchingListState(&maFixed_ChangeType),
 
-    nPageType( 0 ),
-    nDlgType( 0 ),
-    nPos( LISTBOX_ENTRY_NOTFOUND ),
+    nPageType(0),
+    nDlgType(0),
+    nPos(0),
 
-    pbAreaTP( 0 ),
+    // init with pointer to fixed bool
+    pbAreaTP(&maFixed_sal_Bool),
 
     pXPool              ( (XOutdevItemPool*) rInAttrs.GetPool() ),
     aXFillAttr          ( pXPool ),
-    rXFSet              ( aXFillAttr.GetItemSet() )
+    rXFSet              ( aXFillAttr.GetItemSet() ),
+
+    ePoolUnit(SFX_MAPUNIT_100TH_MM),
+    eFUnit(FUNIT_NONE),
+
+    //UUUU
+    mbOfferImportButton(false),
+    mbPositionsAdapted(false),
+    mbDirectGraphicSet(false),
+    maDirectGraphic()
 {
     get(m_pTypeLB,"LB_AREA_TYPE");
     get(m_pFillLB,"boxLB_FILL");
@@ -641,6 +660,7 @@ SvxAreaTabPage::SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
     get(m_pFlOffset,"FL_OFFSET");
     get(m_pRbtRow,"RBT_ROW");
     get(m_pRbtColumn,"RBT_COLUMN");
+    get(m_pBtnImport, "btnimport");
     get(m_pMtrFldOffset,"MTR_FLD_OFFSET");
 
     get(m_pCtlXRectPreview,"CTL_COLOR_PREVIEW");
@@ -704,6 +724,8 @@ SvxAreaTabPage::SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
     m_pLbColor->SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyColorHdl_Impl ) );
     m_pLbHatchBckgrdColor->SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl ) );
     m_pCbxHatchBckgrd->SetToggleHdl( LINK( this, SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl ) );
+    //UUUU
+    m_pBtnImport->SetClickHdl(LINK(this, SvxAreaTabPage, ClickImportHdl_Impl));
 
     m_pLbGradient->SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyGradientHdl_Impl ) );
     m_pLbHatching->SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyHatchingHdl_Impl ) );
@@ -1101,33 +1123,44 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet& rAttrs )
             break;
             case XFILL_BITMAP:
             {
-                nPos = m_pLbBitmap->GetSelectEntryPos();
-                if( nPos != LISTBOX_ENTRY_NOTFOUND &&
-                    nPos != m_pLbBitmap->GetSavedValue() )
+                //UUUU
+                if(mbDirectGraphicSet && GRAPHIC_NONE != maDirectGraphic.GetType())
                 {
-                    const XBitmapEntry* pXBitmapEntry = pBitmapList->GetBitmap(nPos);
-                    const OUString aString(m_pLbBitmap->GetSelectEntry());
-                    const XFillBitmapItem aFillBitmapItem(aString, pXBitmapEntry->GetGraphicObject());
-                    pOld = GetOldItem( rAttrs, XATTR_FILLBITMAP );
-                    if ( !pOld || !( *(const XFillBitmapItem*)pOld == aFillBitmapItem ) )
-                    {
-                        rAttrs.Put( aFillBitmapItem );
-                        bModified = sal_True;
-                    }
+                    const XFillBitmapItem aXBmpItem(maDirectName, maDirectGraphic);
+                    rAttrs.Put(XFillStyleItem(XFILL_BITMAP));
+                    rAttrs.Put(aXBmpItem);
+                    bModified = sal_True;
                 }
-                // NEW
-                if( (eSavedStyle != eStyle) &&
-                    ( bModified ||
-                      SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), true ) ) )
+                else
                 {
-                    XFillStyleItem aStyleItem( XFILL_BITMAP );
-                    pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
-                    if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
+                    nPos = m_pLbBitmap->GetSelectEntryPos();
+                    if( nPos != LISTBOX_ENTRY_NOTFOUND &&
+                        nPos != m_pLbBitmap->GetSavedValue() )
                     {
-                        rAttrs.Put( aStyleItem );
-                        bModified = sal_True;
+                        const XBitmapEntry* pXBitmapEntry = pBitmapList->GetBitmap(nPos);
+                        const OUString aString(m_pLbBitmap->GetSelectEntry());
+                        const XFillBitmapItem aFillBitmapItem(aString, pXBitmapEntry->GetGraphicObject());
+                        pOld = GetOldItem( rAttrs, XATTR_FILLBITMAP );
+                        if ( !pOld || !( *(const XFillBitmapItem*)pOld == aFillBitmapItem ) )
+                        {
+                            rAttrs.Put( aFillBitmapItem );
+                            bModified = sal_True;
+                        }
+                    }
+                    // NEW
+                    if( (eSavedStyle != eStyle) &&
+                        ( bModified ||
+                          SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), true ) ) )
+                    {
+                            XFillStyleItem aStyleItem( XFILL_BITMAP );
+                            pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
+                            if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
+                            {
+                                rAttrs.Put( aStyleItem );
+                                bModified = sal_True;
+                            }
                     }
-               }
+                }
            }
            break;
        }
@@ -2039,6 +2072,19 @@ void SvxAreaTabPage::ClickBitmapHdl_Impl()
     m_pLbColor->Hide();
     m_pLbGradient->Hide();
     m_pLbHatching->Hide();
+
+    //UUUU
+    if(mbOfferImportButton)
+    {
+        m_pBtnImport->Show();
+        m_pBtnImport->Enable();
+    }
+    else
+    {
+        m_pBtnImport->Hide();
+        m_pBtnImport->Disable();
+    }
+
     m_pLbBitmap->Enable();
     m_pLbBitmap->Show();
     m_pCtlBitmapPreview->Enable();
@@ -2084,6 +2130,11 @@ void SvxAreaTabPage::ClickBitmapHdl_Impl()
 
 IMPL_LINK_NOARG(SvxAreaTabPage, ModifyBitmapHdl_Impl)
 {
+    //UUUU
+    mbDirectGraphicSet = false;
+    maDirectGraphic.Clear();
+    maDirectName = "";
+
     const SfxPoolItem* pPoolItem = NULL;
     sal_Int32 _nPos = m_pLbBitmap->GetSelectEntryPos();
     if( _nPos != LISTBOX_ENTRY_NOTFOUND )
@@ -2139,41 +2190,99 @@ IMPL_LINK( SvxAreaTabPage, ModifyStepCountHdl_Impl, void *, p )
     return( 0L );
 }
 
+IMPL_LINK_NOARG( SvxAreaTabPage, ClickImportHdl_Impl )
+{
+    ResMgr& rMgr = CUI_MGR();
+    SvxOpenGraphicDialog aDlg("Import");
+    aDlg.EnableLink(sal_False);
+
+    if(!aDlg.Execute())
+    {
+        EnterWait();
+        const int nError(aDlg.GetGraphic(maDirectGraphic));
+        LeaveWait();
+
+        if(!nError && GRAPHIC_NONE != maDirectGraphic.GetType())
+        {
+            // extract name from filename
+            const INetURLObject aURL(aDlg.GetPath());
+            maDirectName = aURL.GetName().getToken( 0, '.' );
+
+            // use loaded graphic
+            const XFillBitmapItem aXBmpItem(maDirectName, maDirectGraphic);
+            rXFSet.Put(XFillStyleItem(XFILL_BITMAP));
+            rXFSet.Put(aXBmpItem);
+
+            // trigger state flag for directly loaded graphic
+            mbDirectGraphicSet = true;
+
+            // preview
+            m_pCtlBitmapPreview->SetAttributes(aXFillAttr.GetItemSet());
+            m_pCtlBitmapPreview->Invalidate();
+        }
+        else
+        {
+            // graphic could not be loaded
+            ErrorBox(this, WB_OK, OUString(ResId(RID_SVXSTR_READ_DATA_ERROR, rMgr))).Execute();
+        }
+    }
+
+    return 0L;
+}
 
+//------------------------------------------------------------------------
 
 IMPL_LINK_NOARG(SvxAreaTabPage, ModifyTileHdl_Impl)
 {
     TriState eState = m_pTsbTile->GetState();
     if( eState == TRISTATE_TRUE )
     {
+        // tiled
+        // disable stretched for tiled graphic
         m_pTsbStretch->Disable();
         m_pFlOffset->Enable();
 
+        // allow positioning
         m_pCtlPosition->Invalidate();
+        // allow 'Position" title
         m_pFlPosition->Enable();
 
+        // allow size definitions
         m_pFlSize->Enable();
     }
     else if( eState == TRISTATE_FALSE )
     {
+        // non-tiled
+        // enable stretch selection
         m_pTsbStretch->Enable();
+        // no need for offsets, only position is supported in non-tiled
         m_pFlOffset->Disable();
 
-        m_pCtlPosition->Invalidate();
-        m_pFlPosition->Disable();
-
         if( m_pTsbStretch->GetState() != TRISTATE_FALSE )
         {
+            // non-tiled, stretched
+            // no need for positioning
+            m_pCtlPosition->Invalidate();
+            // no need for 'Position" title, all deactivated
+            m_pFlPosition->Disable();
 
+            // no need for size definitions
             m_pFlSize->Disable();
         }
         else
         {
+            // non-tiled, non-stretched
+            // allow positioning
+            m_pCtlPosition->Enable();
+            m_pCtlPosition->Invalidate();
+            // allow 'Position" title, positioning is active
+            m_pFlPosition->Enable();
             m_pFlSize->Enable();
         }
     }
     else
     {
+        // disable all when tiling is undefined
         m_pTsbStretch->Disable();
         m_pFlOffset->Disable();
 
@@ -2335,6 +2444,8 @@ void SvxAreaTabPage::PageCreated (SfxAllItemSet aSet)
     SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,false);
     SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,false);
     SFX_ITEMSET_ARG (&aSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,false);
+    //UUUU
+    SFX_ITEMSET_ARG (&aSet, pOfferImportItem, SfxBoolItem, SID_OFFER_IMPORT, sal_False);
 
     if (pColorListItem)
         SetColorList(pColorListItem->GetColorList());
@@ -2350,6 +2461,18 @@ void SvxAreaTabPage::PageCreated (SfxAllItemSet aSet)
         SetDlgType(pDlgTypeItem->GetValue());
     if (pPosItem)
         SetPos(pPosItem->GetValue());
+
+    //UUUU
+    if(pOfferImportItem)
+    {
+        const bool bNew(pOfferImportItem->GetValue());
+
+        if(mbOfferImportButton != bNew)
+        {
+            mbOfferImportButton = bNew;
+        }
+    }
+
     Construct();
 }
 
diff --git a/cui/uiconfig/ui/areatabpage.ui b/cui/uiconfig/ui/areatabpage.ui
index 8bb0f6b..4c11f61 100644
--- a/cui/uiconfig/ui/areatabpage.ui
+++ b/cui/uiconfig/ui/areatabpage.ui
@@ -821,6 +821,19 @@
                 <property name="position">3</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkButton" id="btnimport">
+                <property name="label" translatable="yes">Import Graphic...</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">4</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
diff --git a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
index 669ee49..2e7f05e 100755
--- a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
@@ -209,11 +209,11 @@ namespace drawinglayer
             // get logical size of bitmap (before expanding eventually)
             Graphic aGraphic(getFillGraphic());
 
-            // init values with defaults
+            // init values with defaults for stretched
             basegfx::B2DPoint aBitmapSize(1.0, 1.0);
             basegfx::B2DVector aBitmapTopLeft(0.0, 0.0);
 
-            // are changes needed?
+            //UUUU are changes needed? When streched we are already done, all other values will have no influence
             if(getTiling() || !getStretch())
             {
                 // init values with range sizes
@@ -258,34 +258,33 @@ namespace drawinglayer
                     aBitmapSize.setY(getGraphicLogicSize().getY());
                 }
 
-                // get values, force to centered if necessary
-                const basegfx::B2DVector aRectPoint(getTiling() ? getRectPoint() : basegfx::B2DVector(0.0, 0.0));
-
                 // position changes X
-                if(0.0 == aRectPoint.getX())
+                if(0.0 == getRectPoint().getX())
                 {
                     aBitmapTopLeft.setX((fRangeWidth - aBitmapSize.getX()) * 0.5);
                 }
-                else if(1.0 == aRectPoint.getX())
+                else if(1.0 == getRectPoint().getX())
                 {
                     aBitmapTopLeft.setX(fRangeWidth - aBitmapSize.getX());
                 }
 
+                // offset positions are only meaningful when tiled
                 if(getTiling() && 0.0 != getOffsetPosition().getX())
                 {
                     aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (getOffsetPosition().getX() * 0.01)));
                 }
 
                 // position changes Y
-                if(0.0 == aRectPoint.getY())
+                if(0.0 == getRectPoint().getY())
                 {
                     aBitmapTopLeft.setY((fRangeHeight - aBitmapSize.getY()) * 0.5);
                 }
-                else if(1.0 == aRectPoint.getY())
+                else if(1.0 == getRectPoint().getY())
                 {
                     aBitmapTopLeft.setY(fRangeHeight - aBitmapSize.getY());
                 }
 
+                // offset positions are only meaningful when tiled
                 if(getTiling() && 0.0 != getOffsetPosition().getY())
                 {
                     aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (getOffsetPosition().getY() * 0.01)));
diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
index 575c6b3..f5be906 100644
--- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
@@ -37,7 +37,7 @@ namespace drawinglayer
     {
         void FillGradientPrimitive2D::generateMatricesAndColors(
             std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
-            basegfx::BColor& rOutmostColor) const
+            basegfx::BColor& rOuterColor) const
         {
             rEntries.clear();
 
@@ -68,38 +68,83 @@ namespace drawinglayer
             {
                 case attribute::GRADIENTSTYLE_LINEAR:
                 {
-                    texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getAngle());
-                    aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
+                    texture::GeoTexSvxGradientLinear aGradient(
+                        getDefinitionRange(),
+                        getOutputRange(),
+                        aStart,
+                        aEnd,
+                        nSteps,
+                        getFillGradient().getBorder(),
+                        getFillGradient().getAngle());
+                    aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
                     break;
                 }
                 case attribute::GRADIENTSTYLE_AXIAL:
                 {
-                    texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getAngle());
-                    aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
+                    texture::GeoTexSvxGradientAxial aGradient(
+                        getDefinitionRange(),
+                        getOutputRange(),
+                        aStart,
+                        aEnd,
+                        nSteps,
+                        getFillGradient().getBorder(),
+                        getFillGradient().getAngle());
+                    aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
                     break;
                 }
                 case attribute::GRADIENTSTYLE_RADIAL:
                 {
-                    texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY());
-                    aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
+                    texture::GeoTexSvxGradientRadial aGradient(
+                        getDefinitionRange(),
+                        aStart,
+                        aEnd,
+                        nSteps,
+                        getFillGradient().getBorder(),
+                        getFillGradient().getOffsetX(),
+                        getFillGradient().getOffsetY());
+                    aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
                     break;
                 }
                 case attribute::GRADIENTSTYLE_ELLIPTICAL:
                 {
-                    texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle());
-                    aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
+                    texture::GeoTexSvxGradientElliptical aGradient(
+                        getDefinitionRange(),
+                        aStart,
+                        aEnd,
+                        nSteps,
+                        getFillGradient().getBorder(),
+                        getFillGradient().getOffsetX(),
+                        getFillGradient().getOffsetY(),
+                        getFillGradient().getAngle());
+                    aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
                     break;
                 }
                 case attribute::GRADIENTSTYLE_SQUARE:
                 {
-                    texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle());
-                    aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
+                    texture::GeoTexSvxGradientSquare aGradient(
+                        getDefinitionRange(),
+                        aStart,
+                        aEnd,
+                        nSteps,
+                        getFillGradient().getBorder(),
+                        getFillGradient().getOffsetX(),
+                        getFillGradient().getOffsetY(),
+                        getFillGradient().getAngle());
+                    aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
                     break;
                 }
                 case attribute::GRADIENTSTYLE_RECT:
                 {
-                    texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle());
-                    aGradient.appendTransformationsAndColors(rEntries, rOutmostColor);
+                    texture::GeoTexSvxGradientRect aGradient(
+                        getDefinitionRange(),
+                        aStart,
+                        aEnd,
+                        nSteps,
+                        getFillGradient().getBorder(),
+                        getFillGradient().getOffsetX(),
+                        getFillGradient().getOffsetY(),
+                        getFillGradient().getAngle());
+                    aGradient.appendTransformationsAndColors(rEntries, rOuterColor);
                     break;
                 }
             }
@@ -107,7 +152,7 @@ namespace drawinglayer
 
         Primitive2DSequence FillGradientPrimitive2D::createOverlappingFill(
             const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
-            const basegfx::BColor& rOutmostColor,
+            const basegfx::BColor& rOuterColor,
             const basegfx::B2DPolygon& rUnitPolygon) const
         {
             // prepare return value
@@ -116,8 +161,9 @@ namespace drawinglayer
             // create solid fill with outmost color
             aRetval[0] = Primitive2DReference(
                 new PolyPolygonColorPrimitive2D(
-                    basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getObjectRange())),
-                    rOutmostColor));
+                    basegfx::B2DPolyPolygon(
+                        basegfx::tools::createPolygonFromRect(getOutputRange())),
+                    rOuterColor));
 
             // create solid fill steps
             for(sal_uInt32 a(0); a < rEntries.size(); a++)
@@ -139,14 +185,14 @@ namespace drawinglayer
 
         Primitive2DSequence FillGradientPrimitive2D::createNonOverlappingFill(
             const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
-            const basegfx::BColor& rOutmostColor,
+            const basegfx::BColor& rOuterColor,
             const basegfx::B2DPolygon& rUnitPolygon) const
         {
             // prepare return value
             Primitive2DSequence aRetval(rEntries.size() + 1);
 
-            // get outmost range from object
-            basegfx::B2DRange aOutmostRange(getObjectRange());
+            // get outmost viusible range from object
+            basegfx::B2DRange aOutmostRange(getOutputRange());
             basegfx::B2DPolyPolygon aCombinedPolyPoly;
 
             if(rEntries.size())
@@ -164,7 +210,7 @@ namespace drawinglayer
             aRetval[0] = Primitive2DReference(
                 new PolyPolygonColorPrimitive2D(
                     aCombinedPolyPoly,
-                    rOutmostColor));
+                    rOuterColor));
 
             if(rEntries.size())
             {
@@ -222,17 +268,17 @@ namespace drawinglayer
             // get the transform matrices and colors (where colors
             // will have one more entry that matrices)
             std::vector< drawinglayer::texture::B2DHomMatrixAndBColor > aEntries;
-            basegfx::BColor aOutmostColor;
+            basegfx::BColor aOuterColor;
 
-            generateMatricesAndColors(aEntries, aOutmostColor);
+            generateMatricesAndColors(aEntries, aOuterColor);
 
             if(bOverlapping)
             {
-                return createOverlappingFill(aEntries, aOutmostColor, aUnitPolygon);
+                return createOverlappingFill(aEntries, aOuterColor, aUnitPolygon);
             }
             else
             {
-                return createNonOverlappingFill(aEntries, aOutmostColor, aUnitPolygon);
+                return createNonOverlappingFill(aEntries, aOuterColor, aUnitPolygon);
             }
         }
 
@@ -258,10 +304,22 @@ namespace drawinglayer
         }
 
         FillGradientPrimitive2D::FillGradientPrimitive2D(
-            const basegfx::B2DRange& rObjectRange,
+            const basegfx::B2DRange& rOutputRange,
             const attribute::FillGradientAttribute& rFillGradient)
         :   BufferedDecompositionPrimitive2D(),
-            maObjectRange(rObjectRange),
+            maOutputRange(rOutputRange),
+            maDefinitionRange(rOutputRange),
+            maFillGradient(rFillGradient)
+        {
+        }
+
+        FillGradientPrimitive2D::FillGradientPrimitive2D(
+            const basegfx::B2DRange& rOutputRange,
+            const basegfx::B2DRange& rDefinitionRange,
+            const attribute::FillGradientAttribute& rFillGradient)
+        :   BufferedDecompositionPrimitive2D(),
+            maOutputRange(rOutputRange),
+            maDefinitionRange(rDefinitionRange),
             maFillGradient(rFillGradient)
         {
         }
@@ -272,7 +330,8 @@ namespace drawinglayer
             {
                 const FillGradientPrimitive2D& rCompare = (FillGradientPrimitive2D&)rPrimitive;
 
-                return (getObjectRange() == rCompare.getObjectRange()
+                return (getOutputRange() == rCompare.getOutputRange()
+                    && getDefinitionRange() == rCompare.getDefinitionRange()
                     && getFillGradient() == rCompare.getFillGradient());
             }
 
@@ -281,8 +340,8 @@ namespace drawinglayer
 
         basegfx::B2DRange FillGradientPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
         {
-            // return ObjectRange
-            return getObjectRange();
+            // return the geometrically visible area
+            return getOutputRange();
         }
 
         // provide unique ID
diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
index 1f941d0..cbad4a1 100644
--- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
@@ -67,7 +67,12 @@ namespace drawinglayer
                     case attribute::HATCHSTYLE_TRIPLE:
                     {
                         // rotated 45 degrees
-                        texture::GeoTexSvxHatch aHatch(getObjectRange(), fDistance, fAngle - F_PI4);
+                        texture::GeoTexSvxHatch aHatch(
+                            getDefinitionRange(),
+                            getOutputRange(),
+                            fDistance,
+                            fAngle - F_PI4);
+
                         aHatch.appendTransformations(aMatrices);
 
                         // fall-through by purpose
@@ -75,7 +80,12 @@ namespace drawinglayer
                     case attribute::HATCHSTYLE_DOUBLE:
                     {
                         // rotated 90 degrees
-                        texture::GeoTexSvxHatch aHatch(getObjectRange(), fDistance, fAngle - F_PI2);
+                        texture::GeoTexSvxHatch aHatch(
+                            getDefinitionRange(),
+                            getOutputRange(),
+                            fDistance,
+                            fAngle - F_PI2);
+
                         aHatch.appendTransformations(aMatrices);
 
                         // fall-through by purpose
@@ -83,7 +93,12 @@ namespace drawinglayer
                     case attribute::HATCHSTYLE_SINGLE:
                     {
                         // angle as given
-                        texture::GeoTexSvxHatch aHatch(getObjectRange(), fDistance, fAngle);
+                        texture::GeoTexSvxHatch aHatch(
+                            getDefinitionRange(),
+                            getOutputRange(),
+                            fDistance,
+                            fAngle);
+
                         aHatch.appendTransformations(aMatrices);
                     }
                 }
@@ -99,7 +114,7 @@ namespace drawinglayer
                     const Primitive2DReference xRef(
                         new PolyPolygonColorPrimitive2D(
                             basegfx::B2DPolyPolygon(
-                                basegfx::tools::createPolygonFromRect(getObjectRange())), getBColor()));
+                                basegfx::tools::createPolygonFromRect(getOutputRange())), getBColor()));
                     aRetval[0] = xRef;
                 }
 
@@ -125,11 +140,25 @@ namespace drawinglayer
         }
 
         FillHatchPrimitive2D::FillHatchPrimitive2D(
-            const basegfx::B2DRange& rObjectRange,
+            const basegfx::B2DRange& rOutputRange,
+            const basegfx::BColor& rBColor,
+            const attribute::FillHatchAttribute& rFillHatch)
+        :   DiscreteMetricDependentPrimitive2D(),
+            maOutputRange(rOutputRange),
+            maDefinitionRange(rOutputRange),
+            maFillHatch(rFillHatch),
+            maBColor(rBColor)
+        {
+        }
+
+        FillHatchPrimitive2D::FillHatchPrimitive2D(
+            const basegfx::B2DRange& rOutputRange,
+            const basegfx::B2DRange& rDefinitionRange,
             const basegfx::BColor& rBColor,
             const attribute::FillHatchAttribute& rFillHatch)
         :   DiscreteMetricDependentPrimitive2D(),
-            maObjectRange(rObjectRange),
+            maOutputRange(rOutputRange),
+            maDefinitionRange(rDefinitionRange),
             maFillHatch(rFillHatch),
             maBColor(rBColor)
         {
@@ -141,7 +170,8 @@ namespace drawinglayer
             {
                 const FillHatchPrimitive2D& rCompare = (FillHatchPrimitive2D&)rPrimitive;
 
-                return (getObjectRange() == rCompare.getObjectRange()
+                return (getOutputRange() == rCompare.getOutputRange()
+                    && getDefinitionRange() == rCompare.getDefinitionRange()
                     && getFillHatch() == rCompare.getFillHatch()
                     && getBColor() == rCompare.getBColor());
             }
@@ -151,8 +181,8 @@ namespace drawinglayer
 
         basegfx::B2DRange FillHatchPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
         {
-            // return ObjectRange
-            return getObjectRange();
+            // return the geometrically visible area
+            return getOutputRange();
         }
 
         Primitive2DSequence FillHatchPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
index 0f33f9c..1fe0a6f 100644
--- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
@@ -201,7 +201,7 @@ namespace drawinglayer
 
         PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
             const basegfx::B2DPolyPolygon& rPolyPolygon,
-              const attribute::LineAttribute& rLineAttribute,
+            const attribute::LineAttribute& rLineAttribute,
             const attribute::StrokeAttribute& rStrokeAttribute)
         :   BufferedDecompositionPrimitive2D(),
             maPolyPolygon(rPolyPolygon),
@@ -212,7 +212,7 @@ namespace drawinglayer
 
         PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
             const basegfx::B2DPolyPolygon& rPolyPolygon,
-              const attribute::LineAttribute& rLineAttribute)
+            const attribute::LineAttribute& rLineAttribute)
         :   BufferedDecompositionPrimitive2D(),
             maPolyPolygon(rPolyPolygon),
             maLineAttribute(rLineAttribute),
@@ -306,7 +306,10 @@ namespace drawinglayer
             {
                 // create SubSequence with FillGradientPrimitive2D
                 const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
-                FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(aPolyPolygonRange, getFillGradient());
+                FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(
+                    aPolyPolygonRange,
+                    getDefinitionRange(),
+                    getFillGradient());
                 const Primitive2DReference xSubRef(pNewGradient);
                 const Primitive2DSequence aSubSequence(&xSubRef, 1L);
 
@@ -327,6 +330,18 @@ namespace drawinglayer
             const attribute::FillGradientAttribute& rFillGradient)
         :   BufferedDecompositionPrimitive2D(),
             maPolyPolygon(rPolyPolygon),
+            maDefinitionRange(rPolyPolygon.getB2DRange()),
+            maFillGradient(rFillGradient)
+        {
+        }
+
+        PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D(
+            const basegfx::B2DPolyPolygon& rPolyPolygon,
+            const basegfx::B2DRange& rDefinitionRange,
+            const attribute::FillGradientAttribute& rFillGradient)
+        :   BufferedDecompositionPrimitive2D(),
+            maPolyPolygon(rPolyPolygon),
+            maDefinitionRange(rDefinitionRange),
             maFillGradient(rFillGradient)
         {
         }
@@ -337,7 +352,9 @@ namespace drawinglayer
             {
                 const PolyPolygonGradientPrimitive2D& rCompare = (PolyPolygonGradientPrimitive2D&)rPrimitive;
 
-                return (getFillGradient() == rCompare.getFillGradient());
+                return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+                    && getDefinitionRange() == rCompare.getDefinitionRange()
+                    && getFillGradient() == rCompare.getFillGradient());
             }
 
             return false;
@@ -361,7 +378,11 @@ namespace drawinglayer
             {
                 // create SubSequence with FillHatchPrimitive2D
                 const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
-                FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBackgroundColor(), getFillHatch());
+                FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(
+                    aPolyPolygonRange,
+                    getDefinitionRange(),
+                    getBackgroundColor(),
+                    getFillHatch());
                 const Primitive2DReference xSubRef(pNewHatch);
                 const Primitive2DSequence aSubSequence(&xSubRef, 1L);
 
@@ -383,6 +404,20 @@ namespace drawinglayer
             const attribute::FillHatchAttribute& rFillHatch)
         :   BufferedDecompositionPrimitive2D(),
             maPolyPolygon(rPolyPolygon),
+            maDefinitionRange(rPolyPolygon.getB2DRange()),
+            maBackgroundColor(rBackgroundColor),
+            maFillHatch(rFillHatch)
+        {
+        }
+
+        PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D(
+            const basegfx::B2DPolyPolygon& rPolyPolygon,
+            const basegfx::B2DRange& rDefinitionRange,
+            const basegfx::BColor& rBackgroundColor,
+            const attribute::FillHatchAttribute& rFillHatch)
+        :   BufferedDecompositionPrimitive2D(),
+            maPolyPolygon(rPolyPolygon),
+            maDefinitionRange(rDefinitionRange),
             maBackgroundColor(rBackgroundColor),
             maFillHatch(rFillHatch)
         {
@@ -394,7 +429,9 @@ namespace drawinglayer
             {
                 const PolyPolygonHatchPrimitive2D& rCompare = (PolyPolygonHatchPrimitive2D&)rPrimitive;
 
-                return (getBackgroundColor() == rCompare.getBackgroundColor()
+                return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+                    && getDefinitionRange() == rCompare.getDefinitionRange()
+                    && getBackgroundColor() == rCompare.getBackgroundColor()
                     && getFillHatch() == rCompare.getFillHatch());
             }
 
@@ -429,15 +466,56 @@ namespace drawinglayer
                     if(aPrefSize.Width() && aPrefSize.Height())
                     {
                         // create SubSequence with FillGraphicPrimitive2D based on polygon range
-                        const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
+                        const basegfx::B2DRange aOutRange(getB2DPolyPolygon().getB2DRange());
                         const basegfx::B2DHomMatrix aNewObjectTransform(
                             basegfx::tools::createScaleTranslateB2DHomMatrix(
-                                aPolyPolygonRange.getRange(),
-                                aPolyPolygonRange.getMinimum()));
-                        const Primitive2DReference xSubRef(
-                            new FillGraphicPrimitive2D(
+                                aOutRange.getRange(),
+                                aOutRange.getMinimum()));
+                        Primitive2DReference xSubRef;
+
+                        if(aOutRange != getDefinitionRange())
+                        {
+                            // we want to paint (tiled) content which is defined relative to DefinitionRange
+                            // with the same tiling and offset(s) in the traget range of the geometry (the
+                            // polygon). The range given in the local FillGraphicAttribute defines the position
+                            // of the graphic in unit coordinates relative to the DefinitionRange. Transform
+                            // this using DefinitionRange to get to the global definition and then with the
+                            // inverse transformation from the target range to go to unit coordinates relative
+                            // to that traget coordinate system.
+                            basegfx::B2DRange aAdaptedRange(getFillGraphic().getGraphicRange());
+
+                            const basegfx::B2DHomMatrix aFromDefinitionRangeToGlobal(
+                                basegfx::tools::createScaleTranslateB2DHomMatrix(
+                                    getDefinitionRange().getRange(),
+                                    getDefinitionRange().getMinimum()));
+
+                            aAdaptedRange.transform(aFromDefinitionRangeToGlobal);
+
+                            basegfx::B2DHomMatrix aFromGlobalToOutRange(
+                                basegfx::tools::createScaleTranslateB2DHomMatrix(
+                                    aOutRange.getRange(),
+                                    aOutRange.getMinimum()));
+                            aFromGlobalToOutRange.invert();
+
+                            aAdaptedRange.transform(aFromGlobalToOutRange);
+
+                            const drawinglayer::attribute::FillGraphicAttribute aAdaptedFillGraphicAttribute(
+                                getFillGraphic().getGraphic(),
+                                aAdaptedRange,
+                                getFillGraphic().getTiling(),
+                                getFillGraphic().getOffsetX(),
+                                getFillGraphic().getOffsetY());
+
+                            xSubRef = new FillGraphicPrimitive2D(
+                                aNewObjectTransform,
+                                aAdaptedFillGraphicAttribute);
+                        }
+                        else
+                        {
+                            xSubRef = new FillGraphicPrimitive2D(
                                 aNewObjectTransform,
-                                getFillGraphic()));
+                                getFillGraphic());
+                        }
 
                         // embed to mask primitive
                         const Primitive2DReference xRef(
@@ -458,6 +536,18 @@ namespace drawinglayer
             const attribute::FillGraphicAttribute& rFillGraphic)
         :   BufferedDecompositionPrimitive2D(),
             maPolyPolygon(rPolyPolygon),
+            maDefinitionRange(rPolyPolygon.getB2DRange()),
+            maFillGraphic(rFillGraphic)
+        {
+        }
+
+        PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D(
+            const basegfx::B2DPolyPolygon& rPolyPolygon,
+            const basegfx::B2DRange& rDefinitionRange,
+            const attribute::FillGraphicAttribute& rFillGraphic)
+        :   BufferedDecompositionPrimitive2D(),
+            maPolyPolygon(rPolyPolygon),
+            maDefinitionRange(rDefinitionRange),
             maFillGraphic(rFillGraphic)
         {
         }
@@ -468,7 +558,9 @@ namespace drawinglayer
             {
                 const PolyPolygonGraphicPrimitive2D& rCompare = (PolyPolygonGraphicPrimitive2D&)rPrimitive;
 
-                return (getFillGraphic() == rCompare.getFillGraphic());
+                return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+                    && getDefinitionRange() == rCompare.getDefinitionRange()
+                    && getFillGraphic() == rCompare.getFillGraphic());
             }
 
             return false;
diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
index 20169cb..24162d6 100644
--- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
@@ -145,19 +145,34 @@ namespace drawinglayer
                                                 case attribute::HATCHSTYLE_TRIPLE:
                                                 {
                                                     // rotated 45 degrees
-                                                    texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle - F_PI4);
+                                                    texture::GeoTexSvxHatch aHatch(
+                                                        aOutlineRange,
+                                                        aOutlineRange,
+                                                        getHatch().getDistance(),
+                                                        fAngle - F_PI4);
+
                                                     aHatch.appendTransformations(aMatrices);
                                                 }
                                                 case attribute::HATCHSTYLE_DOUBLE:
                                                 {
                                                     // rotated 90 degrees
-                                                    texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle - F_PI2);
+                                                    texture::GeoTexSvxHatch aHatch(
+                                                        aOutlineRange,
+                                                        aOutlineRange,
+                                                        getHatch().getDistance(),
+                                                        fAngle - F_PI2);
+
                                                     aHatch.appendTransformations(aMatrices);
                                                 }
                                                 case attribute::HATCHSTYLE_SINGLE:
                                                 {
                                                     // angle as given
-                                                    texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle);
+                                                    texture::GeoTexSvxHatch aHatch(
+                                                        aOutlineRange,
+                                                        aOutlineRange,
+                                                        getHatch().getDistance(),
+                                                        fAngle);
+
                                                     aHatch.appendTransformations(aMatrices);
                                                 }
                                             }
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 38248be..353466e 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1453,6 +1453,15 @@ namespace drawinglayer
                     const attribute::FillHatchAttribute& rFillHatchAttribute = rHatchCandidate.getFillHatch();
                     basegfx::B2DPolyPolygon aLocalPolyPolygon(rHatchCandidate.getB2DPolyPolygon());
 
+                    if(aLocalPolyPolygon.getB2DRange() != rHatchCandidate.getDefinitionRange())
+                    {
+                        // the range which defines the hatch is different from the range of the
+                        // geometry (used for writer frames). This cannot be done calling vcl, thus use
+                        // decomposition here
+                        process(rCandidate.get2DDecomposition(getViewInformation2D()));
+                        break;
+                    }
+
                     // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
                     // per polygon. Split polygon until there are less than that
                     while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon))
@@ -1575,11 +1584,20 @@ namespace drawinglayer
                         // BTW: One more example how useful the principles of primitives are; the decomposition
                         // is by definition a simpler, maybe more expensive representation of the same content.
                         process(rCandidate.get2DDecomposition(getViewInformation2D()));
+                        break;
                     }
-                    else
+
+                    const primitive2d::PolyPolygonGradientPrimitive2D& rGradientCandidate = static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate);
+                    basegfx::B2DPolyPolygon aLocalPolyPolygon(rGradientCandidate.getB2DPolyPolygon());
+
+                    if(aLocalPolyPolygon.getB2DRange() != rGradientCandidate.getDefinitionRange())
                     {
-                        const primitive2d::PolyPolygonGradientPrimitive2D& rGradientCandidate = static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate);
-                        basegfx::B2DPolyPolygon aLocalPolyPolygon(rGradientCandidate.getB2DPolyPolygon());
+                        // the range which defines the gradient is different from the range of the
+                        // geometry (used for writer frames). This cannot be done calling vcl, thus use
+                        // decomposition here
+                        process(rCandidate.get2DDecomposition(getViewInformation2D()));
+                        break;
+                    }
 
                         // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
                         // per polygon. Split polygon until there are less than that
@@ -1627,29 +1645,28 @@ namespace drawinglayer
                                     break;
                             }
 
-                            pSvtGraphicFill = new SvtGraphicFill(
-                                aToolsPolyPolygon,
-                                Color(),
-                                0.0,
-                                SvtGraphicFill::fillEvenOdd,
-                                SvtGraphicFill::fillGradient,
-                                SvtGraphicFill::Transform(),
-                                false,
-                                SvtGraphicFill::hatchSingle,
-                                Color(),
-                                eGrad,
-                                aVCLGradient.GetStartColor(),
-                                aVCLGradient.GetEndColor(),
-                                aVCLGradient.GetSteps(),
-                                Graphic());
-                        }
-
-                        // call VCL directly; encapsulate with SvtGraphicFill
-                        impStartSvtGraphicFill(pSvtGraphicFill);
-                        mpOutputDevice->DrawGradient(aToolsPolyPolygon, aVCLGradient);
-                        impEndSvtGraphicFill(pSvtGraphicFill);
+                        pSvtGraphicFill = new SvtGraphicFill(
+                            aToolsPolyPolygon,
+                            Color(),
+                            0.0,
+                            SvtGraphicFill::fillEvenOdd,
+                            SvtGraphicFill::fillGradient,
+                            SvtGraphicFill::Transform(),
+                            false,
+                            SvtGraphicFill::hatchSingle,
+                            Color(),
+                            eGrad,
+                            aVCLGradient.GetStartColor(),
+                            aVCLGradient.GetEndColor(),
+                            aVCLGradient.GetSteps(),
+                            Graphic());
                     }
 
+                    // call VCL directly; encapsulate with SvtGraphicFill
+                    impStartSvtGraphicFill(pSvtGraphicFill);
+                    mpOutputDevice->DrawGradient(aToolsPolyPolygon, aVCLGradient);
+                    impEndSvtGraphicFill(pSvtGraphicFill);
+
                     break;
                 }
                 case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D :
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index a701c2a..9fcc25a 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1089,7 +1089,7 @@ namespace drawinglayer
                         const attribute::FillHatchAttribute& rFillHatchAttributes = rFillHatchPrimitive.getFillHatch();
 
                         // create hatch polygon in range size and discrete coordinates
-                        basegfx::B2DRange aHatchRange(rFillHatchPrimitive.getObjectRange());
+                        basegfx::B2DRange aHatchRange(rFillHatchPrimitive.getOutputRange());
                         aHatchRange.transform(maCurrentTransformation);
                         const basegfx::B2DPolygon aHatchPolygon(basegfx::tools::createPolygonFromRect(aHatchRange));
 
diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
index 3808210..38028b2 100644
--- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
@@ -91,32 +91,83 @@ namespace drawinglayer
                     {
                         case attribute::GRADIENTSTYLE_LINEAR:
                         {
-                            pNewTex.reset(new texture::GeoTexSvxGradientLinear(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getAngle()));
+                            pNewTex.reset(
+                                new texture::GeoTexSvxGradientLinear(
+                                    aOutlineRange,
+                                    aOutlineRange,
+                                    aStart,
+                                    aEnd,
+                                    nSteps,
+                                    rFillGradient.getBorder(),
+                                    rFillGradient.getAngle()));
                             break;
                         }
                         case attribute::GRADIENTSTYLE_AXIAL:
                         {
-                            pNewTex.reset(new texture::GeoTexSvxGradientAxial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getAngle()));
+                            pNewTex.reset(
+                                new texture::GeoTexSvxGradientAxial(
+                                    aOutlineRange,
+                                    aOutlineRange,
+                                    aStart,
+                                    aEnd,
+                                    nSteps,
+                                    rFillGradient.getBorder(),
+                                    rFillGradient.getAngle()));
                             break;
                         }
                         case attribute::GRADIENTSTYLE_RADIAL:
                         {
-                            pNewTex.reset(new texture::GeoTexSvxGradientRadial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY()));
+                            pNewTex.reset(
+                                new texture::GeoTexSvxGradientRadial(
+                                    aOutlineRange,
+                                    aStart,
+                                    aEnd,
+                                    nSteps,
+                                    rFillGradient.getBorder(),
+                                    rFillGradient.getOffsetX(),
+                                    rFillGradient.getOffsetY()));
                             break;
                         }
                         case attribute::GRADIENTSTYLE_ELLIPTICAL:
                         {
-                            pNewTex.reset(new texture::GeoTexSvxGradientElliptical(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()));
+                            pNewTex.reset(
+                                new texture::GeoTexSvxGradientElliptical(
+                                    aOutlineRange,
+                                    aStart,
+                                    aEnd,
+                                    nSteps,
+                                    rFillGradient.getBorder(),
+                                    rFillGradient.getOffsetX(),
+                                    rFillGradient.getOffsetY(),
+                                    rFillGradient.getAngle()));
                             break;
                         }
                         case attribute::GRADIENTSTYLE_SQUARE:
                         {
-                            pNewTex.reset(new texture::GeoTexSvxGradientSquare(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()));
+                            pNewTex.reset(
+                                new texture::GeoTexSvxGradientSquare(
+                                    aOutlineRange,
+                                    aStart,
+                                    aEnd,
+                                    nSteps,
+                                    rFillGradient.getBorder(),
+                                    rFillGradient.getOffsetX(),
+                                    rFillGradient.getOffsetY(),
+                                    rFillGradient.getAngle()));
                             break;
                         }
                         case attribute::GRADIENTSTYLE_RECT:
                         {
-                            pNewTex.reset(new texture::GeoTexSvxGradientRect(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()));
+                            pNewTex.reset(
+                                new texture::GeoTexSvxGradientRect(
+                                    aOutlineRange,
+                                    aStart,
+                                    aEnd,
+                                    nSteps,
+                                    rFillGradient.getBorder(),
+                                    rFillGradient.getOffsetX(),
+                                    rFillGradient.getOffsetY(),
+                                    rFillGradient.getAngle()));
                             break;
                         }
                     }
diff --git a/drawinglayer/source/texture/texture.cxx b/drawinglayer/source/texture/texture.cxx
index d468f70..e1f8f92 100644
--- a/drawinglayer/source/texture/texture.cxx
+++ b/drawinglayer/source/texture/texture.cxx
@@ -67,14 +67,14 @@ namespace drawinglayer
     namespace texture
     {
         GeoTexSvxGradient::GeoTexSvxGradient(
-            const basegfx::B2DRange& rTargetRange,
+            const basegfx::B2DRange& rDefinitionRange,
             const basegfx::BColor& rStart,
             const basegfx::BColor& rEnd,
             sal_uInt32 /* nSteps */,
             double fBorder)
         :   GeoTexSvx(),
             maGradientInfo(),
-            maTargetRange(rTargetRange),
+            maDefinitionRange(rDefinitionRange),
             maStart(rStart),
             maEnd(rEnd),
             mfBorder(fBorder)
@@ -91,7 +91,7 @@ namespace drawinglayer
 
             return (pCompare
                 && maGradientInfo == pCompare->maGradientInfo
-                && maTargetRange == pCompare->maTargetRange
+                && maDefinitionRange == pCompare->maDefinitionRange
                 && mfBorder == pCompare->mfBorder);
         }
     } // end of namespace texture
@@ -104,19 +104,33 @@ namespace drawinglayer
     namespace texture
     {
         GeoTexSvxGradientLinear::GeoTexSvxGradientLinear(
-            const basegfx::B2DRange& rTargetRange,
+            const basegfx::B2DRange& rDefinitionRange,
+            const basegfx::B2DRange& rOutputRange,
             const basegfx::BColor& rStart,
             const basegfx::BColor& rEnd,
             sal_uInt32 nSteps,
             double fBorder,
             double fAngle)
-        :   GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder)
+        :   GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder),
+            mfUnitMinX(0.0),
+            mfUnitWidth(1.0),
+            mfUnitMaxY(1.0)
         {
             maGradientInfo = basegfx::tools::createLinearODFGradientInfo(
-                rTargetRange,
+                rDefinitionRange,
                 nSteps,
                 fBorder,
                 fAngle);
+
+            if(rDefinitionRange != rOutputRange)
+            {
+                basegfx::B2DRange aInvOutputRange(rOutputRange);
+
+                aInvOutputRange.transform(maGradientInfo.getBackTextureTransform());
+                mfUnitMinX = aInvOutputRange.getMinX();
+                mfUnitWidth = aInvOutputRange.getWidth();
+                mfUnitMaxY = aInvOutputRange.getMaxY();
+            }
         }
 
         GeoTexSvxGradientLinear::~GeoTexSvxGradientLinear()
@@ -125,29 +139,46 @@ namespace drawinglayer
 
         void GeoTexSvxGradientLinear::appendTransformationsAndColors(
             std::vector< B2DHomMatrixAndBColor >& rEntries,
-            basegfx::BColor& rOutmostColor)
+            basegfx::BColor& rOuterColor)
         {
-            rOutmostColor = maStart;
+            rOuterColor = maStart;
 
             if(maGradientInfo.getSteps())
             {
                 const double fStripeWidth(1.0 / maGradientInfo.getSteps());
                 B2DHomMatrixAndBColor aB2DHomMatrixAndBColor;
+                basegfx::B2DHomMatrix aPattern;
+
+                // bring from unit circle [-1, -1, 1, 1] to unit range [0, 0, 1, 1]
+                aPattern.scale(0.5, 0.5);
+                aPattern.translate(0.5, 0.5);
+
+                // scale and translate in X
+                aPattern.scale(mfUnitWidth, 1.0);
+                aPattern.translate(mfUnitMinX, 0.0);
 
                 for(sal_uInt32 a(1); a < maGradientInfo.getSteps(); a++)
                 {
                     const double fPos(fStripeWidth * a);
-                    // optimized below...
-
-                    // basegfx::B2DHomMatrix aNew;
-                    // aNew.scale(0.5, 0.5);
-                    // aNew.translate(0.5, 0.5);
-                    // aNew.scale(1.0, (1.0 - fPos));
-                    // aNew.translate(0.0, fPos);
-                    // aNew = maGradientInfo.getTextureTransform() * aNew;
-                    aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() *
-                        basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5 * (1.0 - fPos), 0.5, 0.5 * (1.0 + fPos));
+                    basegfx::B2DHomMatrix aNew(aPattern);
+
+                    // scale and translate in Y
+                    double fHeight(1.0 - fPos);
+
+                    if(a + 1 == maGradientInfo.getSteps() && mfUnitMaxY > 1.0)
+                    {
+                        fHeight += mfUnitMaxY - 1.0;
+                    }
+
+                    aNew.scale(1.0, fHeight);
+                    aNew.translate(0.0, fPos);
+
+                    // set at target
+                    aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() * aNew;
+
+                    // interpolate and set color
                     aB2DHomMatrixAndBColor.maBColor = interpolate(maStart, maEnd, double(a) / double(maGradientInfo.getSteps() - 1));
+
                     rEntries.push_back(aB2DHomMatrixAndBColor);
                 }
             }
@@ -169,19 +200,31 @@ namespace drawinglayer
     namespace texture
     {
         GeoTexSvxGradientAxial::GeoTexSvxGradientAxial(
-            const basegfx::B2DRange& rTargetRange,
+            const basegfx::B2DRange& rDefinitionRange,
+            const basegfx::B2DRange& rOutputRange,
             const basegfx::BColor& rStart,
             const basegfx::BColor& rEnd,
             sal_uInt32 nSteps,
             double fBorder,
             double fAngle)
-        :   GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder)
+        :   GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder),
+            mfUnitMinX(0.0),
+            mfUnitWidth(1.0)
         {
             maGradientInfo = basegfx::tools::createAxialODFGradientInfo(
-                rTargetRange,
+                rDefinitionRange,
                 nSteps,
                 fBorder,
                 fAngle);
+
+            if(rDefinitionRange != rOutputRange)
+            {
+                basegfx::B2DRange aInvOutputRange(rOutputRange);
+
+                aInvOutputRange.transform(maGradientInfo.getBackTextureTransform());
+                mfUnitMinX = aInvOutputRange.getMinX();
+                mfUnitWidth = aInvOutputRange.getWidth();
+            }
         }
 
         GeoTexSvxGradientAxial::~GeoTexSvxGradientAxial()
@@ -190,9 +233,9 @@ namespace drawinglayer
 
         void GeoTexSvxGradientAxial::appendTransformationsAndColors(
             std::vector< B2DHomMatrixAndBColor >& rEntries,
-            basegfx::BColor& rOutmostColor)
+            basegfx::BColor& rOuterColor)
         {
-            rOutmostColor = maEnd;
+            rOuterColor = maEnd;
 
             if(maGradientInfo.getSteps())
             {
@@ -201,16 +244,26 @@ namespace drawinglayer
 
                 for(sal_uInt32 a(1); a < maGradientInfo.getSteps(); a++)
                 {
-                    // const double fPos(fStripeWidth * a);
-                    // optimized below...
-
-                    // basegfx::B2DHomMatrix aNew;
-                    // aNew.scale(0.50, (1.0 - fPos));
-                    // aNew.translate(0.5, 0.0);
-                    // aNew = maGradientInfo.getTextureTransform() * aNew;
-                    aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() *
-                        basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 1.0 - (fStripeWidth * a), 0.5, 0.0);
+                    const double fPos(fStripeWidth * a);
+                    basegfx::B2DHomMatrix aNew;
+
+                    // bring in X from unit circle [-1, -1, 1, 1] to unit range [0, 0, 1, 1]
+                    aNew.scale(0.5, 1.0);
+                    aNew.translate(0.5, 0.0);
+
+                    // scale/translate in X
+                    aNew.scale(mfUnitWidth, 1.0);
+                    aNew.translate(mfUnitMinX, 0.0);
+
+                    // already centerd in Y on X-Axis, just scale in Y
+                    aNew.scale(1.0, 1.0 - fPos);
+
+                    // set at target
+                    aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() * aNew;
+
+                    // interpolate and set color
                     aB2DHomMatrixAndBColor.maBColor = interpolate(maEnd, maStart, double(a) / double(maGradientInfo.getSteps() - 1));
+
                     rEntries.push_back(aB2DHomMatrixAndBColor);
                 }
             }
@@ -232,17 +285,17 @@ namespace drawinglayer
     namespace texture
     {
         GeoTexSvxGradientRadial::GeoTexSvxGradientRadial(
-            const basegfx::B2DRange& rTargetRange,
+            const basegfx::B2DRange& rDefinitionRange,
             const basegfx::BColor& rStart,
             const basegfx::BColor& rEnd,
             sal_uInt32 nSteps,
             double fBorder,
             double fOffsetX,
             double fOffsetY)
-        :   GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder)
+        :   GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder)
         {
             maGradientInfo = basegfx::tools::createRadialODFGradientInfo(
-                rTargetRange,
+                rDefinitionRange,
                 basegfx::B2DVector(fOffsetX,fOffsetY),
                 nSteps,
                 fBorder);
@@ -254,9 +307,9 @@ namespace drawinglayer
 
         void GeoTexSvxGradientRadial::appendTransformationsAndColors(
             std::vector< B2DHomMatrixAndBColor >& rEntries,
-            basegfx::BColor& rOutmostColor)
+            basegfx::BColor& rOuterColor)
         {
-            rOutmostColor = maStart;
+            rOuterColor = maStart;
 
             if(maGradientInfo.getSteps())
             {
@@ -289,7 +342,7 @@ namespace drawinglayer
     namespace texture
     {
         GeoTexSvxGradientElliptical::GeoTexSvxGradientElliptical(
-            const basegfx::B2DRange& rTargetRange,
+            const basegfx::B2DRange& rDefinitionRange,
             const basegfx::BColor& rStart,
             const basegfx::BColor& rEnd,
             sal_uInt32 nSteps,
@@ -297,10 +350,10 @@ namespace drawinglayer
             double fOffsetX,
             double fOffsetY,
             double fAngle)
-        :   GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder)
+        :   GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder)
         {
             maGradientInfo = basegfx::tools::createEllipticalODFGradientInfo(
-                rTargetRange,
+                rDefinitionRange,
                 basegfx::B2DVector(fOffsetX,fOffsetY),
                 nSteps,
                 fBorder,
@@ -313,9 +366,9 @@ namespace drawinglayer
 
         void GeoTexSvxGradientElliptical::appendTransformationsAndColors(
             std::vector< B2DHomMatrixAndBColor >& rEntries,
-            basegfx::BColor& rOutmostColor)
+            basegfx::BColor& rOuterColor)
         {
-            rOutmostColor = maStart;
+            rOuterColor = maStart;
 
             if(maGradientInfo.getSteps())
             {
@@ -366,7 +419,7 @@ namespace drawinglayer
     namespace texture
     {
         GeoTexSvxGradientSquare::GeoTexSvxGradientSquare(
-            const basegfx::B2DRange& rTargetRange,
+            const basegfx::B2DRange& rDefinitionRange,
             const basegfx::BColor& rStart,
             const basegfx::BColor& rEnd,
             sal_uInt32 nSteps,
@@ -374,10 +427,10 @@ namespace drawinglayer
             double fOffsetX,
             double fOffsetY,
             double fAngle)
-        :   GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder)
+        :   GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder)
         {
             maGradientInfo = basegfx::tools::createSquareODFGradientInfo(
-                rTargetRange,
+                rDefinitionRange,
                 basegfx::B2DVector(fOffsetX,fOffsetY),
                 nSteps,
                 fBorder,
@@ -390,9 +443,9 @@ namespace drawinglayer
 
         void GeoTexSvxGradientSquare::appendTransformationsAndColors(
             std::vector< B2DHomMatrixAndBColor >& rEntries,
-            basegfx::BColor& rOutmostColor)
+            basegfx::BColor& rOuterColor)
         {
-            rOutmostColor = maStart;
+            rOuterColor = maStart;
 
             if(maGradientInfo.getSteps())
             {
@@ -425,7 +478,7 @@ namespace drawinglayer
     namespace texture
     {
         GeoTexSvxGradientRect::GeoTexSvxGradientRect(
-            const basegfx::B2DRange& rTargetRange,
+            const basegfx::B2DRange& rDefinitionRange,
             const basegfx::BColor& rStart,
             const basegfx::BColor& rEnd,
             sal_uInt32 nSteps,
@@ -433,10 +486,10 @@ namespace drawinglayer
             double fOffsetX,
             double fOffsetY,
             double fAngle)
-        :   GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder)
+        :   GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder)
         {
             maGradientInfo = basegfx::tools::createRectangularODFGradientInfo(
-                rTargetRange,
+                rDefinitionRange,
                 basegfx::B2DVector(fOffsetX,fOffsetY),
                 nSteps,
                 fBorder,
@@ -449,9 +502,9 @@ namespace drawinglayer
 
         void GeoTexSvxGradientRect::appendTransformationsAndColors(
             std::vector< B2DHomMatrixAndBColor >& rEntries,
-            basegfx::BColor& rOutmostColor)
+            basegfx::BColor& rOuterColor)
         {
-            rOutmostColor = maStart;
+            rOuterColor = maStart;
 
             if(maGradientInfo.getSteps())
             {
@@ -502,17 +555,22 @@ namespace drawinglayer
     namespace texture
     {
         GeoTexSvxHatch::GeoTexSvxHatch(
-            const basegfx::B2DRange& rTargetRange,
+            const basegfx::B2DRange& rDefinitionRange,
+            const basegfx::B2DRange& rOutputRange,
             double fDistance,
             double fAngle)
-        :   mfDistance(0.1),
+        :   maOutputRange(rOutputRange),
+            maTextureTransform(),
+            maBackTextureTransform(),
+            mfDistance(0.1),
             mfAngle(fAngle),
-            mnSteps(10L)
+            mnSteps(10),
+            mbDefinitionRangeEqualsOutputRange(rDefinitionRange == rOutputRange)
         {
-            double fTargetSizeX(rTargetRange.getWidth());
-            double fTargetSizeY(rTargetRange.getHeight());
-            double fTargetOffsetX(rTargetRange.getMinX());
-            double fTargetOffsetY(rTargetRange.getMinY());
+            double fTargetSizeX(rDefinitionRange.getWidth());
+            double fTargetSizeY(rDefinitionRange.getHeight());
+            double fTargetOffsetX(rDefinitionRange.getMinX());
+            double fTargetOffsetY(rDefinitionRange.getMinY());
 
             fAngle = -fAngle;
 
@@ -559,6 +617,7 @@ namespace drawinglayer
         {
             const GeoTexSvxHatch* pCompare = dynamic_cast< const GeoTexSvxHatch* >(&rGeoTexSvx);
             return (pCompare
+                && maOutputRange == pCompare->maOutputRange
                 && maTextureTransform == pCompare->maTextureTransform
                 && mfDistance == pCompare->mfDistance
                 && mfAngle == pCompare->mfAngle
@@ -567,13 +626,54 @@ namespace drawinglayer
 
         void GeoTexSvxHatch::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices)
         {
-            for(sal_uInt32 a(1L); a < mnSteps; a++)
+            if(mbDefinitionRangeEqualsOutputRange)
             {
-                // create matrix
-                const double fOffset(mfDistance * (double)a);

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list